]> granicus.if.org Git - openssl/commitdiff
Providers: move all digests
authorRichard Levitte <levitte@openssl.org>
Fri, 4 Oct 2019 10:30:33 +0000 (12:30 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 10 Oct 2019 12:12:15 +0000 (14:12 +0200)
From providers/{common,default,legacy}/ to providers/implementations/
However, providers/common/digests/digest_common.c stays where it is,
because it's support code rather than an implementation.

To better support all kinds of implementations with common code, we
add the library providers/libcommon.a.  Code that ends up in this
library must be FIPS agnostic.

While we're moving things around, though, we move digestscommon.h
from providers/common/include/internal to providers/common/include/prov,
thereby starting on a provider specific include structure, which
follows the line of thoughts of the recent header file reorganization.
We modify the affected '#include "internal/something.h"' to
'#include "prov/something.h"'.

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/10088)

31 files changed:
crypto/blake2/m_blake2b.c
crypto/blake2/m_blake2s.c
crypto/evp/legacy_md5_sha1.c
crypto/md5/md5_sha1.c
providers/build.info
providers/common/digests/build.info
providers/common/digests/digest_common.c
providers/common/include/prov/digestcommon.h [moved from providers/common/include/internal/digestcommon.h with 100% similarity]
providers/default/build.info
providers/default/digests/build.info [deleted file]
providers/implementations/build.info
providers/implementations/digests/blake2_impl.h [moved from providers/default/digests/blake2_impl.h with 100% similarity]
providers/implementations/digests/blake2_prov.c [moved from providers/default/digests/blake2_prov.c with 94% similarity]
providers/implementations/digests/blake2b_prov.c [moved from providers/default/digests/blake2b_prov.c with 99% similarity]
providers/implementations/digests/blake2s_prov.c [moved from providers/default/digests/blake2s_prov.c with 99% similarity]
providers/implementations/digests/build.info [new file with mode: 0644]
providers/implementations/digests/md2_prov.c [moved from providers/legacy/digests/md2_prov.c with 94% similarity]
providers/implementations/digests/md4_prov.c [moved from providers/legacy/digests/md4_prov.c with 94% similarity]
providers/implementations/digests/md5_prov.c [moved from providers/default/digests/md5_prov.c with 94% similarity]
providers/implementations/digests/md5_sha1_prov.c [moved from providers/default/digests/md5_sha1_prov.c with 96% similarity]
providers/implementations/digests/mdc2_prov.c [moved from providers/legacy/digests/mdc2_prov.c with 97% similarity]
providers/implementations/digests/ripemd_prov.c [moved from providers/legacy/digests/ripemd_prov.c with 94% similarity]
providers/implementations/digests/sha2_prov.c [moved from providers/common/digests/sha2_prov.c with 98% similarity]
providers/implementations/digests/sha3_prov.c [moved from providers/common/digests/sha3_prov.c with 99% similarity]
providers/implementations/digests/sm3_prov.c [moved from providers/default/digests/sm3_prov.c with 94% similarity]
providers/implementations/digests/wp_prov.c [moved from providers/legacy/digests/wp_prov.c with 94% similarity]
providers/implementations/include/prov/blake2.h [moved from providers/default/include/internal/blake2.h with 100% similarity]
providers/implementations/include/prov/md5_sha1.h [moved from providers/default/include/internal/md5_sha1.h with 100% similarity]
providers/implementations/macs/blake2_mac_impl.c
providers/legacy/build.info
providers/legacy/digests/build.info [deleted file]

index 816dd06b6c83b4198b3e5a5c80287e52a7f384aa..bb3f145abda2fb0c61d5b711538128779cbd9a74 100644 (file)
@@ -12,7 +12,7 @@
 # include <stddef.h>
 # include <openssl/obj_mac.h>
 # include "crypto/evp.h"
