fix psa crypto test fail
@@ -100,50 +100,55 @@ int mbedtls_pk_error_from_psa( psa_status_t status )
}
}
-#if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
-int mbedtls_pk_error_from_psa_ecdca( psa_status_t status )
+#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY)
+int mbedtls_pk_error_from_psa_rsa( psa_status_t status )
{
switch( status )
{
case PSA_ERROR_NOT_PERMITTED:
case PSA_ERROR_INVALID_ARGUMENT:
- return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
case PSA_ERROR_INVALID_HANDLE:
- return( MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE );
+ return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
case PSA_ERROR_BUFFER_TOO_SMALL:
- return( MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL );
+ return( MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE );
case PSA_ERROR_INSUFFICIENT_ENTROPY:
- return( MBEDTLS_ERR_ECP_RANDOM_FAILED );
+ return( MBEDTLS_ERR_RSA_RNG_FAILED );
case PSA_ERROR_INVALID_SIGNATURE:
- return( MBEDTLS_ERR_ECP_VERIFY_FAILED );
+ return( MBEDTLS_ERR_RSA_VERIFY_FAILED );
+ case PSA_ERROR_INVALID_PADDING:
+ return( MBEDTLS_ERR_RSA_INVALID_PADDING );
default:
return( mbedtls_pk_error_from_psa( status ) );
}
}
#endif
-#if defined(PSA_WANT_KEY_TYPE_RSA_PUBLIC_KEY)
-int mbedtls_pk_error_from_psa_rsa( psa_status_t status )
+#endif /* MBEDTLS_PSA_CRYPTO_C */
+
+#if defined(MBEDTLS_USE_PSA_CRYPTO)
+
+#if defined(PSA_WANT_KEY_TYPE_ECC_PUBLIC_KEY)
+int mbedtls_pk_error_from_psa_ecdca( psa_status_t status )
{
switch( status )
{
case PSA_ERROR_NOT_PERMITTED:
case PSA_ERROR_INVALID_ARGUMENT:
+ return( MBEDTLS_ERR_ECP_BAD_INPUT_DATA );
case PSA_ERROR_INVALID_HANDLE:
- return( MBEDTLS_ERR_RSA_BAD_INPUT_DATA );
+ return( MBEDTLS_ERR_ECP_FEATURE_UNAVAILABLE );
case PSA_ERROR_BUFFER_TOO_SMALL:
- return( MBEDTLS_ERR_RSA_OUTPUT_TOO_LARGE );
+ return( MBEDTLS_ERR_ECP_BUFFER_TOO_SMALL );
case PSA_ERROR_INSUFFICIENT_ENTROPY:
- return( MBEDTLS_ERR_RSA_RNG_FAILED );
+ return( MBEDTLS_ERR_ECP_RANDOM_FAILED );
case PSA_ERROR_INVALID_SIGNATURE:
- return( MBEDTLS_ERR_RSA_VERIFY_FAILED );
- case PSA_ERROR_INVALID_PADDING:
- return( MBEDTLS_ERR_RSA_INVALID_PADDING );
+ return( MBEDTLS_ERR_ECP_VERIFY_FAILED );
default:
return( mbedtls_pk_error_from_psa( status ) );
}
}
#endif
+
#endif
#if defined(MBEDTLS_RSA_C)
