projects
/
BearSSL
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fixed br_ssl_session_cache_lru_forget().
[BearSSL]
/
test
/
test_speed.c
diff --git
a/test/test_speed.c
b/test/test_speed.c
index
6981299
..
296e914
100644
(file)
--- a/
test/test_speed.c
+++ b/
test/test_speed.c
@@
-175,17
+175,24
@@
test_speed_ ## fname(void) \
static void \
test_speed_ ## fname(void) \
{ \
static void \
test_speed_ ## fname(void) \
{ \
+ br_chacha20_run bc; \
unsigned char key[32]; \
unsigned char buf[8192]; \
unsigned char iv[12]; \
int i; \
long num; \
\
unsigned char key[32]; \
unsigned char buf[8192]; \
unsigned char iv[12]; \
int i; \
long num; \
\
+ bc = br_ ## fname ## _get(); \
+ if (bc == 0) { \
+ printf("%-30s UNAVAILABLE\n", #Name); \
+ fflush(stdout); \
+ return; \
+ } \
memset(key, 'T', sizeof key); \
memset(buf, 'P', sizeof buf); \
memset(iv, 'X', sizeof iv); \
for (i = 0; i < 10; i ++) { \
memset(key, 'T', sizeof key); \
memset(buf, 'P', sizeof buf); \
memset(iv, 'X', sizeof iv); \
for (i = 0; i < 10; i ++) { \
- b
r_ ## fname ## _run
(key, iv, i, buf, sizeof buf); \
+ b
c
(key, iv, i, buf, sizeof buf); \
} \
num = 10; \
for (;;) { \
} \
num = 10; \
for (;;) { \
@@
-195,8
+202,7
@@
test_speed_ ## fname(void) \
\
begin = clock(); \
for (k = num; k > 0; k --) { \
\
begin = clock(); \
for (k = num; k > 0; k --) { \
- br_ ## fname ## _run(key, iv, \
- (uint32_t)k, buf, sizeof buf); \
+ bc(key, iv, (uint32_t)k, buf, sizeof buf); \
} \
end = clock(); \
tt = (double)(end - begin) / CLOCKS_PER_SEC; \
} \
end = clock(); \
tt = (double)(end - begin) / CLOCKS_PER_SEC; \
@@
-232,6
+238,7
@@
SPEED_HASH(SHA-512, sha512)
#define br_aes_ct64_cbcenc_get_vtable() (&br_aes_ct64_cbcenc_vtable)
#define br_aes_ct64_cbcdec_get_vtable() (&br_aes_ct64_cbcdec_vtable)
#define br_aes_ct64_ctr_get_vtable() (&br_aes_ct64_ctr_vtable)
#define br_aes_ct64_cbcenc_get_vtable() (&br_aes_ct64_cbcenc_vtable)
#define br_aes_ct64_cbcdec_get_vtable() (&br_aes_ct64_cbcdec_vtable)
#define br_aes_ct64_ctr_get_vtable() (&br_aes_ct64_ctr_vtable)
+#define br_chacha20_ct_get() (&br_chacha20_ct_run)
#define SPEED_AES(iname) \
SPEED_BLOCKCIPHER_CBC(AES-128 CBC encrypt (iname), aes128_ ## iname ## _cbcenc, aes_ ## iname, 16, enc) \
#define SPEED_AES(iname) \
SPEED_BLOCKCIPHER_CBC(AES-128 CBC encrypt (iname), aes128_ ## iname ## _cbcenc, aes_ ## iname, 16, enc) \
@@
-265,7
+272,8
@@
SPEED_BLOCKCIPHER_CBC(3DES CBC decrypt (iname), 3des_ ## iname ## _cbcdec, des_
SPEED_DES(tab)
SPEED_DES(ct)
SPEED_DES(tab)
SPEED_DES(ct)
-SPEED_CHACHA20(ChaCha20, chacha20_ct)
+SPEED_CHACHA20(ChaCha20 (ct), chacha20_ct)
+SPEED_CHACHA20(ChaCha20 (sse2), chacha20_sse2)
static void
test_speed_ghash_inner(char *name, br_ghash gh)
static void
test_speed_ghash_inner(char *name, br_ghash gh)
@@
-416,6
+424,19
@@
test_speed_poly1305_ctmul32(void)
&br_poly1305_ctmul32_run);
}
&br_poly1305_ctmul32_run);
}
+static void
+test_speed_poly1305_ctmulq(void)
+{
+ br_poly1305_run bp;
+
+ bp = br_poly1305_ctmulq_get();
+ if (bp == 0) {
+ printf("%-30s UNAVAILABLE\n", "Poly1305 (ctmulq)");
+ } else {
+ test_speed_poly1305_inner("Poly1305 (ctmulq)", bp);
+ }
+}
+
static void
test_speed_poly1305_i15(void)
{
static void
test_speed_poly1305_i15(void)
{
@@
-653,6
+674,21
@@
test_speed_rsa_i32(void)
&br_rsa_i32_public, &br_rsa_i32_private);
}
&br_rsa_i32_public, &br_rsa_i32_private);
}
+static void
+test_speed_rsa_i62(void)
+{
+ br_rsa_public pub;
+ br_rsa_private priv;
+
+ pub = br_rsa_i62_public_get();
+ priv = br_rsa_i62_private_get();
+ if (pub) {
+ test_speed_rsa_inner("RSA i62", pub, priv);
+ } else {
+ printf("%-30s UNAVAILABLE\n", "RSA i62");
+ }
+}
+
static void
test_speed_ec_inner_1(const char *name,
const br_ec_impl *impl, const br_ec_curve_def *cd)
static void
test_speed_ec_inner_1(const char *name,
const br_ec_impl *impl, const br_ec_curve_def *cd)
@@
-1251,6
+1287,7
@@
static const struct {
STU(3des_ct_cbcdec),
STU(chacha20_ct),
STU(3des_ct_cbcdec),
STU(chacha20_ct),
+ STU(chacha20_sse2),
STU(ghash_ctmul),
STU(ghash_ctmul32),
STU(ghash_ctmul),
STU(ghash_ctmul32),
@@
-1260,11
+1297,13
@@
static const struct {
STU(poly1305_ctmul),
STU(poly1305_ctmul32),
STU(poly1305_ctmul),
STU(poly1305_ctmul32),
+ STU(poly1305_ctmulq),
STU(poly1305_i15),
STU(rsa_i15),
STU(rsa_i31),
STU(rsa_i32),
STU(poly1305_i15),
STU(rsa_i15),
STU(rsa_i31),
STU(rsa_i32),
+ STU(rsa_i62),
STU(ec_prime_i15),
STU(ec_prime_i31),
STU(ec_p256_m15),
STU(ec_prime_i15),
STU(ec_prime_i31),
STU(ec_p256_m15),