psa_util: improve check of raw_len in mbedtls_ecdsa_raw_to_der()

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/library/psa_util.c b/library/psa_util.c
index 1bb02e9..f3fcd1d 100644
--- a/library/psa_util.c
+++ b/library/psa_util.c
@@ -413,7 +413,7 @@
     unsigned char *p = der + der_size;
     int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
 
-    if (raw_len < 2 * coordinate_len) {
+    if ((raw_len < 2 * coordinate_len) || (raw_len > 2 * coordinate_len)) {
         return MBEDTLS_ERR_ASN1_INVALID_DATA;
     }