diff options
author | tb <> | 2023-04-25 18:48:32 +0000 |
---|---|---|
committer | tb <> | 2023-04-25 18:48:32 +0000 |
commit | 326188c5fb0d0373a3ac0c57922ede3500c468c5 (patch) | |
tree | 45ac67a10ac935d385254aab211068743021c681 | |
parent | 6c3bca154d6d7f953f61e2c4bf065eb94e485ce7 (diff) | |
download | openbsd-326188c5fb0d0373a3ac0c57922ede3500c468c5.tar.gz openbsd-326188c5fb0d0373a3ac0c57922ede3500c468c5.tar.bz2 openbsd-326188c5fb0d0373a3ac0c57922ede3500c468c5.zip |
Remove SXNET
Unused and no authorative information was found online in 2016
-rw-r--r-- | src/lib/libcrypto/Makefile | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/Symbols.namespace | 14 | ||||
-rw-r--r-- | src/lib/libcrypto/hidden/openssl/x509v3.h | 16 | ||||
-rw-r--r-- | src/lib/libcrypto/man/Makefile | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/man/SXNET_new.3 | 139 | ||||
-rw-r--r-- | src/lib/libcrypto/man/X509_EXTENSION_set_object.3 | 5 | ||||
-rw-r--r-- | src/lib/libcrypto/stack/safestack.h | 26 | ||||
-rw-r--r-- | src/lib/libcrypto/x509/x509_sxnet.c | 397 | ||||
-rw-r--r-- | src/lib/libcrypto/x509/x509v3.h | 42 |
9 files changed, 7 insertions, 638 deletions
diff --git a/src/lib/libcrypto/Makefile b/src/lib/libcrypto/Makefile index 057eb9cc54..d6175dfd5d 100644 --- a/src/lib/libcrypto/Makefile +++ b/src/lib/libcrypto/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.112 2023/04/25 17:54:10 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.113 2023/04/25 18:48:32 tb Exp $ |
2 | 2 | ||
3 | LIB= crypto | 3 | LIB= crypto |
4 | LIBREBUILD=y | 4 | LIBREBUILD=y |
@@ -704,7 +704,6 @@ SRCS+= x509_r2x.c | |||
704 | SRCS+= x509_req.c | 704 | SRCS+= x509_req.c |
705 | SRCS+= x509_set.c | 705 | SRCS+= x509_set.c |
706 | SRCS+= x509_skey.c | 706 | SRCS+= x509_skey.c |
707 | #SRCS+= x509_sxnet.c | ||
708 | SRCS+= x509_trs.c | 707 | SRCS+= x509_trs.c |
709 | SRCS+= x509_txt.c | 708 | SRCS+= x509_txt.c |
710 | SRCS+= x509_utl.c | 709 | SRCS+= x509_utl.c |
diff --git a/src/lib/libcrypto/Symbols.namespace b/src/lib/libcrypto/Symbols.namespace index 2fc36f3853..f477c4d6ce 100644 --- a/src/lib/libcrypto/Symbols.namespace +++ b/src/lib/libcrypto/Symbols.namespace | |||
@@ -657,20 +657,6 @@ _libre_BASIC_CONSTRAINTS_new | |||
657 | _libre_BASIC_CONSTRAINTS_free | 657 | _libre_BASIC_CONSTRAINTS_free |
658 | _libre_d2i_BASIC_CONSTRAINTS | 658 | _libre_d2i_BASIC_CONSTRAINTS |
659 | _libre_i2d_BASIC_CONSTRAINTS | 659 | _libre_i2d_BASIC_CONSTRAINTS |
660 | _libre_SXNET_new | ||
661 | _libre_SXNET_free | ||
662 | _libre_d2i_SXNET | ||
663 | _libre_i2d_SXNET | ||
664 | _libre_SXNETID_new | ||
665 | _libre_SXNETID_free | ||
666 | _libre_d2i_SXNETID | ||
667 | _libre_i2d_SXNETID | ||
668 | _libre_SXNET_add_id_asc | ||
669 | _libre_SXNET_add_id_ulong | ||
670 | _libre_SXNET_add_id_INTEGER | ||
671 | _libre_SXNET_get_id_asc | ||
672 | _libre_SXNET_get_id_ulong | ||
673 | _libre_SXNET_get_id_INTEGER | ||
674 | _libre_AUTHORITY_KEYID_new | 660 | _libre_AUTHORITY_KEYID_new |
675 | _libre_AUTHORITY_KEYID_free | 661 | _libre_AUTHORITY_KEYID_free |
676 | _libre_d2i_AUTHORITY_KEYID | 662 | _libre_d2i_AUTHORITY_KEYID |
diff --git a/src/lib/libcrypto/hidden/openssl/x509v3.h b/src/lib/libcrypto/hidden/openssl/x509v3.h index eed75e0749..044b55334d 100644 --- a/src/lib/libcrypto/hidden/openssl/x509v3.h +++ b/src/lib/libcrypto/hidden/openssl/x509v3.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509v3.h,v 1.1 2022/11/14 17:48:49 beck Exp $ */ | 1 | /* $OpenBSD: x509v3.h,v 1.2 2023/04/25 18:48:32 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2022 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2022 Bob Beck <beck@openbsd.org> |
4 | * | 4 | * |
@@ -33,20 +33,6 @@ LCRYPTO_USED(BASIC_CONSTRAINTS_new); | |||
33 | LCRYPTO_USED(BASIC_CONSTRAINTS_free); | 33 | LCRYPTO_USED(BASIC_CONSTRAINTS_free); |
34 | LCRYPTO_USED(d2i_BASIC_CONSTRAINTS); | 34 | LCRYPTO_USED(d2i_BASIC_CONSTRAINTS); |
35 | LCRYPTO_USED(i2d_BASIC_CONSTRAINTS); | 35 | LCRYPTO_USED(i2d_BASIC_CONSTRAINTS); |
36 | LCRYPTO_USED(SXNET_new); | ||
37 | LCRYPTO_USED(SXNET_free); | ||
38 | LCRYPTO_USED(d2i_SXNET); | ||
39 | LCRYPTO_USED(i2d_SXNET); | ||
40 | LCRYPTO_USED(SXNETID_new); | ||
41 | LCRYPTO_USED(SXNETID_free); | ||
42 | LCRYPTO_USED(d2i_SXNETID); | ||
43 | LCRYPTO_USED(i2d_SXNETID); | ||
44 | LCRYPTO_USED(SXNET_add_id_asc); | ||
45 | LCRYPTO_USED(SXNET_add_id_ulong); | ||
46 | LCRYPTO_USED(SXNET_add_id_INTEGER); | ||
47 | LCRYPTO_USED(SXNET_get_id_asc); | ||
48 | LCRYPTO_USED(SXNET_get_id_ulong); | ||
49 | LCRYPTO_USED(SXNET_get_id_INTEGER); | ||
50 | LCRYPTO_USED(AUTHORITY_KEYID_new); | 36 | LCRYPTO_USED(AUTHORITY_KEYID_new); |
51 | LCRYPTO_USED(AUTHORITY_KEYID_free); | 37 | LCRYPTO_USED(AUTHORITY_KEYID_free); |
52 | LCRYPTO_USED(d2i_AUTHORITY_KEYID); | 38 | LCRYPTO_USED(d2i_AUTHORITY_KEYID); |
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index b3fa34fe12..029c9473e1 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.244 2023/04/20 16:19:43 tb Exp $ | 1 | # $OpenBSD: Makefile,v 1.245 2023/04/25 18:48:32 tb Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> | 3 | .include <bsd.own.mk> |
4 | 4 | ||
@@ -304,7 +304,6 @@ MAN= \ | |||
304 | SMIME_write_CMS.3 \ | 304 | SMIME_write_CMS.3 \ |
305 | SMIME_write_PKCS7.3 \ | 305 | SMIME_write_PKCS7.3 \ |
306 | STACK_OF.3 \ | 306 | STACK_OF.3 \ |
307 | SXNET_new.3 \ | ||
308 | TS_REQ_new.3 \ | 307 | TS_REQ_new.3 \ |
309 | UI_UTIL_read_pw.3 \ | 308 | UI_UTIL_read_pw.3 \ |
310 | UI_create_method.3 \ | 309 | UI_create_method.3 \ |
diff --git a/src/lib/libcrypto/man/SXNET_new.3 b/src/lib/libcrypto/man/SXNET_new.3 deleted file mode 100644 index 9a723be203..0000000000 --- a/src/lib/libcrypto/man/SXNET_new.3 +++ /dev/null | |||
@@ -1,139 +0,0 @@ | |||
1 | .\" $OpenBSD: SXNET_new.3,v 1.3 2018/03/21 17:57:48 schwarze Exp $ | ||
2 | .\" | ||
3 | .\" Copyright (c) 2016 Ingo Schwarze <schwarze@openbsd.org> | ||
4 | .\" | ||
5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
7 | .\" copyright notice and this permission notice appear in all copies. | ||
8 | .\" | ||
9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | .\" | ||
17 | .Dd $Mdocdate: March 21 2018 $ | ||
18 | .Dt SXNET_NEW 3 | ||
19 | .Os | ||
20 | .Sh NAME | ||
21 | .Nm SXNET_new , | ||
22 | .Nm SXNET_free , | ||
23 | .Nm SXNETID_new , | ||
24 | .Nm SXNETID_free , | ||
25 | .Nm d2i_SXNET , | ||
26 | .Nm i2d_SXNET , | ||
27 | .Nm d2i_SXNETID , | ||
28 | .Nm i2d_SXNETID | ||
29 | .Nd Thawte strong extranet X.509 extension | ||
30 | .Sh SYNOPSIS | ||
31 | .In openssl/x509v3.h | ||
32 | .Ft SXNET * | ||
33 | .Fn SXNET_new void | ||
34 | .Ft void | ||
35 | .Fn SXNET_free "SXNET *sxnet" | ||
36 | .Ft SXNETID * | ||
37 | .Fn SXNETID_new void | ||
38 | .Ft void | ||
39 | .Fn SXNETID_free "SXNETID *sxnetid" | ||
40 | .Ft SXNET * | ||
41 | .Fo d2i_SXNET | ||
42 | .Fa "SXNET **val_out" | ||
43 | .Fa "const unsigned char **der_in" | ||
44 | .Fa "long length" | ||
45 | .Fc | ||
46 | .Ft int | ||
47 | .Fo i2d_SXNET | ||
48 | .Fa "SXNET *val_in" | ||
49 | .Fa "unsigned char **der_out" | ||
50 | .Fc | ||
51 | .Ft SXNETID * | ||
52 | .Fo d2i_SXNETID | ||
53 | .Fa "SXNETID **val_out" | ||
54 | .Fa "const unsigned char **der_in" | ||
55 | .Fa "long length" | ||
56 | .Fc | ||
57 | .Ft int | ||
58 | .Fo i2d_SXNETID | ||
59 | .Fa "SXNETID *val_in" | ||
60 | .Fa "unsigned char **der_out" | ||
61 | .Fc | ||
62 | .Sh DESCRIPTION | ||
63 | .Fn SXNET_new | ||
64 | allocates and initializes an empty | ||
65 | .Vt SXNET | ||
66 | object representing a non-standard proprietary Thawte strong extranet | ||
67 | X.509 extension. | ||
68 | .Fn SXNET_free | ||
69 | frees | ||
70 | .Fa sxnet . | ||
71 | .Pp | ||
72 | .Fn SXNETID_new | ||
73 | allocates and initializes an empty | ||
74 | .Vt SXNETID | ||
75 | object. | ||
76 | It is used inside | ||
77 | .Vt SXNET . | ||
78 | .Fn SXNETID_free | ||
79 | frees | ||
80 | .Fa sxnetid . | ||
81 | .Pp | ||
82 | The remaining functions decode and encode these objects | ||
83 | using DER format. | ||
84 | For details about the semantics, examples, caveats, and bugs, see | ||
85 | .Xr ASN1_item_d2i 3 . | ||
86 | .Sh RETURN VALUES | ||
87 | .Fn SXNET_new | ||
88 | and | ||
89 | .Fn d2i_SXNET | ||
90 | return an | ||
91 | .Vt SXNET | ||
92 | object or | ||
93 | .Dv NULL | ||
94 | if an error occurs. | ||
95 | .Pp | ||
96 | .Fn SXNETID_new | ||
97 | and | ||
98 | .Fn d2i_SXNETID | ||
99 | return an | ||
100 | .Vt SXNETID | ||
101 | object or | ||
102 | .Dv NULL | ||
103 | if an error occurs. | ||
104 | .Pp | ||
105 | .Fn i2d_SXNET | ||
106 | and | ||
107 | .Fn i2d_SXNETID | ||
108 | return the number of bytes successfully encoded or a negative value | ||
109 | if an error occurs. | ||
110 | .Sh SEE ALSO | ||
111 | .Xr X509_EXTENSION_new 3 , | ||
112 | .Xr X509_new 3 | ||
113 | .Rs | ||
114 | .%A M. Shuttleworth | ||
115 | .%R The Strong Extranet: real-world personal certification | ||
116 | .%Q Thawte Consulting | ||
117 | .%C South Africa | ||
118 | .%D 1998 | ||
119 | .Re | ||
120 | .Sh HISTORY | ||
121 | These functions first appeared in OpenSSL 0.9.3 | ||
122 | and have been available since | ||
123 | .Ox 2.6 . | ||
124 | .Sh BUGS | ||
125 | This manual page does not explain what the extension actually does | ||
126 | because no authoritative information was found online so far. | ||
127 | .Pp | ||
128 | The only hint was found in an ancient white paper "Securing IBM | ||
129 | Applications with Public Key Infrastructure" on the IBM website, | ||
130 | dated June 13, 2001: "Thawte also has a technology called Strong | ||
131 | Extranet that allows institutions to encode customer information | ||
132 | in the extensions to their customer's certificates. | ||
133 | Because multiple institutions can add information, the user needs | ||
134 | only one certificate, making renewal and revocation simpler, although | ||
135 | the issue of modifying an extension to an existing certificate is | ||
136 | not addressed." | ||
137 | .Pp | ||
138 | It is unclear whether that explanation is accurate, but in any case, | ||
139 | it is not very specific. | ||
diff --git a/src/lib/libcrypto/man/X509_EXTENSION_set_object.3 b/src/lib/libcrypto/man/X509_EXTENSION_set_object.3 index 6a5b4e09a9..3ade50e4d6 100644 --- a/src/lib/libcrypto/man/X509_EXTENSION_set_object.3 +++ b/src/lib/libcrypto/man/X509_EXTENSION_set_object.3 | |||
@@ -1,4 +1,4 @@ | |||
1 | .\" $OpenBSD: X509_EXTENSION_set_object.3,v 1.15 2021/10/29 10:22:00 schwarze Exp $ | 1 | .\" $OpenBSD: X509_EXTENSION_set_object.3,v 1.16 2023/04/25 18:48:32 tb Exp $ |
2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 | 2 | .\" full merge up to: OpenSSL 99d63d46 Oct 26 13:56:48 2016 -0400 |
3 | .\" | 3 | .\" |
4 | .\" This file is a derived work. | 4 | .\" This file is a derived work. |
@@ -65,7 +65,7 @@ | |||
65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 65 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. | 66 | .\" OF THE POSSIBILITY OF SUCH DAMAGE. |
67 | .\" | 67 | .\" |
68 | .Dd $Mdocdate: October 29 2021 $ | 68 | .Dd $Mdocdate: April 25 2023 $ |
69 | .Dt X509_EXTENSION_SET_OBJECT 3 | 69 | .Dt X509_EXTENSION_SET_OBJECT 3 |
70 | .Os | 70 | .Os |
71 | .Sh NAME | 71 | .Sh NAME |
@@ -292,7 +292,6 @@ pointer. | |||
292 | .Xr PKEY_USAGE_PERIOD_new 3 , | 292 | .Xr PKEY_USAGE_PERIOD_new 3 , |
293 | .Xr POLICYINFO_new 3 , | 293 | .Xr POLICYINFO_new 3 , |
294 | .Xr PROXY_POLICY_new 3 , | 294 | .Xr PROXY_POLICY_new 3 , |
295 | .Xr SXNET_new 3 , | ||
296 | .Xr TS_REQ_new 3 , | 295 | .Xr TS_REQ_new 3 , |
297 | .Xr X509_check_ca 3 , | 296 | .Xr X509_check_ca 3 , |
298 | .Xr X509_check_host 3 , | 297 | .Xr X509_check_host 3 , |
diff --git a/src/lib/libcrypto/stack/safestack.h b/src/lib/libcrypto/stack/safestack.h index b577f2f60f..0df128a7bd 100644 --- a/src/lib/libcrypto/stack/safestack.h +++ b/src/lib/libcrypto/stack/safestack.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: safestack.h,v 1.24 2023/04/24 22:30:17 tb Exp $ */ | 1 | /* $OpenBSD: safestack.h,v 1.25 2023/04/25 18:48:32 tb Exp $ */ |
2 | /* ==================================================================== | 2 | /* ==================================================================== |
3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1999 The OpenSSL Project. All rights reserved. |
4 | * | 4 | * |
@@ -1479,30 +1479,6 @@ DECLARE_SPECIAL_STACK_OF(OPENSSL_BLOCK, void) | |||
1479 | #define sk_STORE_OBJECT_sort(st) SKM_sk_sort(STORE_OBJECT, (st)) | 1479 | #define sk_STORE_OBJECT_sort(st) SKM_sk_sort(STORE_OBJECT, (st)) |
1480 | #define sk_STORE_OBJECT_is_sorted(st) SKM_sk_is_sorted(STORE_OBJECT, (st)) | 1480 | #define sk_STORE_OBJECT_is_sorted(st) SKM_sk_is_sorted(STORE_OBJECT, (st)) |
1481 | 1481 | ||
1482 | #if !defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_INTERNAL) | ||
1483 | #define sk_SXNETID_new(cmp) SKM_sk_new(SXNETID, (cmp)) | ||
1484 | #define sk_SXNETID_new_null() SKM_sk_new_null(SXNETID) | ||
1485 | #define sk_SXNETID_free(st) SKM_sk_free(SXNETID, (st)) | ||
1486 | #define sk_SXNETID_num(st) SKM_sk_num(SXNETID, (st)) | ||
1487 | #define sk_SXNETID_value(st, i) SKM_sk_value(SXNETID, (st), (i)) | ||
1488 | #define sk_SXNETID_set(st, i, val) SKM_sk_set(SXNETID, (st), (i), (val)) | ||
1489 | #define sk_SXNETID_zero(st) SKM_sk_zero(SXNETID, (st)) | ||
1490 | #define sk_SXNETID_push(st, val) SKM_sk_push(SXNETID, (st), (val)) | ||
1491 | #define sk_SXNETID_unshift(st, val) SKM_sk_unshift(SXNETID, (st), (val)) | ||
1492 | #define sk_SXNETID_find(st, val) SKM_sk_find(SXNETID, (st), (val)) | ||
1493 | #define sk_SXNETID_find_ex(st, val) SKM_sk_find_ex(SXNETID, (st), (val)) | ||
1494 | #define sk_SXNETID_delete(st, i) SKM_sk_delete(SXNETID, (st), (i)) | ||
1495 | #define sk_SXNETID_delete_ptr(st, ptr) SKM_sk_delete_ptr(SXNETID, (st), (ptr)) | ||
1496 | #define sk_SXNETID_insert(st, val, i) SKM_sk_insert(SXNETID, (st), (val), (i)) | ||
1497 | #define sk_SXNETID_set_cmp_func(st, cmp) SKM_sk_set_cmp_func(SXNETID, (st), (cmp)) | ||
1498 | #define sk_SXNETID_dup(st) SKM_sk_dup(SXNETID, st) | ||
1499 | #define sk_SXNETID_pop_free(st, free_func) SKM_sk_pop_free(SXNETID, (st), (free_func)) | ||
1500 | #define sk_SXNETID_shift(st) SKM_sk_shift(SXNETID, (st)) | ||
1501 | #define sk_SXNETID_pop(st) SKM_sk_pop(SXNETID, (st)) | ||
1502 | #define sk_SXNETID_sort(st) SKM_sk_sort(SXNETID, (st)) | ||
1503 | #define sk_SXNETID_is_sorted(st) SKM_sk_is_sorted(SXNETID, (st)) | ||
1504 | #endif | ||
1505 | |||
1506 | #define sk_UI_STRING_new(cmp) SKM_sk_new(UI_STRING, (cmp)) | 1482 | #define sk_UI_STRING_new(cmp) SKM_sk_new(UI_STRING, (cmp)) |
1507 | #define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING) | 1483 | #define sk_UI_STRING_new_null() SKM_sk_new_null(UI_STRING) |
1508 | #define sk_UI_STRING_free(st) SKM_sk_free(UI_STRING, (st)) | 1484 | #define sk_UI_STRING_free(st) SKM_sk_free(UI_STRING, (st)) |
diff --git a/src/lib/libcrypto/x509/x509_sxnet.c b/src/lib/libcrypto/x509/x509_sxnet.c deleted file mode 100644 index 77c792d227..0000000000 --- a/src/lib/libcrypto/x509/x509_sxnet.c +++ /dev/null | |||
@@ -1,397 +0,0 @@ | |||
1 | /* $OpenBSD: x509_sxnet.c,v 1.3 2023/02/16 08:38:17 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 <openssl/asn1.h> | ||
63 | #include <openssl/asn1t.h> | ||
64 | #include <openssl/conf.h> | ||
65 | #include <openssl/err.h> | ||
66 | #include <openssl/x509v3.h> | ||
67 | |||
68 | /* Support for Thawte strong extranet extension */ | ||
69 | |||
70 | #define SXNET_TEST | ||
71 | |||
72 | static int sxnet_i2r(X509V3_EXT_METHOD *method, SXNET *sx, BIO *out, | ||
73 | int indent); | ||
74 | #ifdef SXNET_TEST | ||
75 | static SXNET * sxnet_v2i(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, | ||
76 | STACK_OF(CONF_VALUE) *nval); | ||
77 | #endif | ||
78 | |||
79 | const X509V3_EXT_METHOD v3_sxnet = { | ||
80 | .ext_nid = NID_sxnet, | ||
81 | .ext_flags = X509V3_EXT_MULTILINE, | ||
82 | .it = &SXNET_it, | ||
83 | .ext_new = NULL, | ||
84 | .ext_free = NULL, | ||
85 | .d2i = NULL, | ||
86 | .i2d = NULL, | ||
87 | .i2s = NULL, | ||
88 | .s2i = NULL, | ||
89 | .i2v = NULL, | ||
90 | #ifdef SXNET_TEST | ||
91 | .v2i = (X509V3_EXT_V2I)sxnet_v2i, | ||
92 | #else | ||
93 | .v2i = NULL, | ||
94 | #endif | ||
95 | .i2r = (X509V3_EXT_I2R)sxnet_i2r, | ||
96 | .r2i = NULL, | ||
97 | .usr_data = NULL, | ||
98 | }; | ||
99 | |||
100 | static const ASN1_TEMPLATE SXNETID_seq_tt[] = { | ||
101 | { | ||
102 | .flags = 0, | ||
103 | .tag = 0, | ||
104 | .offset = offsetof(SXNETID, zone), | ||
105 | .field_name = "zone", | ||
106 | .item = &ASN1_INTEGER_it, | ||
107 | }, | ||
108 | { | ||
109 | .flags = 0, | ||
110 | .tag = 0, | ||
111 | .offset = offsetof(SXNETID, user), | ||
112 | .field_name = "user", | ||
113 | .item = &ASN1_OCTET_STRING_it, | ||
114 | }, | ||
115 | }; | ||
116 | |||
117 | const ASN1_ITEM SXNETID_it = { | ||
118 | .itype = ASN1_ITYPE_SEQUENCE, | ||
119 | .utype = V_ASN1_SEQUENCE, | ||
120 | .templates = SXNETID_seq_tt, | ||
121 | .tcount = sizeof(SXNETID_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
122 | .funcs = NULL, | ||
123 | .size = sizeof(SXNETID), | ||
124 | .sname = "SXNETID", | ||
125 | }; | ||
126 | |||
127 | |||
128 | SXNETID * | ||
129 | d2i_SXNETID(SXNETID **a, const unsigned char **in, long len) | ||
130 | { | ||
131 | return (SXNETID *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | ||
132 | &SXNETID_it); | ||
133 | } | ||
134 | LCRYPTO_ALIAS(d2i_SXNETID); | ||
135 | |||
136 | int | ||
137 | i2d_SXNETID(SXNETID *a, unsigned char **out) | ||
138 | { | ||
139 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &SXNETID_it); | ||
140 | } | ||
141 | LCRYPTO_ALIAS(i2d_SXNETID); | ||
142 | |||
143 | SXNETID * | ||
144 | SXNETID_new(void) | ||
145 | { | ||
146 | return (SXNETID *)ASN1_item_new(&SXNETID_it); | ||
147 | } | ||
148 | LCRYPTO_ALIAS(SXNETID_new); | ||
149 | |||
150 | void | ||
151 | SXNETID_free(SXNETID *a) | ||
152 | { | ||
153 | ASN1_item_free((ASN1_VALUE *)a, &SXNETID_it); | ||
154 | } | ||
155 | LCRYPTO_ALIAS(SXNETID_free); | ||
156 | |||
157 | static const ASN1_TEMPLATE SXNET_seq_tt[] = { | ||
158 | { | ||
159 | .flags = 0, | ||
160 | .tag = 0, | ||
161 | .offset = offsetof(SXNET, version), | ||
162 | .field_name = "version", | ||
163 | .item = &ASN1_INTEGER_it, | ||
164 | }, | ||
165 | { | ||
166 | .flags = ASN1_TFLG_SEQUENCE_OF, | ||
167 | .tag = 0, | ||
168 | .offset = offsetof(SXNET, ids), | ||
169 | .field_name = "ids", | ||
170 | .item = &SXNETID_it, | ||
171 | }, | ||
172 | }; | ||
173 | |||
174 | const ASN1_ITEM SXNET_it = { | ||
175 | .itype = ASN1_ITYPE_SEQUENCE, | ||
176 | .utype = V_ASN1_SEQUENCE, | ||
177 | .templates = SXNET_seq_tt, | ||
178 | .tcount = sizeof(SXNET_seq_tt) / sizeof(ASN1_TEMPLATE), | ||
179 | .funcs = NULL, | ||
180 | .size = sizeof(SXNET), | ||
181 | .sname = "SXNET", | ||
182 | }; | ||
183 | |||
184 | |||
185 | SXNET * | ||
186 | d2i_SXNET(SXNET **a, const unsigned char **in, long len) | ||
187 | { | ||
188 | return (SXNET *)ASN1_item_d2i((ASN1_VALUE **)a, in, len, | ||
189 | &SXNET_it); | ||
190 | } | ||
191 | LCRYPTO_ALIAS(d2i_SXNET); | ||
192 | |||
193 | int | ||
194 | i2d_SXNET(SXNET *a, unsigned char **out) | ||
195 | { | ||
196 | return ASN1_item_i2d((ASN1_VALUE *)a, out, &SXNET_it); | ||
197 | } | ||
198 | LCRYPTO_ALIAS(i2d_SXNET); | ||
199 | |||
200 | SXNET * | ||
201 | SXNET_new(void) | ||
202 | { | ||
203 | return (SXNET *)ASN1_item_new(&SXNET_it); | ||
204 | } | ||
205 | LCRYPTO_ALIAS(SXNET_new); | ||
206 | |||
207 | void | ||
208 | SXNET_free(SXNET *a) | ||
209 | { | ||
210 | ASN1_item_free((ASN1_VALUE *)a, &SXNET_it); | ||
211 | } | ||
212 | LCRYPTO_ALIAS(SXNET_free); | ||
213 | |||
214 | static int | ||
215 | sxnet_i2r(X509V3_EXT_METHOD *method, SXNET *sx, BIO *out, int indent) | ||
216 | { | ||
217 | long v; | ||
218 | char *tmp; | ||
219 | SXNETID *id; | ||
220 | int i; | ||
221 | |||
222 | v = ASN1_INTEGER_get(sx->version); | ||
223 | BIO_printf(out, "%*sVersion: %ld (0x%lX)", indent, "", v + 1, v); | ||
224 | for (i = 0; i < sk_SXNETID_num(sx->ids); i++) { | ||
225 | id = sk_SXNETID_value(sx->ids, i); | ||
226 | tmp = i2s_ASN1_INTEGER(NULL, id->zone); | ||
227 | BIO_printf(out, "\n%*sZone: %s, User: ", indent, "", tmp); | ||
228 | free(tmp); | ||
229 | ASN1_STRING_print(out, id->user); | ||
230 | } | ||
231 | return 1; | ||
232 | } | ||
233 | |||
234 | #ifdef SXNET_TEST | ||
235 | |||
236 | /* NBB: this is used for testing only. It should *not* be used for anything | ||
237 | * else because it will just take static IDs from the configuration file and | ||
238 | * they should really be separate values for each user. | ||
239 | */ | ||
240 | |||
241 | static SXNET * | ||
242 | sxnet_v2i(X509V3_EXT_METHOD *method, X509V3_CTX *ctx, | ||
243 | STACK_OF(CONF_VALUE) *nval) | ||
244 | { | ||
245 | CONF_VALUE *cnf; | ||
246 | SXNET *sx = NULL; | ||
247 | int i; | ||
248 | |||
249 | for (i = 0; i < sk_CONF_VALUE_num(nval); i++) { | ||
250 | cnf = sk_CONF_VALUE_value(nval, i); | ||
251 | if (!SXNET_add_id_asc(&sx, cnf->name, cnf->value, -1)) | ||
252 | return NULL; | ||
253 | } | ||
254 | return sx; | ||
255 | } | ||
256 | |||
257 | #endif | ||
258 | |||
259 | /* Strong Extranet utility functions */ | ||
260 | |||
261 | /* Add an id given the zone as an ASCII number */ | ||
262 | |||
263 | int | ||
264 | SXNET_add_id_asc(SXNET **psx, const char *zone, const char *user, int userlen) | ||
265 | { | ||
266 | ASN1_INTEGER *izone = NULL; | ||
267 | |||
268 | if (!(izone = s2i_ASN1_INTEGER(NULL, zone))) { | ||
269 | X509V3error(X509V3_R_ERROR_CONVERTING_ZONE); | ||
270 | return 0; | ||
271 | } | ||
272 | return SXNET_add_id_INTEGER(psx, izone, user, userlen); | ||
273 | } | ||
274 | LCRYPTO_ALIAS(SXNET_add_id_asc); | ||
275 | |||
276 | /* Add an id given the zone as an unsigned long */ | ||
277 | |||
278 | int | ||
279 | SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, const char *user, | ||
280 | int userlen) | ||
281 | { | ||
282 | ASN1_INTEGER *izone = NULL; | ||
283 | |||
284 | if (!(izone = ASN1_INTEGER_new()) || | ||
285 | !ASN1_INTEGER_set(izone, lzone)) { | ||
286 | X509V3error(ERR_R_MALLOC_FAILURE); | ||
287 | ASN1_INTEGER_free(izone); | ||
288 | return 0; | ||
289 | } | ||
290 | return SXNET_add_id_INTEGER(psx, izone, user, userlen); | ||
291 | } | ||
292 | LCRYPTO_ALIAS(SXNET_add_id_ulong); | ||
293 | |||
294 | /* Add an id given the zone as an ASN1_INTEGER. | ||
295 | * Note this version uses the passed integer and doesn't make a copy so don't | ||
296 | * free it up afterwards. | ||
297 | */ | ||
298 | |||
299 | int | ||
300 | SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *zone, const char *user, | ||
301 | int userlen) | ||
302 | { | ||
303 | SXNET *sx = NULL; | ||
304 | SXNETID *id = NULL; | ||
305 | |||
306 | if (!psx || !zone || !user) { | ||
307 | X509V3error(X509V3_R_INVALID_NULL_ARGUMENT); | ||
308 | return 0; | ||
309 | } | ||
310 | if (userlen == -1) | ||
311 | userlen = strlen(user); | ||
312 | if (userlen > 64) { | ||
313 | X509V3error(X509V3_R_USER_TOO_LONG); | ||
314 | return 0; | ||
315 | } | ||
316 | if (!*psx) { | ||
317 | if (!(sx = SXNET_new())) | ||
318 | goto err; | ||
319 | if (!ASN1_INTEGER_set(sx->version, 0)) | ||
320 | goto err; | ||
321 | *psx = sx; | ||
322 | } else | ||
323 | sx = *psx; | ||
324 | if (SXNET_get_id_INTEGER(sx, zone)) { | ||
325 | X509V3error(X509V3_R_DUPLICATE_ZONE_ID); | ||
326 | return 0; | ||
327 | } | ||
328 | |||
329 | if (!(id = SXNETID_new())) | ||
330 | goto err; | ||
331 | if (userlen == -1) | ||
332 | userlen = strlen(user); | ||
333 | |||
334 | if (!ASN1_STRING_set(id->user, user, userlen)) | ||
335 | goto err; | ||
336 | if (!sk_SXNETID_push(sx->ids, id)) | ||
337 | goto err; | ||
338 | id->zone = zone; | ||
339 | return 1; | ||
340 | |||
341 | err: | ||
342 | X509V3error(ERR_R_MALLOC_FAILURE); | ||
343 | SXNETID_free(id); | ||
344 | SXNET_free(sx); | ||
345 | *psx = NULL; | ||
346 | return 0; | ||
347 | } | ||
348 | LCRYPTO_ALIAS(SXNET_add_id_INTEGER); | ||
349 | |||
350 | ASN1_OCTET_STRING * | ||
351 | SXNET_get_id_asc(SXNET *sx, const char *zone) | ||
352 | { | ||
353 | ASN1_INTEGER *izone = NULL; | ||
354 | ASN1_OCTET_STRING *oct; | ||
355 | |||
356 | if (!(izone = s2i_ASN1_INTEGER(NULL, zone))) { | ||
357 | X509V3error(X509V3_R_ERROR_CONVERTING_ZONE); | ||
358 | return NULL; | ||
359 | } | ||
360 | oct = SXNET_get_id_INTEGER(sx, izone); | ||
361 | ASN1_INTEGER_free(izone); | ||
362 | return oct; | ||
363 | } | ||
364 | LCRYPTO_ALIAS(SXNET_get_id_asc); | ||
365 | |||
366 | ASN1_OCTET_STRING * | ||
367 | SXNET_get_id_ulong(SXNET *sx, unsigned long lzone) | ||
368 | { | ||
369 | ASN1_INTEGER *izone = NULL; | ||
370 | ASN1_OCTET_STRING *oct; | ||
371 | |||
372 | if (!(izone = ASN1_INTEGER_new()) || | ||
373 | !ASN1_INTEGER_set(izone, lzone)) { | ||
374 | X509V3error(ERR_R_MALLOC_FAILURE); | ||
375 | ASN1_INTEGER_free(izone); | ||
376 | return NULL; | ||
377 | } | ||
378 | oct = SXNET_get_id_INTEGER(sx, izone); | ||
379 | ASN1_INTEGER_free(izone); | ||
380 | return oct; | ||
381 | } | ||
382 | LCRYPTO_ALIAS(SXNET_get_id_ulong); | ||
383 | |||
384 | ASN1_OCTET_STRING * | ||
385 | SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone) | ||
386 | { | ||
387 | SXNETID *id; | ||
388 | int i; | ||
389 | |||
390 | for (i = 0; i < sk_SXNETID_num(sx->ids); i++) { | ||
391 | id = sk_SXNETID_value(sx->ids, i); | ||
392 | if (!ASN1_INTEGER_cmp(id->zone, zone)) | ||
393 | return id->user; | ||
394 | } | ||
395 | return NULL; | ||
396 | } | ||
397 | LCRYPTO_ALIAS(SXNET_get_id_INTEGER); | ||
diff --git a/src/lib/libcrypto/x509/x509v3.h b/src/lib/libcrypto/x509/x509v3.h index 8738b302cb..d7a0ef0165 100644 --- a/src/lib/libcrypto/x509/x509v3.h +++ b/src/lib/libcrypto/x509/x509v3.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: x509v3.h,v 1.22 2023/04/25 18:28:05 tb Exp $ */ | 1 | /* $OpenBSD: x509v3.h,v 1.23 2023/04/25 18:48:32 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 1999. | 3 | * project 1999. |
4 | */ | 4 | */ |
@@ -262,22 +262,6 @@ struct AUTHORITY_KEYID_st { | |||
262 | ASN1_INTEGER *serial; | 262 | ASN1_INTEGER *serial; |
263 | }; | 263 | }; |
264 | 264 | ||
265 | /* Strong extranet structures */ | ||
266 | |||
267 | #if !defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_INTERNAL) | ||
268 | typedef struct SXNET_ID_st { | ||
269 | ASN1_INTEGER *zone; | ||
270 | ASN1_OCTET_STRING *user; | ||
271 | } SXNETID; | ||
272 | |||
273 | DECLARE_STACK_OF(SXNETID) | ||
274 | |||
275 | typedef struct SXNET_st { | ||
276 | ASN1_INTEGER *version; | ||
277 | STACK_OF(SXNETID) *ids; | ||
278 | } SXNET; | ||
279 | #endif | ||
280 | |||
281 | typedef struct NOTICEREF_st { | 265 | typedef struct NOTICEREF_st { |
282 | ASN1_STRING *organization; | 266 | ASN1_STRING *organization; |
283 | STACK_OF(ASN1_INTEGER) *noticenos; | 267 | STACK_OF(ASN1_INTEGER) *noticenos; |
@@ -517,30 +501,6 @@ BASIC_CONSTRAINTS *d2i_BASIC_CONSTRAINTS(BASIC_CONSTRAINTS **a, const unsigned c | |||
517 | int i2d_BASIC_CONSTRAINTS(BASIC_CONSTRAINTS *a, unsigned char **out); | 501 | int i2d_BASIC_CONSTRAINTS(BASIC_CONSTRAINTS *a, unsigned char **out); |
518 | extern const ASN1_ITEM BASIC_CONSTRAINTS_it; | 502 | extern const ASN1_ITEM BASIC_CONSTRAINTS_it; |
519 | 503 | ||
520 | #if !defined(LIBRESSL_NEXT_API) || defined(LIBRESSL_INTERNAL) | ||
521 | SXNET *SXNET_new(void); | ||
522 | void SXNET_free(SXNET *a); | ||
523 | SXNET *d2i_SXNET(SXNET **a, const unsigned char **in, long len); | ||
524 | int i2d_SXNET(SXNET *a, unsigned char **out); | ||
525 | extern const ASN1_ITEM SXNET_it; | ||
526 | SXNETID *SXNETID_new(void); | ||
527 | void SXNETID_free(SXNETID *a); | ||
528 | SXNETID *d2i_SXNETID(SXNETID **a, const unsigned char **in, long len); | ||
529 | int i2d_SXNETID(SXNETID *a, unsigned char **out); | ||
530 | extern const ASN1_ITEM SXNETID_it; | ||
531 | |||
532 | int SXNET_add_id_asc(SXNET **psx, const char *zone, const char *user, | ||
533 | int userlen); | ||
534 | int SXNET_add_id_ulong(SXNET **psx, unsigned long lzone, const char *user, | ||
535 | int userlen); | ||
536 | int SXNET_add_id_INTEGER(SXNET **psx, ASN1_INTEGER *izone, const char *user, | ||
537 | int userlen); | ||
538 | |||
539 | ASN1_OCTET_STRING *SXNET_get_id_asc(SXNET *sx, const char *zone); | ||
540 | ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone); | ||
541 | ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone); | ||
542 | #endif | ||
543 | |||
544 | AUTHORITY_KEYID *AUTHORITY_KEYID_new(void); | 504 | AUTHORITY_KEYID *AUTHORITY_KEYID_new(void); |
545 | void AUTHORITY_KEYID_free(AUTHORITY_KEYID *a); | 505 | void AUTHORITY_KEYID_free(AUTHORITY_KEYID *a); |
546 | AUTHORITY_KEYID *d2i_AUTHORITY_KEYID(AUTHORITY_KEYID **a, const unsigned char **in, long len); | 506 | AUTHORITY_KEYID *d2i_AUTHORITY_KEYID(AUTHORITY_KEYID **a, const unsigned char **in, long len); |