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 dst_len,
|
||||||
size_t *olen )
|
size_t *olen )
|
||||||
{
|
{
|
||||||
((void) ssl);
|
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||||
((void) md);
|
psa_hash_operation_t *hash_operation_to_clone;
|
||||||
((void) dst);
|
psa_hash_operation_t hash_operation = psa_hash_operation_init();
|
||||||
((void) dst_len);
|
|
||||||
*olen = 0;
|
*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 */
|
#else /* MBEDTLS_USE_PSA_CRYPTO */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue