summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2023-04-25 16:11:02 +0000
committertb <>2023-04-25 16:11:02 +0000
commit0d93f23822e7889e043d8a9e07ab66b33b45dd53 (patch)
tree2b03158b79a916af2d07cae674152288709c99c9
parentd05ab2065f197a796d440b6d16c5a157ecfc3531 (diff)
downloadopenbsd-0d93f23822e7889e043d8a9e07ab66b33b45dd53.tar.gz
openbsd-0d93f23822e7889e043d8a9e07ab66b33b45dd53.tar.bz2
openbsd-0d93f23822e7889e043d8a9e07ab66b33b45dd53.zip
Remove the nseq command
-rw-r--r--src/usr.bin/openssl/Makefile4
-rw-r--r--src/usr.bin/openssl/nseq.c174
-rw-r--r--src/usr.bin/openssl/openssl.135
-rw-r--r--src/usr.bin/openssl/openssl.c3
4 files changed, 5 insertions, 211 deletions
diff --git a/src/usr.bin/openssl/Makefile b/src/usr.bin/openssl/Makefile
index 664a520003..47199c10e1 100644
--- a/src/usr.bin/openssl/Makefile
+++ b/src/usr.bin/openssl/Makefile
@@ -1,4 +1,4 @@
1# $OpenBSD: Makefile,v 1.11 2019/11/04 15:25:54 jsing Exp $ 1# $OpenBSD: Makefile,v 1.12 2023/04/25 16:11:02 tb Exp $
2 2
3.include <bsd.own.mk> 3.include <bsd.own.mk>
4 4
@@ -22,7 +22,7 @@ CFLAGS+= -DLIBRESSL_INTERNAL
22 22
23SRCS= apps.c apps_posix.c asn1pars.c ca.c certhash.c ciphers.c cms.c crl.c \ 23SRCS= apps.c apps_posix.c asn1pars.c ca.c certhash.c ciphers.c cms.c crl.c \
24 crl2p7.c dgst.c dh.c dhparam.c dsa.c dsaparam.c ec.c ecparam.c enc.c \ 24 crl2p7.c dgst.c dh.c dhparam.c dsa.c dsaparam.c ec.c ecparam.c enc.c \
25 errstr.c gendh.c gendsa.c genpkey.c genrsa.c nseq.c ocsp.c \ 25 errstr.c gendh.c gendsa.c genpkey.c genrsa.c ocsp.c \
26 openssl.c passwd.c pkcs12.c pkcs7.c pkcs8.c pkey.c pkeyparam.c \ 26 openssl.c passwd.c pkcs12.c pkcs7.c pkcs8.c pkey.c pkeyparam.c \
27 pkeyutl.c prime.c rand.c req.c rsa.c rsautl.c s_cb.c s_client.c \ 27 pkeyutl.c prime.c rand.c req.c rsa.c rsautl.c s_cb.c s_client.c \
28 s_server.c s_socket.c s_time.c sess_id.c smime.c speed.c spkac.c ts.c \ 28 s_server.c s_socket.c s_time.c sess_id.c smime.c speed.c spkac.c ts.c \
diff --git a/src/usr.bin/openssl/nseq.c b/src/usr.bin/openssl/nseq.c
deleted file mode 100644
index fb0dda5dca..0000000000
--- a/src/usr.bin/openssl/nseq.c
+++ /dev/null
@@ -1,174 +0,0 @@
1/* $OpenBSD: nseq.c,v 1.11 2023/03/06 14:32:06 tb Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999.
4 */
5/* ====================================================================
6 * Copyright (c) 1999 The OpenSSL Project. All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in
17 * the documentation and/or other materials provided with the
18 * distribution.
19 *
20 * 3. All advertising materials mentioning features or use of this
21 * software must display the following acknowledgment:
22 * "This product includes software developed by the OpenSSL Project
23 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24 *
25 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26 * endorse or promote products derived from this software without
27 * prior written permission. For written permission, please contact
28 * licensing@OpenSSL.org.
29 *
30 * 5. Products derived from this software may not be called "OpenSSL"
31 * nor may "OpenSSL" appear in their names without prior written
32 * permission of the OpenSSL Project.
33 *
34 * 6. Redistributions of any form whatsoever must retain the following
35 * acknowledgment:
36 * "This product includes software developed by the OpenSSL Project
37 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38 *
39 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
43 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50 * OF THE POSSIBILITY OF SUCH DAMAGE.
51 * ====================================================================
52 *
53 * This product includes cryptographic software written by Eric Young
54 * (eay@cryptsoft.com). This product includes software written by Tim
55 * Hudson (tjh@cryptsoft.com).
56 *
57 */
58
59#include <stdio.h>
60#include <string.h>
61
62#include "apps.h"
63
64#include <openssl/err.h>
65#include <openssl/pem.h>
66
67static struct {
68 char *infile;
69 char *outfile;
70 int toseq;
71} cfg;
72
73static const struct option nseq_options[] = {
74 {
75 .name = "in",
76 .argname = "file",
77 .desc = "Input file to read from (default stdin)",
78 .type = OPTION_ARG,
79 .opt.arg = &cfg.infile,
80 },
81 {
82 .name = "out",
83 .argname = "file",
84 .desc = "Output file to write to (default stdout)",
85 .type = OPTION_ARG,
86 .opt.arg = &cfg.outfile,
87 },
88 {
89 .name = "toseq",
90 .desc = "Convert certificates to Netscape certificate sequence",
91 .type = OPTION_FLAG,
92 .opt.flag = &cfg.toseq,
93 },
94 { NULL },
95};
96
97static void
98nseq_usage()
99{
100 fprintf(stderr, "usage: nseq [-in file] [-out file] [-toseq]\n");
101 options_usage(nseq_options);
102}
103
104int
105nseq_main(int argc, char **argv)
106{
107 BIO *in = NULL, *out = NULL;
108 X509 *x509 = NULL;
109 NETSCAPE_CERT_SEQUENCE *seq = NULL;
110 int i, ret = 1;
111
112 if (pledge("stdio cpath wpath rpath", NULL) == -1) {
113 perror("pledge");
114 exit(1);
115 }
116
117 memset(&cfg, 0, sizeof(cfg));
118
119 if (options_parse(argc, argv, nseq_options, NULL, NULL) != 0) {
120 nseq_usage();
121 return (1);
122 }
123
124 if (cfg.infile) {
125 if (!(in = BIO_new_file(cfg.infile, "r"))) {
126 BIO_printf(bio_err,
127 "Can't open input file %s\n", cfg.infile);
128 goto end;
129 }
130 } else
131 in = BIO_new_fp(stdin, BIO_NOCLOSE);
132
133 if (cfg.outfile) {
134 if (!(out = BIO_new_file(cfg.outfile, "w"))) {
135 BIO_printf(bio_err,
136 "Can't open output file %s\n", cfg.outfile);
137 goto end;
138 }
139 } else {
140 out = BIO_new_fp(stdout, BIO_NOCLOSE);
141 }
142 if (cfg.toseq) {
143 seq = NETSCAPE_CERT_SEQUENCE_new();
144 seq->certs = sk_X509_new_null();
145 while ((x509 = PEM_read_bio_X509(in, NULL, NULL, NULL)))
146 sk_X509_push(seq->certs, x509);
147
148 if (!sk_X509_num(seq->certs)) {
149 BIO_printf(bio_err, "Error reading certs file %s\n", cfg.infile);
150 ERR_print_errors(bio_err);
151 goto end;
152 }
153 PEM_write_bio_NETSCAPE_CERT_SEQUENCE(out, seq);
154 ret = 0;
155 goto end;
156 }
157 if (!(seq = PEM_read_bio_NETSCAPE_CERT_SEQUENCE(in, NULL, NULL, NULL))) {
158 BIO_printf(bio_err, "Error reading sequence file %s\n", cfg.infile);
159 ERR_print_errors(bio_err);
160 goto end;
161 }
162 for (i = 0; i < sk_X509_num(seq->certs); i++) {
163 x509 = sk_X509_value(seq->certs, i);
164 dump_cert_text(out, x509);
165 PEM_write_bio_X509(out, x509);
166 }
167 ret = 0;
168 end:
169 BIO_free(in);
170 BIO_free_all(out);
171 NETSCAPE_CERT_SEQUENCE_free(seq);
172
173 return (ret);
174}
diff --git a/src/usr.bin/openssl/openssl.1 b/src/usr.bin/openssl/openssl.1
index a7c3bf5ee6..c430e49f0f 100644
--- a/src/usr.bin/openssl/openssl.1
+++ b/src/usr.bin/openssl/openssl.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: openssl.1,v 1.142 2023/04/22 20:51:26 tb Exp $ 1.\" $OpenBSD: openssl.1,v 1.143 2023/04/25 16:11:02 tb Exp $
2.\" ==================================================================== 2.\" ====================================================================
3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved. 3.\" Copyright (c) 1998-2002 The OpenSSL Project. All rights reserved.
4.\" 4.\"
@@ -110,7 +110,7 @@
110.\" copied and put under another distribution licence 110.\" copied and put under another distribution licence
111.\" [including the GNU Public Licence.] 111.\" [including the GNU Public Licence.]
112.\" 112.\"
113.Dd $Mdocdate: April 22 2023 $ 113.Dd $Mdocdate: April 25 2023 $
114.Dt OPENSSL 1 114.Dt OPENSSL 1
115.Os 115.Os
116.Sh NAME 116.Sh NAME
@@ -2542,37 +2542,6 @@ The size of the private key to generate in bits.
2542This must be the last option specified. 2542This must be the last option specified.
2543The default is 2048. 2543The default is 2048.
2544.El 2544.El
2545.Tg nseq
2546.Sh NSEQ
2547.Nm openssl nseq
2548.Op Fl in Ar file
2549.Op Fl out Ar file
2550.Op Fl toseq
2551.Pp
2552The
2553.Nm nseq
2554command takes a file containing a Netscape certificate sequence
2555(an alternative to the standard PKCS#7 format)
2556and prints out the certificates contained in it,
2557or takes a file of certificates
2558and converts it into a Netscape certificate sequence.
2559.Pp
2560The options are as follows:
2561.Bl -tag -width Ds
2562.It Fl in Ar file
2563The input file to read from,
2564or standard input if not specified.
2565.It Fl out Ar file
2566The output file to write to,
2567or standard output if not specified.
2568.It Fl toseq
2569Normally, a Netscape certificate sequence will be input and the output
2570is the certificates contained in it.
2571With the
2572.Fl toseq
2573option the situation is reversed:
2574a Netscape certificate sequence is created from a file of certificates.
2575.El
2576.Tg ocsp 2545.Tg ocsp
2577.Sh OCSP 2546.Sh OCSP
2578.Bl -hang -width "openssl ocsp" 2547.Bl -hang -width "openssl ocsp"
diff --git a/src/usr.bin/openssl/openssl.c b/src/usr.bin/openssl/openssl.c
index 1b1cea6098..51940fdf64 100644
--- a/src/usr.bin/openssl/openssl.c
+++ b/src/usr.bin/openssl/openssl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: openssl.c,v 1.32 2022/11/11 18:24:32 joshua Exp $ */ 1/* $OpenBSD: openssl.c,v 1.33 2023/04/25 16:11:02 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 *
@@ -161,7 +161,6 @@ FUNCTION functions[] = {
161 { FUNC_TYPE_GENERAL, "enc", enc_main }, 161 { FUNC_TYPE_GENERAL, "enc", enc_main },
162 { FUNC_TYPE_GENERAL, "errstr", errstr_main }, 162 { FUNC_TYPE_GENERAL, "errstr", errstr_main },
163 { FUNC_TYPE_GENERAL, "genpkey", genpkey_main }, 163 { FUNC_TYPE_GENERAL, "genpkey", genpkey_main },
164 { FUNC_TYPE_GENERAL, "nseq", nseq_main },
165#ifndef OPENSSL_NO_OCSP 164#ifndef OPENSSL_NO_OCSP
166 { FUNC_TYPE_GENERAL, "ocsp", ocsp_main }, 165 { FUNC_TYPE_GENERAL, "ocsp", ocsp_main },
167#endif 166#endif