Syntax errors in crypto.h

Don Payette payettedon at gmail.com
Tue Aug 15 14:01:15 UTC 2023


I'm converting an existing Winsock app to have encryption by using OpenSSL.
I'm getting syntax errors attempting to compile my app. My environment is
Microsoft Visual C++.
I downloaded and installed the OpenSSL pre-compiled binaries and added the
following to the Include Directories.

   C:\Program Files\OpenSSL-Win64\includes

In my existing Socket.cpp file I added OpenSSL includes:

#include <stdio.h>
#include <string.h>
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <signal.h>



Severity Code                Description
                                               Project File

             Line

Error (active) E0077 this declaration has no storage class or type
specifier DFDS C:\Program Files\OpenSSL-Win64\include\openssl\crypto.h 344
Error (active) E0065 expected a ';'
  DFDS C:\Program Files\OpenSSL-Win64\include\openssl\crypto.h 344
OSSL_CRYPTO_ALLOC void *CRYPTO_malloc(size_t num, const char *file, int
line);

The definition of OSSL_CRYPTO_ALLOC is in macros.h:

# ifndef OSSL_CRYPTO_ALLOC
#  if defined(__GNUC__)
#   define OSSL_CRYPTO_ALLOC __attribute__((malloc))
#  elif defined(_MSC_VER)
#   define OSSL_CRYPTO_ALLOC __declspec(restrict)
#  else
#   define OSSL_CRYPTO_ALLOC
#  endif
# endif


I figure it is using the _MSC_VER define, which is the __declspec one.

Any ideas what it is complaining about?

Don Payette
(cell) 479-216-6320 <(479)%20216-6320>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mta.openssl.org/pipermail/openssl-users/attachments/20230815/870fc318/attachment.htm>


More information about the openssl-users mailing list