summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwayne Litzenberger <dlitz@dlitz.net>2014-06-22 20:05:02 -0700
committerDwayne Litzenberger <dlitz@dlitz.net>2014-06-22 20:10:24 -0700
commit780eb557aedd3de7689aa215b3f13082dc60e2e1 (patch)
tree7b3a187f2f19caad7ebfa446b67b7f688f53516f
parent696b31bc95cb98dc17e1bc6daad196cff64af29b (diff)
downloadpycrypto-780eb557aedd3de7689aa215b3f13082dc60e2e1.tar.gz
PyCrypto customizations: Declare things static so that we don't leak symbols
-rw-r--r--src/libtom/tomcrypt_cipher.h28
-rw-r--r--src/libtom/tomcrypt_des.c28
2 files changed, 28 insertions, 28 deletions
diff --git a/src/libtom/tomcrypt_cipher.h b/src/libtom/tomcrypt_cipher.h
index bd740bf..a4b3dcf 100644
--- a/src/libtom/tomcrypt_cipher.h
+++ b/src/libtom/tomcrypt_cipher.h
@@ -328,7 +328,7 @@ typedef struct {
/** cipher descriptor table, last entry has "name == NULL" to mark the end of table */
-extern struct ltc_cipher_descriptor {
+static struct ltc_cipher_descriptor {
/** name of cipher */
char *name;
/** internal ID */
@@ -660,19 +660,19 @@ extern const struct ltc_cipher_descriptor twofish_desc;
#endif
#ifdef LTC_DES
-int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
-int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
-int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
-int des_test(void);
-void des_done(symmetric_key *skey);
-int des_keysize(int *keysize);
-int des3_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
-int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
-int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
-int des3_test(void);
-void des3_done(symmetric_key *skey);
-int des3_keysize(int *keysize);
-extern const struct ltc_cipher_descriptor des_desc, des3_desc;
+static int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
+static int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
+static int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
+static int des_test(void);
+static void des_done(symmetric_key *skey);
+static int des_keysize(int *keysize);
+static int des3_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey);
+static int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey);
+static int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey);
+static int des3_test(void);
+static void des3_done(symmetric_key *skey);
+static int des3_keysize(int *keysize);
+static const struct ltc_cipher_descriptor des_desc, des3_desc;
#endif
#ifdef LTC_CAST5
diff --git a/src/libtom/tomcrypt_des.c b/src/libtom/tomcrypt_des.c
index dea5b92..d921ca5 100644
--- a/src/libtom/tomcrypt_des.c
+++ b/src/libtom/tomcrypt_des.c
@@ -20,7 +20,7 @@
#define EN0 0
#define DE1 1
-const struct ltc_cipher_descriptor des_desc =
+static const struct ltc_cipher_descriptor des_desc =
{
"des",
13,
@@ -34,7 +34,7 @@ const struct ltc_cipher_descriptor des_desc =
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
};
-const struct ltc_cipher_descriptor des3_desc =
+static const struct ltc_cipher_descriptor des3_desc =
{
"3des",
14,
@@ -1526,7 +1526,7 @@ static void desfunc(ulong32 *block, const ulong32 *keys)
@param skey The key in as scheduled by this function.
@return CRYPT_OK if successful
*/
-int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
+static int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
{
LTC_ARGCHK(key != NULL);
LTC_ARGCHK(skey != NULL);
@@ -1553,7 +1553,7 @@ int des_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_ke
@param skey The key in as scheduled by this function.
@return CRYPT_OK if successful
*/
-int des3_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
+static int des3_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_key *skey)
{
LTC_ARGCHK(key != NULL);
LTC_ARGCHK(skey != NULL);
@@ -1584,7 +1584,7 @@ int des3_setup(const unsigned char *key, int keylen, int num_rounds, symmetric_k
@param skey The key as scheduled
@return CRYPT_OK if successful
*/
-int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)
+static int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)
{
ulong32 work[2];
LTC_ARGCHK(pt != NULL);
@@ -1605,7 +1605,7 @@ int des_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *s
@param skey The key as scheduled
@return CRYPT_OK if successful
*/
-int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey)
+static int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey)
{
ulong32 work[2];
LTC_ARGCHK(pt != NULL);
@@ -1626,7 +1626,7 @@ int des_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *s
@param skey The key as scheduled
@return CRYPT_OK if successful
*/
-int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)
+static int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *skey)
{
ulong32 work[2];
@@ -1650,7 +1650,7 @@ int des3_ecb_encrypt(const unsigned char *pt, unsigned char *ct, symmetric_key *
@param skey The key as scheduled
@return CRYPT_OK if successful
*/
-int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey)
+static int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *skey)
{
ulong32 work[2];
LTC_ARGCHK(pt != NULL);
@@ -1670,7 +1670,7 @@ int des3_ecb_decrypt(const unsigned char *ct, unsigned char *pt, symmetric_key *
Performs a self-test of the LTC_DES block cipher
@return CRYPT_OK if functional, CRYPT_NOP if self-test has been disabled
*/
-int des_test(void)
+static int des_test(void)
{
#ifndef LTC_TEST
return CRYPT_NOP;
@@ -1813,7 +1813,7 @@ int des_test(void)
#endif
}
-int des3_test(void)
+static int des3_test(void)
{
#ifndef LTC_TEST
return CRYPT_NOP;
@@ -1852,14 +1852,14 @@ int des3_test(void)
/** Terminate the context
@param skey The scheduled key
*/
-void des_done(symmetric_key *skey)
+static void des_done(symmetric_key *skey)
{
}
/** Terminate the context
@param skey The scheduled key
*/
-void des3_done(symmetric_key *skey)
+static void des3_done(symmetric_key *skey)
{
}
@@ -1869,7 +1869,7 @@ void des3_done(symmetric_key *skey)
@param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable.
@return CRYPT_OK if the input key size is acceptable.
*/
-int des_keysize(int *keysize)
+static int des_keysize(int *keysize)
{
LTC_ARGCHK(keysize != NULL);
if(*keysize < 8) {
@@ -1884,7 +1884,7 @@ int des_keysize(int *keysize)
@param keysize [in/out] The length of the recommended key (in bytes). This function will store the suitable size back in this variable.
@return CRYPT_OK if the input key size is acceptable.
*/
-int des3_keysize(int *keysize)
+static int des3_keysize(int *keysize)
{
LTC_ARGCHK(keysize != NULL);
if(*keysize < 24) {