diff options
Diffstat (limited to 'src/usr.bin/openssl/rsa.c')
| -rw-r--r-- | src/usr.bin/openssl/rsa.c | 40 |
1 files changed, 5 insertions, 35 deletions
diff --git a/src/usr.bin/openssl/rsa.c b/src/usr.bin/openssl/rsa.c index 231674b5a6..0d331f6a9a 100644 --- a/src/usr.bin/openssl/rsa.c +++ b/src/usr.bin/openssl/rsa.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: rsa.c,v 1.14 2019/07/14 03:30:46 guenther Exp $ */ | 1 | /* $OpenBSD: rsa.c,v 1.15 2021/11/26 16:23:27 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -88,7 +88,6 @@ static struct { | |||
| 88 | int pubin; | 88 | int pubin; |
| 89 | int pubout; | 89 | int pubout; |
| 90 | int pvk_encr; | 90 | int pvk_encr; |
| 91 | int sgckey; | ||
| 92 | int text; | 91 | int text; |
| 93 | } rsa_config; | 92 | } rsa_config; |
| 94 | 93 | ||
| @@ -215,12 +214,6 @@ static const struct option rsa_options[] = { | |||
| 215 | .opt.value = &rsa_config.pubout, | 214 | .opt.value = &rsa_config.pubout, |
| 216 | }, | 215 | }, |
| 217 | { | 216 | { |
| 218 | .name = "sgckey", | ||
| 219 | .desc = "Use modified NET algorithm for IIS and SGC keys", | ||
| 220 | .type = OPTION_FLAG, | ||
| 221 | .opt.flag = &rsa_config.sgckey, | ||
| 222 | }, | ||
| 223 | { | ||
| 224 | .name = "text", | 217 | .name = "text", |
| 225 | .desc = "Print in plain text in addition to encoded", | 218 | .desc = "Print in plain text in addition to encoded", |
| 226 | .type = OPTION_FLAG, | 219 | .type = OPTION_FLAG, |
| @@ -244,7 +237,7 @@ rsa_usage() | |||
| 244 | "[-inform fmt]\n" | 237 | "[-inform fmt]\n" |
| 245 | " [-modulus] [-noout] [-out file] [-outform fmt] " | 238 | " [-modulus] [-noout] [-out file] [-outform fmt] " |
| 246 | "[-passin src]\n" | 239 | "[-passin src]\n" |
| 247 | " [-passout src] [-pubin] [-pubout] [-sgckey] [-text]\n\n"); | 240 | " [-passout src] [-pubin] [-pubout] [-text]\n\n"); |
| 248 | options_usage(rsa_options); | 241 | options_usage(rsa_options); |
| 249 | fprintf(stderr, "\n"); | 242 | fprintf(stderr, "\n"); |
| 250 | 243 | ||
| @@ -300,19 +293,14 @@ rsa_main(int argc, char **argv) | |||
| 300 | tmpformat = FORMAT_PEMRSA; | 293 | tmpformat = FORMAT_PEMRSA; |
| 301 | else if (rsa_config.informat == FORMAT_ASN1) | 294 | else if (rsa_config.informat == FORMAT_ASN1) |
| 302 | tmpformat = FORMAT_ASN1RSA; | 295 | tmpformat = FORMAT_ASN1RSA; |
| 303 | } else if (rsa_config.informat == FORMAT_NETSCAPE && | 296 | } else |
| 304 | rsa_config.sgckey) | ||
| 305 | tmpformat = FORMAT_IISSGC; | ||
| 306 | else | ||
| 307 | tmpformat = rsa_config.informat; | 297 | tmpformat = rsa_config.informat; |
| 308 | 298 | ||
| 309 | pkey = load_pubkey(bio_err, rsa_config.infile, | 299 | pkey = load_pubkey(bio_err, rsa_config.infile, |
| 310 | tmpformat, 1, passin, "Public Key"); | 300 | tmpformat, 1, passin, "Public Key"); |
| 311 | } else | 301 | } else |
| 312 | pkey = load_key(bio_err, rsa_config.infile, | 302 | pkey = load_key(bio_err, rsa_config.infile, |
| 313 | (rsa_config.informat == FORMAT_NETSCAPE && | 303 | rsa_config.informat, 1, passin, "Private Key"); |
| 314 | rsa_config.sgckey ? FORMAT_IISSGC : | ||
| 315 | rsa_config.informat), 1, passin, "Private Key"); | ||
| 316 | 304 | ||
| 317 | if (pkey != NULL) | 305 | if (pkey != NULL) |
| 318 | rsa = EVP_PKEY_get1_RSA(pkey); | 306 | rsa = EVP_PKEY_get1_RSA(pkey); |
| @@ -380,25 +368,7 @@ rsa_main(int argc, char **argv) | |||
| 380 | i = i2d_RSA_PUBKEY_bio(out, rsa); | 368 | i = i2d_RSA_PUBKEY_bio(out, rsa); |
| 381 | } else | 369 | } else |
| 382 | i = i2d_RSAPrivateKey_bio(out, rsa); | 370 | i = i2d_RSAPrivateKey_bio(out, rsa); |
| 383 | } | 371 | } else if (rsa_config.outformat == FORMAT_PEM) { |
| 384 | #ifndef OPENSSL_NO_RC4 | ||
| 385 | else if (rsa_config.outformat == FORMAT_NETSCAPE) { | ||
| 386 | unsigned char *p, *pp; | ||
| 387 | int size; | ||
| 388 | |||
| 389 | i = 1; | ||
| 390 | size = i2d_RSA_NET(rsa, NULL, NULL, rsa_config.sgckey); | ||
| 391 | if ((p = malloc(size)) == NULL) { | ||
| 392 | BIO_printf(bio_err, "Memory allocation failure\n"); | ||
| 393 | goto end; | ||
| 394 | } | ||
| 395 | pp = p; | ||
| 396 | i2d_RSA_NET(rsa, &p, NULL, rsa_config.sgckey); | ||
| 397 | BIO_write(out, (char *) pp, size); | ||
| 398 | free(pp); | ||
| 399 | } | ||
| 400 | #endif | ||
| 401 | else if (rsa_config.outformat == FORMAT_PEM) { | ||
| 402 | if (rsa_config.pubout || rsa_config.pubin) { | 372 | if (rsa_config.pubout || rsa_config.pubin) { |
| 403 | if (rsa_config.pubout == 2) | 373 | if (rsa_config.pubout == 2) |
| 404 | i = PEM_write_bio_RSAPublicKey(out, rsa); | 374 | i = PEM_write_bio_RSAPublicKey(out, rsa); |
