diff options
author | Paul Yang <kaishen.yy@antfin.com> | 2020-03-04 23:49:43 +0800 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2020-09-22 08:18:09 +0100 |
commit | d0b79f8631c0f522c514175be4e4fbe984cf8f6c (patch) | |
tree | 4606888f35caaf5c2d6646ac4da4d98d75ab5d56 /include | |
parent | 7ee511d093758360ed421e420cc29d9aaf11f143 (diff) |
Add SM2 signature algorithm to default provider
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/12536)
Diffstat (limited to 'include')
-rw-r--r-- | include/crypto/sm2.h | 9 | ||||
-rw-r--r-- | include/crypto/sm2err.h | 8 | ||||
-rw-r--r-- | include/openssl/core_names.h | 1 |
3 files changed, 11 insertions, 7 deletions
diff --git a/include/crypto/sm2.h b/include/crypto/sm2.h index 4a65ce4332..a83c20b7af 100644 --- a/include/crypto/sm2.h +++ b/include/crypto/sm2.h @@ -45,14 +45,14 @@ int sm2_do_verify(const EC_KEY *key, /* * SM2 signature generation. */ -int sm2_sign(const unsigned char *dgst, int dgstlen, - unsigned char *sig, unsigned int *siglen, EC_KEY *eckey); +int sm2_internal_sign(const unsigned char *dgst, int dgstlen, + unsigned char *sig, unsigned int *siglen, EC_KEY *eckey); /* * SM2 signature verification. */ -int sm2_verify(const unsigned char *dgst, int dgstlen, - const unsigned char *sig, int siglen, EC_KEY *eckey); +int sm2_internal_verify(const unsigned char *dgst, int dgstlen, + const unsigned char *sig, int siglen, EC_KEY *eckey); /* * SM2 encryption @@ -74,5 +74,6 @@ int sm2_decrypt(const EC_KEY *key, const uint8_t *ciphertext, size_t ciphertext_len, uint8_t *ptext_buf, size_t *ptext_len); +const unsigned char *sm2_algorithmidentifier_encoding(int md_nid, size_t *len); # endif /* OPENSSL_NO_SM2 */ #endif diff --git a/include/crypto/sm2err.h b/include/crypto/sm2err.h index d0b04baf71..bbbb0cfecf 100644 --- a/include/crypto/sm2err.h +++ b/include/crypto/sm2err.h @@ -1,6 +1,6 @@ /* * Generated by util/mkerr.pl DO NOT EDIT - * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the Apache License 2.0 (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -8,8 +8,8 @@ * https://www.openssl.org/source/license.html */ -#ifndef OSSL_CRYPTO_SM2ERR_H -# define OSSL_CRYPTO_SM2ERR_H +#ifndef OPENSSL_SM2ERR_H +# define OPENSSL_SM2ERR_H # include <openssl/opensslconf.h> # include <openssl/symhacks.h> @@ -39,6 +39,8 @@ int ERR_load_SM2_strings(void); # define SM2_F_SM2_COMPUTE_Z_DIGEST 0 # define SM2_F_SM2_DECRYPT 0 # define SM2_F_SM2_ENCRYPT 0 +# define SM2_F_SM2_INTERNAL_SIGN 0 +# define SM2_F_SM2_INTERNAL_VERIFY 0 # define SM2_F_SM2_PLAINTEXT_SIZE 0 # define SM2_F_SM2_SIGN 0 # define SM2_F_SM2_SIG_GEN 0 diff --git a/include/openssl/core_names.h b/include/openssl/core_names.h index d17ab49700..a1c73a86df 100644 --- a/include/openssl/core_names.h +++ b/include/openssl/core_names.h @@ -142,6 +142,7 @@ extern "C" { #define OSSL_DIGEST_NAME_SHA3_512 "SHA3-512" #define OSSL_DIGEST_NAME_KECCAK_KMAC128 "KECCAK-KMAC-128" #define OSSL_DIGEST_NAME_KECCAK_KMAC256 "KECCAK-KMAC-256" +#define OSSL_DIGEST_NAME_SM3 "SM3" /* MAC parameters */ #define OSSL_MAC_PARAM_KEY "key" /* octet string */ |