psa: cipher: Use psa_generate_random to generate IVs

Use psa_generate_random() to generate IVs instead of
mbedtls_psa_get_random(). mbedtls_psa_get_random() is
meant to be used as the f_rng argument of Mbed TLS
library functions.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/library/psa_crypto_cipher.c b/library/psa_crypto_cipher.c
index 5440e45..dac9d7f 100644
--- a/library/psa_crypto_cipher.c
+++ b/library/psa_crypto_cipher.c
@@ -274,15 +274,14 @@
     mbedtls_psa_cipher_operation_t *operation,
     uint8_t *iv, size_t iv_size, size_t *iv_length )
 {
-    int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
+    int status = PSA_ERROR_CORRUPTION_DETECTED;
 
     if( iv_size < operation->iv_size )
         return( PSA_ERROR_BUFFER_TOO_SMALL );
 
-    ret = mbedtls_psa_get_random( MBEDTLS_PSA_RANDOM_STATE,
-                                  iv, operation->iv_size );
-    if( ret != 0 )
-        return( mbedtls_to_psa_error( ret ) );
+    status = psa_generate_random( iv, operation->iv_size );
+    if( status != PSA_SUCCESS )
+        return( status );
 
     *iv_length = operation->iv_size;