Finalize PSA hash operations in TLS 1.3
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
4279bac965
commit
f6893e11c7
1 changed files with 33 additions and 5 deletions
|
@ -7476,12 +7476,40 @@ int mbedtls_ssl_get_handshake_transcript( mbedtls_ssl_context *ssl,
|
|||
size_t dst_len,
|
||||
size_t *olen )
|
||||
{
|
||||
((void) ssl);
|
||||
((void) md);
|
||||
((void) dst);
|
||||
((void) dst_len);
|
||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||
psa_hash_operation_t *hash_operation_to_clone;
|
||||
psa_hash_operation_t hash_operation = psa_hash_operation_init();
|
||||
|
||||
*olen = 0;
|
||||
return( MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE);
|
||||
|
||||
switch( md )
|
||||
{
|
||||
#if defined(MBEDTLS_SHA384_C)
|
||||
case MBEDTLS_MD_SHA384:
|
||||
hash_operation_to_clone = &ssl->handshake->fin_sha384_psa;
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SHA256_C)
|
||||
case MBEDTLS_MD_SHA256:
|
||||
hash_operation_to_clone = &ssl->handshake->fin_sha256_psa;
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
goto exit;
|
||||
}
|
||||
|
||||
status = psa_hash_clone( hash_operation_to_clone, &hash_operation );
|
||||
if( status != PSA_SUCCESS )
|
||||
goto exit;
|
||||
|
||||
status = psa_hash_finish( &hash_operation, dst, dst_len, olen );
|
||||
if( status != PSA_SUCCESS )
|
||||
goto exit;
|
||||
|
||||
exit:
|
||||
return( ( status == PSA_SUCCESS ) ? 0 : MBEDTLS_ERR_ERROR_GENERIC_ERROR );
|
||||
}
|
||||
#else /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
|
|
Loading…
Reference in a new issue