diff options
Diffstat (limited to 'recipes-connectivity/openssl/openssl-qoriq/qoriq/0029-cryptodev-use-CIOCHASH-ioctl-for-digest-operations.patch')
-rw-r--r-- | recipes-connectivity/openssl/openssl-qoriq/qoriq/0029-cryptodev-use-CIOCHASH-ioctl-for-digest-operations.patch | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/recipes-connectivity/openssl/openssl-qoriq/qoriq/0029-cryptodev-use-CIOCHASH-ioctl-for-digest-operations.patch b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0029-cryptodev-use-CIOCHASH-ioctl-for-digest-operations.patch new file mode 100644 index 0000000..3dc2b92 --- /dev/null +++ b/recipes-connectivity/openssl/openssl-qoriq/qoriq/0029-cryptodev-use-CIOCHASH-ioctl-for-digest-operations.patch @@ -0,0 +1,91 @@ +From 3fe44ab50a87106af3349148e81ec8a1d524de82 Mon Sep 17 00:00:00 2001 +From: Cristian Stoica <cristian.stoica@nxp.com> +Date: Tue, 15 Dec 2015 15:43:28 +0200 +Subject: [PATCH 29/48] cryptodev: use CIOCHASH ioctl for digest operations + +Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com> +--- + crypto/engine/eng_cryptodev.c | 34 +++++++++++----------------------- + 1 file changed, 11 insertions(+), 23 deletions(-) + +diff --git a/crypto/engine/eng_cryptodev.c b/crypto/engine/eng_cryptodev.c +index 1585009..dc27b55 100644 +--- a/crypto/engine/eng_cryptodev.c ++++ b/crypto/engine/eng_cryptodev.c +@@ -84,6 +84,7 @@ struct dev_crypto_state { + unsigned char *iv; + int ivlen; + # ifdef USE_CRYPTODEV_DIGESTS ++ struct hash_op_data hash_op; + char dummy_mac_key[HASH_MAX_LEN]; + unsigned char digest_res[HASH_MAX_LEN]; + char *mac_data; +@@ -1556,7 +1557,7 @@ static int digest_key_length(int nid) + static int cryptodev_digest_init(EVP_MD_CTX *ctx) + { + struct dev_crypto_state *state = ctx->md_data; +- struct session_op *sess = &state->d_sess; ++ struct hash_op_data *hash_op = &state->hash_op; + int digest; + + memset(state, 0, sizeof(struct dev_crypto_state)); +@@ -1573,9 +1574,9 @@ static int cryptodev_digest_init(EVP_MD_CTX *ctx) + return (0); + } + +- sess->mackey = state->dummy_mac_key; +- sess->mackeylen = digest_key_length(ctx->digest->type); +- sess->mac = digest; ++ hash_op->mac_op = digest; ++ hash_op->mackey = state->dummy_mac_key; ++ hash_op->mackeylen = digest_key_length(ctx->digest->type); + + return (1); + } +@@ -1617,37 +1618,24 @@ static int cryptodev_digest_update(EVP_MD_CTX *ctx, const void *data, + static int cryptodev_digest_final(EVP_MD_CTX *ctx, unsigned char *md) + { + int ret = 1; +- struct crypt_op cryp; + struct dev_crypto_state *state = ctx->md_data; +- struct session_op *sess = &state->d_sess; ++ struct hash_op_data *hash_op = &state->hash_op; + + if (!md || state->d_fd < 0) { + printf("%s: illegal input\n", __func__); + return (0); + } + +- if (ioctl(state->d_fd, CIOCGSESSION, sess) < 0) { +- printf("%s: Open session failed\n", __func__); +- return (0); +- } +- +- memset(&cryp, 0, sizeof(cryp)); ++ hash_op->flags = 0; ++ hash_op->len = state->mac_len; ++ hash_op->src = state->mac_data; ++ hash_op->mac_result = md; + +- cryp.ses = sess->ses; +- cryp.flags = 0; +- cryp.len = state->mac_len; +- cryp.src = state->mac_data; +- cryp.mac = md; +- +- if (ioctl(state->d_fd, CIOCCRYPT, &cryp) < 0) { ++ if (ioctl(state->d_fd, CIOCHASH, hash_op) < 0) { + printf("%s: digest failed\n", __func__); + ret = 0; + } + +- if (ioctl(state->d_fd, CIOCFSESSION, &sess->ses) < 0) { +- printf("%s: failed to close session\n", __func__); +- } +- + return ret; + } + +-- +2.7.0 + |