Fix no-poly1305, no-siphash and no-blake2
authorMatt Caswell <matt@openssl.org>
Wed, 28 Aug 2019 13:57:56 +0000 (14:57 +0100)
committerMatt Caswell <matt@openssl.org>
Thu, 29 Aug 2019 10:12:25 +0000 (11:12 +0100)
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)

providers/default/macs/blake2_mac_impl.c
providers/default/macs/blake2b_mac.c
providers/default/macs/blake2s_mac.c
providers/default/macs/build.info
providers/default/macs/poly1305_prov.c
providers/default/macs/siphash_prov.c

index 846e5ef57b01b3141e71795ac5b9d003a6f0962a..a190b91b98c585fedce0498c6f215b3241d8a6b1 100644 (file)
@@ -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
index c020d2e1067a2bca182eedf309ba275b00055c8c..aa1a8dee1fa8c7b2426e7962dd00dcecb06eb93e 100644 (file)
@@ -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
index 67a68cfa8af2c592c4a09df985a7c13389fad3ce..ccd70355237a3787108dfe81928cee0a78dce7ad 100644 (file)
@@ -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"
index d7014e1009925f65319a9dcd87ed6d787e306e05..fa7f5e479a791574331f79c49a4b6aed99ef6148 100644 (file)
@@ -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
index db54fbe31331f9bb37238d5f00c150e9bc724bb6..e76f982ace207c6848a39a04fe78c95f46df9f40 100644 (file)
@@ -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
index 91b46c9e774d11c87fd1d147f8f29f4164783453..1a36846bfe36b588861305724cea517021256a87 100644 (file)
@@ -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