From bad41b689fd67fa44efbe6488c1c0b9d6e14c139 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Wed, 28 Aug 2019 15:46:26 +0100 Subject: [PATCH] Fix no-cmac Don't include files that we don't want to build Reviewed-by: Richard Levitte (Merged from https://github.com/openssl/openssl/pull/9718) --- providers/common/macs/build.info | 6 +++++- providers/common/macs/cmac_prov.c | 21 ++++++++------------- providers/fips/fipsprov.c | 2 ++ 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/providers/common/macs/build.info b/providers/common/macs/build.info index 6bd17291a6..832a1e76ec 100644 --- a/providers/common/macs/build.info +++ b/providers/common/macs/build.info @@ -1,4 +1,8 @@ -$COMMON=cmac_prov.c gmac_prov.c hmac_prov.c kmac_prov.c +$COMMON=gmac_prov.c hmac_prov.c kmac_prov.c + +IF[{- !$disabled{cmac} -}] + $COMMON=$COMMON cmac_prov.c +ENDIF LIBS=../../../libcrypto SOURCE[../../../libcrypto]=$COMMON diff --git a/providers/common/macs/cmac_prov.c b/providers/common/macs/cmac_prov.c index 693423130d..f63f405abf 100644 --- a/providers/common/macs/cmac_prov.c +++ b/providers/common/macs/cmac_prov.c @@ -7,18 +7,15 @@ * https://www.openssl.org/source/license.html */ -#include -#ifndef OPENSSL_NO_CMAC +#include +#include +#include +#include +#include +#include -# include -# include -# include -# include -# include -# include - -# include "internal/provider_algs.h" -# include "internal/provider_ctx.h" +#include "internal/provider_algs.h" +#include "internal/provider_ctx.h" /* * Forward declaration of everything implemented here. This is not strictly @@ -256,5 +253,3 @@ const OSSL_DISPATCH cmac_functions[] = { { OSSL_FUNC_MAC_SET_CTX_PARAMS, (void (*)(void))cmac_set_ctx_params }, { 0, NULL } }; - -#endif diff --git a/providers/fips/fipsprov.c b/providers/fips/fipsprov.c index 9a7193bb4f..f8f0a90c24 100644 --- a/providers/fips/fipsprov.c +++ b/providers/fips/fipsprov.c @@ -332,7 +332,9 @@ static const OSSL_ALGORITHM fips_ciphers[] = { }; static const OSSL_ALGORITHM fips_macs[] = { +#ifndef OPENSSL_NO_CMAC { "CMAC", "fips=yes", cmac_functions }, +#endif { "GMAC", "fips=yes", gmac_functions }, { "HMAC", "fips=yes", hmac_functions }, { "KMAC128", "fips=yes", kmac128_functions }, -- 2.25.1