summaryrefslogtreecommitdiffstats
path: root/providers/implementations/digests/sha2_prov.c
diff options
context:
space:
mode:
authorPauli <ppzgs1@gmail.com>2021-03-03 09:20:21 +1000
committerPauli <ppzgs1@gmail.com>2021-03-12 08:27:21 +1000
commit5506cd0bbd874b164f59e3e6a6a530426a2b38bf (patch)
treec4bc9dae24676165bad332bfb3e87ea583c975dd /providers/implementations/digests/sha2_prov.c
parent5a7e999114562e5d9b696effac550d9d141ff087 (diff)
prov: update digests to support modified ctx params
Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/14383)
Diffstat (limited to 'providers/implementations/digests/sha2_prov.c')
-rw-r--r--providers/implementations/digests/sha2_prov.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/providers/implementations/digests/sha2_prov.c b/providers/implementations/digests/sha2_prov.c
index 96f4cc7004..3b731796bd 100644
--- a/providers/implementations/digests/sha2_prov.c
+++ b/providers/implementations/digests/sha2_prov.c
@@ -45,13 +45,16 @@ static int sha1_set_ctx_params(void *vctx, const OSSL_PARAM params[])
const OSSL_PARAM *p;
SHA_CTX *ctx = (SHA_CTX *)vctx;
- if (ctx != NULL && params != NULL) {
- p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_SSL3_MS);
- if (p != NULL && p->data_type == OSSL_PARAM_OCTET_STRING)
- return ossl_sha1_ctrl(ctx, EVP_CTRL_SSL3_MASTER_SECRET,
- p->data_size, p->data);
- }
- return 0;
+ if (ctx == NULL)
+ return 0;
+ if (params == NULL)
+ return 1;
+
+ p = OSSL_PARAM_locate_const(params, OSSL_DIGEST_PARAM_SSL3_MS);
+ if (p != NULL && p->data_type == OSSL_PARAM_OCTET_STRING)
+ return ossl_sha1_ctrl(ctx, EVP_CTRL_SSL3_MASTER_SECRET,
+ p->data_size, p->data);
+ return 1;
}
/* ossl_sha1_functions */