mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-10 23:55:28 +00:00
psa: programs: Add cipher example fallback main
When dependencies are missing, print an error message from the example about missing dependencies at run-time.
This commit is contained in:
parent
44b09d2a67
commit
18ac331e15
|
@ -31,6 +31,19 @@
|
||||||
} \
|
} \
|
||||||
} while ( 0 )
|
} while ( 0 )
|
||||||
|
|
||||||
|
#if !defined(MBEDTLS_PSA_CRYPTO_C) || !defined(MBEDTLS_AES_C) || \
|
||||||
|
!defined(MBEDTLS_CIPHER_MODE_CBC) || !defined(MBEDTLS_CIPHER_MODE_CTR) || \
|
||||||
|
!defined(MBEDTLS_CIPHER_MODE_WITH_PADDING)
|
||||||
|
int main( void )
|
||||||
|
{
|
||||||
|
mbedtls_printf( "MBEDTLS_PSA_CRYPTO_C and/or MBEDTLS_AES_C and/or "
|
||||||
|
"MBEDTLS_CIPHER_MODE_CBC and/or MBEDTLS_CIPHER_MODE_CTR "
|
||||||
|
"and/or MBEDTLS_CIPHER_MODE_WITH_PADDING "
|
||||||
|
"not defined.\r\n" );
|
||||||
|
return( 0 );
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
/* Use key slot 1 for our cipher key. Key slot 0 is reserved as unused. */
|
/* Use key slot 1 for our cipher key. Key slot 0 is reserved as unused. */
|
||||||
static const psa_key_slot_t key_slot_cipher = 1;
|
static const psa_key_slot_t key_slot_cipher = 1;
|
||||||
|
|
||||||
|
@ -314,3 +327,5 @@ exit:
|
||||||
mbedtls_psa_crypto_free( );
|
mbedtls_psa_crypto_free( );
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
#endif /* MBEDTLS_PSA_CRYPTO_C && MBEDTLS_AES_C && MBEDTLS_CIPHER_MODE_CBC &&
|
||||||
|
MBEDTLS_CIPHER_MODE_CTR && MBEDTLS_CIPHER_MODE_WITH_PADDING */
|
||||||
|
|
Loading…
Reference in a new issue