Commit 9e26ae32a7 for openssl.org

commit 9e26ae32a757178d6862e0951c76615fe10a3d1d
Author: Norbert Pocs <norbertp@openssl.org>
Date:   Tue Mar 31 16:45:43 2026 +0200

    Document ASN1_BIT_STRING functions

    Signed-off-by: Norbert Pocs <norbertp@openssl.org>

    Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
    Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
    MergeDate: Wed Apr 15 12:25:45 2026
    (Merged from https://github.com/openssl/openssl/pull/30690)

diff --git a/doc/build.info b/doc/build.info
index 9f87ba71a9..e5c62b258a 100644
--- a/doc/build.info
+++ b/doc/build.info
@@ -475,6 +475,10 @@ DEPEND[html/man3/ASN1_BIT_STRING_get_length.html]=man3/ASN1_BIT_STRING_get_lengt
 GENERATE[html/man3/ASN1_BIT_STRING_get_length.html]=man3/ASN1_BIT_STRING_get_length.pod
 DEPEND[man/man3/ASN1_BIT_STRING_get_length.3]=man3/ASN1_BIT_STRING_get_length.pod
 GENERATE[man/man3/ASN1_BIT_STRING_get_length.3]=man3/ASN1_BIT_STRING_get_length.pod
+DEPEND[html/man3/ASN1_BIT_STRING_new.html]=man3/ASN1_BIT_STRING_new.pod
+GENERATE[html/man3/ASN1_BIT_STRING_new.html]=man3/ASN1_BIT_STRING_new.pod
+DEPEND[man/man3/ASN1_BIT_STRING_new.3]=man3/ASN1_BIT_STRING_new.pod
+GENERATE[man/man3/ASN1_BIT_STRING_new.3]=man3/ASN1_BIT_STRING_new.pod
 DEPEND[html/man3/ASN1_EXTERN_FUNCS.html]=man3/ASN1_EXTERN_FUNCS.pod
 GENERATE[html/man3/ASN1_EXTERN_FUNCS.html]=man3/ASN1_EXTERN_FUNCS.pod
 DEPEND[man/man3/ASN1_EXTERN_FUNCS.3]=man3/ASN1_EXTERN_FUNCS.pod
@@ -3162,6 +3166,7 @@ GENERATE[man/man3/s2i_ASN1_IA5STRING.3]=man3/s2i_ASN1_IA5STRING.pod
 IMAGEDOCS[man3]=
 HTMLDOCS[man3]=html/man3/ADMISSIONS.html \
 html/man3/ASN1_BIT_STRING_get_length.html \
+html/man3/ASN1_BIT_STRING_new.html \
 html/man3/ASN1_EXTERN_FUNCS.html \
 html/man3/ASN1_INTEGER_get_int64.html \
 html/man3/ASN1_INTEGER_new.html \
@@ -3835,6 +3840,7 @@ html/man3/o2i_SCT_LIST.html \
 html/man3/s2i_ASN1_IA5STRING.html
 MANDOCS[man3]=man/man3/ADMISSIONS.3 \
 man/man3/ASN1_BIT_STRING_get_length.3 \
+man/man3/ASN1_BIT_STRING_new.3 \
 man/man3/ASN1_EXTERN_FUNCS.3 \
 man/man3/ASN1_INTEGER_get_int64.3 \
 man/man3/ASN1_INTEGER_new.3 \
diff --git a/doc/man3/ASN1_BIT_STRING_get_length.pod b/doc/man3/ASN1_BIT_STRING_get_length.pod
index 94645bfcd7..4ca43c1834 100644
--- a/doc/man3/ASN1_BIT_STRING_get_length.pod
+++ b/doc/man3/ASN1_BIT_STRING_get_length.pod
@@ -3,21 +3,68 @@
 =head1 NAME

 ASN1_BIT_STRING_set1,
+ASN1_BIT_STRING_set_bit,
+ASN1_BIT_STRING_get_bit,
+ASN1_BIT_STRING_check,
+ASN1_BIT_STRING_name_print,
+ASN1_BIT_STRING_num_asc,
+ASN1_BIT_STRING_set_asc,
 ASN1_BIT_STRING_get_length - ASN1_BIT_STRING accessors

 =head1 SYNOPSIS

   #include <openssl/asn1.h>

-  int ASN1_BIT_STRING_get_length(const ASN1_BIT_STRING *bitstr, size_t *length, int *unused_bits);
-  int ASN1_BIT_STRING_set1(ASN1_BIT_STRING *bitstr, const uint8_t *data, size_t length, int unused_bits);
+  typedef struct BIT_STRING_BITNAME_st {
+      int bitnum;
+      const char *lname;
+      const char *sname;
+  } BIT_STRING_BITNAME;
+
+  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);
+  int ASN1_BIT_STRING_check(const ASN1_BIT_STRING *a,
+    const unsigned char *flags, int flags_len);
+
+  int ASN1_BIT_STRING_name_print(BIO *out, ASN1_BIT_STRING *bs,
+    BIT_STRING_BITNAME *tbl, int indent);
+  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);
+  int ASN1_BIT_STRING_get_length(const ASN1_BIT_STRING *bitstr,
+    size_t *length, int *unused_bits);
+  int ASN1_BIT_STRING_set1(ASN1_BIT_STRING *bitstr, const uint8_t *data,
+    size_t length, int unused_bits);

 =head1 DESCRIPTION

 The ASN.1 BIT STRING type holds a bit string of arbitrary bit length.
 In the distinguished encoding rules DER, its bits are encoded in
 groups of eight, leaving between zero and seven bits of the
