Blame SOURCES/openssl-1.0.2a-rsa-x931.patch

fd2893
diff -up openssl-1.0.2a/apps/genrsa.c.x931 openssl-1.0.2a/apps/genrsa.c
fd2893
--- openssl-1.0.2a/apps/genrsa.c.x931	2015-04-09 18:18:24.132107287 +0200
fd2893
+++ openssl-1.0.2a/apps/genrsa.c	2015-04-09 18:18:18.852985339 +0200
fd2893
@@ -97,6 +97,7 @@ int MAIN(int argc, char **argv)
fd2893
     int ret = 1;
fd2893
     int i, num = DEFBITS;
fd2893
     long l;
fd2893
+    int use_x931 = 0;
fd2893
     const EVP_CIPHER *enc = NULL;
fd2893
     unsigned long f4 = RSA_F4;
fd2893
     char *outfile = NULL;
fd2893
@@ -139,6 +140,8 @@ int MAIN(int argc, char **argv)
fd2893
             f4 = 3;
fd2893
         else if (strcmp(*argv, "-F4") == 0 || strcmp(*argv, "-f4") == 0)
fd2893
             f4 = RSA_F4;
fd2893
+        else if (strcmp(*argv, "-x931") == 0)
fd2893
+            use_x931 = 1;
fd2893
 # ifndef OPENSSL_NO_ENGINE
fd2893
         else if (strcmp(*argv, "-engine") == 0) {
fd2893
             if (--argc < 1)
fd2893
@@ -278,7 +281,13 @@ int MAIN(int argc, char **argv)
fd2893
     if (!rsa)
fd2893
         goto err;
fd2893
 
fd2893
-    if (!BN_set_word(bn, f4) || !RSA_generate_key_ex(rsa, num, bn, &cb))
fd2893
+    if (use_x931) {
fd2893
+        if (!BN_set_word(bn, f4))
fd2893
+            goto err;
fd2893
+        if (!RSA_X931_generate_key_ex(rsa, num, bn, &cb))
fd2893
+            goto err;
fd2893
+    } else if (!BN_set_word(bn, f4)
fd2893
+               || !RSA_generate_key_ex(rsa, num, bn, &cb))
fd2893
         goto err;
fd2893
 
fd2893
     app_RAND_write_file(NULL, bio_err);