From b4a3aeebd9f9280aa7e69a343f5c824e68466d90 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Fri, 18 Mar 2016 13:49:25 +0000 Subject: [PATCH] Fix no-cmac There were a couple of CMAC references without OPENSSL_NO_CMAC guards. Reviewed-by: Rich Salz --- crypto/asn1/ameth_lib.c | 2 ++ crypto/evp/pmeth_lib.c | 2 ++ test/evp_test.c | 11 ++++++++--- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/crypto/asn1/ameth_lib.c b/crypto/asn1/ameth_lib.c index 8458e811c9..0926a4f26c 100644 --- a/crypto/asn1/ameth_lib.c +++ b/crypto/asn1/ameth_lib.c @@ -86,7 +86,9 @@ static const EVP_PKEY_ASN1_METHOD *standard_methods[] = { &eckey_asn1_meth, #endif &hmac_asn1_meth, +#ifndef OPENSSL_NO_CMAC &cmac_asn1_meth, +#endif #ifndef OPENSSL_NO_DH &dhx_asn1_meth #endif diff --git a/crypto/evp/pmeth_lib.c b/crypto/evp/pmeth_lib.c index 26bec9a64b..a285009ad4 100644 --- a/crypto/evp/pmeth_lib.c +++ b/crypto/evp/pmeth_lib.c @@ -86,7 +86,9 @@ static const EVP_PKEY_METHOD *standard_methods[] = { &ec_pkey_meth, #endif &hmac_pkey_meth, +#ifndef OPENSSL_NO_CMAC &cmac_pkey_meth, +#endif #ifndef OPENSSL_NO_DH &dhx_pkey_meth, #endif diff --git a/test/evp_test.c b/test/evp_test.c index bda7f694a3..759ec3be4a 100644 --- a/test/evp_test.c +++ b/test/evp_test.c @@ -1022,11 +1022,16 @@ static int mac_test_init(struct evp_test *t, const char *alg) { int type; struct mac_data *mdat; - if (strcmp(alg, "HMAC") == 0) + if (strcmp(alg, "HMAC") == 0) { type = EVP_PKEY_HMAC; - else if (strcmp(alg, "CMAC") == 0) + } else if (strcmp(alg, "CMAC") == 0) { +#ifndef OPENSSL_NO_CMAC type = EVP_PKEY_CMAC; - else +#else + t->skip = 1; + return 1; +#endif + } else return 0; mdat = OPENSSL_malloc(sizeof(*mdat)); -- 2.39.2