summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>2018-08-28 12:23:13 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-09-04 11:03:56 +0100
commit1343314af942b58fb659b06221d3df6ab299e35c (patch)
tree34b5c4617301e26c725f163d15624c655203bab4
parentdf15a4c914177024f1825aacb4701fd232e1dd58 (diff)
downloadpoky-1343314af942b58fb659b06221d3df6ab299e35c.tar.gz
cryptodev-tests: port to openssl 1.1
This leaves openssh as the only recipe that requires openssl 1.0 (or libressl). (From OE-Core rev: 8b3711f32f0e25961762cbc77ae2e10628ecdf07) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-kernel/cryptodev/cryptodev-tests_1.9.bb3
-rw-r--r--meta/recipes-kernel/cryptodev/files/0001-Port-tests-to-openssl-1.1.patch103
2 files changed, 105 insertions, 1 deletions
diff --git a/meta/recipes-kernel/cryptodev/cryptodev-tests_1.9.bb b/meta/recipes-kernel/cryptodev/cryptodev-tests_1.9.bb
index 9afb3de217..617db6cdd3 100644
--- a/meta/recipes-kernel/cryptodev/cryptodev-tests_1.9.bb
+++ b/meta/recipes-kernel/cryptodev/cryptodev-tests_1.9.bb
@@ -2,10 +2,11 @@ require cryptodev.inc
2 2
3SUMMARY = "A test suite for /dev/crypto device driver" 3SUMMARY = "A test suite for /dev/crypto device driver"
4 4
5DEPENDS += "openssl10" 5DEPENDS += "openssl"
6 6
7SRC_URI += " \ 7SRC_URI += " \
8file://0001-Add-the-compile-and-install-rules-for-cryptodev-test.patch \ 8file://0001-Add-the-compile-and-install-rules-for-cryptodev-test.patch \
9file://0001-Port-tests-to-openssl-1.1.patch \
9" 10"
10 11
11EXTRA_OEMAKE='KERNEL_DIR="${STAGING_EXECPREFIXDIR}" PREFIX="${D}"' 12EXTRA_OEMAKE='KERNEL_DIR="${STAGING_EXECPREFIXDIR}" PREFIX="${D}"'
diff --git a/meta/recipes-kernel/cryptodev/files/0001-Port-tests-to-openssl-1.1.patch b/meta/recipes-kernel/cryptodev/files/0001-Port-tests-to-openssl-1.1.patch
new file mode 100644
index 0000000000..c9691265f6
--- /dev/null
+++ b/meta/recipes-kernel/cryptodev/files/0001-Port-tests-to-openssl-1.1.patch
@@ -0,0 +1,103 @@
1From 2fe4bdeb8cdd0b0f46d9caed807812855d51ea56 Mon Sep 17 00:00:00 2001
2From: Alexander Kanavin <alex.kanavin@gmail.com>
3Date: Wed, 28 Mar 2018 20:11:05 +0300
4Subject: [PATCH] Port tests to openssl 1.1
5
6Upstream-Status: Accepted [https://github.com/cryptodev-linux/cryptodev-linux/pull/36]
7Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
8
9---
10 tests/openssl_wrapper.c | 33 +++++++++++++++++++++++++++++++++
11 1 file changed, 33 insertions(+)
12
13diff --git a/tests/openssl_wrapper.c b/tests/openssl_wrapper.c
14index 038c58f..dea2496 100644
15--- a/tests/openssl_wrapper.c
16+++ b/tests/openssl_wrapper.c
17@@ -4,6 +4,7 @@
18 #include <openssl/aes.h>
19 #include <openssl/evp.h>
20 #include <openssl/hmac.h>
21+#include <openssl/opensslv.h>
22
23 //#define DEBUG
24
25@@ -23,10 +24,17 @@ enum ctx_type {
26 ctx_type_md,
27 };
28
29+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
30+union openssl_ctx {
31+ HMAC_CTX *hmac;
32+ EVP_MD_CTX *md;
33+};
34+#else
35 union openssl_ctx {
36 HMAC_CTX hmac;
37 EVP_MD_CTX md;
38 };
39+#endif
40
41 struct ctx_mapping {
42 __u32 ses;
43@@ -63,6 +71,16 @@ static void remove_mapping(__u32 ses)
44 switch (mapping->type) {
45 case ctx_type_none:
46 break;
47+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
48+ case ctx_type_hmac:
49+ dbgp("%s: calling HMAC_CTX_free\n", __func__);
50+ HMAC_CTX_free(mapping->ctx.hmac);
51+ break;
52+ case ctx_type_md:
53+ dbgp("%s: calling EVP_MD_CTX_free\n", __func__);
54+ EVP_MD_CTX_free(mapping->ctx.md);
55+ break;
56+#else
57 case ctx_type_hmac:
58 dbgp("%s: calling HMAC_CTX_cleanup\n", __func__);
59 HMAC_CTX_cleanup(&mapping->ctx.hmac);
60@@ -71,6 +89,7 @@ static void remove_mapping(__u32 ses)
61 dbgp("%s: calling EVP_MD_CTX_cleanup\n", __func__);
62 EVP_MD_CTX_cleanup(&mapping->ctx.md);
63 break;
64+#endif
65 }
66 memset(mapping, 0, sizeof(*mapping));
67 }
68@@ -127,10 +146,17 @@ static int openssl_hmac(struct session_op *sess, struct crypt_op *cop)
69
70 mapping->ses = sess->ses;
71 mapping->type = ctx_type_hmac;
72+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
73+ ctx = mapping->ctx.hmac;
74+
75+ dbgp("calling HMAC_CTX_new");
76+ ctx = HMAC_CTX_new();
77+#else
78 ctx = &mapping->ctx.hmac;
79
80 dbgp("calling HMAC_CTX_init");
81 HMAC_CTX_init(ctx);
82+#endif
83 dbgp("calling HMAC_Init_ex");
84 if (!HMAC_Init_ex(ctx, sess->mackey, sess->mackeylen,
85 sess_to_evp_md(sess), NULL)) {
86@@ -172,10 +198,17 @@ static int openssl_md(struct session_op *sess, struct crypt_op *cop)
87
88 mapping->ses = sess->ses;
89 mapping->type = ctx_type_md;
90+#if OPENSSL_VERSION_NUMBER >= 0x10100000L
91+ ctx = mapping->ctx.md;
92+
93+ dbgp("calling EVP_MD_CTX_new");
94+ ctx = EVP_MD_CTX_new();
95+#else
96 ctx = &mapping->ctx.md;
97
98 dbgp("calling EVP_MD_CTX_init");
99 EVP_MD_CTX_init(ctx);
100+#endif
101 dbgp("calling EVP_DigestInit");
102 EVP_DigestInit(ctx, sess_to_evp_md(sess));
103 }