Extend the provider MAC bridge for Poly1305

The previous commits added support for HMAC and SIPHASH into the provider
MAC bridge. We now extend that for Poly1305 too.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/12637)
This commit is contained in:
Matt Caswell 2020-08-11 15:28:07 +01:00 committed by Pauli
parent 8014b2a966
commit 4db71d0175
4 changed files with 9 additions and 1 deletions

View File

@ -151,7 +151,6 @@ static int is_legacy_alg(int id, const char *keytype)
*/
case EVP_PKEY_SM2:
case EVP_PKEY_CMAC:
case EVP_PKEY_POLY1305:
return 1;
default:
return 0;

View File

@ -366,6 +366,9 @@ static const OSSL_ALGORITHM deflt_signature[] = {
#endif
{ "HMAC", "provider=default", mac_hmac_signature_functions },
{ "SIPHASH", "provider=default", mac_siphash_signature_functions },
#ifndef OPENSSL_NO_POLY1305
{ "POLY1305", "provider=default", mac_poly1305_signature_functions },
#endif
{ NULL, NULL, NULL }
};
@ -396,6 +399,9 @@ static const OSSL_ALGORITHM deflt_keymgmt[] = {
{ "SCRYPT:id-scrypt", "provider=default", kdf_keymgmt_functions },
{ "HMAC", "provider=default", mac_keymgmt_functions },
{ "SIPHASH", "provider=default", mac_keymgmt_functions },
#ifndef OPENSSL_NO_POLY1305
{ "POLY1305", "provider=default", mac_keymgmt_functions },
#endif
{ NULL, NULL, NULL }
};

View File

@ -297,6 +297,7 @@ extern const OSSL_DISPATCH ed448_signature_functions[];
extern const OSSL_DISPATCH ecdsa_signature_functions[];
extern const OSSL_DISPATCH mac_hmac_signature_functions[];
extern const OSSL_DISPATCH mac_siphash_signature_functions[];
extern const OSSL_DISPATCH mac_poly1305_signature_functions[];
/* Asym Cipher */
extern const OSSL_DISPATCH rsa_asym_cipher_functions[];

View File

@ -71,6 +71,7 @@ static void *mac_newctx(void *provctx, const char *propq, const char *macname)
MAC_NEWCTX(hmac, "HMAC")
MAC_NEWCTX(siphash, "SIPHASH")
MAC_NEWCTX(poly1305, "POLY1305")
static int mac_digest_sign_init(void *vpmacctx, const char *mdname, void *vkey)
{
@ -179,3 +180,4 @@ static void *mac_dupctx(void *vpmacctx)
MAC_SIGNATURE_FUNCTIONS(hmac)
MAC_SIGNATURE_FUNCTIONS(siphash)
MAC_SIGNATURE_FUNCTIONS(poly1305)