psa_util: convert_der_to_raw_single_int: ensure the input DER integers have valid length

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/library/psa_util.c b/library/psa_util.c
index be257e7..b13d83d 100644
--- a/library/psa_util.c
+++ b/library/psa_util.c
@@ -492,10 +492,10 @@
     if ((unpadded_len > 0) && (*p == 0x00)) {
         p++;
         unpadded_len--;
-        /* It should never happen that the input number is all zeros. */
-        if (unpadded_len == 0) {
-            return MBEDTLS_ERR_ASN1_LENGTH_MISMATCH;
-        }
+    }
+    /* It should never happen that the input number has 0 length. */
+    if (unpadded_len == 0) {
+        return MBEDTLS_ERR_ASN1_INVALID_DATA;
     }
 
     if (unpadded_len > coordinate_size) {