diff options
Diffstat (limited to 'recipes-connectivity/openssl/openssl-qoriq/qoriq/0030-cryptodev-reduce-duplicated-efforts-for-searching-in.patch')
-rw-r--r-- | recipes-connectivity/openssl/openssl-qoriq/qoriq/0030-cryptodev-reduce-duplicated-efforts-for-searching-in.patch | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/recipes-connectivity/openssl/openssl-qoriq/qoriq/0030-cryptodev-reduce-duplicated-efforts-for-searching-in.patch b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0030-cryptodev-reduce-duplicated-efforts-for-searching-in.patch new file mode 100644 index 0000000..995a593 --- /dev/null +++ b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0030-cryptodev-reduce-duplicated-efforts-for-searching-in.patch @@ -0,0 +1,106 @@ +From 12fad710349bb72b7f95ee30b40c2e6dfbb5d373 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica <cristian.stoica@nxp.com> +Date: Wed, 13 Jan 2016 15:18:20 +0200 +Subject: [PATCH 30/48] cryptodev: reduce duplicated efforts for searching + inside digests table + +Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com> +--- + crypto/engine/eng_cryptodev.c | 44 ++++++++++++++++++------------------------- + 1 file changed, 18 insertions(+), 26 deletions(-) + +diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c +index dc27b55..30713e5 100644 +--- a/crypto/engine/eng_cryptodev.c ++++ b/crypto/engine/eng_cryptodev.c +@@ -1533,37 +1533,31 @@ cryptodev_engine_ciphers(ENGINE *e, const EVP_CIPHER **cipher, + + # ifdef USE_CRYPTODEV_DIGESTS + +-/* convert digest type to cryptodev */ +-static int digest_nid_to_cryptodev(int nid) ++static int digest_nid_to_id(int nid) + { + int i; + +- for (i = 0; digests[i].id; i++) +- if (digests[i].nid == nid) +- return (digests[i].id); +- return (0); +-} +- +-static int digest_key_length(int nid) +-{ +- int i; +- +- for (i = 0; digests[i].id; i++) +- if (digests[i].nid == nid) +- return digests[i].keylen; +- return (0); ++ for (i = 0;; i++) { ++ if ((digests[i].nid == nid) || (digests[i].id == 0)) { ++ break; ++ } ++ } ++ return i; + } + + static int cryptodev_digest_init(EVP_MD_CTX *ctx) + { + struct dev_crypto_state *state = ctx->md_data; + struct hash_op_data *hash_op = &state->hash_op; +- int digest; ++ int id; + + memset(state, 0, sizeof(struct dev_crypto_state)); + +- digest = digest_nid_to_cryptodev(ctx->digest->type); +- if (digest == NID_undef) { ++ id = digest_nid_to_id(ctx->digest->type); ++ ++ hash_op->mac_op = digests[id].id; ++ hash_op->mackeylen = digests[id].keylen; ++ if (hash_op->mac_op == 0) { + printf("%s: Can't get digest\n", __func__); + return (0); + } +@@ -1574,11 +1568,9 @@ static int cryptodev_digest_init(EVP_MD_CTX *ctx) + return (0); + } + +- hash_op->mac_op = digest; + hash_op->mackey = state->dummy_mac_key; +- hash_op->mackeylen = digest_key_length(ctx->digest->type); + +- return (1); ++ return 1; + } + + static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data, +@@ -1668,7 +1660,7 @@ static int cryptodev_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) + struct dev_crypto_state *fstate = from->md_data; + struct dev_crypto_state *dstate = to->md_data; + struct session_op *sess; +- int digest; ++ int id; + + if (dstate == NULL || fstate == NULL) + return 1; +@@ -1677,11 +1669,11 @@ static int cryptodev_digest_copy(EVP_MD_CTX *to, const EVP_MD_CTX *from) + + sess = &dstate->d_sess; + +- digest = digest_nid_to_cryptodev(to->digest->type); ++ id = digest_nid_to_id(to->digest->type); + + sess->mackey = dstate->dummy_mac_key; +- sess->mackeylen = digest_key_length(to->digest->type); +- sess->mac = digest; ++ sess->mackeylen = digests[id].keylen; ++ sess->mac = digests[id].id; + + dstate->d_fd = get_dev_crypto(); + +-- +2.7.0 + |