Remove more ASN1_BIT_STRING API
authortb <tb@openbsd.org>
Fri, 28 Jul 2023 10:33:13 +0000 (10:33 +0000)
committertb <tb@openbsd.org>
Fri, 28 Jul 2023 10:33:13 +0000 (10:33 +0000)
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
lib/libcrypto/Symbols.namespace
lib/libcrypto/asn1/a_bitstr.c
lib/libcrypto/asn1/asn1.h
lib/libcrypto/hidden/openssl/asn1.h

index 110a3fa..cffee7e 100644 (file)
@@ -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
index eada22c..3493ad8 100644 (file)
@@ -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
index b985db6..7ea3e12 100644 (file)
@@ -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)
 {
index 51fb286..5eeee33 100644 (file)
@@ -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);
index 087d129..fb1393f 100644 (file)
@@ -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 <beck@openbsd.org>
  *
@@ -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);