Syntax errors in crypto.h
Don Payette
payettedon at gmail.com
Wed Aug 23 21:51:31 UTC 2023
OK, Richard, I tried your suggestion and it worked:
#define OSSL_CRYPTO_ALLOC
#define OSSL_DEPRECATEDIN_3_1
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
I no longer get syntax errors.
Don Payette
(cell) 479-216-6320 <(479)%20216-6320>
On Sat, Aug 19, 2023 at 6:37 AM Don Payette <payettedon at gmail.com> wrote:
> Nope. I changed macros.h from:
>
> # 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
>
> to:
>
> # ifndef OSSL_CRYPTO_ALLOC
> # if defined(__GNUC__)
> # define OSSL_CRYPTO_ALLOC __attribute__((malloc))
> # elif defined(_MSC_VER)
> # define OSSL_CRYPTO_ALLOC
> # else
> # define OSSL_CRYPTO_ALLOC
> # endif
> # endif
>
> And still got a syntax error. Expecting ";".
>
> Don Payette
> (cell) 479-216-6320 <(479)%20216-6320>
>
>
> On Sat, Aug 19, 2023 at 12:45 AM Richard Levitte <levitte at openssl.org>
> wrote:
>
>> It should be possible to have this define in your code before including
>> any openssl header:
>>
>> #define OSSL_CRYPTO_ALLOC
>>
>> Is that what you did?
>>
>> Cheers
>> Richard
>>
>>
>> Don Payette <payettedon at gmail.com> skrev: (19 augusti 2023 04:58:13 CEST)
>>
>>> Well, I did some experimenting. I changed
>>> OSSL_CRYPTO_ALLOC void *CRYPTO_malloc(size_t num, const char *file, int
>>> line);
>>>
>>> to
>>>
>>> void *CRYPTO_malloc(size_t num, const char *file, int line);
>>>
>>> And it compiled. I tried changing the OSSL_CRYPTO_ALLOC define to
>>> define it as blank. But that still gets a syntax
>>> error saying it expects a ";" before the "void *". That seems odd to me.
>>>
>>>
>>> Don Payette
>>> (cell) 479-216-6320 <(479)%20216-6320>
>>>
>>>
>>> On Tue, Aug 15, 2023 at 9:01 AM Don Payette <payettedon at gmail.com>
>>> wrote:
>>>
>>>> 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/20230823/b2093571/attachment.htm>
More information about the openssl-users
mailing list