* [dpdk-dev] [PATCH v1] crypto/ccp: aes-gcm driver bug fix
@ 2019-12-30 19:07 Selwin Sebastian
2020-01-21 6:04 ` Kumar, Ravi1
0 siblings, 1 reply; 3+ messages in thread
From: Selwin Sebastian @ 2019-12-30 19:07 UTC (permalink / raw)
To: dev; +Cc: Selwin Sebastian
fixes ccp crypto driver to make aes-gcm output match with
openssl/NIST output
Signed-off-by: Selwin Sebastian <Selwin.Sebastian@amd.com>
---
drivers/crypto/ccp/ccp_crypto.c | 21 +++++++++++----------
1 file changed, 11 insertions(+), 10 deletions(-)
diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c
index 4256734d1..19009f5f2 100644
--- a/drivers/crypto/ccp/ccp_crypto.c
+++ b/drivers/crypto/ccp/ccp_crypto.c
@@ -1515,8 +1515,8 @@ ccp_perform_passthru(struct ccp_passthru *pst,
CCP_CMD_SOC(desc) = 0;
CCP_CMD_IOC(desc) = 0;
- CCP_CMD_INIT(desc) = 0;
- CCP_CMD_EOM(desc) = 0;
+ CCP_CMD_INIT(desc) = 1;
+ CCP_CMD_EOM(desc) = 1;
CCP_CMD_PROT(desc) = 0;
function.raw = 0;
@@ -2383,7 +2383,7 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
op->sym->session,
ccp_cryptodev_driver_id);
iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
- key_addr = session->cipher.key_phys;
+ key_addr = (phys_addr_t)rte_mem_virt2phy(session->cipher.key_ccp);
src_addr = rte_pktmbuf_mtophys_offset(op->sym->m_src,
op->sym->aead.data.offset);
@@ -2393,7 +2393,8 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
else
dest_addr = src_addr;
rte_pktmbuf_append(op->sym->m_src, session->auth.ctx_len);
- digest_dest_addr = op->sym->aead.digest.phys_addr;
+ digest_dest_addr =
+ (phys_addr_t)rte_mem_virt2phy(op->sym->aead.digest.data);
temp = (uint64_t *)(op->sym->aead.digest.data + AES_BLOCK_SIZE);
*temp++ = rte_bswap64(session->auth.aad_length << 3);
*temp = rte_bswap64(op->sym->aead.data.length << 3);
@@ -2401,10 +2402,10 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
non_align_len = op->sym->aead.data.length % AES_BLOCK_SIZE;
length = CCP_ALIGN(op->sym->aead.data.length, AES_BLOCK_SIZE);
- aad_addr = op->sym->aead.aad.phys_addr;
+ aad_addr = (phys_addr_t)rte_mem_virt2phy(op->sym->aead.aad.data);
/* CMD1 IV Passthru */
- rte_memcpy(session->cipher.nonce + AES_BLOCK_SIZE, iv,
+ rte_memcpy(session->cipher.nonce, iv,
session->iv.length);
pst.src_addr = session->cipher.nonce_phys;
pst.dest_addr = (phys_addr_t)(cmd_q->sb_iv * CCP_SB_BYTES);
@@ -2512,12 +2513,12 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
/* Last block (AAD_len || PT_len)*/
CCP_CMD_LEN(desc) = AES_BLOCK_SIZE;
- CCP_CMD_SRC_LO(desc) = ((uint32_t)digest_dest_addr + AES_BLOCK_SIZE);
- CCP_CMD_SRC_HI(desc) = high32_value(digest_dest_addr + AES_BLOCK_SIZE);
+ CCP_CMD_SRC_LO(desc) = ((uint32_t)digest_dest_addr);
+ CCP_CMD_SRC_HI(desc) = high32_value(digest_dest_addr);
CCP_CMD_SRC_MEM(desc) = CCP_MEMTYPE_SYSTEM;
- CCP_CMD_DST_LO(desc) = ((uint32_t)digest_dest_addr);
- CCP_CMD_DST_HI(desc) = high32_value(digest_dest_addr);
+ CCP_CMD_DST_LO(desc) = ((uint32_t)digest_dest_addr + AES_BLOCK_SIZE);
+ CCP_CMD_DST_HI(desc) = high32_value(digest_dest_addr + AES_BLOCK_SIZE);
CCP_CMD_SRC_MEM(desc) = CCP_MEMTYPE_SYSTEM;
CCP_CMD_KEY_LO(desc) = ((uint32_t)key_addr);
--
2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v1] crypto/ccp: aes-gcm driver bug fix
2019-12-30 19:07 [dpdk-dev] [PATCH v1] crypto/ccp: aes-gcm driver bug fix Selwin Sebastian
@ 2020-01-21 6:04 ` Kumar, Ravi1
2020-01-28 6:24 ` Akhil Goyal
0 siblings, 1 reply; 3+ messages in thread
From: Kumar, Ravi1 @ 2020-01-21 6:04 UTC (permalink / raw)
To: Sebastian, Selwin, dev; +Cc: Sebastian, Selwin
[AMD Official Use Only - Internal Distribution Only]
Looks good to me.
Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
Regards,
Ravi
>
>
>-----Original Message-----
>From: dev <dev-bounces@dpdk.org> On Behalf Of Selwin Sebastian
>Sent: Tuesday, December 31, 2019 12:38 AM
>To: dev@dpdk.org
>Cc: Sebastian, Selwin <Selwin.Sebastian@amd.com>
>Subject: [dpdk-dev] [PATCH v1] crypto/ccp: aes-gcm driver bug fix
>
>[CAUTION: External Email]
>
>fixes ccp crypto driver to make aes-gcm output match with openssl/NIST output
>
>Signed-off-by: Selwin Sebastian <Selwin.Sebastian@amd.com>
>---
> drivers/crypto/ccp/ccp_crypto.c | 21 +++++++++++----------
> 1 file changed, 11 insertions(+), 10 deletions(-)
>
>diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c index 4256734d1..19009f5f2 100644
>--- a/drivers/crypto/ccp/ccp_crypto.c
>+++ b/drivers/crypto/ccp/ccp_crypto.c
>@@ -1515,8 +1515,8 @@ ccp_perform_passthru(struct ccp_passthru *pst,
>
> CCP_CMD_SOC(desc) = 0;
> CCP_CMD_IOC(desc) = 0;
>- CCP_CMD_INIT(desc) = 0;
>- CCP_CMD_EOM(desc) = 0;
>+ CCP_CMD_INIT(desc) = 1;
>+ CCP_CMD_EOM(desc) = 1;
> CCP_CMD_PROT(desc) = 0;
>
> function.raw = 0;
>@@ -2383,7 +2383,7 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
> op->sym->session,
> ccp_cryptodev_driver_id);
> iv = rte_crypto_op_ctod_offset(op, uint8_t *, session->iv.offset);
>- key_addr = session->cipher.key_phys;
>+ key_addr =
>+ (phys_addr_t)rte_mem_virt2phy(session->cipher.key_ccp);
>
> src_addr = rte_pktmbuf_mtophys_offset(op->sym->m_src,
> op->sym->aead.data.offset); @@ -2393,7 +2393,8 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
> else
> dest_addr = src_addr;
> rte_pktmbuf_append(op->sym->m_src, session->auth.ctx_len);
>- digest_dest_addr = op->sym->aead.digest.phys_addr;
>+ digest_dest_addr =
>+
>+ (phys_addr_t)rte_mem_virt2phy(op->sym->aead.digest.data);
> temp = (uint64_t *)(op->sym->aead.digest.data + AES_BLOCK_SIZE);
> *temp++ = rte_bswap64(session->auth.aad_length << 3);
> *temp = rte_bswap64(op->sym->aead.data.length << 3); @@ -2401,10 +2402,10 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
> non_align_len = op->sym->aead.data.length % AES_BLOCK_SIZE;
> length = CCP_ALIGN(op->sym->aead.data.length, AES_BLOCK_SIZE);
>
>- aad_addr = op->sym->aead.aad.phys_addr;
>+ aad_addr =
>+ (phys_addr_t)rte_mem_virt2phy(op->sym->aead.aad.data);
>
> /* CMD1 IV Passthru */
>- rte_memcpy(session->cipher.nonce + AES_BLOCK_SIZE, iv,
>+ rte_memcpy(session->cipher.nonce, iv,
> session->iv.length);
> pst.src_addr = session->cipher.nonce_phys;
> pst.dest_addr = (phys_addr_t)(cmd_q->sb_iv * CCP_SB_BYTES); @@ -2512,12 +2513,12 @@ ccp_perform_aes_gcm(struct rte_crypto_op *op, struct ccp_queue *cmd_q)
> /* Last block (AAD_len || PT_len)*/
> CCP_CMD_LEN(desc) = AES_BLOCK_SIZE;
>
>- CCP_CMD_SRC_LO(desc) = ((uint32_t)digest_dest_addr + AES_BLOCK_SIZE);
>- CCP_CMD_SRC_HI(desc) = high32_value(digest_dest_addr + AES_BLOCK_SIZE);
>+ CCP_CMD_SRC_LO(desc) = ((uint32_t)digest_dest_addr);
>+ CCP_CMD_SRC_HI(desc) = high32_value(digest_dest_addr);
> CCP_CMD_SRC_MEM(desc) = CCP_MEMTYPE_SYSTEM;
>
>- CCP_CMD_DST_LO(desc) = ((uint32_t)digest_dest_addr);
>- CCP_CMD_DST_HI(desc) = high32_value(digest_dest_addr);
>+ CCP_CMD_DST_LO(desc) = ((uint32_t)digest_dest_addr + AES_BLOCK_SIZE);
>+ CCP_CMD_DST_HI(desc) = high32_value(digest_dest_addr +
>+ AES_BLOCK_SIZE);
> CCP_CMD_SRC_MEM(desc) = CCP_MEMTYPE_SYSTEM;
>
> CCP_CMD_KEY_LO(desc) = ((uint32_t)key_addr);
>--
>2.17.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH v1] crypto/ccp: aes-gcm driver bug fix
2020-01-21 6:04 ` Kumar, Ravi1
@ 2020-01-28 6:24 ` Akhil Goyal
0 siblings, 0 replies; 3+ messages in thread
From: Akhil Goyal @ 2020-01-28 6:24 UTC (permalink / raw)
To: Kumar, Ravi1, Sebastian, Selwin, dev; +Cc: Sebastian, Selwin
>
> Looks good to me.
>
> Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
>
> Regards,
> Ravi
> >
> >
> >
> >fixes ccp crypto driver to make aes-gcm output match with openssl/NIST
> output
> >
> >Signed-off-by: Selwin Sebastian <Selwin.Sebastian@amd.com>
> >---
Please mention commit id for the original patch for which this fix is submitted.
"Fixes: <12 digits of commit id> ("patch title")"
Title should be in format "crypto/ccp: fix ....."
Also explain the issue briefly in description and cc stable@dpdk.org
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-28 6:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-30 19:07 [dpdk-dev] [PATCH v1] crypto/ccp: aes-gcm driver bug fix Selwin Sebastian
2020-01-21 6:04 ` Kumar, Ravi1
2020-01-28 6:24 ` Akhil Goyal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).