From 2d8adebb5ac89dda780d75c3b9cad107bfe28f7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Fri, 4 Jun 2010 18:11:32 +0300 Subject: main/openssl: add padlock sha support, autoload dynamic padlock Add new version of padlock patches which enable: - limited support of VIA C7 SHA acceleration - full support for VIA Nano SHA acceleration Openssl HMAC core is also patched to take full performance out of padlock. Speed application is updated for measuring hmac(sha1). Padlock was moved to be dynamic engine in openssl-1.0.0. So add some code that losfd automatically that engine. --- ...fix-digest-speed-measurement-and-add-hmac.patch | 392 +++++++++++++++++++++ 1 file changed, 392 insertions(+) create mode 100644 main/openssl/0002-apps-speed-fix-digest-speed-measurement-and-add-hmac.patch (limited to 'main/openssl/0002-apps-speed-fix-digest-speed-measurement-and-add-hmac.patch') diff --git a/main/openssl/0002-apps-speed-fix-digest-speed-measurement-and-add-hmac.patch b/main/openssl/0002-apps-speed-fix-digest-speed-measurement-and-add-hmac.patch new file mode 100644 index 0000000000..8859f40601 --- /dev/null +++ b/main/openssl/0002-apps-speed-fix-digest-speed-measurement-and-add-hmac.patch @@ -0,0 +1,392 @@ +From de61d5881a12b359dfb1b4fbbb53412460196553 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Timo=20Ter=C3=A4s?= +Date: Thu, 3 Jun 2010 09:02:13 +0300 +Subject: [PATCH 2/3] apps/speed: fix digest speed measurement and add hmac-sha1 test + +Merge the common code of testing digest speed, and make it reuse +existing context. Context creation can be heavy operation, and it's +speed depends on if engine is used or not. As we are measuring the +digest speed, the context creation overhead should not be included +like hmac tests do. + +This also adds test for hmac-sha1 speed. +--- + apps/speed.c | 243 +++++++++++++++++++++------------------------------------- + 1 files changed, 86 insertions(+), 157 deletions(-) + +diff --git a/apps/speed.c b/apps/speed.c +index 539bfff..f64289e 100644 +--- a/apps/speed.c ++++ b/apps/speed.c +@@ -214,7 +214,7 @@ static void print_result(int alg,int run_no,int count,double time_used); + static int do_multi(int multi); + #endif + +-#define ALGOR_NUM 29 ++#define ALGOR_NUM 30 + #define SIZE_NUM 5 + #define RSA_NUM 4 + #define DSA_NUM 3 +@@ -229,9 +229,11 @@ static const char *names[ALGOR_NUM]={ + "aes-128 cbc","aes-192 cbc","aes-256 cbc", + "camellia-128 cbc","camellia-192 cbc","camellia-256 cbc", + "evp","sha256","sha512","whirlpool", +- "aes-128 ige","aes-192 ige","aes-256 ige"}; ++ "aes-128 ige","aes-192 ige","aes-256 ige","hmac(sha1)"}; + static double results[ALGOR_NUM][SIZE_NUM]; + static int lengths[SIZE_NUM]={16,64,256,1024,8*1024}; ++static unsigned char *buf=NULL,*buf2=NULL; ++static long c[ALGOR_NUM][SIZE_NUM]; + #ifndef OPENSSL_NO_RSA + static double rsa_results[RSA_NUM][2]; + #endif +@@ -329,6 +331,66 @@ static void *KDF1_SHA1(const void *in, size_t inlen, void *out, size_t *outlen) + } + #endif /* OPENSSL_NO_ECDH */ + ++#ifndef SIGALRM ++#define COND(d) (count < (d)) ++#else ++#define COND(c) (run) ++#endif /* SIGALRM */ ++ ++static void Test_Digest(int digest, const EVP_MD *type) ++{ ++ unsigned char md[EVP_MAX_MD_SIZE]; ++ int j, count; ++ double d=0.0; ++ EVP_MD_CTX ctx; ++ ++ EVP_MD_CTX_init(&ctx); ++ EVP_MD_CTX_set_flags(&ctx,EVP_MD_CTX_FLAG_ONESHOT); ++ ++ for (j=0; j