From bb21d0e626d59cbaacc44842b719824d50fe098a Mon Sep 17 00:00:00 2001 From: huangji Date: Tue, 8 Apr 2025 18:18:20 +0800 Subject: [PATCH] add openssl3 compat Signed-off-by: huangji --- src/storage/gstor/zekernel/common/cm_encrypt.c | 3 ++- src/storage/gstor/zekernel/common/cm_encrypt.h | 4 ++++ src/storage/gstor/zekernel/common/cm_entropy.h | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/storage/gstor/zekernel/common/cm_encrypt.c b/src/storage/gstor/zekernel/common/cm_encrypt.c index 214eaf0..46ed40a 100644 --- a/src/storage/gstor/zekernel/common/cm_encrypt.c +++ b/src/storage/gstor/zekernel/common/cm_encrypt.c @@ -289,6 +289,7 @@ status_t cm_encyrpt_init(cm_encrypt_ctrl *ctrl, cipher_alg_type alg_type, uchar status_t cm_init_drbg(void) { +#if OPENSSL_VERSION_NUMBER < 0x30000000L RAND_DRBG *master_drbg = NULL; master_drbg = RAND_DRBG_get0_master(); @@ -316,7 +317,7 @@ status_t cm_init_drbg(void) GS_THROW_ERROR(ERR_RANDOM_INIT); return GS_ERROR; } - +#endif return GS_SUCCESS; } diff --git a/src/storage/gstor/zekernel/common/cm_encrypt.h b/src/storage/gstor/zekernel/common/cm_encrypt.h index 7743128..19b5f36 100644 --- a/src/storage/gstor/zekernel/common/cm_encrypt.h +++ b/src/storage/gstor/zekernel/common/cm_encrypt.h @@ -27,7 +27,11 @@ #include "cm_defs.h" #include "cm_text.h" #include "openssl/evp.h" +#if OPENSSL_VERSION_NUMBER < 0x30000000L #include "openssl/rand_drbg.h" +#else +#include "openssl/rand.h" +#endif #include "openssl/ssl.h" #ifdef __cplusplus diff --git a/src/storage/gstor/zekernel/common/cm_entropy.h b/src/storage/gstor/zekernel/common/cm_entropy.h index 1390a72..440ecba 100644 --- a/src/storage/gstor/zekernel/common/cm_entropy.h +++ b/src/storage/gstor/zekernel/common/cm_entropy.h @@ -25,8 +25,12 @@ #define __CM_ENTROPY_H__ #include "cm_defs.h" -#include "openssl/rand_drbg.h" #include "openssl/evp.h" +#if OPENSSL_VERSION_NUMBER < 0x30000000L +#include "openssl/rand_drbg.h" +#else +#include "openssl/rand.h" +#endif #ifdef __cplusplus extern "C" { -- Gitee