mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Add Multipart AEAD CCM internal implementation
Signed-off-by: Paul Elliott <paul.elliott@arm.com>
This commit is contained in:
@@ -3868,6 +3868,15 @@ psa_status_t psa_aead_generate_nonce( psa_aead_operation_t *operation,
|
||||
goto exit;
|
||||
}
|
||||
|
||||
/* For CCM, this size may not be correct according to the PSA
|
||||
* specification. The PSA Crypto 1.0.1 specification states:
|
||||
*
|
||||
* CCM encodes the plaintext length pLen in L octets, with L the smallest
|
||||
* integer >= 2 where pLen < 2^(8L). The nonce length is then 15 - L bytes.
|
||||
*
|
||||
* However this restriction that L has to be the smallest integer is not
|
||||
* applied in practice, and it is not implementable here since the
|
||||
* plaintext length may or may not be known at this time. */
|
||||
required_nonce_size = PSA_AEAD_NONCE_LENGTH( operation->key_type,
|
||||
operation->alg );
|
||||
if( nonce_size < required_nonce_size )
|
||||
@@ -4030,6 +4039,13 @@ psa_status_t psa_aead_update_ad( psa_aead_operation_t *operation,
|
||||
|
||||
operation->ad_remaining -= input_length;
|
||||
}
|
||||
#if defined(PSA_WANT_ALG_CCM)
|
||||
else if( operation->alg == PSA_ALG_CCM )
|
||||
{
|
||||
status = PSA_ERROR_BAD_STATE;
|
||||
goto exit;
|
||||
}
|
||||
#endif /* PSA_WANT_ALG_CCM */
|
||||
|
||||
status = psa_driver_wrapper_aead_update_ad( operation, input,
|
||||
input_length );
|
||||
@@ -4087,6 +4103,13 @@ psa_status_t psa_aead_update( psa_aead_operation_t *operation,
|
||||
|
||||
operation->body_remaining -= input_length;
|
||||
}
|
||||
#if defined(PSA_WANT_ALG_CCM)
|
||||
else if( operation->alg == PSA_ALG_CCM )
|
||||
{
|
||||
status = PSA_ERROR_BAD_STATE;
|
||||
goto exit;
|
||||
}
|
||||
#endif /* PSA_WANT_ALG_CCM */
|
||||
|
||||
status = psa_driver_wrapper_aead_update( operation, input, input_length,
|
||||
output, output_size,
|
||||
|
Reference in New Issue
Block a user