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