summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2025-01-02 13:10:03 +0000
committertb <>2025-01-02 13:10:03 +0000
commit31683601b72b2a5980f5f5d968711f4a1fba7a52 (patch)
treec4838fa7396ce47a209dde85f2982a12ac8265be
parent6ea9ba6b09ff9e35104226f2e1b9e2540f4afa4e (diff)
downloadopenbsd-31683601b72b2a5980f5f5d968711f4a1fba7a52.tar.gz
openbsd-31683601b72b2a5980f5f5d968711f4a1fba7a52.tar.bz2
openbsd-31683601b72b2a5980f5f5d968711f4a1fba7a52.zip
Merge s_apps.h into apps.h
discussed with jsing
-rw-r--r--src/usr.bin/openssl/apps.h42
-rw-r--r--src/usr.bin/openssl/openssl.c4
-rw-r--r--src/usr.bin/openssl/s_apps.h150
-rw-r--r--src/usr.bin/openssl/s_cb.c4
-rw-r--r--src/usr.bin/openssl/s_client.c4
-rw-r--r--src/usr.bin/openssl/s_server.c4
-rw-r--r--src/usr.bin/openssl/s_socket.c4
-rw-r--r--src/usr.bin/openssl/s_time.c4
8 files changed, 47 insertions, 169 deletions
diff --git a/src/usr.bin/openssl/apps.h b/src/usr.bin/openssl/apps.h
index f8d67ccacd..c8d6154b9f 100644
--- a/src/usr.bin/openssl/apps.h
+++ b/src/usr.bin/openssl/apps.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: apps.h,v 1.40 2025/01/02 12:36:21 tb Exp $ */ 1/* $OpenBSD: apps.h,v 1.41 2025/01/02 13:10:03 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 *
@@ -126,6 +126,8 @@
126#include <openssl/ocsp.h> 126#include <openssl/ocsp.h>
127#endif 127#endif
128 128
129#include <openssl/ssl.h>
130
129#include <unistd.h> 131#include <unistd.h>
130 132
131/* numbers in us */ 133/* numbers in us */
@@ -364,4 +366,42 @@ int verify_main(int argc, char **argv);
364int version_main(int argc, char **argv); 366int version_main(int argc, char **argv);
365int x509_main(int argc, char **argv); 367int x509_main(int argc, char **argv);
366 368
369#define PORT 4433
370#define PORT_STR "4433"
371#define PROTOCOL "tcp"
372
373extern int verify_depth;
374extern int verify_return_error;
375
376int do_server(int port, int type, int *ret,
377 int (*cb)(int s, unsigned char *context),
378 unsigned char *context, int naccept);
379#ifdef HEADER_X509_H
380int verify_callback(int ok, X509_STORE_CTX *ctx);
381#endif
382#ifdef HEADER_SSL_H
383int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file);
384int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key);
385#endif
386int ssl_print_tmp_key(BIO *out, SSL *s);
387int init_client(int *sock, char *server, char *port, int type, int af);
388int extract_port(char *str, short *port_ptr);
389int extract_host_port(char *str, char **host_ptr, unsigned char *ip, char **p);
390
391long bio_dump_callback(BIO *bio, int cmd, const char *argp, int argi,
392 long argl, long ret);
393
394#ifdef HEADER_SSL_H
395void apps_ssl_info_callback(const SSL *s, int where, int ret);
396void msg_cb(int write_p, int version, int content_type, const void *buf,
397 size_t len, SSL *ssl, void *arg);
398void tlsext_cb(SSL *s, int client_server, int type, unsigned char *data,
399 int len, void *arg);
400#endif
401
402int generate_cookie_callback(SSL *ssl, unsigned char *cookie,
403 unsigned int *cookie_len);
404int verify_cookie_callback(SSL *ssl, const unsigned char *cookie,
405 unsigned int cookie_len);
406
367#endif 407#endif
diff --git a/src/usr.bin/openssl/openssl.c b/src/usr.bin/openssl/openssl.c
index eaa5401ece..75a0e4d266 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.38 2025/01/02 12:31:44 tb Exp $ */ 1/* $OpenBSD: openssl.c,v 1.39 2025/01/02 13:10:03 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 *
@@ -127,8 +127,6 @@
127#include <openssl/ssl.h> 127#include <openssl/ssl.h>
128#include <openssl/x509.h> 128#include <openssl/x509.h>
129 129
130#include "s_apps.h"
131
132#define FUNC_TYPE_GENERAL 1 130#define FUNC_TYPE_GENERAL 1
133#define FUNC_TYPE_MD 2 131#define FUNC_TYPE_MD 2
134#define FUNC_TYPE_CIPHER 3 132#define FUNC_TYPE_CIPHER 3
diff --git a/src/usr.bin/openssl/s_apps.h b/src/usr.bin/openssl/s_apps.h
deleted file mode 100644
index d8217d9eee..0000000000
--- a/src/usr.bin/openssl/s_apps.h
+++ /dev/null
@@ -1,150 +0,0 @@
1/* $OpenBSD: s_apps.h,v 1.8 2024/05/18 08:47:13 jsg Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved.
4 *
5 * This package is an SSL implementation written
6 * by Eric Young (eay@cryptsoft.com).
7 * The implementation was written so as to conform with Netscapes SSL.
8 *
9 * This library is free for commercial and non-commercial use as long as
10 * the following conditions are aheared to. The following conditions
11 * apply to all code found in this distribution, be it the RC4, RSA,
12 * lhash, DES, etc., code; not just the SSL code. The SSL documentation
13 * included with this distribution is covered by the same copyright terms
14 * except that the holder is Tim Hudson (tjh@cryptsoft.com).
15 *
16 * Copyright remains Eric Young's, and as such any Copyright notices in
17 * the code are not to be removed.
18 * If this package is used in a product, Eric Young should be given attribution
19 * as the author of the parts of the library used.
20 * This can be in the form of a textual message at program startup or
21 * in documentation (online or textual) provided with the package.
22 *
23 * Redistribution and use in source and binary forms, with or without
24 * modification, are permitted provided that the following conditions
25 * are met:
26 * 1. Redistributions of source code must retain the copyright
27 * notice, this list of conditions and the following disclaimer.
28 * 2. Redistributions in binary form must reproduce the above copyright
29 * notice, this list of conditions and the following disclaimer in the
30 * documentation and/or other materials provided with the distribution.
31 * 3. All advertising materials mentioning features or use of this software
32 * must display the following acknowledgement:
33 * "This product includes cryptographic software written by
34 * Eric Young (eay@cryptsoft.com)"
35 * The word 'cryptographic' can be left out if the rouines from the library
36 * being used are not cryptographic related :-).
37 * 4. If you include any Windows specific code (or a derivative thereof) from
38 * the apps directory (application code) you must include an acknowledgement:
39 * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
40 *
41 * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
42 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
44 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
45 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
46 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
47 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
49 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
50 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
51 * SUCH DAMAGE.
52 *
53 * The licence and distribution terms for any publically available version or
54 * derivative of this code cannot be changed. i.e. this code cannot simply be
55 * copied and put under another distribution licence
56 * [including the GNU Public Licence.]
57 */
58/* ====================================================================
59 * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved.
60 *
61 * Redistribution and use in source and binary forms, with or without
62 * modification, are permitted provided that the following conditions
63 * are met:
64 *
65 * 1. Redistributions of source code must retain the above copyright
66 * notice, this list of conditions and the following disclaimer.
67 *
68 * 2. Redistributions in binary form must reproduce the above copyright
69 * notice, this list of conditions and the following disclaimer in
70 * the documentation and/or other materials provided with the
71 * distribution.
72 *
73 * 3. All advertising materials mentioning features or use of this
74 * software must display the following acknowledgment:
75 * "This product includes software developed by the OpenSSL Project
76 * for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
77 *
78 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
79 * endorse or promote products derived from this software without
80 * prior written permission. For written permission, please contact
81 * openssl-core@openssl.org.
82 *
83 * 5. Products derived from this software may not be called "OpenSSL"
84 * nor may "OpenSSL" appear in their names without prior written
85 * permission of the OpenSSL Project.
86 *
87 * 6. Redistributions of any form whatsoever must retain the following
88 * acknowledgment:
89 * "This product includes software developed by the OpenSSL Project
90 * for use in the OpenSSL Toolkit (http://www.openssl.org/)"
91 *
92 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
93 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
94 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
95 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
96 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
97 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
98 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
99 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
101 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
102 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
103 * OF THE POSSIBILITY OF SUCH DAMAGE.
104 * ====================================================================
105 *
106 * This product includes cryptographic software written by Eric Young
107 * (eay@cryptsoft.com). This product includes software written by Tim
108 * Hudson (tjh@cryptsoft.com).
109 *
110 */
111#include <sys/types.h>
112#include <openssl/opensslconf.h>
113
114#define PORT 4433
115#define PORT_STR "4433"
116#define PROTOCOL "tcp"
117
118extern int verify_depth;
119extern int verify_return_error;
120
121int do_server(int port, int type, int *ret,
122 int (*cb)(int s, unsigned char *context),
123 unsigned char *context, int naccept);
124#ifdef HEADER_X509_H
125int verify_callback(int ok, X509_STORE_CTX *ctx);
126#endif
127#ifdef HEADER_SSL_H
128int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file);
129int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key);
130#endif
131int ssl_print_tmp_key(BIO *out, SSL *s);
132int init_client(int *sock, char *server, char *port, int type, int af);
133int extract_port(char *str, short *port_ptr);
134int extract_host_port(char *str, char **host_ptr, unsigned char *ip, char **p);
135
136long bio_dump_callback(BIO *bio, int cmd, const char *argp, int argi,
137 long argl, long ret);
138
139#ifdef HEADER_SSL_H
140void apps_ssl_info_callback(const SSL *s, int where, int ret);
141void msg_cb(int write_p, int version, int content_type, const void *buf,
142 size_t len, SSL *ssl, void *arg);
143void tlsext_cb(SSL *s, int client_server, int type, unsigned char *data,
144 int len, void *arg);
145#endif
146
147int generate_cookie_callback(SSL *ssl, unsigned char *cookie,
148 unsigned int *cookie_len);
149int verify_cookie_callback(SSL *ssl, const unsigned char *cookie,
150 unsigned int cookie_len);
diff --git a/src/usr.bin/openssl/s_cb.c b/src/usr.bin/openssl/s_cb.c
index d503b8cf27..fcb2cd3076 100644
--- a/src/usr.bin/openssl/s_cb.c
+++ b/src/usr.bin/openssl/s_cb.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_cb.c,v 1.21 2023/04/14 15:27:13 tb Exp $ */ 1/* $OpenBSD: s_cb.c,v 1.22 2025/01/02 13:10:03 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 *
@@ -124,8 +124,6 @@
124#include <openssl/ssl.h> 124#include <openssl/ssl.h>
125#include <openssl/x509.h> 125#include <openssl/x509.h>
126 126
127#include "s_apps.h"
128
129#define COOKIE_SECRET_LENGTH 16 127#define COOKIE_SECRET_LENGTH 16
130 128
131int verify_depth = 0; 129int verify_depth = 0;
diff --git a/src/usr.bin/openssl/s_client.c b/src/usr.bin/openssl/s_client.c
index 45260ac875..96cf92d4f2 100644
--- a/src/usr.bin/openssl/s_client.c
+++ b/src/usr.bin/openssl/s_client.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_client.c,v 1.65 2025/01/02 12:36:21 tb Exp $ */ 1/* $OpenBSD: s_client.c,v 1.66 2025/01/02 13:10:03 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 *
@@ -159,8 +159,6 @@
159#include <openssl/ssl.h> 159#include <openssl/ssl.h>
160#include <openssl/x509.h> 160#include <openssl/x509.h>
161 161
162#include "s_apps.h"
163
164/*#define SSL_HOST_NAME "www.netscape.com" */ 162/*#define SSL_HOST_NAME "www.netscape.com" */
165/*#define SSL_HOST_NAME "193.118.187.102" */ 163/*#define SSL_HOST_NAME "193.118.187.102" */
166#define SSL_HOST_NAME "localhost" 164#define SSL_HOST_NAME "localhost"
diff --git a/src/usr.bin/openssl/s_server.c b/src/usr.bin/openssl/s_server.c
index 8984586ab5..f56042a4b4 100644
--- a/src/usr.bin/openssl/s_server.c
+++ b/src/usr.bin/openssl/s_server.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_server.c,v 1.60 2025/01/02 12:36:21 tb Exp $ */ 1/* $OpenBSD: s_server.c,v 1.61 2025/01/02 13:10:03 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 *
@@ -174,8 +174,6 @@
174 174
175#include <openssl/rsa.h> 175#include <openssl/rsa.h>
176 176
177#include "s_apps.h"
178
179static void s_server_init(void); 177static void s_server_init(void);
180static void sv_usage(void); 178static void sv_usage(void);
181static void print_stats(BIO *bp, SSL_CTX *ctx); 179static void print_stats(BIO *bp, SSL_CTX *ctx);
diff --git a/src/usr.bin/openssl/s_socket.c b/src/usr.bin/openssl/s_socket.c
index db125c1ed3..86a23c56d1 100644
--- a/src/usr.bin/openssl/s_socket.c
+++ b/src/usr.bin/openssl/s_socket.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_socket.c,v 1.13 2021/12/06 11:06:58 tb Exp $ */ 1/* $OpenBSD: s_socket.c,v 1.14 2025/01/02 13:10:03 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 *
@@ -71,8 +71,6 @@
71 71
72#include <openssl/ssl.h> 72#include <openssl/ssl.h>
73 73
74#include "s_apps.h"
75
76static int init_server(int *sock, int port, int type); 74static int init_server(int *sock, int port, int type);
77static int init_server_long(int *sock, int port, char *ip, int type); 75static int init_server_long(int *sock, int port, char *ip, int type);
78static int do_accept(int acc_sock, int *sock); 76static int do_accept(int acc_sock, int *sock);
diff --git a/src/usr.bin/openssl/s_time.c b/src/usr.bin/openssl/s_time.c
index 7eed6d486e..c90be33f28 100644
--- a/src/usr.bin/openssl/s_time.c
+++ b/src/usr.bin/openssl/s_time.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: s_time.c,v 1.38 2023/03/06 14:32:06 tb Exp $ */ 1/* $OpenBSD: s_time.c,v 1.39 2025/01/02 13:10:03 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 *
@@ -78,8 +78,6 @@
78#include <openssl/ssl.h> 78#include <openssl/ssl.h>
79#include <openssl/x509.h> 79#include <openssl/x509.h>
80 80
81#include "s_apps.h"
82
83#define SSL_CONNECT_NAME "localhost:4433" 81#define SSL_CONNECT_NAME "localhost:4433"
84 82
85#define BUFSIZZ 1024*10 83#define BUFSIZZ 1024*10