Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/openssl/openssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Levitte <levitte@openssl.org>2020-04-29 07:55:40 +0300
committerRichard Levitte <levitte@openssl.org>2020-05-14 11:05:29 +0300
commitbcb018e70b596811146a17d95532498bbe3ef13a (patch)
tree2c6a87b8b076f496b45a71be9a15e0e522fd0993
parentc4e3a727209b8ae165a0abe085488845e246ea0e (diff)
EVP: Only use the engine when one is defined, in pkey_mac_ctrl()
Fixes #11671 Reviewed-by: Shane Lontis <shane.lontis@oracle.com> (Merged from https://github.com/openssl/openssl/pull/11674)
-rw-r--r--crypto/evp/pkey_mac.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/crypto/evp/pkey_mac.c b/crypto/evp/pkey_mac.c
index 56231e3938..3503aac6d3 100644
--- a/crypto/evp/pkey_mac.c
+++ b/crypto/evp/pkey_mac.c
@@ -308,11 +308,14 @@ static int pkey_mac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
OSSL_PARAM params[3];
size_t params_n = 0;
char *ciphname = (char *)OBJ_nid2sn(EVP_CIPHER_nid(p2));
+
#ifndef OPENSSL_NO_ENGINE
- char *engineid = (char *)ENGINE_get_id(ctx->engine);
+ if (ctx->engine != NULL) {
+ char *engid = (char *)ENGINE_get_id(ctx->engine);
- params[params_n++] =
- OSSL_PARAM_construct_utf8_string("engine", engineid, 0);
+ params[params_n++] =
+ OSSL_PARAM_construct_utf8_string("engine", engid, 0);
+ }
#endif
params[params_n++] =
OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_CIPHER,
@@ -458,13 +461,14 @@ static int pkey_mac_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
size_t params_n = 0;
char *mdname =
(char *)OBJ_nid2sn(EVP_MD_nid(hctx->raw_data.md));
+
#ifndef OPENSSL_NO_ENGINE
- char *engineid = ctx->engine == NULL
- ? NULL : (char *)ENGINE_get_id(ctx->engine);
+ if (ctx->engine != NULL) {
+ char *engid = (char *)ENGINE_get_id(ctx->engine);
- if (engineid != NULL)
params[params_n++] =
- OSSL_PARAM_construct_utf8_string("engine", engineid, 0);
+ OSSL_PARAM_construct_utf8_string("engine", engid, 0);
+ }
#endif
params[params_n++] =
OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,