]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix missing propq in sm2
authorShane Lontis <shane.lontis@oracle.com>
Tue, 22 Sep 2020 05:56:11 +0000 (15:56 +1000)
committerShane Lontis <shane.lontis@oracle.com>
Wed, 23 Sep 2020 07:31:40 +0000 (17:31 +1000)
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12944)

crypto/sm2/sm2_pmeth.c

index 665e278d1faa2b651152f805f8aa781820e7c52f..32713a5ac48f936a9ebb28bdc7acbb5869897b7e 100644 (file)
@@ -130,6 +130,7 @@ static int pkey_sm2_encrypt(EVP_PKEY_CTX *ctx,
     SM2_PKEY_CTX *dctx = ctx->data;
     const EVP_MD *md = (dctx->md == NULL) ? EVP_sm3() : dctx->md;
     OPENSSL_CTX *libctx = ec_key_get_libctx(ec);
+    const char *propq = ec_key_get0_propq(ec);
     EVP_MD *fetched_md = NULL;
 
     if (out == NULL) {
@@ -139,7 +140,7 @@ static int pkey_sm2_encrypt(EVP_PKEY_CTX *ctx,
             return 1;
     }
 
-    fetched_md = EVP_MD_fetch(libctx, EVP_MD_name(md), 0);
+    fetched_md = EVP_MD_fetch(libctx, EVP_MD_name(md), propq);
     if (fetched_md == NULL)
         return 0;
     ret = sm2_encrypt(ec, fetched_md, in, inlen, out, outlen);
@@ -156,6 +157,7 @@ static int pkey_sm2_decrypt(EVP_PKEY_CTX *ctx,
     SM2_PKEY_CTX *dctx = ctx->data;
     const EVP_MD *md = (dctx->md == NULL) ? EVP_sm3() : dctx->md;
     OPENSSL_CTX *libctx = ec_key_get_libctx(ec);
+    const char *propq = ec_key_get0_propq(ec);
     EVP_MD *fetched_md = NULL;
 
     if (out == NULL) {
@@ -165,7 +167,7 @@ static int pkey_sm2_decrypt(EVP_PKEY_CTX *ctx,
             return 1;
     }
 
-    fetched_md = EVP_MD_fetch(libctx, EVP_MD_name(md), 0);
+    fetched_md = EVP_MD_fetch(libctx, EVP_MD_name(md), propq);
     if (fetched_md == NULL)
         return 0;
     ret = sm2_decrypt(ec, fetched_md, in, inlen, out, outlen);