summaryrefslogtreecommitdiffstats
path: root/crypto/sm2
diff options
context:
space:
mode:
authorPaul Yang <yang.yang@baishancloud.com>2019-01-16 16:16:28 +0800
committerPaul Yang <yang.yang@baishancloud.com>2019-02-27 10:05:17 +0800
commita7cef52f9b961dcb1e5d0c3b75185a12a88ad2db (patch)
tree59936955f2e1df867bf4727195823b9f2d051463 /crypto/sm2
parent4089b4340701e3c13e07169e67a7d14519c98658 (diff)
Support raw input data in apps/pkeyutl
Some signature algorithms require special treatment for digesting, such as SM2. This patch adds the ability of handling raw input data in apps/pkeyutl other than accepting only pre-hashed input data. Beside, SM2 requries an ID string when signing or verifying a piece of data, this patch also adds the ability for apps/pkeyutil to specify that ID string. Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/8186)
Diffstat (limited to 'crypto/sm2')
-rw-r--r--crypto/sm2/sm2_pmeth.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/sm2/sm2_pmeth.c b/crypto/sm2/sm2_pmeth.c
index 8ae7556361..5ca430f515 100644
--- a/crypto/sm2/sm2_pmeth.c
+++ b/crypto/sm2/sm2_pmeth.c
@@ -248,6 +248,9 @@ static int pkey_sm2_ctrl_str(EVP_PKEY_CTX *ctx,
else
return -2;
return EVP_PKEY_CTX_set_ec_param_enc(ctx, param_enc);
+ } else if (strcmp(type, "sm2_id") == 0) {
+ return pkey_sm2_ctrl(ctx, EVP_PKEY_CTRL_SET1_ID,
+ (int)strlen(value), (void *)value);
}
return -2;