summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArek Kusztal <arkadiuszx.kusztal@intel.com>2016-12-23 08:24:51 +0000
committerPablo de Lara <pablo.de.lara.guarch@intel.com>2017-01-18 21:48:56 +0100
commitb9719b996a7c0c0dd4d80a142ddb26fabafd0ce9 (patch)
tree258213e90ff23667bf48c9daaf15dd5b4b466602
parent84d79658660414e4985a455259c4b46e9e77366d (diff)
downloaddpdk-b9719b996a7c0c0dd4d80a142ddb26fabafd0ce9.zip
dpdk-b9719b996a7c0c0dd4d80a142ddb26fabafd0ce9.tar.gz
dpdk-b9719b996a7c0c0dd4d80a142ddb26fabafd0ce9.tar.xz
crypto/aesni_gcm: fix J0 padding bytes
This commit fixes pre-counter block (J0) padding by clearing four most significant bytes before setting initial counter value. Fixes: b2bb3597470c ("crypto/aesni_gcm: move pre-counter block to driver") Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com> Acked-by: Piotr Azarewicz <piotrx.t.azarewicz@intel.com>
-rw-r--r--drivers/crypto/aesni_gcm/aesni_gcm_pmd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
index dba5e15..af3d60f 100644
--- a/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
+++ b/drivers/crypto/aesni_gcm/aesni_gcm_pmd.c
@@ -40,6 +40,7 @@
#include <rte_vdev.h>
#include <rte_malloc.h>
#include <rte_cpuflags.h>
+#include <rte_byteorder.h>
#include "aesni_gcm_pmd_private.h"
@@ -241,7 +242,8 @@ process_gcm_crypto_op(struct aesni_gcm_qp *qp, struct rte_crypto_sym_op *op,
* to set BE LSB to 1, driver expects that 16B is allocated
*/
if (op->cipher.iv.length == 12) {
- op->cipher.iv.data[15] = 1;
+ uint32_t *iv_padd = (uint32_t *)&op->cipher.iv.data[12];
+ *iv_padd = rte_bswap32(1);
}
if (op->auth.aad.length != 12 && op->auth.aad.length != 8 &&