fix "declaration-after-statement" warnings (tests only)

This commit is contained in:
Karel Miko 2017-03-24 10:17:02 +01:00
parent fd1e351316
commit b465881b58
6 changed files with 17 additions and 13 deletions

View File

@ -11,6 +11,7 @@ int pkcs_1_eme_test(void)
int prng_idx = register_prng(&no_prng_desc);
int hash_idx = find_hash("sha1");
unsigned int i;
unsigned int j;
DO(prng_is_valid(prng_idx));
DO(hash_is_valid(hash_idx));
@ -31,7 +32,6 @@ int pkcs_1_eme_test(void)
DOX(mp_read_unsigned_bin(key->p, t->rsa.p, t->rsa.p_l), t->name);
key->type = PK_PRIVATE;
unsigned int j;
for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
rsaData_t* s = &t->data[j];
unsigned char buf[256], obuf[256];

View File

@ -10,6 +10,7 @@ int pkcs_1_emsa_test(void)
{
int hash_idx = find_hash("sha1");
unsigned int i;
unsigned int j;
DO(hash_is_valid(hash_idx));
@ -29,7 +30,6 @@ int pkcs_1_emsa_test(void)
DOX(mp_read_unsigned_bin(key->p, t->rsa.p, t->rsa.p_l), t->name);
key->type = PK_PRIVATE;
unsigned int j;
for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
rsaData_t* s = &t->data[j];
unsigned char buf[20], obuf[256];

View File

@ -11,6 +11,7 @@ int pkcs_1_oaep_test(void)
int prng_idx = register_prng(&no_prng_desc);
int hash_idx = find_hash("sha1");
unsigned int i;
unsigned int j;
DO(prng_is_valid(prng_idx));
DO(hash_is_valid(hash_idx));
@ -31,7 +32,6 @@ int pkcs_1_oaep_test(void)
DOX(mp_read_unsigned_bin(key->p, t->rsa.p, t->rsa.p_l), t->name);
key->type = PK_PRIVATE;
unsigned int j;
for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
rsaData_t* s = &t->data[j];
unsigned char buf[256], obuf[256];

View File

@ -11,6 +11,7 @@ int pkcs_1_pss_test(void)
int prng_idx = register_prng(&no_prng_desc);
int hash_idx = find_hash("sha1");
unsigned int i;
unsigned int j;
DO(prng_is_valid(prng_idx));
DO(hash_is_valid(hash_idx));
@ -31,7 +32,6 @@ int pkcs_1_pss_test(void)
DOX(mp_read_unsigned_bin(key->p, t->rsa.p, t->rsa.p_l), t->name);
key->type = PK_PRIVATE;
unsigned int j;
for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
rsaData_t* s = &t->data[j];
unsigned char buf[20], obuf[256];

View File

@ -200,6 +200,10 @@ int rsa_test(void)
int hash_idx, prng_idx, stat, stat2, i, err;
unsigned long rsa_msgsize, len, len2, len3, cnt, cnt2;
static unsigned char lparam[] = { 0x01, 0x02, 0x03, 0x04 };
void* dP;
unsigned char* p;
unsigned char* p2;
unsigned char* p3;
if (rsa_compat_test() != 0) {
return 1;
@ -388,7 +392,7 @@ for (cnt = 0; cnt < len; ) {
/* verify with privKey but remove pointer to dP to test without CRT */
void* dP = privKey.dP;
dP = privKey.dP;
privKey.dP = NULL;
/* change byte back to original */
in[0] ^= 1;
@ -470,9 +474,9 @@ for (cnt = 0; cnt < len; ) {
* For all PS lengths: the result should not be valid
*/
unsigned char* p = in;
unsigned char* p2 = out;
unsigned char* p3 = tmp;
p = in;
p2 = out;
p3 = tmp;
for (i = 0; i < 9; ++i) {
len = sizeof(in);
len2 = sizeof(out);

View File

@ -526,16 +526,16 @@ int time_keysched(void)
return 0;
}
#ifdef LTC_ECB_MODE
int time_cipher(void)
{
fprintf(stderr, "\n\nECB Time Trials for the Symmetric Ciphers:\n");
#ifdef LTC_ECB_MODE
unsigned long x, y1;
ulong64 t1, t2, c1, c2, a1, a2;
symmetric_ECB ecb;
unsigned char key[MAXBLOCKSIZE], pt[4096];
int err;
fprintf(stderr, "\n\nECB Time Trials for the Symmetric Ciphers:\n");
no_results = 0;
for (x = 0; cipher_descriptor[x].name != NULL; x++) {
ecb_start(x, key, cipher_descriptor[x].min_key_length, 0, &ecb);
@ -594,12 +594,12 @@ int time_cipher(void)
#undef DO1
}
tally_results(1);
#else
fprintf(stderr, "NOP");
#endif
return 0;
}
#else
int time_cipher(void) { fprintf(stderr, "NO ECB\n"); return 0; }
#endif
#ifdef LTC_CBC_MODE
int time_cipher2(void)