fix "declaration-after-statement" warnings (tests only)
This commit is contained in:
parent
fd1e351316
commit
b465881b58
@ -11,6 +11,7 @@ int pkcs_1_eme_test(void)
|
|||||||
int prng_idx = register_prng(&no_prng_desc);
|
int prng_idx = register_prng(&no_prng_desc);
|
||||||
int hash_idx = find_hash("sha1");
|
int hash_idx = find_hash("sha1");
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
unsigned int j;
|
||||||
|
|
||||||
DO(prng_is_valid(prng_idx));
|
DO(prng_is_valid(prng_idx));
|
||||||
DO(hash_is_valid(hash_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);
|
DOX(mp_read_unsigned_bin(key->p, t->rsa.p, t->rsa.p_l), t->name);
|
||||||
key->type = PK_PRIVATE;
|
key->type = PK_PRIVATE;
|
||||||
|
|
||||||
unsigned int j;
|
|
||||||
for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
|
for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
|
||||||
rsaData_t* s = &t->data[j];
|
rsaData_t* s = &t->data[j];
|
||||||
unsigned char buf[256], obuf[256];
|
unsigned char buf[256], obuf[256];
|
||||||
|
@ -10,6 +10,7 @@ int pkcs_1_emsa_test(void)
|
|||||||
{
|
{
|
||||||
int hash_idx = find_hash("sha1");
|
int hash_idx = find_hash("sha1");
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
unsigned int j;
|
||||||
|
|
||||||
DO(hash_is_valid(hash_idx));
|
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);
|
DOX(mp_read_unsigned_bin(key->p, t->rsa.p, t->rsa.p_l), t->name);
|
||||||
key->type = PK_PRIVATE;
|
key->type = PK_PRIVATE;
|
||||||
|
|
||||||
unsigned int j;
|
|
||||||
for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
|
for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
|
||||||
rsaData_t* s = &t->data[j];
|
rsaData_t* s = &t->data[j];
|
||||||
unsigned char buf[20], obuf[256];
|
unsigned char buf[20], obuf[256];
|
||||||
|
@ -11,6 +11,7 @@ int pkcs_1_oaep_test(void)
|
|||||||
int prng_idx = register_prng(&no_prng_desc);
|
int prng_idx = register_prng(&no_prng_desc);
|
||||||
int hash_idx = find_hash("sha1");
|
int hash_idx = find_hash("sha1");
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
unsigned int j;
|
||||||
|
|
||||||
DO(prng_is_valid(prng_idx));
|
DO(prng_is_valid(prng_idx));
|
||||||
DO(hash_is_valid(hash_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);
|
DOX(mp_read_unsigned_bin(key->p, t->rsa.p, t->rsa.p_l), t->name);
|
||||||
key->type = PK_PRIVATE;
|
key->type = PK_PRIVATE;
|
||||||
|
|
||||||
unsigned int j;
|
|
||||||
for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
|
for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
|
||||||
rsaData_t* s = &t->data[j];
|
rsaData_t* s = &t->data[j];
|
||||||
unsigned char buf[256], obuf[256];
|
unsigned char buf[256], obuf[256];
|
||||||
|
@ -11,6 +11,7 @@ int pkcs_1_pss_test(void)
|
|||||||
int prng_idx = register_prng(&no_prng_desc);
|
int prng_idx = register_prng(&no_prng_desc);
|
||||||
int hash_idx = find_hash("sha1");
|
int hash_idx = find_hash("sha1");
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
unsigned int j;
|
||||||
|
|
||||||
DO(prng_is_valid(prng_idx));
|
DO(prng_is_valid(prng_idx));
|
||||||
DO(hash_is_valid(hash_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);
|
DOX(mp_read_unsigned_bin(key->p, t->rsa.p, t->rsa.p_l), t->name);
|
||||||
key->type = PK_PRIVATE;
|
key->type = PK_PRIVATE;
|
||||||
|
|
||||||
unsigned int j;
|
|
||||||
for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
|
for (j = 0; j < sizeof(t->data)/sizeof(t->data[0]); ++j) {
|
||||||
rsaData_t* s = &t->data[j];
|
rsaData_t* s = &t->data[j];
|
||||||
unsigned char buf[20], obuf[256];
|
unsigned char buf[20], obuf[256];
|
||||||
|
@ -200,6 +200,10 @@ int rsa_test(void)
|
|||||||
int hash_idx, prng_idx, stat, stat2, i, err;
|
int hash_idx, prng_idx, stat, stat2, i, err;
|
||||||
unsigned long rsa_msgsize, len, len2, len3, cnt, cnt2;
|
unsigned long rsa_msgsize, len, len2, len3, cnt, cnt2;
|
||||||
static unsigned char lparam[] = { 0x01, 0x02, 0x03, 0x04 };
|
static unsigned char lparam[] = { 0x01, 0x02, 0x03, 0x04 };
|
||||||
|
void* dP;
|
||||||
|
unsigned char* p;
|
||||||
|
unsigned char* p2;
|
||||||
|
unsigned char* p3;
|
||||||
|
|
||||||
if (rsa_compat_test() != 0) {
|
if (rsa_compat_test() != 0) {
|
||||||
return 1;
|
return 1;
|
||||||
@ -388,7 +392,7 @@ for (cnt = 0; cnt < len; ) {
|
|||||||
|
|
||||||
/* verify with privKey but remove pointer to dP to test without CRT */
|
/* verify with privKey but remove pointer to dP to test without CRT */
|
||||||
|
|
||||||
void* dP = privKey.dP;
|
dP = privKey.dP;
|
||||||
privKey.dP = NULL;
|
privKey.dP = NULL;
|
||||||
/* change byte back to original */
|
/* change byte back to original */
|
||||||
in[0] ^= 1;
|
in[0] ^= 1;
|
||||||
@ -470,9 +474,9 @@ for (cnt = 0; cnt < len; ) {
|
|||||||
* For all PS lengths: the result should not be valid
|
* For all PS lengths: the result should not be valid
|
||||||
*/
|
*/
|
||||||
|
|
||||||
unsigned char* p = in;
|
p = in;
|
||||||
unsigned char* p2 = out;
|
p2 = out;
|
||||||
unsigned char* p3 = tmp;
|
p3 = tmp;
|
||||||
for (i = 0; i < 9; ++i) {
|
for (i = 0; i < 9; ++i) {
|
||||||
len = sizeof(in);
|
len = sizeof(in);
|
||||||
len2 = sizeof(out);
|
len2 = sizeof(out);
|
||||||
|
@ -526,16 +526,16 @@ int time_keysched(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef LTC_ECB_MODE
|
||||||
int time_cipher(void)
|
int time_cipher(void)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\n\nECB Time Trials for the Symmetric Ciphers:\n");
|
|
||||||
#ifdef LTC_ECB_MODE
|
|
||||||
unsigned long x, y1;
|
unsigned long x, y1;
|
||||||
ulong64 t1, t2, c1, c2, a1, a2;
|
ulong64 t1, t2, c1, c2, a1, a2;
|
||||||
symmetric_ECB ecb;
|
symmetric_ECB ecb;
|
||||||
unsigned char key[MAXBLOCKSIZE], pt[4096];
|
unsigned char key[MAXBLOCKSIZE], pt[4096];
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
|
fprintf(stderr, "\n\nECB Time Trials for the Symmetric Ciphers:\n");
|
||||||
no_results = 0;
|
no_results = 0;
|
||||||
for (x = 0; cipher_descriptor[x].name != NULL; x++) {
|
for (x = 0; cipher_descriptor[x].name != NULL; x++) {
|
||||||
ecb_start(x, key, cipher_descriptor[x].min_key_length, 0, &ecb);
|
ecb_start(x, key, cipher_descriptor[x].min_key_length, 0, &ecb);
|
||||||
@ -594,12 +594,12 @@ int time_cipher(void)
|
|||||||
#undef DO1
|
#undef DO1
|
||||||
}
|
}
|
||||||
tally_results(1);
|
tally_results(1);
|
||||||
#else
|
|
||||||
fprintf(stderr, "NOP");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
int time_cipher(void) { fprintf(stderr, "NO ECB\n"); return 0; }
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef LTC_CBC_MODE
|
#ifdef LTC_CBC_MODE
|
||||||
int time_cipher2(void)
|
int time_cipher2(void)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user