-last octet unused. If there are unused bits, they must all be set to zero.
+last octet unused. If there are unused bits, they must all be set to
+zero.
+
+ASN1_BIT_STRING_set_bit() sets the I<n>th bit (counted from 0 as the
+least significant bit) of a bit string I<a> to I<value> which is
+interpreted as a boolean.
+
+ASN1_BIT_STRING_get_bit() returns the bit value of the I<n>th bit in the
+bit string I<a>.
+
+ASN1_BIT_STRING_check() checks if the I<a> bit string contains only bits
+specified by the I<flags> vector. I<flags_len> is the length of I<flags>
+in bytes.
+
+ASN1_BIT_STRING_name_print() prints the corresponding bit name specified
+in I<tbl> to I<out> based on the bit string I<bs>. I<indent> might be
+specified for a number of spaces to indent the line.
+
+ASN1_BIT_STRING_num_asc() searches for the provided I<name> in I<lname>
+and I<sname> fields of I<tbl>'s elements and returns the corresponding
+I<bitnum> field value in case there is a match found.
+
+ASN1_BIT_STRING_set_asc() sets the corresponding bit to I<name> in I<bs>
+based on the conversion table I<tbl>.

 ASN1_BIT_STRING_get_length() returns the number of octets in I<bitstr>
 containing bit values in I<length> and the number of unused bits in
@@ -31,6 +78,23 @@ I<unused_bits> bits in the last byte are zero.

 =head1 RETURN VALUES

+ASN1_BIT_STRING_set_bit() returns 1 on success or 0 on incorrect input
+values.
+
+ASN1_BIT_STRING_get_bit() returns the value of the requested bit or 0
+when data not available for the requested arguments.
+
+ASN1_BIT_STRING_check() returns 0 if there is at least one bit set in
+I<a> which is not specified in I<flags>, 1 otherwise.
+
+ASN1_BIT_STRING_name_print() returns 1 on success, or 0 when the print
+functions fail.
+
+ASN1_BIT_STRING_num_asc() returns the bit number of the requested
+I<name> or -1 when the name was not found.
+
+ASN1_BIT_STRING_set_asc() returns 1 on success or 0 on failure.
+
 ASN1_BIT_STRING_get_length() returns 1 on success or 0 if the encoding
 of I<bitstr> is internally inconsistent, or if one of I<bitstr>,
 I<length>, or I<unused_bits> is NULL.
@@ -41,6 +105,11 @@ zero and I<unused_bits> is nonzero, I<unused_bits> is less than 0 or
 greater than 7, or any unused bit in the last octet of I<data> is
 nonzero.

+=head1 HISTORY
+
+Functions ASN1_BIT_STRING_get_length() and ASN1_BIT_STRING_set1() were
+added in OpenSSL version 4.0.
+
 =head1 COPYRIGHT

 Copyright 2025-2026 The OpenSSL Project Authors. All Rights Reserved.
diff --git a/doc/man3/ASN1_BIT_STRING_new.pod b/doc/man3/ASN1_BIT_STRING_new.pod
new file mode 100644
index 0000000000..010aa25392
--- /dev/null
+++ b/doc/man3/ASN1_BIT_STRING_new.pod
@@ -0,0 +1,45 @@
+=pod
+
+=head1 NAME
+
+ASN1_BIT_STRING_new, ASN1_BIT_STRING_free - ASN1_BIT_STRING allocation functions
+
+=head1 SYNOPSIS
+
+=for openssl generic
+
+ #include <openssl/asn1.h>
+
+ ASN1_BIT_STRING *ASN1_BIT_STRING_new(void);
+ void ASN1_BIT_STRING_free(ASN1_BIT_STRING *a);
+
+=head1 DESCRIPTION
+
+ASN1_BIT_STRING_new() returns an allocated B<ASN1_BIT_STRING> structure.
+
+ASN1_BIT_STRING_free() frees up a single B<ASN1_BIT_STRING> object.
+If the argument is NULL, nothing is done.
+
+B<ASN1_BIT_STRING> structure representing the ASN.1 BIT_STRING type.
+
+=head1 RETURN VALUES
+
+ASN1_BIT_STRING_new() return a valid B<ASN1_BIT_STRING> structure or NULL
+if an error occurred.
+
+ASN1_BIT_STRING_free() does not return a value.
+
+=head1 SEE ALSO
+
+L<ERR_get_error(3)>
+
+=head1 COPYRIGHT
+
+Copyright 2026 The OpenSSL Project Authors. All Rights Reserved.
+
+Licensed under the Apache License 2.0 (the "License").  You may not use
+this file except in compliance with the License.  You can obtain a copy
+in the file LICENSE in the source distribution or at
+L<https://www.openssl.org/source/license.html>.
+
+=cut
diff --git a/util/missingcrypto.txt b/util/missingcrypto.txt
index fdc1c9215f..652ee6f0d0 100644
--- a/util/missingcrypto.txt
+++ b/util/missingcrypto.txt
@@ -20,16 +20,8 @@ ASIdOrRange_it(3)
 ASIdentifierChoice_it(3)
 ASIdentifiers_it(3)
 ASN1_ANY_it(3)
-ASN1_BIT_STRING_check(3)
-ASN1_BIT_STRING_free(3)
-ASN1_BIT_STRING_get_bit(3)
 ASN1_BIT_STRING_it(3)
-ASN1_BIT_STRING_name_print(3)
-ASN1_BIT_STRING_new(3)
-ASN1_BIT_STRING_num_asc(3)
 ASN1_BIT_STRING_set(3)
-ASN1_BIT_STRING_set_asc(3)
-ASN1_BIT_STRING_set_bit(3)
 ASN1_BMPSTRING_free(3)
 ASN1_BMPSTRING_it(3)
 ASN1_BMPSTRING_new(3)