include/internal: add a few missing #pragma once directives
authorFdaSilvaYY <fdasilvayy@gmail.com>
Sat, 6 Feb 2021 21:14:03 +0000 (22:14 +0100)
committerDr. Matthias St. Pierre <matthias.st.pierre@ncp-e.com>
Wed, 10 Feb 2021 22:20:58 +0000 (23:20 +0100)
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/14096)

30 files changed:
include/internal/asn1.h
include/internal/bio.h
include/internal/conf.h
include/internal/constant_time.h
include/internal/core.h
include/internal/cryptlib.h
include/internal/dane.h
include/internal/deprecated.h
include/internal/dso.h
include/internal/endian.h
include/internal/err.h
include/internal/ffc.h
include/internal/ktls.h
include/internal/nelem.h
include/internal/numbers.h
include/internal/o_dir.h
include/internal/packet.h
include/internal/param_build_set.h
include/internal/passphrase.h
include/internal/property.h
include/internal/provider.h
include/internal/refcount.h
include/internal/sha3.h
include/internal/sizes.h
include/internal/sm3.h
include/internal/sockets.h
include/internal/sslconf.h
include/internal/symhacks.h
include/internal/thread_once.h
include/internal/tlsgroups.h

index 8448786919d04910358e4cf45b62f718f3baf53e..36d90e22b179e312db8914dfa3de0baa5eb13cc7 100644 (file)
@@ -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);
 
index 2fb0d5cb76f458533bd1c617fe37761f968663c2..12782c85a28d630b04a736e7496515eac656cd42 100644 (file)
@@ -9,8 +9,9 @@
 
 #ifndef OSSL_INTERNAL_BIO_H
 # define OSSL_INTERNAL_BIO_H
+# pragma once
 
-#include <openssl/bio.h>
+# include <openssl/bio.h>
 
 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
index 1e7ab2cedf085e1868d1da670eed09e186b37aed..44043613a4d829c53ae30c997406af5f01956006 100644 (file)
@@ -9,10 +9,11 @@
 
 #ifndef OSSL_INTERNAL_CONF_H
 # define OSSL_INTERNAL_CONF_H
+# pragma once
 
-#include <openssl/conf.h>
+# include <openssl/conf.h>
 
-#define DEFAULT_CONF_MFLAGS \
+# define DEFAULT_CONF_MFLAGS \
     (CONF_MFLAGS_DEFAULT_SECTION | \
      CONF_MFLAGS_IGNORE_MISSING_FILE | \
      CONF_MFLAGS_IGNORE_RETURN_CODES)
index dc75e31df1d52793bad3f5cd69d4dcef1a4693ba..b50b10ba803ef78a540d513bb6c0485813369f8c 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifndef OSSL_INTERNAL_CONSTANT_TIME_H
 # define OSSL_INTERNAL_CONSTANT_TIME_H
+# pragma once
 
 # include <stdlib.h>
 # include <string.h>
index 8499f357948f3a59e1d5579fba0e6d4e3c5b4814..75bcfeb4e8637e987988b963151f715c8ec4f595 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifndef OSSL_INTERNAL_CORE_H
 # define OSSL_INTERNAL_CORE_H
+# pragma once
 
 /*
  * namespaces:
index 93dedda94c930a8d03fec096e7f0605f183fb4ba..5145178deec493bd4dc4d8406ac4ea682905eecc 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifndef OSSL_INTERNAL_CRYPTLIB_H
 # define OSSL_INTERNAL_CRYPTLIB_H
+# pragma once
 
 # include <stdlib.h>
 # include <string.h>
index d9bae2b9f7b514b1aee31d91feacfff207235201..6639d2d97ff80c188914d51cba1d822021851320 100644 (file)
@@ -9,8 +9,9 @@
 
 #ifndef OSSL_INTERNAL_DANE_H
 #define OSSL_INTERNAL_DANE_H
+# pragma once
 
-#include <openssl/safestack.h>
+# include <openssl/safestack.h>
 
 /*-
  * Certificate usages:
index 16b075127551fd6c90a243e006af88cd09f38dc0..a6de3957023ef85e23e996a7e824ad3721c2c140 100644 (file)
@@ -18,6 +18,7 @@
 
 #ifndef OSSL_INTERNAL_DEPRECATED_H
 # define OSSL_INTERNAL_DEPRECATED_H
+# pragma once
 
 # include <openssl/configuration.h>
 
index ec58926f7271bf45c5de6ec3d4eda181044bc16e..d04a1c166e13fa430893bc4947bacbed9160e8c2 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifndef OSSL_INTERNAL_DSO_H
 # define OSSL_INTERNAL_DSO_H
+# pragma once
 
 # include <openssl/crypto.h>
 # include "internal/dsoerr.h"
index b4e486da3a52aea9f9750f32801803bcc0e2def3..01b926d0bde5b0f95d45d5841f64f6530373011a 100644 (file)
@@ -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
index 8cb72ae370aace6babfc021692c7cf3428413341..d5ad9abdf486f82368e6f51686331d68828169dd 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifndef OSSL_INTERNAL_ERR_H
 # define OSSL_INTERNAL_ERR_H
+# pragma once
 
 void err_free_strings_int(void);
 
index 191f9369f1faa16bd8ab6ca00a382d01b1212ebd..7653b6e2fa6e8bbcbf2e7001013da43a6b348678 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifndef OSSL_INTERNAL_FFC_H
 # define OSSL_INTERNAL_FFC_H
+# pragma once
 
 # include <openssl/core.h>
 # include <openssl/bn.h>
index 1f486e7b488abb8bdb3096f2b834883584db8ec3..dae94226d772662d5dc791b7181e2c0f33ba879b 100644 (file)
@@ -22,6 +22,8 @@
 
 #ifndef HEADER_INTERNAL_KTLS
 # define HEADER_INTERNAL_KTLS
+# pragma once
+
 # ifndef OPENSSL_NO_KTLS
 
 #  if defined(__FreeBSD__)
index 0c32483fc581952a11723b80579aed0e67fc52e3..f0a53c37d5fce6bef58dce26e28d146a39fd4be6 100644 (file)
@@ -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
index db65559c6b4cf689918c8e279972a140f299cf8c..bade59fd893afb33b29984111846f2be0ff66585 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifndef OSSL_INTERNAL_NUMBERS_H
 # define OSSL_INTERNAL_NUMBERS_H
+# pragma once
 
 # include <limits.h>
 
index 220cf173e65319b495b7b788b41e88a46cfae403..90c247d65e4dc34fd947b4d71a320200ec82bbeb 100644 (file)
@@ -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;
 
index 95aeb1c49fd845c5de61d57c247743f3d9442435..efb1a702ef360724d066b55c4150aff48184f9f1 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifndef OSSL_INTERNAL_PACKET_H
 # define OSSL_INTERNAL_PACKET_H
+# pragma once
 
 # include <string.h>
 # include <openssl/bn.h>
index d1f18633816d674290db470a11417a6540125994..a037ab8ee1b661bd7c58d7b05a559e7a5be3f8da 100644 (file)
@@ -7,8 +7,12 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <openssl/safestack.h>
-#include <openssl/param_build.h>
+#ifndef OSSL_INTERNAL_PARAM_BUILD_SET_H
+# define OSSL_INTERNAL_PARAM_BUILD_SET_H
+# pragma once
+
+# include <openssl/safestack.h>
+# include <openssl/param_build.h>
 
 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 */
