Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,10 @@ psa_status_t cracen_sw_aes_ccm_update(cracen_aead_operation_t *operation, const
size_t processed = 0;
size_t counter_size = CCM_Q_LEN_FROM_NONCE(operation->nonce_length);

if (output_size < input_length) {
return PSA_ERROR_BUFFER_TOO_SMALL;
}
Comment on lines +395 to +397

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please consider moving this check to cracen_aead_update() instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

oki


operation->ad_finished = true;
status = initialize_cbc_mac(operation, &cipher);
if (status != PSA_SUCCESS) {
Expand Down Expand Up @@ -459,6 +463,12 @@ psa_status_t cracen_sw_aes_ccm_finish(cracen_aead_operation_t *operation, uint8_
struct sxblkcipher cipher;
psa_status_t status;

*ciphertext_length = 0;

if (tag_size < operation->tag_size) {
return PSA_ERROR_BUFFER_TOO_SMALL;
}
Comment on lines +468 to +470

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hm, it looks like a duplicate to

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

true


status = initialize_cbc_mac(operation, &cipher);
if (status != PSA_SUCCESS) {
return status;
Expand Down