Add some missing 'static' on a few objects
diff --git a/library/cipher_wrap.c b/library/cipher_wrap.c
index 12fc5c6..fd816fe 100644
--- a/library/cipher_wrap.c
+++ b/library/cipher_wrap.c
@@ -169,7 +169,7 @@
polarssl_free( ctx );
}
-const cipher_base_t aes_info = {
+static const cipher_base_t aes_info = {
POLARSSL_CIPHER_ID_AES,
aes_crypt_ecb_wrap,
#if defined(POLARSSL_CIPHER_MODE_CBC)
@@ -190,7 +190,7 @@
aes_ctx_free
};
-const cipher_info_t aes_128_ecb_info = {
+static const cipher_info_t aes_128_ecb_info = {
POLARSSL_CIPHER_AES_128_ECB,
POLARSSL_MODE_ECB,
128,
@@ -201,7 +201,7 @@
&aes_info
};
-const cipher_info_t aes_192_ecb_info = {
+static const cipher_info_t aes_192_ecb_info = {
POLARSSL_CIPHER_AES_192_ECB,
POLARSSL_MODE_ECB,
192,
@@ -212,7 +212,7 @@
&aes_info
};
-const cipher_info_t aes_256_ecb_info = {
+static const cipher_info_t aes_256_ecb_info = {
POLARSSL_CIPHER_AES_256_ECB,
POLARSSL_MODE_ECB,
256,
@@ -224,7 +224,7 @@
};
#if defined(POLARSSL_CIPHER_MODE_CBC)
-const cipher_info_t aes_128_cbc_info = {
+static const cipher_info_t aes_128_cbc_info = {
POLARSSL_CIPHER_AES_128_CBC,
POLARSSL_MODE_CBC,
128,
@@ -235,7 +235,7 @@
&aes_info
};
-const cipher_info_t aes_192_cbc_info = {
+static const cipher_info_t aes_192_cbc_info = {
POLARSSL_CIPHER_AES_192_CBC,
POLARSSL_MODE_CBC,
192,
@@ -246,7 +246,7 @@
&aes_info
};
-const cipher_info_t aes_256_cbc_info = {
+static const cipher_info_t aes_256_cbc_info = {
POLARSSL_CIPHER_AES_256_CBC,
POLARSSL_MODE_CBC,
256,
@@ -259,7 +259,7 @@
#endif /* POLARSSL_CIPHER_MODE_CBC */
#if defined(POLARSSL_CIPHER_MODE_CFB)
-const cipher_info_t aes_128_cfb128_info = {
+static const cipher_info_t aes_128_cfb128_info = {
POLARSSL_CIPHER_AES_128_CFB128,
POLARSSL_MODE_CFB,
128,
@@ -270,7 +270,7 @@
&aes_info
};
-const cipher_info_t aes_192_cfb128_info = {
+static const cipher_info_t aes_192_cfb128_info = {
POLARSSL_CIPHER_AES_192_CFB128,
POLARSSL_MODE_CFB,
192,
@@ -281,7 +281,7 @@
&aes_info
};
-const cipher_info_t aes_256_cfb128_info = {
+static const cipher_info_t aes_256_cfb128_info = {
POLARSSL_CIPHER_AES_256_CFB128,
POLARSSL_MODE_CFB,
256,
@@ -294,7 +294,7 @@
#endif /* POLARSSL_CIPHER_MODE_CFB */
#if defined(POLARSSL_CIPHER_MODE_CTR)
-const cipher_info_t aes_128_ctr_info = {
+static const cipher_info_t aes_128_ctr_info = {
POLARSSL_CIPHER_AES_128_CTR,
POLARSSL_MODE_CTR,
128,
@@ -305,7 +305,7 @@
&aes_info
};
-const cipher_info_t aes_192_ctr_info = {
+static const cipher_info_t aes_192_ctr_info = {
POLARSSL_CIPHER_AES_192_CTR,
POLARSSL_MODE_CTR,
192,
@@ -316,7 +316,7 @@
&aes_info
};
-const cipher_info_t aes_256_ctr_info = {
+static const cipher_info_t aes_256_ctr_info = {
POLARSSL_CIPHER_AES_256_CTR,
POLARSSL_MODE_CTR,
256,
@@ -336,7 +336,7 @@
key, key_length );
}
-const cipher_base_t gcm_aes_info = {
+static const cipher_base_t gcm_aes_info = {
POLARSSL_CIPHER_ID_AES,
NULL,
#if defined(POLARSSL_CIPHER_MODE_CBC)
@@ -357,7 +357,7 @@
gcm_ctx_free,
};
-const cipher_info_t aes_128_gcm_info = {
+static const cipher_info_t aes_128_gcm_info = {
POLARSSL_CIPHER_AES_128_GCM,
POLARSSL_MODE_GCM,
128,
@@ -368,7 +368,7 @@
&gcm_aes_info
};
-const cipher_info_t aes_192_gcm_info = {
+static const cipher_info_t aes_192_gcm_info = {
POLARSSL_CIPHER_AES_192_GCM,
POLARSSL_MODE_GCM,
192,
@@ -379,7 +379,7 @@
&gcm_aes_info
};
-const cipher_info_t aes_256_gcm_info = {
+static const cipher_info_t aes_256_gcm_info = {
POLARSSL_CIPHER_AES_256_GCM,
POLARSSL_MODE_GCM,
256,
@@ -399,7 +399,7 @@
key, key_length );
}
-const cipher_base_t ccm_aes_info = {
+static const cipher_base_t ccm_aes_info = {
POLARSSL_CIPHER_ID_AES,
NULL,
#if defined(POLARSSL_CIPHER_MODE_CBC)
@@ -420,7 +420,7 @@
ccm_ctx_free,
};
-const cipher_info_t aes_128_ccm_info = {
+static const cipher_info_t aes_128_ccm_info = {
POLARSSL_CIPHER_AES_128_CCM,
POLARSSL_MODE_CCM,
128,
@@ -431,7 +431,7 @@
&ccm_aes_info
};
-const cipher_info_t aes_192_ccm_info = {
+static const cipher_info_t aes_192_ccm_info = {
POLARSSL_CIPHER_AES_192_CCM,
POLARSSL_MODE_CCM,
192,
@@ -442,7 +442,7 @@
&ccm_aes_info
};
-const cipher_info_t aes_256_ccm_info = {
+static const cipher_info_t aes_256_ccm_info = {
POLARSSL_CIPHER_AES_256_CCM,
POLARSSL_MODE_CCM,
256,
@@ -526,7 +526,7 @@
polarssl_free( ctx );
}
-const cipher_base_t camellia_info = {
+static const cipher_base_t camellia_info = {
POLARSSL_CIPHER_ID_CAMELLIA,
camellia_crypt_ecb_wrap,
#if defined(POLARSSL_CIPHER_MODE_CBC)
@@ -547,7 +547,7 @@
camellia_ctx_free
};
-const cipher_info_t camellia_128_ecb_info = {
+static const cipher_info_t camellia_128_ecb_info = {
POLARSSL_CIPHER_CAMELLIA_128_ECB,
POLARSSL_MODE_ECB,
128,
@@ -558,7 +558,7 @@
&camellia_info
};
-const cipher_info_t camellia_192_ecb_info = {
+static const cipher_info_t camellia_192_ecb_info = {
POLARSSL_CIPHER_CAMELLIA_192_ECB,
POLARSSL_MODE_ECB,
192,
@@ -569,7 +569,7 @@
&camellia_info
};
-const cipher_info_t camellia_256_ecb_info = {
+static const cipher_info_t camellia_256_ecb_info = {
POLARSSL_CIPHER_CAMELLIA_256_ECB,
POLARSSL_MODE_ECB,
256,
@@ -581,7 +581,7 @@
};
#if defined(POLARSSL_CIPHER_MODE_CBC)
-const cipher_info_t camellia_128_cbc_info = {
+static const cipher_info_t camellia_128_cbc_info = {
POLARSSL_CIPHER_CAMELLIA_128_CBC,
POLARSSL_MODE_CBC,
128,
@@ -592,7 +592,7 @@
&camellia_info
};
-const cipher_info_t camellia_192_cbc_info = {
+static const cipher_info_t camellia_192_cbc_info = {
POLARSSL_CIPHER_CAMELLIA_192_CBC,
POLARSSL_MODE_CBC,
192,
@@ -603,7 +603,7 @@
&camellia_info
};
-const cipher_info_t camellia_256_cbc_info = {
+static const cipher_info_t camellia_256_cbc_info = {
POLARSSL_CIPHER_CAMELLIA_256_CBC,
POLARSSL_MODE_CBC,
256,
@@ -616,7 +616,7 @@
#endif /* POLARSSL_CIPHER_MODE_CBC */
#if defined(POLARSSL_CIPHER_MODE_CFB)
-const cipher_info_t camellia_128_cfb128_info = {
+static const cipher_info_t camellia_128_cfb128_info = {
POLARSSL_CIPHER_CAMELLIA_128_CFB128,
POLARSSL_MODE_CFB,
128,
@@ -627,7 +627,7 @@
&camellia_info
};
-const cipher_info_t camellia_192_cfb128_info = {
+static const cipher_info_t camellia_192_cfb128_info = {
POLARSSL_CIPHER_CAMELLIA_192_CFB128,
POLARSSL_MODE_CFB,
192,
@@ -638,7 +638,7 @@
&camellia_info
};
-const cipher_info_t camellia_256_cfb128_info = {
+static const cipher_info_t camellia_256_cfb128_info = {
POLARSSL_CIPHER_CAMELLIA_256_CFB128,
POLARSSL_MODE_CFB,
256,
@@ -651,7 +651,7 @@
#endif /* POLARSSL_CIPHER_MODE_CFB */
#if defined(POLARSSL_CIPHER_MODE_CTR)
-const cipher_info_t camellia_128_ctr_info = {
+static const cipher_info_t camellia_128_ctr_info = {
POLARSSL_CIPHER_CAMELLIA_128_CTR,
POLARSSL_MODE_CTR,
128,
@@ -662,7 +662,7 @@
&camellia_info
};
-const cipher_info_t camellia_192_ctr_info = {
+static const cipher_info_t camellia_192_ctr_info = {
POLARSSL_CIPHER_CAMELLIA_192_CTR,
POLARSSL_MODE_CTR,
192,
@@ -673,7 +673,7 @@
&camellia_info
};
-const cipher_info_t camellia_256_ctr_info = {
+static const cipher_info_t camellia_256_ctr_info = {
POLARSSL_CIPHER_CAMELLIA_256_CTR,
POLARSSL_MODE_CTR,
256,
@@ -693,7 +693,7 @@
key, key_length );
}
-const cipher_base_t gcm_camellia_info = {
+static const cipher_base_t gcm_camellia_info = {
POLARSSL_CIPHER_ID_CAMELLIA,
NULL,
#if defined(POLARSSL_CIPHER_MODE_CBC)
@@ -714,7 +714,7 @@
gcm_ctx_free,
};
-const cipher_info_t camellia_128_gcm_info = {
+static const cipher_info_t camellia_128_gcm_info = {
POLARSSL_CIPHER_CAMELLIA_128_GCM,
POLARSSL_MODE_GCM,
128,
@@ -725,7 +725,7 @@
&gcm_camellia_info
};
-const cipher_info_t camellia_192_gcm_info = {
+static const cipher_info_t camellia_192_gcm_info = {
POLARSSL_CIPHER_CAMELLIA_192_GCM,
POLARSSL_MODE_GCM,
192,
@@ -736,7 +736,7 @@
&gcm_camellia_info
};
-const cipher_info_t camellia_256_gcm_info = {
+static const cipher_info_t camellia_256_gcm_info = {
POLARSSL_CIPHER_CAMELLIA_256_GCM,
POLARSSL_MODE_GCM,
256,
@@ -756,7 +756,7 @@
key, key_length );
}
-const cipher_base_t ccm_camellia_info = {
+static const cipher_base_t ccm_camellia_info = {
POLARSSL_CIPHER_ID_CAMELLIA,
NULL,
#if defined(POLARSSL_CIPHER_MODE_CBC)
@@ -777,7 +777,7 @@
ccm_ctx_free,
};
-const cipher_info_t camellia_128_ccm_info = {
+static const cipher_info_t camellia_128_ccm_info = {
POLARSSL_CIPHER_CAMELLIA_128_CCM,
POLARSSL_MODE_CCM,
128,
@@ -788,7 +788,7 @@
&ccm_camellia_info
};
-const cipher_info_t camellia_192_ccm_info = {
+static const cipher_info_t camellia_192_ccm_info = {
POLARSSL_CIPHER_CAMELLIA_192_CCM,
POLARSSL_MODE_CCM,
192,
@@ -799,7 +799,7 @@
&ccm_camellia_info
};
-const cipher_info_t camellia_256_ccm_info = {
+static const cipher_info_t camellia_256_ccm_info = {
POLARSSL_CIPHER_CAMELLIA_256_CCM,
POLARSSL_MODE_CCM,
256,
@@ -932,7 +932,7 @@
polarssl_free( ctx );
}
-const cipher_base_t des_info = {
+static const cipher_base_t des_info = {
POLARSSL_CIPHER_ID_DES,
des_crypt_ecb_wrap,
#if defined(POLARSSL_CIPHER_MODE_CBC)
@@ -953,7 +953,7 @@
des_ctx_free
};
-const cipher_info_t des_ecb_info = {
+static const cipher_info_t des_ecb_info = {
POLARSSL_CIPHER_DES_ECB,
POLARSSL_MODE_ECB,
POLARSSL_KEY_LENGTH_DES,
@@ -965,7 +965,7 @@
};
#if defined(POLARSSL_CIPHER_MODE_CBC)
-const cipher_info_t des_cbc_info = {
+static const cipher_info_t des_cbc_info = {
POLARSSL_CIPHER_DES_CBC,
POLARSSL_MODE_CBC,
POLARSSL_KEY_LENGTH_DES,
@@ -977,7 +977,7 @@
};
#endif /* POLARSSL_CIPHER_MODE_CBC */
-const cipher_base_t des_ede_info = {
+static const cipher_base_t des_ede_info = {
POLARSSL_CIPHER_ID_DES,
des3_crypt_ecb_wrap,
#if defined(POLARSSL_CIPHER_MODE_CBC)
@@ -998,7 +998,7 @@
des3_ctx_free
};
-const cipher_info_t des_ede_ecb_info = {
+static const cipher_info_t des_ede_ecb_info = {
POLARSSL_CIPHER_DES_EDE_ECB,
POLARSSL_MODE_ECB,
POLARSSL_KEY_LENGTH_DES_EDE,
@@ -1010,7 +1010,7 @@
};
#if defined(POLARSSL_CIPHER_MODE_CBC)
-const cipher_info_t des_ede_cbc_info = {
+static const cipher_info_t des_ede_cbc_info = {
POLARSSL_CIPHER_DES_EDE_CBC,
POLARSSL_MODE_CBC,
POLARSSL_KEY_LENGTH_DES_EDE,
@@ -1022,7 +1022,7 @@
};
#endif /* POLARSSL_CIPHER_MODE_CBC */
-const cipher_base_t des_ede3_info = {
+static const cipher_base_t des_ede3_info = {
POLARSSL_CIPHER_ID_DES,
des3_crypt_ecb_wrap,
#if defined(POLARSSL_CIPHER_MODE_CBC)
@@ -1043,7 +1043,7 @@
des3_ctx_free
};
-const cipher_info_t des_ede3_ecb_info = {
+static const cipher_info_t des_ede3_ecb_info = {
POLARSSL_CIPHER_DES_EDE3_ECB,
POLARSSL_MODE_ECB,
POLARSSL_KEY_LENGTH_DES_EDE3,
@@ -1054,7 +1054,7 @@
&des_ede3_info
};
#if defined(POLARSSL_CIPHER_MODE_CBC)
-const cipher_info_t des_ede3_cbc_info = {
+static const cipher_info_t des_ede3_cbc_info = {
POLARSSL_CIPHER_DES_EDE3_CBC,
POLARSSL_MODE_CBC,
POLARSSL_KEY_LENGTH_DES_EDE3,
@@ -1131,7 +1131,7 @@
polarssl_free( ctx );
}
-const cipher_base_t blowfish_info = {
+static const cipher_base_t blowfish_info = {
POLARSSL_CIPHER_ID_BLOWFISH,
blowfish_crypt_ecb_wrap,
#if defined(POLARSSL_CIPHER_MODE_CBC)
@@ -1152,7 +1152,7 @@
blowfish_ctx_free
};
-const cipher_info_t blowfish_ecb_info = {
+static const cipher_info_t blowfish_ecb_info = {
POLARSSL_CIPHER_BLOWFISH_ECB,
POLARSSL_MODE_ECB,
128,
@@ -1164,7 +1164,7 @@
};
#if defined(POLARSSL_CIPHER_MODE_CBC)
-const cipher_info_t blowfish_cbc_info = {
+static const cipher_info_t blowfish_cbc_info = {
POLARSSL_CIPHER_BLOWFISH_CBC,
POLARSSL_MODE_CBC,
128,
@@ -1177,7 +1177,7 @@
#endif /* POLARSSL_CIPHER_MODE_CBC */
#if defined(POLARSSL_CIPHER_MODE_CFB)
-const cipher_info_t blowfish_cfb64_info = {
+static const cipher_info_t blowfish_cfb64_info = {
POLARSSL_CIPHER_BLOWFISH_CFB64,
POLARSSL_MODE_CFB,
128,
@@ -1190,7 +1190,7 @@
#endif /* POLARSSL_CIPHER_MODE_CFB */
#if defined(POLARSSL_CIPHER_MODE_CTR)
-const cipher_info_t blowfish_ctr_info = {
+static const cipher_info_t blowfish_ctr_info = {
POLARSSL_CIPHER_BLOWFISH_CTR,
POLARSSL_MODE_CTR,
128,
@@ -1241,7 +1241,7 @@
polarssl_free( ctx );
}
-const cipher_base_t arc4_base_info = {
+static const cipher_base_t arc4_base_info = {
POLARSSL_CIPHER_ID_ARC4,
NULL,
#if defined(POLARSSL_CIPHER_MODE_CBC)
@@ -1262,7 +1262,7 @@
arc4_ctx_free
};
-const cipher_info_t arc4_128_info = {
+static const cipher_info_t arc4_128_info = {
POLARSSL_CIPHER_ARC4_128,
POLARSSL_MODE_STREAM,
128,
@@ -1304,7 +1304,7 @@
((void) ctx);
}
-const cipher_base_t null_base_info = {
+static const cipher_base_t null_base_info = {
POLARSSL_CIPHER_ID_NULL,
NULL,
#if defined(POLARSSL_CIPHER_MODE_CBC)
@@ -1325,7 +1325,7 @@
null_ctx_free
};
-const cipher_info_t null_cipher_info = {
+static const cipher_info_t null_cipher_info = {
POLARSSL_CIPHER_NULL,
POLARSSL_MODE_STREAM,
0,
diff --git a/library/gcm.c b/library/gcm.c
index 522a8b1..f0c49c6 100644
--- a/library/gcm.c
+++ b/library/gcm.c
@@ -508,10 +508,10 @@
*/
#define MAX_TESTS 6
-int key_index[MAX_TESTS] =
+static int key_index[MAX_TESTS] =
{ 0, 0, 1, 1, 1, 1 };
-unsigned char key[MAX_TESTS][32] =
+static unsigned char key[MAX_TESTS][32] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -523,13 +523,13 @@
0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08 },
};
-size_t iv_len[MAX_TESTS] =
+static size_t iv_len[MAX_TESTS] =
{ 12, 12, 12, 12, 8, 60 };
-int iv_index[MAX_TESTS] =
+static int iv_index[MAX_TESTS] =
{ 0, 0, 1, 1, 1, 2 };
-unsigned char iv[MAX_TESTS][64] =
+static unsigned char iv[MAX_TESTS][64] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00 },
@@ -545,13 +545,13 @@
0xa6, 0x37, 0xb3, 0x9b },
};
-size_t add_len[MAX_TESTS] =
+static size_t add_len[MAX_TESTS] =
{ 0, 0, 0, 20, 20, 20 };
-int add_index[MAX_TESTS] =
+static int add_index[MAX_TESTS] =
{ 0, 0, 0, 1, 1, 1 };
-unsigned char additional[MAX_TESTS][64] =
+static unsigned char additional[MAX_TESTS][64] =
{
{ 0x00 },
{ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
@@ -559,13 +559,13 @@
0xab, 0xad, 0xda, 0xd2 },
};
-size_t pt_len[MAX_TESTS] =
+static size_t pt_len[MAX_TESTS] =
{ 0, 16, 64, 60, 60, 60 };
-int pt_index[MAX_TESTS] =
+static int pt_index[MAX_TESTS] =
{ 0, 0, 1, 1, 1, 1 };
-unsigned char pt[MAX_TESTS][64] =
+static unsigned char pt[MAX_TESTS][64] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },
@@ -579,7 +579,7 @@
0xba, 0x63, 0x7b, 0x39, 0x1a, 0xaf, 0xd2, 0x55 },
};
-unsigned char ct[MAX_TESTS * 3][64] =
+static unsigned char ct[MAX_TESTS * 3][64] =
{
{ 0x00 },
{ 0x03, 0x88, 0xda, 0xce, 0x60, 0xb6, 0xa3, 0x92,
@@ -688,7 +688,7 @@
0x44, 0xae, 0x7e, 0x3f },
};
-unsigned char tag[MAX_TESTS * 3][16] =
+static unsigned char tag[MAX_TESTS * 3][16] =
{
{ 0x58, 0xe2, 0xfc, 0xce, 0xfa, 0x7e, 0x30, 0x61,
0x36, 0x7f, 0x1d, 0x57, 0xa4, 0xe7, 0x45, 0x5a },
diff --git a/library/pkcs5.c b/library/pkcs5.c
index 182d632..289ed45 100644
--- a/library/pkcs5.c
+++ b/library/pkcs5.c
@@ -300,10 +300,10 @@
#define MAX_TESTS 6
-size_t plen[MAX_TESTS] =
+static size_t plen[MAX_TESTS] =
{ 8, 8, 8, 8, 24, 9 };
-unsigned char password[MAX_TESTS][32] =
+static unsigned char password[MAX_TESTS][32] =
{
"password",
"password",
@@ -313,10 +313,10 @@
"pass\0word",
};
-size_t slen[MAX_TESTS] =
+static size_t slen[MAX_TESTS] =
{ 4, 4, 4, 4, 36, 5 };
-unsigned char salt[MAX_TESTS][40] =
+static unsigned char salt[MAX_TESTS][40] =
{
"salt",
"salt",
@@ -326,14 +326,13 @@
"sa\0lt",
};
-uint32_t it_cnt[MAX_TESTS] =
+static uint32_t it_cnt[MAX_TESTS] =
{ 1, 2, 4096, 16777216, 4096, 4096 };
-uint32_t key_len[MAX_TESTS] =
+static uint32_t key_len[MAX_TESTS] =
{ 20, 20, 20, 20, 25, 16 };
-
-unsigned char result_key[MAX_TESTS][32] =
+static unsigned char result_key[MAX_TESTS][32] =
{
{ 0x0c, 0x60, 0xc8, 0x0f, 0x96, 0x1f, 0x0e, 0x71,
0xf3, 0xa9, 0xb5, 0x24, 0xaf, 0x60, 0x12, 0x06,
diff --git a/library/version.c b/library/version.c
index c10acac..f03d8d6 100644
--- a/library/version.c
+++ b/library/version.c
@@ -31,8 +31,6 @@
#include "polarssl/version.h"
#include <string.h>
-const char version[] = POLARSSL_VERSION_STRING;
-
unsigned int version_get_number()
{
return( POLARSSL_VERSION_NUMBER );
diff --git a/library/version_features.c b/library/version_features.c
index adaf5de..5055086 100644
--- a/library/version_features.c
+++ b/library/version_features.c
@@ -37,7 +37,7 @@
#define strcasecmp _stricmp
#endif
-const char *features[] = {
+static const char *features[] = {
#if defined(POLARSSL_VERSION_FEATURES)
#if defined(POLARSSL_HAVE_INT8)
"POLARSSL_HAVE_INT8",