Cleanup: move remaining providers/common/include/internal/*.h
authorRichard Levitte <levitte@openssl.org>
Fri, 4 Oct 2019 13:25:59 +0000 (15:25 +0200)
committerRichard Levitte <levitte@openssl.org>
Thu, 10 Oct 2019 12:12:15 +0000 (14:12 +0200)
The end up in providers/common/include/prov/.
All inclusions are adjusted accordingly.

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

51 files changed:
crypto/err/err_all.c
crypto/err/openssl.ec
crypto/initthread.c
crypto/rand/drbg_hash.c
crypto/rand/drbg_hmac.c
doc/internal/man3/ossl_prov_util_nid_to_name.pod
providers/common/ciphers/block.c
providers/common/ciphers/cipher_ccm.c
providers/common/ciphers/cipher_common.c
providers/common/ciphers/cipher_gcm.c
providers/common/digests/digest_common.c
providers/common/include/internal/provider_ctx.h [deleted file]
providers/common/include/internal/provider_util.h [deleted file]
providers/common/include/internal/providercommon.h [deleted file]
providers/common/include/internal/providercommonerr.h [deleted file]
providers/common/include/prov/provider_ctx.h [new file with mode: 0644]
providers/common/include/prov/provider_util.h [new file with mode: 0644]
providers/common/include/prov/providercommon.h [new file with mode: 0644]
providers/common/include/prov/providercommonerr.h [new file with mode: 0644]
providers/common/provider_err.c
providers/common/provider_util.c
providers/common/provlib.c
providers/fips/build.info
providers/fips/fipsprov.c
providers/implementations/ciphers/cipher_aes_hw.c
providers/implementations/ciphers/cipher_aes_ocb.c
providers/implementations/ciphers/cipher_aes_wrp.c
providers/implementations/ciphers/cipher_aes_xts.c
providers/implementations/ciphers/cipher_des.c
providers/implementations/ciphers/cipher_rc2.c
providers/implementations/ciphers/cipher_rc5.c
providers/implementations/ciphers/cipher_tdes.c
providers/implementations/ciphers/cipher_tdes_wrap.c
providers/implementations/digests/mdc2_prov.c
providers/implementations/digests/sha3_prov.c
providers/implementations/kdfs/hkdf.c
providers/implementations/kdfs/kbkdf.c
providers/implementations/kdfs/pbkdf2.c
providers/implementations/kdfs/scrypt.c
providers/implementations/kdfs/sshkdf.c
providers/implementations/kdfs/sskdf.c
providers/implementations/kdfs/tls1_prf.c
providers/implementations/kdfs/x942kdf.c
providers/implementations/macs/blake2_mac_impl.c
providers/implementations/macs/cmac_prov.c
providers/implementations/macs/gmac_prov.c
providers/implementations/macs/hmac_prov.c
providers/implementations/macs/kmac_prov.c
providers/implementations/macs/poly1305_prov.c
providers/implementations/macs/siphash_prov.c
providers/implementations/signature/dsa.c

index 5957730d183e6eb6e3e88e45aa44e7495c37d668..13bef4a7a8fc1bd2ddf84bf3b8ea50029c5c5f18 100644 (file)
@@ -41,7 +41,7 @@
 #include <openssl/storeerr.h>
 #include <openssl/esserr.h>
 #include "internal/propertyerr.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 int err_load_crypto_strings_int(void)
 {
index 179a3baa05bf739d7e1a8c429f4fbcd2d1869f21..65633717ee95ca9f9084c867415fb0d2f4ec2005 100644 (file)
@@ -39,7 +39,7 @@ L SM2           include/crypto/sm2.h            crypto/sm2/sm2_err.c
 L OSSL_STORE    include/openssl/store.h         crypto/store/store_err.c
 L ESS           include/openssl/ess.h           crypto/ess/ess_err.c
 L PROP          include/internal/property.h     crypto/property/property_err.c
-L PROV          providers/common/include/internal/providercommon.h providers/common/provider_err.c
+L PROV          providers/common/include/prov/providercommon.h providers/common/provider_err.c
 
 # additional header files to be scanned for function names
 L NONE          include/openssl/x509_vfy.h      NONE
index 930b94a817d877d860e692dcf463067fccb6cfc2..da30d59fecad89cddabaced262bcee1439d3d66c 100644 (file)
@@ -10,7 +10,7 @@
 #include <openssl/crypto.h>
 #include <openssl/core_numbers.h>
 #include "crypto/cryptlib.h"
-#include "internal/providercommon.h"
+#include "prov/providercommon.h"
 #include "internal/thread_once.h"
 
 #ifdef FIPS_MODE
index 4a64992af247fe9845dfe4614c733329cd67679a..72068c67c00794a6a827d49d96239d48ca9cc10b 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/err.h>
 #include <openssl/rand.h>
 #include "internal/thread_once.h"
-#include "internal/providercommon.h"
+#include "prov/providercommon.h"
 #include "rand_local.h"
 
 /* 440 bits from SP800-90Ar1 10.1 table 2 */
index 4d7676d21b2c542da205c6615c3fce4d89bd7c30..0289070f81ba7f974b4b7bb0b0aa4990614f6565 100644 (file)
@@ -13,7 +13,7 @@
 #include <openssl/err.h>
 #include <openssl/rand.h>
 #include "internal/thread_once.h"
