From: Bob Beck Date: Fri, 14 Nov 2025 18:49:17 +0000 (-0700) Subject: Removed ASN1_STRING_data() X-Git-Tag: 4.0-PRE-CLANG-FORMAT-WEBKIT~141 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=aa0be384d8144ae48a3274cbd728e4bd27304e07;p=thirdparty%2Fopenssl.git Removed ASN1_STRING_data() This has been deprecated since 1.1.0 and is in the way for improvements that could make ASN1_STRING opaque. (#29177) Reviewed-by: Paul Dale Reviewed-by: Dmitry Belyavskiy Reviewed-by: Saša Nedvědický Reviewed-by: Norbert Pocs Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/29149) --- diff --git a/CHANGES.md b/CHANGES.md index a57ed8ab7fe..9efb5315a69 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -32,6 +32,10 @@ OpenSSL 4.0 ### Changes between 3.6 and 4.0 [xx XXX xxxx] + * The deprecated function ASN1_STRING_data has been removed. + + *Bob Beck* + * various function parameters have been constified, in particular for X509-related functions. diff --git a/crypto/asn1/asn1_lib.c b/crypto/asn1/asn1_lib.c index 34db3b4ca72..cb50a350724 100644 --- a/crypto/asn1/asn1_lib.c +++ b/crypto/asn1/asn1_lib.c @@ -424,13 +424,6 @@ const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x) return x->data; } -#ifndef OPENSSL_NO_DEPRECATED_1_1_0 -unsigned char *ASN1_STRING_data(ASN1_STRING *x) -{ - return x->data; -} -#endif - /* |max_len| excludes NUL terminator and may be 0 to indicate no restriction */ char *ossl_sk_ASN1_UTF8STRING2text(STACK_OF(ASN1_UTF8STRING) *text, const char *sep, size_t max_len) diff --git a/doc/man3/ASN1_STRING_length.pod b/doc/man3/ASN1_STRING_length.pod index 8354cea8bdc..47cacb253a0 100644 --- a/doc/man3/ASN1_STRING_length.pod +++ b/doc/man3/ASN1_STRING_length.pod @@ -3,7 +3,7 @@ =head1 NAME ASN1_STRING_dup, ASN1_STRING_cmp, ASN1_STRING_set, ASN1_STRING_length, -ASN1_STRING_type, ASN1_STRING_get0_data, ASN1_STRING_data, +ASN1_STRING_type, ASN1_STRING_get0_data, ASN1_STRING_to_UTF8 - ASN1_STRING utility functions =head1 SYNOPSIS @@ -12,7 +12,6 @@ ASN1_STRING_to_UTF8 - ASN1_STRING utility functions int ASN1_STRING_length(ASN1_STRING *x); const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x); - unsigned char *ASN1_STRING_data(ASN1_STRING *x); ASN1_STRING *ASN1_STRING_dup(const ASN1_STRING *a); @@ -34,10 +33,6 @@ ASN1_STRING_get0_data() returns an internal pointer to the data of I. Since this is an internal pointer it should B be freed or modified in any way. I B be NULL. -ASN1_STRING_data() is similar to ASN1_STRING_get0_data() except the -returned value is not constant. This function is deprecated: -applications should use ASN1_STRING_get0_data() instead. - ASN1_STRING_dup() returns a copy of the structure I. ASN1_STRING_cmp() compares I and I returning 0 if the two @@ -68,11 +63,12 @@ These functions should B be used to examine or modify B or B types: the relevant B or B utility functions should be used instead. -In general it cannot be assumed that the data returned by ASN1_STRING_data() -is null terminated or does not contain embedded nulls. The actual format -of the data will depend on the actual string type itself: for example -for an IA5String the data will be ASCII, for a BMPString two bytes per -character in big endian format, and for a UTF8String it will be in UTF8 format. +In general it cannot be assumed that the data returned by +ASN1_STRING_get0_data() is null terminated or does not contain +embedded nulls. The actual format of the data will depend on the +actual string type itself: for example for an IA5String the data will +be ASCII, for a BMPString two bytes per character in big endian +format, and for a UTF8String it will be in UTF8 format. Similar care should be take to ensure the data is in the correct format when calling ASN1_STRING_set(). @@ -81,7 +77,7 @@ when calling ASN1_STRING_set(). ASN1_STRING_length() returns the length of the content of I. -ASN1_STRING_get0_data() and ASN1_STRING_data() return an internal pointer to +ASN1_STRING_get0_data() returns an internal pointer to the data of I. ASN1_STRING_dup() returns a valid B structure or NULL if an diff --git a/include/openssl/asn1.h.in b/include/openssl/asn1.h.in index b39929a0662..e25fd1c9c3a 100644 --- a/include/openssl/asn1.h.in +++ b/include/openssl/asn1.h.in @@ -585,9 +585,6 @@ int ASN1_STRING_length(const ASN1_STRING *x); OSSL_DEPRECATEDIN_3_0 void ASN1_STRING_length_set(ASN1_STRING *x, int n); # endif int ASN1_STRING_type(const ASN1_STRING *x); -# ifndef OPENSSL_NO_DEPRECATED_1_1_0 -OSSL_DEPRECATEDIN_1_1_0 unsigned char *ASN1_STRING_data(ASN1_STRING *x); -# endif const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *x); DECLARE_ASN1_FUNCTIONS(ASN1_BIT_STRING) diff --git a/util/libcrypto.num b/util/libcrypto.num index 9f351914e1d..bbdf9af66e0 100644 --- a/util/libcrypto.num +++ b/util/libcrypto.num @@ -2827,7 +2827,6 @@ ASN1_STRING_set0 ? 4_0_0 EXIST::FUNCTION: ASN1_STRING_length ? 4_0_0 EXIST::FUNCTION: ASN1_STRING_length_set ? 4_0_0 EXIST::FUNCTION:DEPRECATEDIN_3_0 ASN1_STRING_type ? 4_0_0 EXIST::FUNCTION: -ASN1_STRING_data ? 4_0_0 EXIST::FUNCTION:DEPRECATEDIN_1_1_0 ASN1_STRING_get0_data ? 4_0_0 EXIST::FUNCTION: d2i_ASN1_BIT_STRING ? 4_0_0 EXIST::FUNCTION: i2d_ASN1_BIT_STRING ? 4_0_0 EXIST::FUNCTION: