]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Make the crypto includes self-contained
authorBob Beck <beck@openssl.org>
Mon, 27 Apr 2026 22:50:06 +0000 (16:50 -0600)
committerNorbert Pocs <norbertp@openssl.org>
Wed, 6 May 2026 11:35:41 +0000 (13:35 +0200)
Except for obj_dat.h and obj_xref.h which need perl mungery

Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Norbert Pocs <norbertp@openssl.org>
MergeDate: Wed May  6 11:35:57 2026
(Merged from https://github.com/openssl/openssl/pull/31001)

29 files changed:
crypto/asn1/standard_methods.h
crypto/asn1/tbl_standard.h
crypto/bf/bf_pi.h
crypto/camellia/cmll_local.h
crypto/cast/cast_local.h
crypto/cast/cast_s.h
crypto/cms/cms_local.h
crypto/comp/comp_local.h
crypto/des/spr.h
crypto/ec/curve448/arch_64/arch_intrinsics.h
crypto/ec/curve448/ed448.h
crypto/evp/evp_local.h
crypto/lhash/lhash_local.h
crypto/ml_dsa/ml_dsa_matrix.h
crypto/ml_dsa/ml_dsa_poly.h
crypto/ml_dsa/ml_dsa_sign.h
crypto/objects/o_names.c
crypto/objects/obj_local.h
crypto/ocsp/ocsp_local.h
crypto/pkcs12/p12_local.h
crypto/rcu_internal.h
crypto/slh_dsa/slh_dsa_key.h
crypto/slh_dsa/slh_hash.h
crypto/ts/ts_local.h
crypto/x509/ext_dat.h
crypto/x509/pcy_local.h
crypto/x509/standard_exts.h
crypto/x509/v3_admis.h
include/crypto/riscv_arch.h

index b123ee687fc9f25dd77cb597f35dc8993eb6d573..b5f038969bcf12f1ab90878aa1a15acad02ef726 100644 (file)
@@ -7,6 +7,13 @@
  * https://www.openssl.org/source/license.html
  */
 
+#if !defined(OSSL_CRYPTO_ASN1_STANDARD_METHODS_H)
+#define OSSL_CRYPTO_ASN1_STANDARD_METHODS_H
+
+#include <openssl/types.h>
+
+#include <crypto/asn1.h>
+
 /*
  * This table MUST be kept in ascending order of the NID each method
  * represents (corresponding to the pkey_id field) as OBJ_bsearch
@@ -41,3 +48,4 @@ static const EVP_PKEY_ASN1_METHOD *const standard_methods[] = {
     &ossl_sm2_asn1_meth,
 #endif
 };
+#endif /* !defined(OSSL_CRYPTO_ASN1_STANDARD_METHODS_H) */
index 79f2f06c75354e0db0551bfe1a3345f214d84a14..41af74e27a1becb7f1d6668f5080d99312248cf7 100644 (file)
@@ -7,11 +7,14 @@
  * https://www.openssl.org/source/license.html
  */
 
-/* size limits: this stuff is taken straight from RFC3280 */
-
 #if !defined(OSSL_LIBCRYPTO_ASN1_TBL_STANDARD_H)
 #define OSSL_LIBCRYPTO_ASN1_TBL_STANDARD_H
 
+/* size limits: this stuff is taken straight from RFC3280 */
+
+#include <openssl/asn1.h>
+#include <openssl/obj_mac.h>
+
 #define ub_name 32768
 #define ub_common_name 64
 #define ub_locality_name 128
index 6971865c1b2ebcf0cecf5e1df13038fd9bc72c30..1419a5cf4a7ac403bdd65aa68646d9fbc7d8ee26 100644 (file)
@@ -10,6 +10,8 @@
 #if !defined(OSSL_LIBCRYPTO_BF_BF_PI_H)
 #define OSSL_LIBCRYPTO_BF_BF_PI_H
 
+#include <openssl/blowfish.h>
+
 static const BF_KEY bf_init = {
     { 0x243f6a88L, 0x85a308d3L, 0x13198a2eL, 0x03707344L,
         0xa4093822L, 0x299f31d0L, 0x082efa98L, 0xec4e6c89L,
index f585994ff9e822923362e4432fd464a8289e8d4d..5740307385f90c81bbcc6e6b71eecdefb78c87ee 100644 (file)
@@ -25,6 +25,8 @@
 #ifndef OSSL_CRYPTO_CAMELLIA_CMLL_LOCAL_H
 #define OSSL_CRYPTO_CAMELLIA_CMLL_LOCAL_H
 
+#include <openssl/camellia.h>
+
 typedef unsigned int u32;
 typedef unsigned char u8;
 
index a3ea4d14de2cdb2c2c300589cce021565b4f1382..954a5b237c3ecee9d5019577f1e30c2e733ae2f8 100644 (file)
@@ -10,6 +10,8 @@
 #if !defined(OSSL_LIBCRYPTO_CAST_CAST_LOCAL_H)
 #define OSSL_LIBCRYPTO_CAST_CAST_LOCAL_H
 
+#include <openssl/cast.h>
+
 #ifdef OPENSSL_SYS_WIN32
 #include <stdlib.h>
 #endif
index c76770f3447535420bbc7439b0fe29866b5a768f..89cb6223a326cfa652b544b8ed9b99392d099ba1 100644 (file)
@@ -10,6 +10,8 @@
 #if !defined(OSSL_LIBCRYPTO_CAST_CAST_S_H)
 #define OSSL_LIBCRYPTO_CAST_CAST_S_H
 
+#include <openssl/cast.h>
+
 const CAST_LONG CAST_S_table0[256] = {
     0x30fb40d4,
     0x9fa0ff0b,
index ed3728906627e67ae35b4c4a53aa7c2a00111066..5e0ac3907ff342ba390a354076b190c2a850fb4c 100644 (file)
@@ -10,6 +10,7 @@
 #ifndef OSSL_CRYPTO_CMS_LOCAL_H
 #define OSSL_CRYPTO_CMS_LOCAL_H
 
+#include <openssl/cms.h>
 #include <openssl/x509.h>
 
 /*
index 913eb09f70d26e55dd11779555a6bea4a9467722..bb9d4a0f79705276b3eb6e10972403f28d63c622 100644 (file)
@@ -10,6 +10,8 @@
 #if !defined(OSSL_LIBCRYPTO_COMP_COMP_LOCAL_H)
 #define OSSL_LIBCRYPTO_COMP_COMP_LOCAL_H
 
+#include <openssl/comp.h>
+
 struct comp_method_st {
     int type; /* NID for compression library */
     const char *name; /* A text string to identify the library */
index 3687bb3720975a88cd500c4b073d46e55a3e2289..fe3e9d31e38ea4cbcc3b29a803a483addfb70ec9 100644 (file)
@@ -10,6 +10,8 @@
 #if !defined(OSSL_LIBCRYPTO_DES_SPR_H)
 #define OSSL_LIBCRYPTO_DES_SPR_H
 
+#include <openssl/des.h>
+
 const DES_LONG DES_SPtrans[8][64] = {
     {
         /* nibble 0 */
index 09f0fdf34e4129974a2cb59869d79c3e97fb484f..14294892e7ec4cf07932c3dc4575ee314330c5f6 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef OSSL_CRYPTO_EC_CURVE448_ARCH_64_INTRINSICS_H
 #define OSSL_CRYPTO_EC_CURVE448_ARCH_64_INTRINSICS_H
 
+#include <stdint.h>
+
 #include "internal/constant_time.h"
 
 #define ARCH_WORD_BITS 64
index 1c94649557cad3459c67b6bba9a668f30bc45b09..29e732d629ae4ac684e00a41836b2111bee394a5 100644 (file)
@@ -13,6 +13,8 @@
 #ifndef OSSL_CRYPTO_EC_CURVE448_ED448_H
 #define OSSL_CRYPTO_EC_CURVE448_ED448_H
 
+#include <openssl/types.h>
+
 #include "point_448.h"
 
 /* Number of bytes in an EdDSA public key. */
index fc00d2484053a78b70c80c52465f0930b63baa60..fc01b71efc78d1474cdfc864db3c445da1a67cab 100644 (file)
 #define OSSL_LIBCRYPTO_EVP_EVP_LOCAL_H
 
 #include <openssl/core_dispatch.h>
+#include <openssl/evp.h>
+
+#include <crypto/evp.h>
+
 #include "internal/refcount.h"
 
 #define EVP_CTRL_RET_UNSUPPORTED -1
index c35b3987461576a9a8066e28bcea482d2754908e..8d1b671d18de834dbcedbb243288bda6bb96966e 100644 (file)
@@ -10,6 +10,7 @@
 #define OSSL_LIBCRYPTO_LHASH_LHASH_LOCAL_H
 
 #include <openssl/crypto.h>
+#include <openssl/lhash.h>
 
 #include "internal/tsan_assist.h"
 
index 2610e17dfe8f2b89f0eb71bd12e3443bcd307205..3bc053720bb9491c879c60df731361f2a2d29d5a 100644 (file)
@@ -11,6 +11,8 @@
 #if !defined(OSSL_LIBCRYPTO_ML_DSA_ML_DSA_MATRIX_H)
 #define OSSL_LIBCRYPTO_ML_DSA_ML_DSA_MATRIX_H
 
+#include "ml_dsa_local.h"
+
 struct matrix_st {
     POLY *m_poly;
     size_t k, l;
index 3cdb38ea16ff84ba5170035f69a62e7cf47e341a..061deb147b1a95bda31388be47a6de5ea3ae061f 100644 (file)
@@ -11,6 +11,8 @@
 
 #include <openssl/crypto.h>
 
+#include "ml_dsa_local.h"
+
 #define ML_DSA_NUM_POLY_COEFFICIENTS 256
 
 /* Polynomial object with 256 coefficients. The coefficients are unsigned 32 bits */
index be4b2920e01c20d7213697c78e1e33a2b1448289..1a134100504222e10b60089f227b6db49617fbb3 100644 (file)
@@ -10,6 +10,8 @@
 #if !defined(OSSL_LIBCRYPTO_ML_DSA_ML_DSA_SIGN_H)
 #define OSSL_LIBCRYPTO_ML_DSA_ML_DSA_SIGN_H
 
+#include "ml_dsa_vector.h"
+
 struct ml_dsa_sig_st {
     VECTOR z;
     VECTOR hint;
index 7c0bdddc7ccccd504425e9004e20a81731690840..9ab9a2acd1b43ed91bc53be29694e845b3355e5b 100644 (file)
@@ -29,12 +29,6 @@ static LHASH_OF(OBJ_NAME) *names_lh = NULL;
 static int names_type_num = OBJ_NAME_TYPE_NUM;
 static CRYPTO_RWLOCK *obj_lock = NULL;
 
-struct name_funcs_st {
-    unsigned long (*hash_func)(const char *name);
-    int (*cmp_func)(const char *a, const char *b);
-    void (*free_func)(const char *, int, const char *);
-};
-
 static STACK_OF(NAME_FUNCS) *name_funcs_stack;
 
 /*
index b17ef9ae09008c4133ac5968b29f68db21a367cd..29e5cc034b91c2fd5b1791446bd4e14467f15b98 100644 (file)
 #if !defined(OSSL_LIBCRYPTO_OBJECTS_OBJ_LOCAL_H)
 #define OSSL_LIBCRYPTO_OBJECTS_OBJ_LOCAL_H
 
-typedef struct name_funcs_st NAME_FUNCS;
+#include <openssl/lhash.h>
+#include <openssl/objects.h>
+#include <openssl/safestack.h>
+
+typedef struct name_funcs_st {
+    unsigned long (*hash_func)(const char *name);
+    int (*cmp_func)(const char *a, const char *b);
+    void (*free_func)(const char *, int, const char *);
+} NAME_FUNCS;
+
 DEFINE_STACK_OF(NAME_FUNCS)
 DEFINE_LHASH_OF_EX(OBJ_NAME);
 typedef struct added_obj_st ADDED_OBJ;
index 2a9e95852a40988c6c76eb2cf235528949ee50a3..82676ce2d4d253ce843343ff24a763fa6e213c9e 100644 (file)
@@ -10,6 +10,9 @@
 #if !defined(OSSL_LIBCRYPTO_OCSP_OCSP_LOCAL_H)
 #define OSSL_LIBCRYPTO_OCSP_OCSP_LOCAL_H
 
+#include <openssl/ocsp.h>
+#include <openssl/x509v3.h>
+
 #include "crypto/x509.h" /* for ossl_x509_add_cert_new() */
 
 /*-  CertID ::= SEQUENCE {
index 9dce1e14f9251e8c6d254f9dd624d3a20b0f3b8a..ef5866ad9bdd34185aeed39524145de33b36bbff 100644 (file)
 #if !defined(OSSL_LIBCRYPTO_PKCS12_P12_LOCAL_H)
 #define OSSL_LIBCRYPTO_PKCS12_P12_LOCAL_H
 
+#include <openssl/asn1.h>
+#include <openssl/pkcs12.h>
+#include <openssl/x509.h>
+
 struct PKCS12_MAC_DATA_st {
     X509_SIG *dinfo;
     ASN1_OCTET_STRING *salt;
index 3408923ebaa39443271261b4e68be6f506f57b55..e4b9aab6fac0c98c2949fa5025eefb87a243558c 100644 (file)
@@ -11,6 +11,8 @@
 #define OPENSSL_RCU_INTERNAL_H
 #pragma once
 
+#include <internal/rcu.h>
+
 struct rcu_qp;
 
 struct rcu_cb_item {
index 412bffdeea1bcd32fb535c067efec4ba0e02c572..6f7554a315fbe8d4a67b045909eefd358923842a 100644 (file)
 #if !defined(OSSL_LIBCRYPTO_SLH_DSA_SLH_DSA_KEY_H)
 #define OSSL_LIBCRYPTO_SLH_DSA_SLH_DSA_KEY_H
 
+#include <openssl/crypto.h>
 #include <openssl/e_os2.h>
 
+#include "crypto/slh_dsa.h"
+
+#include "slh_params.h"
+#include "slh_adrs.h"
+#include "slh_hash.h"
+
 #define SLH_DSA_MAX_N 32
 #define SLH_DSA_SK_SEED(key) ((key)->priv)
 #define SLH_DSA_SK_PRF(key) ((key)->priv + (key)->params->n)
index ded22f7e60c3dcba396dd9c871a7fb2c0ef7e136..27f2332392072af534316700ff9e6cc3013e4e1d 100644 (file)
@@ -12,6 +12,9 @@
 #pragma once
 
 #include <openssl/e_os2.h>
+
+#include "crypto/slh_dsa.h"
+
 #include "slh_adrs.h"
 #include "internal/packet.h"
 
index d86b395472b9b09950343544cf46a67ee32230f2..be1be4ad5f5b28235a154f912079a9a4d7408231 100644 (file)
@@ -7,13 +7,18 @@
  * https://www.openssl.org/source/license.html
  */
 
+#if !defined(OSSL_LIBCRYPTO_TS_TS_LOCAL_H)
+#define OSSL_LIBCRYPTO_TS_TS_LOCAL_H
+
+#include <openssl/asn1.h>
+#include <openssl/ts.h>
+#include <openssl/x509.h>
+
 /*-
  * MessageImprint ::= SEQUENCE  {
  *      hashAlgorithm                AlgorithmIdentifier,
  *      hashedMessage                OCTET STRING  }
  */
-#if !defined(OSSL_LIBCRYPTO_TS_TS_LOCAL_H)
-#define OSSL_LIBCRYPTO_TS_TS_LOCAL_H
 
 struct TS_msg_imprint_st {
     X509_ALGOR *hash_algo;
index bec7716135d3d9374f86e01235740c380603e2a4..668f05c6e9505469d87dfbd83774e018d898f93a 100644 (file)
@@ -10,6 +10,8 @@
 #if !defined(OSSL_LIBCRYPTO_X509_EXT_DAT_H)
 #define OSSL_LIBCRYPTO_X509_EXT_DAT_H
 
+#include <openssl/x509v3.h>
+
 int ossl_v3_name_cmp(const char *name, const char *cmp);
 
 extern const X509V3_EXT_METHOD ossl_v3_bcons, ossl_v3_nscert, ossl_v3_key_usage, ossl_v3_ext_ku;
index 56466ea07f56c73711944d809fb0b2864e48ba6d..0892c8dd0b820ccc8b26d2f4cf4a7871aa97e4a2 100644 (file)
 #if !defined(OSSL_LIBCRYPTO_X509_PCY_LOCAL_H)
 #define OSSL_LIBCRYPTO_X509_PCY_LOCAL_H
 
+#include <openssl/asn1.h>
+#include <openssl/safestack.h>
+#include <openssl/types.h>
+#include <openssl/x509v3.h>
+
 typedef struct X509_POLICY_DATA_st X509_POLICY_DATA;
 
 DEFINE_STACK_OF(X509_POLICY_DATA)
index 14e6455ae142dfe6c772e7bfd67930681998f774..e72cc98da75116aa75834a1d991d7aa6f65e3bc7 100644 (file)
@@ -15,6 +15,8 @@
 #if !defined(OSSL_LIBCRYPTO_X509_STANDARD_EXTS_H)
 #define OSSL_LIBCRYPTO_X509_STANDARD_EXTS_H
 
+#include "ext_dat.h"
+
 static const X509V3_EXT_METHOD *const standard_exts[] = {
     &ossl_v3_nscert,
     &ossl_v3_ns_ia5_list[0],
index 75a07c1fcdff12c402e5589671ac54f7668fa40b..fa4a409f243bd6d948e7fbb9b67112fe6c1e66ad 100644 (file)
 #ifndef OSSL_CRYPTO_X509_V3_ADMIS_H
 #define OSSL_CRYPTO_X509_V3_ADMIS_H
 
+#include <openssl/asn1.h>
+#include <openssl/safestack.h>
+#include <openssl/x509v3.h>
+
 struct NamingAuthority_st {
     ASN1_OBJECT *namingAuthorityId;
     ASN1_IA5STRING *namingAuthorityUrl;
index 347b9df74f9fb6b06f1e6f061269c263a81ffd71..ddc36e58f1be1aaaf63fc243c03658fb8a0b7d5d 100644 (file)
@@ -11,6 +11,7 @@
 #define OSSL_CRYPTO_RISCV_ARCH_H
 
 #include <ctype.h>
+#include <stddef.h>
 #include <stdint.h>
 
 #if defined(OPENSSL_SYS_LINUX) && !defined(FIPS_MODULE)