Suppress an error when doing SM2 sign/verify ops
authorPaul Yang <kaishen.yy@antfin.com>
Mon, 28 Oct 2019 12:14:53 +0000 (20:14 +0800)
committerPaul Yang <kaishen.yy@antfin.com>
Tue, 29 Oct 2019 12:36:05 +0000 (20:36 +0800)
This was fixed in #8321 right after the 1.1.1 was released but never
back ported to 1.1.1. Now fix it.

Issue reported from lua-openssl project.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10278)

crypto/sm2/sm2_pmeth.c

index 62a5b5534df6978cb654ea4e185ecaf34e1b2910..b42a14c32f265a76c4263a512426c8143d348d6c 100644 (file)
@@ -220,6 +220,10 @@ static int pkey_sm2_ctrl(EVP_PKEY_CTX *ctx, int type, int p1, void *p2)
         *(size_t *)p2 = smctx->id_len;
         return 1;
 
+    case EVP_PKEY_CTRL_DIGESTINIT:
+        /* nothing to be inited, this is to suppress the error... */
+        return 1;
+
     default:
         return -2;
     }