Commit 1e5fad9d authored by Niels Möller's avatar Niels Möller

(main): Try openssl's ciphers as

well, if available.

Rev: src/nettle/examples/nettle-benchmark.c:1.6
parent 4fb8138e
...@@ -24,6 +24,10 @@ ...@@ -24,6 +24,10 @@
* MA 02111-1307, USA. * MA 02111-1307, USA.
*/ */
#if HAVE_CONFIG_H
# include "config.h"
#endif /* HAVE_CONFIG_H */
#include "aes.h" #include "aes.h"
#include "arcfour.h" #include "arcfour.h"
#include "blowfish.h" #include "blowfish.h"
...@@ -221,25 +225,31 @@ time_cipher(const struct nettle_cipher *cipher) ...@@ -221,25 +225,31 @@ time_cipher(const struct nettle_cipher *cipher)
} }
} }
#if HAVE_LIBCRYPTO
#define NCIPHERS 12 # define OPENSSL(x) x,
#else
# define OPENSSL(x)
#endif
int int
main(int argc UNUSED, char **argv UNUSED) main(int argc UNUSED, char **argv UNUSED)
{ {
unsigned i; unsigned i;
const struct nettle_cipher *ciphers[NCIPHERS] = const struct nettle_cipher *ciphers[] =
{ {
&nettle_aes128, &nettle_aes192, &nettle_aes256, &nettle_aes128, &nettle_aes192, &nettle_aes256,
&nettle_arcfour128, &nettle_arcfour128,
&nettle_blowfish128, &nettle_blowfish128,
&nettle_cast128, OPENSSL(&nettle_openssl_blowfish128)
&nettle_des, &nettle_des3, &nettle_cast128, OPENSSL(&nettle_openssl_cast128)
&nettle_des, OPENSSL(&nettle_openssl_des)
&nettle_des3,
&nettle_serpent256, &nettle_serpent256,
&nettle_twofish128, &nettle_twofish192, &nettle_twofish256, &nettle_twofish128, &nettle_twofish192, &nettle_twofish256,
NULL
}; };
for (i = 0; i<NCIPHERS; i++) for (i = 0; ciphers[i]; i++)
time_cipher(ciphers[i]); time_cipher(ciphers[i]);
return 0; return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment