aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/openssl/openssl-qoriq/qoriq/0041-cryptodev-check-for-errors-inside-cryptodev_rsa_mod_.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/openssl/openssl-qoriq/qoriq/0041-cryptodev-check-for-errors-inside-cryptodev_rsa_mod_.patch')
-rw-r--r--recipes-connectivity/openssl/openssl-qoriq/qoriq/0041-cryptodev-check-for-errors-inside-cryptodev_rsa_mod_.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/recipes-connectivity/openssl/openssl-qoriq/qoriq/0041-cryptodev-check-for-errors-inside-cryptodev_rsa_mod_.patch b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0041-cryptodev-check-for-errors-inside-cryptodev_rsa_mod_.patch
new file mode 100644
index 0000000..5525045
--- /dev/null
+++ b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0041-cryptodev-check-for-errors-inside-cryptodev_rsa_mod_.patch
@@ -0,0 +1,49 @@
+From f10d471839dff079a23d79d1b4ecb3e3e6529283 Mon Sep 17 00:00:00 2001
+From: Cristian Stoica <cristian.stoica@nxp.com>
+Date: Mon, 8 Feb 2016 17:04:25 +0200
+Subject: [PATCH 41/48] cryptodev: check for errors inside
+ cryptodev_rsa_mod_exp
+
+Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
+---
+ crypto/engine/eng_cryptodev.c | 24 ++++++++++++++++++------
+ 1 file changed, 18 insertions(+), 6 deletions(-)
+
+diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
+index f172173..695848d 100644
+--- a/crypto/engine/eng_cryptodev.c
++++ b/crypto/engine/eng_cryptodev.c
+@@ -2054,12 +2054,24 @@ cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
+ kop.crk_status = 0;
+ kop.crk_op = CRK_MOD_EXP_CRT;
+ f_len = BN_num_bytes(rsa->n);
+- spcf_bn2bin_ex(I, &f, &f_len);
+- spcf_bn2bin(rsa->p, &p, &p_len);
+- spcf_bn2bin(rsa->q, &q, &q_len);
+- spcf_bn2bin_ex(rsa->dmp1, &dp, &p_len);
+- spcf_bn2bin_ex(rsa->iqmp, &c, &p_len);
+- spcf_bn2bin_ex(rsa->dmq1, &dq, &q_len);
++ if (spcf_bn2bin_ex(I, &f, &f_len) != 0) {
++ goto err;
++ }
++ if (spcf_bn2bin(rsa->p, &p, &p_len) != 0) {
++ goto err;
++ }
++ if (spcf_bn2bin(rsa->q, &q, &q_len) != 0) {
++ goto err;
++ }
++ if (spcf_bn2bin_ex(rsa->dmp1, &dp, &p_len) != 0) {
++ goto err;
++ }
++ if (spcf_bn2bin_ex(rsa->iqmp, &c, &p_len) != 0) {
++ goto err;
++ }
++ if (spcf_bn2bin_ex(rsa->dmq1, &dq, &q_len) != 0) {
++ goto err;
++ }
+ /* inputs: rsa->p rsa->q I rsa->dmp1 rsa->dmq1 rsa->iqmp */
+ kop.crk_param[0].crp_p = p;
+ kop.crk_param[0].crp_nbits = p_len * 8;
+--
+2.7.0
+