diff options
Diffstat (limited to 'recipes-connectivity/openssl/openssl-qoriq/qoriq/0042-cryptodev-check-for-errors-inside-cryptodev_rsa_mod_.patch')
-rw-r--r-- | recipes-connectivity/openssl/openssl-qoriq/qoriq/0042-cryptodev-check-for-errors-inside-cryptodev_rsa_mod_.patch | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/recipes-connectivity/openssl/openssl-qoriq/qoriq/0042-cryptodev-check-for-errors-inside-cryptodev_rsa_mod_.patch b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0042-cryptodev-check-for-errors-inside-cryptodev_rsa_mod_.patch new file mode 100644 index 0000000..218accb --- /dev/null +++ b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0042-cryptodev-check-for-errors-inside-cryptodev_rsa_mod_.patch @@ -0,0 +1,69 @@ +From 402a2e4da471728fa537462d7a13aa35955cd6d8 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica <cristian.stoica@nxp.com> +Date: Tue, 9 Feb 2016 11:47:52 +0200 +Subject: [PATCH 42/48] cryptodev: check for errors inside + cryptodev_rsa_mod_exp_async + +Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com> +--- + crypto/engine/eng_cryptodev.c | 33 +++++++++++++++++++++++++-------- + 1 file changed, 25 insertions(+), 8 deletions(-) + +diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c +index 695848d..8e84972 100644 +--- a/crypto/engine/eng_cryptodev.c ++++ b/crypto/engine/eng_cryptodev.c +@@ -2109,25 +2109,42 @@ static int + cryptodev_rsa_mod_exp_async(BIGNUM *r0, const BIGNUM *I, RSA *rsa, + BN_CTX *ctx, struct pkc_cookie_s *cookie) + { +- struct crypt_kop *kop = malloc(sizeof(struct crypt_kop)); ++ struct crypt_kop *kop; + int ret = 1, f_len, p_len, q_len; + unsigned char *f = NULL, *p = NULL, *q = NULL, *dp = NULL, *dq = + NULL, *c = NULL; + +- if (!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp || !kop) { ++ if (!rsa->p || !rsa->q || !rsa->dmp1 || !rsa->dmq1 || !rsa->iqmp) { + return (0); + } + ++ kop = malloc(sizeof(struct crypt_kop)); ++ if (kop == NULL) { ++ goto err; ++ } ++ + kop->crk_oparams = 0; + 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 + |