summaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/openssl/openssl-qoriq/qoriq/0005-Initial-support-for-PKC-in-cryptodev-engine.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/openssl/openssl-qoriq/qoriq/0005-Initial-support-for-PKC-in-cryptodev-engine.patch')
-rw-r--r--recipes-connectivity/openssl/openssl-qoriq/qoriq/0005-Initial-support-for-PKC-in-cryptodev-engine.patch48
1 files changed, 24 insertions, 24 deletions
diff --git a/recipes-connectivity/openssl/openssl-qoriq/qoriq/0005-Initial-support-for-PKC-in-cryptodev-engine.patch b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0005-Initial-support-for-PKC-in-cryptodev-engine.patch
index ad253064..156b7434 100644
--- a/recipes-connectivity/openssl/openssl-qoriq/qoriq/0005-Initial-support-for-PKC-in-cryptodev-engine.patch
+++ b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0005-Initial-support-for-PKC-in-cryptodev-engine.patch
@@ -1,4 +1,4 @@
1From e28df2a5c63dc6195a6065bfd7de9fc860129f56 Mon Sep 17 00:00:00 2001 1From aff25bbf6b5b833931a5281d30a6f26fda9f0a52 Mon Sep 17 00:00:00 2001
2From: Yashpal Dutta <yashpal.dutta@freescale.com> 2From: Yashpal Dutta <yashpal.dutta@freescale.com>
3Date: Tue, 11 Mar 2014 06:29:52 +0545 3Date: Tue, 11 Mar 2014 06:29:52 +0545
4Subject: [PATCH 05/48] Initial support for PKC in cryptodev engine 4Subject: [PATCH 05/48] Initial support for PKC in cryptodev engine
@@ -11,10 +11,10 @@ Signed-off-by: Yashpal Dutta <yashpal.dutta@freescale.com>
11 1 file changed, 1202 insertions(+), 163 deletions(-) 11 1 file changed, 1202 insertions(+), 163 deletions(-)
12 12
13diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c 13diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
14index 3b6515e..0b41bb2 100644 14index 49ed638..cc9b63b 100644
15--- a/crypto/engine/eng_cryptodev.c 15--- a/crypto/engine/eng_cryptodev.c
16+++ b/crypto/engine/eng_cryptodev.c 16+++ b/crypto/engine/eng_cryptodev.c
17@@ -58,6 +58,10 @@ void ENGINE_load_cryptodev(void) 17@@ -59,6 +59,10 @@ void ENGINE_load_cryptodev(void)
18 # include <openssl/dsa.h> 18 # include <openssl/dsa.h>
19 # include <openssl/err.h> 19 # include <openssl/err.h>
20 # include <openssl/rsa.h> 20 # include <openssl/rsa.h>
@@ -25,7 +25,7 @@ index 3b6515e..0b41bb2 100644
25 # include <sys/ioctl.h> 25 # include <sys/ioctl.h>
26 # include <errno.h> 26 # include <errno.h>
27 # include <stdio.h> 27 # include <stdio.h>
28@@ -67,6 +71,7 @@ void ENGINE_load_cryptodev(void) 28@@ -68,6 +72,7 @@ void ENGINE_load_cryptodev(void)
29 # include <syslog.h> 29 # include <syslog.h>
30 # include <errno.h> 30 # include <errno.h>
31 # include <string.h> 31 # include <string.h>
@@ -33,7 +33,7 @@ index 3b6515e..0b41bb2 100644
33 33
34 struct dev_crypto_state { 34 struct dev_crypto_state {
35 struct session_op d_sess; 35 struct session_op d_sess;
36@@ -115,20 +120,10 @@ static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, 36@@ -116,20 +121,10 @@ static int cryptodev_rsa_nocrt_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
37 BN_CTX *ctx); 37 BN_CTX *ctx);
38 static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, 38 static int cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,
39 BN_CTX *ctx); 39 BN_CTX *ctx);
@@ -54,7 +54,7 @@ index 3b6515e..0b41bb2 100644
54 static int cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, 54 static int cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key,
55 DH *dh); 55 DH *dh);
56 static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p, 56 static int cryptodev_ctrl(ENGINE *e, int cmd, long i, void *p,
57@@ -137,6 +132,105 @@ void ENGINE_load_cryptodev(void); 57@@ -138,6 +133,105 @@ void ENGINE_load_cryptodev(void);
58 const EVP_CIPHER cryptodev_aes_128_cbc_hmac_sha1; 58 const EVP_CIPHER cryptodev_aes_128_cbc_hmac_sha1;
59 const EVP_CIPHER cryptodev_aes_256_cbc_hmac_sha1; 59 const EVP_CIPHER cryptodev_aes_256_cbc_hmac_sha1;
60 60
@@ -160,7 +160,7 @@ index 3b6515e..0b41bb2 100644
160 static const ENGINE_CMD_DEFN cryptodev_defns[] = { 160 static const ENGINE_CMD_DEFN cryptodev_defns[] = {
161 {0, NULL, NULL, 0} 161 {0, NULL, NULL, 0}
162 }; 162 };
163@@ -1225,7 +1319,6 @@ cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest, 163@@ -1230,7 +1324,6 @@ cryptodev_engine_digests(ENGINE *e, const EVP_MD **digest,
164 */ 164 */
165 static int bn2crparam(const BIGNUM *a, struct crparam *crp) 165 static int bn2crparam(const BIGNUM *a, struct crparam *crp)
166 { 166 {
@@ -168,7 +168,7 @@ index 3b6515e..0b41bb2 100644
168 ssize_t bytes, bits; 168 ssize_t bytes, bits;
169 u_char *b; 169 u_char *b;
170 170
171@@ -1243,36 +1336,21 @@ static int bn2crparam(const BIGNUM *a, struct crparam *crp) 171@@ -1248,36 +1341,21 @@ static int bn2crparam(const BIGNUM *a, struct crparam *crp)
172 crp->crp_p = (caddr_t) b; 172 crp->crp_p = (caddr_t) b;
173 crp->crp_nbits = bits; 173 crp->crp_nbits = bits;
174 174
@@ -208,8 +208,8 @@ index 3b6515e..0b41bb2 100644
208 208
209 return (0); 209 return (0);
210 } 210 }
211@@ -1321,6 +1399,32 @@ cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen, 211@@ -1334,6 +1412,32 @@ cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen,
212 return (ret); 212 return ret;
213 } 213 }
214 214
215+/* Close an opened instance of cryptodev engine */ 215+/* Close an opened instance of cryptodev engine */
@@ -241,7 +241,7 @@ index 3b6515e..0b41bb2 100644
241 static int 241 static int
242 cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 242 cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
243 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 243 const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
244@@ -1337,8 +1441,9 @@ cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 244@@ -1350,8 +1454,9 @@ cryptodev_bn_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
245 return (ret); 245 return (ret);
246 } 246 }
247 247
@@ -252,7 +252,7 @@ index 3b6515e..0b41bb2 100644
252 252
253 /* inputs: a^p % m */ 253 /* inputs: a^p % m */
254 if (bn2crparam(a, &kop.crk_param[0])) 254 if (bn2crparam(a, &kop.crk_param[0]))
255@@ -1381,28 +1486,39 @@ static int 255@@ -1394,28 +1499,39 @@ static int
256 cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) 256 cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
257 { 257 {
258 struct crypt_kop kop; 258 struct crypt_kop kop;
@@ -306,7 +306,7 @@ index 3b6515e..0b41bb2 100644
306 kop.crk_iparams = 6; 306 kop.crk_iparams = 6;
307 307
308 if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL)) { 308 if (cryptodev_asym(&kop, BN_num_bytes(rsa->n), r0, 0, NULL)) {
309@@ -1438,93 +1554,120 @@ static RSA_METHOD cryptodev_rsa = { 309@@ -1451,93 +1567,120 @@ static RSA_METHOD cryptodev_rsa = {
310 NULL /* rsa_verify */ 310 NULL /* rsa_verify */
311 }; 311 };
312 312
@@ -491,7 +491,7 @@ index 3b6515e..0b41bb2 100644
491 } 491 }
492 492
493 static int 493 static int
494@@ -1532,43 +1675,175 @@ cryptodev_dsa_verify(const unsigned char *dgst, int dlen, 494@@ -1545,43 +1688,175 @@ cryptodev_dsa_verify(const unsigned char *dgst, int dlen,
495 DSA_SIG *sig, DSA *dsa) 495 DSA_SIG *sig, DSA *dsa)
496 { 496 {
497 struct crypt_kop kop; 497 struct crypt_kop kop;
@@ -516,7 +516,8 @@ index 3b6515e..0b41bb2 100644
516+ /* Get Order of field of private keys */ 516+ /* Get Order of field of private keys */
517+ if (spcf_bn2bin(dsa->q, &r, &r_len)) { 517+ if (spcf_bn2bin(dsa->q, &r, &r_len)) {
518+ DSAerr(DSA_F_DSA_DO_VERIFY, ERR_R_MALLOC_FAILURE); 518+ DSAerr(DSA_F_DSA_DO_VERIFY, ERR_R_MALLOC_FAILURE);
519+ goto err; 519 goto err;
520- if (bn2crparam(dsa->q, &kop.crk_param[2]))
520+ } 521+ }
521+ 522+
522+ g_len = q_len; 523+ g_len = q_len;
@@ -526,8 +527,7 @@ index 3b6515e..0b41bb2 100644
526+ */ 527+ */
527+ if (spcf_bn2bin_ex(dsa->g, &g, &g_len)) { 528+ if (spcf_bn2bin_ex(dsa->g, &g, &g_len)) {
528+ DSAerr(DSA_F_DSA_DO_VERIFY, ERR_R_MALLOC_FAILURE); 529+ DSAerr(DSA_F_DSA_DO_VERIFY, ERR_R_MALLOC_FAILURE);
529 goto err; 530+ goto err;
530- if (bn2crparam(dsa->q, &kop.crk_param[2]))
531+ } 531+ }
532+ w_len = q_len; 532+ w_len = q_len;
533+ /** 533+ /**
@@ -688,7 +688,7 @@ index 3b6515e..0b41bb2 100644
688 } 688 }
689 689
690 static DSA_METHOD cryptodev_dsa = { 690 static DSA_METHOD cryptodev_dsa = {
691@@ -1584,12 +1859,558 @@ static DSA_METHOD cryptodev_dsa = { 691@@ -1597,12 +1872,558 @@ static DSA_METHOD cryptodev_dsa = {
692 NULL /* app_data */ 692 NULL /* app_data */
693 }; 693 };
694 694
@@ -1252,7 +1252,7 @@ index 3b6515e..0b41bb2 100644
1252 } 1252 }
1253 1253
1254 static int 1254 static int
1255@@ -1597,41 +2418,236 @@ cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh) 1255@@ -1610,41 +2431,236 @@ cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
1256 { 1256 {
1257 struct crypt_kop kop; 1257 struct crypt_kop kop;
1258 int dhret = 1; 1258 int dhret = 1;
@@ -1416,7 +1416,7 @@ index 3b6515e..0b41bb2 100644
1416+ ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_EC_LIB); 1416+ ECDSAerr(ECDSA_F_ECDSA_DO_SIGN, ERR_R_EC_LIB);
1417+ goto err; 1417+ goto err;
1418+ } 1418+ }
1419+ } 1419 }
1420+ 1420+
1421+ /* irreducible polynomial that creates the field */ 1421+ /* irreducible polynomial that creates the field */
1422+ if (spcf_bn2bin((BIGNUM *)&group->order, &r, &r_len)) { 1422+ if (spcf_bn2bin((BIGNUM *)&group->order, &r, &r_len)) {
@@ -1477,7 +1477,7 @@ index 3b6515e..0b41bb2 100644
1477+ if (len > buflen || q_len < buflen) { 1477+ if (len > buflen || q_len < buflen) {
1478+ ECDHerr(ECDH_F_ECDH_COMPUTE_KEY, ERR_R_INTERNAL_ERROR); 1478+ ECDHerr(ECDH_F_ECDH_COMPUTE_KEY, ERR_R_INTERNAL_ERROR);
1479+ goto err; 1479+ goto err;
1480 } 1480+ }
1481+ 1481+
1482+ kop.crk_op = CRK_DH_COMPUTE_KEY; 1482+ kop.crk_op = CRK_DH_COMPUTE_KEY;
1483+ kop.crk_param[0].crp_p = (void *)s; 1483+ kop.crk_param[0].crp_p = (void *)s;
@@ -1507,7 +1507,7 @@ index 3b6515e..0b41bb2 100644
1507 } 1507 }
1508 1508
1509 static DH_METHOD cryptodev_dh = { 1509 static DH_METHOD cryptodev_dh = {
1510@@ -1645,6 +2661,14 @@ static DH_METHOD cryptodev_dh = { 1510@@ -1658,6 +2674,14 @@ static DH_METHOD cryptodev_dh = {
1511 NULL /* app_data */ 1511 NULL /* app_data */
1512 }; 1512 };
1513 1513
@@ -1522,7 +1522,7 @@ index 3b6515e..0b41bb2 100644
1522 /* 1522 /*
1523 * ctrl right now is just a wrapper that doesn't do much 1523 * ctrl right now is just a wrapper that doesn't do much
1524 * but I expect we'll want some options soon. 1524 * but I expect we'll want some options soon.
1525@@ -1724,24 +2748,39 @@ void ENGINE_load_cryptodev(void) 1525@@ -1737,24 +2761,39 @@ void ENGINE_load_cryptodev(void)
1526 memcpy(&cryptodev_dsa, meth, sizeof(DSA_METHOD)); 1526 memcpy(&cryptodev_dsa, meth, sizeof(DSA_METHOD));
1527 if (cryptodev_asymfeat & CRF_DSA_SIGN) 1527 if (cryptodev_asymfeat & CRF_DSA_SIGN)
1528 cryptodev_dsa.dsa_do_sign = cryptodev_dsa_do_sign; 1528 cryptodev_dsa.dsa_do_sign = cryptodev_dsa_do_sign;
@@ -1574,5 +1574,5 @@ index 3b6515e..0b41bb2 100644
1574 } 1574 }
1575 1575
1576-- 1576--
15772.7.0 15772.7.3
1578 1578