summaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/openssl/openssl-qoriq/qoriq/0018-cryptodev-drop-redundant-function.patch
blob: cf6cce26f89b574314456d7d36e10d3afc01d3d9 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From dddb8bc7eea34dfc73c1f5c8863d19894d9a18ac Mon Sep 17 00:00:00 2001
From: Cristian Stoica <cristian.stoica@freescale.com>
Date: Thu, 19 Feb 2015 16:11:53 +0200
Subject: [PATCH 18/48] cryptodev: drop redundant function

get_dev_crypto already caches the result. Another cache in-between is
useless.

Signed-off-by: Cristian Stoica <cristian.stoica@freescale.com>
---
 crypto/engine/eng_cryptodev.c | 17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)

diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c
index 455868e..d229f61 100644
--- a/crypto/engine/eng_cryptodev.c
+++ b/crypto/engine/eng_cryptodev.c
@@ -94,7 +94,6 @@ struct dev_crypto_state {
 
 static u_int32_t cryptodev_asymfeat = 0;
 
-static int get_asym_dev_crypto(void);
 static int open_dev_crypto(void);
 static int get_dev_crypto(void);
 static int get_cryptodev_ciphers(const int **cnids);
@@ -441,16 +440,6 @@ static void put_dev_crypto(int fd)
 # endif
 }
 
-/* Caching version for asym operations */
-static int get_asym_dev_crypto(void)
-{
-    static int fd = -1;
-
-    if (fd == -1)
-        fd = get_dev_crypto();
-    return fd;
-}
-
 /*
  * Find out what ciphers /dev/crypto will let us have a session for.
  * XXX note, that some of these openssl doesn't deal with yet!
@@ -1923,7 +1912,7 @@ cryptodev_asym(struct crypt_kop *kop, int rlen, BIGNUM *r, int slen,
 {
     int fd, ret = -1;
 
-    if ((fd = get_asym_dev_crypto()) < 0)
+    if ((fd = get_dev_crypto()) < 0)
         return ret;
 
     if (r) {
@@ -2522,7 +2511,7 @@ static int cryptodev_rsa_keygen(RSA *rsa, int bits, BIGNUM *e, BN_GENCB *cb)
     int p_len, q_len;
     int i;
 
-    if ((fd = get_asym_dev_crypto()) < 0)
+    if ((fd = get_dev_crypto()) < 0)
         goto sw_try;
 
     if (!rsa->n && ((rsa->n = BN_new()) == NULL))
@@ -4111,7 +4100,7 @@ cryptodev_dh_compute_key(unsigned char *key, const BIGNUM *pub_key, DH *dh)
     BIGNUM *temp = NULL;
     unsigned char *padded_pub_key = NULL, *p = NULL;
 
-    if ((fd = get_asym_dev_crypto()) < 0)
+    if ((fd = get_dev_crypto()) < 0)
         goto sw_try;
 
     memset(&kop, 0, sizeof kop);
-- 
2.7.3