From 054d43ff972068a0f2ec07319808ca32ad0afb5f Mon Sep 17 00:00:00 2001 From: Shane Lontis Date: Tue, 9 Mar 2021 11:04:21 +1000 Subject: Add ossl_ ecx symbols Partial fix for #12964 Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/14473) --- providers/implementations/exchange/ecx_exch.c | 6 ++++-- providers/implementations/keymgmt/ecx_kmgmt.c | 24 ++++++++++++------------ providers/implementations/signature/eddsa.c | 16 ++++++++-------- 3 files changed, 24 insertions(+), 22 deletions(-) (limited to 'providers/implementations') diff --git a/providers/implementations/exchange/ecx_exch.c b/providers/implementations/exchange/ecx_exch.c index caa1eece89..2ba9090c8b 100644 --- a/providers/implementations/exchange/ecx_exch.c +++ b/providers/implementations/exchange/ecx_exch.c @@ -154,7 +154,8 @@ static int ecx_derive(void *vecxctx, unsigned char *secret, size_t *secretlen, } } else #endif - if (X25519(secret, ecxctx->key->privkey, ecxctx->peerkey->pubkey) == 0) { + if (ossl_x25519(secret, ecxctx->key->privkey, + ecxctx->peerkey->pubkey) == 0) { ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_DURING_DERIVATION); return 0; } @@ -169,7 +170,8 @@ static int ecx_derive(void *vecxctx, unsigned char *secret, size_t *secretlen, } } else #endif - if (X448(secret, ecxctx->key->privkey, ecxctx->peerkey->pubkey) == 0) { + if (ossl_x448(secret, ecxctx->key->privkey, + ecxctx->peerkey->pubkey) == 0) { ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_DURING_DERIVATION); return 0; } diff --git a/providers/implementations/keymgmt/ecx_kmgmt.c b/providers/implementations/keymgmt/ecx_kmgmt.c index 6aa947827c..6f58a1cb77 100644 --- a/providers/implementations/keymgmt/ecx_kmgmt.c +++ b/providers/implementations/keymgmt/ecx_kmgmt.c @@ -583,21 +583,21 @@ static void *ecx_gen(struct ecx_gen_ctx *gctx) privkey[0] &= 248; privkey[X25519_KEYLEN - 1] &= 127; privkey[X25519_KEYLEN - 1] |= 64; - X25519_public_from_private(key->pubkey, privkey); + ossl_x25519_public_from_private(key->pubkey, privkey); break; case ECX_KEY_TYPE_X448: privkey[0] &= 252; privkey[X448_KEYLEN - 1] |= 128; - X448_public_from_private(key->pubkey, privkey); + ossl_x448_public_from_private(key->pubkey, privkey); break; case ECX_KEY_TYPE_ED25519: - if (!ED25519_public_from_private(gctx->libctx, key->pubkey, privkey, - gctx->propq)) + if (!ossl_ed25519_public_from_private(gctx->libctx, key->pubkey, privkey, + gctx->propq)) goto err; break; case ECX_KEY_TYPE_ED448: - if (!ED448_public_from_private(gctx->libctx, key->pubkey, privkey, - gctx->propq)) + if (!ossl_ed448_public_from_private(gctx->libctx, key->pubkey, privkey, + gctx->propq)) goto err; break; } @@ -697,19 +697,19 @@ static int ecx_key_pairwise_check(const ECX_KEY *ecx, int type) switch (type) { case ECX_KEY_TYPE_X25519: - X25519_public_from_private(pub, ecx->privkey); + ossl_x25519_public_from_private(pub, ecx->privkey); break; case ECX_KEY_TYPE_X448: - X448_public_from_private(pub, ecx->privkey); + ossl_x448_public_from_private(pub, ecx->privkey); break; case ECX_KEY_TYPE_ED25519: - if (!ED25519_public_from_private(ecx->libctx, pub, ecx->privkey, - ecx->propq)) + if (!ossl_ed25519_public_from_private(ecx->libctx, pub, ecx->privkey, + ecx->propq)) return 0; break; case ECX_KEY_TYPE_ED448: - if (!ED448_public_from_private(ecx->libctx, pub, ecx->privkey, - ecx->propq)) + if (!ossl_ed448_public_from_private(ecx->libctx, pub, ecx->privkey, + ecx->propq)) return 0; break; default: diff --git a/providers/implementations/signature/eddsa.c b/providers/implementations/signature/eddsa.c index 221ccdd928..148c143cc0 100644 --- a/providers/implementations/signature/eddsa.c +++ b/providers/implementations/signature/eddsa.c @@ -159,8 +159,8 @@ int ed25519_digest_sign(void *vpeddsactx, unsigned char *sigret, if (S390X_CAN_SIGN(ED25519)) return s390x_ed25519_digestsign(edkey, sigret, tbs, tbslen); #endif /* S390X_EC_ASM */ - if (ED25519_sign(sigret, tbs, tbslen, edkey->pubkey, edkey->privkey, - peddsactx->libctx, NULL) == 0) { + if (ossl_ed25519_sign(sigret, tbs, tbslen, edkey->pubkey, edkey->privkey, + peddsactx->libctx, NULL) == 0) { ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SIGN); return 0; } @@ -190,8 +190,8 @@ int ed448_digest_sign(void *vpeddsactx, unsigned char *sigret, if (S390X_CAN_SIGN(ED448)) return s390x_ed448_digestsign(edkey, sigret, tbs, tbslen); #endif /* S390X_EC_ASM */ - if (ED448_sign(peddsactx->libctx, sigret, tbs, tbslen, edkey->pubkey, - edkey->privkey, NULL, 0, edkey->propq) == 0) { + if (ossl_ed448_sign(peddsactx->libctx, sigret, tbs, tbslen, edkey->pubkey, + edkey->privkey, NULL, 0, edkey->propq) == 0) { ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_SIGN); return 0; } @@ -214,8 +214,8 @@ int ed25519_digest_verify(void *vpeddsactx, const unsigned char *sig, return s390x_ed25519_digestverify(edkey, sig, tbs, tbslen); #endif /* S390X_EC_ASM */ - return ED25519_verify(tbs, tbslen, sig, edkey->pubkey, peddsactx->libctx, - edkey->propq); + return ossl_ed25519_verify(tbs, tbslen, sig, edkey->pubkey, + peddsactx->libctx, edkey->propq); } int ed448_digest_verify(void *vpeddsactx, const unsigned char *sig, @@ -233,8 +233,8 @@ int ed448_digest_verify(void *vpeddsactx, const unsigned char *sig, return s390x_ed448_digestverify(edkey, sig, tbs, tbslen); #endif /* S390X_EC_ASM */ - return ED448_verify(peddsactx->libctx, tbs, tbslen, sig, edkey->pubkey, - NULL, 0, edkey->propq); + return ossl_ed448_verify(peddsactx->libctx, tbs, tbslen, sig, edkey->pubkey, + NULL, 0, edkey->propq); } static void eddsa_freectx(void *vpeddsactx) -- cgit v1.2.3