From: FdaSilvaYY Date: Sat, 6 Feb 2021 21:14:03 +0000 (+0100) Subject: include/internal: add a few missing #pragma once directives X-Git-Tag: openssl-3.0.0-alpha12~85 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3a111aadc3d24e0f325497f830a59295d0616e98;p=thirdparty%2Fopenssl.git include/internal: add a few missing #pragma once directives Reviewed-by: Paul Dale Reviewed-by: Matthias St. Pierre (Merged from https://github.com/openssl/openssl/pull/14096) --- diff --git a/include/internal/asn1.h b/include/internal/asn1.h index 8448786919d..36d90e22b17 100644 --- a/include/internal/asn1.h +++ b/include/internal/asn1.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_ASN1_H # define OSSL_INTERNAL_ASN1_H +# pragma once int asn1_d2i_read_bio(BIO *in, BUF_MEM **pb); diff --git a/include/internal/bio.h b/include/internal/bio.h index 2fb0d5cb76f..12782c85a28 100644 --- a/include/internal/bio.h +++ b/include/internal/bio.h @@ -9,8 +9,9 @@ #ifndef OSSL_INTERNAL_BIO_H # define OSSL_INTERNAL_BIO_H +# pragma once -#include +# include struct bio_method_st { int type; @@ -62,11 +63,11 @@ int bread_conv(BIO *bio, char *data, size_t datal, size_t *read); # define BIO_clear_ktls_ctrl_msg_flag(b) \ BIO_clear_flags(b, BIO_FLAGS_KTLS_TX_CTRL_MSG) -# define BIO_set_ktls(b, keyblob, is_tx) \ +# define BIO_set_ktls(b, keyblob, is_tx) \ BIO_ctrl(b, BIO_CTRL_SET_KTLS, is_tx, keyblob) -# define BIO_set_ktls_ctrl_msg(b, record_type) \ +# define BIO_set_ktls_ctrl_msg(b, record_type) \ BIO_ctrl(b, BIO_CTRL_SET_KTLS_TX_SEND_CTRL_MSG, record_type, NULL) -# define BIO_clear_ktls_ctrl_msg(b) \ +# define BIO_clear_ktls_ctrl_msg(b) \ BIO_ctrl(b, BIO_CTRL_CLEAR_KTLS_TX_CTRL_MSG, 0, NULL) #endif diff --git a/include/internal/conf.h b/include/internal/conf.h index 1e7ab2cedf0..44043613a4d 100644 --- a/include/internal/conf.h +++ b/include/internal/conf.h @@ -9,10 +9,11 @@ #ifndef OSSL_INTERNAL_CONF_H # define OSSL_INTERNAL_CONF_H +# pragma once -#include +# include -#define DEFAULT_CONF_MFLAGS \ +# define DEFAULT_CONF_MFLAGS \ (CONF_MFLAGS_DEFAULT_SECTION | \ CONF_MFLAGS_IGNORE_MISSING_FILE | \ CONF_MFLAGS_IGNORE_RETURN_CODES) diff --git a/include/internal/constant_time.h b/include/internal/constant_time.h index dc75e31df1d..b50b10ba803 100644 --- a/include/internal/constant_time.h +++ b/include/internal/constant_time.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_CONSTANT_TIME_H # define OSSL_INTERNAL_CONSTANT_TIME_H +# pragma once # include # include diff --git a/include/internal/core.h b/include/internal/core.h index 8499f357948..75bcfeb4e86 100644 --- a/include/internal/core.h +++ b/include/internal/core.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_CORE_H # define OSSL_INTERNAL_CORE_H +# pragma once /* * namespaces: diff --git a/include/internal/cryptlib.h b/include/internal/cryptlib.h index 93dedda94c9..5145178deec 100644 --- a/include/internal/cryptlib.h +++ b/include/internal/cryptlib.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_CRYPTLIB_H # define OSSL_INTERNAL_CRYPTLIB_H +# pragma once # include # include diff --git a/include/internal/dane.h b/include/internal/dane.h index d9bae2b9f7b..6639d2d97ff 100644 --- a/include/internal/dane.h +++ b/include/internal/dane.h @@ -9,8 +9,9 @@ #ifndef OSSL_INTERNAL_DANE_H #define OSSL_INTERNAL_DANE_H +# pragma once -#include +# include /*- * Certificate usages: diff --git a/include/internal/deprecated.h b/include/internal/deprecated.h index 16b07512755..a6de3957023 100644 --- a/include/internal/deprecated.h +++ b/include/internal/deprecated.h @@ -18,6 +18,7 @@ #ifndef OSSL_INTERNAL_DEPRECATED_H # define OSSL_INTERNAL_DEPRECATED_H +# pragma once # include diff --git a/include/internal/dso.h b/include/internal/dso.h index ec58926f727..d04a1c166e1 100644 --- a/include/internal/dso.h +++ b/include/internal/dso.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_DSO_H # define OSSL_INTERNAL_DSO_H +# pragma once # include # include "internal/dsoerr.h" diff --git a/include/internal/endian.h b/include/internal/endian.h index b4e486da3a5..01b926d0bde 100644 --- a/include/internal/endian.h +++ b/include/internal/endian.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_ENDIAN_H # define OSSL_INTERNAL_ENDIAN_H +# pragma once /* * IS_LITTLE_ENDIAN and IS_BIG_ENDIAN can be used to detect the endiannes diff --git a/include/internal/err.h b/include/internal/err.h index 8cb72ae370a..d5ad9abdf48 100644 --- a/include/internal/err.h +++ b/include/internal/err.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_ERR_H # define OSSL_INTERNAL_ERR_H +# pragma once void err_free_strings_int(void); diff --git a/include/internal/ffc.h b/include/internal/ffc.h index 191f9369f1f..7653b6e2fa6 100644 --- a/include/internal/ffc.h +++ b/include/internal/ffc.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_FFC_H # define OSSL_INTERNAL_FFC_H +# pragma once # include # include diff --git a/include/internal/ktls.h b/include/internal/ktls.h index 1f486e7b488..dae94226d77 100644 --- a/include/internal/ktls.h +++ b/include/internal/ktls.h @@ -22,6 +22,8 @@ #ifndef HEADER_INTERNAL_KTLS # define HEADER_INTERNAL_KTLS +# pragma once + # ifndef OPENSSL_NO_KTLS # if defined(__FreeBSD__) diff --git a/include/internal/nelem.h b/include/internal/nelem.h index 0c32483fc58..f0a53c37d5f 100644 --- a/include/internal/nelem.h +++ b/include/internal/nelem.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_NELEM_H # define OSSL_INTERNAL_NELEM_H +# pragma once # define OSSL_NELEM(x) (sizeof(x)/sizeof((x)[0])) #endif diff --git a/include/internal/numbers.h b/include/internal/numbers.h index db65559c6b4..bade59fd893 100644 --- a/include/internal/numbers.h +++ b/include/internal/numbers.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_NUMBERS_H # define OSSL_INTERNAL_NUMBERS_H +# pragma once # include diff --git a/include/internal/o_dir.h b/include/internal/o_dir.h index 220cf173e65..90c247d65e4 100644 --- a/include/internal/o_dir.h +++ b/include/internal/o_dir.h @@ -38,6 +38,7 @@ #ifndef OSSL_INTERNAL_O_DIR_H # define OSSL_INTERNAL_O_DIR_H +# pragma once typedef struct OPENSSL_dir_context_st OPENSSL_DIR_CTX; diff --git a/include/internal/packet.h b/include/internal/packet.h index 95aeb1c49fd..efb1a702ef3 100644 --- a/include/internal/packet.h +++ b/include/internal/packet.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_PACKET_H # define OSSL_INTERNAL_PACKET_H +# pragma once # include # include diff --git a/include/internal/param_build_set.h b/include/internal/param_build_set.h index d1f18633816..a037ab8ee1b 100644 --- a/include/internal/param_build_set.h +++ b/include/internal/param_build_set.h @@ -7,8 +7,12 @@ * https://www.openssl.org/source/license.html */ -#include -#include +#ifndef OSSL_INTERNAL_PARAM_BUILD_SET_H +# define OSSL_INTERNAL_PARAM_BUILD_SET_H +# pragma once + +# include +# include int ossl_param_build_set_int(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, const char *key, int num); @@ -27,3 +31,5 @@ int ossl_param_build_set_bn_pad(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, int ossl_param_build_set_multi_key_bn(OSSL_PARAM_BLD *bld, OSSL_PARAM *p, const char *names[], STACK_OF(BIGNUM_const) *stk); + +#endif /* OSSL_INTERNAL_PARAM_BUILD_SET_H */ diff --git a/include/internal/passphrase.h b/include/internal/passphrase.h index 9077907d52c..f2d26141320 100644 --- a/include/internal/passphrase.h +++ b/include/internal/passphrase.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_PASSPHRASE_H # define OSSL_INTERNAL_PASSPHRASE_H +# pragma once /* * This is a passphrase reader bridge with bells and whistles. diff --git a/include/internal/property.h b/include/internal/property.h index f2682a1fedc..a5335110a87 100644 --- a/include/internal/property.h +++ b/include/internal/property.h @@ -10,8 +10,9 @@ #ifndef OSSL_INTERNAL_PROPERTY_H # define OSSL_INTERNAL_PROPERTY_H +# pragma once -#include "internal/cryptlib.h" +# include "internal/cryptlib.h" typedef struct ossl_method_store_st OSSL_METHOD_STORE; typedef struct ossl_property_list_st OSSL_PROPERTY_LIST; diff --git a/include/internal/provider.h b/include/internal/provider.h index 7a0fc848757..dc064fd70b9 100644 --- a/include/internal/provider.h +++ b/include/internal/provider.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_PROVIDER_H # define OSSL_INTERNAL_PROVIDER_H +# pragma once # include # include diff --git a/include/internal/refcount.h b/include/internal/refcount.h index 5899e8c8e14..e5c4aca167b 100644 --- a/include/internal/refcount.h +++ b/include/internal/refcount.h @@ -8,6 +8,7 @@ */ #ifndef OSSL_INTERNAL_REFCOUNT_H # define OSSL_INTERNAL_REFCOUNT_H +# pragma once # include diff --git a/include/internal/sha3.h b/include/internal/sha3.h index 2fd7b20af39..f564549b591 100644 --- a/include/internal/sha3.h +++ b/include/internal/sha3.h @@ -10,6 +10,7 @@ /* TODO(3.0) Move this header into provider when dependencies are removed */ #ifndef OSSL_INTERNAL_SHA3_H # define OSSL_INTERNAL_SHA3_H +# pragma once # include # include diff --git a/include/internal/sizes.h b/include/internal/sizes.h index 00a5d3e88e7..d9abb53788a 100644 --- a/include/internal/sizes.h +++ b/include/internal/sizes.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_SIZES_H # define OSSL_INTERNAL_SIZES_H +# pragma once /* * Max sizes used to allocate buffers with a fixed sizes, for example for diff --git a/include/internal/sm3.h b/include/internal/sm3.h index 51bb265fff5..b9b0636d017 100644 --- a/include/internal/sm3.h +++ b/include/internal/sm3.h @@ -11,6 +11,7 @@ /* TODO(3.0) Move this header into provider when dependencies are removed */ #ifndef OSSL_INTERNAL_SM3_H # define OSSL_INTERNAL_SM3_H +# pragma once # include diff --git a/include/internal/sockets.h b/include/internal/sockets.h index e86ae8a09ef..5d169b631dc 100644 --- a/include/internal/sockets.h +++ b/include/internal/sockets.h @@ -10,6 +10,7 @@ #ifndef OSSL_INTERNAL_SOCKETS_H # define OSSL_INTERNAL_SOCKETS_H +# pragma once # if defined(OPENSSL_SYS_VXWORKS) || defined(OPENSSL_SYS_UEFI) # define NO_SYS_PARAM_H diff --git a/include/internal/sslconf.h b/include/internal/sslconf.h index 9e635da98a6..2c2044c1045 100644 --- a/include/internal/sslconf.h +++ b/include/internal/sslconf.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_SSLCONF_H # define OSSL_INTERNAL_SSLCONF_H +# pragma once typedef struct ssl_conf_cmd_st SSL_CONF_CMD; diff --git a/include/internal/symhacks.h b/include/internal/symhacks.h index 6a5a1875ff4..425b644d3ac 100644 --- a/include/internal/symhacks.h +++ b/include/internal/symhacks.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_SYMHACKS_H # define OSSL_INTERNAL_SYMHACKS_H +# pragma once # include diff --git a/include/internal/thread_once.h b/include/internal/thread_once.h index 7b72700a3fb..d6cb2eeec3b 100644 --- a/include/internal/thread_once.h +++ b/include/internal/thread_once.h @@ -7,7 +7,11 @@ * https://www.openssl.org/source/license.html */ -#include +#ifndef OSSL_INTERNAL_THREAD_ONCE_H +# define OSSL_INTERNAL_THREAD_ONCE_H +# pragma once + +# include /* * Initialisation of global data should never happen via "RUN_ONCE" inside the @@ -15,7 +19,7 @@ * OSSL_LIB_CTX object. In this way data will get cleaned up correctly when the * module gets unloaded. */ -#if !defined(FIPS_MODULE) || defined(ALLOW_RUN_ONCE_IN_FIPS) +# if !defined(FIPS_MODULE) || defined(ALLOW_RUN_ONCE_IN_FIPS) /* * DEFINE_RUN_ONCE: Define an initialiser function that should be run exactly * once. It takes no arguments and returns an int result (1 for success or @@ -30,7 +34,7 @@ * return 0; * } */ -# define DEFINE_RUN_ONCE(init) \ +# define DEFINE_RUN_ONCE(init) \ static int init(void); \ int init##_ossl_ret_ = 0; \ void init##_ossl_(void) \ @@ -43,7 +47,7 @@ * DECLARE_RUN_ONCE: Declare an initialiser function that should be run exactly * once that has been defined in another file via DEFINE_RUN_ONCE(). */ -# define DECLARE_RUN_ONCE(init) \ +# define DECLARE_RUN_ONCE(init) \ extern int init##_ossl_ret_; \ void init##_ossl_(void); @@ -62,7 +66,7 @@ * return 0; * } */ -# define DEFINE_RUN_ONCE_STATIC(init) \ +# define DEFINE_RUN_ONCE_STATIC(init) \ static int init(void); \ static int init##_ossl_ret_ = 0; \ static void init##_ossl_(void) \ @@ -103,7 +107,7 @@ * return 0; * } */ -# define DEFINE_RUN_ONCE_STATIC_ALT(initalt, init) \ +# define DEFINE_RUN_ONCE_STATIC_ALT(initalt, init) \ static int initalt(void); \ static void initalt##_ossl_(void) \ { \ @@ -122,7 +126,7 @@ * * (*) by convention, since the init function must return 1 on success. */ -# define RUN_ONCE(once, init) \ +# define RUN_ONCE(once, init) \ (CRYPTO_THREAD_run_once(once, init##_ossl_) ? init##_ossl_ret_ : 0) /* @@ -140,7 +144,8 @@ * * (*) by convention, since the init function must return 1 on success. */ -# define RUN_ONCE_ALT(once, initalt, init) \ +# define RUN_ONCE_ALT(once, initalt, init) \ (CRYPTO_THREAD_run_once(once, initalt##_ossl_) ? init##_ossl_ret_ : 0) -#endif /* FIPS_MODULE */ +# endif /* FIPS_MODULE */ +#endif /* OSSL_INTERNAL_THREAD_ONCE_H */ diff --git a/include/internal/tlsgroups.h b/include/internal/tlsgroups.h index 024556315f5..c5653bdbd38 100644 --- a/include/internal/tlsgroups.h +++ b/include/internal/tlsgroups.h @@ -9,6 +9,7 @@ #ifndef OSSL_INTERNAL_TLSGROUPS_H # define OSSL_INTERNAL_TLSGROUPS_H +# pragma once # define OSSL_TLS_GROUP_ID_sect163k1 0x0001 # define OSSL_TLS_GROUP_ID_sect163r1 0x0002