fix warnings in tests
This commit is contained in:
parent
c211ce7f66
commit
4929e4e989
@ -555,7 +555,7 @@ void ocb3_gen(void)
|
|||||||
plaintext[z] = (unsigned char)(z & 255);
|
plaintext[z] = (unsigned char)(z & 255);
|
||||||
}
|
}
|
||||||
len = sizeof(tag);
|
len = sizeof(tag);
|
||||||
if ((err = ocb3_encrypt_authenticate_memory(x, key, kl, nonce, cipher_descriptor[x].block_length, "AAD", 3, plaintext, y1, plaintext, tag, &len)) != CRYPT_OK) {
|
if ((err = ocb3_encrypt_authenticate_memory(x, key, kl, nonce, cipher_descriptor[x].block_length, (unsigned char*)"AAD", 3, plaintext, y1, plaintext, tag, &len)) != CRYPT_OK) {
|
||||||
printf("Error OCB'ing: %s\n", error_to_string(err));
|
printf("Error OCB'ing: %s\n", error_to_string(err));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ int base64_test(void)
|
|||||||
for (x = 0; x < sizeof(cases)/sizeof(cases[0]); ++x) {
|
for (x = 0; x < sizeof(cases)/sizeof(cases[0]); ++x) {
|
||||||
slen1 = strlen(cases[x].s);
|
slen1 = strlen(cases[x].s);
|
||||||
l1 = sizeof(out);
|
l1 = sizeof(out);
|
||||||
DO(base64_encode(cases[x].s, slen1, out, &l1));
|
DO(base64_encode((unsigned char*)cases[x].s, slen1, out, &l1));
|
||||||
l2 = sizeof(tmp);
|
l2 = sizeof(tmp);
|
||||||
DO(base64_decode(out, l1, tmp, &l2));
|
DO(base64_decode(out, l1, tmp, &l2));
|
||||||
if (l2 != slen1 || l1 != strlen(cases[x].b64) || memcmp(tmp, cases[x].s, l2) || memcmp(out, cases[x].b64, l1)) {
|
if (l2 != slen1 || l1 != strlen(cases[x].b64) || memcmp(tmp, cases[x].s, l2) || memcmp(out, cases[x].b64, l1)) {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#ifdef LTC_MECC
|
#ifdef LTC_MECC
|
||||||
|
|
||||||
static int sizes[] = {
|
static unsigned int sizes[] = {
|
||||||
#ifdef ECC112
|
#ifdef ECC112
|
||||||
14,
|
14,
|
||||||
#endif
|
#endif
|
||||||
@ -47,7 +47,7 @@ int ecc_test_shamir(void)
|
|||||||
for (x = 0; x < (int)(sizeof(sizes)/sizeof(sizes[0])); x++) {
|
for (x = 0; x < (int)(sizeof(sizes)/sizeof(sizes[0])); x++) {
|
||||||
/* get the base point */
|
/* get the base point */
|
||||||
for (z = 0; ltc_ecc_sets[z].name; z++) {
|
for (z = 0; ltc_ecc_sets[z].name; z++) {
|
||||||
if (sizes[z] < ltc_ecc_sets[z].size) break;
|
if (sizes[z] < (unsigned int)ltc_ecc_sets[z].size) break;
|
||||||
}
|
}
|
||||||
LTC_ARGCHK(ltc_ecc_sets[z].name != NULL);
|
LTC_ARGCHK(ltc_ecc_sets[z].name != NULL);
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ int ecc_test_shamir(void)
|
|||||||
|
|
||||||
/* compute rA * G = A */
|
/* compute rA * G = A */
|
||||||
DO(ltc_mp.ecc_ptmul(rA, G, A, modulus, 1));
|
DO(ltc_mp.ecc_ptmul(rA, G, A, modulus, 1));
|
||||||
|
|
||||||
/* compute rB * G = B */
|
/* compute rB * G = B */
|
||||||
DO(ltc_mp.ecc_ptmul(rB, G, B, modulus, 1));
|
DO(ltc_mp.ecc_ptmul(rB, G, B, modulus, 1));
|
||||||
|
|
||||||
@ -111,7 +111,7 @@ int ecc_tests (void)
|
|||||||
unsigned long x, y, z, s;
|
unsigned long x, y, z, s;
|
||||||
int stat, stat2;
|
int stat, stat2;
|
||||||
ecc_key usera, userb, pubKey, privKey;
|
ecc_key usera, userb, pubKey, privKey;
|
||||||
|
|
||||||
DO(ecc_test ());
|
DO(ecc_test ());
|
||||||
DO(ecc_test ());
|
DO(ecc_test ());
|
||||||
DO(ecc_test ());
|
DO(ecc_test ());
|
||||||
@ -222,11 +222,11 @@ int ecc_tests (void)
|
|||||||
DO(ecc_verify_hash (buf[1], x, buf[0], 16, &stat, &pubKey));
|
DO(ecc_verify_hash (buf[1], x, buf[0], 16, &stat, &pubKey));
|
||||||
buf[0][0] ^= 1;
|
buf[0][0] ^= 1;
|
||||||
DO(ecc_verify_hash (buf[1], x, buf[0], 16, &stat2, &privKey));
|
DO(ecc_verify_hash (buf[1], x, buf[0], 16, &stat2, &privKey));
|
||||||
if (!(stat == 1 && stat2 == 0)) {
|
if (!(stat == 1 && stat2 == 0)) {
|
||||||
fprintf(stderr, "ecc_verify_hash failed %d, %d, ", stat, stat2);
|
fprintf(stderr, "ecc_verify_hash failed %d, %d, ", stat, stat2);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
ecc_free (&usera);
|
ecc_free (&usera);
|
||||||
ecc_free (&pubKey);
|
ecc_free (&pubKey);
|
||||||
ecc_free (&privKey);
|
ecc_free (&privKey);
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
int pkcs_1_test(void)
|
int pkcs_1_test(void)
|
||||||
{
|
{
|
||||||
unsigned char buf[3][128];
|
unsigned char buf[3][128];
|
||||||
int res1, res2, res3, prng_idx, hash_idx, err;
|
int res1, res2, res3, prng_idx, hash_idx;
|
||||||
unsigned long x, y, l1, l2, l3, i1, i2, lparamlen, saltlen, modlen;
|
unsigned long x, y, l1, l2, l3, i1, i2, lparamlen, saltlen, modlen;
|
||||||
static const unsigned char lparam[] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 };
|
static const unsigned char lparam[] = { 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16 };
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ int ecc_tests(void);
|
|||||||
int dsa_test(void);
|
int dsa_test(void);
|
||||||
int der_tests(void);
|
int der_tests(void);
|
||||||
int misc_test(void);
|
int misc_test(void);
|
||||||
|
int base64_test(void);
|
||||||
|
|
||||||
/* timing */
|
/* timing */
|
||||||
#define KTIMES 25
|
#define KTIMES 25
|
||||||
@ -85,6 +86,7 @@ int time_keysched(void);
|
|||||||
int time_cipher(void);
|
int time_cipher(void);
|
||||||
int time_cipher2(void);
|
int time_cipher2(void);
|
||||||
int time_cipher3(void);
|
int time_cipher3(void);
|
||||||
|
int time_cipher4(void);
|
||||||
int time_hash(void);
|
int time_hash(void);
|
||||||
void time_mult(void);
|
void time_mult(void);
|
||||||
void time_sqr(void);
|
void time_sqr(void);
|
||||||
|
@ -25,7 +25,7 @@ void tally_results(int type)
|
|||||||
if (type == 0) {
|
if (type == 0) {
|
||||||
for (x = 0; x < no_results; x++) {
|
for (x = 0; x < no_results; x++) {
|
||||||
fprintf(stderr, "%-20s: Schedule at %6lu\n", cipher_descriptor[results[x].id].name, (unsigned long)results[x].spd1);
|
fprintf(stderr, "%-20s: Schedule at %6lu\n", cipher_descriptor[results[x].id].name, (unsigned long)results[x].spd1);
|
||||||
}
|
}
|
||||||
} else if (type == 1) {
|
} else if (type == 1) {
|
||||||
for (x = 0; x < no_results; x++) {
|
for (x = 0; x < no_results; x++) {
|
||||||
printf
|
printf
|
||||||
@ -48,9 +48,12 @@ ulong64 rdtsc (void)
|
|||||||
asm ( " rdtsc ":"=A"(a));
|
asm ( " rdtsc ":"=A"(a));
|
||||||
return a;
|
return a;
|
||||||
#elif defined(__i386__) || defined(__x86_64__)
|
#elif defined(__i386__) || defined(__x86_64__)
|
||||||
ulong64 a;
|
/* version from http://www.mcs.anl.gov/~kazutomo/rdtsc.html
|
||||||
asm __volatile__ ("rdtsc\nmovl %%eax,(%0)\nmovl %%edx,4(%0)\n"::"r"(&a):"%eax","%edx");
|
* the old code always got a warning issued by gcc, clang did not complain...
|
||||||
return a;
|
*/
|
||||||
|
unsigned hi, lo;
|
||||||
|
__asm__ __volatile__ ("rdtsc" : "=a"(lo), "=d"(hi));
|
||||||
|
return ((ulong64)lo)|( ((ulong64)hi)<<32);
|
||||||
#elif defined(LTC_PPC32) || defined(TFM_PPC32)
|
#elif defined(LTC_PPC32) || defined(TFM_PPC32)
|
||||||
unsigned long a, b;
|
unsigned long a, b;
|
||||||
__asm__ __volatile__ ("mftbu %1 \nmftb %0\n":"=r"(a), "=r"(b));
|
__asm__ __volatile__ ("mftbu %1 \nmftb %0\n":"=r"(a), "=r"(b));
|
||||||
@ -69,9 +72,9 @@ ulong64 rdtsc (void)
|
|||||||
#else
|
#else
|
||||||
register unsigned long x, y;
|
register unsigned long x, y;
|
||||||
__asm__ __volatile__ ("rd %%tick, %0; clruw %0, %1; srlx %0, 32, %0" : "=r" (x), "=r" (y) : "0" (x), "1" (y));
|
__asm__ __volatile__ ("rd %%tick, %0; clruw %0, %1; srlx %0, 32, %0" : "=r" (x), "=r" (y) : "0" (x), "1" (y));
|
||||||
return ((unsigned long long) x << 32) | y;
|
return ((unsigned long long) x << 32) | y;
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
return XCLOCK();
|
return XCLOCK();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -104,14 +107,13 @@ ulong64 t_read(void)
|
|||||||
|
|
||||||
void init_timer(void)
|
void init_timer(void)
|
||||||
{
|
{
|
||||||
ulong64 c1, c2, t1, t2, t3;
|
ulong64 c1, c2, t1, t2;
|
||||||
unsigned long y1;
|
unsigned long y1;
|
||||||
|
|
||||||
c1 = c2 = (ulong64)-1;
|
c1 = c2 = (ulong64)-1;
|
||||||
for (y1 = 0; y1 < TIMES*100; y1++) {
|
for (y1 = 0; y1 < TIMES*100; y1++) {
|
||||||
t_start();
|
t_start();
|
||||||
t1 = t_read();
|
t1 = t_read();
|
||||||
t3 = t_read();
|
|
||||||
t2 = (t_read() - t1)>>1;
|
t2 = (t_read() - t1)>>1;
|
||||||
|
|
||||||
c1 = (t1 > c1) ? t1 : c1;
|
c1 = (t1 > c1) ? t1 : c1;
|
||||||
@ -237,7 +239,7 @@ void reg_algs(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef LTC_YARROW
|
#ifndef LTC_YARROW
|
||||||
#error This demo requires Yarrow.
|
#error This demo requires Yarrow.
|
||||||
#endif
|
#endif
|
||||||
register_prng(&yarrow_desc);
|
register_prng(&yarrow_desc);
|
||||||
@ -255,7 +257,7 @@ register_prng(&sober128_desc);
|
|||||||
fprintf(stderr, "rng_make_prng failed: %s\n", error_to_string(err));
|
fprintf(stderr, "rng_make_prng failed: %s\n", error_to_string(err));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int time_keysched(void)
|
int time_keysched(void)
|
||||||
@ -268,7 +270,7 @@ int time_keysched(void)
|
|||||||
unsigned char key[MAXBLOCKSIZE];
|
unsigned char key[MAXBLOCKSIZE];
|
||||||
|
|
||||||
fprintf(stderr, "\n\nKey Schedule Time Trials for the Symmetric Ciphers:\n(Times are cycles per key)\n");
|
fprintf(stderr, "\n\nKey Schedule Time Trials for the Symmetric Ciphers:\n(Times are cycles per key)\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++) {
|
||||||
#define DO1(k) func(k, kl, 0, &skey);
|
#define DO1(k) func(k, kl, 0, &skey);
|
||||||
|
|
||||||
@ -349,14 +351,14 @@ int time_cipher(void)
|
|||||||
}
|
}
|
||||||
a2 = c2 - c1 - skew;
|
a2 = c2 - c1 - skew;
|
||||||
ecb_done(&ecb);
|
ecb_done(&ecb);
|
||||||
|
|
||||||
results[no_results].id = x;
|
results[no_results].id = x;
|
||||||
results[no_results].spd1 = a1/(sizeof(pt)/cipher_descriptor[x].block_length);
|
results[no_results].spd1 = a1/(sizeof(pt)/cipher_descriptor[x].block_length);
|
||||||
results[no_results].spd2 = a2/(sizeof(pt)/cipher_descriptor[x].block_length);
|
results[no_results].spd2 = a2/(sizeof(pt)/cipher_descriptor[x].block_length);
|
||||||
results[no_results].avg = (results[no_results].spd1 + results[no_results].spd2+1)/2;
|
results[no_results].avg = (results[no_results].spd1 + results[no_results].spd2+1)/2;
|
||||||
++no_results;
|
++no_results;
|
||||||
fprintf(stderr, "."); fflush(stdout);
|
fprintf(stderr, "."); fflush(stdout);
|
||||||
|
|
||||||
#undef DO2
|
#undef DO2
|
||||||
#undef DO1
|
#undef DO1
|
||||||
}
|
}
|
||||||
@ -365,7 +367,7 @@ int time_cipher(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef LTC_CBC_MODE
|
#ifdef LTC_CBC_MODE
|
||||||
int time_cipher2(void)
|
int time_cipher2(void)
|
||||||
{
|
{
|
||||||
unsigned long x, y1;
|
unsigned long x, y1;
|
||||||
@ -421,14 +423,14 @@ int time_cipher2(void)
|
|||||||
}
|
}
|
||||||
a2 = c2 - c1 - skew;
|
a2 = c2 - c1 - skew;
|
||||||
cbc_done(&cbc);
|
cbc_done(&cbc);
|
||||||
|
|
||||||
results[no_results].id = x;
|
results[no_results].id = x;
|
||||||
results[no_results].spd1 = a1/(sizeof(pt)/cipher_descriptor[x].block_length);
|
results[no_results].spd1 = a1/(sizeof(pt)/cipher_descriptor[x].block_length);
|
||||||
results[no_results].spd2 = a2/(sizeof(pt)/cipher_descriptor[x].block_length);
|
results[no_results].spd2 = a2/(sizeof(pt)/cipher_descriptor[x].block_length);
|
||||||
results[no_results].avg = (results[no_results].spd1 + results[no_results].spd2+1)/2;
|
results[no_results].avg = (results[no_results].spd1 + results[no_results].spd2+1)/2;
|
||||||
++no_results;
|
++no_results;
|
||||||
fprintf(stderr, "."); fflush(stdout);
|
fprintf(stderr, "."); fflush(stdout);
|
||||||
|
|
||||||
#undef DO2
|
#undef DO2
|
||||||
#undef DO1
|
#undef DO1
|
||||||
}
|
}
|
||||||
@ -496,14 +498,14 @@ int time_cipher3(void)
|
|||||||
}
|
}
|
||||||
a2 = c2 - c1 - skew;
|
a2 = c2 - c1 - skew;
|
||||||
ctr_done(&ctr);
|
ctr_done(&ctr);
|
||||||
|
|
||||||
results[no_results].id = x;
|
results[no_results].id = x;
|
||||||
results[no_results].spd1 = a1/(sizeof(pt)/cipher_descriptor[x].block_length);
|
results[no_results].spd1 = a1/(sizeof(pt)/cipher_descriptor[x].block_length);
|
||||||
results[no_results].spd2 = a2/(sizeof(pt)/cipher_descriptor[x].block_length);
|
results[no_results].spd2 = a2/(sizeof(pt)/cipher_descriptor[x].block_length);
|
||||||
results[no_results].avg = (results[no_results].spd1 + results[no_results].spd2+1)/2;
|
results[no_results].avg = (results[no_results].spd1 + results[no_results].spd2+1)/2;
|
||||||
++no_results;
|
++no_results;
|
||||||
fprintf(stderr, "."); fflush(stdout);
|
fprintf(stderr, "."); fflush(stdout);
|
||||||
|
|
||||||
#undef DO2
|
#undef DO2
|
||||||
#undef DO1
|
#undef DO1
|
||||||
}
|
}
|
||||||
@ -573,14 +575,14 @@ int time_cipher4(void)
|
|||||||
a2 = c2 - c1 - skew;
|
a2 = c2 - c1 - skew;
|
||||||
|
|
||||||
lrw_done(&lrw);
|
lrw_done(&lrw);
|
||||||
|
|
||||||
results[no_results].id = x;
|
results[no_results].id = x;
|
||||||
results[no_results].spd1 = a1/(sizeof(pt)/cipher_descriptor[x].block_length);
|
results[no_results].spd1 = a1/(sizeof(pt)/cipher_descriptor[x].block_length);
|
||||||
results[no_results].spd2 = a2/(sizeof(pt)/cipher_descriptor[x].block_length);
|
results[no_results].spd2 = a2/(sizeof(pt)/cipher_descriptor[x].block_length);
|
||||||
results[no_results].avg = (results[no_results].spd1 + results[no_results].spd2+1)/2;
|
results[no_results].avg = (results[no_results].spd1 + results[no_results].spd2+1)/2;
|
||||||
++no_results;
|
++no_results;
|
||||||
fprintf(stderr, "."); fflush(stdout);
|
fprintf(stderr, "."); fflush(stdout);
|
||||||
|
|
||||||
#undef DO2
|
#undef DO2
|
||||||
#undef DO1
|
#undef DO1
|
||||||
}
|
}
|
||||||
@ -677,7 +679,7 @@ void time_mult(void)
|
|||||||
|
|
||||||
#undef DO1
|
#undef DO1
|
||||||
#undef DO2
|
#undef DO2
|
||||||
}
|
}
|
||||||
|
|
||||||
void time_sqr(void)
|
void time_sqr(void)
|
||||||
{
|
{
|
||||||
@ -712,7 +714,7 @@ void time_sqr(void)
|
|||||||
void time_mult(void) { fprintf(stderr, "NO MULT\n"); }
|
void time_mult(void) { fprintf(stderr, "NO MULT\n"); }
|
||||||
void time_sqr(void) { fprintf(stderr, "NO SQR\n"); }
|
void time_sqr(void) { fprintf(stderr, "NO SQR\n"); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void time_prng(void)
|
void time_prng(void)
|
||||||
{
|
{
|
||||||
ulong64 t1, t2;
|
ulong64 t1, t2;
|
||||||
@ -776,7 +778,7 @@ void time_dsa(void)
|
|||||||
static const struct {
|
static const struct {
|
||||||
int group, modulus;
|
int group, modulus;
|
||||||
} groups[] = {
|
} groups[] = {
|
||||||
{ 20, 96 },
|
{ 20, 96 },
|
||||||
{ 20, 128 },
|
{ 20, 128 },
|
||||||
{ 24, 192 },
|
{ 24, 192 },
|
||||||
{ 28, 256 },
|
{ 28, 256 },
|
||||||
@ -810,7 +812,7 @@ static const struct {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef LTC_MRSA
|
#ifdef LTC_MRSA
|
||||||
/* time various RSA operations */
|
/* time various RSA operations */
|
||||||
void time_rsa(void)
|
void time_rsa(void)
|
||||||
{
|
{
|
||||||
@ -870,7 +872,7 @@ void time_rsa(void)
|
|||||||
t_start();
|
t_start();
|
||||||
t1 = t_read();
|
t1 = t_read();
|
||||||
zzz = sizeof(buf[0]);
|
zzz = sizeof(buf[0]);
|
||||||
if ((err = rsa_decrypt_key(buf[1], z, buf[0], &zzz, (const unsigned char *)"testprog", 8, find_hash("sha1"),
|
if ((err = rsa_decrypt_key(buf[1], z, buf[0], &zzz, (const unsigned char *)"testprog", 8, find_hash("sha1"),
|
||||||
&zz, &key)) != CRYPT_OK) {
|
&zz, &key)) != CRYPT_OK) {
|
||||||
fprintf(stderr, "\n\nrsa_decrypt_key says %s, wait...no it should say %s...damn you!\n", error_to_string(err), error_to_string(CRYPT_OK));
|
fprintf(stderr, "\n\nrsa_decrypt_key says %s, wait...no it should say %s...damn you!\n", error_to_string(err), error_to_string(CRYPT_OK));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -890,7 +892,7 @@ void time_rsa(void)
|
|||||||
t_start();
|
t_start();
|
||||||
t1 = t_read();
|
t1 = t_read();
|
||||||
z = sizeof(buf[1]);
|
z = sizeof(buf[1]);
|
||||||
if ((err = rsa_sign_hash(buf[0], 20, buf[1], &z, &yarrow_prng,
|
if ((err = rsa_sign_hash(buf[0], 20, buf[1], &z, &yarrow_prng,
|
||||||
find_prng("yarrow"), find_hash("sha1"), 8, &key)) != CRYPT_OK) {
|
find_prng("yarrow"), find_hash("sha1"), 8, &key)) != CRYPT_OK) {
|
||||||
fprintf(stderr, "\n\nrsa_sign_hash says %s, wait...no it should say %s...damn you!\n", error_to_string(err), error_to_string(CRYPT_OK));
|
fprintf(stderr, "\n\nrsa_sign_hash says %s, wait...no it should say %s...damn you!\n", error_to_string(err), error_to_string(CRYPT_OK));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -934,7 +936,7 @@ void time_rsa(void)
|
|||||||
void time_rsa(void) { fprintf(stderr, "NO RSA\n"); }
|
void time_rsa(void) { fprintf(stderr, "NO RSA\n"); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MKAT
|
#ifdef MKAT
|
||||||
/* time various KAT operations */
|
/* time various KAT operations */
|
||||||
void time_katja(void)
|
void time_katja(void)
|
||||||
{
|
{
|
||||||
@ -985,7 +987,7 @@ void time_katja(void)
|
|||||||
t_start();
|
t_start();
|
||||||
t1 = t_read();
|
t1 = t_read();
|
||||||
zzz = sizeof(buf[0]);
|
zzz = sizeof(buf[0]);
|
||||||
if ((err = katja_decrypt_key(buf[1], z, buf[0], &zzz, "testprog", 8, find_hash("sha1"),
|
if ((err = katja_decrypt_key(buf[1], z, buf[0], &zzz, "testprog", 8, find_hash("sha1"),
|
||||||
&zz, &key)) != CRYPT_OK) {
|
&zz, &key)) != CRYPT_OK) {
|
||||||
fprintf(stderr, "\n\nkatja_decrypt_key says %s, wait...no it should say %s...damn you!\n", error_to_string(err), error_to_string(CRYPT_OK));
|
fprintf(stderr, "\n\nkatja_decrypt_key says %s, wait...no it should say %s...damn you!\n", error_to_string(err), error_to_string(CRYPT_OK));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -1015,28 +1017,28 @@ void time_ecc(void)
|
|||||||
int err, stat;
|
int err, stat;
|
||||||
static unsigned long sizes[] = {
|
static unsigned long sizes[] = {
|
||||||
#ifdef ECC112
|
#ifdef ECC112
|
||||||
112/8,
|
112/8,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ECC128
|
#ifdef ECC128
|
||||||
128/8,
|
128/8,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ECC160
|
#ifdef ECC160
|
||||||
160/8,
|
160/8,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ECC192
|
#ifdef ECC192
|
||||||
192/8,
|
192/8,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ECC224
|
#ifdef ECC224
|
||||||
224/8,
|
224/8,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ECC256
|
#ifdef ECC256
|
||||||
256/8,
|
256/8,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ECC384
|
#ifdef ECC384
|
||||||
384/8,
|
384/8,
|
||||||
#endif
|
#endif
|
||||||
#ifdef ECC521
|
#ifdef ECC521
|
||||||
521/8,
|
521/8,
|
||||||
#endif
|
#endif
|
||||||
100000};
|
100000};
|
||||||
|
|
||||||
@ -1108,7 +1110,7 @@ void time_ecc(void)
|
|||||||
t_start();
|
t_start();
|
||||||
t1 = t_read();
|
t1 = t_read();
|
||||||
z = sizeof(buf[1]);
|
z = sizeof(buf[1]);
|
||||||
if ((err = ecc_sign_hash(buf[0], 20, buf[1], &z, &yarrow_prng,
|
if ((err = ecc_sign_hash(buf[0], 20, buf[1], &z, &yarrow_prng,
|
||||||
find_prng("yarrow"), &key)) != CRYPT_OK) {
|
find_prng("yarrow"), &key)) != CRYPT_OK) {
|
||||||
fprintf(stderr, "\n\necc_sign_hash says %s, wait...no it should say %s...damn you!\n", error_to_string(err), error_to_string(CRYPT_OK));
|
fprintf(stderr, "\n\necc_sign_hash says %s, wait...no it should say %s...damn you!\n", error_to_string(err), error_to_string(CRYPT_OK));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -1170,7 +1172,7 @@ void time_macs_(unsigned long MAC_SIZE)
|
|||||||
|
|
||||||
cipher_idx = find_cipher("aes");
|
cipher_idx = find_cipher("aes");
|
||||||
hash_idx = find_hash("sha1");
|
hash_idx = find_hash("sha1");
|
||||||
|
|
||||||
if (cipher_idx == -1 || hash_idx == -1) {
|
if (cipher_idx == -1 || hash_idx == -1) {
|
||||||
fprintf(stderr, "Warning the MAC tests requires AES and LTC_SHA1 to operate... so sorry\n");
|
fprintf(stderr, "Warning the MAC tests requires AES and LTC_SHA1 to operate... so sorry\n");
|
||||||
return;
|
return;
|
||||||
@ -1345,7 +1347,7 @@ void time_encmacs_(unsigned long MAC_SIZE)
|
|||||||
t_start();
|
t_start();
|
||||||
t1 = t_read();
|
t1 = t_read();
|
||||||
z = 16;
|
z = 16;
|
||||||
if ((err = ocb3_encrypt_authenticate_memory(cipher_idx, key, 16, IV, 16, "", 0, buf, MAC_SIZE*1024, buf, tag, &z)) != CRYPT_OK) {
|
if ((err = ocb3_encrypt_authenticate_memory(cipher_idx, key, 16, IV, 16, (unsigned char*)"", 0, buf, MAC_SIZE*1024, buf, tag, &z)) != CRYPT_OK) {
|
||||||
fprintf(stderr, "\nOCB3 error... %s\n", error_to_string(err));
|
fprintf(stderr, "\nOCB3 error... %s\n", error_to_string(err));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@ -1369,7 +1371,7 @@ void time_encmacs_(unsigned long MAC_SIZE)
|
|||||||
if (t1 < t2) t2 = t1;
|
if (t1 < t2) t2 = t1;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "CCM (no-precomp) \t%9llu\n", t2/(ulong64)(MAC_SIZE*1024));
|
fprintf(stderr, "CCM (no-precomp) \t%9llu\n", t2/(ulong64)(MAC_SIZE*1024));
|
||||||
|
|
||||||
cipher_descriptor[cipher_idx].setup(key, 16, 0, &skey);
|
cipher_descriptor[cipher_idx].setup(key, 16, 0, &skey);
|
||||||
t2 = -1;
|
t2 = -1;
|
||||||
for (x = 0; x < 10000; x++) {
|
for (x = 0; x < 10000; x++) {
|
||||||
@ -1384,7 +1386,7 @@ void time_encmacs_(unsigned long MAC_SIZE)
|
|||||||
if (t1 < t2) t2 = t1;
|
if (t1 < t2) t2 = t1;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "CCM (precomp) \t\t%9llu\n", t2/(ulong64)(MAC_SIZE*1024));
|
fprintf(stderr, "CCM (precomp) \t\t%9llu\n", t2/(ulong64)(MAC_SIZE*1024));
|
||||||
cipher_descriptor[cipher_idx].done(&skey);
|
cipher_descriptor[cipher_idx].done(&skey);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef LTC_GCM_MODE
|
#ifdef LTC_GCM_MODE
|
||||||
@ -1431,7 +1433,7 @@ __attribute__ ((aligned (16)))
|
|||||||
fprintf(stderr, "\nGCM error[%d]... %s\n", __LINE__, error_to_string(err));
|
fprintf(stderr, "\nGCM error[%d]... %s\n", __LINE__, error_to_string(err));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = gcm_done(&gcm, tag, &z)) != CRYPT_OK) {
|
if ((err = gcm_done(&gcm, tag, &z)) != CRYPT_OK) {
|
||||||
fprintf(stderr, "\nGCM error[%d]... %s\n", __LINE__, error_to_string(err));
|
fprintf(stderr, "\nGCM error[%d]... %s\n", __LINE__, error_to_string(err));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
@ -1444,7 +1446,7 @@ __attribute__ ((aligned (16)))
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void time_encmacs(void)
|
void time_encmacs(void)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user