diff --git a/library/psa_crypto.c b/library/psa_crypto.c index 969c695ac0..0a9011ad84 100644 --- a/library/psa_crypto.c +++ b/library/psa_crypto.c @@ -5194,6 +5194,12 @@ psa_status_t psa_aead_update_ad(psa_aead_operation_t *operation, goto exit; } + /* No input to add (zero length), nothing to do. */ + if (input_length == 0) { + status = PSA_SUCCESS; + goto exit; + } + if (operation->lengths_set) { if (operation->ad_remaining < input_length) { status = PSA_ERROR_INVALID_ARGUMENT;