From d4a5db2459a71baa776cb7499fd89c43b80614cb Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sun, 20 Jan 2013 17:05:24 -0800 Subject: [PATCH] Remove benchmark progs for now, they will be reintroduced later. --- src/libsodium/crypto_auth/measure.c | 69 ----------- src/libsodium/crypto_box/measure.c | 137 --------------------- src/libsodium/crypto_hash/measure.c | 66 ---------- src/libsodium/crypto_hashblocks/measure.c | 18 --- src/libsodium/crypto_onetimeauth/measure.c | 69 ----------- src/libsodium/crypto_scalarmult/measure.c | 61 --------- src/libsodium/crypto_secretbox/measure.c | 75 ----------- src/libsodium/crypto_sign/measure.c | 83 ------------- src/libsodium/crypto_stream/measure.c | 73 ----------- src/libsodium/crypto_verify/measure.c | 18 --- 10 files changed, 669 deletions(-) delete mode 100644 src/libsodium/crypto_auth/measure.c delete mode 100644 src/libsodium/crypto_box/measure.c delete mode 100644 src/libsodium/crypto_hash/measure.c delete mode 100644 src/libsodium/crypto_hashblocks/measure.c delete mode 100644 src/libsodium/crypto_onetimeauth/measure.c delete mode 100644 src/libsodium/crypto_scalarmult/measure.c delete mode 100644 src/libsodium/crypto_secretbox/measure.c delete mode 100644 src/libsodium/crypto_sign/measure.c delete mode 100644 src/libsodium/crypto_stream/measure.c delete mode 100644 src/libsodium/crypto_verify/measure.c diff --git a/src/libsodium/crypto_auth/measure.c b/src/libsodium/crypto_auth/measure.c deleted file mode 100644 index e5209903..00000000 --- a/src/libsodium/crypto_auth/measure.c +++ /dev/null @@ -1,69 +0,0 @@ -#include "crypto_auth.h" -#include "randombytes.h" -#include "cpucycles.h" - -extern void printentry(long long,const char *,long long *,long long); -extern unsigned char *alignedcalloc(unsigned long long); -extern const char *primitiveimplementation; -extern const char *implementationversion; -extern const char *sizenames[]; -extern const long long sizes[]; -extern void allocate(void); -extern void measure(void); - -const char *primitiveimplementation = crypto_auth_IMPLEMENTATION; -const char *implementationversion = crypto_auth_VERSION; -const char *sizenames[] = { "outputbytes", "keybytes", 0 }; -const long long sizes[] = { crypto_auth_BYTES, crypto_auth_KEYBYTES }; - -#define MAXTEST_BYTES 4096 -#ifdef SUPERCOP -#define MGAP 8192 -#else -#define MGAP 8 -#endif - -static unsigned char *k; -static unsigned char *m; -static unsigned char *h; - -void preallocate(void) -{ -} - -void allocate(void) -{ - k = alignedcalloc(crypto_auth_KEYBYTES); - m = alignedcalloc(MAXTEST_BYTES); - h = alignedcalloc(crypto_auth_BYTES); -} - -#define TIMINGS 15 -static long long cycles[TIMINGS + 1]; - -void measure(void) -{ - int i; - int loop; - int mlen; - - for (loop = 0;loop < LOOPS;++loop) { - for (mlen = 0;mlen <= MAXTEST_BYTES;mlen += 1 + mlen / MGAP) { - randombytes(k,crypto_auth_KEYBYTES); - randombytes(m,mlen); - randombytes(h,crypto_auth_BYTES); - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_auth(h,m,mlen,k); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"cycles",cycles,TIMINGS); - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_auth_verify(h,m,mlen,k); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"verify_cycles",cycles,TIMINGS); - } - } -} diff --git a/src/libsodium/crypto_box/measure.c b/src/libsodium/crypto_box/measure.c deleted file mode 100644 index 08df1e39..00000000 --- a/src/libsodium/crypto_box/measure.c +++ /dev/null @@ -1,137 +0,0 @@ -#include -#include "randombytes.h" -#include "cpucycles.h" -#include "crypto_box.h" - -extern void printentry(long long,const char *,long long *,long long); -extern unsigned char *alignedcalloc(unsigned long long); -extern const char *primitiveimplementation; -extern const char *implementationversion; -extern const char *sizenames[]; -extern const long long sizes[]; -extern void allocate(void); -extern void measure(void); - -const char *primitiveimplementation = crypto_box_IMPLEMENTATION; -const char *implementationversion = crypto_box_VERSION; -const char *sizenames[] = { "publickeybytes", "secretkeybytes", "beforenmbytes", "noncebytes", "zerobytes", "boxzerobytes", 0 }; -const long long sizes[] = { crypto_box_PUBLICKEYBYTES, crypto_box_SECRETKEYBYTES, crypto_box_BEFORENMBYTES, crypto_box_NONCEBYTES, crypto_box_ZEROBYTES, crypto_box_BOXZEROBYTES }; - -#define MAXTEST_BYTES 4096 - -static unsigned char *ska; -static unsigned char *pka; -static unsigned char *skb; -static unsigned char *pkb; -static unsigned char *n; -static unsigned char *m; -static unsigned char *c; -static unsigned char *sa; -static unsigned char *sb; - -void preallocate(void) -{ -} - -void allocate(void) -{ - ska = alignedcalloc(crypto_box_SECRETKEYBYTES); - pka = alignedcalloc(crypto_box_PUBLICKEYBYTES); - skb = alignedcalloc(crypto_box_SECRETKEYBYTES); - pkb = alignedcalloc(crypto_box_PUBLICKEYBYTES); - n = alignedcalloc(crypto_box_NONCEBYTES); - m = alignedcalloc(MAXTEST_BYTES + crypto_box_ZEROBYTES); - c = alignedcalloc(MAXTEST_BYTES + crypto_box_ZEROBYTES); - sa = alignedcalloc(crypto_box_BEFORENMBYTES); - sb = alignedcalloc(crypto_box_BEFORENMBYTES); -} - -#define TIMINGS 15 -static long long cycles[TIMINGS + 1]; - -void measure(void) -{ - int i; - int loop; - int mlen; - - for (loop = 0;loop < LOOPS;++loop) { - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_box_keypair(pka,ska); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(-1,"keypair_cycles",cycles,TIMINGS); - - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_box_keypair(pkb,skb); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(-1,"keypair_cycles",cycles,TIMINGS); - - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_box_beforenm(sa,pkb,ska); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(-1,"beforenm_cycles",cycles,TIMINGS); - - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_box_beforenm(sb,pka,skb); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(-1,"beforenm_cycles",cycles,TIMINGS); - - for (mlen = 0;mlen <= MAXTEST_BYTES;mlen += 1 + mlen / 8) { - randombytes(n,crypto_box_NONCEBYTES); - randombytes(m + crypto_box_ZEROBYTES,mlen); - randombytes(c,mlen + crypto_box_ZEROBYTES); - - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_box(c,m,mlen + crypto_box_ZEROBYTES,n,pka,skb); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"cycles",cycles,TIMINGS); - - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_box_open(m,c,mlen + crypto_box_ZEROBYTES,n,pkb,ska); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"open_cycles",cycles,TIMINGS); - - ++c[crypto_box_ZEROBYTES]; - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_box_open(m,c,mlen + crypto_box_ZEROBYTES,n,pkb,ska); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"forgery_open_cycles",cycles,TIMINGS); - - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_box_afternm(c,m,mlen + crypto_box_ZEROBYTES,n,sb); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"afternm_cycles",cycles,TIMINGS); - - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_box_open_afternm(m,c,mlen + crypto_box_ZEROBYTES,n,sa); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"open_afternm_cycles",cycles,TIMINGS); - - ++c[crypto_box_ZEROBYTES]; - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_box_open_afternm(m,c,mlen + crypto_box_ZEROBYTES,n,sa); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"forgery_open_afternm_cycles",cycles,TIMINGS); - } - } -} diff --git a/src/libsodium/crypto_hash/measure.c b/src/libsodium/crypto_hash/measure.c deleted file mode 100644 index cec0404d..00000000 --- a/src/libsodium/crypto_hash/measure.c +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include "randombytes.h" -#include "cpucycles.h" -#include "crypto_hash.h" - -extern void printentry(long long,const char *,long long *,long long); -extern unsigned char *alignedcalloc(unsigned long long); -extern const char *primitiveimplementation; -extern const char *implementationversion; -extern const char *sizenames[]; -extern const long long sizes[]; -extern void allocate(void); -extern void measure(void); - -const char *primitiveimplementation = crypto_hash_IMPLEMENTATION; -const char *implementationversion = crypto_hash_VERSION; -const char *sizenames[] = { "outputbytes", 0 }; -const long long sizes[] = { crypto_hash_BYTES }; - -#define MAXTEST_BYTES 4096 -#ifdef SUPERCOP -#define MGAP 8192 -#else -#define MGAP 8 -#endif - -static unsigned char *h; -static unsigned char *m; - -void preallocate(void) -{ -} - -void allocate(void) -{ - h = alignedcalloc(crypto_hash_BYTES); - m = alignedcalloc(MAXTEST_BYTES); -} - -#define TIMINGS 15 -static long long cycles[TIMINGS + 1]; - -static void printcycles(long long mlen) -{ - int i; - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"cycles",cycles,TIMINGS); -} - -void measure(void) -{ - int i; - int loop; - int mlen; - - for (loop = 0;loop < LOOPS;++loop) { - for (mlen = 0;mlen <= MAXTEST_BYTES;mlen += 1 + mlen / MGAP) { - randombytes(m,mlen); - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_hash(h,m,mlen); - } - printcycles(mlen); - } - } -} diff --git a/src/libsodium/crypto_hashblocks/measure.c b/src/libsodium/crypto_hashblocks/measure.c deleted file mode 100644 index 145fbbc4..00000000 --- a/src/libsodium/crypto_hashblocks/measure.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "crypto_hashblocks.h" - -const char *primitiveimplementation = crypto_hashblocks_IMPLEMENTATION; -const char *implementationversion = crypto_hashblocks_VERSION; -const char *sizenames[] = { "statebytes", 0 }; -const long long sizes[] = { crypto_hashblocks_STATEBYTES }; - -void preallocate(void) -{ -} - -void allocate(void) -{ -} - -void measure(void) -{ -} diff --git a/src/libsodium/crypto_onetimeauth/measure.c b/src/libsodium/crypto_onetimeauth/measure.c deleted file mode 100644 index 6d3ddfd5..00000000 --- a/src/libsodium/crypto_onetimeauth/measure.c +++ /dev/null @@ -1,69 +0,0 @@ -#include "crypto_onetimeauth.h" -#include "randombytes.h" -#include "cpucycles.h" - -extern void printentry(long long,const char *,long long *,long long); -extern unsigned char *alignedcalloc(unsigned long long); -extern const char *primitiveimplementation; -extern const char *implementationversion; -extern const char *sizenames[]; -extern const long long sizes[]; -extern void allocate(void); -extern void measure(void); - -const char *primitiveimplementation = crypto_onetimeauth_IMPLEMENTATION; -const char *implementationversion = crypto_onetimeauth_VERSION; -const char *sizenames[] = { "outputbytes", "keybytes", 0 }; -const long long sizes[] = { crypto_onetimeauth_BYTES, crypto_onetimeauth_KEYBYTES }; - -#define MAXTEST_BYTES 4096 -#ifdef SUPERCOP -#define MGAP 8192 -#else -#define MGAP 8 -#endif - -static unsigned char *k; -static unsigned char *m; -static unsigned char *h; - -void preallocate(void) -{ -} - -void allocate(void) -{ - k = alignedcalloc(crypto_onetimeauth_KEYBYTES); - m = alignedcalloc(MAXTEST_BYTES); - h = alignedcalloc(crypto_onetimeauth_BYTES); -} - -#define TIMINGS 15 -static long long cycles[TIMINGS + 1]; - -void measure(void) -{ - int i; - int loop; - int mlen; - - for (loop = 0;loop < LOOPS;++loop) { - for (mlen = 0;mlen <= MAXTEST_BYTES;mlen += 1 + mlen / MGAP) { - randombytes(k,crypto_onetimeauth_KEYBYTES); - randombytes(m,mlen); - randombytes(h,crypto_onetimeauth_BYTES); - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_onetimeauth(h,m,mlen,k); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"cycles",cycles,TIMINGS); - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_onetimeauth_verify(h,m,mlen,k); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"verify_cycles",cycles,TIMINGS); - } - } -} diff --git a/src/libsodium/crypto_scalarmult/measure.c b/src/libsodium/crypto_scalarmult/measure.c deleted file mode 100644 index 0c7265d5..00000000 --- a/src/libsodium/crypto_scalarmult/measure.c +++ /dev/null @@ -1,61 +0,0 @@ -#include -#include "randombytes.h" -#include "cpucycles.h" -#include "crypto_scalarmult.h" - -extern void printentry(long long,const char *,long long *,long long); -extern unsigned char *alignedcalloc(unsigned long long); -extern const char *primitiveimplementation; -extern const char *implementationversion; -extern const char *sizenames[]; -extern const long long sizes[]; -extern void allocate(void); -extern void measure(void); - -const char *primitiveimplementation = crypto_scalarmult_IMPLEMENTATION; -const char *implementationversion = crypto_scalarmult_VERSION; -const char *sizenames[] = { "outputbytes", "scalarbytes", 0 }; -const long long sizes[] = { crypto_scalarmult_BYTES, crypto_scalarmult_SCALARBYTES }; - -static unsigned char *m; -static unsigned char *n; -static unsigned char *p; -static unsigned char *q; - -void preallocate(void) -{ -} - -void allocate(void) -{ - m = alignedcalloc(crypto_scalarmult_SCALARBYTES); - n = alignedcalloc(crypto_scalarmult_SCALARBYTES); - p = alignedcalloc(crypto_scalarmult_BYTES); - q = alignedcalloc(crypto_scalarmult_BYTES); -} - -#define TIMINGS 63 -static long long cycles[TIMINGS + 1]; - -void measure(void) -{ - int i; - int loop; - - for (loop = 0;loop < LOOPS;++loop) { - randombytes(m,crypto_scalarmult_SCALARBYTES); - randombytes(n,crypto_scalarmult_SCALARBYTES); - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_scalarmult_base(p,m); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(-1,"base_cycles",cycles,TIMINGS); - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_scalarmult(q,n,p); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(-1,"cycles",cycles,TIMINGS); - } -} diff --git a/src/libsodium/crypto_secretbox/measure.c b/src/libsodium/crypto_secretbox/measure.c deleted file mode 100644 index 6cb0692f..00000000 --- a/src/libsodium/crypto_secretbox/measure.c +++ /dev/null @@ -1,75 +0,0 @@ -#include -#include "randombytes.h" -#include "cpucycles.h" -#include "crypto_secretbox.h" - -extern void printentry(long long,const char *,long long *,long long); -extern unsigned char *alignedcalloc(unsigned long long); -extern const char *primitiveimplementation; -extern const char *implementationversion; -extern const char *sizenames[]; -extern const long long sizes[]; -extern void allocate(void); -extern void measure(void); - -const char *primitiveimplementation = crypto_secretbox_IMPLEMENTATION; -const char *implementationversion = crypto_secretbox_VERSION; -const char *sizenames[] = { "keybytes", "noncebytes", "zerobytes", "boxzerobytes", 0 }; -const long long sizes[] = { crypto_secretbox_KEYBYTES, crypto_secretbox_NONCEBYTES, crypto_secretbox_ZEROBYTES, crypto_secretbox_BOXZEROBYTES }; - -#define MAXTEST_BYTES 4096 - -static unsigned char *k; -static unsigned char *n; -static unsigned char *m; -static unsigned char *c; - -void preallocate(void) -{ -} - -void allocate(void) -{ - k = alignedcalloc(crypto_secretbox_KEYBYTES); - n = alignedcalloc(crypto_secretbox_NONCEBYTES); - m = alignedcalloc(MAXTEST_BYTES + crypto_secretbox_ZEROBYTES); - c = alignedcalloc(MAXTEST_BYTES + crypto_secretbox_ZEROBYTES); -} - -#define TIMINGS 15 -static long long cycles[TIMINGS + 1]; - -void measure(void) -{ - int i; - int loop; - int mlen; - - for (loop = 0;loop < LOOPS;++loop) { - for (mlen = 0;mlen <= MAXTEST_BYTES;mlen += 1 + mlen / 8) { - randombytes(k,crypto_secretbox_KEYBYTES); - randombytes(n,crypto_secretbox_NONCEBYTES); - randombytes(m + crypto_secretbox_ZEROBYTES,mlen); - randombytes(c,mlen + crypto_secretbox_ZEROBYTES); - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_secretbox(c,m,mlen + crypto_secretbox_ZEROBYTES,n,k); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"cycles",cycles,TIMINGS); - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_secretbox_open(m,c,mlen + crypto_secretbox_ZEROBYTES,n,k); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"open_cycles",cycles,TIMINGS); - ++c[crypto_secretbox_ZEROBYTES]; - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_secretbox_open(m,c,mlen + crypto_secretbox_ZEROBYTES,n,k); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"forgery_open_cycles",cycles,TIMINGS); - } - } -} diff --git a/src/libsodium/crypto_sign/measure.c b/src/libsodium/crypto_sign/measure.c deleted file mode 100644 index 8d8495a8..00000000 --- a/src/libsodium/crypto_sign/measure.c +++ /dev/null @@ -1,83 +0,0 @@ -#include -#include "randombytes.h" -#include "cpucycles.h" -#include "crypto_sign.h" - -extern void printentry(long long,const char *,long long *,long long); -extern unsigned char *alignedcalloc(unsigned long long); -extern const char *primitiveimplementation; -extern const char *implementationversion; -extern const char *sizenames[]; -extern const long long sizes[]; -extern void allocate(void); -extern void measure(void); - -const char *primitiveimplementation = crypto_sign_IMPLEMENTATION; -const char *implementationversion = crypto_sign_VERSION; -const char *sizenames[] = { "outputbytes", "publickeybytes", "secretkeybytes", 0 }; -const long long sizes[] = { crypto_sign_BYTES, crypto_sign_PUBLICKEYBYTES, crypto_sign_SECRETKEYBYTES }; - -#define MAXTEST_BYTES 100000 - -static unsigned char *pk; -static unsigned char *sk; -static unsigned char *m; unsigned long long mlen; -static unsigned char *sm; unsigned long long smlen; -static unsigned char *t; unsigned long long tlen; - -void preallocate(void) -{ -#ifdef RAND_R_PRNG_NOT_SEEDED - RAND_status(); -#endif -} - -void allocate(void) -{ - pk = alignedcalloc(crypto_sign_PUBLICKEYBYTES); - sk = alignedcalloc(crypto_sign_SECRETKEYBYTES); - m = alignedcalloc(MAXTEST_BYTES + crypto_sign_BYTES); - sm = alignedcalloc(MAXTEST_BYTES + crypto_sign_BYTES); - t = alignedcalloc(MAXTEST_BYTES + crypto_sign_BYTES); -} - -#define TIMINGS 31 -static long long cycles[TIMINGS + 1]; -static long long bytes[TIMINGS + 1]; - -void measure(void) -{ - int i; - int loop; - - for (loop = 0;loop < LOOPS;++loop) { - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_sign_keypair(pk,sk); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(-1,"keypair_cycles",cycles,TIMINGS); - - for (mlen = 0;mlen <= MAXTEST_BYTES;mlen += 1 + mlen / 4) { - randombytes(m,mlen); - - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - bytes[i] = crypto_sign(sm,&smlen,m,mlen,sk); - if (bytes[i] == 0) bytes[i] = smlen; - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"cycles",cycles,TIMINGS); - printentry(mlen,"bytes",bytes,TIMINGS); - - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - bytes[i] = crypto_sign_open(t,&tlen,sm,smlen,pk); - if (bytes[i] == 0) bytes[i] = tlen; - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"open_cycles",cycles,TIMINGS); - printentry(mlen,"open_bytes",bytes,TIMINGS); - } - } -} diff --git a/src/libsodium/crypto_stream/measure.c b/src/libsodium/crypto_stream/measure.c deleted file mode 100644 index ff3ab610..00000000 --- a/src/libsodium/crypto_stream/measure.c +++ /dev/null @@ -1,73 +0,0 @@ -#include -#include "randombytes.h" -#include "cpucycles.h" -#include "crypto_stream.h" - -extern void printentry(long long,const char *,long long *,long long); -extern unsigned char *alignedcalloc(unsigned long long); -extern const char *primitiveimplementation; -extern const char *implementationversion; -extern const char *sizenames[]; -extern const long long sizes[]; -extern void allocate(void); -extern void measure(void); - -const char *primitiveimplementation = crypto_stream_IMPLEMENTATION; -const char *implementationversion = crypto_stream_VERSION; -const char *sizenames[] = { "keybytes", "noncebytes", 0 }; -const long long sizes[] = { crypto_stream_KEYBYTES, crypto_stream_NONCEBYTES }; - -#define MAXTEST_BYTES 4096 -#ifdef SUPERCOP -#define MGAP 8192 -#else -#define MGAP 8 -#endif - -static unsigned char *k; -static unsigned char *n; -static unsigned char *m; -static unsigned char *c; - -void preallocate(void) -{ -} - -void allocate(void) -{ - k = alignedcalloc(crypto_stream_KEYBYTES); - n = alignedcalloc(crypto_stream_NONCEBYTES); - m = alignedcalloc(MAXTEST_BYTES); - c = alignedcalloc(MAXTEST_BYTES); -} - -#define TIMINGS 15 -static long long cycles[TIMINGS + 1]; - -void measure(void) -{ - int i; - int loop; - int mlen; - - for (loop = 0;loop < LOOPS;++loop) { - for (mlen = 0;mlen <= MAXTEST_BYTES;mlen += 1 + mlen / MGAP) { - randombytes(k,crypto_stream_KEYBYTES); - randombytes(n,crypto_stream_NONCEBYTES); - randombytes(m,mlen); - randombytes(c,mlen); - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_stream(c,mlen,n,k); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"cycles",cycles,TIMINGS); - for (i = 0;i <= TIMINGS;++i) { - cycles[i] = cpucycles(); - crypto_stream_xor(c,m,mlen,n,k); - } - for (i = 0;i < TIMINGS;++i) cycles[i] = cycles[i + 1] - cycles[i]; - printentry(mlen,"xor_cycles",cycles,TIMINGS); - } - } -} diff --git a/src/libsodium/crypto_verify/measure.c b/src/libsodium/crypto_verify/measure.c deleted file mode 100644 index bbfac4f1..00000000 --- a/src/libsodium/crypto_verify/measure.c +++ /dev/null @@ -1,18 +0,0 @@ -#include "crypto_verify.h" - -const char *primitiveimplementation = crypto_verify_IMPLEMENTATION; -const char *implementationversion = crypto_verify_VERSION; -const char *sizenames[] = { "inputbytes", 0 }; -const long long sizes[] = { crypto_verify_BYTES }; - -void preallocate(void) -{ -} - -void allocate(void) -{ -} - -void measure(void) -{ -}