-# include "internal/blake2.h"
+# include "prov/blake2.h"
 
 static int init(EVP_MD_CTX *ctx)
 {
index caf8a6657a128752f06fb9fb41fd634352965d0e..b04d63ec383e42eab0d0b50eab1a524b72b8471d 100644 (file)
@@ -12,7 +12,7 @@
 # include <stddef.h>
 # include <openssl/obj_mac.h>
 # include "crypto/evp.h"
-# include "internal/blake2.h"
+# include "prov/blake2.h"
 
 static int init(EVP_MD_CTX *ctx)
 {
index cba37bacd80e5a119b4bef5bca29d87da1aabe22..a23febfd53c79f2b66750c98807ba52a4075b9e5 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <openssl/opensslconf.h>
 
-#include "internal/md5_sha1.h"   /* diverse MD5_SHA1 macros */
+#include "prov/md5_sha1.h"   /* diverse MD5_SHA1 macros */
 
 #ifndef OPENSSL_NO_MD5
 
index 5d5fac95bd0d04ed9904303c7a418050865b27ef..32bf9a13fc6efd296c8c2c5f2bf6522486367b33 100644 (file)
@@ -7,7 +7,7 @@
  * https://www.openssl.org/source/license.html
  */
 #include <string.h>
-#include "internal/md5_sha1.h"
+#include "prov/md5_sha1.h"
 #include <openssl/evp.h>
 
 int md5_sha1_init(MD5_SHA1_CTX *mctx)
index 973adac5c74992479f9abd124d9793175c14e107..42b9c0aa9c8da404da5eb53dbd930d017108c0b0 100644 (file)
@@ -46,8 +46,8 @@ $LIBFIPS=libfips.a
 $COMMON_INCLUDES=../crypto ../include common/include
 
 INCLUDE[$LIBCOMMON]=$COMMON_INCLUDES
-INCLUDE[$LIBIMPLEMENTATIONS]=.. $COMMON_INCLUDES default/include
-INCLUDE[$LIBLEGACY]=$COMMON_INCLUDES
+INCLUDE[$LIBIMPLEMENTATIONS]=.. $COMMON_INCLUDES implementations/include
+INCLUDE[$LIBLEGACY]=$COMMON_INCLUDES implementations/include
 INCLUDE[$LIBNONFIPS]=$COMMON_INCLUDES
 INCLUDE[$LIBFIPS]=.. $COMMON_INCLUDES
 DEFINE[$LIBFIPS]=FIPS_MODE
@@ -82,6 +82,8 @@ LIBS{noinst}=$LIBNONFIPS $LIBIMPLEMENTATIONS
 # with DEPEND.
 $DEFAULTGOAL=../libcrypto
 SOURCE[$DEFAULTGOAL]=$LIBIMPLEMENTATIONS $LIBNONFIPS
+# Some legacy implementations depend on provider header files
+INCLUDE[../libcrypto]=implementations/include
 
 LIBS=$DEFAULTGOAL
 
index 2a8e8aa3975d3039e55aa53386897c9f3b8f2e75..730046d670aa26c789bbeddaba2bcdffc413db7d 100644 (file)
@@ -1,7 +1,2 @@
 # This source is common for all digests in all our providers.
 SOURCE[../../libcommon.a]=digest_common.c
-
-# These are our implementations
-$GOAL=../../libimplementations.a
-
-SOURCE[$GOAL]=sha2_prov.c sha3_prov.c
index 062209f32909740d3b43a837fe6b8ca9615439f4..92610a15245b8d0eea65593ac1b24f14456a338b 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "openssl/err.h"
-#include "internal/digestcommon.h"
+#include "prov/digestcommon.h"
 #include "internal/providercommonerr.h"
 
 int digest_default_get_params(OSSL_PARAM params[], size_t blksz, size_t paramsz,
index 67b4d3a977d24f288f27c0fc88c5fc4791b9a838..9a9760b7999824972016546cb6dfb49cd1d80bf5 100644 (file)
@@ -1,4 +1,4 @@
-SUBDIRS=digests ciphers
+SUBDIRS=ciphers
 $GOAL=../../libcrypto
 SOURCE[$GOAL]=defltprov.c
 INCLUDE[$GOAL]=include
diff --git a/providers/default/digests/build.info b/providers/default/digests/build.info
deleted file mode 100644 (file)
index 6869657..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-$GOAL=../../libimplementations.a
-
-IF[{- !$disabled{blake2} -}]
-  SOURCE[$GOAL]=\
-          blake2_prov.c blake2b_prov.c blake2s_prov.c
-ENDIF
-
-IF[{- !$disabled{sm3} -}]
-  SOURCE[$GOAL]=\
-          sm3_prov.c
-ENDIF
-
-IF[{- !$disabled{md5} -}]
-  SOURCE[$GOAL]=\
-          md5_prov.c md5_sha1_prov.c
-ENDIF
index 1170ef96b36584b9ea7b6119f9c1ca6b0d702954..86c581d7f740b4adcc64c8048d1053ea0afa154d 100644 (file)
@@ -1 +1 @@
-SUBDIRS=macs kdfs exchange keymgmt signature
+SUBDIRS=digests macs kdfs exchange keymgmt signature
similarity index 94%
rename from providers/default/digests/blake2_prov.c
rename to providers/implementations/digests/blake2_prov.c
index f299fb289d5bb431444ca9851fc5b70a1033ca57..16f301b177d40f0a48488696fa1a0b894e2306e9 100644 (file)
@@ -8,8 +8,8 @@
  */
 
 #include <openssl/crypto.h>
-#include "internal/blake2.h"
-#include "internal/digestcommon.h"
+#include "prov/blake2.h"
+#include "prov/digestcommon.h"
 #include "internal/provider_algs.h"
 
 OSSL_OP_digest_init_fn blake2s256_init;
similarity index 99%
rename from providers/default/digests/blake2b_prov.c
rename to providers/implementations/digests/blake2b_prov.c
index 2f8081268e5a1e5f933e7bee25715e4cb94b0f77..baa33e922fdfe18a2f3e547088783084f60799c8 100644 (file)
@@ -18,7 +18,7 @@
 #include <string.h>
 #include <openssl/crypto.h>
 #include "blake2_impl.h"
-#include "internal/blake2.h"
+#include "prov/blake2.h"
 
 static const uint64_t blake2b_IV[8] =
 {
similarity index 99%
rename from providers/default/digests/blake2s_prov.c
rename to providers/implementations/digests/blake2s_prov.c
index a9c757ea620ee81c64776f6dccd3c71e96c5abb6..703d8a8fabb2f220dd8ecea0cd2ee8d0e2a3c730 100644 (file)
@@ -18,7 +18,7 @@
 #include <string.h>
 #include <openssl/crypto.h>
 #include "blake2_impl.h"
-#include "internal/blake2.h"
+#include "prov/blake2.h"
 
 static const uint32_t blake2s_IV[8] =
 {
diff --git a/providers/implementations/digests/build.info b/providers/implementations/digests/build.info
new file mode 100644 (file)
index 0000000..2026de9
--- /dev/null
@@ -0,0 +1,52 @@
+# We make separate GOAL variables for each algorithm, to make it easy to
+# switch each to the Legacy provider when needed.
+
+$SHA1_GOAL=../../libimplementations.a
+$SHA2_GOAL=../../libimplementations.a
+$SHA3_GOAL=../../libimplementations.a
+$BLAKE2_GOAL=../../libimplementations.a
+$SM3_GOAL=../../libimplementations.a
+$MD5_GOAL=../../libimplementations.a
+
+$MD2_GOAL=../../liblegacy.a
+$MD4_GOAL=../../liblegacy.a
+$MDC2_GOAL=../../liblegacy.a
+$WHIRLPOOL_GOAL=../../liblegacy.a
+$RIPEMD_GOAL=../../liblegacy.a
+
+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
+
+IF[{- !$disabled{sm3} -}]
+  SOURCE[$SM3_GOAL]=sm3_prov.c
+ENDIF
+
+IF[{- !$disabled{md5} -}]
+  SOURCE[$MD5_GOAL]=md5_prov.c md5_sha1_prov.c
+ENDIF
+
+IF[{- !$disabled{md2} -}]
+  SOURCE[$MD2_GOAL]=md2_prov.c
+ENDIF
+
+IF[{- !$disabled{md4} -}]
+  SOURCE[$MD4_GOAL]=md4_prov.c
+ENDIF
+
+IF[{- !$disabled{mdc2} -}]
+  SOURCE[$MDC2_GOAL]=mdc2_prov.c
+ENDIF
+
+IF[{- !$disabled{whirlpool} -}]
+  SOURCE[$WHIRLPOOL_GOAL]=wp_prov.c
+ENDIF
+
+IF[{- !$disabled{rmd160} -}]
+  SOURCE[$RIPEMD_GOAL]=ripemd_prov.c
+ENDIF
similarity index 94%
rename from providers/legacy/digests/md2_prov.c
rename to providers/implementations/digests/md2_prov.c
index 2a4439d26c61c610590124ca9f7270ca9259dd07..ab1d605218caed4a8505719aba9513816a050cd9 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <openssl/crypto.h>
 #include <openssl/md2.h>
-#include "internal/digestcommon.h"
+#include "prov/digestcommon.h"
 #include "internal/provider_algs.h"
 
 /* md2_functions */
similarity index 94%
rename from providers/legacy/digests/md4_prov.c
rename to providers/implementations/digests/md4_prov.c
index 8486b7b48de65dcd43f96fb8444432995f301282..6b311c075d09dba27682f05ba7305049f235d14d 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <openssl/crypto.h>
 #include <openssl/md4.h>
-#include "internal/digestcommon.h"
+#include "prov/digestcommon.h"
 #include "internal/provider_algs.h"
 
 /* md4_functions */
similarity index 94%
rename from providers/default/digests/md5_prov.c
rename to providers/implementations/digests/md5_prov.c
index c688bebac03c412e3ad068217b137b87a4158b79..1205888ff90666088d5fb202df5775ff368ccf93 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <openssl/crypto.h>
 #include <openssl/md5.h>
-#include "internal/digestcommon.h"
+#include "prov/digestcommon.h"
 #include "internal/provider_algs.h"
 
 /* md5_functions */
similarity index 96%
rename from providers/default/digests/md5_sha1_prov.c
rename to providers/implementations/digests/md5_sha1_prov.c
index 7f224cba4fd8dd1e593f9e3c91039ed78cf8c708..ff6e2ed121ad39bf10517f9e7a7cc7ad112f46d2 100644 (file)
@@ -12,8 +12,8 @@
 #include <openssl/evp.h>
 #include <openssl/params.h>
 #include <openssl/core_names.h>
-#include "internal/md5_sha1.h"
-#include "internal/digestcommon.h"
+#include "prov/md5_sha1.h"
+#include "prov/digestcommon.h"
 #include "internal/provider_algs.h"
 
 static OSSL_OP_digest_set_ctx_params_fn md5_sha1_set_ctx_params;
similarity index 97%
rename from providers/legacy/digests/mdc2_prov.c
rename to providers/implementations/digests/mdc2_prov.c
index cf37b528e7357e8deb945ce2da51bcd9078a85a8..f0ae8b374235fd5eb1a839a0e3787add7e493e27 100644 (file)
@@ -12,7 +12,7 @@
 #include <openssl/mdc2.h>
 #include <openssl/core_names.h>
 #include <openssl/err.h>
-#include "internal/digestcommon.h"
+#include "prov/digestcommon.h"
 #include "internal/provider_algs.h"
 #include "internal/providercommonerr.h"
 
similarity index 94%
rename from providers/legacy/digests/ripemd_prov.c
rename to providers/implementations/digests/ripemd_prov.c
index 314b69a3fb7cb164c954825e1054ce9d2471f40d..4f11f79e4c34f4b6672a53da5c7cf24729abdb12 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <openssl/crypto.h>
 #include <openssl/ripemd.h>
-#include "internal/digestcommon.h"
+#include "prov/digestcommon.h"
 #include "internal/provider_algs.h"
 
 /* ripemd160_functions */
similarity index 98%
rename from providers/common/digests/sha2_prov.c
rename to providers/implementations/digests/sha2_prov.c
index d2c7df2ee684028baa2c34b7292907d8ac34790e..3c07e784cfb29afc62c99a7ecc4de24fda53b84b 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/evp.h>
 #include <openssl/params.h>
 #include <openssl/core_names.h>
-#include "internal/digestcommon.h"
+#include "prov/digestcommon.h"
 #include "internal/provider_algs.h"
 #include "crypto/sha.h"
 
similarity index 99%
rename from providers/common/digests/sha3_prov.c
rename to providers/implementations/digests/sha3_prov.c
index 0563d0cfc196a3dbf204fcd59b08167aefe1b47f..5adc7b2976b73b21ef80f71b7c1f55a4ce2597f7 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/params.h>
 #include <openssl/err.h>
 #include "internal/sha3.h"
-#include "internal/digestcommon.h"
+#include "prov/digestcommon.h"
 #include "internal/provider_algs.h"
 #include "internal/providercommonerr.h"
 
similarity index 94%
rename from providers/default/digests/sm3_prov.c
rename to providers/implementations/digests/sm3_prov.c
index 512e3cb1c138a5f00a5d86639026a701fa25ad75..bd9d833184d3ac4c804326c7f464e30ef5b1294d 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <openssl/crypto.h>
 #include "internal/sm3.h"
-#include "internal/digestcommon.h"
+#include "prov/digestcommon.h"
 #include "internal/provider_algs.h"
 
 /* sm3_functions */
similarity index 94%
rename from providers/legacy/digests/wp_prov.c
rename to providers/implementations/digests/wp_prov.c
index eaa41b0af1a1e7823f920030cb17fa458e12c12d..1dd5aa36e41179e02f6efbd2639502f1ae2f8bb8 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <openssl/crypto.h>
 #include <openssl/whrlpool.h>
-#include "internal/digestcommon.h"
+#include "prov/digestcommon.h"
 #include "internal/provider_algs.h"
 
 /* wp_functions */
index a190b91b98c585fedce0498c6f215b3241d8a6b1..a191e78defbf4165cb79dc6b42699406b62b60f7 100644 (file)
@@ -11,7 +11,7 @@
 #include <openssl/core_names.h>
 #include <openssl/params.h>
 
-#include "internal/blake2.h"
+#include "prov/blake2.h"
 #include "internal/cryptlib.h"
 #include "internal/providercommonerr.h"
 #include "internal/provider_algs.h"
index 713c48dbe60035a19e72e6aa2d8e0d09adc28fcf..1236f15818d053727c5e05e0d376729f102fa1d5 100644 (file)
@@ -1,4 +1,3 @@
-SUBDIRS=digests
 IF[{- $disabled{module} -}]
   $GOAL=../../libcrypto
 ELSE
diff --git a/providers/legacy/digests/build.info b/providers/legacy/digests/build.info
deleted file mode 100644 (file)
index 4e1aeb6..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-$GOAL=../../liblegacy.a
-
-IF[{- !$disabled{md2} -}]
-  SOURCE[$GOAL]=md2_prov.c
-ENDIF
-
-IF[{- !$disabled{md4} -}]
-  SOURCE[$GOAL]=md4_prov.c
-ENDIF
-
-IF[{- !$disabled{mdc2} -}]
-  SOURCE[$GOAL]=mdc2_prov.c
-ENDIF
-
-IF[{- !$disabled{whirlpool} -}]
-  SOURCE[$GOAL]=wp_prov.c
-ENDIF
-
-IF[{- !$disabled{rmd160} -}]
-  SOURCE[$GOAL]=ripemd_prov.c
-ENDIF