Remove invalid buffer overflow check

Signed-off-by: gabor-mezei-arm <gabor.mezei@arm.com>
diff --git a/library/psa_crypto.c b/library/psa_crypto.c
index d3f7c2e..6e73d12 100644
--- a/library/psa_crypto.c
+++ b/library/psa_crypto.c
@@ -3513,13 +3513,6 @@
     key_type = slot->attr.type;
     iv_length = PSA_CIPHER_IV_LENGTH( key_type, alg );
 
-    if( output_size < PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg,
-                                                      input_length ) )
-    {
-        status = PSA_ERROR_BUFFER_TOO_SMALL;
-        goto exit;
-    }
-
     if( iv_length > 0 )
     {
         if( output_size < iv_length )
@@ -3577,13 +3570,6 @@
         goto exit;
     }
 
-    if( output_size < PSA_CIPHER_DECRYPT_OUTPUT_SIZE( slot->attr.type, alg,
-                                                      input_length ) )
-    {
-        status = PSA_ERROR_BUFFER_TOO_SMALL;
-        goto exit;
-    }
-
     status = psa_driver_wrapper_cipher_decrypt(
         &attributes, slot->key.data, slot->key.bytes,
         alg, input, input_length,
diff --git a/library/psa_crypto_cipher.c b/library/psa_crypto_cipher.c
index 754345e..9bb21a0 100644
--- a/library/psa_crypto_cipher.c
+++ b/library/psa_crypto_cipher.c
@@ -532,11 +532,6 @@
     if( status != PSA_SUCCESS )
         goto exit;
 
-    if( output_size < accumulated_length )
-    {
-        status = PSA_ERROR_BUFFER_TOO_SMALL;
-        goto exit;
-    }
 
     status = cipher_finish( &operation, output + accumulated_length,
                             output_size - accumulated_length, &olength );
diff --git a/library/psa_crypto_cipher.h b/library/psa_crypto_cipher.h
index 39e5688..5971e8d 100644
--- a/library/psa_crypto_cipher.h
+++ b/library/psa_crypto_cipher.h
@@ -223,13 +223,7 @@
  *                              \c key_type is the type of the key identified
  *                              by \p key and \p alg is the cipher algorithm
  *                              to compute.
- * \param[in]  output_size      Size of the \p output buffer in bytes. The core
- *                              has checked that this size is greater or equal to
- *                              PSA_CIPHER_ENCRYPT_OUTPUT_SIZE( key_type, alg, input_length )
- *                              where \c key_type is the type of the key
- *                              identified by \p key, \p alg is the cipher
- *                              algorithm to compute and \p input_length is the
- *                              size of the \p input buffer.
+ * \param[in]  output_size      Size of the \p output buffer in bytes.
  * \param[out] output_length    On success, the number of bytes that make up
  *                              the returned output. Initialized to zero
  *                              by the core.
@@ -279,13 +273,6 @@
  * \param[in]  input_length     Size of the \p input buffer in bytes.
  * \param[out] output           Buffer where the output is to be written.
  * \param[in]  output_size      Size of the \p output buffer in bytes.
- *                              The core has checked that this size is
- *                              greater or equal to
- *                              PSA_CIPHER_DECRYPT_OUTPUT_SIZE( key_type, alg, input_length )
- *                              where \c key_type is the type of the key
- *                              identified by \p key, \p alg is the cipher
- *                              algorithm to compute and \p input_length is the
- *                              size of the \p input buffer.
  * \param[out] output_length    On success, the number of bytes that make up
  *                              the returned output. Initialized to zero
  *                              by the core.