1 From f10d471839dff079a23d79d1b4ecb3e3e6529283 Mon Sep 17 00:00:00 2001
2 From: Cristian Stoica <cristian.stoica@nxp.com>
3 Date: Mon, 8 Feb 2016 17:04:25 +0200
4 Subject: [PATCH 41/48] cryptodev: check for errors inside
7 Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
9 crypto/engine/eng_cryptodev.c | 24 ++++++++++++++++++------
10 1 file changed, 18 insertions(+), 6 deletions(-)
12 diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
13 index f172173..695848d 100644
14 --- a/crypto/engine/eng_cryptodev.c
15 +++ b/crypto/engine/eng_cryptodev.c
16 @@ -2054,12 +2054,24 @@ cryptodev_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)
18 kop.crk_op = CRK_MOD_EXP_CRT;
19 f_len = BN_num_bytes(rsa->n);
20 - spcf_bn2bin_ex(I, &f, &f_len);
21 - spcf_bn2bin(rsa->p, &p, &p_len);
22 - spcf_bn2bin(rsa->q, &q, &q_len);
23 - spcf_bn2bin_ex(rsa->dmp1, &dp, &p_len);
24 - spcf_bn2bin_ex(rsa->iqmp, &c, &p_len);
25 - spcf_bn2bin_ex(rsa->dmq1, &dq, &q_len);
26 + if (spcf_bn2bin_ex(I, &f, &f_len) != 0) {
29 + if (spcf_bn2bin(rsa->p, &p, &p_len) != 0) {
32 + if (spcf_bn2bin(rsa->q, &q, &q_len) != 0) {
35 + if (spcf_bn2bin_ex(rsa->dmp1, &dp, &p_len) != 0) {
38 + if (spcf_bn2bin_ex(rsa->iqmp, &c, &p_len) != 0) {
41 + if (spcf_bn2bin_ex(rsa->dmq1, &dq, &q_len) != 0) {
44 /* inputs: rsa->p rsa->q I rsa->dmp1 rsa->dmq1 rsa->iqmp */
45 kop.crk_param[0].crp_p = p;
46 kop.crk_param[0].crp_nbits = p_len * 8;