-#include "internal/providercommon.h"
+#include "prov/providercommon.h"
 #include "rand_local.h"
 
 /*
index dce4ba60ac0a176c6681c6980a09a975f2f0ed8b..31eec076c55f38cff0fc3df24b31938d9ab26dcd 100644 (file)
@@ -7,7 +7,7 @@ ossl_prov_util_nid_to_name
 
 =head1 SYNOPSIS
 
- #include "internal/providercommon.h"
+ #include "prov/providercommon.h"
 
  const char *ossl_prov_util_nid_to_name(int nid);
 
index ec2dab684970e0883e721db055db828cfcefe559..95acfaf3234e2c1d5140721bffd1b6cf6954bbe6 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <assert.h>
 #include "cipher_local.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 /*
  * Fills a single block of buffered data from the input, and returns the amount
index 60fade83e0148ac47efe118e656fd30abb3f8f92..904af3a5e059aeaede163e8bdeb4269f9ec593a6 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "prov/ciphercommon.h"
 #include "prov/cipher_ccm.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 static int ccm_cipher_internal(PROV_CCM_CTX *ctx, unsigned char *out,
                                size_t *padlen, const unsigned char *in,
index 2577d94d7a86a37d40a37d4f2006544b3691b40f..d06e7b8004a0c6f1d365998a2c94e271674084b6 100644 (file)
@@ -12,8 +12,8 @@
  */
 
 #include "cipher_local.h"
-#include "internal/provider_ctx.h"
-#include "internal/providercommonerr.h"
+#include "prov/provider_ctx.h"
+#include "prov/providercommonerr.h"
 
 /*-
  * Generic cipher functions for OSSL_PARAM gettables and settables
index 72d17d00733d9a596c731a974d4d818c6f397148..580928fddea51c93f6b7f140247975cb99af5b31 100644 (file)
@@ -11,9 +11,9 @@
 
 #include "prov/ciphercommon.h"
 #include "prov/cipher_gcm.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 #include "crypto/rand.h"
-#include "internal/provider_ctx.h"
+#include "prov/provider_ctx.h"
 
 static int gcm_tls_init(PROV_GCM_CTX *dat, unsigned char *aad, size_t aad_len);
 static int gcm_tls_iv_set_fixed(PROV_GCM_CTX *ctx, unsigned char *iv,
index 92610a15245b8d0eea65593ac1b24f14456a338b..9d30b2be2c0fedbc1cb7e8143d5060a7567f7dca 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "openssl/err.h"
 #include "prov/digestcommon.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 int digest_default_get_params(OSSL_PARAM params[], size_t blksz, size_t paramsz,
                               unsigned long flags)
diff --git a/providers/common/include/internal/provider_ctx.h b/providers/common/include/internal/provider_ctx.h
deleted file mode 100644 (file)
index 365667d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-/*
- * To be used anywhere the library context needs to be passed, such as to
- * fetching functions.
- */
-#define PROV_LIBRARY_CONTEXT_OF(provctx)        (provctx)
diff --git a/providers/common/include/internal/provider_util.h b/providers/common/include/internal/provider_util.h
deleted file mode 100644 (file)
index 9925ac2..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#include <openssl/provider.h>
-#include <openssl/engine.h>
-
-typedef struct {
-    /*
-     * References to the underlying cipher implementation.  |cipher| caches
-     * the cipher, always.  |alloc_cipher| only holds a reference to an
-     * explicitly fetched cipher.
-     */
-    const EVP_CIPHER *cipher;   /* cipher */
-    EVP_CIPHER *alloc_cipher;   /* fetched cipher */
-
-    /* Conditions for legacy EVP_CIPHER uses */
-    ENGINE *engine;             /* cipher engine */
-} PROV_CIPHER;
-
-typedef struct {
-    /*
-     * References to the underlying digest implementation.  |md| caches
-     * the digest, always.  |alloc_md| only holds a reference to an explicitly
-     * fetched digest.
-     */
-    const EVP_MD *md;           /* digest */
-    EVP_MD *alloc_md;           /* fetched digest */
-
-    /* Conditions for legacy EVP_MD uses */
-    ENGINE *engine;             /* digest engine */
-} PROV_DIGEST;
-
-/* Cipher functions */
-/*
- * Load a cipher from the specified parameters with the specified context.
- * The params "properties", "engine" and "cipher" are used to determine the
- * implementation used.  If a provider cannot be found, it falls back to trying
- * non-provider based implementations.
- */
-int ossl_prov_cipher_load_from_params(PROV_CIPHER *pc,
-                                      const OSSL_PARAM params[],
-                                      OPENSSL_CTX *ctx);
-
-/* Reset the PROV_CIPHER fields and free any allocated cipher reference */
-void ossl_prov_cipher_reset(PROV_CIPHER *pc);
-
-/* Clone a PROV_CIPHER structure into a second */
-int ossl_prov_cipher_copy(PROV_CIPHER *dst, const PROV_CIPHER *src);
-
-/* Query the cipher and associated engine (if any) */
-const EVP_CIPHER *ossl_prov_cipher_cipher(const PROV_CIPHER *pc);
-ENGINE *ossl_prov_cipher_engine(const PROV_CIPHER *pc);
-
-/* Digest functions */
-/*
- * Load a digest from the specified parameters with the specified context.
- * The params "properties", "engine" and "digest" are used to determine the
- * implementation used.  If a provider cannot be found, it falls back to trying
- * non-provider based implementations.
- */
-int ossl_prov_digest_load_from_params(PROV_DIGEST *pd,
-                                      const OSSL_PARAM params[],
-                                      OPENSSL_CTX *ctx);
-
-/* Reset the PROV_DIGEST fields and free any allocated digest reference */
-void ossl_prov_digest_reset(PROV_DIGEST *pd);
-
-/* Clone a PROV_DIGEST structure into a second */
-int ossl_prov_digest_copy(PROV_DIGEST *dst, const PROV_DIGEST *src);
-
-/* Query the digest and associated engine (if any) */
-const EVP_MD *ossl_prov_digest_md(const PROV_DIGEST *pd);
-ENGINE *ossl_prov_digest_engine(const PROV_DIGEST *pd);
-
-/* MAC functions */
-/*
- * Load an EVP_MAC_CTX* from the specified parameters with the specified
- * library context.
- * The params "mac" and "properties" are used to determine the implementation
- * used, and the parameters "digest", "cipher", "engine" and "properties" are
- * passed to the MAC via the created MAC context if they are given.
- * If there is already a created MAC context, it will be replaced if the "mac"
- * parameter is found, otherwise it will simply be used as is, and passed the
- * parameters to pilfer as it sees fit.
- *
- * As an option, a MAC name may be explicitly given, and if it is, the "mac"
- * parameter will be ignored.
- * Similarly, as an option, a cipher name or a digest name may be explicitly
- * given, and if any of them is, the "digest" and "cipher" parameters are
- * ignored.
- */
-int ossl_prov_macctx_load_from_params(EVP_MAC_CTX **macctx,
-                                      const OSSL_PARAM params[],
-                                      const char *macname,
-                                      const char *ciphername,
-                                      const char *mdname,
-                                      OPENSSL_CTX *ctx);
diff --git a/providers/common/include/internal/providercommon.h b/providers/common/include/internal/providercommon.h
deleted file mode 100644 (file)
index 569c08c..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#include <openssl/provider.h>
-
-const OSSL_PROVIDER *FIPS_get_provider(OPENSSL_CTX *ctx);
-
-const char *ossl_prov_util_nid_to_name(int nid);
-
diff --git a/providers/common/include/internal/providercommonerr.h b/providers/common/include/internal/providercommonerr.h
deleted file mode 100644 (file)
index 90c6d11..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Generated by util/mkerr.pl DO NOT EDIT
- * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
- *
- * Licensed under the Apache License 2.0 (the "License").  You may not use
- * this file except in compliance with the License.  You can obtain a copy
- * in the file LICENSE in the source distribution or at
- * https://www.openssl.org/source/license.html
- */
-
-#ifndef OPENSSL_PROVERR_H
-# define OPENSSL_PROVERR_H
-
-# include <openssl/opensslconf.h>
-# include <openssl/symhacks.h>
-
-
-# ifdef  __cplusplus
-extern "C"
-# endif
-int ERR_load_PROV_strings(void);
-
-/*
- * PROV function codes.
- */
-# if !OPENSSL_API_3
-#  define PROV_F_AESNI_INIT_KEY                            0
-#  define PROV_F_AES_BLOCK_FINAL                           0
-#  define PROV_F_AES_BLOCK_UPDATE                          0
-#  define PROV_F_AES_CIPHER                                0
-#  define PROV_F_AES_DINIT                                 0
-#  define PROV_F_AES_DUPCTX                                0
-#  define PROV_F_AES_EINIT                                 0
-#  define PROV_F_AES_GET_CTX_PARAMS                        0
-#  define PROV_F_AES_INIT_KEY                              0
-#  define PROV_F_AES_SET_CTX_PARAMS                        0
-#  define PROV_F_AES_STREAM_UPDATE                         0
-#  define PROV_F_AES_T4_INIT_KEY                           0
-#  define PROV_F_BLAKE2_MAC_INIT                           0
-#  define PROV_F_BLAKE2_MAC_SET_PARAMS                     0
-#  define PROV_F_GMAC_SET_PARAMS                           0
-#  define PROV_F_KMAC_SET_PARAMS                           0
-#  define PROV_F_POLY1305_SET_PARAMS                       0
-#  define PROV_F_PROV_AES_KEY_GENERIC_INIT                 0
-#  define PROV_F_TRAILINGDATA                              0
-#  define PROV_F_UNPADBLOCK                                0
-# endif
-
-/*
- * PROV reason codes.
- */
-# define PROV_R_AES_KEY_SETUP_FAILED                      101
-# define PROV_R_BAD_DECRYPT                               100
-# define PROV_R_BAD_ENCODING                              141
-# define PROV_R_BAD_LENGTH                                142
-# define PROV_R_BOTH_MODE_AND_MODE_INT                    127
-# define PROV_R_CIPHER_OPERATION_FAILED                   102
-# define PROV_R_FAILED_TO_GENERATE_KEY                    121
-# define PROV_R_FAILED_TO_GET_PARAMETER                   103
-# define PROV_R_FAILED_TO_SET_PARAMETER                   104
-# define PROV_R_INAVLID_UKM_LENGTH                        146
-# define PROV_R_INVALID_AAD                               108
-# define PROV_R_INVALID_CUSTOM_LENGTH                     111
-# define PROV_R_INVALID_DATA                              115
-# define PROV_R_INVALID_DIGEST                            122
-# define PROV_R_INVALID_ITERATION_COUNT                   123
-# define PROV_R_INVALID_IVLEN                             116
-# define PROV_R_INVALID_IV_LENGTH                         109
-# define PROV_R_INVALID_KEYLEN                            117
-# define PROV_R_INVALID_KEY_LEN                           124
-# define PROV_R_INVALID_KEY_LENGTH                        105
-# define PROV_R_INVALID_MAC                               151
-# define PROV_R_INVALID_MODE                              125
-# define PROV_R_INVALID_MODE_INT                          126
-# define PROV_R_INVALID_SALT_LENGTH                       112
-# define PROV_R_INVALID_TAG                               110
-# define PROV_R_INVALID_TAGLEN                            118
-# define PROV_R_MISSING_CEK_ALG                           144
-# define PROV_R_MISSING_KEY                               128
-# define PROV_R_MISSING_MAC                               150
-# define PROV_R_MISSING_MESSAGE_DIGEST                    129
-# define PROV_R_MISSING_PASS                              130
-# define PROV_R_MISSING_SALT                              131
-# define PROV_R_MISSING_SECRET                            132
-# define PROV_R_MISSING_SEED                              140
-# define PROV_R_MISSING_SESSION_ID                        133
-# define PROV_R_MISSING_TYPE                              134
-# define PROV_R_MISSING_XCGHASH                           135
-# define PROV_R_NOT_SUPPORTED                             136
-# define PROV_R_NOT_XOF_OR_INVALID_LENGTH                 113
-# define PROV_R_NO_KEY_SET                                114
-# define PROV_R_OUTPUT_BUFFER_TOO_SMALL                   106
-# define PROV_R_TAG_NOTSET                                119
-# define PROV_R_TAG_NOT_NEEDED                            120
-# define PROV_R_UNABLE_TO_LOAD_SHA1                       143
-# define PROV_R_UNABLE_TO_LOAD_SHA256                     147
-# define PROV_R_UNSUPPORTED_CEK_ALG                       145
-# define PROV_R_UNSUPPORTED_KEY_SIZE                      153
-# define PROV_R_UNSUPPORTED_MAC_TYPE                      137
-# define PROV_R_UNSUPPORTED_NUMBER_OF_ROUNDS              152
-# define PROV_R_VALUE_ERROR                               138
-# define PROV_R_WRONG_FINAL_BLOCK_LENGTH                  107
-# define PROV_R_WRONG_OUTPUT_BUFFER_SIZE                  139
-# define PROV_R_XTS_DATA_UNIT_IS_TOO_LARGE                148
-# define PROV_R_XTS_DUPLICATED_KEYS                       149
-
-#endif
diff --git a/providers/common/include/prov/provider_ctx.h b/providers/common/include/prov/provider_ctx.h
new file mode 100644 (file)
index 0000000..365667d
--- /dev/null
@@ -0,0 +1,14 @@
+/*
+ * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+/*
+ * To be used anywhere the library context needs to be passed, such as to
+ * fetching functions.
+ */
+#define PROV_LIBRARY_CONTEXT_OF(provctx)        (provctx)
diff --git a/providers/common/include/prov/provider_util.h b/providers/common/include/prov/provider_util.h
new file mode 100644 (file)
index 0000000..9925ac2
--- /dev/null
@@ -0,0 +1,103 @@
+/*
+ * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <openssl/provider.h>
+#include <openssl/engine.h>
+
+typedef struct {
+    /*
+     * References to the underlying cipher implementation.  |cipher| caches
+     * the cipher, always.  |alloc_cipher| only holds a reference to an
+     * explicitly fetched cipher.
+     */
+    const EVP_CIPHER *cipher;   /* cipher */
+    EVP_CIPHER *alloc_cipher;   /* fetched cipher */
+
+    /* Conditions for legacy EVP_CIPHER uses */
+    ENGINE *engine;             /* cipher engine */
+} PROV_CIPHER;
+
+typedef struct {
+    /*
+     * References to the underlying digest implementation.  |md| caches
+     * the digest, always.  |alloc_md| only holds a reference to an explicitly
+     * fetched digest.
+     */
+    const EVP_MD *md;           /* digest */
+    EVP_MD *alloc_md;           /* fetched digest */
+
+    /* Conditions for legacy EVP_MD uses */
+    ENGINE *engine;             /* digest engine */
+} PROV_DIGEST;
+
+/* Cipher functions */
+/*
+ * Load a cipher from the specified parameters with the specified context.
+ * The params "properties", "engine" and "cipher" are used to determine the
+ * implementation used.  If a provider cannot be found, it falls back to trying
+ * non-provider based implementations.
+ */
+int ossl_prov_cipher_load_from_params(PROV_CIPHER *pc,
+                                      const OSSL_PARAM params[],
+                                      OPENSSL_CTX *ctx);
+
+/* Reset the PROV_CIPHER fields and free any allocated cipher reference */
+void ossl_prov_cipher_reset(PROV_CIPHER *pc);
+
+/* Clone a PROV_CIPHER structure into a second */
+int ossl_prov_cipher_copy(PROV_CIPHER *dst, const PROV_CIPHER *src);
+
+/* Query the cipher and associated engine (if any) */
+const EVP_CIPHER *ossl_prov_cipher_cipher(const PROV_CIPHER *pc);
+ENGINE *ossl_prov_cipher_engine(const PROV_CIPHER *pc);
+
+/* Digest functions */
+/*
+ * Load a digest from the specified parameters with the specified context.
+ * The params "properties", "engine" and "digest" are used to determine the
+ * implementation used.  If a provider cannot be found, it falls back to trying
+ * non-provider based implementations.
+ */
+int ossl_prov_digest_load_from_params(PROV_DIGEST *pd,
+                                      const OSSL_PARAM params[],
+                                      OPENSSL_CTX *ctx);
+
+/* Reset the PROV_DIGEST fields and free any allocated digest reference */
+void ossl_prov_digest_reset(PROV_DIGEST *pd);
+
+/* Clone a PROV_DIGEST structure into a second */
+int ossl_prov_digest_copy(PROV_DIGEST *dst, const PROV_DIGEST *src);
+
+/* Query the digest and associated engine (if any) */
+const EVP_MD *ossl_prov_digest_md(const PROV_DIGEST *pd);
+ENGINE *ossl_prov_digest_engine(const PROV_DIGEST *pd);
+
+/* MAC functions */
+/*
+ * Load an EVP_MAC_CTX* from the specified parameters with the specified
+ * library context.
+ * The params "mac" and "properties" are used to determine the implementation
+ * used, and the parameters "digest", "cipher", "engine" and "properties" are
+ * passed to the MAC via the created MAC context if they are given.
+ * If there is already a created MAC context, it will be replaced if the "mac"
+ * parameter is found, otherwise it will simply be used as is, and passed the
+ * parameters to pilfer as it sees fit.
+ *
+ * As an option, a MAC name may be explicitly given, and if it is, the "mac"
+ * parameter will be ignored.
+ * Similarly, as an option, a cipher name or a digest name may be explicitly
+ * given, and if any of them is, the "digest" and "cipher" parameters are
+ * ignored.
+ */
+int ossl_prov_macctx_load_from_params(EVP_MAC_CTX **macctx,
+                                      const OSSL_PARAM params[],
+                                      const char *macname,
+                                      const char *ciphername,
+                                      const char *mdname,
+                                      OPENSSL_CTX *ctx);
diff --git a/providers/common/include/prov/providercommon.h b/providers/common/include/prov/providercommon.h
new file mode 100644 (file)
index 0000000..569c08c
--- /dev/null
@@ -0,0 +1,15 @@
+/*
+ * Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#include <openssl/provider.h>
+
+const OSSL_PROVIDER *FIPS_get_provider(OPENSSL_CTX *ctx);
+
+const char *ossl_prov_util_nid_to_name(int nid);
+
diff --git a/providers/common/include/prov/providercommonerr.h b/providers/common/include/prov/providercommonerr.h
new file mode 100644 (file)
index 0000000..90c6d11
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * Generated by util/mkerr.pl DO NOT EDIT
+ * Copyright 1995-2019 The OpenSSL Project Authors. All Rights Reserved.
+ *
+ * Licensed under the Apache License 2.0 (the "License").  You may not use
+ * this file except in compliance with the License.  You can obtain a copy
+ * in the file LICENSE in the source distribution or at
+ * https://www.openssl.org/source/license.html
+ */
+
+#ifndef OPENSSL_PROVERR_H
+# define OPENSSL_PROVERR_H
+
+# include <openssl/opensslconf.h>
+# include <openssl/symhacks.h>
+
+
+# ifdef  __cplusplus
+extern "C"
+# endif
+int ERR_load_PROV_strings(void);
+
+/*
+ * PROV function codes.
+ */
+# if !OPENSSL_API_3
+#  define PROV_F_AESNI_INIT_KEY                            0
+#  define PROV_F_AES_BLOCK_FINAL                           0
+#  define PROV_F_AES_BLOCK_UPDATE                          0
+#  define PROV_F_AES_CIPHER                                0
+#  define PROV_F_AES_DINIT                                 0
+#  define PROV_F_AES_DUPCTX                                0
+#  define PROV_F_AES_EINIT                                 0
+#  define PROV_F_AES_GET_CTX_PARAMS                        0
+#  define PROV_F_AES_INIT_KEY                              0
+#  define PROV_F_AES_SET_CTX_PARAMS                        0
+#  define PROV_F_AES_STREAM_UPDATE                         0
+#  define PROV_F_AES_T4_INIT_KEY                           0
+#  define PROV_F_BLAKE2_MAC_INIT                           0
+#  define PROV_F_BLAKE2_MAC_SET_PARAMS                     0
+#  define PROV_F_GMAC_SET_PARAMS                           0
+#  define PROV_F_KMAC_SET_PARAMS                           0
+#  define PROV_F_POLY1305_SET_PARAMS                       0
+#  define PROV_F_PROV_AES_KEY_GENERIC_INIT                 0
+#  define PROV_F_TRAILINGDATA                              0
+#  define PROV_F_UNPADBLOCK                                0
+# endif
+
+/*
+ * PROV reason codes.
+ */
+# define PROV_R_AES_KEY_SETUP_FAILED                      101
+# define PROV_R_BAD_DECRYPT                               100
+# define PROV_R_BAD_ENCODING                              141
+# define PROV_R_BAD_LENGTH                                142
+# define PROV_R_BOTH_MODE_AND_MODE_INT                    127
+# define PROV_R_CIPHER_OPERATION_FAILED                   102
+# define PROV_R_FAILED_TO_GENERATE_KEY                    121
+# define PROV_R_FAILED_TO_GET_PARAMETER                   103
+# define PROV_R_FAILED_TO_SET_PARAMETER                   104
+# define PROV_R_INAVLID_UKM_LENGTH                        146
+# define PROV_R_INVALID_AAD                               108
+# define PROV_R_INVALID_CUSTOM_LENGTH                     111
+# define PROV_R_INVALID_DATA                              115
+# define PROV_R_INVALID_DIGEST                            122
+# define PROV_R_INVALID_ITERATION_COUNT                   123
+# define PROV_R_INVALID_IVLEN                             116
+# define PROV_R_INVALID_IV_LENGTH                         109
+# define PROV_R_INVALID_KEYLEN                            117
+# define PROV_R_INVALID_KEY_LEN                           124
+# define PROV_R_INVALID_KEY_LENGTH                        105
+# define PROV_R_INVALID_MAC                               151
+# define PROV_R_INVALID_MODE                              125
+# define PROV_R_INVALID_MODE_INT                          126
+# define PROV_R_INVALID_SALT_LENGTH                       112
+# define PROV_R_INVALID_TAG                               110
+# define PROV_R_INVALID_TAGLEN                            118
+# define PROV_R_MISSING_CEK_ALG                           144
+# define PROV_R_MISSING_KEY                               128
+# define PROV_R_MISSING_MAC                               150
+# define PROV_R_MISSING_MESSAGE_DIGEST                    129
+# define PROV_R_MISSING_PASS                              130
+# define PROV_R_MISSING_SALT                              131
+# define PROV_R_MISSING_SECRET                            132
+# define PROV_R_MISSING_SEED                              140
+# define PROV_R_MISSING_SESSION_ID                        133
+# define PROV_R_MISSING_TYPE                              134
+# define PROV_R_MISSING_XCGHASH                           135
+# define PROV_R_NOT_SUPPORTED                             136
+# define PROV_R_NOT_XOF_OR_INVALID_LENGTH                 113
+# define PROV_R_NO_KEY_SET                                114
+# define PROV_R_OUTPUT_BUFFER_TOO_SMALL                   106
+# define PROV_R_TAG_NOTSET                                119
+# define PROV_R_TAG_NOT_NEEDED                            120
+# define PROV_R_UNABLE_TO_LOAD_SHA1                       143
+# define PROV_R_UNABLE_TO_LOAD_SHA256                     147
+# define PROV_R_UNSUPPORTED_CEK_ALG                       145
+# define PROV_R_UNSUPPORTED_KEY_SIZE                      153
+# define PROV_R_UNSUPPORTED_MAC_TYPE                      137
+# define PROV_R_UNSUPPORTED_NUMBER_OF_ROUNDS              152
+# define PROV_R_VALUE_ERROR                               138
+# define PROV_R_WRONG_FINAL_BLOCK_LENGTH                  107
+# define PROV_R_WRONG_OUTPUT_BUFFER_SIZE                  139
+# define PROV_R_XTS_DATA_UNIT_IS_TOO_LARGE                148
+# define PROV_R_XTS_DUPLICATED_KEYS                       149
+
+#endif
index 5216baf91835b0a005fafe9b511b20eaf3f4975c..ae1552283d2473feae453012717410115fbac88c 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include <openssl/err.h>
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 #ifndef OPENSSL_NO_ERR
 
