From: Matt Caswell Date: Tue, 11 Aug 2020 13:54:18 +0000 (+0100) Subject: Extend the provider MAC bridge for SIPHASH X-Git-Tag: openssl-3.0.0-alpha7~453 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b27b31b62846d21a915acfd45c92ba82d3cd5666;p=thirdparty%2Fopenssl.git Extend the provider MAC bridge for SIPHASH The previous commits added support for HMAC into the provider MAC bridge. We now extend that for SIPHASH too. Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/12637) --- diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index 1d5585583eb..db4b6f8fa12 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -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_SIPHASH: case EVP_PKEY_POLY1305: return 1; default: diff --git a/providers/defltprov.c b/providers/defltprov.c index c5b3407894a..aaf1cfe6b0c 100644 --- a/providers/defltprov.c +++ b/providers/defltprov.c @@ -365,6 +365,7 @@ static const OSSL_ALGORITHM deflt_signature[] = { { "ECDSA", "provider=default", ecdsa_signature_functions }, #endif { "HMAC", "provider=default", mac_hmac_signature_functions }, + { "SIPHASH", "provider=default", mac_siphash_signature_functions }, { NULL, NULL, NULL } }; @@ -394,6 +395,7 @@ static const OSSL_ALGORITHM deflt_keymgmt[] = { { "HKDF", "provider=default", kdf_keymgmt_functions }, { "SCRYPT:id-scrypt", "provider=default", kdf_keymgmt_functions }, { "HMAC", "provider=default", mac_keymgmt_functions }, + { "SIPHASH", "provider=default", mac_keymgmt_functions }, { NULL, NULL, NULL } }; diff --git a/providers/implementations/include/prov/implementations.h b/providers/implementations/include/prov/implementations.h index d975226fb51..7c6412ceb5c 100644 --- a/providers/implementations/include/prov/implementations.h +++ b/providers/implementations/include/prov/implementations.h @@ -296,6 +296,7 @@ extern const OSSL_DISPATCH ed25519_signature_functions[]; 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[]; /* Asym Cipher */ extern const OSSL_DISPATCH rsa_asym_cipher_functions[]; diff --git a/providers/implementations/signature/mac_legacy.c b/providers/implementations/signature/mac_legacy.c index 67acea3288e..bb3bf5b55d7 100644 --- a/providers/implementations/signature/mac_legacy.c +++ b/providers/implementations/signature/mac_legacy.c @@ -70,6 +70,7 @@ static void *mac_newctx(void *provctx, const char *propq, const char *macname) } MAC_NEWCTX(hmac, "HMAC") +MAC_NEWCTX(siphash, "SIPHASH") static int mac_digest_sign_init(void *vpmacctx, const char *mdname, void *vkey) { @@ -176,4 +177,5 @@ static void *mac_dupctx(void *vpmacctx) { 0, NULL } \ }; -MAC_SIGNATURE_FUNCTIONS(hmac) \ No newline at end of file +MAC_SIGNATURE_FUNCTIONS(hmac) +MAC_SIGNATURE_FUNCTIONS(siphash)