Only declare static functions when they are used. Omit functions we never use.
diff --git a/lib/gladman-fcrypt.c b/lib/gladman-fcrypt.c index a0da258..8488ae4 100644 --- a/lib/gladman-fcrypt.c +++ b/lib/gladman-fcrypt.c
@@ -31,6 +31,8 @@ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#define BUILDING_FCRYPT + #include "gladman-fcrypt.h" #include "gladman-fcrypt/aescrypt.c"
diff --git a/lib/gladman-fcrypt/aes.h b/lib/gladman-fcrypt/aes.h index 7d62e0d..d8a5f93 100644 --- a/lib/gladman-fcrypt/aes.h +++ b/lib/gladman-fcrypt/aes.h
@@ -107,15 +107,19 @@ /* and 256 bit) keys. The value aes_good is returned if the requested */ /* key size is legal, otherwise aes_bad is returned. */ +#ifdef BUILDING_FCRYPT INTERNAL aes_rval aes_set_encrypt_key(const unsigned char in_key[], unsigned int klen, aes_ctx cx[1]); INTERNAL aes_rval aes_encrypt_block(const unsigned char in_blk[], unsigned char out_blk[], const aes_ctx cx[1]); +#endif +#if 0 /* not used */ INTERNAL aes_rval aes_set_decrypt_key(const unsigned char in_key[], unsigned int klen, aes_ctx cx[1]); INTERNAL aes_rval aes_decrypt_block(const unsigned char in_blk[], unsigned char out_blk[], const aes_ctx cx[1]); +#endif #if defined(__cplusplus) }
diff --git a/lib/gladman-fcrypt/hmac.c b/lib/gladman-fcrypt/hmac.c index b51374e..39e7bd5 100644 --- a/lib/gladman-fcrypt/hmac.c +++ b/lib/gladman-fcrypt/hmac.c
@@ -131,6 +131,7 @@ mac[i] = dig[i]; } +#if 0 /* not used */ /* 'do it all in one go' subroutine */ INTERNAL void hmac_sha1(const unsigned char key[], unsigned int key_len, const unsigned char data[], unsigned int data_len, @@ -142,6 +143,7 @@ hmac_sha1_data(data, data_len, cx); hmac_sha1_end(mac, mac_len, cx); } +#endif #if defined(__cplusplus) }
diff --git a/lib/gladman-fcrypt/hmac.h b/lib/gladman-fcrypt/hmac.h index 015cf72..1541440 100644 --- a/lib/gladman-fcrypt/hmac.h +++ b/lib/gladman-fcrypt/hmac.h
@@ -58,6 +58,7 @@ unsigned int klen; } hmac_ctx; +#ifdef BUILDING_FCRYPT INTERNAL void hmac_sha1_begin(hmac_ctx cx[1]); INTERNAL int hmac_sha1_key(const unsigned char key[], unsigned long key_len, hmac_ctx cx[1]); @@ -65,10 +66,13 @@ INTERNAL void hmac_sha1_data(const unsigned char data[], unsigned long data_len, hmac_ctx cx[1]); INTERNAL void hmac_sha1_end(unsigned char mac[], unsigned long mac_len, hmac_ctx cx[1]); +#endif +#if 0 /* not used */ INTERNAL void hmac_sha1(const unsigned char key[], unsigned int key_len, const unsigned char data[], unsigned int data_len, unsigned char mac[], unsigned int mac_len); +#endif #if defined(__cplusplus) }
diff --git a/lib/gladman-fcrypt/pwd2key.h b/lib/gladman-fcrypt/pwd2key.h index d6a2c4a..b00e288 100644 --- a/lib/gladman-fcrypt/pwd2key.h +++ b/lib/gladman-fcrypt/pwd2key.h
@@ -42,6 +42,7 @@ { #endif +#ifdef BUILDING_FCRYPT INTERNAL void derive_key( const unsigned char pwd[], /* the PASSWORD, and */ unsigned int pwd_len, /* its length */ @@ -50,6 +51,7 @@ unsigned int iter, /* the number of iterations */ unsigned char key[], /* space for the output key */ unsigned int key_len); /* and its required length */ +#endif #if defined(__cplusplus) }
diff --git a/lib/gladman-fcrypt/sha1.c b/lib/gladman-fcrypt/sha1.c index 1aedf57..4e2c196 100644 --- a/lib/gladman-fcrypt/sha1.c +++ b/lib/gladman-fcrypt/sha1.c
@@ -274,11 +274,13 @@ hval[i] = (unsigned char)(ctx->hash[i >> 2] >> (8 * (~i & 3))); } +#if 0 /* not used */ INTERNAL void sha1(unsigned char hval[], const unsigned char data[], unsigned int len) { sha1_ctx cx[1]; sha1_begin(cx); sha1_hash(data, len, cx); sha1_end(hval, cx); } +#endif #if defined(__cplusplus) }
diff --git a/lib/gladman-fcrypt/sha1.h b/lib/gladman-fcrypt/sha1.h index 766ccc2..58529d4 100644 --- a/lib/gladman-fcrypt/sha1.h +++ b/lib/gladman-fcrypt/sha1.h
@@ -60,12 +60,17 @@ sha1_32t wbuf[16]; } sha1_ctx; +#ifdef BUILDING_FCRYPT INTERNAL void sha1_compile(sha1_ctx ctx[1]); INTERNAL void sha1_begin(sha1_ctx ctx[1]); INTERNAL void sha1_hash(const unsigned char data[], unsigned int len, sha1_ctx ctx[1]); INTERNAL void sha1_end(unsigned char hval[], sha1_ctx ctx[1]); +#endif + +#if 0 /* not used */ INTERNAL void sha1(unsigned char hval[], const unsigned char data[], unsigned int len); +#endif #if defined(__cplusplus) }