summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/modes
diff options
context:
space:
mode:
authormiod <>2014-04-17 18:37:48 +0000
committermiod <>2014-04-17 18:37:48 +0000
commitbdccac7bb03aa13ef9c01cc6ecc1cc7bc42f6f9d (patch)
tree0458f1ab927ec3e0670c1af39b41e109ba072f51 /src/lib/libcrypto/modes
parent4e69a4929c85c995c1bf1bfd11b1aeb9947d7b85 (diff)
downloadopenbsd-bdccac7bb03aa13ef9c01cc6ecc1cc7bc42f6f9d.tar.gz
openbsd-bdccac7bb03aa13ef9c01cc6ecc1cc7bc42f6f9d.tar.bz2
openbsd-bdccac7bb03aa13ef9c01cc6ecc1cc7bc42f6f9d.zip
Remove the benchmark part of the selftest. It uses the undocumented
OPENSSL_rdtsc() routine to get a high-precision timestamp, and (although this is the only user of this routine in libcrypto) forces every platform willing to provide fast assembly versions of some routines, to also provide OPENSSL_rdtsc().
Diffstat (limited to 'src/lib/libcrypto/modes')
-rw-r--r--src/lib/libcrypto/modes/gcm128.c43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/lib/libcrypto/modes/gcm128.c b/src/lib/libcrypto/modes/gcm128.c
index 52de084318..a495db110f 100644
--- a/src/lib/libcrypto/modes/gcm128.c
+++ b/src/lib/libcrypto/modes/gcm128.c
@@ -1857,49 +1857,6 @@ int main()
1857 TEST_CASE(19); 1857 TEST_CASE(19);
1858 TEST_CASE(20); 1858 TEST_CASE(20);
1859 1859
1860#ifdef OPENSSL_CPUID_OBJ
1861 {
1862 size_t start,stop,gcm_t,ctr_t,OPENSSL_rdtsc();
1863 union { u64 u; u8 c[1024]; } buf;
1864 int i;
1865
1866 AES_set_encrypt_key(K1,sizeof(K1)*8,&key);
1867 CRYPTO_gcm128_init(&ctx,&key,(block128_f)AES_encrypt);
1868 CRYPTO_gcm128_setiv(&ctx,IV1,sizeof(IV1));
1869
1870 CRYPTO_gcm128_encrypt(&ctx,buf.c,buf.c,sizeof(buf));
1871 start = OPENSSL_rdtsc();
1872 CRYPTO_gcm128_encrypt(&ctx,buf.c,buf.c,sizeof(buf));
1873 gcm_t = OPENSSL_rdtsc() - start;
1874
1875 CRYPTO_ctr128_encrypt(buf.c,buf.c,sizeof(buf),
1876 &key,ctx.Yi.c,ctx.EKi.c,&ctx.mres,
1877 (block128_f)AES_encrypt);
1878 start = OPENSSL_rdtsc();
1879 CRYPTO_ctr128_encrypt(buf.c,buf.c,sizeof(buf),
1880 &key,ctx.Yi.c,ctx.EKi.c,&ctx.mres,
1881 (block128_f)AES_encrypt);
1882 ctr_t = OPENSSL_rdtsc() - start;
1883
1884 printf("%.2f-%.2f=%.2f\n",
1885 gcm_t/(double)sizeof(buf),
1886 ctr_t/(double)sizeof(buf),
1887 (gcm_t-ctr_t)/(double)sizeof(buf));
1888#ifdef GHASH
1889 {
1890 void (*gcm_ghash_p)(u64 Xi[2],const u128 Htable[16],
1891 const u8 *inp,size_t len) = ctx.ghash;
1892
1893 GHASH((&ctx),buf.c,sizeof(buf));
1894 start = OPENSSL_rdtsc();
1895 for (i=0;i<100;++i) GHASH((&ctx),buf.c,sizeof(buf));
1896 gcm_t = OPENSSL_rdtsc() - start;
1897 printf("%.2f\n",gcm_t/(double)sizeof(buf)/(double)i);
1898 }
1899#endif
1900 }
1901#endif
1902
1903 return ret; 1860 return ret;
1904} 1861}
1905#endif 1862#endif