commit c4683eb904238d20cb34a4c7661ffac04901283c Author: Ingo Franzki Date: Tue Jun 29 17:35:30 2021 +0200 COMMON: Add OPENSSL_VERSION_PREREQ macro to check for OpenSSL version Make the OPENSSL_VERSION_PREREQ macro available independent of the used OpenSSL version, so that the code can easily check for the OpenSSL version it is compiled with. Signed-off-by: Ingo Franzki diff --git a/usr/lib/common/defs.h b/usr/lib/common/defs.h index 22d75d2d..8ab50517 100644 --- a/usr/lib/common/defs.h +++ b/usr/lib/common/defs.h @@ -17,6 +17,20 @@ #ifndef _DEFS_H #define _DEFS_H +#include + +#ifndef OPENSSL_VERSION_PREREQ + #if defined(OPENSSL_VERSION_MAJOR) && defined(OPENSSL_VERSION_MINOR) + #define OPENSSL_VERSION_PREREQ(maj, min) \ + ((OPENSSL_VERSION_MAJOR << 16) + \ + OPENSSL_VERSION_MINOR >= ((maj) << 16) + (min)) + #else + #define OPENSSL_VERSION_PREREQ(maj, min) \ + (OPENSSL_VERSION_NUMBER >= (((maj) << 28) | \ + ((min) << 20))) + #endif +#endif + #define MAX_SESSION_COUNT 64 #define MAX_PIN_LEN 8 #define MIN_PIN_LEN 4