summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/usr.bin/openssl/cms.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/usr.bin/openssl/cms.c b/src/usr.bin/openssl/cms.c
index 2adcfe8c11..ad01c0413c 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.11 2019/11/04 15:31:08 jsing Exp $ */ 1/* $OpenBSD: cms.c,v 1.12 2019/11/04 15:33:48 jsing 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 */
@@ -68,12 +68,12 @@
68 68
69#include <openssl/cms.h> 69#include <openssl/cms.h>
70 70
71static int save_certs(char *signerfile, STACK_OF(X509) * signers); 71static int save_certs(char *signerfile, STACK_OF(X509) *signers);
72static int cms_cb(int ok, X509_STORE_CTX * ctx); 72static int cms_cb(int ok, X509_STORE_CTX *ctx);
73static void receipt_request_print(BIO * out, CMS_ContentInfo * cms); 73static void receipt_request_print(BIO *out, CMS_ContentInfo *cms);
74static CMS_ReceiptRequest * make_receipt_request( 74static CMS_ReceiptRequest *make_receipt_request(
75 STACK_OF(OPENSSL_STRING) * rr_to, int rr_allorfirst, 75 STACK_OF(OPENSSL_STRING) *rr_to, int rr_allorfirst,
76 STACK_OF(OPENSSL_STRING) * rr_from); 76 STACK_OF(OPENSSL_STRING) *rr_from);
77 77
78#define SMIME_OP 0x10 78#define SMIME_OP 0x10
79#define SMIME_IP 0x20 79#define SMIME_IP 0x20
@@ -106,7 +106,7 @@ cms_main(int argc, char **argv)
106 const char *inmode = "r", *outmode = "w"; 106 const char *inmode = "r", *outmode = "w";
107 char *infile = NULL, *outfile = NULL, *rctfile = NULL; 107 char *infile = NULL, *outfile = NULL, *rctfile = NULL;
108 char *signerfile = NULL, *recipfile = NULL; 108 char *signerfile = NULL, *recipfile = NULL;
109 STACK_OF(OPENSSL_STRING) * sksigners = NULL, *skkeys = NULL; 109 STACK_OF(OPENSSL_STRING) *sksigners = NULL, *skkeys = NULL;
110 char *certfile = NULL, *keyfile = NULL, *contfile = NULL; 110 char *certfile = NULL, *keyfile = NULL, *contfile = NULL;
111 char *certsoutfile = NULL; 111 char *certsoutfile = NULL;
112 const EVP_CIPHER *cipher = NULL; 112 const EVP_CIPHER *cipher = NULL;
@@ -114,13 +114,13 @@ cms_main(int argc, char **argv)
114 X509_STORE *store = NULL; 114 X509_STORE *store = NULL;
115 X509 *cert = NULL, *recip = NULL, *signer = NULL; 115 X509 *cert = NULL, *recip = NULL, *signer = NULL;
116 EVP_PKEY *key = NULL; 116 EVP_PKEY *key = NULL;
117 STACK_OF(X509) * encerts = NULL, *other = NULL; 117 STACK_OF(X509) *encerts = NULL, *other = NULL;
118 BIO *in = NULL, *out = NULL, *indata = NULL, *rctin = NULL; 118 BIO *in = NULL, *out = NULL, *indata = NULL, *rctin = NULL;
119 int badarg = 0; 119 int badarg = 0;
120 int flags = CMS_DETACHED, noout = 0, print = 0; 120 int flags = CMS_DETACHED, noout = 0, print = 0;
121 int verify_retcode = 0; 121 int verify_retcode = 0;
122 int rr_print = 0, rr_allorfirst = -1; 122 int rr_print = 0, rr_allorfirst = -1;
123 STACK_OF(OPENSSL_STRING) * rr_to = NULL, *rr_from = NULL; 123 STACK_OF(OPENSSL_STRING) *rr_to = NULL, *rr_from = NULL;
124 CMS_ReceiptRequest *rr = NULL; 124 CMS_ReceiptRequest *rr = NULL;
125 char *to = NULL, *from = NULL, *subject = NULL; 125 char *to = NULL, *from = NULL, *subject = NULL;
126 char *CAfile = NULL, *CApath = NULL; 126 char *CAfile = NULL, *CApath = NULL;
@@ -660,7 +660,7 @@ argerr:
660 } 660 }
661 } 661 }
662 if (certsoutfile) { 662 if (certsoutfile) {
663 STACK_OF(X509) * allcerts; 663 STACK_OF(X509) *allcerts;
664 allcerts = CMS_get1_certs(cms); 664 allcerts = CMS_get1_certs(cms);
665 if (!save_certs(certsoutfile, allcerts)) { 665 if (!save_certs(certsoutfile, allcerts)) {
666 BIO_printf(bio_err, 666 BIO_printf(bio_err,
@@ -754,7 +754,7 @@ argerr:
754 754
755 } else if (operation == SMIME_SIGN_RECEIPT) { 755 } else if (operation == SMIME_SIGN_RECEIPT) {
756 CMS_ContentInfo *srcms = NULL; 756 CMS_ContentInfo *srcms = NULL;
757 STACK_OF(CMS_SignerInfo) * sis; 757 STACK_OF(CMS_SignerInfo) *sis;
758 CMS_SignerInfo *si; 758 CMS_SignerInfo *si;
759 sis = CMS_get0_SignerInfos(cms); 759 sis = CMS_get0_SignerInfos(cms);
760 if (!sis) 760 if (!sis)
@@ -885,7 +885,7 @@ argerr:
885 goto end; 885 goto end;
886 } 886 }
887 if (signerfile) { 887 if (signerfile) {
888 STACK_OF(X509) * signers; 888 STACK_OF(X509) *signers;
889 signers = CMS_get0_signers(cms); 889 signers = CMS_get0_signers(cms);
890 if (!save_certs(signerfile, signers)) { 890 if (!save_certs(signerfile, signers)) {
891 BIO_printf(bio_err, 891 BIO_printf(bio_err,
@@ -969,7 +969,7 @@ end:
969} 969}
970 970
971static int 971static int
972save_certs(char *signerfile, STACK_OF(X509) * signers) 972save_certs(char *signerfile, STACK_OF(X509) *signers)
973{ 973{
974 int i; 974 int i;
975 BIO *tmp; 975 BIO *tmp;
@@ -988,7 +988,7 @@ save_certs(char *signerfile, STACK_OF(X509) * signers)
988/* Minimal callback just to output policy info (if any) */ 988/* Minimal callback just to output policy info (if any) */
989 989
990static int 990static int
991cms_cb(int ok, X509_STORE_CTX * ctx) 991cms_cb(int ok, X509_STORE_CTX *ctx)
992{ 992{
993 int error; 993 int error;
994 994
@@ -1006,9 +1006,9 @@ cms_cb(int ok, X509_STORE_CTX * ctx)
1006} 1006}
1007 1007
1008static void 1008static void
1009gnames_stack_print(BIO * out, STACK_OF(GENERAL_NAMES) * gns) 1009gnames_stack_print(BIO *out, STACK_OF(GENERAL_NAMES) *gns)
1010{ 1010{
1011 STACK_OF(GENERAL_NAME) * gens; 1011 STACK_OF(GENERAL_NAME) *gens;
1012 GENERAL_NAME *gen; 1012 GENERAL_NAME *gen;
1013 int i, j; 1013 int i, j;
1014 1014
@@ -1025,13 +1025,13 @@ gnames_stack_print(BIO * out, STACK_OF(GENERAL_NAMES) * gns)
1025} 1025}
1026 1026
1027static void 1027static void
1028receipt_request_print(BIO * out, CMS_ContentInfo * cms) 1028receipt_request_print(BIO *out, CMS_ContentInfo *cms)
1029{ 1029{
1030 STACK_OF(CMS_SignerInfo) * sis; 1030 STACK_OF(CMS_SignerInfo) *sis;
1031 CMS_SignerInfo *si; 1031 CMS_SignerInfo *si;
1032 CMS_ReceiptRequest *rr; 1032 CMS_ReceiptRequest *rr;
1033 int allorfirst; 1033 int allorfirst;
1034 STACK_OF(GENERAL_NAMES) * rto, *rlist; 1034 STACK_OF(GENERAL_NAMES) *rto, *rlist;
1035 ASN1_STRING *scid; 1035 ASN1_STRING *scid;
1036 int i, rv; 1036 int i, rv;
1037 1037
@@ -1073,10 +1073,10 @@ receipt_request_print(BIO * out, CMS_ContentInfo * cms)
1073} 1073}
1074 1074
1075static STACK_OF(GENERAL_NAMES) * 1075static STACK_OF(GENERAL_NAMES) *
1076make_names_stack(STACK_OF(OPENSSL_STRING) * ns) 1076make_names_stack(STACK_OF(OPENSSL_STRING) *ns)
1077{ 1077{
1078 int i; 1078 int i;
1079 STACK_OF(GENERAL_NAMES) * ret; 1079 STACK_OF(GENERAL_NAMES) *ret;
1080 GENERAL_NAMES *gens = NULL; 1080 GENERAL_NAMES *gens = NULL;
1081 GENERAL_NAME *gen = NULL; 1081 GENERAL_NAME *gen = NULL;
1082 ret = sk_GENERAL_NAMES_new_null(); 1082 ret = sk_GENERAL_NAMES_new_null();
@@ -1110,10 +1110,10 @@ err:
1110 1110
1111 1111
1112static CMS_ReceiptRequest * 1112static CMS_ReceiptRequest *
1113make_receipt_request(STACK_OF(OPENSSL_STRING) * rr_to, int rr_allorfirst, 1113make_receipt_request(STACK_OF(OPENSSL_STRING) *rr_to, int rr_allorfirst,
1114 STACK_OF(OPENSSL_STRING) * rr_from) 1114 STACK_OF(OPENSSL_STRING) *rr_from)
1115{ 1115{
1116 STACK_OF(GENERAL_NAMES) * rct_to, *rct_from; 1116 STACK_OF(GENERAL_NAMES) *rct_to, *rct_from;
1117 CMS_ReceiptRequest *rr; 1117 CMS_ReceiptRequest *rr;
1118 1118
1119 rct_to = make_names_stack(rr_to); 1119 rct_to = make_names_stack(rr_to);