summaryrefslogtreecommitdiffstats
path: root/providers/default/macs
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2019-08-28 14:57:56 +0100
committerMatt Caswell <matt@openssl.org>2019-08-29 11:12:25 +0100
commit7f6b035b523898cf5318d023d50cb3665a67d686 (patch)
treebb67f5fae40ea0011a3da722872b51e5fb4ef976 /providers/default/macs
parent632f112cf730b4b1e2cdeea07a5c51fa8da9bba4 (diff)
Fix no-poly1305, no-siphash and no-blake2
Make sure we don't include files that we don't need if we've disabled them. Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/9717)
Diffstat (limited to 'providers/default/macs')
-rw-r--r--providers/default/macs/blake2_mac_impl.c19
-rw-r--r--providers/default/macs/blake2b_mac.c36
-rw-r--r--providers/default/macs/blake2s_mac.c37
-rw-r--r--providers/default/macs/build.info15
-rw-r--r--providers/default/macs/poly1305_prov.c23
-rw-r--r--providers/default/macs/siphash_prov.c27
6 files changed, 72 insertions, 85 deletions
diff --git a/providers/default/macs/blake2_mac_impl.c b/providers/default/macs/blake2_mac_impl.c
index 846e5ef57b..a190b91b98 100644
--- a/providers/default/macs/blake2_mac_impl.c
+++ b/providers/default/macs/blake2_mac_impl.c
@@ -7,17 +7,14 @@
* https://www.openssl.org/source/license.html
*/
-#include <openssl/opensslconf.h>
-#ifndef OPENSSL_NO_BLAKE2
+#include <openssl/core_numbers.h>
+#include <openssl/core_names.h>
+#include <openssl/params.h>
-# include <openssl/core_numbers.h>
-# include <openssl/core_names.h>
-# include <openssl/params.h>
-
-# include "internal/blake2.h"
-# include "internal/cryptlib.h"
-# include "internal/providercommonerr.h"
-# include "internal/provider_algs.h"
+#include "internal/blake2.h"
+#include "internal/cryptlib.h"
+#include "internal/providercommonerr.h"
+#include "internal/provider_algs.h"
/*
* Forward declaration of everything implemented here. This is not strictly
@@ -221,5 +218,3 @@ const OSSL_DISPATCH BLAKE2_FUNCTIONS[] = {
{ OSSL_FUNC_MAC_SET_CTX_PARAMS, (void (*)(void))blake2_mac_set_ctx_params },
{ 0, NULL }
};
-
-#endif
diff --git a/providers/default/macs/blake2b_mac.c b/providers/default/macs/blake2b_mac.c
index c020d2e106..aa1a8dee1f 100644
--- a/providers/default/macs/blake2b_mac.c
+++ b/providers/default/macs/blake2b_mac.c
@@ -7,30 +7,26 @@
* https://www.openssl.org/source/license.html
*/
-#include <openssl/opensslconf.h>
-#ifndef OPENSSL_NO_BLAKE2
-
/* Constants */
-# define BLAKE2_CTX BLAKE2B_CTX
-# define BLAKE2_PARAM BLAKE2B_PARAM
-# define BLAKE2_KEYBYTES BLAKE2B_KEYBYTES
-# define BLAKE2_OUTBYTES BLAKE2B_OUTBYTES
-# define BLAKE2_PERSONALBYTES BLAKE2B_PERSONALBYTES
-# define BLAKE2_SALTBYTES BLAKE2B_SALTBYTES
+#define BLAKE2_CTX BLAKE2B_CTX
+#define BLAKE2_PARAM BLAKE2B_PARAM
+#define BLAKE2_KEYBYTES BLAKE2B_KEYBYTES
+#define BLAKE2_OUTBYTES BLAKE2B_OUTBYTES
+#define BLAKE2_PERSONALBYTES BLAKE2B_PERSONALBYTES
+#define BLAKE2_SALTBYTES BLAKE2B_SALTBYTES
/* Function names */
-# define BLAKE2_PARAM_INIT blake2b_param_init
-# define BLAKE2_INIT_KEY blake2b_init_key
-# define BLAKE2_UPDATE blake2b_update
-# define BLAKE2_FINAL blake2b_final
-# define BLAKE2_PARAM_SET_DIGEST_LENGTH blake2b_param_set_digest_length
-# define BLAKE2_PARAM_SET_KEY_LENGTH blake2b_param_set_key_length
-# define BLAKE2_PARAM_SET_PERSONAL blake2b_param_set_personal
-# define BLAKE2_PARAM_SET_SALT blake2b_param_set_salt
+#define BLAKE2_PARAM_INIT blake2b_param_init
+#define BLAKE2_INIT_KEY blake2b_init_key
+#define BLAKE2_UPDATE blake2b_update
+#define BLAKE2_FINAL blake2b_final
+#define BLAKE2_PARAM_SET_DIGEST_LENGTH blake2b_param_set_digest_length
+#define BLAKE2_PARAM_SET_KEY_LENGTH blake2b_param_set_key_length
+#define BLAKE2_PARAM_SET_PERSONAL blake2b_param_set_personal
+#define BLAKE2_PARAM_SET_SALT blake2b_param_set_salt
/* OSSL_DISPATCH symbol */
-# define BLAKE2_FUNCTIONS blake2bmac_functions
+#define BLAKE2_FUNCTIONS blake2bmac_functions
-# include "blake2_mac_impl.c"
+#include "blake2_mac_impl.c"
-#endif
diff --git a/providers/default/macs/blake2s_mac.c b/providers/default/macs/blake2s_mac.c
index 67a68cfa8a..ccd7035523 100644
--- a/providers/default/macs/blake2s_mac.c
+++ b/providers/default/macs/blake2s_mac.c
@@ -7,30 +7,25 @@
* https://www.openssl.org/source/license.html
*/
-#include <openssl/opensslconf.h>
-#ifndef OPENSSL_NO_BLAKE2
-
/* Constants */
-# define BLAKE2_CTX BLAKE2S_CTX
-# define BLAKE2_PARAM BLAKE2S_PARAM
-# define BLAKE2_KEYBYTES BLAKE2S_KEYBYTES
-# define BLAKE2_OUTBYTES BLAKE2S_OUTBYTES
-# define BLAKE2_PERSONALBYTES BLAKE2S_PERSONALBYTES
-# define BLAKE2_SALTBYTES BLAKE2S_SALTBYTES
+#define BLAKE2_CTX BLAKE2S_CTX
+#define BLAKE2_PARAM BLAKE2S_PARAM
+#define BLAKE2_KEYBYTES BLAKE2S_KEYBYTES
+#define BLAKE2_OUTBYTES BLAKE2S_OUTBYTES
+#define BLAKE2_PERSONALBYTES BLAKE2S_PERSONALBYTES
+#define BLAKE2_SALTBYTES BLAKE2S_SALTBYTES
/* Function names */
-# define BLAKE2_PARAM_INIT blake2s_param_init
-# define BLAKE2_INIT_KEY blake2s_init_key
-# define BLAKE2_UPDATE blake2s_update
-# define BLAKE2_FINAL blake2s_final
-# define BLAKE2_PARAM_SET_DIGEST_LENGTH blake2s_param_set_digest_length
-# define BLAKE2_PARAM_SET_KEY_LENGTH blake2s_param_set_key_length
-# define BLAKE2_PARAM_SET_PERSONAL blake2s_param_set_personal
-# define BLAKE2_PARAM_SET_SALT blake2s_param_set_salt
+#define BLAKE2_PARAM_INIT blake2s_param_init
+#define BLAKE2_INIT_KEY blake2s_init_key
+#define BLAKE2_UPDATE blake2s_update
+#define BLAKE2_FINAL blake2s_final
+#define BLAKE2_PARAM_SET_DIGEST_LENGTH blake2s_param_set_digest_length
+#define BLAKE2_PARAM_SET_KEY_LENGTH blake2s_param_set_key_length
+#define BLAKE2_PARAM_SET_PERSONAL blake2s_param_set_personal
+#define BLAKE2_PARAM_SET_SALT blake2s_param_set_salt
/* OSSL_DISPATCH symbol */
-# define BLAKE2_FUNCTIONS blake2smac_functions
-
-# include "blake2_mac_impl.c"
+#define BLAKE2_FUNCTIONS blake2smac_functions
-#endif
+#include "blake2_mac_impl.c"
diff --git a/providers/default/macs/build.info b/providers/default/macs/build.info
index d7014e1009..fa7f5e479a 100644
--- a/providers/default/macs/build.info
+++ b/providers/default/macs/build.info
@@ -1,4 +1,15 @@
LIBS=../../../libcrypto
-SOURCE[../../../libcrypto]=\
- blake2b_mac.c blake2s_mac.c siphash_prov.c poly1305_prov.c
+
+IF[{- !$disabled{blake2} -}]
+ SOURCE[../../../libcrypto]=blake2b_mac.c blake2s_mac.c
+ENDIF
+
+IF[{- !$disabled{siphash} -}]
+ SOURCE[../../../libcrypto]=siphash_prov.c
+ENDIF
+
+IF[{- !$disabled{poly1305} -}]
+ SOURCE[../../../libcrypto]=poly1305_prov.c
+ENDIF
+
INCLUDE[../../../libcrypto]=. ../../../crypto
diff --git a/providers/default/macs/poly1305_prov.c b/providers/default/macs/poly1305_prov.c
index db54fbe313..e76f982ace 100644
--- a/providers/default/macs/poly1305_prov.c
+++ b/providers/default/macs/poly1305_prov.c
@@ -7,25 +7,22 @@
* https://www.openssl.org/source/license.html
*/
-#include <openssl/opensslconf.h>
-#ifndef OPENSSL_NO_POLY1305
+#include <openssl/core_numbers.h>
+#include <openssl/core_names.h>
+#include <openssl/params.h>
+#include <openssl/evp.h>
+#include <openssl/err.h>
-# include <openssl/core_numbers.h>
-# include <openssl/core_names.h>
-# include <openssl/params.h>
-# include <openssl/evp.h>
-# include <openssl/err.h>
-
-# include "internal/poly1305.h"
+#include "internal/poly1305.h"
/*
* TODO(3.0) when poly1305 has moved entirely to our providers, this
* header should be moved to the provider include directory. For the
* moment, crypto/poly1305/poly1305_ameth.c has us stuck.
*/
-# include "../../../crypto/poly1305/poly1305_local.h"
+#include "../../../crypto/poly1305/poly1305_local.h"
-# include "internal/providercommonerr.h"
-# include "internal/provider_algs.h"
+#include "internal/providercommonerr.h"
+#include "internal/provider_algs.h"
/*
* Forward declaration of everything implemented here. This is not strictly
@@ -163,5 +160,3 @@ const OSSL_DISPATCH poly1305_functions[] = {
{ OSSL_FUNC_MAC_SET_CTX_PARAMS, (void (*)(void))poly1305_set_ctx_params },
{ 0, NULL }
};
-
-#endif
diff --git a/providers/default/macs/siphash_prov.c b/providers/default/macs/siphash_prov.c
index 91b46c9e77..1a36846bfe 100644
--- a/providers/default/macs/siphash_prov.c
+++ b/providers/default/macs/siphash_prov.c
@@ -7,26 +7,23 @@
* https://www.openssl.org/source/license.html
*/
-#include <openssl/opensslconf.h>
-#ifndef OPENSSL_NO_SIPHASH
-
-# include <string.h>
-# include <openssl/core_numbers.h>
-# include <openssl/core_names.h>
-# include <openssl/params.h>
-# include <openssl/evp.h>
-# include <openssl/err.h>
-
-# include "internal/siphash.h"
+#include <string.h>
+#include <openssl/core_numbers.h>
+#include <openssl/core_names.h>
+#include <openssl/params.h>
+#include <openssl/evp.h>
+#include <openssl/err.h>
+
+#include "internal/siphash.h"
/*
* TODO(3.0) when siphash has moved entirely to our providers, this
* header should be moved to the provider include directory. For the
* moment, crypto/siphash/siphash_ameth.c has us stuck.
*/
-# include "../../../crypto/siphash/siphash_local.h"
+#include "../../../crypto/siphash/siphash_local.h"
-# include "internal/providercommonerr.h"
-# include "internal/provider_algs.h"
+#include "internal/providercommonerr.h"
+#include "internal/provider_algs.h"
/*
* Forward declaration of everything implemented here. This is not strictly
@@ -174,5 +171,3 @@ const OSSL_DISPATCH siphash_functions[] = {
{ OSSL_FUNC_MAC_SET_CTX_PARAMS, (void (*)(void))siphash_set_params },
{ 0, NULL }
};
-
-#endif