Browse Source

Providers: move all digests

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)
master
Richard Levitte 3 years ago
parent
commit
7c214f1092
31 changed files with 79 additions and 68 deletions
  1. +1
    -1
      crypto/blake2/m_blake2b.c
  2. +1
    -1
      crypto/blake2/m_blake2s.c
  3. +1
    -1
      crypto/evp/legacy_md5_sha1.c
  4. +1
    -1
      crypto/md5/md5_sha1.c
  5. +4
    -2
      providers/build.info
  6. +0
    -5
      providers/common/digests/build.info
  7. +1
    -1
      providers/common/digests/digest_common.c
  8. +0
    -0
      providers/common/include/prov/digestcommon.h
  9. +1
    -1
      providers/default/build.info
  10. +0
    -16
      providers/default/digests/build.info
  11. +1
    -1
      providers/implementations/build.info
  12. +0
    -0
      providers/implementations/digests/blake2_impl.h
  13. +2
    -2
      providers/implementations/digests/blake2_prov.c
  14. +1
    -1
      providers/implementations/digests/blake2b_prov.c
  15. +1
    -1
      providers/implementations/digests/blake2s_prov.c
  16. +52
    -0
      providers/implementations/digests/build.info
  17. +1
    -1
      providers/implementations/digests/md2_prov.c
  18. +1
    -1
      providers/implementations/digests/md4_prov.c
  19. +1
    -1
      providers/implementations/digests/md5_prov.c
  20. +2
    -2
      providers/implementations/digests/md5_sha1_prov.c
  21. +1
    -1
      providers/implementations/digests/mdc2_prov.c
  22. +1
    -1
      providers/implementations/digests/ripemd_prov.c
  23. +1
    -1
      providers/implementations/digests/sha2_prov.c
  24. +1
    -1
      providers/implementations/digests/sha3_prov.c
  25. +1
    -1
      providers/implementations/digests/sm3_prov.c
  26. +1
    -1
      providers/implementations/digests/wp_prov.c
  27. +0
    -0
      providers/implementations/include/prov/blake2.h
  28. +0
    -0
      providers/implementations/include/prov/md5_sha1.h
  29. +1
    -1
      providers/implementations/macs/blake2_mac_impl.c
  30. +0
    -1
      providers/legacy/build.info
  31. +0
    -21
      providers/legacy/digests/build.info

+ 1
- 1
crypto/blake2/m_blake2b.c View 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)
{


+ 1
- 1
crypto/blake2/m_blake2s.c View 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)
{


+ 1
- 1
crypto/evp/legacy_md5_sha1.c View 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


+ 1
- 1
crypto/md5/md5_sha1.c View 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)


+ 4
- 2
providers/build.info View 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


+ 0
- 5
providers/common/digests/build.info View 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

+ 1
- 1
providers/common/digests/digest_common.c View 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,


providers/common/include/internal/digestcommon.h → providers/common/include/prov/digestcommon.h View File


+ 1
- 1
providers/default/build.info View File

@ -1,4 +1,4 @@
SUBDIRS=digests ciphers
SUBDIRS=ciphers
$GOAL=../../libcrypto
SOURCE[$GOAL]=defltprov.c
INCLUDE[$GOAL]=include

+ 0
- 16
providers/default/digests/build.info View File

@ -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

+ 1
- 1
providers/implementations/build.info View File

@ -1 +1 @@
SUBDIRS=macs kdfs exchange keymgmt signature
SUBDIRS=digests macs kdfs exchange keymgmt signature

providers/default/digests/blake2_impl.h → providers/implementations/digests/blake2_impl.h View File


providers/default/digests/blake2_prov.c → providers/implementations/digests/blake2_prov.c View File


providers/default/digests/blake2b_prov.c → providers/implementations/digests/blake2b_prov.c View File


providers/default/digests/blake2s_prov.c → providers/implementations/digests/blake2s_prov.c View File


+ 52
- 0
providers/implementations/digests/build.info View File

@ -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

providers/legacy/digests/md2_prov.c → providers/implementations/digests/md2_prov.c View File


providers/legacy/digests/md4_prov.c → providers/implementations/digests/md4_prov.c View File


providers/default/digests/md5_prov.c → providers/implementations/digests/md5_prov.c View File


providers/default/digests/md5_sha1_prov.c → providers/implementations/digests/md5_sha1_prov.c View File


providers/legacy/digests/mdc2_prov.c → providers/implementations/digests/mdc2_prov.c View File


providers/legacy/digests/ripemd_prov.c → providers/implementations/digests/ripemd_prov.c View File


providers/common/digests/sha2_prov.c → providers/implementations/digests/sha2_prov.c View File


providers/common/digests/sha3_prov.c → providers/implementations/digests/sha3_prov.c View File


providers/default/digests/sm3_prov.c → providers/implementations/digests/sm3_prov.c View File


providers/legacy/digests/wp_prov.c → providers/implementations/digests/wp_prov.c View File


providers/default/include/internal/blake2.h → providers/implementations/include/prov/blake2.h View File


providers/default/include/internal/md5_sha1.h → providers/implementations/include/prov/md5_sha1.h View File


+ 1
- 1
providers/implementations/macs/blake2_mac_impl.c View 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"


+ 0
- 1
providers/legacy/build.info View File

@ -1,4 +1,3 @@
SUBDIRS=digests
IF[{- $disabled{module} -}]
$GOAL=../../libcrypto
ELSE


+ 0
- 21
providers/legacy/digests/build.info View File

@ -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

Loading…
Cancel
Save