Fix no-cmac
authorMatt Caswell <matt@openssl.org>
Fri, 18 Mar 2016 13:49:25 +0000 (13:49 +0000)
committerMatt Caswell <matt@openssl.org>
Fri, 18 Mar 2016 17:07:11 +0000 (17:07 +0000)
There were a couple of CMAC references without OPENSSL_NO_CMAC guards.

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/asn1/ameth_lib.c
crypto/evp/pmeth_lib.c
test/evp_test.c

index 8458e811c9f574e71056901b85ec98f9eecd75a9..0926a4f26c816d05ea5b61d35bdbe975dc47081b 100644 (file)
@@ -86,7 +86,9 @@ static const EVP_PKEY_ASN1_METHOD *standard_methods[] = {
     &eckey_asn1_meth,
 #endif
     &hmac_asn1_meth,
     &eckey_asn1_meth,
 #endif
     &hmac_asn1_meth,
+#ifndef OPENSSL_NO_CMAC
     &cmac_asn1_meth,
     &cmac_asn1_meth,
+#endif
 #ifndef OPENSSL_NO_DH
     &dhx_asn1_meth
 #endif
 #ifndef OPENSSL_NO_DH
     &dhx_asn1_meth
 #endif
index 26bec9a64b7caa41fee5a88025ffca5d42b904ae..a285009ad427dac997b11f47108023ff1bf7e28d 100644 (file)
@@ -86,7 +86,9 @@ static const EVP_PKEY_METHOD *standard_methods[] = {
     &ec_pkey_meth,
 #endif
     &hmac_pkey_meth,
     &ec_pkey_meth,
 #endif
     &hmac_pkey_meth,
+#ifndef OPENSSL_NO_CMAC
     &cmac_pkey_meth,
     &cmac_pkey_meth,
+#endif
 #ifndef OPENSSL_NO_DH
     &dhx_pkey_meth,
 #endif
 #ifndef OPENSSL_NO_DH
     &dhx_pkey_meth,
 #endif
index bda7f694a3d52335adab4a220fecc028d28701ac..759ec3be4a8a5951c09a6feb835bde18de6bc515 100644 (file)
@@ -1022,11 +1022,16 @@ static int mac_test_init(struct evp_test *t, const char *alg)
 {
     int type;
     struct mac_data *mdat;
 {
     int type;
     struct mac_data *mdat;
-    if (strcmp(alg, "HMAC") == 0)
+    if (strcmp(alg, "HMAC") == 0) {
         type = EVP_PKEY_HMAC;
         type = EVP_PKEY_HMAC;
-    else if (strcmp(alg, "CMAC") == 0)
+    } else if (strcmp(alg, "CMAC") == 0) {
+#ifndef OPENSSL_NO_CMAC
         type = EVP_PKEY_CMAC;
         type = EVP_PKEY_CMAC;
-    else
+#else
+        t->skip = 1;
+        return 1;
+#endif
+    } else
         return 0;
 
     mdat = OPENSSL_malloc(sizeof(*mdat));
         return 0;
 
     mdat = OPENSSL_malloc(sizeof(*mdat));