From df2ee0e27d2db02660c1d15fe6a3e38be9df0a60 Mon Sep 17 00:00:00 2001 From: Ben Laurie Date: Sat, 5 Sep 2015 13:32:58 +0100 Subject: Enable -Wmissing-variable-declarations and -Wincompatible-pointer-types-discards-qualifiers (the latter did not require any code changes). Reviewed-by: Rich Salz --- test/Makefile | 6 ++---- test/bntest.c | 6 +++--- test/ecdsatest.c | 4 ++-- test/gost2814789test.c | 2 +- test/ideatest.c | 22 +++++++++++----------- test/sha256t.c | 12 ++++++------ test/sha512t.c | 12 ++++++------ test/ssltest.c | 26 +++++++++++++------------- test/wp_test.c | 18 +++++++++--------- 9 files changed, 53 insertions(+), 55 deletions(-) (limited to 'test') diff --git a/test/Makefile b/test/Makefile index 9ead38ed01..779d23a2f4 100644 --- a/test/Makefile +++ b/test/Makefile @@ -414,8 +414,7 @@ clienthellotest.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h clienthellotest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h clienthellotest.o: clienthellotest.c constant_time_test.o: ../e_os.h ../include/internal/constant_time_locl.h -constant_time_test.o: ../include/openssl/e_os2.h -constant_time_test.o: ../include/openssl/opensslconf.h constant_time_test.c +constant_time_test.o: constant_time_test.c destest.o: ../include/openssl/des.h ../include/openssl/e_os2.h destest.o: ../include/openssl/opensslconf.h destest.c dhtest.o: ../e_os.h ../include/openssl/bio.h ../include/openssl/bn.h @@ -680,8 +679,7 @@ ssltest.o: ../include/openssl/symhacks.h ../include/openssl/tls1.h ssltest.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h ssltest.o: ../include/openssl/x509v3.h ../ssl/packet_locl.h ssltest.o: ../ssl/record/record.h ../ssl/ssl_locl.h ssltest.c -testutil.o: ../e_os.h ../include/openssl/e_os2.h -testutil.o: ../include/openssl/opensslconf.h testutil.c testutil.h +testutil.o: ../e_os.h testutil.c testutil.h v3nametest.o: ../e_os.h ../include/openssl/asn1.h ../include/openssl/bio.h v3nametest.o: ../include/openssl/buffer.h ../include/openssl/conf.h v3nametest.o: ../include/openssl/crypto.h ../include/openssl/e_os2.h diff --git a/test/bntest.c b/test/bntest.c index be358c82d1..9caa2c904b 100644 --- a/test/bntest.c +++ b/test/bntest.c @@ -83,9 +83,9 @@ #include "../crypto/bn/bn_lcl.h" -const int num0 = 100; /* number of tests */ -const int num1 = 50; /* additional tests for some functions */ -const int num2 = 5; /* number of tests for slow functions */ +static const int num0 = 100; /* number of tests */ +static const int num1 = 50; /* additional tests for some functions */ +static const int num2 = 5; /* number of tests for slow functions */ int test_add(BIO *bp); int test_sub(BIO *bp); diff --git a/test/ecdsatest.c b/test/ecdsatest.c index 2cf1725d6a..9754869565 100644 --- a/test/ecdsatest.c +++ b/test/ecdsatest.c @@ -107,8 +107,8 @@ int change_rand(void); int restore_rand(void); int fbytes(unsigned char *buf, int num); -RAND_METHOD fake_rand; -const RAND_METHOD *old_rand; +static RAND_METHOD fake_rand; +static const RAND_METHOD *old_rand; int change_rand(void) { diff --git a/test/gost2814789test.c b/test/gost2814789test.c index 953e1e1540..56a8ae3054 100644 --- a/test/gost2814789test.c +++ b/test/gost2814789test.c @@ -79,7 +79,7 @@ typedef struct g89_tc_ { */ } g89_tc; -const g89_tc tcs[] = { +static const g89_tc tcs[] = { /* * GOST R 34.11-94 Test cases */ diff --git a/test/ideatest.c b/test/ideatest.c index dd5d9ff12f..b522013e80 100644 --- a/test/ideatest.c +++ b/test/ideatest.c @@ -71,34 +71,34 @@ int main(int argc, char *argv[]) #else # include -unsigned char k[16] = { +static const unsigned char k[16] = { 0x00, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00, 0x04, 0x00, 0x05, 0x00, 0x06, 0x00, 0x07, 0x00, 0x08 }; -unsigned char in[8] = { 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03 }; -unsigned char c[8] = { 0x11, 0xFB, 0xED, 0x2B, 0x01, 0x98, 0x6D, 0xE5 }; +static const unsigned char in[8] = { 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x03 }; +static const unsigned char c[8] = { 0x11, 0xFB, 0xED, 0x2B, 0x01, 0x98, 0x6D, 0xE5 }; -unsigned char out[80]; +static unsigned char out[80]; -char *text = "Hello to all people out there"; +static const char text[] = "Hello to all people out there"; -static unsigned char cfb_key[16] = { +static const unsigned char cfb_key[16] = { 0xe1, 0xf0, 0xc3, 0xd2, 0xa5, 0xb4, 0x87, 0x96, 0x69, 0x78, 0x4b, 0x5a, 0x2d, 0x3c, 0x0f, 0x1e, }; -static unsigned char cfb_iv[80] = +static const unsigned char cfb_iv[80] = { 0x34, 0x12, 0x78, 0x56, 0xab, 0x90, 0xef, 0xcd }; static unsigned char cfb_buf1[40], cfb_buf2[40], cfb_tmp[8]; # define CFB_TEST_SIZE 24 -static unsigned char plain[CFB_TEST_SIZE] = { +static const unsigned char plain[CFB_TEST_SIZE] = { 0x4e, 0x6f, 0x77, 0x20, 0x69, 0x73, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x69, 0x6d, 0x65, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x61, 0x6c, 0x6c, 0x20 }; -static unsigned char cfb_cipher64[CFB_TEST_SIZE] = { +static const unsigned char cfb_cipher64[CFB_TEST_SIZE] = { 0x59, 0xD8, 0xE2, 0x65, 0x00, 0x58, 0x6C, 0x3F, 0x2C, 0x17, 0x25, 0xD0, 0x1A, 0x38, 0xB7, 0x2A, 0x39, 0x61, 0x37, 0xDC, 0x79, 0xFB, 0x9F, 0x45 @@ -107,7 +107,7 @@ static unsigned char cfb_cipher64[CFB_TEST_SIZE] = { 0x3D,0x1E,0xAE,0x47,0xFC,0xCF,0x29,0x0B,*/ }; -static int cfb64_test(unsigned char *cfb_cipher); +static int cfb64_test(const unsigned char *cfb_cipher); static char *pt(unsigned char *p); int main(int argc, char *argv[]) { @@ -175,7 +175,7 @@ int main(int argc, char *argv[]) EXIT(err); } -static int cfb64_test(unsigned char *cfb_cipher) +static int cfb64_test(const unsigned char *cfb_cipher) { IDEA_KEY_SCHEDULE eks, dks; int err = 0, i, n; diff --git a/test/sha256t.c b/test/sha256t.c index 0872f346b7..11f3684a74 100644 --- a/test/sha256t.c +++ b/test/sha256t.c @@ -10,42 +10,42 @@ #include #include -unsigned char app_b1[SHA256_DIGEST_LENGTH] = { +static const unsigned char app_b1[SHA256_DIGEST_LENGTH] = { 0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22, 0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00, 0x15, 0xad }; -unsigned char app_b2[SHA256_DIGEST_LENGTH] = { +static const unsigned char app_b2[SHA256_DIGEST_LENGTH] = { 0x24, 0x8d, 0x6a, 0x61, 0xd2, 0x06, 0x38, 0xb8, 0xe5, 0xc0, 0x26, 0x93, 0x0c, 0x3e, 0x60, 0x39, 0xa3, 0x3c, 0xe4, 0x59, 0x64, 0xff, 0x21, 0x67, 0xf6, 0xec, 0xed, 0xd4, 0x19, 0xdb, 0x06, 0xc1 }; -unsigned char app_b3[SHA256_DIGEST_LENGTH] = { +static const unsigned char app_b3[SHA256_DIGEST_LENGTH] = { 0xcd, 0xc7, 0x6e, 0x5c, 0x99, 0x14, 0xfb, 0x92, 0x81, 0xa1, 0xc7, 0xe2, 0x84, 0xd7, 0x3e, 0x67, 0xf1, 0x80, 0x9a, 0x48, 0xa4, 0x97, 0x20, 0x0e, 0x04, 0x6d, 0x39, 0xcc, 0xc7, 0x11, 0x2c, 0xd0 }; -unsigned char addenum_1[SHA224_DIGEST_LENGTH] = { +static const unsigned char addenum_1[SHA224_DIGEST_LENGTH] = { 0x23, 0x09, 0x7d, 0x22, 0x34, 0x05, 0xd8, 0x22, 0x86, 0x42, 0xa4, 0x77, 0xbd, 0xa2, 0x55, 0xb3, 0x2a, 0xad, 0xbc, 0xe4, 0xbd, 0xa0, 0xb3, 0xf7, 0xe3, 0x6c, 0x9d, 0xa7 }; -unsigned char addenum_2[SHA224_DIGEST_LENGTH] = { +static const unsigned char addenum_2[SHA224_DIGEST_LENGTH] = { 0x75, 0x38, 0x8b, 0x16, 0x51, 0x27, 0x76, 0xcc, 0x5d, 0xba, 0x5d, 0xa1, 0xfd, 0x89, 0x01, 0x50, 0xb0, 0xc6, 0x45, 0x5c, 0xb4, 0xf5, 0x8b, 0x19, 0x52, 0x52, 0x25, 0x25 }; -unsigned char addenum_3[SHA224_DIGEST_LENGTH] = { +static const unsigned char addenum_3[SHA224_DIGEST_LENGTH] = { 0x20, 0x79, 0x46, 0x55, 0x98, 0x0c, 0x91, 0xd8, 0xbb, 0xb4, 0xc1, 0xea, 0x97, 0x61, 0x8a, 0x4b, 0xf0, 0x3f, 0x42, 0x58, 0x19, 0x48, 0xb2, 0xee, diff --git a/test/sha512t.c b/test/sha512t.c index a4d4b5e80b..f60d319028 100644 --- a/test/sha512t.c +++ b/test/sha512t.c @@ -11,7 +11,7 @@ #include #include -unsigned char app_c1[SHA512_DIGEST_LENGTH] = { +static const unsigned char app_c1[SHA512_DIGEST_LENGTH] = { 0xdd, 0xaf, 0x35, 0xa1, 0x93, 0x61, 0x7a, 0xba, 0xcc, 0x41, 0x73, 0x49, 0xae, 0x20, 0x41, 0x31, 0x12, 0xe6, 0xfa, 0x4e, 0x89, 0xa9, 0x7e, 0xa2, @@ -22,7 +22,7 @@ unsigned char app_c1[SHA512_DIGEST_LENGTH] = { 0x2a, 0x9a, 0xc9, 0x4f, 0xa5, 0x4c, 0xa4, 0x9f }; -unsigned char app_c2[SHA512_DIGEST_LENGTH] = { +static const unsigned char app_c2[SHA512_DIGEST_LENGTH] = { 0x8e, 0x95, 0x9b, 0x75, 0xda, 0xe3, 0x13, 0xda, 0x8c, 0xf4, 0xf7, 0x28, 0x14, 0xfc, 0x14, 0x3f, 0x8f, 0x77, 0x79, 0xc6, 0xeb, 0x9f, 0x7f, 0xa1, @@ -33,7 +33,7 @@ unsigned char app_c2[SHA512_DIGEST_LENGTH] = { 0x5e, 0x96, 0xe5, 0x5b, 0x87, 0x4b, 0xe9, 0x09 }; -unsigned char app_c3[SHA512_DIGEST_LENGTH] = { +static const unsigned char app_c3[SHA512_DIGEST_LENGTH] = { 0xe7, 0x18, 0x48, 0x3d, 0x0c, 0xe7, 0x69, 0x64, 0x4e, 0x2e, 0x42, 0xc7, 0xbc, 0x15, 0xb4, 0x63, 0x8e, 0x1f, 0x98, 0xb1, 0x3b, 0x20, 0x44, 0x28, @@ -44,7 +44,7 @@ unsigned char app_c3[SHA512_DIGEST_LENGTH] = { 0x4e, 0xad, 0xb2, 0x17, 0xad, 0x8c, 0xc0, 0x9b }; -unsigned char app_d1[SHA384_DIGEST_LENGTH] = { +static const unsigned char app_d1[SHA384_DIGEST_LENGTH] = { 0xcb, 0x00, 0x75, 0x3f, 0x45, 0xa3, 0x5e, 0x8b, 0xb5, 0xa0, 0x3d, 0x69, 0x9a, 0xc6, 0x50, 0x07, 0x27, 0x2c, 0x32, 0xab, 0x0e, 0xde, 0xd1, 0x63, @@ -53,7 +53,7 @@ unsigned char app_d1[SHA384_DIGEST_LENGTH] = { 0x58, 0xba, 0xec, 0xa1, 0x34, 0xc8, 0x25, 0xa7 }; -unsigned char app_d2[SHA384_DIGEST_LENGTH] = { +static const unsigned char app_d2[SHA384_DIGEST_LENGTH] = { 0x09, 0x33, 0x0c, 0x33, 0xf7, 0x11, 0x47, 0xe8, 0x3d, 0x19, 0x2f, 0xc7, 0x82, 0xcd, 0x1b, 0x47, 0x53, 0x11, 0x1b, 0x17, 0x3b, 0x3b, 0x05, 0xd2, @@ -62,7 +62,7 @@ unsigned char app_d2[SHA384_DIGEST_LENGTH] = { 0x66, 0xc3, 0xe9, 0xfa, 0x91, 0x74, 0x60, 0x39 }; -unsigned char app_d3[SHA384_DIGEST_LENGTH] = { +static const unsigned char app_d3[SHA384_DIGEST_LENGTH] = { 0x9d, 0x0e, 0x18, 0x09, 0x71, 0x64, 0x74, 0xcb, 0x08, 0x6e, 0x83, 0x4e, 0x31, 0x0a, 0x4a, 0x1c, 0xed, 0x14, 0x9e, 0x9c, 0x00, 0xf2, 0x48, 0x52, diff --git a/test/ssltest.c b/test/ssltest.c index 4959aed3ab..e951788d3a 100644 --- a/test/ssltest.c +++ b/test/ssltest.c @@ -288,9 +288,9 @@ static BIO *bio_stdout = NULL; #ifndef OPENSSL_NO_NEXTPROTONEG /* Note that this code assumes that this is only a one element list: */ static const char NEXT_PROTO_STRING[] = "\x09testproto"; -int npn_client = 0; -int npn_server = 0; -int npn_server_reject = 0; +static int npn_client = 0; +static int npn_server = 0; +static int npn_server_reject = 0; static int cb_client_npn(SSL *s, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, @@ -500,24 +500,24 @@ static int verify_alpn(SSL *client, SSL *server) #define CUSTOM_EXT_TYPE_2 1002 #define CUSTOM_EXT_TYPE_3 1003 -const char custom_ext_cli_string[] = "abc"; -const char custom_ext_srv_string[] = "defg"; +static const char custom_ext_cli_string[] = "abc"; +static const char custom_ext_srv_string[] = "defg"; /* These set from cmdline */ -char *serverinfo_file = NULL; -int serverinfo_sct = 0; -int serverinfo_tack = 0; +static char *serverinfo_file = NULL; +static int serverinfo_sct = 0; +static int serverinfo_tack = 0; /* These set based on extension callbacks */ -int serverinfo_sct_seen = 0; -int serverinfo_tack_seen = 0; -int serverinfo_other_seen = 0; +static int serverinfo_sct_seen = 0; +static int serverinfo_tack_seen = 0; +static int serverinfo_other_seen = 0; /* This set from cmdline */ -int custom_ext = 0; +static int custom_ext = 0; /* This set based on extension callbacks */ -int custom_ext_error = 0; +static int custom_ext_error = 0; static int serverinfo_cli_parse_cb(SSL *s, unsigned int ext_type, const unsigned char *in, size_t inlen, diff --git a/test/wp_test.c b/test/wp_test.c index 2ea6251a58..de7aa3dcda 100644 --- a/test/wp_test.c +++ b/test/wp_test.c @@ -18,7 +18,7 @@ int main(int argc, char *argv[]) #else /* ISO/IEC 10118-3 test vector set */ -unsigned char iso_test_1[WHIRLPOOL_DIGEST_LENGTH] = { +static const unsigned char iso_test_1[WHIRLPOOL_DIGEST_LENGTH] = { 0x19, 0xFA, 0x61, 0xD7, 0x55, 0x22, 0xA4, 0x66, 0x9B, 0x44, 0xE3, 0x9C, 0x1D, 0x2E, 0x17, 0x26, 0xC5, 0x30, 0x23, 0x21, 0x30, 0xD4, 0x07, 0xF8, @@ -29,7 +29,7 @@ unsigned char iso_test_1[WHIRLPOOL_DIGEST_LENGTH] = { 0x08, 0xB1, 0x38, 0xCC, 0x42, 0xA6, 0x6E, 0xB3 }; -unsigned char iso_test_2[WHIRLPOOL_DIGEST_LENGTH] = { +static const unsigned char iso_test_2[WHIRLPOOL_DIGEST_LENGTH] = { 0x8A, 0xCA, 0x26, 0x02, 0x79, 0x2A, 0xEC, 0x6F, 0x11, 0xA6, 0x72, 0x06, 0x53, 0x1F, 0xB7, 0xD7, 0xF0, 0xDF, 0xF5, 0x94, 0x13, 0x14, 0x5E, 0x69, @@ -40,7 +40,7 @@ unsigned char iso_test_2[WHIRLPOOL_DIGEST_LENGTH] = { 0x3B, 0x47, 0x85, 0x84, 0xFD, 0xAE, 0x23, 0x1A }; -unsigned char iso_test_3[WHIRLPOOL_DIGEST_LENGTH] = { +static const unsigned char iso_test_3[WHIRLPOOL_DIGEST_LENGTH] = { 0x4E, 0x24, 0x48, 0xA4, 0xC6, 0xF4, 0x86, 0xBB, 0x16, 0xB6, 0x56, 0x2C, 0x73, 0xB4, 0x02, 0x0B, 0xF3, 0x04, 0x3E, 0x3A, 0x73, 0x1B, 0xCE, 0x72, @@ -51,7 +51,7 @@ unsigned char iso_test_3[WHIRLPOOL_DIGEST_LENGTH] = { 0xD2, 0x25, 0x29, 0x20, 0x76, 0xD4, 0xEE, 0xF5 }; -unsigned char iso_test_4[WHIRLPOOL_DIGEST_LENGTH] = { +static const unsigned char iso_test_4[WHIRLPOOL_DIGEST_LENGTH] = { 0x37, 0x8C, 0x84, 0xA4, 0x12, 0x6E, 0x2D, 0xC6, 0xE5, 0x6D, 0xCC, 0x74, 0x58, 0x37, 0x7A, 0xAC, 0x83, 0x8D, 0x00, 0x03, 0x22, 0x30, 0xF5, 0x3C, @@ -62,7 +62,7 @@ unsigned char iso_test_4[WHIRLPOOL_DIGEST_LENGTH] = { 0x62, 0xE8, 0x6D, 0xBD, 0x37, 0xA8, 0x90, 0x3E }; -unsigned char iso_test_5[WHIRLPOOL_DIGEST_LENGTH] = { +static const unsigned char iso_test_5[WHIRLPOOL_DIGEST_LENGTH] = { 0xF1, 0xD7, 0x54, 0x66, 0x26, 0x36, 0xFF, 0xE9, 0x2C, 0x82, 0xEB, 0xB9, 0x21, 0x2A, 0x48, 0x4A, 0x8D, 0x38, 0x63, 0x1E, 0xAD, 0x42, 0x38, 0xF5, @@ -73,7 +73,7 @@ unsigned char iso_test_5[WHIRLPOOL_DIGEST_LENGTH] = { 0x5D, 0x98, 0x19, 0xA3, 0xDB, 0xA4, 0xEB, 0x3B }; -unsigned char iso_test_6[WHIRLPOOL_DIGEST_LENGTH] = { +static const unsigned char iso_test_6[WHIRLPOOL_DIGEST_LENGTH] = { 0xDC, 0x37, 0xE0, 0x08, 0xCF, 0x9E, 0xE6, 0x9B, 0xF1, 0x1F, 0x00, 0xED, 0x9A, 0xBA, 0x26, 0x90, 0x1D, 0xD7, 0xC2, 0x8C, 0xDE, 0xC0, 0x66, 0xCC, @@ -84,7 +84,7 @@ unsigned char iso_test_6[WHIRLPOOL_DIGEST_LENGTH] = { 0x42, 0xC6, 0x5F, 0x5A, 0x7A, 0xF0, 0x14, 0x67 }; -unsigned char iso_test_7[WHIRLPOOL_DIGEST_LENGTH] = { +static const unsigned char iso_test_7[WHIRLPOOL_DIGEST_LENGTH] = { 0x46, 0x6E, 0xF1, 0x8B, 0xAB, 0xB0, 0x15, 0x4D, 0x25, 0xB9, 0xD3, 0x8A, 0x64, 0x14, 0xF5, 0xC0, 0x87, 0x84, 0x37, 0x2B, 0xCC, 0xB2, 0x04, 0xD6, @@ -95,7 +95,7 @@ unsigned char iso_test_7[WHIRLPOOL_DIGEST_LENGTH] = { 0x2C, 0x2A, 0x80, 0xCF, 0x3A, 0x9A, 0x08, 0x3B }; -unsigned char iso_test_8[WHIRLPOOL_DIGEST_LENGTH] = { +static const unsigned char iso_test_8[WHIRLPOOL_DIGEST_LENGTH] = { 0x2A, 0x98, 0x7E, 0xA4, 0x0F, 0x91, 0x70, 0x61, 0xF5, 0xD6, 0xF0, 0xA0, 0xE4, 0x64, 0x4F, 0x48, 0x8A, 0x7A, 0x5A, 0x52, 0xDE, 0xEE, 0x65, 0x62, @@ -106,7 +106,7 @@ unsigned char iso_test_8[WHIRLPOOL_DIGEST_LENGTH] = { 0x74, 0x5B, 0x7B, 0x18, 0x1C, 0x3B, 0xE3, 0xFD }; -unsigned char iso_test_9[WHIRLPOOL_DIGEST_LENGTH] = { +static const unsigned char iso_test_9[WHIRLPOOL_DIGEST_LENGTH] = { 0x0C, 0x99, 0x00, 0x5B, 0xEB, 0x57, 0xEF, 0xF5, 0x0A, 0x7C, 0xF0, 0x05, 0x56, 0x0D, 0xDF, 0x5D, 0x29, 0x05, 0x7F, 0xD8, 0x6B, 0x20, 0xBF, 0xD6, -- cgit v1.2.3