From: Tobias Brunner Date: Wed, 5 Oct 2022 14:37:22 +0000 (+0200) Subject: Make functions static that are only accessed from the same compilation unit X-Git-Tag: 5.9.9rc1~48 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7f46c76125a6aa4d155507bb56b1e6aae28ac18b;p=thirdparty%2Fstrongswan.git Make functions static that are only accessed from the same compilation unit Also removed some declarations for undefined functions. --- diff --git a/scripts/pubkey_speed.c b/scripts/pubkey_speed.c index f5f9a26a2c..87b6d0e442 100644 --- a/scripts/pubkey_speed.c +++ b/scripts/pubkey_speed.c @@ -20,12 +20,12 @@ #include #include -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; diff --git a/src/libcharon/plugins/eap_radius/eap_radius_accounting.c b/src/libcharon/plugins/eap_radius/eap_radius_accounting.c index 674d6ef221..f833dc3c0b 100644 --- a/src/libcharon/plugins/eap_radius/eap_radius_accounting.c +++ b/src/libcharon/plugins/eap_radius/eap_radius_accounting.c @@ -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); diff --git a/src/libimcv/plugins/imv_attestation/attest_db.c b/src/libimcv/plugins/imv_attestation/attest_db.c index 317671bd5a..9027bcc461 100644 --- a/src/libimcv/plugins/imv_attestation/attest_db.c +++ b/src/libimcv/plugins/imv_attestation/attest_db.c @@ -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]; diff --git a/src/libimcv/tcg/pts/tcg_pts_attr_simple_comp_evid.c b/src/libimcv/tcg/pts/tcg_pts_attr_simple_comp_evid.c index 933148f7e6..6a25d98d2e 100644 --- a/src/libimcv/tcg/pts/tcg_pts_attr_simple_comp_evid.c +++ b/src/libimcv/tcg/pts/tcg_pts_attr_simple_comp_evid.c @@ -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; diff --git a/src/libstrongswan/collections/linked_list.c b/src/libstrongswan/collections/linked_list.c index 2726f9bfce..19c3408fc1 100644 --- a/src/libstrongswan/collections/linked_list.c +++ b/src/libstrongswan/collections/linked_list.c @@ -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, diff --git a/src/libstrongswan/plugins/aesni/aesni_cmac.c b/src/libstrongswan/plugins/aesni/aesni_cmac.c index effa9fdd76..eeff9317dc 100644 --- a/src/libstrongswan/plugins/aesni/aesni_cmac.c +++ b/src/libstrongswan/plugins/aesni/aesni_cmac.c @@ -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; diff --git a/src/libstrongswan/plugins/aesni/aesni_cmac.h b/src/libstrongswan/plugins/aesni/aesni_cmac.h index ae4af15d29..10846e0247 100644 --- a/src/libstrongswan/plugins/aesni/aesni_cmac.h +++ b/src/libstrongswan/plugins/aesni/aesni_cmac.h @@ -26,14 +26,6 @@ #include #include -/** - * 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. * diff --git a/src/libstrongswan/plugins/aesni/aesni_xcbc.c b/src/libstrongswan/plugins/aesni/aesni_xcbc.c index e51b57a93d..4725f17162 100644 --- a/src/libstrongswan/plugins/aesni/aesni_xcbc.c +++ b/src/libstrongswan/plugins/aesni/aesni_xcbc.c @@ -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; diff --git a/src/libstrongswan/plugins/aesni/aesni_xcbc.h b/src/libstrongswan/plugins/aesni/aesni_xcbc.h index d764b4f790..88096b888d 100644 --- a/src/libstrongswan/plugins/aesni/aesni_xcbc.h +++ b/src/libstrongswan/plugins/aesni/aesni_xcbc.h @@ -26,14 +26,6 @@ #include #include -/** - * 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. * diff --git a/src/libstrongswan/plugins/botan/botan_diffie_hellman.c b/src/libstrongswan/plugins/botan/botan_diffie_hellman.c index cacc220d65..a3f5996798 100644 --- a/src/libstrongswan/plugins/botan/botan_diffie_hellman.c +++ b/src/libstrongswan/plugins/botan/botan_diffie_hellman.c @@ -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; diff --git a/src/libstrongswan/plugins/cmac/cmac.c b/src/libstrongswan/plugins/cmac/cmac.c index ce39d9395b..b0a779628f 100644 --- a/src/libstrongswan/plugins/cmac/cmac.c +++ b/src/libstrongswan/plugins/cmac/cmac.c @@ -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; diff --git a/src/libstrongswan/plugins/des/des_crypter.c b/src/libstrongswan/plugins/des/des_crypter.c index 397a9e4c7d..f8261b057c 100644 --- a/src/libstrongswan/plugins/des/des_crypter.c +++ b/src/libstrongswan/plugins/des/des_crypter.c @@ -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, diff --git a/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.h b/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.h index 97fb18d73b..ed253a6f69 100644 --- a/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.h +++ b/src/libstrongswan/plugins/openssl/openssl_rsa_private_key.h @@ -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_ @}*/ diff --git a/src/libstrongswan/plugins/pkcs7/pkcs7_signed_data.c b/src/libstrongswan/plugins/pkcs7/pkcs7_signed_data.c index be020e761d..1b9d13569b 100644 --- a/src/libstrongswan/plugins/pkcs7/pkcs7_signed_data.c +++ b/src/libstrongswan/plugins/pkcs7/pkcs7_signed_data.c @@ -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); diff --git a/src/libstrongswan/plugins/x509/x509_cert.c b/src/libstrongswan/plugins/x509/x509_cert.c index 7fae6ab32b..d929a1013c 100644 --- a/src/libstrongswan/plugins/x509/x509_cert.c +++ b/src/libstrongswan/plugins/x509/x509_cert.c @@ -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; diff --git a/src/libstrongswan/utils/lexparser.h b/src/libstrongswan/utils/lexparser.h index 20379fb591..59addc4e30 100644 --- a/src/libstrongswan/utils/lexparser.h +++ b/src/libstrongswan/utils/lexparser.h @@ -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 */ diff --git a/src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c b/src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c index c187e33ac5..269fde3b69 100644 --- a/src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c +++ b/src/libtnccs/plugins/tnccs_dynamic/tnccs_dynamic.c @@ -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) { diff --git a/src/libtpmtss/tpm_tss_tss2_session.c b/src/libtpmtss/tpm_tss_tss2_session.c index 12123803fd..3a7ce29b02 100644 --- a/src/libtpmtss/tpm_tss_tss2_session.c +++ b/src/libtpmtss/tpm_tss_tss2_session.c @@ -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) { diff --git a/src/libtpmtss/tpm_tss_tss2_v2.c b/src/libtpmtss/tpm_tss_tss2_v2.c index ea87929887..ef56a16eb0 100644 --- a/src/libtpmtss/tpm_tss_tss2_v2.c +++ b/src/libtpmtss/tpm_tss_tss2_v2.c @@ -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; diff --git a/src/medsrv/controller/peer_controller.c b/src/medsrv/controller/peer_controller.c index 69fb19c745..9fa02a207f 100644 --- a/src/medsrv/controller/peer_controller.c +++ b/src/medsrv/controller/peer_controller.c @@ -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-----"; diff --git a/src/pki/scep/scep.c b/src/pki/scep/scep.c index abe246f819..7bbef72eec 100644 --- a/src/pki/scep/scep.c +++ b/src/pki/scep/scep.c @@ -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; diff --git a/src/starter/parser/conf_parser.c b/src/starter/parser/conf_parser.c index f7e423c3f6..c5e5216f6d 100644 --- a/src/starter/parser/conf_parser.c +++ b/src/starter/parser/conf_parser.c @@ -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); diff --git a/src/sw-collector/sw_collector_db.c b/src/sw-collector/sw_collector_db.c index 492f068f02..1e44fc57c4 100644 --- a/src/sw-collector/sw_collector_db.c +++ b/src/sw-collector/sw_collector_db.c @@ -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;