summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorShane Lontis <shane.lontis@oracle.com>2021-02-18 20:27:26 +1000
committerShane Lontis <shane.lontis@oracle.com>2021-02-26 10:53:01 +1000
commit32ab57cbb4877ce7e6b4eb3f9b3cfbb0ff7cd10b (patch)
tree91e75951efa936b26e3a636b9a0daf90d60182b0 /include
parent5af02212a5331cc30389246bb94f97fbcdebc23a (diff)
Fix external symbols related to ec & sm2 keys
Partial fix for #12964 This adds ossl_ names for the following symbols: ec_*, ecx_*, ecdh_*, ecdsa_*, sm2_* Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14231)
Diffstat (limited to 'include')
-rw-r--r--include/crypto/ec.h68
-rw-r--r--include/crypto/ecx.h29
-rw-r--r--include/crypto/evp.h10
-rw-r--r--include/crypto/sm2.h66
4 files changed, 88 insertions, 85 deletions
diff --git a/include/crypto/ec.h b/include/crypto/ec.h
index 347474a37b..a3d87e9d1a 100644
--- a/include/crypto/ec.h
+++ b/include/crypto/ec.h
@@ -16,10 +16,10 @@
# include <openssl/opensslconf.h>
# include <openssl/evp.h>
-const char *ec_curve_nid2name(int nid);
-int ec_curve_name2nid(const char *name);
-const char *ec_curve_nid2nist_int(int nid);
-int ec_curve_nist2nid_int(const char *name);
+const char *ossl_ec_curve_nid2name(int nid);
+int ossl_ec_curve_name2nid(const char *name);
+const char *ossl_ec_curve_nid2nist_int(int nid);
+int ossl_ec_curve_nist2nid_int(const char *name);
int evp_pkey_ctx_set_ec_param_enc_prov(EVP_PKEY_CTX *ctx, int param_enc);
# ifndef OPENSSL_NO_EC
@@ -48,43 +48,45 @@ int evp_pkey_ctx_set_ec_param_enc_prov(EVP_PKEY_CTX *ctx, int param_enc);
* reduction round on the input can be omitted by the underlying
* implementations for better SCA properties on regular input values).
*/
-__owur int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
- const BIGNUM *x, BN_CTX *ctx);
+__owur int ossl_ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
+ const BIGNUM *x, BN_CTX *ctx);
/*-
* ECDH Key Derivation Function as defined in ANSI X9.63
*/
-int ecdh_KDF_X9_63(unsigned char *out, size_t outlen,
- const unsigned char *Z, size_t Zlen,
- const unsigned char *sinfo, size_t sinfolen,
- const EVP_MD *md, OSSL_LIB_CTX *libctx, const char *propq);
+int ossl_ecdh_kdf_X9_63(unsigned char *out, size_t outlen,
+ const unsigned char *Z, size_t Zlen,
+ const unsigned char *sinfo, size_t sinfolen,
+ const EVP_MD *md, OSSL_LIB_CTX *libctx,
+ const char *propq);
-int ec_key_public_check(const EC_KEY *eckey, BN_CTX *ctx);
-int ec_key_public_check_quick(const EC_KEY *eckey, BN_CTX *ctx);
-int ec_key_private_check(const EC_KEY *eckey);
-int ec_key_pairwise_check(const EC_KEY *eckey, BN_CTX *ctx);
-OSSL_LIB_CTX *ec_key_get_libctx(const EC_KEY *eckey);
-const char *ec_key_get0_propq(const EC_KEY *eckey);
-void ec_key_set0_libctx(EC_KEY *key, OSSL_LIB_CTX *libctx);
+int ossl_ec_key_public_check(const EC_KEY *eckey, BN_CTX *ctx);
+int ossl_ec_key_public_check_quick(const EC_KEY *eckey, BN_CTX *ctx);
+int ossl_ec_key_private_check(const EC_KEY *eckey);
+int ossl_ec_key_pairwise_check(const EC_KEY *eckey, BN_CTX *ctx);
+OSSL_LIB_CTX *ossl_ec_key_get_libctx(const EC_KEY *eckey);
+const char *ossl_ec_key_get0_propq(const EC_KEY *eckey);
+void ossl_ec_key_set0_libctx(EC_KEY *key, OSSL_LIB_CTX *libctx);
/* Backend support */
-int ec_group_todata(const EC_GROUP *group, OSSL_PARAM_BLD *tmpl,
- OSSL_PARAM params[], OSSL_LIB_CTX *libctx,
- const char *propq,
- BN_CTX *bnctx, unsigned char **genbuf);
-int ec_group_fromdata(EC_KEY *ec, const OSSL_PARAM params[]);
-int ec_group_set_params(EC_GROUP *group, const OSSL_PARAM params[]);
-int ec_key_fromdata(EC_KEY *ecx, const OSSL_PARAM params[], int include_private);
-int ec_key_otherparams_fromdata(EC_KEY *ec, const OSSL_PARAM params[]);
-int ec_set_ecdh_cofactor_mode(EC_KEY *ec, int mode);
-int ec_encoding_name2id(const char *name);
-int ec_encoding_param2id(const OSSL_PARAM *p, int *id);
-int ec_pt_format_name2id(const char *name);
-int ec_pt_format_param2id(const OSSL_PARAM *p, int *id);
-char *ec_pt_format_id2name(int id);
+int ossl_ec_group_todata(const EC_GROUP *group, OSSL_PARAM_BLD *tmpl,
+ OSSL_PARAM params[], OSSL_LIB_CTX *libctx,
+ const char *propq,
+ BN_CTX *bnctx, unsigned char **genbuf);
+int ossl_ec_group_fromdata(EC_KEY *ec, const OSSL_PARAM params[]);
+int ossl_ec_group_set_params(EC_GROUP *group, const OSSL_PARAM params[]);
+int ossl_ec_key_fromdata(EC_KEY *ecx, const OSSL_PARAM params[],
+ int include_private);
+int ossl_ec_key_otherparams_fromdata(EC_KEY *ec, const OSSL_PARAM params[]);
+int ossl_ec_set_ecdh_cofactor_mode(EC_KEY *ec, int mode);
+int ossl_ec_encoding_name2id(const char *name);
+int ossl_ec_encoding_param2id(const OSSL_PARAM *p, int *id);
+int ossl_ec_pt_format_name2id(const char *name);
+int ossl_ec_pt_format_param2id(const OSSL_PARAM *p, int *id);
+char *ossl_ec_pt_format_id2name(int id);
-char *ec_check_group_type_id2name(int flags);
-int ec_set_check_group_type_from_name(EC_KEY *ec, const char *name);
+char *ossl_ec_check_group_type_id2name(int flags);
+int ossl_ec_set_check_group_type_from_name(EC_KEY *ec, const char *name);
# endif /* OPENSSL_NO_EC */
#endif
diff --git a/include/crypto/ecx.h b/include/crypto/ecx.h
index 678cfcccea..af03d32587 100644
--- a/include/crypto/ecx.h
+++ b/include/crypto/ecx.h
@@ -76,13 +76,12 @@ struct ecx_key_st {
typedef struct ecx_key_st ECX_KEY;
-size_t ecx_key_length(ECX_KEY_TYPE type);
-ECX_KEY *ecx_key_new(OSSL_LIB_CTX *libctx, ECX_KEY_TYPE type, int haspubkey,
- const char *propq);
-void ecx_key_set0_libctx(ECX_KEY *key, OSSL_LIB_CTX *libctx);
-unsigned char *ecx_key_allocate_privkey(ECX_KEY *key);
-void ecx_key_free(ECX_KEY *key);
-int ecx_key_up_ref(ECX_KEY *key);
+ECX_KEY *ossl_ecx_key_new(OSSL_LIB_CTX *libctx, ECX_KEY_TYPE type,
+ int haspubkey, const char *propq);
+void ossl_ecx_key_set0_libctx(ECX_KEY *key, OSSL_LIB_CTX *libctx);
+unsigned char *ossl_ecx_key_allocate_privkey(ECX_KEY *key);
+void ossl_ecx_key_free(ECX_KEY *key);
+int ossl_ecx_key_up_ref(ECX_KEY *key);
int X25519(uint8_t out_shared_key[32], const uint8_t private_key[32],
const uint8_t peer_public_value[32]);
@@ -116,13 +115,13 @@ void X448_public_from_private(uint8_t out_public_value[56],
/* Backend support */
-int ecx_public_from_private(ECX_KEY *key);
-int ecx_key_fromdata(ECX_KEY *ecx, const OSSL_PARAM params[],
- int include_private);
-
-ECX_KEY *evp_pkey_get1_X25519(EVP_PKEY *pkey);
-ECX_KEY *evp_pkey_get1_X448(EVP_PKEY *pkey);
-ECX_KEY *evp_pkey_get1_ED25519(EVP_PKEY *pkey);
-ECX_KEY *evp_pkey_get1_ED448(EVP_PKEY *pkey);
+int ossl_ecx_public_from_private(ECX_KEY *key);
+int ossl_ecx_key_fromdata(ECX_KEY *ecx, const OSSL_PARAM params[],
+ int include_private);
+
+ECX_KEY *ossl_evp_pkey_get1_X25519(EVP_PKEY *pkey);
+ECX_KEY *ossl_evp_pkey_get1_X448(EVP_PKEY *pkey);
+ECX_KEY *ossl_evp_pkey_get1_ED25519(EVP_PKEY *pkey);
+ECX_KEY *ossl_evp_pkey_get1_ED448(EVP_PKEY *pkey);
# endif /* OPENSSL_NO_EC */
#endif
diff --git a/include/crypto/evp.h b/include/crypto/evp.h
index 1b0a00dac2..9115f47c1f 100644
--- a/include/crypto/evp.h
+++ b/include/crypto/evp.h
@@ -182,11 +182,11 @@ void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx);
const EVP_PKEY_METHOD *ossl_dh_pkey_method(void);
const EVP_PKEY_METHOD *ossl_dhx_pkey_method(void);
const EVP_PKEY_METHOD *ossl_dsa_pkey_method(void);
-const EVP_PKEY_METHOD *ec_pkey_method(void);
-const EVP_PKEY_METHOD *ecx25519_pkey_method(void);
-const EVP_PKEY_METHOD *ecx448_pkey_method(void);
-const EVP_PKEY_METHOD *ed25519_pkey_method(void);
-const EVP_PKEY_METHOD *ed448_pkey_method(void);
+const EVP_PKEY_METHOD *ossl_ec_pkey_method(void);
+const EVP_PKEY_METHOD *ossl_ecx25519_pkey_method(void);
+const EVP_PKEY_METHOD *ossl_ecx448_pkey_method(void);
+const EVP_PKEY_METHOD *ossl_ed25519_pkey_method(void);
+const EVP_PKEY_METHOD *ossl_ed448_pkey_method(void);
const EVP_PKEY_METHOD *ossl_rsa_pkey_method(void);
const EVP_PKEY_METHOD *ossl_rsa_pss_pkey_method(void);
diff --git a/include/crypto/sm2.h b/include/crypto/sm2.h
index 2bd0af03d6..e3278a31e6 100644
--- a/include/crypto/sm2.h
+++ b/include/crypto/sm2.h
@@ -20,65 +20,67 @@
# include <openssl/ec.h>
# include "crypto/types.h"
-int sm2_key_private_check(const EC_KEY *eckey);
+int ossl_sm2_key_private_check(const EC_KEY *eckey);
/* The default user id as specified in GM/T 0009-2012 */
# define SM2_DEFAULT_USERID "1234567812345678"
-int sm2_compute_z_digest(uint8_t *out,
- const EVP_MD *digest,
- const uint8_t *id,
- const size_t id_len,
- const EC_KEY *key);
+int ossl_sm2_compute_z_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 Z and then signs H(Z || msg) using SM2
*/
-ECDSA_SIG *sm2_do_sign(const EC_KEY *key,
+ECDSA_SIG *ossl_sm2_do_sign(const EC_KEY *key,
+ const EVP_MD *digest,
+ const uint8_t *id,
+ const size_t id_len,
+ const uint8_t *msg, size_t msg_len);
+
+int ossl_sm2_do_verify(const EC_KEY *key,
const EVP_MD *digest,
+ const ECDSA_SIG *signature,
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 uint8_t *id,
- const size_t id_len,
- const uint8_t *msg, size_t msg_len);
-
/*
* SM2 signature generation.
*/
-int sm2_internal_sign(const unsigned char *dgst, int dgstlen,
- unsigned char *sig, unsigned int *siglen, EC_KEY *eckey);
+int ossl_sm2_internal_sign(const unsigned char *dgst, int dgstlen,
+ unsigned char *sig, unsigned int *siglen,
+ EC_KEY *eckey);
/*
* SM2 signature verification.
*/
-int sm2_internal_verify(const unsigned char *dgst, int dgstlen,
- const unsigned char *sig, int siglen, EC_KEY *eckey);
+int ossl_sm2_internal_verify(const unsigned char *dgst, int dgstlen,
+ const unsigned char *sig, int siglen,
+ EC_KEY *eckey);
/*
* SM2 encryption
*/
-int sm2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len,
- size_t *ct_size);
+int ossl_sm2_ciphertext_size(const EC_KEY *key, const EVP_MD *digest,
+ size_t msg_len, size_t *ct_size);
-int sm2_plaintext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len,
- size_t *pt_size);
+int ossl_sm2_plaintext_size(const EC_KEY *key, const EVP_MD *digest,
+ size_t msg_len, size_t *pt_size);
-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);
+int ossl_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);
-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);
+int ossl_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);
-const unsigned char *sm2_algorithmidentifier_encoding(int md_nid, size_t *len);
+const unsigned char *ossl_sm2_algorithmidentifier_encoding(int md_nid,
+ size_t *len);
# endif /* OPENSSL_NO_SM2 */
#endif