psa: cipher: Add bound check of the IV length in the core

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index 5dd93af..ab4d18f 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -3401,14 +3401,13 @@
     psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
 
     if( operation->id == 0 )
-    {
         return( PSA_ERROR_BAD_STATE );
-    }
 
     if( operation->iv_set || ! operation->iv_required )
-    {
         return( PSA_ERROR_BAD_STATE );
-    }
+
+    if( iv_length > PSA_CIPHER_IV_MAX_SIZE )
+        return( PSA_ERROR_INVALID_ARGUMENT );
 
     status = psa_driver_wrapper_cipher_set_iv( operation,
                                                iv,