diff options
author | tb <> | 2023-07-28 10:33:13 +0000 |
---|---|---|
committer | tb <> | 2023-07-28 10:33:13 +0000 |
commit | d13035e40f9f0aeb77be3097963f11fabf83e401 (patch) | |
tree | 6ca61cb63c965a6e1ab24f4f13909d7067ef58fb | |
parent | a6fe4431097f0743a991627e730ef8ceebc499b6 (diff) | |
download | openbsd-d13035e40f9f0aeb77be3097963f11fabf83e401.tar.gz openbsd-d13035e40f9f0aeb77be3097963f11fabf83e401.tar.bz2 openbsd-d13035e40f9f0aeb77be3097963f11fabf83e401.zip |
Remove more ASN1_BIT_STRING API
This removes ASN1_BIT_STRING_name_print(), ASN1_BIT_STRING_{num,set}_asc().
Before trust was properly handled using OIDs, there was a period where it
used bit strings. The actual interfaces used in openssl x509 were removed,
but the functions they wrapped remained unused for the next 24 years.
ok jsing
-rw-r--r-- | src/lib/libcrypto/Symbols.list | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/Symbols.namespace | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/a_bitstr.c | 54 | ||||
-rw-r--r-- | src/lib/libcrypto/asn1/asn1.h | 10 | ||||
-rw-r--r-- | src/lib/libcrypto/hidden/openssl/asn1.h | 5 |
5 files changed, 3 insertions, 72 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index 110a3fa9c5..cffee7e000 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list | |||
@@ -29,11 +29,8 @@ ASN1_ANY_it | |||
29 | ASN1_BIT_STRING_free | 29 | ASN1_BIT_STRING_free |
30 | ASN1_BIT_STRING_get_bit | 30 | ASN1_BIT_STRING_get_bit |
31 | ASN1_BIT_STRING_it | 31 | ASN1_BIT_STRING_it |
32 | ASN1_BIT_STRING_name_print | ||
33 | ASN1_BIT_STRING_new | 32 | ASN1_BIT_STRING_new |
34 | ASN1_BIT_STRING_num_asc | ||
35 | ASN1_BIT_STRING_set | 33 | ASN1_BIT_STRING_set |
36 | ASN1_BIT_STRING_set_asc | ||
37 | ASN1_BIT_STRING_set_bit | 34 | ASN1_BIT_STRING_set_bit |
38 | ASN1_BMPSTRING_free | 35 | ASN1_BMPSTRING_free |
39 | ASN1_BMPSTRING_it | 36 | ASN1_BMPSTRING_it |
diff --git a/src/lib/libcrypto/Symbols.namespace b/src/lib/libcrypto/Symbols.namespace index eada22cc44..3493ad8934 100644 --- a/src/lib/libcrypto/Symbols.namespace +++ b/src/lib/libcrypto/Symbols.namespace | |||
@@ -931,9 +931,6 @@ _libre_i2d_ASN1_BIT_STRING | |||
931 | _libre_ASN1_BIT_STRING_set | 931 | _libre_ASN1_BIT_STRING_set |
932 | _libre_ASN1_BIT_STRING_set_bit | 932 | _libre_ASN1_BIT_STRING_set_bit |
933 | _libre_ASN1_BIT_STRING_get_bit | 933 | _libre_ASN1_BIT_STRING_get_bit |
934 | _libre_ASN1_BIT_STRING_name_print | ||
935 | _libre_ASN1_BIT_STRING_num_asc | ||
936 | _libre_ASN1_BIT_STRING_set_asc | ||
937 | _libre_ASN1_INTEGER_new | 934 | _libre_ASN1_INTEGER_new |
938 | _libre_ASN1_INTEGER_free | 935 | _libre_ASN1_INTEGER_free |
939 | _libre_d2i_ASN1_INTEGER | 936 | _libre_d2i_ASN1_INTEGER |
diff --git a/src/lib/libcrypto/asn1/a_bitstr.c b/src/lib/libcrypto/asn1/a_bitstr.c index b985db60da..7ea3e12b91 100644 --- a/src/lib/libcrypto/asn1/a_bitstr.c +++ b/src/lib/libcrypto/asn1/a_bitstr.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: a_bitstr.c,v 1.40 2023/07/28 10:30:16 tb Exp $ */ | 1 | /* $OpenBSD: a_bitstr.c,v 1.41 2023/07/28 10:33:13 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 | * |
@@ -163,58 +163,6 @@ ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n) | |||
163 | LCRYPTO_ALIAS(ASN1_BIT_STRING_get_bit); | 163 | LCRYPTO_ALIAS(ASN1_BIT_STRING_get_bit); |
164 | 164 | ||
165 | int | 165 | int |
166 | ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, | ||
167 | BIT_STRING_BITNAME *tbl, int indent) | ||
168 | { | ||
169 | BIT_STRING_BITNAME *bnam; | ||
170 | char first = 1; | ||
171 | |||
172 | BIO_printf(out, "%*s", indent, ""); | ||
173 | for (bnam = tbl; bnam->lname; bnam++) { | ||
174 | if (ASN1_BIT_STRING_get_bit(bs, bnam->bitnum)) { | ||
175 | if (!first) | ||
176 | BIO_puts(out, ", "); | ||
177 | BIO_puts(out, bnam->lname); | ||
178 | first = 0; | ||
179 | } | ||
180 | } | ||
181 | BIO_puts(out, "\n"); | ||
182 | return 1; | ||
183 | } | ||
184 | LCRYPTO_ALIAS(ASN1_BIT_STRING_name_print); | ||
185 | |||
186 | int | ||
187 | ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value, | ||
188 | BIT_STRING_BITNAME *tbl) | ||
189 | { | ||
190 | int bitnum; | ||
191 | |||
192 | bitnum = ASN1_BIT_STRING_num_asc(name, tbl); | ||
193 | if (bitnum < 0) | ||
194 | return 0; | ||
195 | if (bs) { | ||
196 | if (!ASN1_BIT_STRING_set_bit(bs, bitnum, value)) | ||
197 | return 0; | ||
198 | } | ||
199 | return 1; | ||
200 | } | ||
201 | LCRYPTO_ALIAS(ASN1_BIT_STRING_set_asc); | ||
202 | |||
203 | int | ||
204 | ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl) | ||
205 | { | ||
206 | BIT_STRING_BITNAME *bnam; | ||
207 | |||
208 | for (bnam = tbl; bnam->lname; bnam++) { | ||
209 | if (!strcmp(bnam->sname, name) || | ||
210 | !strcmp(bnam->lname, name)) | ||
211 | return bnam->bitnum; | ||
212 | } | ||
213 | return -1; | ||
214 | } | ||
215 | LCRYPTO_ALIAS(ASN1_BIT_STRING_num_asc); | ||
216 | |||
217 | int | ||
218 | i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) | 166 | i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) |
219 | { | 167 | { |
220 | int ret, j, bits, len; | 168 | int ret, j, bits, len; |
diff --git a/src/lib/libcrypto/asn1/asn1.h b/src/lib/libcrypto/asn1/asn1.h index 51fb2862cd..5eeee3317b 100644 --- a/src/lib/libcrypto/asn1/asn1.h +++ b/src/lib/libcrypto/asn1/asn1.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1.h,v 1.79 2023/07/28 10:30:16 tb Exp $ */ | 1 | /* $OpenBSD: asn1.h,v 1.80 2023/07/28 10:33:13 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 | * |
@@ -577,14 +577,6 @@ int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length); | |||
577 | int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); | 577 | int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); |
578 | int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); | 578 | int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); |
579 | 579 | ||
580 | #ifndef OPENSSL_NO_BIO | ||
581 | int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, | ||
582 | BIT_STRING_BITNAME *tbl, int indent); | ||
583 | #endif | ||
584 | int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl); | ||
585 | int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value, | ||
586 | BIT_STRING_BITNAME *tbl); | ||
587 | |||
588 | ASN1_INTEGER *ASN1_INTEGER_new(void); | 580 | ASN1_INTEGER *ASN1_INTEGER_new(void); |
589 | void ASN1_INTEGER_free(ASN1_INTEGER *a); | 581 | void ASN1_INTEGER_free(ASN1_INTEGER *a); |
590 | ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in, long len); | 582 | ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in, long len); |
diff --git a/src/lib/libcrypto/hidden/openssl/asn1.h b/src/lib/libcrypto/hidden/openssl/asn1.h index 087d1294c1..fb1393f2a4 100644 --- a/src/lib/libcrypto/hidden/openssl/asn1.h +++ b/src/lib/libcrypto/hidden/openssl/asn1.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: asn1.h,v 1.5 2023/07/28 10:30:16 tb Exp $ */ | 1 | /* $OpenBSD: asn1.h,v 1.6 2023/07/28 10:33:13 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Copyright (c) 2023 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2023 Bob Beck <beck@openbsd.org> |
4 | * | 4 | * |
@@ -61,9 +61,6 @@ LCRYPTO_USED(i2d_ASN1_BIT_STRING); | |||
61 | LCRYPTO_USED(ASN1_BIT_STRING_set); | 61 | LCRYPTO_USED(ASN1_BIT_STRING_set); |
62 | LCRYPTO_USED(ASN1_BIT_STRING_set_bit); | 62 | LCRYPTO_USED(ASN1_BIT_STRING_set_bit); |
63 | LCRYPTO_USED(ASN1_BIT_STRING_get_bit); | 63 | LCRYPTO_USED(ASN1_BIT_STRING_get_bit); |
64 | LCRYPTO_USED(ASN1_BIT_STRING_name_print); | ||
65 | LCRYPTO_USED(ASN1_BIT_STRING_num_asc); | ||
66 | LCRYPTO_USED(ASN1_BIT_STRING_set_asc); | ||
67 | LCRYPTO_USED(ASN1_INTEGER_new); | 64 | LCRYPTO_USED(ASN1_INTEGER_new); |
68 | LCRYPTO_USED(ASN1_INTEGER_free); | 65 | LCRYPTO_USED(ASN1_INTEGER_free); |
69 | LCRYPTO_USED(d2i_ASN1_INTEGER); | 66 | LCRYPTO_USED(d2i_ASN1_INTEGER); |