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

Fix for data input size of CAAM CMAC do_update() #4583

Merged
merged 2 commits into from
Apr 29, 2021

Conversation

clementfaure
Copy link
Contributor

Hello,

These are two fixes for the CAAM CMAC we found while inspecting the code.
xtest does not cover these cases.

Thanks!
Clement

@jforissier
Copy link
Contributor

xtest does not cover these cases.

Could this be addressed?

@clementfaure
Copy link
Contributor Author

clementfaure commented Apr 29, 2021

xtest does not cover these cases.

Could this be addressed?

That's doable. However, I'm not sure to have something to merge before the release tomorrow unfortunately

@jforissier
Copy link
Contributor

xtest does not cover these cases.

Could this be addressed?

That's doable. However, I'm not sure to have something to merge before the release tomorrow unfortunately

That's fine, it can be done later. I suppose adding a few XTEST_MAC_CMAC_CASE macro calls could do the trick ?
For the time being I am ready to take this since it is a platform-specific fix and you hopefully have tested it ;)

Acked-by: Jerome Forissier <jerome@forissier.org>

Fix a corner case where the CAAM would try to allocate an input
DMA object with a size of 0 bytes.

Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com>
Signed-off-by: Clement Faure <clement.faure@nxp.com>
Acked-by: Jerome Forissier <jerome@forissier.org>
Fix an issue in the CMAC do_update() operation that
would happen in the following conditions:
 * a data temporay buffer full (16 bytes).
 * an input message of 16 bytes.

These conditions would set the data size to be processed by the CAAM
equals to zero. This would result on the loss of 16 bytes of the input
message and a wrong CMAC.

Signed-off-by: Cedric Neveux <cedric.neveux@nxp.com>
Signed-off-by: Clement Faure <clement.faure@nxp.com>
Acked-by: Jerome Forissier <jerome@forissier.org>
@clementfaure clementfaure force-pushed the fix/caam_cmac_update branch from f20fb8f to 133cbad Compare April 29, 2021 11:25
@clementfaure
Copy link
Contributor Author

clementfaure commented Apr 29, 2021

@jforissier
I did it in the end, it was fairly simple :)
The test is OK with these two configurations:

  • SW crypto
  • HW crypto CAAM + this PR

Tag applied!

@jforissier
Copy link
Contributor

@clementfaure excellent, thanks.

clementfaure added a commit to clementfaure/optee_test that referenced this pull request Apr 29, 2021
Add a CMAC subtest where do_update operations are done with a data
input size of 16 bytes.
The CAAM CMAC driver does not properly handle multiple do_update
operations with 16 bytes input data.

Link: OP-TEE/optee_os#4583
Signed-off-by: Clement Faure <clement.faure@nxp.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
clementfaure added a commit to clementfaure/optee_test that referenced this pull request Apr 29, 2021
Add a CMAC subtest where do_update operations are done with a data
input size of 16 bytes.
The CAAM CMAC driver does not properly handle multiple do_update
operations with 16 bytes input data.

Link: OP-TEE/optee_os#4583
Signed-off-by: Clement Faure <clement.faure@nxp.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
@jforissier jforissier merged commit 4016b86 into OP-TEE:master Apr 29, 2021
clementfaure added a commit to clementfaure/optee_test that referenced this pull request Apr 29, 2021
Add a CMAC subtest where do_update operations are done with a data
input size of 16 bytes.
This is a test case for a bug in the CAAM CMAC driver which would not
handle properly consecutive do_update operations with input data size
of 16 bytes.

Link: OP-TEE/optee_os#4583
Signed-off-by: Clement Faure <clement.faure@nxp.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
jforissier pushed a commit to OP-TEE/optee_test that referenced this pull request Apr 29, 2021
Add a CMAC subtest where do_update operations are done with a data
input size of 16 bytes.
This is a test case for a bug in the CAAM CMAC driver which would not
handle properly consecutive do_update operations with input data size
of 16 bytes.

Link: OP-TEE/optee_os#4583
Signed-off-by: Clement Faure <clement.faure@nxp.com>
Reviewed-by: Jerome Forissier <jerome@forissier.org>
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org>
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.

2 participants