summaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/openssl/openssl-qoriq/qoriq/0018-eng_cryptodev-extend-TLS-offload-with-3des_cbc_hmac_.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/openssl/openssl-qoriq/qoriq/0018-eng_cryptodev-extend-TLS-offload-with-3des_cbc_hmac_.patch')
-rw-r--r--recipes-connectivity/openssl/openssl-qoriq/qoriq/0018-eng_cryptodev-extend-TLS-offload-with-3des_cbc_hmac_.patch193
1 files changed, 193 insertions, 0 deletions
diff --git a/recipes-connectivity/openssl/openssl-qoriq/qoriq/0018-eng_cryptodev-extend-TLS-offload-with-3des_cbc_hmac_.patch b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0018-eng_cryptodev-extend-TLS-offload-with-3des_cbc_hmac_.patch
new file mode 100644
index 0000000..1118a6f
--- /dev/null
+++ b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0018-eng_cryptodev-extend-TLS-offload-with-3des_cbc_hmac_.patch
@@ -0,0 +1,193 @@
1From 21e3ca4ec77f9258aa4001f07faac1c4942b48b4 Mon Sep 17 00:00:00 2001
2From: Tudor Ambarus <tudor.ambarus@freescale.com>
3Date: Fri, 9 May 2014 17:54:06 +0300
4Subject: [PATCH 18/26] eng_cryptodev: extend TLS offload with
5 3des_cbc_hmac_sha1
6
7Both obj_mac.h and obj_dat.h were generated using the scripts
8from crypto/objects:
9
10$ cd crypto/objects
11$ perl objects.pl objects.txt obj_mac.num obj_mac.h
12$ perl obj_dat.pl obj_mac.h obj_dat.h
13
14Change-Id: I94f13cdd09df67e33e6acd3c00aab47cb358ac46
15Signed-off-by: Tudor Ambarus <tudor.ambarus@freescale.com>
16Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
17Reviewed-on: http://git.am.freescale.net:8181/34001
18---
19 crypto/engine/eng_cryptodev.c | 24 ++++++++++++++++++++++++
20 crypto/objects/obj_dat.h | 10 +++++++---
21 crypto/objects/obj_mac.h | 4 ++++
22 crypto/objects/obj_mac.num | 1 +
23 crypto/objects/objects.txt | 1 +
24 ssl/ssl_ciph.c | 4 ++++
25 6 files changed, 41 insertions(+), 3 deletions(-)
26
27diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
28index 79b2678..299e84b 100644
29--- a/crypto/engine/eng_cryptodev.c
30+++ b/crypto/engine/eng_cryptodev.c
31@@ -135,6 +135,7 @@ static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p,
32 void ENGINE_load_cryptodev(void);
33 const EVP_CIPHER cryptodev_aes_128_cbc_hmac_sha1;
34 const EVP_CIPHER cryptodev_aes_256_cbc_hmac_sha1;
35+const EVP_CIPHER cryptodev_3des_cbc_hmac_sha1;
36
37 inline int spcf_bn2bin(BIGNUM *bn, unsigned char **bin, int *bin_len)
38 {
39@@ -252,6 +253,7 @@ static struct {
40 { CRYPTO_BLF_CBC, NID_bf_cbc, 8, 16, 0},
41 { CRYPTO_CAST_CBC, NID_cast5_cbc, 8, 16, 0},
42 { CRYPTO_SKIPJACK_CBC, NID_undef, 0, 0, 0},
43+ { CRYPTO_TLS10_3DES_CBC_HMAC_SHA1, NID_des_ede3_cbc_hmac_sha1, 8, 24, 20},
44 { CRYPTO_TLS10_AES_CBC_HMAC_SHA1, NID_aes_128_cbc_hmac_sha1, 16, 16, 20},
45 { CRYPTO_TLS10_AES_CBC_HMAC_SHA1, NID_aes_256_cbc_hmac_sha1, 16, 32, 20},
46 { CRYPTO_AES_GCM, NID_aes_128_gcm, 16, 16, 0},
47@@ -466,6 +468,9 @@ cryptodev_usable_ciphers(const int **nids)
48 case NID_aes_256_cbc_hmac_sha1:
49 EVP_add_cipher(&cryptodev_aes_256_cbc_hmac_sha1);
50 break;
51+ case NID_des_ede3_cbc_hmac_sha1:
52+ EVP_add_cipher(&cryptodev_3des_cbc_hmac_sha1);
53+ break;
54 }
55 }
56 return count;
57@@ -571,6 +576,7 @@ static int cryptodev_aead_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
58 switch (ctx->cipher->nid) {
59 case NID_aes_128_cbc_hmac_sha1:
60 case NID_aes_256_cbc_hmac_sha1:
61+ case NID_des_ede3_cbc_hmac_sha1:
62 cryp.flags = COP_FLAG_AEAD_TLS_TYPE;
63 }
64 cryp.ses = sess->ses;
65@@ -763,6 +769,7 @@ static int cryptodev_cbc_hmac_sha1_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg,
66 switch (ctx->cipher->nid) {
67 case NID_aes_128_cbc_hmac_sha1:
68 case NID_aes_256_cbc_hmac_sha1:
69+ case NID_des_ede3_cbc_hmac_sha1:
70 maclen = SHA_DIGEST_LENGTH;
71 }
72
73@@ -1082,6 +1089,20 @@ const EVP_CIPHER cryptodev_aes_256_cbc = {
74 NULL
75 };
76
77+const EVP_CIPHER cryptodev_3des_cbc_hmac_sha1 = {
78+ NID_des_ede3_cbc_hmac_sha1,
79+ 8, 24, 8,
80+ EVP_CIPH_CBC_MODE | EVP_CIPH_FLAG_AEAD_CIPHER,
81+ cryptodev_init_aead_key,
82+ cryptodev_aead_cipher,
83+ cryptodev_cleanup,
84+ sizeof(struct dev_crypto_state),
85+ EVP_CIPHER_set_asn1_iv,
86+ EVP_CIPHER_get_asn1_iv,
87+ cryptodev_cbc_hmac_sha1_ctrl,
88+ NULL
89+};
90+
91 const EVP_CIPHER cryptodev_aes_128_cbc_hmac_sha1 = {
92 NID_aes_128_cbc_hmac_sha1,
93 16, 16, 16,
94@@ -1163,6 +1184,9 @@ cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
95 case NID_aes_256_cbc:
96 *cipher = &cryptodev_aes_256_cbc;
97 break;
98+ case NID_des_ede3_cbc_hmac_sha1:
99+ *cipher = &cryptodev_3des_cbc_hmac_sha1;
100+ break;
101 case NID_aes_128_cbc_hmac_sha1:
102 *cipher = &cryptodev_aes_128_cbc_hmac_sha1;
103 break;
104diff --git a/crypto/objects/obj_dat.h b/crypto/objects/obj_dat.h
105index bc69665..9f2267a 100644
106--- a/crypto/objects/obj_dat.h
107+++ b/crypto/objects/obj_dat.h
108@@ -62,9 +62,9 @@
109 * [including the GNU Public Licence.]
110 */
111
112-#define NUM_NID 920
113-#define NUM_SN 913
114-#define NUM_LN 913
115+#define NUM_NID 921
116+#define NUM_SN 914
117+#define NUM_LN 914
118 #define NUM_OBJ 857
119
120 static const unsigned char lvalues[5974]={
121@@ -2399,6 +2399,8 @@ static const ASN1_OBJECT nid_objs[NUM_NID]={
122 {"AES-256-CBC-HMAC-SHA1","aes-256-cbc-hmac-sha1",
123 NID_aes_256_cbc_hmac_sha1,0,NULL,0},
124 {"RSAES-OAEP","rsaesOaep",NID_rsaesOaep,9,&(lvalues[5964]),0},
125+{"DES-EDE3-CBC-HMAC-SHA1","des-ede3-cbc-hmac-sha1",
126+ NID_des_ede3_cbc_hmac_sha1,0,NULL,0},
127 };
128
129 static const unsigned int sn_objs[NUM_SN]={
130@@ -2474,6 +2476,7 @@ static const unsigned int sn_objs[NUM_SN]={
131 62, /* "DES-EDE-OFB" */
132 33, /* "DES-EDE3" */
133 44, /* "DES-EDE3-CBC" */
134+920, /* "DES-EDE3-CBC-HMAC-SHA1" */
135 61, /* "DES-EDE3-CFB" */
136 658, /* "DES-EDE3-CFB1" */
137 659, /* "DES-EDE3-CFB8" */
138@@ -3585,6 +3588,7 @@ static const unsigned int ln_objs[NUM_LN]={
139 62, /* "des-ede-ofb" */
140 33, /* "des-ede3" */
141 44, /* "des-ede3-cbc" */
142+920, /* "des-ede3-cbc-hmac-sha1" */
143 61, /* "des-ede3-cfb" */
144 658, /* "des-ede3-cfb1" */
145 659, /* "des-ede3-cfb8" */
146diff --git a/crypto/objects/obj_mac.h b/crypto/objects/obj_mac.h
147index b5ea7cd..8751902 100644
148--- a/crypto/objects/obj_mac.h
149+++ b/crypto/objects/obj_mac.h
150@@ -4030,3 +4030,7 @@
151 #define LN_aes_256_cbc_hmac_sha1 "aes-256-cbc-hmac-sha1"
152 #define NID_aes_256_cbc_hmac_sha1 918
153
154+#define SN_des_ede3_cbc_hmac_sha1 "DES-EDE3-CBC-HMAC-SHA1"
155+#define LN_des_ede3_cbc_hmac_sha1 "des-ede3-cbc-hmac-sha1"
156+#define NID_des_ede3_cbc_hmac_sha1 920
157+
158diff --git a/crypto/objects/obj_mac.num b/crypto/objects/obj_mac.num
159index 1d0a7c8..9d44bb5 100644
160--- a/crypto/objects/obj_mac.num
161+++ b/crypto/objects/obj_mac.num
162@@ -917,3 +917,4 @@ aes_128_cbc_hmac_sha1 916
163 aes_192_cbc_hmac_sha1 917
164 aes_256_cbc_hmac_sha1 918
165 rsaesOaep 919
166+des_ede3_cbc_hmac_sha1 920
167diff --git a/crypto/objects/objects.txt b/crypto/objects/objects.txt
168index d3bfad7..90d2fc5 100644
169--- a/crypto/objects/objects.txt
170+++ b/crypto/objects/objects.txt
171@@ -1290,3 +1290,4 @@ kisa 1 6 : SEED-OFB : seed-ofb
172 : AES-128-CBC-HMAC-SHA1 : aes-128-cbc-hmac-sha1
173 : AES-192-CBC-HMAC-SHA1 : aes-192-cbc-hmac-sha1
174 : AES-256-CBC-HMAC-SHA1 : aes-256-cbc-hmac-sha1
175+ : DES-EDE3-CBC-HMAC-SHA1 : des-ede3-cbc-hmac-sha1
176diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c
177index 8188ff5..310fe76 100644
178--- a/ssl/ssl_ciph.c
179+++ b/ssl/ssl_ciph.c
180@@ -639,6 +639,10 @@ int ssl_cipher_get_evp(const SSL_SESSION *s, const EVP_CIPHER **enc,
181 c->algorithm_mac == SSL_SHA1 &&
182 (evp=EVP_get_cipherbyname("AES-256-CBC-HMAC-SHA1")))
183 *enc = evp, *md = NULL;
184+ else if (c->algorithm_enc == SSL_3DES &&
185+ c->algorithm_mac == SSL_SHA1 &&
186+ (evp = EVP_get_cipherbyname("DES-EDE3-CBC-HMAC-SHA1")))
187+ *enc = evp, *md = NULL;
188 return(1);
189 }
190 else
191--
1922.3.5
193