aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/openssl/openssl-qoriq/qoriq/0011-Modulus-parameter-is-not-populated-by-dhparams.patch
blob: 13aea0156605300afc89ed605b6b2de62d0563ee (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
From f9d9da58818740334ef356d0384d4e88da865dca Mon Sep 17 00:00:00 2001
From: Yashpal Dutta <yashpal.dutta@freescale.com>
Date: Tue, 22 Apr 2014 22:58:33 +0545
Subject: [PATCH 11/48] Modulus parameter is not populated by dhparams

Upstream-status: Pending

When dhparams are created, modulus parameter required for
private key generation is not populated. So, falling back
to software for proper population of modulus parameters followed
by private key generation

Signed-off-by: Yashpal Dutta <yashpal.dutta@freescale.com>
Tested-by: Cristian Stoica <cristian.stoica@freescale.com>
---
 crypto/engine/eng_cryptodev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
index 151774c..1f1f307 100644
--- a/crypto/engine/eng_cryptodev.c
+++ b/crypto/engine/eng_cryptodev.c
@@ -3502,7 +3502,7 @@ static int cryptodev_dh_keygen_async(DH *dh, struct pkc_cookie_s *cookie)
     kop->crk_op = CRK_DH_GENERATE_KEY;
     if (bn2crparam(dh->p, &kop->crk_param[0]))
         goto sw_try;
-    if (bn2crparam(dh->q, &kop->crk_param[1]))
+    if (!dh->q || bn2crparam(dh->q, &kop->crk_param[1]))
         goto sw_try;
     kop->crk_param[2].crp_p = g;
     kop->crk_param[2].crp_nbits = g_len * 8;
@@ -3557,7 +3557,7 @@ static int cryptodev_dh_keygen(DH *dh)
     kop.crk_op = CRK_DH_GENERATE_KEY;
     if (bn2crparam(dh->p, &kop.crk_param[0]))
         goto sw_try;
-    if (bn2crparam(dh->q, &kop.crk_param[1]))
+    if (!dh->q || bn2crparam(dh->q, &kop.crk_param[1]))
         goto sw_try;
     kop.crk_param[2].crp_p = g;
     kop.crk_param[2].crp_nbits = g_len * 8;
-- 
2.7.0