Commit 30950cfb23 for openssl.org
commit 30950cfb23f8436796a75366026e41b2c46e6f13
Author: kovan <xaum.io@gmail.com>
Date: Mon Feb 2 13:24:06 2026 +0100
doc: add documentation for i2d_ASN1_bio_stream
Create a dedicated man page for i2d_ASN1_bio_stream() following the
pattern of i2d_CMS_bio_stream.pod and i2d_PKCS7_bio_stream.pod.
Remove i2d_ASN1_bio_stream from d2i_X509.pod since it now has its
own documentation page.
Fixes: https://github.com/openssl/openssl/issues/14708
Assisted-by: Claude:claude-opus-4.5
Reviewed-by: Nikola Pajkovsky <nikolap@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
Merge-date: Tue Aug 18 08:04:42 2026
Merged-from: https://github.com/openssl/openssl/pull/29911
diff --git a/doc/build.info b/doc/build.info
index 1ed8458bc6..1aae734f5c 100644
--- a/doc/build.info
+++ b/doc/build.info
@@ -3159,14 +3159,10 @@ DEPEND[html/man3/d2i_X509.html]=man3/d2i_X509.pod
GENERATE[html/man3/d2i_X509.html]=man3/d2i_X509.pod
DEPEND[man/man3/d2i_X509.3]=man3/d2i_X509.pod
GENERATE[man/man3/d2i_X509.3]=man3/d2i_X509.pod
-DEPEND[html/man3/i2d_CMS_bio_stream.html]=man3/i2d_CMS_bio_stream.pod
-GENERATE[html/man3/i2d_CMS_bio_stream.html]=man3/i2d_CMS_bio_stream.pod
-DEPEND[man/man3/i2d_CMS_bio_stream.3]=man3/i2d_CMS_bio_stream.pod
-GENERATE[man/man3/i2d_CMS_bio_stream.3]=man3/i2d_CMS_bio_stream.pod
-DEPEND[html/man3/i2d_PKCS7_bio_stream.html]=man3/i2d_PKCS7_bio_stream.pod
-GENERATE[html/man3/i2d_PKCS7_bio_stream.html]=man3/i2d_PKCS7_bio_stream.pod
-DEPEND[man/man3/i2d_PKCS7_bio_stream.3]=man3/i2d_PKCS7_bio_stream.pod
-GENERATE[man/man3/i2d_PKCS7_bio_stream.3]=man3/i2d_PKCS7_bio_stream.pod
+DEPEND[html/man3/i2d_ASN1_bio_stream.html]=man3/i2d_ASN1_bio_stream.pod
+GENERATE[html/man3/i2d_ASN1_bio_stream.html]=man3/i2d_ASN1_bio_stream.pod
+DEPEND[man/man3/i2d_ASN1_bio_stream.3]=man3/i2d_ASN1_bio_stream.pod
+GENERATE[man/man3/i2d_ASN1_bio_stream.3]=man3/i2d_ASN1_bio_stream.pod
DEPEND[html/man3/i2d_re_X509_tbs.html]=man3/i2d_re_X509_tbs.pod
GENERATE[html/man3/i2d_re_X509_tbs.html]=man3/i2d_re_X509_tbs.pod
DEPEND[man/man3/i2d_re_X509_tbs.3]=man3/i2d_re_X509_tbs.pod
@@ -3853,8 +3849,7 @@ html/man3/d2i_PrivateKey.html \
html/man3/d2i_RSAPrivateKey.html \
html/man3/d2i_SSL_SESSION.html \
html/man3/d2i_X509.html \
-html/man3/i2d_CMS_bio_stream.html \
-html/man3/i2d_PKCS7_bio_stream.html \
+html/man3/i2d_ASN1_bio_stream.html \
html/man3/i2d_re_X509_tbs.html \
html/man3/o2i_SCT_LIST.html \
html/man3/s2i_ASN1_IA5STRING.html
@@ -4531,8 +4526,7 @@ man/man3/d2i_PrivateKey.3 \
man/man3/d2i_RSAPrivateKey.3 \
man/man3/d2i_SSL_SESSION.3 \
man/man3/d2i_X509.3 \
-man/man3/i2d_CMS_bio_stream.3 \
-man/man3/i2d_PKCS7_bio_stream.3 \
+man/man3/i2d_ASN1_bio_stream.3 \
man/man3/i2d_re_X509_tbs.3 \
man/man3/o2i_SCT_LIST.3 \
man/man3/s2i_ASN1_IA5STRING.3
diff --git a/doc/man3/d2i_X509.pod b/doc/man3/d2i_X509.pod
index 53f5aaacb7..b29c4f2135 100644
--- a/doc/man3/d2i_X509.pod
+++ b/doc/man3/d2i_X509.pod
@@ -251,7 +251,6 @@ i2d_ASN1_UNIVERSALSTRING,
i2d_ASN1_UTCTIME,
i2d_ASN1_UTF8STRING,
i2d_ASN1_VISIBLESTRING,
-i2d_ASN1_bio_stream,
i2d_ASRange,
i2d_AUTHORITY_INFO_ACCESS,
i2d_AUTHORITY_KEYID,
@@ -596,8 +595,7 @@ freed in the event of error and I<*a> is set to NULL.
B<i2d_I<TYPE>>() returns the number of bytes successfully encoded or a negative
value if an error occurs.
-B<i2d_I<TYPE>_bio>() and B<i2d_I<TYPE>_fp>(),
-as well as i2d_ASN1_bio_stream(),
+B<i2d_I<TYPE>_bio>() and B<i2d_I<TYPE>_fp>()
return 1 for success and 0 if an error occurs.
On error, these functions may record the error in the OpenSSL error queue.
diff --git a/doc/man3/i2d_ASN1_bio_stream.pod b/doc/man3/i2d_ASN1_bio_stream.pod
new file mode 100644
index 0000000000..566db9d880
--- /dev/null
+++ b/doc/man3/i2d_ASN1_bio_stream.pod
@@ -0,0 +1,76 @@
+=pod
+
+=head1 NAME
+
+i2d_ASN1_bio_stream, i2d_CMS_bio_stream, i2d_PKCS7_bio_stream
+- output ASN.1 structures in BER format
+
+=head1 SYNOPSIS
+
+ #include <openssl/asn1.h>
+
+ int i2d_ASN1_bio_stream(BIO *out, ASN1_VALUE *val, BIO *in, int flags,
+ const ASN1_ITEM *it);
+
+ #include <openssl/cms.h>
+
+ int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags);
+
+ #include <openssl/pkcs7.h>
+
+ int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *data, int flags);
+
+=head1 DESCRIPTION
+
+i2d_ASN1_bio_stream() outputs an ASN1_VALUE structure in BER format.
+The I<it> parameter specifies the B<ASN1_ITEM> that describes the structure
+type. If the B<SMIME_STREAM> flag is set in I<flags>, streaming mode is used
+where content from BIO I<in> is processed through an encoding BIO chain for
+structures that support indefinite length encoding. If B<SMIME_STREAM> is not
+set, I<in> is ignored and the structure is written directly to I<out>.
+
+i2d_CMS_bio_stream() outputs a CMS_ContentInfo structure in BER format.
+It is otherwise identical to the function SMIME_write_CMS().
+
+i2d_PKCS7_bio_stream() outputs a PKCS7 structure in BER format.
+It is otherwise identical to the function SMIME_write_PKCS7().
+
+Both i2d_CMS_bio_stream() and i2d_PKCS7_bio_stream() are implemented using
+i2d_ASN1_bio_stream() internally.
+
+=head1 NOTES
+
+These functions are effectively versions of the corresponding i2d functions
+that support streaming.
+
+=head1 BUGS
+
+The prefix "i2d" is arguably wrong because these functions output BER format.
+
+=head1 RETURN VALUES
+
+These functions return 1 for success or 0 for failure.
+
+=head1 SEE ALSO
+
+L<ERR_get_error(3)>,
+L<CMS_sign(3)>, L<CMS_verify(3)>, L<CMS_encrypt(3)>, L<CMS_decrypt(3)>,
+L<PKCS7_sign(3)>, L<PKCS7_verify(3)>, L<PKCS7_encrypt(3)>, L<PKCS7_decrypt(3)>,
+L<SMIME_write_CMS(3)>, L<SMIME_write_PKCS7(3)>,
+L<PEM_write_bio_CMS_stream(3)>, L<PEM_write_bio_PKCS7_stream(3)>
+
+=head1 HISTORY
+
+i2d_ASN1_bio_stream(), i2d_CMS_bio_stream() and i2d_PKCS7_bio_stream()
+were added in OpenSSL 1.0.0.
+
+=head1 COPYRIGHT
+
+Copyright 2008-2016 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/doc/man3/i2d_CMS_bio_stream.pod b/doc/man3/i2d_CMS_bio_stream.pod
deleted file mode 100644
index 88289b115f..0000000000
--- a/doc/man3/i2d_CMS_bio_stream.pod
+++ /dev/null
@@ -1,53 +0,0 @@
-=pod
-
-=head1 NAME
-
-i2d_CMS_bio_stream - output CMS_ContentInfo structure in BER format
-
-=head1 SYNOPSIS
-
- #include <openssl/cms.h>
-
- int i2d_CMS_bio_stream(BIO *out, CMS_ContentInfo *cms, BIO *data, int flags);
-
-=head1 DESCRIPTION
-
-i2d_CMS_bio_stream() outputs a CMS_ContentInfo structure in BER format.
-
-It is otherwise identical to the function SMIME_write_CMS().
-
-=head1 NOTES
-
-This function is effectively a version of the i2d_CMS_bio() supporting
-streaming.
-
-=head1 BUGS
-
-The prefix "i2d" is arguably wrong because the function outputs BER format.
-
-=head1 RETURN VALUES
-
-i2d_CMS_bio_stream() returns 1 for success or 0 for failure.
-
-=head1 SEE ALSO
-
-L<ERR_get_error(3)>, L<CMS_sign(3)>,
-L<CMS_verify(3)>, L<CMS_encrypt(3)>
-L<CMS_decrypt(3)>,
-L<SMIME_write_CMS(3)>,
-L<PEM_write_bio_CMS_stream(3)>
-
-=head1 HISTORY
-
-The i2d_CMS_bio_stream() function was added in OpenSSL 1.0.0.
-
-=head1 COPYRIGHT
-
-Copyright 2008-2016 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/doc/man3/i2d_PKCS7_bio_stream.pod b/doc/man3/i2d_PKCS7_bio_stream.pod
deleted file mode 100644
index ced178bd55..0000000000
--- a/doc/man3/i2d_PKCS7_bio_stream.pod
+++ /dev/null
@@ -1,53 +0,0 @@
-=pod
-
-=head1 NAME
-
-i2d_PKCS7_bio_stream - output PKCS7 structure in BER format
-
-=head1 SYNOPSIS
-
- #include <openssl/pkcs7.h>
-
- int i2d_PKCS7_bio_stream(BIO *out, PKCS7 *p7, BIO *data, int flags);
-
-=head1 DESCRIPTION
-
-i2d_PKCS7_bio_stream() outputs a PKCS7 structure in BER format.
-
-It is otherwise identical to the function SMIME_write_PKCS7().
-
-=head1 NOTES
-
-This function is effectively a version of the d2i_PKCS7_bio() supporting
-streaming.
-
-=head1 BUGS
-
-The prefix "i2d" is arguably wrong because the function outputs BER format.
-
-=head1 RETURN VALUES
-
-i2d_PKCS7_bio_stream() returns 1 for success or 0 for failure.
-
-=head1 SEE ALSO
-
-L<ERR_get_error(3)>, L<PKCS7_sign(3)>,
-L<PKCS7_verify(3)>, L<PKCS7_encrypt(3)>
-L<PKCS7_decrypt(3)>,
-L<SMIME_write_PKCS7(3)>,
-L<PEM_write_bio_PKCS7_stream(3)>
-
-=head1 HISTORY
-
-The i2d_PKCS7_bio_stream() function was added in OpenSSL 1.0.0.
-
-=head1 COPYRIGHT
-
-Copyright 2008-2016 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