diff options
author | Matt Caswell <matt@openssl.org> | 2018-05-31 15:53:30 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2018-06-04 11:59:56 +0100 |
commit | 2167239abaec5fa44072fa1194505af0b3fced89 (patch) | |
tree | 60528bbddc4973d9c660c66370f8cd9c33047642 /crypto/sm2 | |
parent | 206521a06efe10d1eafac5b313ce42850fd75136 (diff) |
Use lowercase for internal SM2 symbols
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6386)
Diffstat (limited to 'crypto/sm2')
-rw-r--r-- | crypto/sm2/sm2_crypt.c | 18 | ||||
-rw-r--r-- | crypto/sm2/sm2_err.c | 18 | ||||
-rw-r--r-- | crypto/sm2/sm2_sign.c | 28 | ||||
-rw-r--r-- | crypto/sm2/sm2_za.c | 2 |
4 files changed, 33 insertions, 33 deletions
diff --git a/crypto/sm2/sm2_crypt.c b/crypto/sm2/sm2_crypt.c index 568a423541..0fe1dd835f 100644 --- a/crypto/sm2/sm2_crypt.c +++ b/crypto/sm2/sm2_crypt.c @@ -37,7 +37,7 @@ ASN1_SEQUENCE(SM2_Ciphertext) = { IMPLEMENT_ASN1_FUNCTIONS(SM2_Ciphertext) -static size_t EC_field_size(const EC_GROUP *group) +static size_t ec_field_size(const EC_GROUP *group) { /* Is there some simpler way to do this? */ BIGNUM *p = BN_new(); @@ -59,10 +59,10 @@ static size_t EC_field_size(const EC_GROUP *group) return field_size; } -int SM2_plaintext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len, +int sm2_plaintext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len, size_t *pt_size) { - const size_t field_size = EC_field_size(EC_KEY_get0_group(key)); + const size_t field_size = ec_field_size(EC_KEY_get0_group(key)); const int md_size = EVP_MD_size(digest); size_t overhead; @@ -85,10 +85,10 @@ int SM2_plaintext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len, return 1; } -int SM2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len, +int sm2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len, size_t *ct_size) { - const size_t field_size = EC_field_size(EC_KEY_get0_group(key)); + const size_t field_size = ec_field_size(EC_KEY_get0_group(key)); const int md_size = EVP_MD_size(digest); if (field_size == 0 || md_size < 0) @@ -98,7 +98,7 @@ int SM2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len, return 1; } -int SM2_encrypt(const EC_KEY *key, +int sm2_encrypt(const EC_KEY *key, const EVP_MD *digest, const uint8_t *msg, size_t msg_len, uint8_t *ciphertext_buf, size_t *ciphertext_len) @@ -121,7 +121,7 @@ int SM2_encrypt(const EC_KEY *key, uint8_t *msg_mask = NULL; uint8_t *x2y2 = NULL; uint8_t *C3 = NULL; - const size_t field_size = EC_field_size(group); + const size_t field_size = ec_field_size(group); const size_t C3_size = EVP_MD_size(digest); /* NULL these before any "goto done" */ @@ -250,7 +250,7 @@ int SM2_encrypt(const EC_KEY *key, return rc; } -int SM2_decrypt(const EC_KEY *key, +int sm2_decrypt(const EC_KEY *key, const EVP_MD *digest, const uint8_t *ciphertext, size_t ciphertext_len, uint8_t *ptext_buf, size_t *ptext_len) @@ -265,7 +265,7 @@ int SM2_decrypt(const EC_KEY *key, BIGNUM *y2 = NULL; uint8_t *x2y2 = NULL; uint8_t *computed_C3 = NULL; - const size_t field_size = EC_field_size(group); + const size_t field_size = ec_field_size(group); const int hash_size = EVP_MD_size(digest); uint8_t *msg_mask = NULL; const uint8_t *C2 = NULL; diff --git a/crypto/sm2/sm2_err.c b/crypto/sm2/sm2_err.c index c7353642b2..9dd21adaba 100644 --- a/crypto/sm2/sm2_err.c +++ b/crypto/sm2/sm2_err.c @@ -20,16 +20,16 @@ static const ERR_STRING_DATA SM2_str_functs[] = { {ERR_PACK(ERR_LIB_SM2, SM2_F_PKEY_SM2_PARAMGEN, 0), "pkey_sm2_paramgen"}, {ERR_PACK(ERR_LIB_SM2, SM2_F_PKEY_SM2_SIGN, 0), "pkey_sm2_sign"}, {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_COMPUTE_MSG_HASH, 0), - "SM2_compute_msg_hash"}, + "sm2_compute_msg_hash"}, {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_COMPUTE_USERID_DIGEST, 0), - "SM2_compute_userid_digest"}, - {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_DECRYPT, 0), "SM2_decrypt"}, - {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_ENCRYPT, 0), "SM2_encrypt"}, - {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_PLAINTEXT_SIZE, 0), "SM2_plaintext_size"}, - {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_SIGN, 0), "SM2_sign"}, - {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_SIG_GEN, 0), "SM2_sig_gen"}, - {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_SIG_VERIFY, 0), "SM2_sig_verify"}, - {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_VERIFY, 0), "SM2_verify"}, + "sm2_compute_userid_digest"}, + {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_DECRYPT, 0), "sm2_decrypt"}, + {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_ENCRYPT, 0), "sm2_encrypt"}, + {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_PLAINTEXT_SIZE, 0), "sm2_plaintext_size"}, + {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_SIGN, 0), "sm2_sign"}, + {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_SIG_GEN, 0), "sm2_sig_gen"}, + {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_SIG_VERIFY, 0), "sm2_sig_verify"}, + {ERR_PACK(ERR_LIB_SM2, SM2_F_SM2_VERIFY, 0), "sm2_verify"}, {0, NULL} }; diff --git a/crypto/sm2/sm2_sign.c b/crypto/sm2/sm2_sign.c index 542c49f044..4ca0ca8006 100644 --- a/crypto/sm2/sm2_sign.c +++ b/crypto/sm2/sm2_sign.c @@ -17,7 +17,7 @@ #include <openssl/bn.h> #include <string.h> -static BIGNUM *SM2_compute_msg_hash(const EVP_MD *digest, +static BIGNUM *sm2_compute_msg_hash(const EVP_MD *digest, const EC_KEY *key, const char *user_id, const uint8_t *msg, size_t msg_len) @@ -37,7 +37,7 @@ static BIGNUM *SM2_compute_msg_hash(const EVP_MD *digest, goto done; } - if (!SM2_compute_userid_digest(za, digest, user_id, key)) { + if (!sm2_compute_userid_digest(za, digest, user_id, key)) { /* SM2err already called */ goto done; } @@ -61,7 +61,7 @@ static BIGNUM *SM2_compute_msg_hash(const EVP_MD *digest, return e; } -static ECDSA_SIG *SM2_sig_gen(const EC_KEY *key, const BIGNUM *e) +static ECDSA_SIG *sm2_sig_gen(const EC_KEY *key, const BIGNUM *e) { const BIGNUM *dA = EC_KEY_get0_private_key(key); const EC_GROUP *group = EC_KEY_get0_group(key); @@ -163,7 +163,7 @@ static ECDSA_SIG *SM2_sig_gen(const EC_KEY *key, const BIGNUM *e) return sig; } -static int SM2_sig_verify(const EC_KEY *key, const ECDSA_SIG *sig, +static int sm2_sig_verify(const EC_KEY *key, const ECDSA_SIG *sig, const BIGNUM *e) { int ret = 0; @@ -241,27 +241,27 @@ static int SM2_sig_verify(const EC_KEY *key, const ECDSA_SIG *sig, return ret; } -ECDSA_SIG *SM2_do_sign(const EC_KEY *key, +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) { BIGNUM *e = NULL; ECDSA_SIG *sig = NULL; - e = SM2_compute_msg_hash(digest, key, user_id, msg, msg_len); + e = sm2_compute_msg_hash(digest, key, user_id, msg, msg_len); if (e == NULL) { /* SM2err already called */ goto done; } - sig = SM2_sig_gen(key, e); + sig = sm2_sig_gen(key, e); done: BN_free(e); return sig; } -int SM2_do_verify(const EC_KEY *key, +int sm2_do_verify(const EC_KEY *key, const EVP_MD *digest, const ECDSA_SIG *sig, const char *user_id, const uint8_t *msg, size_t msg_len) @@ -269,20 +269,20 @@ int SM2_do_verify(const EC_KEY *key, BIGNUM *e = NULL; int ret = 0; - e = SM2_compute_msg_hash(digest, key, user_id, msg, msg_len); + e = sm2_compute_msg_hash(digest, key, user_id, msg, msg_len); if (e == NULL) { /* SM2err already called */ goto done; } - ret = SM2_sig_verify(key, sig, e); + ret = sm2_sig_verify(key, sig, e); done: BN_free(e); return ret; } -int SM2_sign(int type, const unsigned char *dgst, int dgstlen, +int sm2_sign(int type, const unsigned char *dgst, int dgstlen, unsigned char *sig, unsigned int *siglen, EC_KEY *eckey) { BIGNUM *e = NULL; @@ -301,7 +301,7 @@ int SM2_sign(int type, const unsigned char *dgst, int dgstlen, goto done; } - s = SM2_sig_gen(eckey, e); + s = sm2_sig_gen(eckey, e); sigleni = i2d_ECDSA_SIG(s, &sig); if (sigleni < 0) { @@ -318,7 +318,7 @@ int SM2_sign(int type, const unsigned char *dgst, int dgstlen, return ret; } -int SM2_verify(int type, const unsigned char *dgst, int dgstlen, +int sm2_verify(int type, const unsigned char *dgst, int dgstlen, const unsigned char *sig, int sig_len, EC_KEY *eckey) { ECDSA_SIG *s = NULL; @@ -355,7 +355,7 @@ int SM2_verify(int type, const unsigned char *dgst, int dgstlen, goto done; } - ret = SM2_sig_verify(eckey, s, e); + ret = sm2_sig_verify(eckey, s, e); done: OPENSSL_free(der); diff --git a/crypto/sm2/sm2_za.c b/crypto/sm2/sm2_za.c index 9b1f70cddd..a9560c3c04 100644 --- a/crypto/sm2/sm2_za.c +++ b/crypto/sm2/sm2_za.c @@ -16,7 +16,7 @@ #include <openssl/bn.h> #include <string.h> -int SM2_compute_userid_digest(uint8_t *out, +int sm2_compute_userid_digest(uint8_t *out, const EVP_MD *digest, const char *user_id, const EC_KEY *key) |