index 8384cdc2a0f94e71a0bc27cdf4da6aab774cc94f..bdc86b1c05e21d288af567f6ed68d482e18eee53 100644 (file)
@@ -9,7 +9,7 @@
 
 #include <openssl/evp.h>
 #include <openssl/core_names.h>
-#include "internal/provider_util.h"
+#include "prov/provider_util.h"
 
 void ossl_prov_cipher_reset(PROV_CIPHER *pc)
 {
index 2bab77dba0737f82e4f9d2347ee18de70e4e4181..e754b84d3508bb01b685a47cec82258ad4f592a2 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include <openssl/objects.h>
-#include "internal/providercommon.h"
+#include "prov/providercommon.h"
 
 /*
  * The FIPS provider has its own version of this in fipsprov.c because it does
index 829d8ef3eafec237c453e6fb3a47ffb450e1cb23..4dfbb4623a346f3bbb82251e470b8dbc615757a7 100644 (file)
@@ -1,3 +1,3 @@
 
 SOURCE[../fips]=fipsprov.c selftest.c
-INCLUDE[../fips]=../common/include
\ No newline at end of file
+INCLUDE[../fips]=../implementations/include ../common/include
index c61071e619ef1102abddbcb3d4c96d2cb0664ef2..f0cf4a9bd0d6062011ba466e841f05e60184af0b 100644 (file)
@@ -27,8 +27,8 @@
 #include "internal/property.h"
 #include "crypto/evp.h"
 #include "prov/implementations.h"
-#include "internal/provider_ctx.h"
-#include "internal/providercommon.h"
+#include "prov/provider_ctx.h"
+#include "prov/providercommon.h"
 #include "selftest.h"
 
 extern OSSL_core_thread_start_fn *c_thread_start;
index e9b638830075f50670b719b62911f3f2527c8e60..8519662e7376a879fabdc05b5b2d157d9fb7a39d 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "cipher_aes.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 static int cipher_hw_aes_initkey(PROV_CIPHER_CTX *dat,
                                  const unsigned char *key, size_t keylen)
index c677a0be0bc8fb0d3eb06f08e0c3ac2041dd518b..d30a666fc5897d9edd8dc6e487a10266566b41f3 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "cipher_aes_ocb.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 #include "prov/cipher_aead.h"
 #include "prov/implementations.h"
 
index 5b5e6388e12cc1630d31264c6343a7d22cb08dee..9eaec163187337a2c464fc8f8ee530a3aac71185 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "cipher_aes.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 #include "prov/implementations.h"
 
 /* AES wrap with padding has IV length of 4, without padding 8 */
index 1072418779cfaa7070b8eead173db993a82943ee..2ad1fbe84aa22eb7bf040d0a0e8133710cee8ecf 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "cipher_aes_xts.h"
 #include "prov/implementations.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 /* TODO (3.0) Figure out what flags need to be set */
 #define AES_XTS_FLAGS (EVP_CIPH_CUSTOM_IV          \
index b0e877ea1d1ae7834ddcf5392dd3960879ca2fbb..200c365282ef10595efd03d7068956bce8e535b1 100644 (file)
@@ -11,7 +11,7 @@
 #include "cipher_des.h"
 #include "crypto/rand.h"
 #include "prov/implementations.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 /* TODO(3.0) Figure out what flags need to be here */
 #define DES_FLAGS (EVP_CIPH_RAND_KEY)
index 1da17621e9cd2aae077f81aa124542ca786be1ab..135c6171ec6352c3a77f7b26d0340f7511d7ae56 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "cipher_rc2.h"
 #include "prov/implementations.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 #define RC2_40_MAGIC    0xa0
 #define RC2_64_MAGIC    0x78
index 68a3cfa3233987d92a39400e2a0b5705315c32a9..7f5780f0626130d568b975dfe9548161986edda3 100644 (file)
@@ -11,7 +11,7 @@
 
 #include "cipher_rc5.h"
 #include "prov/implementations.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 static OSSL_OP_cipher_freectx_fn rc5_freectx;
 static OSSL_OP_cipher_dupctx_fn rc5_dupctx;
index 1ded6202df4e49aed143308d759817e2b9b03e6d..e6dab582ca57a1b4fa7b30f6f05385e04020ce8e 100644 (file)
@@ -11,7 +11,7 @@
 #include "cipher_tdes.h"
 #include "crypto/rand.h"
 #include "prov/implementations.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 void *tdes_newctx(void *provctx, int mode, size_t kbits, size_t blkbits,
                   size_t ivbits, uint64_t flags, const PROV_CIPHER_HW *hw)
