1 Star 0 Fork 100

fly_fzc/openssl

forked from src-openEuler/openssl 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Revert-Release-the-drbg-in-the-global-default-contex.patch 3.40 KB
一键复制 编辑 原始数据 按行查看 历史
From 9a12f01f6e784c8cf714442014573d010266182d Mon Sep 17 00:00:00 2001
From: hzero1996 <[email protected]>
Date: Fri, 31 May 2024 16:55:10 +0800
Subject: [PATCH] Revert "Release the drbg in the global default context before
engines"
This reverts commit d0f8056c47f7aea40a34815fe459404f14501e81.
The fix patch for 3.1 will be merged later: d5c02e2de86a28ab2c06e866f0db858c43d00355
---
crypto/context.c | 15 ---------------
crypto/rand/rand_lib.c | 5 ++---
include/crypto/rand.h | 1 -
include/internal/cryptlib.h | 2 --
4 files changed, 2 insertions(+), 21 deletions(-)
diff --git a/crypto/context.c b/crypto/context.c
index 548665fba2..bdfc4d02a3 100644
--- a/crypto/context.c
+++ b/crypto/context.c
@@ -15,7 +15,6 @@
#include "internal/bio.h"
#include "internal/provider.h"
#include "crypto/ctype.h"
-#include "crypto/rand.h"
struct ossl_lib_ctx_onfree_list_st {
ossl_lib_ctx_onfree_fn *fn;
@@ -272,20 +271,6 @@ OSSL_LIB_CTX *OSSL_LIB_CTX_set0_default(OSSL_LIB_CTX *libctx)
return NULL;
}
-
-void ossl_release_default_drbg_ctx(void)
-{
- int dynidx = default_context_int.dyn_indexes[OSSL_LIB_CTX_DRBG_INDEX];
-
- /* early release of the DRBG in global default libctx, no locking */
- if (dynidx != -1) {
- void *data;
-
- data = CRYPTO_get_ex_data(&default_context_int.data, dynidx);
- ossl_rand_ctx_free(data);
- CRYPTO_set_ex_data(&default_context_int.data, dynidx, NULL);
- }
-}
#endif
OSSL_LIB_CTX *ossl_lib_ctx_get_concrete(OSSL_LIB_CTX *ctx)
diff --git a/crypto/rand/rand_lib.c b/crypto/rand/rand_lib.c
index 5fde214448..edfae865b6 100644
--- a/crypto/rand/rand_lib.c
+++ b/crypto/rand/rand_lib.c
@@ -96,7 +96,6 @@ void ossl_rand_cleanup_int(void)
CRYPTO_THREAD_lock_free(rand_meth_lock);
rand_meth_lock = NULL;
# endif
- ossl_release_default_drbg_ctx();
rand_inited = 0;
}
@@ -476,7 +475,7 @@ static void *rand_ossl_ctx_new(OSSL_LIB_CTX *libctx)
return NULL;
}
-void ossl_rand_ctx_free(void *vdgbl)
+static void rand_ossl_ctx_free(void *vdgbl)
{
RAND_GLOBAL *dgbl = vdgbl;
@@ -501,7 +500,7 @@ void ossl_rand_ctx_free(void *vdgbl)
static const OSSL_LIB_CTX_METHOD rand_drbg_ossl_ctx_method = {
OSSL_LIB_CTX_METHOD_PRIORITY_2,
rand_ossl_ctx_new,
- ossl_rand_ctx_free,
+ rand_ossl_ctx_free,
};
static RAND_GLOBAL *rand_get_global(OSSL_LIB_CTX *libctx)
diff --git a/include/crypto/rand.h b/include/crypto/rand.h
index 165deaf95c..6a71a339c8 100644
--- a/include/crypto/rand.h
+++ b/include/crypto/rand.h
@@ -125,5 +125,4 @@ void ossl_rand_cleanup_nonce(ossl_unused const OSSL_CORE_HANDLE *handle,
size_t ossl_pool_acquire_entropy(RAND_POOL *pool);
int ossl_pool_add_nonce_data(RAND_POOL *pool);
-void ossl_rand_ctx_free(void *vdgbl);
#endif
diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h
index 934d4b089c..1291299b6e 100644
--- a/include/internal/cryptlib.h
+++ b/include/internal/cryptlib.h
@@ -199,8 +199,6 @@ int ossl_lib_ctx_run_once(OSSL_LIB_CTX *ctx, unsigned int idx,
int ossl_lib_ctx_onfree(OSSL_LIB_CTX *ctx, ossl_lib_ctx_onfree_fn onfreefn);
const char *ossl_lib_ctx_get_descriptor(OSSL_LIB_CTX *libctx);
-void ossl_release_default_drbg_ctx(void);
-
OSSL_LIB_CTX *ossl_crypto_ex_data_get_ossl_lib_ctx(const CRYPTO_EX_DATA *ad);
int ossl_crypto_new_ex_data_ex(OSSL_LIB_CTX *ctx, int class_index, void *obj,
CRYPTO_EX_DATA *ad);
--
2.33.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fly_fzc/openssl.git
[email protected]:fly_fzc/openssl.git
fly_fzc
openssl
openssl
master

搜索帮助