Browse Source

fix -Wmissing-declarations -Wmissing-prototypes -Wmissing-noreturn

Karel Miko 7 years ago
parent
commit
4fb0562a3b
5 changed files with 30 additions and 28 deletions
  1. 1 1
      demos/ltcrypt.c
  2. 14 14
      demos/tv_gen.c
  3. 1 1
      tests/der_test.c
  4. 4 4
      tests/ecc_test.c
  5. 10 8
      tests/no_prng.c

+ 1 - 1
demos/ltcrypt.c

@@ -18,7 +18,7 @@
 
 
 #include <tomcrypt.h>
 #include <tomcrypt.h>
 
 
-int usage(char *name)
+static int NORETURN usage(char *name)
 {
 {
    int x;
    int x;
 
 

+ 14 - 14
demos/tv_gen.c

@@ -8,7 +8,7 @@
  */
  */
 #include "tomcrypt_private.h"
 #include "tomcrypt_private.h"
 
 
-void hash_gen(void)
+static void hash_gen(void)
 {
 {
    unsigned char md[MAXBLOCKSIZE], *buf;
    unsigned char md[MAXBLOCKSIZE], *buf;
    unsigned long outlen, x, y, z;
    unsigned long outlen, x, y, z;
@@ -49,7 +49,7 @@ void hash_gen(void)
    fclose(out);
    fclose(out);
 }
 }
 
 
-void cipher_gen(void)
+static void cipher_gen(void)
 {
 {
    unsigned char *key, pt[MAXBLOCKSIZE];
    unsigned char *key, pt[MAXBLOCKSIZE];
    unsigned long x, y, z, w;
    unsigned long x, y, z, w;
@@ -124,7 +124,7 @@ void cipher_gen(void)
   fclose(out);
   fclose(out);
 }
 }
 
 
-void hmac_gen(void)
+static void hmac_gen(void)
 {
 {
    unsigned char key[MAXBLOCKSIZE], output[MAXBLOCKSIZE], *input;
    unsigned char key[MAXBLOCKSIZE], output[MAXBLOCKSIZE], *input;
    int x, y, z, err;
    int x, y, z, err;
@@ -176,7 +176,7 @@ void hmac_gen(void)
    fclose(out);
    fclose(out);
 }
 }
 
 
-void omac_gen(void)
+static void omac_gen(void)
 {
 {
 #ifdef LTC_OMAC
 #ifdef LTC_OMAC
    unsigned char key[MAXBLOCKSIZE], output[MAXBLOCKSIZE], input[MAXBLOCKSIZE*2+2];
    unsigned char key[MAXBLOCKSIZE], output[MAXBLOCKSIZE], input[MAXBLOCKSIZE*2+2];
@@ -237,7 +237,7 @@ void omac_gen(void)
 #endif
 #endif
 }
 }
 
 
-void pmac_gen(void)
+static void pmac_gen(void)
 {
 {
 #ifdef LTC_PMAC
 #ifdef LTC_PMAC
    unsigned char key[MAXBLOCKSIZE], output[MAXBLOCKSIZE], input[MAXBLOCKSIZE*2+2];
    unsigned char key[MAXBLOCKSIZE], output[MAXBLOCKSIZE], input[MAXBLOCKSIZE*2+2];
@@ -298,7 +298,7 @@ void pmac_gen(void)
 #endif
 #endif
 }
 }
 
 
-void eax_gen(void)
+static void eax_gen(void)
 {
 {
 #ifdef LTC_EAX_MODE
 #ifdef LTC_EAX_MODE
    int err, kl, x, y1, z;
    int err, kl, x, y1, z;
@@ -364,7 +364,7 @@ void eax_gen(void)
 #endif
 #endif
 }
 }
 
 
-void ocb_gen(void)
+static void ocb_gen(void)
 {
 {
 #ifdef LTC_OCB_MODE
 #ifdef LTC_OCB_MODE
    int err, kl, x, y1, z;
    int err, kl, x, y1, z;
@@ -433,7 +433,7 @@ void ocb_gen(void)
 #endif
 #endif
 }
 }
 
 
-void ocb3_gen(void)
+static void ocb3_gen(void)
 {
 {
 #ifdef LTC_OCB3_MODE
 #ifdef LTC_OCB3_MODE
    int err, kl, x, y1, z, noncelen;
    int err, kl, x, y1, z, noncelen;
@@ -503,7 +503,7 @@ void ocb3_gen(void)
 #endif
 #endif
 }
 }
 
 
-void ccm_gen(void)
+static void ccm_gen(void)
 {
 {
 #ifdef LTC_CCM_MODE
 #ifdef LTC_CCM_MODE
    int err, kl, x, y1, z;
    int err, kl, x, y1, z;
@@ -572,7 +572,7 @@ void ccm_gen(void)
 #endif
 #endif
 }
 }
 
 
-void gcm_gen(void)
+static void gcm_gen(void)
 {
 {
 #ifdef LTC_GCM_MODE
 #ifdef LTC_GCM_MODE
    int err, kl, x, y1, z;
    int err, kl, x, y1, z;
@@ -635,7 +635,7 @@ void gcm_gen(void)
 #endif
 #endif
 }
 }
 
 
-void base64_gen(void)
+static void base64_gen(void)
 {
 {
    FILE *out;
    FILE *out;
    unsigned char src[32], ch;
    unsigned char src[32], ch;
@@ -655,11 +655,11 @@ void base64_gen(void)
    fclose(out);
    fclose(out);
 }
 }
 
 
-void math_gen(void)
+static void math_gen(void)
 {
 {
 }
 }
 
 
-void ecc_gen(void)
+static void ecc_gen(void)
 {
 {
    FILE         *out;
    FILE         *out;
    unsigned char str[512];
    unsigned char str[512];
@@ -701,7 +701,7 @@ void ecc_gen(void)
    fclose(out);
    fclose(out);
 }
 }
 
 
-void lrw_gen(void)
+static void lrw_gen(void)
 {
 {
 #ifdef LTC_LRW_MODE
 #ifdef LTC_LRW_MODE
    FILE *out;
    FILE *out;

+ 1 - 1
tests/der_test.c

@@ -1301,7 +1301,7 @@ static void der_Xcode_test(void)
 }
 }
 
 
 #ifdef LTC_TEST_READDIR
 #ifdef LTC_TEST_READDIR
-int _der_decode_sequence_flexi(const void *in, unsigned long inlen, void* ctx)
+static int _der_decode_sequence_flexi(const void *in, unsigned long inlen, void* ctx)
 {
 {
    ltc_asn1_list** list = ctx;
    ltc_asn1_list** list = ctx;
    if (der_decode_sequence_flexi(in, &inlen, list) == CRYPT_OK) {
    if (der_decode_sequence_flexi(in, &inlen, list) == CRYPT_OK) {

+ 4 - 4
tests/ecc_test.c

@@ -209,7 +209,7 @@ done:
    return err;
    return err;
 }
 }
 
 
-int _ecc_old_api(void)
+static int _ecc_old_api(void)
 {
 {
    unsigned char buf[4][4096], ch;
    unsigned char buf[4][4096], ch;
    unsigned long x, y, z, s;
    unsigned long x, y, z, s;
@@ -350,7 +350,7 @@ int _ecc_old_api(void)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-int _ecc_new_api(void)
+static int _ecc_new_api(void)
 {
 {
    const char* names[] = {
    const char* names[] = {
 #ifdef LTC_ECC_SECP112R1
 #ifdef LTC_ECC_SECP112R1
@@ -517,7 +517,7 @@ int _ecc_new_api(void)
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-int _ecc_key_cmp(const int should_type, const ecc_key *should, const ecc_key *is)
+static int _ecc_key_cmp(const int should_type, const ecc_key *should, const ecc_key *is)
 {
 {
    if (should_type != is->type)                               return CRYPT_ERROR;
    if (should_type != is->type)                               return CRYPT_ERROR;
    if (should_type == PK_PRIVATE) {
    if (should_type == PK_PRIVATE) {
@@ -536,7 +536,7 @@ int _ecc_key_cmp(const int should_type, const ecc_key *should, const ecc_key *is
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }
 
 
-int _ecc_import_export(void) {
+static int _ecc_import_export(void) {
    const ltc_ecc_curve *cu;
    const ltc_ecc_curve *cu;
    ecc_key key, pri, pub;
    ecc_key key, pri, pub;
    unsigned char out[300];
    unsigned char out[300];

+ 10 - 8
tests/no_prng.c

@@ -6,7 +6,9 @@
  * The library is free for all purposes without any express
  * The library is free for all purposes without any express
  * guarantee it works.
  * guarantee it works.
  */
  */
+
 #include "tomcrypt.h"
 #include "tomcrypt.h"
+#include "tomcrypt_test.h"
 
 
 /**
 /**
   @file no_prng.c
   @file no_prng.c
@@ -29,7 +31,7 @@ typedef struct
   @param prng     [out] The PRNG state to initialize
   @param prng     [out] The PRNG state to initialize
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-int no_prng_start(prng_state *prng)
+static int no_prng_start(prng_state *prng)
 {
 {
    no_prng_desc_t *no_prng = (no_prng_desc_t*) prng;
    no_prng_desc_t *no_prng = (no_prng_desc_t*) prng;
    LTC_ARGCHK(no_prng != NULL);
    LTC_ARGCHK(no_prng != NULL);
@@ -47,7 +49,7 @@ int no_prng_start(prng_state *prng)
   @param prng     PRNG state to update
   @param prng     PRNG state to update
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-int no_prng_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng)
+static int no_prng_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng)
 {
 {
    no_prng_desc_t *no_prng = (no_prng_desc_t*) prng;
    no_prng_desc_t *no_prng = (no_prng_desc_t*) prng;
    LTC_ARGCHK(no_prng != NULL);
    LTC_ARGCHK(no_prng != NULL);
@@ -68,7 +70,7 @@ int no_prng_add_entropy(const unsigned char *in, unsigned long inlen, prng_state
   @param prng   The PRNG to make active
   @param prng   The PRNG to make active
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-int no_prng_ready(prng_state *prng)
+static int no_prng_ready(prng_state *prng)
 {
 {
     LTC_ARGCHK(prng != NULL);
     LTC_ARGCHK(prng != NULL);
 
 
@@ -82,7 +84,7 @@ int no_prng_ready(prng_state *prng)
   @param prng     The active PRNG to read from
   @param prng     The active PRNG to read from
   @return Number of octets read
   @return Number of octets read
 */
 */
-unsigned long no_prng_read(unsigned char *out, unsigned long outlen, prng_state *prng)
+static unsigned long no_prng_read(unsigned char *out, unsigned long outlen, prng_state *prng)
 {
 {
    no_prng_desc_t *no_prng = (no_prng_desc_t*) prng;
    no_prng_desc_t *no_prng = (no_prng_desc_t*) prng;
    LTC_ARGCHK(no_prng != NULL);
    LTC_ARGCHK(no_prng != NULL);
@@ -101,7 +103,7 @@ unsigned long no_prng_read(unsigned char *out, unsigned long outlen, prng_state
   @param prng   The PRNG to terminate
   @param prng   The PRNG to terminate
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-int no_prng_done(prng_state *prng)
+static int no_prng_done(prng_state *prng)
 {
 {
    LTC_UNUSED_PARAM(prng);
    LTC_UNUSED_PARAM(prng);
    return CRYPT_OK;
    return CRYPT_OK;
@@ -114,7 +116,7 @@ int no_prng_done(prng_state *prng)
   @param prng      The PRNG to export
   @param prng      The PRNG to export
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-int no_prng_export(unsigned char *out, unsigned long *outlen, prng_state *prng)
+static int no_prng_export(unsigned char *out, unsigned long *outlen, prng_state *prng)
 {
 {
    LTC_UNUSED_PARAM(out);
    LTC_UNUSED_PARAM(out);
    LTC_UNUSED_PARAM(outlen);
    LTC_UNUSED_PARAM(outlen);
@@ -129,7 +131,7 @@ int no_prng_export(unsigned char *out, unsigned long *outlen, prng_state *prng)
   @param prng     The PRNG to import
   @param prng     The PRNG to import
   @return CRYPT_OK if successful
   @return CRYPT_OK if successful
 */
 */
-int no_prng_import(const unsigned char *in, unsigned long inlen, prng_state *prng)
+static int no_prng_import(const unsigned char *in, unsigned long inlen, prng_state *prng)
 {
 {
    LTC_UNUSED_PARAM(in);
    LTC_UNUSED_PARAM(in);
    LTC_UNUSED_PARAM(inlen);
    LTC_UNUSED_PARAM(inlen);
@@ -141,7 +143,7 @@ int no_prng_import(const unsigned char *in, unsigned long inlen, prng_state *prn
   PRNG self-test
   PRNG self-test
   @return CRYPT_OK if successful, CRYPT_NOP if self-testing has been disabled
   @return CRYPT_OK if successful, CRYPT_NOP if self-testing has been disabled
 */
 */
-int no_prng_test(void)
+static int no_prng_test(void)
 {
 {
    return CRYPT_OK;
    return CRYPT_OK;
 }
 }