summaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/openssl/openssl-fsl/0014-SW-Backoff-mechanism-for-dsa-keygen.patch
blob: e5aa1baa33c3c4d8e54420fa33154f709c65d3f7 (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
44
45
46
47
48
49
50
51
52
53
From 8b1ed323d08dce8b6e303ce63a82337543e9187f Mon Sep 17 00:00:00 2001
From: Yashpal Dutta <yashpal.dutta@freescale.com>
Date: Thu, 24 Apr 2014 00:35:34 +0545
Subject: [PATCH][fsl 14/15] SW Backoff mechanism for dsa keygen

Upstream-status: Pending

DSA Keygen is not handled in default openssl dsa method. Due to
same null function pointer in SW DSA method, the backoff for dsa
keygen gives segmentation fault.

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

diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
index 8de8f09..7c2661f 100644
--- a/crypto/engine/eng_cryptodev.c
+++ b/crypto/engine/eng_cryptodev.c
@@ -2075,8 +2075,10 @@ static int cryptodev_dsa_keygen(DSA *dsa)
 	return ret;
 sw_try:
 	{
-		const DSA_METHOD *meth = DSA_OpenSSL();
-		ret = (meth->dsa_keygen)(dsa);
+		const DSA_METHOD *meth = dsa->meth;
+		dsa->meth = DSA_OpenSSL();
+		ret = DSA_generate_key(dsa);
+		dsa->meth = meth;
 	}
 	return ret;
 }
@@ -2130,11 +2132,13 @@ static int cryptodev_dsa_keygen_async(DSA *dsa,  struct pkc_cookie_s *cookie)
 	return ret;
 sw_try:
 	{
-		const DSA_METHOD *meth = DSA_OpenSSL();
+		const DSA_METHOD *meth = dsa->meth;
 
+		dsa->meth = DSA_OpenSSL();
 		if (kop)
 			free(kop);
-		ret = (meth->dsa_keygen)(dsa);
+		ret = DSA_generate_key(dsa);
+		dsa->meth = meth;
 		cookie->pkc_callback(cookie, 0);
 	}
 	return ret;
-- 
1.7.9.7