Skip to content

Commit

Permalink
Define OpenSSL guard iff OQS_USE_OPENSSL is set
Browse files Browse the repository at this point in the history
Signed-off-by: Spencer Wilson <[email protected]>
  • Loading branch information
SWilson4 committed Jul 29, 2024
1 parent 799a38c commit f3248ce
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,24 +43,26 @@ extern "C" {
* This is a temporary workaround until a better error
* handling strategy is developed.
*/
#if defined(OQS_USE_OPENSSL) && !defined(OPENSSL_NO_STDIO)
#ifdef OQS_USE_OPENSSL
#ifdef OPENSSL_NO_STDIO
#define OQS_OPENSSL_GUARD(x) \
do { \
if( 1 != (x) ) { \
fprintf(stderr, "Error return value from OpenSSL API: %d. Exiting.\n", x); \
OSSL_FUNC(ERR_print_errors_fp)(stderr); \
exit(EXIT_FAILURE); \
} \
} while (0)
#else
#else // OPENSSL_NO_STDIO
#define OQS_OPENSSL_GUARD(x) \
do { \
if( 1 != (x) ) { \
fprintf(stderr, "Error return value from OpenSSL API: %d. Exiting.\n", x); \
OSSL_FUNC(ERR_print_errors_fp)(stderr); \
exit(EXIT_FAILURE); \
} \
} while (0)
#endif // defined(OQS_USE_OPENSSL) && !defined(OPENSSL_NO_STDIO)
#endif // OPENSSL_NO_STDIO
#endif // OQS_USE_OPENSSL

/**
* Certain functions (such as OQS_randombytes_openssl in
Expand Down

0 comments on commit f3248ce

Please sign in to comment.