mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-11 20:35:40 +00:00
51 lines
1.1 KiB
Plaintext
51 lines
1.1 KiB
Plaintext
|
/* BEGIN_HEADER */
|
||
|
#include <stdint.h>
|
||
|
|
||
|
#if defined(MBEDTLS_PSA_CRYPTO_SPM)
|
||
|
#include "spm/psa_defs.h"
|
||
|
#endif
|
||
|
#include "psa/crypto.h"
|
||
|
|
||
|
/* END_HEADER */
|
||
|
|
||
|
/* BEGIN_DEPENDENCIES
|
||
|
* depends_on:MBEDTLS_PSA_CRYPTO_C
|
||
|
* END_DEPENDENCIES
|
||
|
*/
|
||
|
|
||
|
/* BEGIN_CASE */
|
||
|
void init_deinit( )
|
||
|
{
|
||
|
psa_status_t status;
|
||
|
int i;
|
||
|
for( i = 0; i <= 1; i++ )
|
||
|
{
|
||
|
status = psa_crypto_init( );
|
||
|
TEST_ASSERT( status == PSA_SUCCESS );
|
||
|
status = psa_crypto_init( );
|
||
|
TEST_ASSERT( status == PSA_SUCCESS );
|
||
|
mbedtls_psa_crypto_free( );
|
||
|
}
|
||
|
}
|
||
|
/* END_CASE */
|
||
|
|
||
|
/* BEGIN_CASE */
|
||
|
void validate_module_init_generate_random( )
|
||
|
{
|
||
|
psa_status_t status;
|
||
|
uint8_t random[10] = { 0 };
|
||
|
status = psa_generate_random( random, sizeof( random ) );
|
||
|
TEST_ASSERT( status == PSA_ERROR_BAD_STATE );
|
||
|
}
|
||
|
/* END_CASE */
|
||
|
|
||
|
/* BEGIN_CASE */
|
||
|
void validate_module_init_key_based( )
|
||
|
{
|
||
|
psa_status_t status;
|
||
|
uint8_t data[10] = { 0 };
|
||
|
status = psa_import_key( 1, PSA_KEY_TYPE_RAW_DATA, data, sizeof( data ) );
|
||
|
TEST_ASSERT( status == PSA_ERROR_BAD_STATE );
|
||
|
}
|
||
|
/* END_CASE */
|