index ecce1d8e11280894c410332281fc6c91bfe3f187..75cc25df064ef0396b2100abbca640c8aaeb57cc 100644 (file)
@@ -12,7 +12,7 @@
 #include "crypto/evp.h"
 #include "crypto/rand.h"
 #include "prov/implementations.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 /* TODO (3.0) Figure out what flags are requred */
 #define TDES_WRAP_FLAGS (EVP_CIPH_WRAP_MODE             \
index 27770f0820a671bec17e3595a793537be3b09717..4a7d3a43abbf6e32b715be69aeec667297d50329 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/err.h>
 #include "prov/digestcommon.h"
 #include "prov/implementations.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 static OSSL_OP_digest_set_ctx_params_fn mdc2_set_ctx_params;
 static OSSL_OP_digest_settable_ctx_params_fn mdc2_settable_ctx_params;
index 79cc6175179238c48d1bb517b740c2eb96fef554..251039e9920fe5645d643046a6fd6bab4ac55c24 100644 (file)
@@ -16,7 +16,7 @@
 #include "internal/sha3.h"
 #include "prov/digestcommon.h"
 #include "prov/implementations.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 
 /*
  * Forward declaration of any unique methods implemented here. This is not strictly
index 333c2bafde10f82d2827a5b024f4a7f8fc6451fa..66d70635a6b2948acc549ac3ba123b89bb0e10e4 100644 (file)
 #include "internal/cryptlib.h"
 #include "internal/numbers.h"
 #include "crypto/evp.h"
-#include "internal/provider_ctx.h"
-#include "internal/providercommonerr.h"
+#include "prov/provider_ctx.h"
+#include "prov/providercommonerr.h"
 #include "prov/implementations.h"
-#include "internal/provider_util.h"
+#include "prov/provider_util.h"
 #include "e_os.h"
 
 #define HKDF_MAXBUF 1024
index 455ee4ba1577a3cd3bee78057027562ab60ee0a4..6faf22e8d20d68cc80019902160e48be9525087d 100644 (file)
@@ -38,9 +38,9 @@
 #include "crypto/evp.h"
 #include "internal/numbers.h"
 #include "prov/implementations.h"
-#include "internal/provider_ctx.h"
-#include "internal/provider_util.h"
-#include "internal/providercommonerr.h"
+#include "prov/provider_ctx.h"
+#include "prov/provider_util.h"
+#include "prov/providercommonerr.h"
 
 #include "e_os.h"
 
index d1047c6e2ccfee96ecf19fa3f1913631b1208053..f08063fab52f2e9ec6233ccca45213590f18629c 100644 (file)
 #include "internal/cryptlib.h"
 #include "internal/numbers.h"
 #include "crypto/evp.h"
-#include "internal/provider_ctx.h"
-#include "internal/providercommonerr.h"
+#include "prov/provider_ctx.h"
+#include "prov/providercommonerr.h"
 #include "prov/implementations.h"
-#include "internal/provider_util.h"
+#include "prov/provider_util.h"
 #include "pbkdf2.h"
 
 /* Constants specified in SP800-132 */
