From 00433bad41bfa492f2e204675d42061314028ff2 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Tue, 4 Sep 2018 01:24:55 +0800 Subject: Make SM2 ID stick to specification Reviewed-by: Tim Hudson Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/7113) --- crypto/include/internal/sm2.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'crypto/include') diff --git a/crypto/include/internal/sm2.h b/crypto/include/internal/sm2.h index 11af248b5a..26a90660ee 100644 --- a/crypto/include/internal/sm2.h +++ b/crypto/include/internal/sm2.h @@ -20,18 +20,28 @@ /* The default user id as specified in GM/T 0009-2012 */ # define SM2_DEFAULT_USERID "1234567812345678" +int sm2_compute_userid_digest(uint8_t *out, + const EVP_MD *digest, + const uint8_t *id, + const size_t id_len, + const EC_KEY *key); + /* * SM2 signature operation. Computes ZA (user id digest) and then signs * H(ZA || msg) using SM2 */ ECDSA_SIG *sm2_do_sign(const EC_KEY *key, const EVP_MD *digest, - const char *user_id, const uint8_t *msg, size_t msg_len); + const uint8_t *id, + const size_t id_len, + const uint8_t *msg, size_t msg_len); int sm2_do_verify(const EC_KEY *key, const EVP_MD *digest, const ECDSA_SIG *signature, - const char *user_id, const uint8_t *msg, size_t msg_len); + const uint8_t *id, + const size_t id_len, + const uint8_t *msg, size_t msg_len); /* * SM2 signature generation. -- cgit v1.2.3