Skip to content

Commit 4fb0562

Browse files
committed
fix -Wmissing-declarations -Wmissing-prototypes -Wmissing-noreturn
1 parent b5009d7 commit 4fb0562

File tree

5 files changed

+30
-28
lines changed

5 files changed

+30
-28
lines changed

demos/ltcrypt.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
#include <tomcrypt.h>
2020

21-
int usage(char *name)
21+
static int NORETURN usage(char *name)
2222
{
2323
int x;
2424

demos/tv_gen.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99
#include "tomcrypt_private.h"
1010

11-
void hash_gen(void)
11+
static void hash_gen(void)
1212
{
1313
unsigned char md[MAXBLOCKSIZE], *buf;
1414
unsigned long outlen, x, y, z;
@@ -49,7 +49,7 @@ void hash_gen(void)
4949
fclose(out);
5050
}
5151

52-
void cipher_gen(void)
52+
static void cipher_gen(void)
5353
{
5454
unsigned char *key, pt[MAXBLOCKSIZE];
5555
unsigned long x, y, z, w;
@@ -124,7 +124,7 @@ void cipher_gen(void)
124124
fclose(out);
125125
}
126126

127-
void hmac_gen(void)
127+
static void hmac_gen(void)
128128
{
129129
unsigned char key[MAXBLOCKSIZE], output[MAXBLOCKSIZE], *input;
130130
int x, y, z, err;
@@ -176,7 +176,7 @@ void hmac_gen(void)
176176
fclose(out);
177177
}
178178

179-
void omac_gen(void)
179+
static void omac_gen(void)
180180
{
181181
#ifdef LTC_OMAC
182182
unsigned char key[MAXBLOCKSIZE], output[MAXBLOCKSIZE], input[MAXBLOCKSIZE*2+2];
@@ -237,7 +237,7 @@ void omac_gen(void)
237237
#endif
238238
}
239239

240-
void pmac_gen(void)
240+
static void pmac_gen(void)
241241
{
242242
#ifdef LTC_PMAC
243243
unsigned char key[MAXBLOCKSIZE], output[MAXBLOCKSIZE], input[MAXBLOCKSIZE*2+2];
@@ -298,7 +298,7 @@ void pmac_gen(void)
298298
#endif
299299
}
300300

301-
void eax_gen(void)
301+
static void eax_gen(void)
302302
{
303303
#ifdef LTC_EAX_MODE
304304
int err, kl, x, y1, z;
@@ -364,7 +364,7 @@ void eax_gen(void)
364364
#endif
365365
}
366366

367-
void ocb_gen(void)
367+
static void ocb_gen(void)
368368
{
369369
#ifdef LTC_OCB_MODE
370370
int err, kl, x, y1, z;
@@ -433,7 +433,7 @@ void ocb_gen(void)
433433
#endif
434434
}
435435

436-
void ocb3_gen(void)
436+
static void ocb3_gen(void)
437437
{
438438
#ifdef LTC_OCB3_MODE
439439
int err, kl, x, y1, z, noncelen;
@@ -503,7 +503,7 @@ void ocb3_gen(void)
503503
#endif
504504
}
505505

506-
void ccm_gen(void)
506+
static void ccm_gen(void)
507507
{
508508
#ifdef LTC_CCM_MODE
509509
int err, kl, x, y1, z;
@@ -572,7 +572,7 @@ void ccm_gen(void)
572572
#endif
573573
}
574574

575-
void gcm_gen(void)
575+
static void gcm_gen(void)
576576
{
577577
#ifdef LTC_GCM_MODE
578578
int err, kl, x, y1, z;
@@ -635,7 +635,7 @@ void gcm_gen(void)
635635
#endif
636636
}
637637

638-
void base64_gen(void)
638+
static void base64_gen(void)
639639
{
640640
FILE *out;
641641
unsigned char src[32], ch;
@@ -655,11 +655,11 @@ void base64_gen(void)
655655
fclose(out);
656656
}
657657

658-
void math_gen(void)
658+
static void math_gen(void)
659659
{
660660
}
661661

662-
void ecc_gen(void)
662+
static void ecc_gen(void)
663663
{
664664
FILE *out;
665665
unsigned char str[512];
@@ -701,7 +701,7 @@ void ecc_gen(void)
701701
fclose(out);
702702
}
703703

704-
void lrw_gen(void)
704+
static void lrw_gen(void)
705705
{
706706
#ifdef LTC_LRW_MODE
707707
FILE *out;

tests/der_test.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1301,7 +1301,7 @@ static void der_Xcode_test(void)
13011301
}
13021302

13031303
#ifdef LTC_TEST_READDIR
1304-
int _der_decode_sequence_flexi(const void *in, unsigned long inlen, void* ctx)
1304+
static int _der_decode_sequence_flexi(const void *in, unsigned long inlen, void* ctx)
13051305
{
13061306
ltc_asn1_list** list = ctx;
13071307
if (der_decode_sequence_flexi(in, &inlen, list) == CRYPT_OK) {

tests/ecc_test.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ static int _ecc_test_mp(void)
209209
return err;
210210
}
211211

212-
int _ecc_old_api(void)
212+
static int _ecc_old_api(void)
213213
{
214214
unsigned char buf[4][4096], ch;
215215
unsigned long x, y, z, s;
@@ -350,7 +350,7 @@ int _ecc_old_api(void)
350350
return CRYPT_OK;
351351
}
352352

353-
int _ecc_new_api(void)
353+
static int _ecc_new_api(void)
354354
{
355355
const char* names[] = {
356356
#ifdef LTC_ECC_SECP112R1
@@ -517,7 +517,7 @@ int _ecc_new_api(void)
517517
return CRYPT_OK;
518518
}
519519

520-
int _ecc_key_cmp(const int should_type, const ecc_key *should, const ecc_key *is)
520+
static int _ecc_key_cmp(const int should_type, const ecc_key *should, const ecc_key *is)
521521
{
522522
if (should_type != is->type) return CRYPT_ERROR;
523523
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
536536
return CRYPT_OK;
537537
}
538538

539-
int _ecc_import_export(void) {
539+
static int _ecc_import_export(void) {
540540
const ltc_ecc_curve *cu;
541541
ecc_key key, pri, pub;
542542
unsigned char out[300];

tests/no_prng.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
* The library is free for all purposes without any express
77
* guarantee it works.
88
*/
9+
910
#include "tomcrypt.h"
11+
#include "tomcrypt_test.h"
1012

1113
/**
1214
@file no_prng.c
@@ -29,7 +31,7 @@ typedef struct
2931
@param prng [out] The PRNG state to initialize
3032
@return CRYPT_OK if successful
3133
*/
32-
int no_prng_start(prng_state *prng)
34+
static int no_prng_start(prng_state *prng)
3335
{
3436
no_prng_desc_t *no_prng = (no_prng_desc_t*) prng;
3537
LTC_ARGCHK(no_prng != NULL);
@@ -47,7 +49,7 @@ int no_prng_start(prng_state *prng)
4749
@param prng PRNG state to update
4850
@return CRYPT_OK if successful
4951
*/
50-
int no_prng_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng)
52+
static int no_prng_add_entropy(const unsigned char *in, unsigned long inlen, prng_state *prng)
5153
{
5254
no_prng_desc_t *no_prng = (no_prng_desc_t*) prng;
5355
LTC_ARGCHK(no_prng != NULL);
@@ -68,7 +70,7 @@ int no_prng_add_entropy(const unsigned char *in, unsigned long inlen, prng_state
6870
@param prng The PRNG to make active
6971
@return CRYPT_OK if successful
7072
*/
71-
int no_prng_ready(prng_state *prng)
73+
static int no_prng_ready(prng_state *prng)
7274
{
7375
LTC_ARGCHK(prng != NULL);
7476

@@ -82,7 +84,7 @@ int no_prng_ready(prng_state *prng)
8284
@param prng The active PRNG to read from
8385
@return Number of octets read
8486
*/
85-
unsigned long no_prng_read(unsigned char *out, unsigned long outlen, prng_state *prng)
87+
static unsigned long no_prng_read(unsigned char *out, unsigned long outlen, prng_state *prng)
8688
{
8789
no_prng_desc_t *no_prng = (no_prng_desc_t*) prng;
8890
LTC_ARGCHK(no_prng != NULL);
@@ -101,7 +103,7 @@ unsigned long no_prng_read(unsigned char *out, unsigned long outlen, prng_state
101103
@param prng The PRNG to terminate
102104
@return CRYPT_OK if successful
103105
*/
104-
int no_prng_done(prng_state *prng)
106+
static int no_prng_done(prng_state *prng)
105107
{
106108
LTC_UNUSED_PARAM(prng);
107109
return CRYPT_OK;
@@ -114,7 +116,7 @@ int no_prng_done(prng_state *prng)
114116
@param prng The PRNG to export
115117
@return CRYPT_OK if successful
116118
*/
117-
int no_prng_export(unsigned char *out, unsigned long *outlen, prng_state *prng)
119+
static int no_prng_export(unsigned char *out, unsigned long *outlen, prng_state *prng)
118120
{
119121
LTC_UNUSED_PARAM(out);
120122
LTC_UNUSED_PARAM(outlen);
@@ -129,7 +131,7 @@ int no_prng_export(unsigned char *out, unsigned long *outlen, prng_state *prng)
129131
@param prng The PRNG to import
130132
@return CRYPT_OK if successful
131133
*/
132-
int no_prng_import(const unsigned char *in, unsigned long inlen, prng_state *prng)
134+
static int no_prng_import(const unsigned char *in, unsigned long inlen, prng_state *prng)
133135
{
134136
LTC_UNUSED_PARAM(in);
135137
LTC_UNUSED_PARAM(inlen);
@@ -141,7 +143,7 @@ int no_prng_import(const unsigned char *in, unsigned long inlen, prng_state *prn
141143
PRNG self-test
142144
@return CRYPT_OK if successful, CRYPT_NOP if self-testing has been disabled
143145
*/
144-
int no_prng_test(void)
146+
static int no_prng_test(void)
145147
{
146148
return CRYPT_OK;
147149
}

0 commit comments

Comments
 (0)