[PATCH v2 2/3] x86/sgx: Fix compatibility issue with OPENSSL < 1.1.0

From: Raoul Strackx
Date: Mon Apr 12 2021 - 05:31:23 EST


The `RSA_get0_key` function only got introduced in OpenSSL 1.1.0. This
makes compilation fail with older versions.

Signed-off-by: Raoul Strackx <raoul.strackx@xxxxxxxxxxxx>
---
tools/testing/selftests/sgx/sigstruct.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/sgx/sigstruct.c b/tools/testing/selftests/sgx/sigstruct.c
index dee7a3d..aac9cbc 100644
--- a/tools/testing/selftests/sgx/sigstruct.c
+++ b/tools/testing/selftests/sgx/sigstruct.c
@@ -128,8 +128,11 @@ static bool check_crypto_errors(void)
static inline const BIGNUM *get_modulus(RSA *key)
{
const BIGNUM *n;
-
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
RSA_get0_key(key, &n, NULL, NULL);
+#else
+ n = key->n;
+#endif
return n;
}

--
2.7.4