index b001bb7cb20656b4ac99a42417fc87e4749e88d7..a067a9a91c893743e12bc8aad4ddc9030065b433 100644 (file)
@@ -17,8 +17,8 @@
 #include "crypto/evp.h"
 #include "internal/numbers.h"
 #include "prov/implementations.h"
-#include "internal/provider_ctx.h"
-#include "internal/providercommonerr.h"
+#include "prov/provider_ctx.h"
+#include "prov/providercommonerr.h"
 #include "prov/implementations.h"
 
 #ifndef OPENSSL_NO_SCRYPT
index 23a0caac5fb3a8bf25622dc9f50dcd23f3a65d57..d5484f4acb39f0efdd5d89a5c6c9b20214b447dc 100644 (file)
 #include "internal/cryptlib.h"
 #include "internal/numbers.h"
 #include "crypto/evp.h"
-#include "internal/provider_ctx.h"
-#include "internal/providercommonerr.h"
+#include "prov/provider_ctx.h"
+#include "prov/providercommonerr.h"
 #include "prov/implementations.h"
-# include "internal/provider_util.h"
+# include "prov/provider_util.h"
 
 /* See RFC 4253, Section 7.2 */
 static OSSL_OP_kdf_newctx_fn kdf_sshkdf_new;
index 23adbc37ba79c978135e24132a34fc36b05c980a..4f69eec7f66ef8648e341e459a735e564e6ee6f9 100644 (file)
 #include "internal/cryptlib.h"
 #include "internal/numbers.h"
 #include "crypto/evp.h"
