From: Bob Beck Date: Mon, 27 Apr 2026 22:50:06 +0000 (-0600) Subject: Make the crypto includes self-contained X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc7d680024b5483ce4e82ccd37b9e89d94ed15d0;p=thirdparty%2Fopenssl.git Make the crypto includes self-contained Except for obj_dat.h and obj_xref.h which need perl mungery Reviewed-by: Tomas Mraz Reviewed-by: Nikola Pajkovsky Reviewed-by: Norbert Pocs MergeDate: Wed May 6 11:35:57 2026 (Merged from https://github.com/openssl/openssl/pull/31001) --- diff --git a/crypto/asn1/standard_methods.h b/crypto/asn1/standard_methods.h index b123ee687fc..b5f038969bc 100644 --- a/crypto/asn1/standard_methods.h +++ b/crypto/asn1/standard_methods.h @@ -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 + +#include + /* * 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) */ diff --git a/crypto/asn1/tbl_standard.h b/crypto/asn1/tbl_standard.h index 79f2f06c753..41af74e27a1 100644 --- a/crypto/asn1/tbl_standard.h +++ b/crypto/asn1/tbl_standard.h @@ -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 +#include + #define ub_name 32768 #define ub_common_name 64 #define ub_locality_name 128 diff --git a/crypto/bf/bf_pi.h b/crypto/bf/bf_pi.h index 6971865c1b2..1419a5cf4a7 100644 --- a/crypto/bf/bf_pi.h +++ b/crypto/bf/bf_pi.h @@ -10,6 +10,8 @@ #if !defined(OSSL_LIBCRYPTO_BF_BF_PI_H) #define OSSL_LIBCRYPTO_BF_BF_PI_H +#include + static const BF_KEY bf_init = { { 0x243f6a88L, 0x85a308d3L, 0x13198a2eL, 0x03707344L, 0xa4093822L, 0x299f31d0L, 0x082efa98L, 0xec4e6c89L, diff --git a/crypto/camellia/cmll_local.h b/crypto/camellia/cmll_local.h index f585994ff9e..5740307385f 100644 --- a/crypto/camellia/cmll_local.h +++ b/crypto/camellia/cmll_local.h @@ -25,6 +25,8 @@ #ifndef OSSL_CRYPTO_CAMELLIA_CMLL_LOCAL_H #define OSSL_CRYPTO_CAMELLIA_CMLL_LOCAL_H +#include + typedef unsigned int u32; typedef unsigned char u8; diff --git a/crypto/cast/cast_local.h b/crypto/cast/cast_local.h index a3ea4d14de2..954a5b237c3 100644 --- a/crypto/cast/cast_local.h +++ b/crypto/cast/cast_local.h @@ -10,6 +10,8 @@ #if !defined(OSSL_LIBCRYPTO_CAST_CAST_LOCAL_H) #define OSSL_LIBCRYPTO_CAST_CAST_LOCAL_H +#include + #ifdef OPENSSL_SYS_WIN32 #include #endif diff --git a/crypto/cast/cast_s.h b/crypto/cast/cast_s.h index c76770f3447..89cb6223a32 100644 --- a/crypto/cast/cast_s.h +++ b/crypto/cast/cast_s.h @@ -10,6 +10,8 @@ #if !defined(OSSL_LIBCRYPTO_CAST_CAST_S_H) #define OSSL_LIBCRYPTO_CAST_CAST_S_H +#include + const CAST_LONG CAST_S_table0[256] = { 0x30fb40d4, 0x9fa0ff0b, diff --git a/crypto/cms/cms_local.h b/crypto/cms/cms_local.h index ed372890662..5e0ac3907ff 100644 --- a/crypto/cms/cms_local.h +++ b/crypto/cms/cms_local.h @@ -10,6 +10,7 @@ #ifndef OSSL_CRYPTO_CMS_LOCAL_H #define OSSL_CRYPTO_CMS_LOCAL_H +#include #include /* diff --git a/crypto/comp/comp_local.h b/crypto/comp/comp_local.h index 913eb09f70d..bb9d4a0f797 100644 --- a/crypto/comp/comp_local.h +++ b/crypto/comp/comp_local.h @@ -10,6 +10,8 @@ #if !defined(OSSL_LIBCRYPTO_COMP_COMP_LOCAL_H) #define OSSL_LIBCRYPTO_COMP_COMP_LOCAL_H +#include + struct comp_method_st { int type; /* NID for compression library */ const char *name; /* A text string to identify the library */ diff --git a/crypto/des/spr.h b/crypto/des/spr.h index 3687bb37209..fe3e9d31e38 100644 --- a/crypto/des/spr.h +++ b/crypto/des/spr.h @@ -10,6 +10,8 @@ #if !defined(OSSL_LIBCRYPTO_DES_SPR_H) #define OSSL_LIBCRYPTO_DES_SPR_H +#include + const DES_LONG DES_SPtrans[8][64] = { { /* nibble 0 */ diff --git a/crypto/ec/curve448/arch_64/arch_intrinsics.h b/crypto/ec/curve448/arch_64/arch_intrinsics.h index 09f0fdf34e4..14294892e7e 100644 --- a/crypto/ec/curve448/arch_64/arch_intrinsics.h +++ b/crypto/ec/curve448/arch_64/arch_intrinsics.h @@ -13,6 +13,8 @@ #ifndef OSSL_CRYPTO_EC_CURVE448_ARCH_64_INTRINSICS_H #define OSSL_CRYPTO_EC_CURVE448_ARCH_64_INTRINSICS_H +#include + #include "internal/constant_time.h" #define ARCH_WORD_BITS 64 diff --git a/crypto/ec/curve448/ed448.h b/crypto/ec/curve448/ed448.h index 1c94649557c..29e732d629a 100644 --- a/crypto/ec/curve448/ed448.h +++ b/crypto/ec/curve448/ed448.h @@ -13,6 +13,8 @@ #ifndef OSSL_CRYPTO_EC_CURVE448_ED448_H #define OSSL_CRYPTO_EC_CURVE448_ED448_H +#include + #include "point_448.h" /* Number of bytes in an EdDSA public key. */ diff --git a/crypto/evp/evp_local.h b/crypto/evp/evp_local.h index fc00d248405..fc01b71efc7 100644 --- a/crypto/evp/evp_local.h +++ b/crypto/evp/evp_local.h @@ -11,6 +11,10 @@ #define OSSL_LIBCRYPTO_EVP_EVP_LOCAL_H #include +#include + +#include + #include "internal/refcount.h" #define EVP_CTRL_RET_UNSUPPORTED -1 diff --git a/crypto/lhash/lhash_local.h b/crypto/lhash/lhash_local.h index c35b3987461..8d1b671d18d 100644 --- a/crypto/lhash/lhash_local.h +++ b/crypto/lhash/lhash_local.h @@ -10,6 +10,7 @@ #define OSSL_LIBCRYPTO_LHASH_LHASH_LOCAL_H #include +#include #include "internal/tsan_assist.h" diff --git a/crypto/ml_dsa/ml_dsa_matrix.h b/crypto/ml_dsa/ml_dsa_matrix.h index 2610e17dfe8..3bc053720bb 100644 --- a/crypto/ml_dsa/ml_dsa_matrix.h +++ b/crypto/ml_dsa/ml_dsa_matrix.h @@ -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; diff --git a/crypto/ml_dsa/ml_dsa_poly.h b/crypto/ml_dsa/ml_dsa_poly.h index 3cdb38ea16f..061deb147b1 100644 --- a/crypto/ml_dsa/ml_dsa_poly.h +++ b/crypto/ml_dsa/ml_dsa_poly.h @@ -11,6 +11,8 @@ #include +#include "ml_dsa_local.h" + #define ML_DSA_NUM_POLY_COEFFICIENTS 256 /* Polynomial object with 256 coefficients. The coefficients are unsigned 32 bits */ diff --git a/crypto/ml_dsa/ml_dsa_sign.h b/crypto/ml_dsa/ml_dsa_sign.h index be4b2920e01..1a134100504 100644 --- a/crypto/ml_dsa/ml_dsa_sign.h +++ b/crypto/ml_dsa/ml_dsa_sign.h @@ -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; diff --git a/crypto/objects/o_names.c b/crypto/objects/o_names.c index 7c0bdddc7cc..9ab9a2acd1b 100644 --- a/crypto/objects/o_names.c +++ b/crypto/objects/o_names.c @@ -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; /* diff --git a/crypto/objects/obj_local.h b/crypto/objects/obj_local.h index b17ef9ae090..29e5cc034b9 100644 --- a/crypto/objects/obj_local.h +++ b/crypto/objects/obj_local.h @@ -10,7 +10,16 @@ #if !defined(OSSL_LIBCRYPTO_OBJECTS_OBJ_LOCAL_H) #define OSSL_LIBCRYPTO_OBJECTS_OBJ_LOCAL_H -typedef struct name_funcs_st NAME_FUNCS; +#include +#include +#include + +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; diff --git a/crypto/ocsp/ocsp_local.h b/crypto/ocsp/ocsp_local.h index 2a9e95852a4..82676ce2d4d 100644 --- a/crypto/ocsp/ocsp_local.h +++ b/crypto/ocsp/ocsp_local.h @@ -10,6 +10,9 @@ #if !defined(OSSL_LIBCRYPTO_OCSP_OCSP_LOCAL_H) #define OSSL_LIBCRYPTO_OCSP_OCSP_LOCAL_H +#include +#include + #include "crypto/x509.h" /* for ossl_x509_add_cert_new() */ /*- CertID ::= SEQUENCE { diff --git a/crypto/pkcs12/p12_local.h b/crypto/pkcs12/p12_local.h index 9dce1e14f92..ef5866ad9bd 100644 --- a/crypto/pkcs12/p12_local.h +++ b/crypto/pkcs12/p12_local.h @@ -10,6 +10,10 @@ #if !defined(OSSL_LIBCRYPTO_PKCS12_P12_LOCAL_H) #define OSSL_LIBCRYPTO_PKCS12_P12_LOCAL_H +#include +#include +#include + struct PKCS12_MAC_DATA_st { X509_SIG *dinfo; ASN1_OCTET_STRING *salt; diff --git a/crypto/rcu_internal.h b/crypto/rcu_internal.h index 3408923ebaa..e4b9aab6fac 100644 --- a/crypto/rcu_internal.h +++ b/crypto/rcu_internal.h @@ -11,6 +11,8 @@ #define OPENSSL_RCU_INTERNAL_H #pragma once +#include + struct rcu_qp; struct rcu_cb_item { diff --git a/crypto/slh_dsa/slh_dsa_key.h b/crypto/slh_dsa/slh_dsa_key.h index 412bffdeea1..6f7554a315f 100644 --- a/crypto/slh_dsa/slh_dsa_key.h +++ b/crypto/slh_dsa/slh_dsa_key.h @@ -10,8 +10,15 @@ #if !defined(OSSL_LIBCRYPTO_SLH_DSA_SLH_DSA_KEY_H) #define OSSL_LIBCRYPTO_SLH_DSA_SLH_DSA_KEY_H +#include #include +#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) diff --git a/crypto/slh_dsa/slh_hash.h b/crypto/slh_dsa/slh_hash.h index ded22f7e60c..27f23323920 100644 --- a/crypto/slh_dsa/slh_hash.h +++ b/crypto/slh_dsa/slh_hash.h @@ -12,6 +12,9 @@ #pragma once #include + +#include "crypto/slh_dsa.h" + #include "slh_adrs.h" #include "internal/packet.h" diff --git a/crypto/ts/ts_local.h b/crypto/ts/ts_local.h index d86b395472b..be1be4ad5f5 100644 --- a/crypto/ts/ts_local.h +++ b/crypto/ts/ts_local.h @@ -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 +#include +#include + /*- * 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; diff --git a/crypto/x509/ext_dat.h b/crypto/x509/ext_dat.h index bec7716135d..668f05c6e95 100644 --- a/crypto/x509/ext_dat.h +++ b/crypto/x509/ext_dat.h @@ -10,6 +10,8 @@ #if !defined(OSSL_LIBCRYPTO_X509_EXT_DAT_H) #define OSSL_LIBCRYPTO_X509_EXT_DAT_H +#include + 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; diff --git a/crypto/x509/pcy_local.h b/crypto/x509/pcy_local.h index 56466ea07f5..0892c8dd0b8 100644 --- a/crypto/x509/pcy_local.h +++ b/crypto/x509/pcy_local.h @@ -10,6 +10,11 @@ #if !defined(OSSL_LIBCRYPTO_X509_PCY_LOCAL_H) #define OSSL_LIBCRYPTO_X509_PCY_LOCAL_H +#include +#include +#include +#include + typedef struct X509_POLICY_DATA_st X509_POLICY_DATA; DEFINE_STACK_OF(X509_POLICY_DATA) diff --git a/crypto/x509/standard_exts.h b/crypto/x509/standard_exts.h index 14e6455ae14..e72cc98da75 100644 --- a/crypto/x509/standard_exts.h +++ b/crypto/x509/standard_exts.h @@ -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], diff --git a/crypto/x509/v3_admis.h b/crypto/x509/v3_admis.h index 75a07c1fcdf..fa4a409f243 100644 --- a/crypto/x509/v3_admis.h +++ b/crypto/x509/v3_admis.h @@ -10,6 +10,10 @@ #ifndef OSSL_CRYPTO_X509_V3_ADMIS_H #define OSSL_CRYPTO_X509_V3_ADMIS_H +#include +#include +#include + struct NamingAuthority_st { ASN1_OBJECT *namingAuthorityId; ASN1_IA5STRING *namingAuthorityUrl; diff --git a/include/crypto/riscv_arch.h b/include/crypto/riscv_arch.h index 347b9df74f9..ddc36e58f1b 100644 --- a/include/crypto/riscv_arch.h +++ b/include/crypto/riscv_arch.h @@ -11,6 +11,7 @@ #define OSSL_CRYPTO_RISCV_ARCH_H #include +#include #include #if defined(OPENSSL_SYS_LINUX) && !defined(FIPS_MODULE)