Move providers/common/{ciphers,digests}/* to providers/implementations
authorRichard Levitte <levitte@openssl.org>
Tue, 3 Dec 2019 18:41:05 +0000 (19:41 +0100)
committerRichard Levitte <levitte@openssl.org>
Wed, 11 Dec 2019 11:55:48 +0000 (12:55 +0100)
The idea to have all these things in providers/common was viable as
long as the implementations was spread around their main providers.
This is, however, no longer the case, so we move the common blocks
closer to the source that use them.

Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/10564)

34 files changed:
providers/build.info
providers/common/build.info
providers/common/ciphers/build.info [deleted file]
providers/common/digests/build.info [deleted file]
providers/implementations/ciphers/build.info
providers/implementations/ciphers/cipher_aes_ccm.c
providers/implementations/ciphers/cipher_aes_ccm_hw.c
providers/implementations/ciphers/cipher_aes_ccm_hw_aesni.inc
providers/implementations/ciphers/cipher_aes_ccm_hw_s390x.inc
providers/implementations/ciphers/cipher_aes_ccm_hw_t4.inc
providers/implementations/ciphers/cipher_aes_gcm.c
providers/implementations/ciphers/cipher_aes_gcm_hw.c
providers/implementations/ciphers/cipher_aes_gcm_hw_aesni.inc
providers/implementations/ciphers/cipher_aes_gcm_hw_s390x.inc
providers/implementations/ciphers/cipher_aes_gcm_hw_t4.inc
providers/implementations/ciphers/cipher_aes_ocb.c
providers/implementations/ciphers/cipher_aes_siv.c
providers/implementations/ciphers/cipher_aria_ccm.h
providers/implementations/ciphers/cipher_aria_gcm.h
providers/implementations/ciphers/ciphercommon.c [moved from providers/common/ciphers/cipher_common.c with 99% similarity]
providers/implementations/ciphers/ciphercommon_block.c [moved from providers/common/ciphers/block.c with 99% similarity]
providers/implementations/ciphers/ciphercommon_ccm.c [moved from providers/common/ciphers/cipher_ccm.c with 99% similarity]
providers/implementations/ciphers/ciphercommon_ccm_hw.c [moved from providers/common/ciphers/cipher_ccm_hw.c with 98% similarity]
providers/implementations/ciphers/ciphercommon_gcm.c [moved from providers/common/ciphers/cipher_gcm.c with 99% similarity]
providers/implementations/ciphers/ciphercommon_gcm_hw.c [moved from providers/common/ciphers/cipher_gcm_hw.c with 99% similarity]
providers/implementations/ciphers/ciphercommon_hw.c [moved from providers/common/ciphers/cipher_common_hw.c with 100% similarity]
providers/implementations/ciphers/ciphercommon_local.h [moved from providers/common/ciphers/cipher_local.h with 100% similarity]
providers/implementations/digests/build.info
providers/implementations/digests/digestcommon.c [moved from providers/common/digests/digest_common.c with 100% similarity]
providers/implementations/include/prov/ciphercommon.h [moved from providers/common/include/prov/ciphercommon.h with 100% similarity]
providers/implementations/include/prov/ciphercommon_aead.h [moved from providers/common/include/prov/cipher_aead.h with 100% similarity]
providers/implementations/include/prov/ciphercommon_ccm.h [moved from providers/common/include/prov/cipher_ccm.h with 99% similarity]
providers/implementations/include/prov/ciphercommon_gcm.h [moved from providers/common/include/prov/cipher_gcm.h with 99% similarity]
providers/implementations/include/prov/digestcommon.h [moved from providers/common/include/prov/digestcommon.h with 100% similarity]

index c31c4271defd7c1d1d5adb424f06ed71226fcf58..39e767fb0e784eed0a2b481136526529d6fdb6e8 100644 (file)
@@ -40,14 +40,14 @@ $LIBNONFIPS=libnonfips.a
 $LIBFIPS=libfips.a
 
 # Enough of our implementations include prov/ciphercommon.h (present in
-# providers/common/include), which includes crypto/ciphermode_platform.h
+# providers/implementations/include), which includes crypto/ciphermode_platform.h
 # (present in include), which in turn may include very internal header
 # files in crypto/, so let's have a common include list for them all.
-$COMMON_INCLUDES=../crypto ../include common/include
+$COMMON_INCLUDES=../crypto ../include implementations/include common/include
 
 INCLUDE[$LIBCOMMON]=$COMMON_INCLUDES
-INCLUDE[$LIBIMPLEMENTATIONS]=.. $COMMON_INCLUDES implementations/include
-INCLUDE[$LIBLEGACY]=$COMMON_INCLUDES implementations/include
+INCLUDE[$LIBIMPLEMENTATIONS]=.. $COMMON_INCLUDES
+INCLUDE[$LIBLEGACY]=$COMMON_INCLUDES
 INCLUDE[$LIBNONFIPS]=$COMMON_INCLUDES
 INCLUDE[$LIBFIPS]=.. $COMMON_INCLUDES
 DEFINE[$LIBFIPS]=FIPS_MODE
@@ -84,7 +84,7 @@ $DEFAULTGOAL=../libcrypto
 SOURCE[$DEFAULTGOAL]=$LIBIMPLEMENTATIONS $LIBNONFIPS
 SOURCE[$DEFAULTGOAL]=defltprov.c
 # Some legacy implementations depend on provider header files
-INCLUDE[../libcrypto]=implementations/include
+INCLUDE[$DEFAULTGOAL]=implementations/include
 
 LIBS=$DEFAULTGOAL
 
index 3f20fb3c09b3748289ed3786788c4c3392402a8d..ccc99e515b305a471c22b19fcf1d76f85d3ab424 100644 (file)
@@ -1,5 +1,3 @@
-SUBDIRS=digests ciphers
-
 SOURCE[../libcommon.a]=provider_err.c bio_prov.c
 $FIPSCOMMON=provider_util.c
 SOURCE[../libnonfips.a]=$FIPSCOMMON nid_to_name.c
diff --git a/providers/common/ciphers/build.info b/providers/common/ciphers/build.info
deleted file mode 100644 (file)
index b76b8ba..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-# This source is common building blocks for all ciphers in all our providers.
-SOURCE[../../libcommon.a]=\
-        cipher_common.c cipher_common_hw.c block.c \
-        cipher_gcm.c cipher_gcm_hw.c \
-        cipher_ccm.c cipher_ccm_hw.c
diff --git a/providers/common/digests/build.info b/providers/common/digests/build.info
deleted file mode 100644 (file)
index 730046d..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-# This source is common for all digests in all our providers.
-SOURCE[../../libcommon.a]=digest_common.c
index 0a76962669e91a7e1591681d72ffc75c427f91db..abc193bb1de56743aa731a93751ffc491af9669d 100644 (file)
@@ -5,6 +5,8 @@
 # The latter may become legacy sooner, so it's comfortable to have two
 # variables already now, to switch the non-FIPSable TDES to legacy if needed.
 
+$COMMON_GOAL=../../libcommon.a
+
 $AES_GOAL=../../libimplementations.a
 $TDES_1_GOAL=../../libimplementations.a
 $TDES_2_GOAL=../../libimplementations.a
@@ -23,6 +25,12 @@ $CHACHA_GOAL=../../libimplementations.a
 $CHACHAPOLY_GOAL=../../libimplementations.a
 $SIV_GOAL=../../libimplementations.a
 
+# This source is common building blocks for all ciphers in all our providers.
+SOURCE[$COMMON_GOAL]=\
+        ciphercommon.c ciphercommon_hw.c ciphercommon_block.c \
+        ciphercommon_gcm.c ciphercommon_gcm_hw.c \
+        ciphercommon_ccm.c ciphercommon_ccm_hw.c
+
 IF[{- !$disabled{des} -}]
   SOURCE[$TDES_1_GOAL]=cipher_tdes.c cipher_tdes_hw.c
 ENDIF
index c1fb51b56575bf54a7a860f19848f990048ebe7e..b6655143d958279aca28688b8078383b5e2b5ce3 100644 (file)
@@ -10,7 +10,7 @@
 /* Dispatch functions for AES CCM mode */
 
 #include "prov/ciphercommon.h"
