library: debug: improve input param check in mbedtls_debug_print_psa_rsa()

Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/library/debug.c b/library/debug.c
index 9ded720..20ef3fd 100644
--- a/library/debug.c
+++ b/library/debug.c
@@ -333,6 +333,13 @@
     size_t len, bits;
     int ret;
 
+    if (NULL == ssl              ||
+        NULL == ssl->conf        ||
+        NULL == ssl->conf->f_dbg ||
+        level > debug_threshold) {
+        return;
+    }
+
     if (pk->pub_raw_len > sizeof(key_der)) {
         return;
     }