summaryrefslogtreecommitdiff
path: root/src/usr.bin/openssl/cms.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/usr.bin/openssl/cms.c')
-rw-r--r--src/usr.bin/openssl/cms.c35
1 files changed, 7 insertions, 28 deletions
diff --git a/src/usr.bin/openssl/cms.c b/src/usr.bin/openssl/cms.c
index 880ab1449b..7430f4c935 100644
--- a/src/usr.bin/openssl/cms.c
+++ b/src/usr.bin/openssl/cms.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: cms.c,v 1.39 2025/11/27 08:27:31 tb Exp $ */ 1/* $OpenBSD: cms.c,v 1.40 2025/12/20 07:02:37 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 */
@@ -89,12 +89,10 @@ static int cms_set_pkey_param(EVP_PKEY_CTX *pctx,
89#define SMIME_DATA_CREATE (8 | SMIME_OP) 89#define SMIME_DATA_CREATE (8 | SMIME_OP)
90#define SMIME_DIGEST_VERIFY (9 | SMIME_IP) 90#define SMIME_DIGEST_VERIFY (9 | SMIME_IP)
91#define SMIME_DIGEST_CREATE (10 | SMIME_OP) 91#define SMIME_DIGEST_CREATE (10 | SMIME_OP)
92#define SMIME_UNCOMPRESS (11 | SMIME_IP) 92#define SMIME_ENCRYPTED_DECRYPT (11 | SMIME_IP)
93#define SMIME_COMPRESS (12 | SMIME_OP) 93#define SMIME_ENCRYPTED_ENCRYPT (12 | SMIME_OP)
94#define SMIME_ENCRYPTED_DECRYPT (13 | SMIME_IP) 94#define SMIME_SIGN_RECEIPT (13 | SMIME_IP | SMIME_OP)
95#define SMIME_ENCRYPTED_ENCRYPT (14 | SMIME_OP) 95#define SMIME_VERIFY_RECEIPT (14 | SMIME_IP)
96#define SMIME_SIGN_RECEIPT (15 | SMIME_IP | SMIME_OP)
97#define SMIME_VERIFY_RECEIPT (16 | SMIME_IP)
98 96
99int verify_err = 0; 97int verify_err = 0;
100 98
@@ -602,13 +600,6 @@ static const struct option cms_options[] = {
602 .value = SMIME_CMSOUT, 600 .value = SMIME_CMSOUT,
603 }, 601 },
604 { 602 {
605 .name = "compress",
606 .desc = "Create CMS CompressedData type",
607 .type = OPTION_VALUE,
608 .opt.value = &cfg.operation,
609 .value = SMIME_COMPRESS,
610 },
611 {
612 .name = "content", 603 .name = "content",
613 .argname = "file", 604 .argname = "file",
614 .desc = "Supply or override content for detached signature", 605 .desc = "Supply or override content for detached signature",
@@ -998,13 +989,6 @@ static const struct option cms_options[] = {
998 .opt.arg = &cfg.to, 989 .opt.arg = &cfg.to,
999 }, 990 },
1000 { 991 {
1001 .name = "uncompress",
1002 .desc = "Uncompress CMS CompressedData type",
1003 .type = OPTION_VALUE,
1004 .opt.value = &cfg.operation,
1005 .value = SMIME_UNCOMPRESS,
1006 },
1007 {
1008 .name = "verify", 992 .name = "verify",
1009 .desc = "Verify signed message", 993 .desc = "Verify signed message",
1010 .type = OPTION_VALUE, 994 .type = OPTION_VALUE,
@@ -1138,7 +1122,7 @@ cms_usage(void)
1138 " -camellia192 | -camellia256 | -des | -des3 |\n" 1122 " -camellia192 | -camellia256 | -des | -des3 |\n"
1139 " -rc2-40 | -rc2-64 | -rc2-128] [-CAfile file]\n" 1123 " -rc2-40 | -rc2-64 | -rc2-128] [-CAfile file]\n"
1140 " [-CApath directory] [-CRLfile file] [-binary]\n" 1124 " [-CApath directory] [-CRLfile file] [-binary]\n"
1141 " [-certfile file] [-certsout file] [-cmsout] [-compress]\n" 1125 " [-certfile file] [-certsout file] [-cmsout]\n"
1142 " [-content file] [-crlfeol] [-data_create] [-data_out]\n" 1126 " [-content file] [-crlfeol] [-data_create] [-data_out]\n"
1143 " [-debug_decrypt] [-decrypt] [-digest_create] [-digest_verify]\n" 1127 " [-debug_decrypt] [-decrypt] [-digest_create] [-digest_verify]\n"
1144 " [-econtent_type type] [-encrypt] [-EncryptedData_decrypt]\n" 1128 " [-econtent_type type] [-encrypt] [-EncryptedData_decrypt]\n"
@@ -1156,7 +1140,7 @@ cms_usage(void)
1156 " [-receipt_request_to addr] [-recip file] [-resign]\n" 1140 " [-receipt_request_to addr] [-recip file] [-resign]\n"
1157 " [-secretkey key] [-secretkeyid id] [-sign] [-sign_receipt]\n" 1141 " [-secretkey key] [-secretkeyid id] [-sign] [-sign_receipt]\n"
1158 " [-signer file] [-stream | -indef | -noindef] [-subject s]\n" 1142 " [-signer file] [-stream | -indef | -noindef] [-subject s]\n"
1159 " [-text] [-to addr] [-uncompress] [-verify]\n" 1143 " [-text] [-to addr] [-verify]\n"
1160 " [-verify_receipt file] [-verify_retcode] [cert.pem ...]\n\n"); 1144 " [-verify_receipt file] [-verify_retcode] [cert.pem ...]\n\n");
1161 1145
1162 options_usage(cms_options); 1146 options_usage(cms_options);
@@ -1482,8 +1466,6 @@ cms_main(int argc, char **argv)
1482 } else if (cfg.operation == SMIME_DIGEST_CREATE) { 1466 } else if (cfg.operation == SMIME_DIGEST_CREATE) {
1483 cms = CMS_digest_create(in, cfg.sign_md, 1467 cms = CMS_digest_create(in, cfg.sign_md,
1484 cfg.flags); 1468 cfg.flags);
1485 } else if (cfg.operation == SMIME_COMPRESS) {
1486 cms = CMS_compress(in, -1, cfg.flags);
1487 } else if (cfg.operation == SMIME_ENCRYPT) { 1469 } else if (cfg.operation == SMIME_ENCRYPT) {
1488 int i; 1470 int i;
1489 cfg.flags |= CMS_PARTIAL; 1471 cfg.flags |= CMS_PARTIAL;
@@ -1691,9 +1673,6 @@ cms_main(int argc, char **argv)
1691 } else if (cfg.operation == SMIME_DATAOUT) { 1673 } else if (cfg.operation == SMIME_DATAOUT) {
1692 if (!CMS_data(cms, out, cfg.flags)) 1674 if (!CMS_data(cms, out, cfg.flags))
1693 goto end; 1675 goto end;
1694 } else if (cfg.operation == SMIME_UNCOMPRESS) {
1695 if (!CMS_uncompress(cms, indata, out, cfg.flags))
1696 goto end;
1697 } else if (cfg.operation == SMIME_DIGEST_VERIFY) { 1676 } else if (cfg.operation == SMIME_DIGEST_VERIFY) {
1698 if (CMS_digest_verify(cms, indata, out, cfg.flags) > 0) 1677 if (CMS_digest_verify(cms, indata, out, cfg.flags) > 0)
1699 BIO_printf(bio_err, "Verification successful\n"); 1678 BIO_printf(bio_err, "Verification successful\n");