diff options
author | Paul Yang <yang.yang@baishancloud.com> | 2018-09-03 19:24:55 +0200 |
---|---|---|
committer | Paul Yang <yang.yang@baishancloud.com> | 2018-09-07 12:12:26 +0200 |
commit | 00433bad41bfa492f2e204675d42061314028ff2 (patch) | |
tree | 3be74f013f2cc7900f301e6f67dc753137393566 /crypto/include | |
parent | Support pmeth->digest_custom (diff) | |
download | openssl-00433bad41bfa492f2e204675d42061314028ff2.tar.xz openssl-00433bad41bfa492f2e204675d42061314028ff2.zip |
Make SM2 ID stick to specification
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7113)
Diffstat (limited to 'crypto/include')
-rw-r--r-- | crypto/include/internal/sm2.h | 14 |
1 files changed, 12 insertions, 2 deletions
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. |