]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
Make functions static that are only accessed from the same compilation unit
authorTobias Brunner <tobias@strongswan.org>
Wed, 5 Oct 2022 14:37:22 +0000 (16:37 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 5 Oct 2022 17:00:46 +0000 (19:00 +0200)
Also removed some declarations for undefined functions.

23 files changed:
scripts/pubkey_speed.c
src/libcharon/plugins/eap_radius/eap_radius_accounting.c
src/libimcv/plugins/imv_attestation/attest_db.c
src/libimcv/tcg/pts/tcg_pts_attr_simple_comp_evid.c
src/libstrongswan/collections/linked_list.c
src/libstrongswan/plugins/aesni/aesni_cmac.c
src/libstrongswan/plugins/aesni/aesni_cmac.h
src/libstrongswan/plugins/aesni/aesni_xcbc.c
src/libstrongswan/plugins/aesni/aesni_xcbc.h
src/libstrongswan/plugins/botan/botan_diffie_hellman.c
src/libstrongswan/plugins/cmac/cmac.c
src/libstrongswan/plugins/des/des_crypter.c
src/libstrongswan/plugins/openssl/openssl_rsa_private_key.h
src/libstrongswan/plugins/pkcs7/pkcs7_signed_data.c
src/libstrongswan/plugins/x509/x509_cert.c
src/libstrongswan/utils/lexparser.h
src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c
src/libtpmtss/tpm_tss_tss2_session.c
src/libtpmtss/tpm_tss_tss2_v2.c
src/medsrv/controller/peer_controller.c
src/pki/scep/scep.c
src/starter/parser/conf_parser.c
src/sw-collector/sw_collector_db.c

index f5f9a26a2c51a59fffc33fd914d6133dd133d3ae..87b6d0e442283c623f8b9cadebbd7b7d51ba74c0 100644 (file)
 #include <utils/debug.h>
 #include <credentials/keys/private_key.h>
 
-void start_timing(struct timespec *start)
+static void start_timing(struct timespec *start)
 {
        clock_gettime(CLOCK_THREAD_CPUTIME_ID, start);
 }
 
-double end_timing(struct timespec *start)
+static double end_timing(struct timespec *start)
 {
        struct timespec end;
 
index 674d6ef221ff0cfe0dfee2e71cce3c4c5e7c4466..f833dc3c0b441fa407ece8a54a94acae8707b400 100644 (file)
@@ -554,7 +554,7 @@ typedef struct {
 /**
  * Clean up interim data
  */
-void destroy_interim_data(interim_data_t *this)
+static void destroy_interim_data(interim_data_t *this)
 {
        this->id->destroy(this->id);
        free(this);
index 317671bd5a1da9db23e9e1f484531f1a1f9397f7..9027bcc4618678aef143c66e25e295448bcbfeed 100644 (file)
@@ -181,7 +181,7 @@ struct private_attest_db_t {
 
 };
 
-char* print_cfn(pts_comp_func_name_t *cfn)
+static char* print_cfn(pts_comp_func_name_t *cfn)
 {
        static char buf[BUF_LEN];
        char flags[8];
index 933148f7e68307880d8a0945a3c7c637fcb220d6..6a25d98d2ef207c4f6928db0e19d7a64e6efcacf 100644 (file)
@@ -159,7 +159,7 @@ METHOD(pa_tnc_attr_t, set_noskip_flag,void,
 /**
  * Convert time_t to Simple Component Evidence UTS string format
  */
-void measurement_time_to_utc(time_t measurement_time, chunk_t *utc_time)
+static void measurement_time_to_utc(time_t measurement_time, chunk_t *utc_time)
 {
        struct tm t;
 
@@ -260,7 +260,7 @@ static const int tm_leap_1970 = 477;
 /**
  * Convert Simple Component Evidence UTS string format to time_t
  */
-bool measurement_time_from_utc(time_t *measurement_time, chunk_t utc_time)
+static bool measurement_time_from_utc(time_t *measurement_time, chunk_t utc_time)
 {
        int tm_year, tm_mon, tm_day, tm_hour, tm_min, tm_sec;
        int tm_leap_4, tm_leap_100, tm_leap_400, tm_leap;
index 2726f9bfce0f8d58b6409c3a322d6fb05bd4cdea..19c3408fc1a3d67da15d2ae45529616c6a23fb89 100644 (file)
@@ -62,7 +62,7 @@ bool linked_list_match_str(void *item, va_list args)
 /**
  * Creates an empty linked list object.
  */
-element_t *element_create(void *value)
+static element_t *element_create(void *value)
 {
        element_t *this;
        INIT(this,
index effa9fdd76bff94e20f90cb6969f83b7fd273001..eeff9317dcb500ec40d532d569e4a0e6528c1851 100644 (file)
@@ -305,10 +305,10 @@ METHOD(mac_t, destroy, void,
        free_align(this);
 }
 
-/*
- * Described in header
+/**
+ * Create a generic mac_t object using AESNI CMAC
  */
-mac_t *aesni_cmac_create(encryption_algorithm_t algo, size_t key_size)
+static mac_t *aesni_cmac_create(encryption_algorithm_t algo, size_t key_size)
 {
        private_mac_t *this;
 
index ae4af15d29a5f4460e45711181b36699a5101e6b..10846e024706306df90c38825dd0db439834105e 100644 (file)
 #include <crypto/prfs/prf.h>
 #include <crypto/signers/signer.h>
 
-/**
- * Create a generic mac_t object using AESNI CMAC.
- *
- * @param algo         underlying encryption algorithm
- * @param key_size     size of encryption key, in bytes
- */
-mac_t *aesni_cmac_create(encryption_algorithm_t algo, size_t key_size);
-
 /**
  * Creates a new prf_t object based AESNI CMAC.
  *
index e51b57a93df2f136dfa988d93e42a1475f0c8fbc..4725f1716239061ac45b92c05ef7826908fdcb00 100644 (file)
@@ -301,10 +301,10 @@ METHOD(mac_t, destroy, void,
        free_align(this);
 }
 
-/*
- * Described in header
+/**
+ * Create a generic mac_t object using AESNI XCBC
  */
-mac_t *aesni_xcbc_create(encryption_algorithm_t algo, size_t key_size)
+static mac_t *aesni_xcbc_create(encryption_algorithm_t algo, size_t key_size)
 {
        private_aesni_mac_t *this;
 
index d764b4f790b9a322df9aa23d025b100b418d5589..88096b888db9293849d5102ad66998737c8cd51a 100644 (file)
 #include <crypto/prfs/prf.h>
 #include <crypto/signers/signer.h>
 
-/**
- * Create a generic mac_t object using AESNI XCBC
- *
- * @param algo         underlying encryption algorithm
- * @param key_size     size of encryption key, in bytes
- */
-mac_t *aesni_xcbc_create(encryption_algorithm_t algo, size_t key_size);
-
 /**
  * Creates a new prf_t object based AESNI XCBC.
  *
index cacc220d650ce6b397c6267216b7cf47d6872b18..a3f599679863c075f48e0bff1df86072c72f1a18 100644 (file)
@@ -80,7 +80,7 @@ struct private_botan_diffie_hellman_t {
 /**
  * Load a DH private key
  */
-bool load_private_key(private_botan_diffie_hellman_t *this, chunk_t value)
+static bool load_private_key(private_botan_diffie_hellman_t *this, chunk_t value)
 {
        botan_mp_t xa;
 
index ce39d9395bd976e30c54723c48088b45bf1c1ba1..b0a779628f717d926d3cce5acec5a202e937988b 100644 (file)
@@ -310,10 +310,10 @@ METHOD(mac_t, destroy, void,
        free(this);
 }
 
-/*
- * Described in header
+/**
+ * Create a generic mac_t object
  */
-mac_t *cmac_create(encryption_algorithm_t algo, size_t key_size)
+static mac_t *cmac_create(encryption_algorithm_t algo, size_t key_size)
 {
        private_mac_t *this;
        crypter_t *crypter;
index 397a9e4c7d0386f117460236dc836154b8c30e9a..f8261b057c356449139e9139aedde95385193ce4 100644 (file)
@@ -531,13 +531,6 @@ YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!!
        PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \
 }
 
-#ifndef NOPROTO
-void fcrypt_body(DES_LONG *out,des_key_schedule ks,
-                                DES_LONG Eswap0, DES_LONG Eswap1);
-#else
-void fcrypt_body();
-#endif
-
 static const DES_LONG des_skb[8][64]={
        {       /* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */
                0x00000000L,0x00000010L,0x20000000L,0x20000010L,
index 97fb18d73b56ab2a58e714bb283062b48d2639b7..ed253a6f690df68311388b3831b7c3f97faa86f4 100644 (file)
@@ -73,17 +73,4 @@ openssl_rsa_private_key_t *openssl_rsa_private_key_load(key_type_t type,
  */
 private_key_t *openssl_rsa_private_key_create(EVP_PKEY *key, bool engine);
 
-/**
- * Connect to a RSA private key on a smartcard.
- *
- * Accepts the BUILD_SMARTCARD_KEYID and the BUILD_SMARTCARD_PIN
- * arguments.
- *
- * @param type         type of the key, must be KEY_RSA
- * @param args         builder_part_t argument list
- * @return                     loaded key, NULL on failure
- */
-openssl_rsa_private_key_t *openssl_rsa_private_key_connect(key_type_t type,
-                                                                                                                  va_list args);
-
 #endif /** OPENSSL_RSA_PRIVATE_KEY_H_ @}*/
index be020e761dadb2feed06b99ded45347827eb1471..1b9d13569b10d8fbb17e8e91b970870dd85c425b 100644 (file)
@@ -105,7 +105,7 @@ typedef struct {
 /**
  * Destroy a signerinfo_t entry
  */
-void signerinfo_destroy(signerinfo_t *this)
+static void signerinfo_destroy(signerinfo_t *this)
 {
        DESTROY_IF(this->attributes);
        DESTROY_IF(this->serial);
index 7fae6ab32b02643f4618e212a1f0475383576f81..d929a1013ce9e79a684ce010cc605553b9127920 100644 (file)
@@ -2041,7 +2041,7 @@ static private_x509_cert_t* create_empty(void)
 /**
  * Build a generalName from an id
  */
-chunk_t build_generalName(identification_t *id)
+static chunk_t build_generalName(identification_t *id)
 {
        int context;
 
index 20379fb591f5d0393d1752132a617461ad101d2a..59addc4e30c5755cc262c36686a028a74a809b57 100644 (file)
@@ -59,11 +59,6 @@ bool fetchline(chunk_t *src, chunk_t *line);
  */
 err_t extract_value(chunk_t *value, chunk_t *line);
 
-/**
- * extracts a name: value pair from a text line
- */
-err_t extract_name_value(chunk_t *name, chunk_t *value, chunk_t *line);
-
 /**
  * extracts a parameter: value from a text line
  */
index c187e33ac5be1e1b75b57946a145500041dcabdd..269fde3b69e5395db08d66b114c09c3db44cbc1f 100644 (file)
@@ -85,7 +85,7 @@ struct private_tnccs_dynamic_t {
  * defined by section 3.5 "Interoperability with older IF-TNCCS versions" of
  * the TCG TNC IF-TNCCS TLV Bindings Version 2.0 standard.
  */
-tnccs_type_t determine_tnccs_protocol(char version)
+static tnccs_type_t determine_tnccs_protocol(char version)
 {
        switch (version)
        {
index 12123803fde030097d870e37022c34dc36361cfb..3a7ce29b0224c800c3257b2906112f3da563472c 100644 (file)
@@ -82,7 +82,7 @@ size_t hash_len_from_tpm_alg_id(TPM2_ALG_ID alg);
 /**
  * Convert TPM2_ALG_ID to PRF algorithm
  */
-pseudo_random_function_t prf_alg_from_tpm_alg_id(TPM2_ALG_ID alg)
+static pseudo_random_function_t prf_alg_from_tpm_alg_id(TPM2_ALG_ID alg)
 {
        switch (alg)
        {
index ea879298877ade8c75fdf90295b2c6ef7ae38861..ef56a16eb0f36c3df127940aa4428d53e36217c2 100644 (file)
@@ -536,8 +536,8 @@ METHOD(tpm_tss_t, get_version_info, chunk_t,
 /**
  * read the public key portion of a TSS 2.0 key from NVRAM
  */
-bool read_public(private_tpm_tss_tss2_t *this, TPMI_DH_OBJECT handle,
-       TPM2B_PUBLIC *public)
+static bool read_public(private_tpm_tss_tss2_t *this, TPMI_DH_OBJECT handle,
+                                               TPM2B_PUBLIC *public)
 {
        uint32_t rval;
 
index 69fb19c7451bcf4ab228615de10c6c3a03071087..9fa02a207f68e9f04b1fc2bfe40852393320ce29 100644 (file)
@@ -202,7 +202,7 @@ static void add(private_peer_controller_t *this, fast_request_t *request)
 /**
  * pem encode a public key into an allocated string
  */
-char* pem_encode(chunk_t der)
+static char* pem_encode(chunk_t der)
 {
        static const char *begin = "-----BEGIN PUBLIC KEY-----\n";
        static const char *end = "-----END PUBLIC KEY-----";
index abe246f8196c1e8dbb8d88a6e274ad93b368bf96..7bbef72eecaa519a0b223712f18aad25b0d9b1aa 100644 (file)
@@ -395,8 +395,8 @@ bool scep_http_request(const char *url, scep_op_t op, bool http_post,
 /**
  * Extract X.501 attributes
  */
-void extract_attributes(pkcs7_t *pkcs7, enumerator_t *enumerator,
-                                               scep_attributes_t *attrs)
+static void extract_attributes(pkcs7_t *pkcs7, enumerator_t *enumerator,
+                                                          scep_attributes_t *attrs)
 {
        chunk_t attr;
 
index f7e423c3f6d770ca1cd5e9461cf007b8832fd54d..c5e5216f6d845dde533827e4c32d9f8f9a66f59d 100644 (file)
@@ -83,14 +83,14 @@ typedef struct {
        char *value;
 } setting_t;
 
-int setting_find(const void *a, const void *b)
+static int setting_find(const void *a, const void *b)
 {
        const char *key = a;
        const setting_t *setting = b;
        return strcmp(key, setting->key);
 }
 
-int setting_sort(const void *a, const void *b, void *user)
+static int setting_sort(const void *a, const void *b, void *user)
 {
        const setting_t *sa = a, *sb = b;
        return strcmp(sa->key, sb->key);
index 492f068f020e45226669228be4ccbffa7fe4fdc3..1e44fc57c4027d24818754064c310083e8d2ee34 100644 (file)
@@ -315,7 +315,7 @@ METHOD(sw_collector_db_t, destroy, void,
 /**
  * Determine file creation data and convert it into RFC 3339 format
  */
-bool get_file_creation_date(char *pathname, char *timestamp)
+static bool get_file_creation_date(char *pathname, char *timestamp)
 {
        struct stat st;
        struct tm ct;