index 9077907d52cf78808ea0a89a55ff0bebf60c5e1e..f2d261413200c0b28a3a0d440437b500e1a6b41f 100644 (file)
@@ -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.
index f2682a1fedc6b720ec23490b00d7ed517222d7c0..a5335110a874d3032bc7134fe370e6cc358f331b 100644 (file)
@@ -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;
index 7a0fc848757da18454b16944dd3550e441d0644a..dc064fd70b96ea9e889bbbfa245b1869e31db24d 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifndef OSSL_INTERNAL_PROVIDER_H
 # define OSSL_INTERNAL_PROVIDER_H
+# pragma once
 
 # include <openssl/core.h>
 # include <openssl/core_dispatch.h>
index 5899e8c8e14a23e0c077563cee7b614fdf0f2152..e5c4aca167bfe7c478f50c33c9e7a781329c0547 100644 (file)
@@ -8,6 +8,7 @@
  */
 #ifndef OSSL_INTERNAL_REFCOUNT_H
 # define OSSL_INTERNAL_REFCOUNT_H
+# pragma once
 
 # include <openssl/e_os2.h>
 
index 2fd7b20af397ef391eaa42ba82fd57bf6bf85c21..f564549b591bfb5d698511ea7864dbb41b77bc34 100644 (file)
@@ -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 <openssl/e_os2.h>
 # include <stddef.h>
index 00a5d3e88e78aa43aac91359e2bb5b05bfb09d36..d9abb53788a6eb91dff7e6e9e8fee38d2d50de4f 100644 (file)
@@ -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
index 51bb265fff5aec1d50427118127677a7737a4383..b9b0636d017e581d3fe0ea3fe834854c27079b44 100644 (file)
@@ -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 <openssl/opensslconf.h>
 
index e86ae8a09ef24646a952a364945bd9ac92df923c..5d169b631dcf573645d2cfb129a8dff381924166 100644 (file)
@@ -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
index 9e635da98a6953934ea56350301981b2bd838967..2c2044c104547e7b79539959bb5c3f4f32bafef1 100644 (file)
@@ -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;
 
index 6a5a1875ff4fd17990378dd697532d634a80d114..425b644d3acc3f905641c3f4fc2b6270c70264ef 100644 (file)
@@ -9,6 +9,7 @@
 
 #ifndef OSSL_INTERNAL_SYMHACKS_H
 # define OSSL_INTERNAL_SYMHACKS_H
+# pragma once
 
 # include <openssl/e_os2.h>
 
index 7b72700a3fbe25c17bd9f06701d56689c754f1c8..d6cb2eeec3bc1065b27882f0ab0432b06a564bfb 100644 (file)
@@ -7,7 +7,11 @@
  * https://www.openssl.org/source/license.html
  */
 
-#include <openssl/crypto.h>
+#ifndef OSSL_INTERNAL_THREAD_ONCE_H
+# define OSSL_INTERNAL_THREAD_ONCE_H
+# pragma once
+
+# include <openssl/crypto.h>
 
 /*
  * 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)              \
  *     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)             \
     {                                             \
  *
  * (*) 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)
 
 /*
  *
  * (*) 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 */
index 024556315f588c0336ce5ae135472b993fd1c6bd..c5653bdbd38a74201e5e6f63375620dacc5c09e0 100644 (file)
@@ -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