Commit 35b0829a6a for openssl.org

commit 35b0829a6a39aa3ade31f5da578fda419de2dad0
Author: Norbert Pocs <norbertp@openssl.org>
Date:   Mon Apr 6 14:34:08 2026 +0200

    Remove duplicate function asn1_bit_string_set_unused_bits

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

    Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
    Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
    Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
    MergeDate: Mon Apr 13 07:11:12 2026
    (Merged from https://github.com/openssl/openssl/pull/30746)

diff --git a/crypto/asn1/a_bitstr.c b/crypto/asn1/a_bitstr.c
index 36aaacc310..ebd1417923 100644
--- a/crypto/asn1/a_bitstr.c
+++ b/crypto/asn1/a_bitstr.c
@@ -15,25 +15,6 @@

 #include <crypto/asn1.h>

-static void
-asn1_bit_string_clear_unused_bits(ASN1_BIT_STRING *abs)
-{
-    abs->flags &= ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07);
-}
-
-static int asn1_bit_string_set_unused_bits(ASN1_BIT_STRING *abs,
-    uint8_t unused_bits)
-{
-    if (unused_bits > 7)
-        return 0;
-
-    asn1_bit_string_clear_unused_bits(abs);
-
-    abs->flags |= ASN1_STRING_FLAG_BITS_LEFT | unused_bits;
-
-    return 1;
-}
-
 int ASN1_BIT_STRING_set(ASN1_BIT_STRING *x, unsigned char *d, int len)
 {
     return ASN1_STRING_set(x, d, len);
@@ -187,9 +168,7 @@ int ASN1_BIT_STRING_set_bit(ASN1_BIT_STRING *a, int n, int value)
             unused_bits -= 2;
         if ((u8 & 0x55) != 0)
             unused_bits -= 1;
-
-        if (!asn1_bit_string_set_unused_bits(a, unused_bits))
-            return 0;
+        ossl_asn1_bit_string_set_unused_bits(a, unused_bits);
     }
     return 1;
 }