Blame SOURCES/opencryptoki-openssl3-c4683eb904238d20cb34a4c7661ffac04901283c.patch

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