Multipart AEAD buffer output sizes #102
Labels
No labels
api-spec
bug
CLA requested
CLA valid
compliance
DO NOT MERGE
duplicate
enhancement
feature branch
good first issue
HEADER FORMATTING ISSUE
help wanted
Information
invalid
Jira status: AWAITING REVIEW
Jira status: CLOSED
Jira status: DONE
Jira status: IN PROGRESS
Jira status: IN REVIEW
Jira status: OPEN
Jira status: REOPENED
Jira status: RESOLVED
mirrored
mirror internally
needs: backports
needs: ci
needs: design review
needs: preceding PR
needs: review
needs: work
notabug
open for community contribution
Product Backlog
question
ready for merge
security
stale
type: bug
type: enhancement
type: question
web pages
wontfix
writing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-ARMmbed/mbed-crypto!102
Loading…
Reference in a new issue
No description provided.
Delete branch "psa-aead_multipart-delay"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
psa_aead_verify. It needs it as much aspsa_aead_finish.Out of scope: testing the new algorithms beyond smoke tests; testing the new macros; testing multipart AEAD.
overall approach looks sound, still need to double check the buffer computation logic but on first viewing it is broadly correct.
However, there are a few problems - see individual comments.
copy paste bug? -
plaintext_length->ciphertext_lengthplaintext_length->input_length( ... ) * PSA_MAX_BLOCK_CIPHER_BLOCK_SIZEparameter mismatch:
plaintext_length->input_lengthJust double checking that you intended to refer to the finishing function here, or should this be
psa_aead_update()?@ -2495,12 +2495,24 @@ psa_status_t psa_aead_update_ad(psa_aead_operation_t *operation,* - In particular, do not copy the output anywhere but to aIs this asking too much of implementations (for accelerators or secure elements)?
"This is the remaining from previous calls"
I think we are missing a word. Suggestion: "This is the remaining plaintext from previous calls..."
Looks like a pre-existing bug. Good to add a commit to fix that.
Do we need a new error code returned from any of the AEAD functions in order to indicate "The hardware is busy/delayed right now and isn't ready to return anything yet. Try again later."?
No. The API is fully synchronous. If the hardware is busy, the call blocks.
All calls consume all the input (or fail). What's implementation-defined is only how whether the output at each stage is the maximum that can be mathematically calculated or not. Is this something that needs to be clarified in the documentation of specific functions?
@ -2495,12 +2495,24 @@ psa_status_t psa_aead_update_ad(psa_aead_operation_t *operation,* - In particular, do not copy the output anywhere but to aThe point of this PR is precisely to avoid asking too much. But the wording could use some improvements. What did you think this is asking?
@ -2495,12 +2495,24 @@ psa_status_t psa_aead_update_ad(psa_aead_operation_t *operation,* - In particular, do not copy the output anywhere but to aI've reworded this paragraph.
Fixed, and I modified the AEAD tests to use this macro.
@ -2498,1 +2503,4 @@* provides sufficient input. The amount of data that can be delayed* in this way is bounded by #PSA_AEAD_UPDATE_OUTPUT_SIZE.** \param[in,out] operation Active AEAD operation.OK, this makes it more clear that an implementation doesn't have to store and delay if it doesn't want to, but it has the option to. Good.
Do we expect the length to be correct for errors other than PSA_ERROR_INVALID_ARGUMENT? If not, should we check for expected_result == PSA_SUCCESS?
The length is expected to be correct except if the algorithm is invalid. This includes cases where the operation might fail for other reasons, at least
INVALID_SIGNATURE. It would be better to have properly separate tests for the macro and for the operation, but that's a much bigger task than this PR (it applies to all the other size macros).CI failure is ABI job (known to fail until https://github.com/ARMmbed/mbedtls/pull/2636 lands in the development branch) and
USE_PSA_CRYPTO, which doesn't work on the API branch.