X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=include%2Finternal%2Fcryptlib.h;fp=crypto%2Finclude%2Finternal%2Fcryptlib.h;h=c73c7542424723d02a31b8b96d85a09b76a16d1b;hp=d2ab720d34e8edd174a459cfd24df9dcacb07ee1;hb=67dc995eaf538ea309c6292a1a5073465201f55b;hpb=5bd05e579994c756cd994b5e0ff5f395aae6bfff diff --git a/crypto/include/internal/cryptlib.h b/include/internal/cryptlib.h similarity index 84% rename from crypto/include/internal/cryptlib.h rename to include/internal/cryptlib.h index d2ab720d34..c73c754242 100644 --- a/crypto/include/internal/cryptlib.h +++ b/include/internal/cryptlib.h @@ -30,6 +30,23 @@ extern "C" { #endif +#ifdef NDEBUG +# define ossl_assert(x) ((x) != 0) +#else +__owur static ossl_inline int ossl_assert_int(int expr, const char *exprstr, + const char *file, int line) +{ + if (!expr) + OPENSSL_die(exprstr, file, line); + + return expr; +} + +# define ossl_assert(x) ossl_assert_int((x) != 0, "Assertion failed: "#x, \ + __FILE__, __LINE__) + +#endif + typedef struct ex_callback_st EX_CALLBACK; DEFINE_STACK_OF(EX_CALLBACK)