parent
6d70827d1f
commit
e2cf11da25
@ -9,8 +9,6 @@
|
||||
|
||||
#include <tomcrypt.h>
|
||||
|
||||
int errno;
|
||||
|
||||
int usage(char *name)
|
||||
{
|
||||
int x;
|
||||
@ -103,6 +101,7 @@ int main(int argc, char *argv[])
|
||||
char *infile, *outfile, *cipher;
|
||||
prng_state prng;
|
||||
FILE *fdin, *fdout;
|
||||
int err;
|
||||
|
||||
/* register algs, so they can be printed */
|
||||
register_algs();
|
||||
@ -180,8 +179,8 @@ int main(int argc, char *argv[])
|
||||
if(fgets((char *)tmpkey,sizeof(tmpkey), stdin) == NULL)
|
||||
exit(-1);
|
||||
outlen = sizeof(key);
|
||||
if ((errno = hash_memory(hash_idx,tmpkey,strlen((char *)tmpkey),key,&outlen)) != CRYPT_OK) {
|
||||
printf("Error hashing key: %s\n", error_to_string(errno));
|
||||
if ((err = hash_memory(hash_idx,tmpkey,strlen((char *)tmpkey),key,&outlen)) != CRYPT_OK) {
|
||||
printf("Error hashing key: %s\n", error_to_string(err));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@ -192,8 +191,8 @@ int main(int argc, char *argv[])
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((errno = ctr_start(cipher_idx,IV,key,ks,0,CTR_COUNTER_LITTLE_ENDIAN,&ctr)) != CRYPT_OK) {
|
||||
printf("ctr_start error: %s\n",error_to_string(errno));
|
||||
if ((err = ctr_start(cipher_idx,IV,key,ks,0,CTR_COUNTER_LITTLE_ENDIAN,&ctr)) != CRYPT_OK) {
|
||||
printf("ctr_start error: %s\n",error_to_string(err));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@ -201,8 +200,8 @@ int main(int argc, char *argv[])
|
||||
do {
|
||||
y = fread(inbuf,1,sizeof(inbuf),fdin);
|
||||
|
||||
if ((errno = ctr_decrypt(inbuf,plaintext,y,&ctr)) != CRYPT_OK) {
|
||||
printf("ctr_decrypt error: %s\n", error_to_string(errno));
|
||||
if ((err = ctr_decrypt(inbuf,plaintext,y,&ctr)) != CRYPT_OK) {
|
||||
printf("ctr_decrypt error: %s\n", error_to_string(err));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@ -217,8 +216,8 @@ int main(int argc, char *argv[])
|
||||
} else { /* encrypt */
|
||||
/* Setup yarrow for random bytes for IV */
|
||||
|
||||
if ((errno = rng_make_prng(128, find_prng("yarrow"), &prng, NULL)) != CRYPT_OK) {
|
||||
printf("Error setting up PRNG, %s\n", error_to_string(errno));
|
||||
if ((err = rng_make_prng(128, find_prng("yarrow"), &prng, NULL)) != CRYPT_OK) {
|
||||
printf("Error setting up PRNG, %s\n", error_to_string(err));
|
||||
}
|
||||
|
||||
/* You can use rng_get_bytes on platforms that support it */
|
||||
@ -234,16 +233,16 @@ int main(int argc, char *argv[])
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
if ((errno = ctr_start(cipher_idx,IV,key,ks,0,CTR_COUNTER_LITTLE_ENDIAN,&ctr)) != CRYPT_OK) {
|
||||
printf("ctr_start error: %s\n",error_to_string(errno));
|
||||
if ((err = ctr_start(cipher_idx,IV,key,ks,0,CTR_COUNTER_LITTLE_ENDIAN,&ctr)) != CRYPT_OK) {
|
||||
printf("ctr_start error: %s\n",error_to_string(err));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
do {
|
||||
y = fread(inbuf,1,sizeof(inbuf),fdin);
|
||||
|
||||
if ((errno = ctr_encrypt(inbuf,ciphertext,y,&ctr)) != CRYPT_OK) {
|
||||
printf("ctr_encrypt error: %s\n", error_to_string(errno));
|
||||
if ((err = ctr_encrypt(inbuf,ciphertext,y,&ctr)) != CRYPT_OK) {
|
||||
printf("ctr_encrypt error: %s\n", error_to_string(err));
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
|
@ -15,6 +15,11 @@
|
||||
#define basename(x) x
|
||||
#endif
|
||||
|
||||
#if !defined(PATH_MAX) && defined(_MSC_VER)
|
||||
#include <windows.h>
|
||||
#define PATH_MAX MAX_PATH
|
||||
#endif
|
||||
|
||||
/* thanks http://stackoverflow.com/a/8198009 */
|
||||
#define _base(x) ((x >= '0' && x <= '9') ? '0' : \
|
||||
(x >= 'a' && x <= 'f') ? 'a' - 10 : \
|
||||
|
11
demos/test.c
11
demos/test.c
@ -33,7 +33,8 @@ int main(int argc, char **argv)
|
||||
int x, pass = 0, fail = 0, nop = 0;
|
||||
size_t fn_len, i, dots;
|
||||
char *single_test = NULL;
|
||||
ulong64 ts, dur = 0;
|
||||
ulong64 ts;
|
||||
long delta, dur = 0;
|
||||
reg_algs();
|
||||
|
||||
printf("build == \n%s\n", crypt_build_settings);
|
||||
@ -77,11 +78,11 @@ int main(int argc, char **argv)
|
||||
|
||||
ts = epoch_usec();
|
||||
x = test_functions[i].fn();
|
||||
ts = epoch_usec() - ts;
|
||||
dur += ts;
|
||||
delta = (long)(epoch_usec() - ts);
|
||||
dur += delta;
|
||||
|
||||
if (x == CRYPT_OK) {
|
||||
printf("passed %10.3fms", (double)(ts)/1000);
|
||||
printf("passed %10.3fms", (double)(delta)/1000);
|
||||
pass++;
|
||||
}
|
||||
else if (x == CRYPT_NOP) {
|
||||
@ -89,7 +90,7 @@ int main(int argc, char **argv)
|
||||
nop++;
|
||||
}
|
||||
else {
|
||||
printf("failed %10.3fms", (double)(ts)/1000);
|
||||
printf("failed %10.3fms", (double)(delta)/1000);
|
||||
fail++;
|
||||
}
|
||||
}
|
||||
|
@ -754,7 +754,7 @@ void base64_gen(void)
|
||||
fprintf(out, "Base64 vectors. These are the base64 encodings of the strings 00,01,02...NN-1\n\n");
|
||||
for (x = 0; x <= 32; x++) {
|
||||
for (y = 0; y < x; y++) {
|
||||
src[y] = y;
|
||||
src[y] = (unsigned char)y;
|
||||
}
|
||||
len = sizeof(dst);
|
||||
base64_encode(src, x, dst, &len);
|
||||
|
@ -46,7 +46,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="src\headers,..\libtommath"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;LTM_DESC;LTC_SOURCE;LTC_NO_TEST;LTC_NO_PROTOTYPES"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;LTM_DESC;LTC_SOURCE;LTC_NO_TEST;LTC_NO_PROTOTYPES"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="0"
|
||||
BasicRuntimeChecks="3"
|
||||
@ -123,7 +123,7 @@
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="src\headers,..\libtommath"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;LTM_DESC;LTC_SOURCE;LTC_NO_TEST;LTC_NO_PROTOTYPES"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;LTM_DESC;LTC_SOURCE;LTC_NO_TEST;LTC_NO_PROTOTYPES"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="0"
|
||||
@ -199,7 +199,7 @@
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="src\headers,..\libtommath"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;LTM_DESC;LTC_SOURCE;LTC_NO_TEST;LTC_NO_PROTOTYPES"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;LTM_DESC;LTC_SOURCE;LTC_NO_TEST;LTC_NO_PROTOTYPES"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="0"
|
||||
BasicRuntimeChecks="3"
|
||||
@ -277,7 +277,7 @@
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="src\headers,..\libtommath"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;LTM_DESC;LTC_SOURCE;LTC_NO_TEST;LTC_NO_PROTOTYPES"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_CRT_NONSTDC_NO_DEPRECATE;LTM_DESC;LTC_SOURCE;LTC_NO_TEST;LTC_NO_PROTOTYPES"
|
||||
StringPooling="true"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="0"
|
||||
|
@ -29,7 +29,7 @@ int chacha20poly1305_decrypt(chacha20poly1305_state *st, const unsigned char *in
|
||||
LTC_ARGCHK(st != NULL);
|
||||
|
||||
if (st->aadflg) {
|
||||
padlen = 16 - (st->aadlen % 16);
|
||||
padlen = 16 - (unsigned long)(st->aadlen % 16);
|
||||
if (padlen < 16) {
|
||||
if ((err = poly1305_process(&st->poly, padzero, padlen)) != CRYPT_OK) return err;
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ int chacha20poly1305_done(chacha20poly1305_state *st, unsigned char *tag, unsign
|
||||
|
||||
LTC_ARGCHK(st != NULL);
|
||||
|
||||
padlen = 16 - (st->ctlen % 16);
|
||||
padlen = 16 - (unsigned long)(st->ctlen % 16);
|
||||
if (padlen < 16) {
|
||||
if ((err = poly1305_process(&st->poly, padzero, padlen)) != CRYPT_OK) return err;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ int chacha20poly1305_encrypt(chacha20poly1305_state *st, const unsigned char *in
|
||||
|
||||
if ((err = chacha_crypt(&st->chacha, in, inlen, out)) != CRYPT_OK) return err;
|
||||
if (st->aadflg) {
|
||||
padlen = 16 - (st->aadlen % 16);
|
||||
padlen = 16 - (unsigned long)(st->aadlen % 16);
|
||||
if (padlen < 16) {
|
||||
if ((err = poly1305_process(&st->poly, padzero, padlen)) != CRYPT_OK) return err;
|
||||
}
|
||||
|
@ -263,7 +263,7 @@ int sober128_stream_crypt(sober128_state *c, const unsigned char *in, unsigned l
|
||||
|
||||
/* handle any previously buffered bytes */
|
||||
while (c->nbuf != 0 && inlen != 0) {
|
||||
*out++ = *in++ ^ (c->sbuf & 0xFF);
|
||||
*out++ = *in++ ^ (unsigned char)(c->sbuf & 0xFF);
|
||||
c->sbuf >>= 8;
|
||||
c->nbuf -= 8;
|
||||
--inlen;
|
||||
@ -311,7 +311,7 @@ int sober128_stream_crypt(sober128_state *c, const unsigned char *in, unsigned l
|
||||
c->sbuf = nltap(c);
|
||||
c->nbuf = 32;
|
||||
while (c->nbuf != 0 && inlen != 0) {
|
||||
*out++ = *in++ ^ (c->sbuf & 0xFF);
|
||||
*out++ = *in++ ^ (unsigned char)(c->sbuf & 0xFF);
|
||||
c->sbuf >>= 8;
|
||||
c->nbuf -= 8;
|
||||
--inlen;
|
||||
|
@ -7,7 +7,7 @@ int base64_test(void)
|
||||
unsigned long x, l1, l2, slen1;
|
||||
|
||||
#if defined(LTC_BASE64)
|
||||
const char special_case[] = {
|
||||
const unsigned char special_case[] = {
|
||||
0xbe, 0xe8, 0x92, 0x3c, 0xa2, 0x25, 0xf0, 0xf8,
|
||||
0x91, 0xe4, 0xef, 0xab, 0x0b, 0x8c, 0xfd, 0xff,
|
||||
0x14, 0xd0, 0x29, 0x9d, 0x00 };
|
||||
@ -31,7 +31,7 @@ int base64_test(void)
|
||||
{"foob", "Zm9vYg==" },
|
||||
{"fooba", "Zm9vYmE=" },
|
||||
{"foobar", "Zm9vYmFy"},
|
||||
{special_case,"vuiSPKIl8PiR5O+rC4z9/xTQKZ0="}
|
||||
{(char*)special_case,"vuiSPKIl8PiR5O+rC4z9/xTQKZ0="}
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -59,7 +59,7 @@ int base64_test(void)
|
||||
DO(base64url_strict_decode((unsigned char*)url_cases[x].s, slen1, out, &l1));
|
||||
else
|
||||
DO(base64url_decode((unsigned char*)url_cases[x].s, slen1, out, &l1));
|
||||
if (compare_testvector(out, l1, special_case, strlen(special_case), "base64url decode", x)) {
|
||||
if (compare_testvector(out, l1, special_case, sizeof(special_case) - 1, "base64url decode", x)) {
|
||||
return 1;
|
||||
}
|
||||
if(x < 2) {
|
||||
|
@ -14,74 +14,74 @@ int der_tests(void)
|
||||
#else
|
||||
|
||||
static const unsigned char _der_tests_stinky_root_cert[] =
|
||||
"MIIFETCCA/mgAwIBAgIQbv53JNmv518t5lkCHE272jANBgkqhkiG9w0BAQUFADCB\
|
||||
lTELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAlVUMRcwFQYDVQQHEw5TYWx0IExha2Ug\
|
||||
Q2l0eTEeMBwGA1UEChMVVGhlIFVTRVJUUlVTVCBOZXR3b3JrMSEwHwYDVQQLExho\
|
||||
dHRwOi8vd3d3LnVzZXJ0cnVzdC5jb20xHTAbBgNVBAMTFFVUTi1VU0VSRmlyc3Qt\
|
||||
T2JqZWN0MB4XDTA4MDQyOTAwMDAwMFoXDTEwMDQyOTIzNTk1OVowgbUxCzAJBgNV\
|
||||
BAYTAlVTMQ4wDAYDVQQRDAU0NDE0MzELMAkGA1UECAwCT0gxGTAXBgNVBAcMEE1h\
|
||||
eWZpZWxkIFZpbGxhZ2UxEDAOBgNVBAkMB1N1aXRlIEExFDASBgNVBAkMCzc2NyBC\
|
||||
ZXRhIERyMSIwIAYDVQQKDBlQcmVlbXB0aXZlIFNvbHV0aW9ucywgTExDMSIwIAYD\
|
||||
VQQDDBlQcmVlbXB0aXZlIFNvbHV0aW9ucywgTExDMIIBIjANBgkqhkiG9w0BAQEF\
|
||||
AAOCAQ8AMIIBCgKCAQEAzH7ZBkMcBuHx8d2f10RGTHAf7gzzVteGbOihJGH2BwlS\
|
||||
ZvNp6WEE4DfL+s1vp0wzk1XeLN5tRjg2qum9YqyCk7okh7pXGy46f5mWbLQiefGA\
|
||||
j5UXRcr6WJ3xeACdbXxKrYMV0REia+4Jb2UbFA8S81PjhRon6vcRz76ziUWwt8NC\
|
||||
igX+4ZC0skhhKzKszel6KGL7bJCtLG7ukw9DZC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R0jBBgwFoAU2u1kdBScFDyr3ZmpvVsoTYs8ydgwHQYDVR0OBBYEFK+1HzZE4i28"
|
||||
"oLIzuqlFR9SspiCIMA4GA1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMBMGA1Ud"
|
||||
"JQQMMAoGCCsGAQUFBwMDMBEGCWCGSAGG+EIBAQQEAwIEEDBGBgNVHSAEPzA9MDsG"
|
||||
"DCsGAQQBsjEBAgEDAjArMCkGCCsGAQUFBwIBFh1odHRwczovL3NlY3VyZS5jb21v"
|
||||
"ZG8ubmV0L0NQUzBCBgNVHR8EOzA5MDegNaAzhjFodHRwOi8vY3JsLnVzZXJ0cnVz"
|
||||
"dC5jb20vVVROLVVTRVJGaXJzdC1PYmplY3QuY3JsMCEGA1UdEQQaMBiBFnN1cHBv"
|
||||
"cnRAcHJlZW1wdGl2ZS5jb20wDQYJKoZIhvcNAQEFBQADggEBAC+JM26Dokvonudl"
|
||||
"JXe/Yun7IBhimkagZUjbk9l/GQWN6i+v1o95UJ1wGJtBdm2+MxbSaPoNTDZR4B+2"
|
||||
"lYL9MW57UVmePrnfUPXQKZZG+8gTRDz8+7ol/CEAKmS3MLKCRcH5oe+J5345sGxi"
|
||||
"FC/KWNKedTNraW95xlg8NTlL2yRP7TMsjvBxgLmkbaFUoXzPTbQWmtovIagIT8GC"
|
||||
"JeXwdFaRjbamiz3Irl+u7x/mhxdza6RvgBYylXRFMudANpeGsV7gDXlnfzpFDKHQ"
|
||||
"niVwB7P5sbPFIlmIc+4/xRItkLIRjCVXaepgN9KYu3VOgiSDI6wXiTwP44/LUXQM"
|
||||
"hetwa7s=";
|
||||
const unsigned char _der_tests_cacert_root_cert[] =
|
||||
"MIIHPTCCBSWgAwIBAgIBADANBgkqhkiG9w0BAQQFADB5MRAwDgYDVQQKEwdSb290\
|
||||
IENBMR4wHAYDVQQLExVodHRwOi8vd3d3LmNhY2VydC5vcmcxIjAgBgNVBAMTGUNB\
|
||||
IENlcnQgU2lnbmluZyB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xJBzcoTWcFbLUvFUufQb1nA5V9FrWk9p2rSVzTMVD";
|
||||
const unsigned long _der_tests_cacert_root_cert_size = sizeof(_der_tests_cacert_root_cert);
|
||||
|
||||
/*
|
||||
@ -1034,8 +1034,8 @@ static int der_choice_test(void)
|
||||
ltc_generalizedtime gtime = { 2038, 01, 19, 3, 14, 8, 0, 0, 0, 0 };
|
||||
|
||||
/* setup variables */
|
||||
for (x = 0; x < sizeof(bitbuf); x++) { bitbuf[x] = x & 1; }
|
||||
for (x = 0; x < sizeof(octetbuf); x++) { octetbuf[x] = x; }
|
||||
for (x = 0; x < sizeof(bitbuf); x++) { bitbuf[x] = (unsigned char)(x & 1); }
|
||||
for (x = 0; x < sizeof(octetbuf); x++) { octetbuf[x] = (unsigned char)x; }
|
||||
for (x = 0; x < sizeof(ia5buf); x++) { ia5buf[x] = 'a'; }
|
||||
for (x = 0; x < sizeof(printbuf); x++) { printbuf[x] = 'a'; }
|
||||
integer = 1;
|
||||
|
@ -75,7 +75,7 @@ int dh_test (void)
|
||||
/* test encrypt_key */
|
||||
dh_make_key (&yarrow_prng, find_prng ("yarrow"), KEYSIZE/8, &usera);
|
||||
for (x = 0; x < 16; x++) {
|
||||
buf[0][x] = x;
|
||||
buf[0][x] = (unsigned char)x;
|
||||
}
|
||||
y = sizeof (buf[1]);
|
||||
DO(dh_encrypt_key (buf[0], 16, buf[1], &y, &yarrow_prng, find_prng ("yarrow"), find_hash ("md5"), &usera));
|
||||
@ -96,7 +96,7 @@ int dh_test (void)
|
||||
|
||||
/* test sign_hash */
|
||||
for (x = 0; x < 16; x++) {
|
||||
buf[0][x] = x;
|
||||
buf[0][x] = (unsigned char)x;
|
||||
}
|
||||
x = sizeof (buf[1]);
|
||||
DO(dh_sign_hash (buf[0], 16, buf[1], &x, &yarrow_prng, find_prng ("yarrow"), &usera));
|
||||
|
@ -186,7 +186,7 @@ int dsa_test(void)
|
||||
if (stat1 == 0) { fprintf(stderr, "dsa_verify_key "); return 1; }
|
||||
|
||||
/* encrypt a message */
|
||||
for (x = 0; x < 16; x++) { msg[x] = x; }
|
||||
for (x = 0; x < 16; x++) { msg[x] = (unsigned char)x; }
|
||||
x = sizeof(out);
|
||||
DO(dsa_encrypt_key(msg, 16, out, &x, &yarrow_prng, find_prng("yarrow"), find_hash("sha1"), &key));
|
||||
|
||||
|
@ -192,7 +192,7 @@ int ecc_tests (void)
|
||||
DO(ecc_import(buf[0], x, &privKey));
|
||||
|
||||
for (x = 0; x < 32; x++) {
|
||||
buf[0][x] = x;
|
||||
buf[0][x] = (unsigned char)x;
|
||||
}
|
||||
y = sizeof (buf[1]);
|
||||
DO(ecc_encrypt_key (buf[0], 32, buf[1], &y, &yarrow_prng, find_prng ("yarrow"), find_hash ("sha256"), &pubKey));
|
||||
@ -211,7 +211,7 @@ int ecc_tests (void)
|
||||
}
|
||||
/* test sign_hash */
|
||||
for (x = 0; x < 16; x++) {
|
||||
buf[0][x] = x;
|
||||
buf[0][x] = (unsigned char)x;
|
||||
}
|
||||
x = sizeof (buf[1]);
|
||||
DO(ecc_sign_hash (buf[0], 16, buf[1], &x, &yarrow_prng, find_prng ("yarrow"), &privKey));
|
||||
|
@ -14,9 +14,12 @@ ulong64 epoch_usec(void)
|
||||
#elif defined(_WIN32)
|
||||
FILETIME CurrentTime;
|
||||
ulong64 cur_time;
|
||||
ULARGE_INTEGER ul;
|
||||
GetSystemTimeAsFileTime(&CurrentTime);
|
||||
cur_time = ((ulong64)CurrentTime.dwHighDateTime << 32) + (ulong64)CurrentTime.dwLowDateTime;
|
||||
cur_time -= 116444736000000000LL; /* subtract epoch in microseconds */
|
||||
ul.LowPart = CurrentTime.dwLowDateTime;
|
||||
ul.HighPart = CurrentTime.dwHighDateTime;
|
||||
cur_time = ul.QuadPart;
|
||||
cur_time -= CONST64(116444736000000000); /* subtract epoch in microseconds */
|
||||
cur_time /= 10; /* nanoseconds > microseconds */
|
||||
return cur_time;
|
||||
#else
|
||||
@ -587,7 +590,7 @@ int time_keysched(void)
|
||||
c1 = (t1 > c1) ? c1 : t1;
|
||||
}
|
||||
t1 = c1 - skew;
|
||||
results[no_results].spd1 = results[no_results].avg = t1;
|
||||
results[no_results].spd1 = results[no_results].avg = (unsigned long)t1;
|
||||
results[no_results++].id = x;
|
||||
fprintf(stderr, "."); fflush(stdout);
|
||||
|
||||
@ -656,8 +659,8 @@ int time_cipher(void)
|
||||
ecb_done(&ecb);
|
||||
|
||||
results[no_results].id = x;
|
||||
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].spd1 = (unsigned long)(a1/(sizeof(pt)/cipher_descriptor[x].block_length));
|
||||
results[no_results].spd2 = (unsigned long)(a2/(sizeof(pt)/cipher_descriptor[x].block_length));
|
||||
results[no_results].avg = (results[no_results].spd1 + results[no_results].spd2+1)/2;
|
||||
++no_results;
|
||||
fprintf(stderr, "."); fflush(stdout);
|
||||
@ -731,8 +734,8 @@ int time_cipher2(void)
|
||||
cbc_done(&cbc);
|
||||
|
||||
results[no_results].id = x;
|
||||
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].spd1 = (unsigned long)(a1/(sizeof(pt)/cipher_descriptor[x].block_length));
|
||||
results[no_results].spd2 = (unsigned long)(a2/(sizeof(pt)/cipher_descriptor[x].block_length));
|
||||
results[no_results].avg = (results[no_results].spd1 + results[no_results].spd2+1)/2;
|
||||
++no_results;
|
||||
fprintf(stderr, "."); fflush(stdout);
|
||||
@ -806,8 +809,8 @@ int time_cipher3(void)
|
||||
ctr_done(&ctr);
|
||||
|
||||
results[no_results].id = x;
|
||||
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].spd1 = (unsigned long)(a1/(sizeof(pt)/cipher_descriptor[x].block_length));
|
||||
results[no_results].spd2 = (unsigned long)(a2/(sizeof(pt)/cipher_descriptor[x].block_length));
|
||||
results[no_results].avg = (results[no_results].spd1 + results[no_results].spd2+1)/2;
|
||||
++no_results;
|
||||
fprintf(stderr, "."); fflush(stdout);
|
||||
@ -883,8 +886,8 @@ int time_cipher4(void)
|
||||
lrw_done(&lrw);
|
||||
|
||||
results[no_results].id = x;
|
||||
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].spd1 = (unsigned long)(a1/(sizeof(pt)/cipher_descriptor[x].block_length));
|
||||
results[no_results].spd2 = (unsigned long)(a2/(sizeof(pt)/cipher_descriptor[x].block_length));
|
||||
results[no_results].avg = (results[no_results].spd1 + results[no_results].spd2+1)/2;
|
||||
++no_results;
|
||||
fprintf(stderr, "."); fflush(stdout);
|
||||
@ -941,7 +944,7 @@ int time_hash(void)
|
||||
t1 = c2 - c1 - skew;
|
||||
t1 = ((t1 * CONST64(1000))) / ((ulong64)hash_descriptor[x].blocksize);
|
||||
results[no_results].id = x;
|
||||
results[no_results].spd1 = results[no_results].avg = t1;
|
||||
results[no_results].spd1 = results[no_results].avg = (unsigned long)t1;
|
||||
++no_results;
|
||||
fprintf(stderr, "."); fflush(stdout);
|
||||
#undef DO2
|
||||
|
Loading…
Reference in New Issue
Block a user