summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2024-08-22 12:14:33 +0000
committertb <>2024-08-22 12:14:33 +0000
commitc3a4b1711d3f254397fb214b2c452a87fd6f71ed (patch)
treea2f91b43293a99c3440fa5b480a903d3520ec656
parentf1a4f437d7bf75e7a4e62433eb54e6eff433baa8 (diff)
downloadopenbsd-c3a4b1711d3f254397fb214b2c452a87fd6f71ed.tar.gz
openbsd-c3a4b1711d3f254397fb214b2c452a87fd6f71ed.tar.bz2
openbsd-c3a4b1711d3f254397fb214b2c452a87fd6f71ed.zip
openssl pkcs12: remove support for LMK and CSP attributes
Documentation on what the Microsoft-specific local machine keyset and the cryptographic service provider are actually good for is hard to find. For some reason (perhaps one million and two arguments for PKCS12_create() was considered two too many) these hang off the EVP_PKEY in the attributes member, which serves no other purpose. Every use of EVP_PKEY (of which there are far too many) pays extra memory taxes for this fringe use case. This complication is not worth it. ok miod
-rw-r--r--src/usr.bin/openssl/pkcs12.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/src/usr.bin/openssl/pkcs12.c b/src/usr.bin/openssl/pkcs12.c
index c8706904f1..69e230eff9 100644
--- a/src/usr.bin/openssl/pkcs12.c
+++ b/src/usr.bin/openssl/pkcs12.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: pkcs12.c,v 1.27 2024/02/28 17:04:38 tb Exp $ */ 1/* $OpenBSD: pkcs12.c,v 1.28 2024/08/22 12:14:33 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project. 3 * project.
4 */ 4 */
@@ -93,14 +93,12 @@ static int alg_print(BIO *x, const X509_ALGOR *alg);
93static int set_pbe(BIO *err, int *ppbe, const char *str); 93static int set_pbe(BIO *err, int *ppbe, const char *str);
94 94
95static struct { 95static struct {
96 int add_lmk;
97 char *CAfile; 96 char *CAfile;
98 STACK_OF(OPENSSL_STRING) *canames; 97 STACK_OF(OPENSSL_STRING) *canames;
99 char *CApath; 98 char *CApath;
100 int cert_pbe; 99 int cert_pbe;
101 char *certfile; 100 char *certfile;
102 int chain; 101 int chain;
103 char *csp_name;
104 const EVP_CIPHER *enc; 102 const EVP_CIPHER *enc;
105 int export_cert; 103 int export_cert;
106 int key_pbe; 104 int key_pbe;
@@ -322,13 +320,6 @@ static const struct option pkcs12_options[] = {
322 .value = CLCERTS, 320 .value = CLCERTS,
323 }, 321 },
324 { 322 {
325 .name = "CSP",
326 .argname = "name",
327 .desc = "Microsoft CSP name",
328 .type = OPTION_ARG,
329 .opt.arg = &cfg.csp_name,
330 },
331 {
332 .name = "descert", 323 .name = "descert",
333 .desc = "Encrypt PKCS#12 certificates with triple DES (default RC2-40)", 324 .desc = "Encrypt PKCS#12 certificates with triple DES (default RC2-40)",
334 .type = OPTION_VALUE, 325 .type = OPTION_VALUE,
@@ -384,12 +375,6 @@ static const struct option pkcs12_options[] = {
384 .value = KEY_SIG, 375 .value = KEY_SIG,
385 }, 376 },
386 { 377 {
387 .name = "LMK",
388 .desc = "Add local machine keyset attribute to private key",
389 .type = OPTION_FLAG,
390 .opt.flag = &cfg.add_lmk,
391 },
392 {
393 .name = "macalg", 378 .name = "macalg",
394 .argname = "alg", 379 .argname = "alg",
395 .desc = "Digest algorithm used in MAC (default SHA1)", 380 .desc = "Digest algorithm used in MAC (default SHA1)",
@@ -719,15 +704,6 @@ pkcs12_main(int argc, char **argv)
719 X509_alias_set1(sk_X509_value(certs, i), catmp, -1); 704 X509_alias_set1(sk_X509_value(certs, i), catmp, -1);
720 } 705 }
721 706
722 if (cfg.csp_name != NULL && key != NULL)
723 EVP_PKEY_add1_attr_by_NID(key, NID_ms_csp_name,
724 MBSTRING_ASC,
725 (unsigned char *) cfg.csp_name, -1);
726
727 if (cfg.add_lmk && key != NULL)
728 EVP_PKEY_add1_attr_by_NID(key, NID_LocalKeySet, 0, NULL,
729 -1);
730
731 if (!cfg.noprompt && 707 if (!cfg.noprompt &&
732 EVP_read_pw_string(pass, sizeof pass, 708 EVP_read_pw_string(pass, sizeof pass,
733 "Enter Export Password:", 1)) { 709 "Enter Export Password:", 1)) {