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

Cipher buf fixes #6802

Merged
merged 2 commits into from
Apr 24, 2024
Merged

Cipher buf fixes #6802

merged 2 commits into from
Apr 24, 2024

Conversation

jenswi-linaro
Copy link
Contributor

@jenswi-linaro jenswi-linaro commented Apr 23, 2024

This includes "libutee: process a full buffer immediately" cherry-picked from #6791 so please ignore that while reviewing this PR.

This fixes an issue found with updated xtest regression tests, OP-TEE/optee_test#741

Copy link
Contributor

@etienne-lms etienne-lms left a comment

Choose a reason for hiding this comment

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

Acked-by: Etienne Carriere <etienne.carriere@foss.st.com> for commit
"libutee: process a full buffer immediately".

Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com> for commit
"libutee: handle buffer_two_blocks correctly".

@jenswi-linaro
Copy link
Contributor Author

The QEMUv8 make check failure puzzles me. It's an error in the 4003 case so it's relevant, but I can't reproduce it locally. I'm rerunning the test to see if it changes.

@jenswi-linaro
Copy link
Contributor Author

It's the check with CFG_CRYPTO_WITH_CE82=y that fails and I'm able to reproduce it locally, I'm looking into this.

@jenswi-linaro
Copy link
Contributor Author

Added "core: arm64: fix ce_aes_xts_{de,en}crypt()" before "libutee: handle buffer_two_blocks correctly", since the latter triggers the bug fixed by the former.

Tag applied to "libutee: handle buffer_two_blocks correctly", note that PR #6791 is supposed to be merged first with "libutee: process a full buffer immediately".

@jforissier
Copy link
Contributor

For "core: arm64: fix ce_aes_xts_{de,en}crypt()":

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

@jforissier
Copy link
Contributor

#6791 merged, please rebase. Thanks!

In ce_aes_xts_encrypt() and ce_aes_xts_decrypt(), if the main interleave
loop (.LxtsencNx or .LxtsdecNx) ends with all blocks completed the v7
register doesn't hold the needed .Lxts_mul_x needed to compute the next
tweak correctly. So fix this by loading .Lxts_mul_x in v7 before ending
the loop.

Fixes: 06d2e41 ("core: add accelerated AES routines")
Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
For operations with buffer_two_blocks true, calculate the required size
of the out buffer (req_dlen) correctly in TEE_CipherUpdate().
tee_buffer_update() is fixed with a matching update.

buffer_two_blocks set to true mandates buffering at least one block + a
byte and at most two full blocks.

Fix needed by TEE_ALG_AES_CTS and TEE_ALG_AES_XTS.

Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
@jenswi-linaro
Copy link
Contributor Author

Rebased and tag applied.

@jforissier
Copy link
Contributor

The Hafnium build has failed on a network error, I will restart it.

2024-04-24T14:32:25.7470695Z error: RPC failed; curl 18 transfer closed with outstanding read data remaining
2024-04-24T14:32:25.7476455Z fetch-pack: unexpected disconnect while reading sideband packet
2024-04-24T14:32:25.7482513Z fatal: early EOF
2024-04-24T14:32:25.7499051Z fatal: fetch-pack: invalid index-pack output
2024-04-24T14:32:25.7531042Z fatal: Fetched in submodule path 'prebuilts', but it did not contain 5cd8406945e7f8f4bc9814167113886ae2a206fc. Direct fetching of that commit failed.
2024-04-24T14:32:25.7532403Z fatal: 
2024-04-24T14:32:25.7537641Z make: *** [Makefile:395: .hafnium_checkout] Error 128

@jforissier jforissier merged commit 5957a0b into OP-TEE:master Apr 24, 2024
7 checks passed
@jenswi-linaro jenswi-linaro deleted the cipher_buf branch April 24, 2024 16:27
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.

None yet

3 participants