From 13e371bf38f1ed6d39bdf991f6fb7edc212a41bc Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 28 Jul 2023 10:33:13 +0000 Subject: [PATCH] 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 --- lib/libcrypto/Symbols.list | 3 -- lib/libcrypto/Symbols.namespace | 3 -- lib/libcrypto/asn1/a_bitstr.c | 54 +---------------------------- lib/libcrypto/asn1/asn1.h | 10 +----- lib/libcrypto/hidden/openssl/asn1.h | 5 +-- 5 files changed, 3 insertions(+), 72 deletions(-) diff --git a/lib/libcrypto/Symbols.list b/lib/libcrypto/Symbols.list index 110a3fa9c5a..cffee7e0001 100644 --- a/lib/libcrypto/Symbols.list +++ b/lib/libcrypto/Symbols.list @@ -29,11 +29,8 @@ ASN1_ANY_it ASN1_BIT_STRING_free ASN1_BIT_STRING_get_bit ASN1_BIT_STRING_it -ASN1_BIT_STRING_name_print ASN1_BIT_STRING_new -ASN1_BIT_STRING_num_asc ASN1_BIT_STRING_set -ASN1_BIT_STRING_set_asc ASN1_BIT_STRING_set_bit ASN1_BMPSTRING_free ASN1_BMPSTRING_it diff --git a/lib/libcrypto/Symbols.namespace b/lib/libcrypto/Symbols.namespace index eada22cc441..3493ad8934b 100644 --- a/lib/libcrypto/Symbols.namespace +++ b/lib/libcrypto/Symbols.namespace @@ -931,9 +931,6 @@ _libre_i2d_ASN1_BIT_STRING _libre_ASN1_BIT_STRING_set _libre_ASN1_BIT_STRING_set_bit _libre_ASN1_BIT_STRING_get_bit -_libre_ASN1_BIT_STRING_name_print -_libre_ASN1_BIT_STRING_num_asc -_libre_ASN1_BIT_STRING_set_asc _libre_ASN1_INTEGER_new _libre_ASN1_INTEGER_free _libre_d2i_ASN1_INTEGER diff --git a/lib/libcrypto/asn1/a_bitstr.c b/lib/libcrypto/asn1/a_bitstr.c index b985db60da6..7ea3e12b919 100644 --- a/lib/libcrypto/asn1/a_bitstr.c +++ b/lib/libcrypto/asn1/a_bitstr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: a_bitstr.c,v 1.40 2023/07/28 10:30:16 tb Exp $ */ +/* $OpenBSD: a_bitstr.c,v 1.41 2023/07/28 10:33:13 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -162,58 +162,6 @@ ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n) } LCRYPTO_ALIAS(ASN1_BIT_STRING_get_bit); -int -ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, - BIT_STRING_BITNAME *tbl, int indent) -{ - BIT_STRING_BITNAME *bnam; - char first = 1; - - BIO_printf(out, "%*s", indent, ""); - for (bnam = tbl; bnam->lname; bnam++) { - if (ASN1_BIT_STRING_get_bit(bs, bnam->bitnum)) { - if (!first) - BIO_puts(out, ", "); - BIO_puts(out, bnam->lname); - first = 0; - } - } - BIO_puts(out, "\n"); - return 1; -} -LCRYPTO_ALIAS(ASN1_BIT_STRING_name_print); - -int -ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value, - BIT_STRING_BITNAME *tbl) -{ - int bitnum; - - bitnum = ASN1_BIT_STRING_num_asc(name, tbl); - if (bitnum < 0) - return 0; - if (bs) { - if (!ASN1_BIT_STRING_set_bit(bs, bitnum, value)) - return 0; - } - return 1; -} -LCRYPTO_ALIAS(ASN1_BIT_STRING_set_asc); - -int -ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl) -{ - BIT_STRING_BITNAME *bnam; - - for (bnam = tbl; bnam->lname; bnam++) { - if (!strcmp(bnam->sname, name) || - !strcmp(bnam->lname, name)) - return bnam->bitnum; - } - return -1; -} -LCRYPTO_ALIAS(ASN1_BIT_STRING_num_asc); - int i2c_ASN1_BIT_STRING(ASN1_BIT_STRING *a, unsigned char **pp) { diff --git a/lib/libcrypto/asn1/asn1.h b/lib/libcrypto/asn1/asn1.h index 51fb2862cdf..5eeee3317be 100644 --- a/lib/libcrypto/asn1/asn1.h +++ b/lib/libcrypto/asn1/asn1.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1.h,v 1.79 2023/07/28 10:30:16 tb Exp $ */ +/* $OpenBSD: asn1.h,v 1.80 2023/07/28 10:33:13 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -577,14 +577,6 @@ int ASN1_BIT_STRING_set(ASN1_BIT_STRING *a, unsigned char *d, int length); int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value); int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n); -#ifndef OPENSSL_NO_BIO -int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs, - BIT_STRING_BITNAME *tbl, int indent); -#endif -int ASN1_BIT_STRING_num_asc(const char *name, BIT_STRING_BITNAME *tbl); -int ASN1_BIT_STRING_set_asc(ASN1_BIT_STRING *bs, const char *name, int value, - BIT_STRING_BITNAME *tbl); - ASN1_INTEGER *ASN1_INTEGER_new(void); void ASN1_INTEGER_free(ASN1_INTEGER *a); ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in, long len); diff --git a/lib/libcrypto/hidden/openssl/asn1.h b/lib/libcrypto/hidden/openssl/asn1.h index 087d1294c10..fb1393f2a41 100644 --- a/lib/libcrypto/hidden/openssl/asn1.h +++ b/lib/libcrypto/hidden/openssl/asn1.h @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1.h,v 1.5 2023/07/28 10:30:16 tb Exp $ */ +/* $OpenBSD: asn1.h,v 1.6 2023/07/28 10:33:13 tb Exp $ */ /* * Copyright (c) 2023 Bob Beck * @@ -61,9 +61,6 @@ LCRYPTO_USED(i2d_ASN1_BIT_STRING); LCRYPTO_USED(ASN1_BIT_STRING_set); LCRYPTO_USED(ASN1_BIT_STRING_set_bit); LCRYPTO_USED(ASN1_BIT_STRING_get_bit); -LCRYPTO_USED(ASN1_BIT_STRING_name_print); -LCRYPTO_USED(ASN1_BIT_STRING_num_asc); -LCRYPTO_USED(ASN1_BIT_STRING_set_asc); LCRYPTO_USED(ASN1_INTEGER_new); LCRYPTO_USED(ASN1_INTEGER_free); LCRYPTO_USED(d2i_ASN1_INTEGER); -- 2.20.1