summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslontis <shane.lontis@oracle.com>2022-06-23 13:10:55 +1000
committerHugo Landau <hlandau@openssl.org>2022-06-28 19:56:19 +0100
commit47741c539f70b26389268fdbc9b160b3a174bbca (patch)
tree4c3e026f0f4686306481082e570bf1c83c07ddc5
parent89c36afabcfd4af22194155f6775c505702b48ff (diff)
kdf objects missing a return if malloc fails.
I have searched through all references of ERR_R_MALLOC_FAILURE for any other instances.. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> Reviewed-by: Hugo Landau <hlandau@openssl.org> (Merged from https://github.com/openssl/openssl/pull/18638) (cherry picked from commit 7260709e9ef155c8b3fccaa32e8ba496a3059905)
-rw-r--r--providers/implementations/kdfs/tls1_prf.c4
-rw-r--r--providers/implementations/kdfs/x942kdf.c6
2 files changed, 7 insertions, 3 deletions
diff --git a/providers/implementations/kdfs/tls1_prf.c b/providers/implementations/kdfs/tls1_prf.c
index 19c5ad3d3e..a4d64b9352 100644
--- a/providers/implementations/kdfs/tls1_prf.c
+++ b/providers/implementations/kdfs/tls1_prf.c
@@ -102,8 +102,10 @@ static void *kdf_tls1_prf_new(void *provctx)
if (!ossl_prov_is_running())
return NULL;
- if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL)
+ if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL) {
ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
ctx->provctx = provctx;
return ctx;
}
diff --git a/providers/implementations/kdfs/x942kdf.c b/providers/implementations/kdfs/x942kdf.c
index c2cc94a192..6305fce616 100644
--- a/providers/implementations/kdfs/x942kdf.c
+++ b/providers/implementations/kdfs/x942kdf.c
@@ -332,10 +332,12 @@ static void *x942kdf_new(void *provctx)
KDF_X942 *ctx;
if (!ossl_prov_is_running())
- return 0;
+ return NULL;
- if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL)
+ if ((ctx = OPENSSL_zalloc(sizeof(*ctx))) == NULL) {
ERR_raise(ERR_LIB_PROV, ERR_R_MALLOC_FAILURE);
+ return NULL;
+ }
ctx->provctx = provctx;
ctx->use_keybits = 1;
return ctx;