-#include "internal/provider_ctx.h"
-#include "internal/providercommonerr.h"
+#include "prov/provider_ctx.h"
+#include "prov/providercommonerr.h"
 #include "prov/implementations.h"
-#include "internal/provider_util.h"
+#include "prov/provider_util.h"
 
 typedef struct {
     void *provctx;
index 941286b6b5372ce74d52b7ea9927236e30994b79..0a83753a8a1b00cf18b8041425677cd31447eb89 100644 (file)
 #include "internal/cryptlib.h"
 #include "internal/numbers.h"
 #include "crypto/evp.h"
-#include "internal/provider_ctx.h"
-#include "internal/providercommonerr.h"
+#include "prov/provider_ctx.h"
+#include "prov/providercommonerr.h"
 #include "prov/implementations.h"
-#include "internal/provider_util.h"
+#include "prov/provider_util.h"
 #include "e_os.h"
 
 static OSSL_OP_kdf_newctx_fn kdf_tls1_prf_new;
index efa1c762716c61cebe1ecbb7c28682069a12d705..5a84d5096821af4857d593c9b545625ec73d21f0 100644 (file)
 # include "internal/cryptlib.h"
 # include "internal/numbers.h"
 # include "crypto/evp.h"
-# include "internal/provider_ctx.h"
-# include "internal/providercommonerr.h"
+# include "prov/provider_ctx.h"
+# include "prov/providercommonerr.h"
 # include "prov/implementations.h"
-# include "internal/provider_util.h"
+# include "prov/provider_util.h"
 
 # define X942KDF_MAX_INLEN (1 << 30)
 
index d33b76ae71037a0f185cd7be7e93bda6deb52583..6b6261f31c7bfb2772bbfc2f4bf6586d89fc2976 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "prov/blake2.h"
 #include "internal/cryptlib.h"
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 #include "prov/implementations.h"
 
 /*
index d5ad4f3e9a8d98676483cf345681bb4a29f39ebc..f3dbe1f2e74debe601b4579042438d5956549211 100644 (file)
@@ -15,8 +15,8 @@
 #include <openssl/cmac.h>
 
 #include "prov/implementations.h"
-#include "internal/provider_ctx.h"
-#include "internal/provider_util.h"
+#include "prov/provider_ctx.h"
+#include "prov/provider_util.h"
 
 /*
  * Forward declaration of everything implemented here.  This is not strictly
index 8947d09688285dd2946422dcff6ad68589d052a8..f9e5a3a17d52e22e9b8139ba9dbea4c51446cd2e 100644 (file)
 #include <openssl/evp.h>
 #include <openssl/err.h>
 
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 #include "prov/implementations.h"
-#include "internal/provider_ctx.h"
-#include "internal/provider_util.h"
+#include "prov/provider_ctx.h"
+#include "prov/provider_util.h"
 
 /*
  * Forward declaration of everything implemented here.  This is not strictly
index 7ae0d476f0e34b5b192ea5a9c00373c09e59d521..3eccc0d2c8801909d5129041d4320bd805a1c558 100644 (file)
@@ -15,8 +15,8 @@
 #include <openssl/hmac.h>
 
 #include "prov/implementations.h"
-#include "internal/provider_ctx.h"
-#include "internal/provider_util.h"
+#include "prov/provider_ctx.h"
+#include "prov/provider_util.h"
 
 /*
  * Forward declaration of everything implemented here.  This is not strictly
index 0c2e8e3c93ebd898d2dc97ae6d645b615fb905a8..6feaba7695307e50ac383da7bc956c2007281298 100644 (file)
 #include <openssl/evp.h>
 #include <openssl/err.h>
 
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 #include "prov/implementations.h"
-#include "internal/provider_ctx.h"
-#include "internal/provider_util.h"
+#include "prov/provider_ctx.h"
+#include "prov/provider_util.h"
 
 /*
  * Forward declaration of everything implemented here.  This is not strictly
index 9dda057d743e6302da76597c5076d09904004842..f41752a3cf219b91e1a8ccd31177b91488c07e62 100644 (file)
@@ -21,7 +21,7 @@
  */
 #include "../../../crypto/poly1305/poly1305_local.h"
 
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 #include "prov/implementations.h"
 
 /*
index 190187d690ca46542ecfcfbcf32b9f61749d7ba0..d1cb5cf1e7599d15acd10c8ce3cd7c10d5a97bca 100644 (file)
@@ -22,7 +22,7 @@
  */
 #include "../../../crypto/siphash/siphash_local.h"
 
-#include "internal/providercommonerr.h"
+#include "prov/providercommonerr.h"
 #include "prov/implementations.h"
 
 /*
index addef0079ae0f1c0f0b3cdcf23b5d4d9f36b6ede..1eef3c916524abdeb28d9948554493c48b627494 100644 (file)
@@ -14,7 +14,7 @@
 #include <openssl/params.h>
 #include <openssl/evp.h>
 #include "prov/implementations.h"
-#include "internal/provider_ctx.h"
+#include "prov/provider_ctx.h"
 
 static OSSL_OP_signature_newctx_fn dsa_newctx;
 static OSSL_OP_signature_sign_init_fn dsa_signature_init;