Skip to content

Commit f5fe918

Browse files
authored
Merge pull request #755 from libtom/fix-warnings
Fix warnings
2 parents 612f211 + 074a354 commit f5fe918

40 files changed

Lines changed: 94 additions & 74 deletions

‎demos/constants.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
22
/* SPDX-License-Identifier: Unlicense */
3+
4+
#define _POSIX_C_SOURCE 200809L /* otherwise PATH_MAX + strdup are not defined for build with -std=c99 */
35
#include "tomcrypt.h"
46

57
#include <string.h>

‎demos/gcm-file/gcm_file.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
@param res [out] Result of the operation, 1==valid, 0==invalid
3535
@return CRYPT_OK on success
3636
*/
37-
int gcm_file( int cipher,
37+
static int gcm_file(int cipher,
3838
const unsigned char *key, unsigned long keylen,
3939
const unsigned char *IV, unsigned long IVlen,
4040
const unsigned char *adata, unsigned long adatalen,

‎demos/gcm-file/gcm_filehandle.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
@param res [out] Result of the operation, 1==valid, 0==invalid
5353
@return CRYPT_OK on success
5454
*/
55-
int gcm_filehandle( int cipher,
55+
static int gcm_filehandle(int cipher,
5656
const unsigned char *key, unsigned long keylen,
5757
const unsigned char *IV, unsigned long IVlen,
5858
const unsigned char *adata, unsigned long adatalen,

‎demos/hashsum.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* more functions ;)
1111
*/
1212

13+
#define _POSIX_C_SOURCE 200809L /* otherwise PATH_MAX + strdup are not defined for build with -std=c99 */
1314
#include <tomcrypt.h>
1415

1516
#include <string.h>

‎demos/latex-tables.c‎

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
#include "tomcrypt_private.h"
55

66
#if defined(LTC_PEM_SSH)
7-
extern const struct blockcipher_info pem_dek_infos[];
8-
extern const unsigned long pem_dek_infos_num;
9-
10-
extern const struct blockcipher_info ssh_ciphers[];
11-
extern const unsigned long ssh_ciphers_num;
12-
137
static const struct {
148
const char *is, *should;
159
} cipher_name_map[] = {

‎demos/openssl-enc.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static void LTC_NORETURN barf(const char *pname, const char *err)
109109
* Output: CRYPT_OK if parsed OK, CRYPT_ERROR if not
110110
* Side Effects: infile's read pointer += 16
111111
*/
112-
int parse_openssl_header(FILE *in, unsigned char *out)
112+
static int parse_openssl_header(FILE *in, unsigned char *out)
113113
{
114114
unsigned char tmp[SALT_LENGTH];
115115
if(fread(tmp, 1, sizeof(tmp), in) != sizeof(tmp))
@@ -129,7 +129,7 @@ int parse_openssl_header(FILE *in, unsigned char *out)
129129
* Output: none
130130
* Side Effects: bytes printed as a hex blob, no lf at the end
131131
*/
132-
void dump_bytes(unsigned char *in, unsigned long len)
132+
static void dump_bytes(unsigned char *in, unsigned long len)
133133
{
134134
unsigned long idx;
135135
for(idx=0; idx<len; idx++)
@@ -171,8 +171,8 @@ static size_t s_pkcs7_pad(union paddable *buf, size_t nb, int block_length,
171171
* Output: CRYPT_OK if no error
172172
* Side Effects: bytes slurped from infile, pushed to outfile, fds updated.
173173
*/
174-
int do_crypt(FILE *infd, FILE *outfd, unsigned char *key, unsigned char *iv,
175-
int encrypt)
174+
static int do_crypt(FILE *infd, FILE *outfd, unsigned char *key, unsigned char *iv,
175+
int encrypt)
176176
{
177177
union paddable inbuf, outbuf;
178178
int cipher, ret;

‎demos/sizes.c‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/* LibTomCrypt, modular cryptographic library -- Tom St Denis */
22
/* SPDX-License-Identifier: Unlicense */
33

4+
#define _POSIX_C_SOURCE 200809L /* otherwise PATH_MAX + strdup are not defined for build with -std=c99 */
45
#include "tomcrypt.h"
56

67
#include <string.h>

‎notes/rsa-testvectors/oaep-vect.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ typedef struct testcase {
4242
#endif /* LTC_TEST_EXT */
4343
} testcase_t;
4444

45-
testcase_t testcases_oaep[] =
45+
static testcase_t testcases_oaep[] =
4646
{
4747
{
4848
"Example 1: A 1024-bit RSA Key Pair",

‎notes/rsa-testvectors/pkcs1v15crypt-vectors.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ typedef struct testcase {
4242
#endif /* LTC_TEST_EXT */
4343
} testcase_t;
4444

45-
testcase_t testcases_eme[] =
45+
static testcase_t testcases_eme[] =
4646
{
4747
{
4848
"Example 1: A 1024-bit RSA key pair",

‎notes/rsa-testvectors/pkcs1v15sign-vectors.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ typedef struct testcase {
4040
#endif /* LTC_TEST_EXT */
4141
} testcase_t;
4242

43-
testcase_t testcases_emsa[] =
43+
static testcase_t testcases_emsa[] =
4444
{
4545
{
4646
"Example 1: A 1024-bit RSA key pair",

0 commit comments

Comments
 (0)