-#include "prov/cipher_ccm.h"
+#include "prov/ciphercommon_ccm.h"
 #include "prov/implementations.h"
 
 static void *aes_ccm_newctx(void *provctx, size_t keybits)
index ae200ebada6bb6bcc60734d280e5dcb679726d32..0b1e50163b29a292a3a030921ba451787fc7857c 100644 (file)
@@ -10,7 +10,7 @@
 /* AES CCM mode */
 
 #include "prov/ciphercommon.h"
-#include "prov/cipher_ccm.h"
+#include "prov/ciphercommon_ccm.h"
 
 #define AES_HW_CCM_SET_KEY_FN(fn_set_enc_key, fn_blk, fn_ccm_enc, fn_ccm_dec)  \
     fn_set_enc_key(key, keylen * 8, &actx->ccm.ks.ks);                         \
index 3a5e4a740ddbc46fecfa4a96b7cee073dd1c84a8..7e835658095e9d6d0434eb591cffa219123b9c93 100644 (file)
@@ -9,7 +9,7 @@
 
 /*-
  * AES-NI support for AES CCM.
- * This file is included by cipher_ccm_hw.c
+ * This file is included by cipher_aes_ccm_hw.c
  */
 
 static int ccm_aesni_initkey(PROV_CCM_CTX *ctx, const unsigned char *key,
index a5025e5960feffd6b3e0f2ee1bf117dea10af030..cec7c9690277919f92f43d9ac38c08f9032ab253 100644 (file)
@@ -9,7 +9,7 @@
 
 /*-
  * S390X support for AES CCM.
- * This file is included by cipher_ccm_hw.c
+ * This file is included by cipher_aes_ccm_hw.c
  */
 
 #define S390X_CCM_AAD_FLAG 0x40
index 21bf6861e0bd4ca4af788d891ecffd2c39ced19e..c4b6d15ed9e663e35a1503c1bdf516fa185f2a6d 100644 (file)
@@ -9,7 +9,7 @@
 
 /*-
  * Fujitsu SPARC64 X support for AES CCM.
- * This file is included by cipher_ccm_hw.c
+ * This file is included by cipher_aes_ccm_hw.c
  */
 
 static int ccm_t4_aes_initkey(PROV_CCM_CTX *ctx, const unsigned char *key,
index 4ebc8140ee45e025d5744ba3c0e523e19b61eb7a..18277c705e33627c4afaefd80d800de9000cc916 100644 (file)
@@ -10,7 +10,7 @@
 /* Dispatch functions for AES GCM mode */
 
 #include "prov/ciphercommon.h"
-#include "prov/cipher_gcm.h"
+#include "prov/ciphercommon_gcm.h"
 #include "prov/implementations.h"
 
 static void *aes_gcm_newctx(void *provctx, size_t keybits)
index f5dc0c4eed37ecec1617d9d3b85d1bf1d04ce692..6a2f8a5fd47b5db0f2bff734546f8bae0c907c2b 100644 (file)
@@ -10,7 +10,7 @@
 /* Dispatch functions for AES GCM mode */
 
 #include "prov/ciphercommon.h"
-#include "prov/cipher_gcm.h"
+#include "prov/ciphercommon_gcm.h"
 
 static int generic_aes_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
                                    size_t keylen)
index eb2a3f343a83f7657fcd0f4ef4d8b1e3a751ec46..2fc86982c036ed3dc7b2dfa0152fdad7f479051f 100644 (file)
@@ -9,7 +9,7 @@
 
 /*-
  * AES-NI support for AES GCM.
- * This file is included by cipher_gcm_hw.c
+ * This file is included by cipher_aes_gcm_hw.c
  */
 
 static int aesni_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
index 44c3bf332d9dab8c1d57d287ebf0892181f9524e..e13771a44959a5f6629a0fef9a208e76767c0e13 100644 (file)
@@ -9,7 +9,7 @@
 
 /*-
  * IBM S390X support for AES GCM.
- * This file is included by cipher_gcm_hw.c
+ * This file is included by cipher_aes_gcm_hw.c
  */
 
 /* iv + padding length for iv lengths != 12 */
index 19e9ccb760749912e6faa036e9b536ad84e2b888..cc7d4ba528ef51bbdff8fcc6ac6d054440dfdda7 100644 (file)
@@ -9,7 +9,7 @@
 
 /*-
  * Fujitsu SPARC64 X support for AES GCM.
- * This file is included by cipher_gcm_hw.c
+ * This file is included by cipher_aes_gcm_hw.c
  */
 
 static int t4_aes_gcm_initkey(PROV_GCM_CTX *ctx, const unsigned char *key,
index 6b07caaa52e875677d43aff2b198c391b1e51ca3..03ec70b9498b6a873bad027fd78c87f144947860 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "cipher_aes_ocb.h"
 #include "prov/providercommonerr.h"
-#include "prov/cipher_aead.h"
+#include "prov/ciphercommon_aead.h"
 #include "prov/implementations.h"
 
 #define AES_OCB_FLAGS AEAD_FLAGS
index 864ebc725edfb934644d29512728c373da114193..ada6b27435c530e5e1b5c1e3c023a3e5c1880911 100644 (file)
@@ -12,7 +12,7 @@
 #include "cipher_aes_siv.h"
 #include "prov/implementations.h"
 #include "prov/providercommonerr.h"
-#include "prov/cipher_aead.h"
+#include "prov/ciphercommon_aead.h"
 
 #define siv_stream_update siv_cipher
 #define SIV_FLAGS AEAD_FLAGS
index 301ce14306b31684a05f31e298429fbea0dcf4fd..a85cf899efd1af227a7d940ee3813ac91918d091 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "crypto/aria.h"
 #include "prov/ciphercommon.h"
-#include "prov/cipher_ccm.h"
+#include "prov/ciphercommon_ccm.h"
 
 typedef struct prov_aria_ccm_ctx_st {
     PROV_CCM_CTX base; /* Must be first */
index 13fbe175d93ae43b22ddecc16b817a8da2b51c9e..2d08a5902903d89eee747038e92d6f136b54b973 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "crypto/aria.h"
 #include "prov/ciphercommon.h"
-#include "prov/cipher_gcm.h"
+#include "prov/ciphercommon_gcm.h"
 
 typedef struct prov_aria_gcm_ctx_st {
     PROV_GCM_CTX base;              /* must be first entry in struct */
similarity index 99%
rename from providers/common/ciphers/cipher_common.c
rename to providers/implementations/ciphers/ciphercommon.c
index 83c370793bf20ecbdd713a0cff9eff32bb926465..a6b890704e1ea73abbd41dbd036387ccc4fb1867 100644 (file)
@@ -11,7 +11,7 @@
  * Generic dispatch table functions for ciphers.
  */
 
-#include "cipher_local.h"
+#include "ciphercommon_local.h"
 #include "prov/provider_ctx.h"
 #include "prov/providercommonerr.h"
 
similarity index 99%
rename from providers/common/ciphers/block.c
rename to providers/implementations/ciphers/ciphercommon_block.c
index 95acfaf3234e2c1d5140721bffd1b6cf6954bbe6..eff94842ed9f8b9a585478c5c8c68965c0926a69 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <assert.h>
-#include "cipher_local.h"
+#include "ciphercommon_local.h"
 #include "prov/providercommonerr.h"
 
 /*
similarity index 99%
rename from providers/common/ciphers/cipher_ccm.c
rename to providers/implementations/ciphers/ciphercommon_ccm.c
index 021a004276245df9d0fd4bb9b6c1c6624ba91a4f..edb8e81bf9869af0a2d242239d5137ea19466084 100644 (file)
@@ -10,7 +10,7 @@
 /* Dispatch functions for ccm mode */
 
 #include "prov/ciphercommon.h"
-#include "prov/cipher_ccm.h"
+#include "prov/ciphercommon_ccm.h"
 #include "prov/providercommonerr.h"
 
 static int ccm_cipher_internal(PROV_CCM_CTX *ctx, unsigned char *out,
similarity index 98%
rename from providers/common/ciphers/cipher_ccm_hw.c
rename to providers/implementations/ciphers/ciphercommon_ccm_hw.c
index 5503a41687c94c152a9f8efa099e55b4ab0d34d1..96cc744f879d17d33a682a72c2fb29e884cccf83 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "prov/ciphercommon.h"
-#include "prov/cipher_ccm.h"
+#include "prov/ciphercommon_ccm.h"
 
 int ccm_generic_setiv(PROV_CCM_CTX *ctx, const unsigned char *nonce,
                       size_t nlen, size_t mlen)
similarity index 99%
rename from providers/common/ciphers/cipher_gcm.c
rename to providers/implementations/ciphers/ciphercommon_gcm.c
index 619d4f61b0790d713d0b6ea88a60076a1d1af27c..803f810a30088c1ee58d8aff3b3430f7c7d734a8 100644 (file)
@@ -10,7 +10,7 @@
 /* Dispatch functions for gcm mode */
 
 #include "prov/ciphercommon.h"
-#include "prov/cipher_gcm.h"
+#include "prov/ciphercommon_gcm.h"
 #include "prov/providercommonerr.h"
 #include "crypto/rand.h"
 #include "prov/provider_ctx.h"
similarity index 99%
rename from providers/common/ciphers/cipher_gcm_hw.c
rename to providers/implementations/ciphers/ciphercommon_gcm_hw.c
index 09e3c2740086d43a036ee437e597bb1579ac16e0..60c7ac5d8fa76dc807e1a194b4c497cffc7f254d 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "prov/ciphercommon.h"
-#include "prov/cipher_gcm.h"
+#include "prov/ciphercommon_gcm.h"
 
 
 int gcm_setiv(PROV_GCM_CTX *ctx, const unsigned char *iv, size_t ivlen)
index 2026de95d7b3744a58530f615dcc1eab86365c40..a90636cbb9dbc9dd6b24c1d9e26337566ee882cb 100644 (file)
@@ -1,6 +1,8 @@
 # We make separate GOAL variables for each algorithm, to make it easy to
 # switch each to the Legacy provider when needed.
 
+$COMMON_GOAL=../../libcommon.a
+
 $SHA1_GOAL=../../libimplementations.a
 $SHA2_GOAL=../../libimplementations.a
 $SHA3_GOAL=../../libimplementations.a
@@ -14,11 +16,12 @@ $MDC2_GOAL=../../liblegacy.a
 $WHIRLPOOL_GOAL=../../liblegacy.a
 $RIPEMD_GOAL=../../liblegacy.a
 
+# This source is common for all digests in all our providers.
+SOURCE[$COMMON_GOAL]=digestcommon.c
+
 SOURCE[$SHA2_GOAL]=sha2_prov.c
 SOURCE[$SHA3_GOAL]=sha3_prov.c
 
-$GOAL=../../libimplementations.a
-
 IF[{- !$disabled{blake2} -}]
   SOURCE[$BLAKE2_GOAL]=blake2_prov.c blake2b_prov.c blake2s_prov.c
 ENDIF
similarity index 99%
rename from providers/common/include/prov/cipher_ccm.h
rename to providers/implementations/include/prov/ciphercommon_ccm.h
index 2214b5fc647f5f3c90a5fb2ca682f1c0ea21d157..0c2af15d54f37f58edfcb761e0e5d660ac2e1a5c 100644 (file)
@@ -7,7 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include "cipher_aead.h"
+#include "ciphercommon_aead.h"
 
 typedef struct prov_ccm_hw_st PROV_CCM_HW;
 
similarity index 99%
rename from providers/common/include/prov/cipher_gcm.h
rename to providers/implementations/include/prov/ciphercommon_gcm.h
index 711b40cdd4bcd0c874f11f543b3a7734ac8e69a0..1932e14c4cdc0d0173c39d2e56712aa42f9c2ead 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include <openssl/aes.h>
-#include "cipher_aead.h"
+#include "ciphercommon_aead.h"
 
 typedef struct prov_gcm_hw_st PROV_GCM_HW;