Make functions static that are only accessed from the same compilation unit

Also removed some declarations for undefined functions.
This commit is contained in:
Tobias Brunner 2022-10-05 16:37:22 +02:00
parent c58ba0cb9f
commit 7f46c76125
23 changed files with 29 additions and 70 deletions

View File

@ -20,12 +20,12 @@
#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;

View 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);

View 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];

View 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;

View 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,

View 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;

View File

@ -26,14 +26,6 @@
#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.
*

View 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;

View File

@ -26,14 +26,6 @@
#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.
*

View 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;

View 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;

View 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,

View 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_ @}*/

View 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);

View 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;

View 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
*/

View 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)
{

View 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)
{

View 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;

View 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-----";

View 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;

View 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);

View 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;