Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CAAM AEAD support #7116

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

sahilnxp
Copy link
Contributor

@sahilnxp sahilnxp commented Nov 8, 2024

This pull request add support for CAAM AEAD support.

@omasse-linaro

Introduce Sequence Fifo load command

Signed-off-by: Olivier Masse <olivier.masse@nxp.com>
Introduce more CCB CLR WR register

Signed-off-by: Olivier Masse <olivier.masse@nxp.com>
Add caam_cpy_buf_src() function that copy a data buffer into a caam buffer.

Signed-off-by: Olivier Masse <olivier.masse@nxp.com>
@sahilnxp
Copy link
Contributor Author

sahilnxp commented Nov 8, 2024

CI reported some issues, I will update the pull request.

Implement CAAM AES GCM

CAAM Errata:
When running GCM (not GMAC) when the IV is not 12 bytes (96 bits),
it is possible to "roll over" the 32-bit counter value.
When this occurs (unless counter starts at -1),
the AES operation will generate an incorrect MAC.
This occurs even when -1 is used as the counter for the last block.
The problem is that the 32-bit counter will overflow into the h value,
thus corrupting the MAC.
In order to reliably work around this (unlikely) issue,
the AES operation must be stopped after initialization to
determine the counter value to see whether/when it will roll over.
Then, before the offending block is processed,
the context needs to be saved. The one block gets processed twice :
GCM, restore MAC, GMAC over its ciphertext,
then patch up the message and AAD lengths, and carry on as normal.

Signed-off-by: Olivier Masse <olivier.masse@nxp.com>
Signed-off-by: Sahil Malhotra <sahil.malhotra@nxp.com>
Implement CAAM AES CCM

Signed-off-by: Olivier Masse <olivier.masse@nxp.com>
imx6dl-sabresd, imx6q-sabresd, imx6sx-sdb does not support AES GCM

Signed-off-by: Olivier Masse <olivier.masse@nxp.com>
Signed-off-by: Sahil Malhotra <sahil.malhotra@nxp.com>
There has been an addition of CAAM AEAD driver, to include that need to
update imx-mx8mmevk compilation command in case of se050 enabled

Signed-off-by: Sahil Malhotra <sahil.malhotra@nxp.com>
@sahilnxp
Copy link
Contributor Author

CI reported issues taken case.
This PR is ready for review.

Copy link
Contributor

@jenswi-linaro jenswi-linaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments for the commit "drivers: caam: Add caam_cpy_buf_src()"

* @src_data Source to copy
* @src_length Length to copy
*/
enum caam_status caam_cpy_buf_src(struct caambuf *dst, uint8_t *src_data,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The _src suffix isn't needed in the function name.

@@ -104,6 +104,17 @@ void caam_free_buf(struct caambuf *buf);
enum caam_status caam_cpy_block_src(struct caamblock *block,
struct caambuf *src, size_t offset);

/*
* Copy source data into the buffer. Allocate buffer if
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy data?

}

/* Do the copy */
memcpy(dst->data, src_data, dst->length);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if dst->length != src_length?

@jenswi-linaro
Copy link
Contributor

@sahilnxp, please add your Signed-off-by to the commits since this is your pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants