Commit 202ea04a27 for openssl.org

commit 202ea04a276abb6c3316582285fa5750eb1cd612
Author: Eugene Syromiatnikov <esyr@openssl.org>
Date:   Wed Sep 23 03:13:31 2026 +0200

    doc/man3/ASN1_STRING_length.pod: document ASN1_STRING_set0()

    Signed-off-by: Eugene Syromiatnikov <esyr@openssl.org>
    Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
    Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
    Merge-date: Tue Nov 10 15:06:59 2026
    Merged-from: https://github.com/openssl/openssl/pull/32937

diff --git a/doc/man3/ASN1_STRING_length.pod b/doc/man3/ASN1_STRING_length.pod
index 3c7498ba97..be24b57357 100644
--- a/doc/man3/ASN1_STRING_length.pod
+++ b/doc/man3/ASN1_STRING_length.pod
@@ -10,6 +10,7 @@ ASN1_STRING_type,
 ASN1_STRING_to_UTF8,
 ASN1_STRING_set1_data,
 ASN1_STRING_set1_string,
+ASN1_STRING_set0,
 ASN1_STRING_get_length,
 ASN1_STRING_set,
 ASN1_STRING_length,
@@ -36,6 +37,8 @@ ASN1_STRING_length_set

  int ASN1_STRING_set1_string(ASN1_STRING *str, const char *data);

+ void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len);
+
  size_t ASN1_STRING_get_length(const ASN1_STRING *x);

 The following functions have been deprecated since OpenSSL 4.1, and can be
@@ -90,6 +93,21 @@ NULL. The terminating NUL byte is not included in the data copied into
 I<str>.  It is an error to use this function on a string of type
 B<ASN1_BIT_STRING>.

+ASN1_STRING_set0() sets the content of the string I<str> to I<data>
+of I<len> bytes in size;  the ownership of I<data> is assumed
+by the string (consequently, I<data> must be allocated using OPENSSL_malloc()
+function, and the caller should not attempt to free I<data> after the call).
+The previously held content (in case they were owned
+by the string) is freed using OPENSSL_clear_free(), provided the length
+of the content is positive.
+I<str> must not be NULL.
+If I<data> is NULL, I<len> must be 0.
+A negative I<len> value is treated as 0.
+Note that ASN1_STRING_set0() does not reset the unused bits field,
+used by B<ASN1_BIT_STRING> (contrary to what ASN1_STRING_set(),
+ASN1_STRING_set1_data(), and ASN1_STRING_set1_string() do),
+so it is not suitable for this type of string.
+
 ASN1_STRING_type() returns the type of I<x>, using standard constants
 such as B<V_ASN1_OCTET_STRING>.

@@ -170,7 +188,7 @@ ASN1_STRING_type() returns the type of I<x>.
 ASN1_STRING_to_UTF8() returns the number of bytes in output string I<out> or a
 negative value if an error occurred.

-ASN1_STRING_length_set() does not return a value.
+ASN1_STRING_set0() and ASN1_STRING_length_set() do not return a value.

 =head1 SEE ALSO

@@ -183,6 +201,9 @@ ASN1_STRING_length_set() was deprecated in OpenSSL 3.0.
 ASN1_STRING_set1_data(), ASN1_STRING_set1_string(), and ASN1_STRING_get_length()
 were added in OpenSSL 4.1.

+Before OpenSSL 4.1, ASN1_STRING_set0() used OPENSSL_free()
+instead of OPENSSL_clean_free() to free previously held string content.
+
 =head1 COPYRIGHT

 Copyright 2002-2026 The OpenSSL Project Authors. All Rights Reserved.
diff --git a/util/missingcrypto.txt b/util/missingcrypto.txt
index 023ab4cd3d..d424e39700 100644
--- a/util/missingcrypto.txt
+++ b/util/missingcrypto.txt
@@ -83,7 +83,6 @@ ASN1_SEQUENCE_ANY_it(3)
 ASN1_SEQUENCE_it(3)
 ASN1_SET_ANY_it(3)
 ASN1_STRING_get_default_mask(3)
-ASN1_STRING_set0(3)
 ASN1_STRING_set_by_NID(3)
 ASN1_STRING_set_default_mask(3)
 ASN1_STRING_set_default_mask_asc(3)