Index: libgcrypt-1.10.3/tests/pkcs1v2.c
===================================================================
--- libgcrypt-1.10.3.orig/tests/pkcs1v2.c
+++ libgcrypt-1.10.3/tests/pkcs1v2.c
@@ -436,14 +436,8 @@ check_v15crypt (void)
 
       if (in_fips_mode)
         {
-          unsigned int nbits = gcry_pk_get_nbits (pub_key);
-
-          if (nbits < 2048)
-            {
-              if (verbose > 1)
-                info ("... skipped\n");
-              goto next;
-            }
+          /* PKCS1.5 is not supported in FIPS-140-3 */
+          goto next;
         }
 
       for (mno = 0; mno < DIM (tbl[0].m); mno++)
@@ -522,6 +516,12 @@ check_v15crypt (void)
             }
           else if (err)
           {
+            /* SKIP the test in fips mode, random-override is not allowed */
+            if (in_fips_mode && gcry_err_code (err) == GPG_ERR_INV_FLAG)
+              {
+                gcry_sexp_release (plain);
+                continue;
+              }
             /* If the message is not set, the padding is invalid and failure is expected */
             if (tbl[tno].m[mno].mesg != NULL)
               {
@@ -571,8 +571,9 @@ check_v15crypt (void)
                   fail ("mismatch in gcry_pk_decrypt. Expected %s\n", msg);
                 }
             }
-            gcry_sexp_release (plain);
-            plain = NULL;
+          gcry_sexp_release (plain);
+          plain = NULL;
+          ciph = NULL;
         }
 
     next:
