SMIME_CRLF_COPY(3)
β¨ NAME β¨
Okay bestie, say hi to SMIME_crlf_copy β buffered copy between BIOs π This is the SMIME_CRLF_COPY(3) page from the Library Functions Manual, and we are absolutely getting into it.
π¦ SYNOPSIS π¦
Here's the exact shape of it, no cap:
library βlibcryptoβ #include <openssl/asn1.h>
int
SMIME_crlf_copy(BIO *in_bio, BIO *out_bio, int flags);
π DESCRIPTION π
SMIME_crlf_copy() copies data from in_bio to out_bio. To avoid many small write operations on out_bio, a buffering BIO created with BIO_f_buffer(3) is temporarily prepended to it. Cute little buffer moment, honestly π«Ά
If the bit SMIME_BINARY is set in the flags argument, all the data is copied verbatim using BIO_read(3) and BIO_write(3).
Otherwise, the data is read as text. All trailing carriage return and newline characters are discarded from every input line, and a single pair of carriage return and newline characters is appended to mark the end of every output line β except that the last output line will end without such a pair if the last input line does not have a newline character at the end. That last-line exception is important, bestie.
If the bit SMIME_TEXT is set in the flags argument and the bit SMIME_BINARY is not set, the line Content-Type: text/plain is prepended to the output with two pairs of carriage return and newline characters after it. Header slay π
In any case, BIO_flush(3) is called on the output at the end of the function. Like, always. Flush era.
πΈ RETURN VALUES πΈ
SMIME_crlf_copy() is intended to return 1 on success or 0 on failure. Intended, okay? Keep that word in mind π
π₯ SEE ALSO π₯
Go read these next, bestie:
BIO_f_buffer(3)BIO_flush(3)BIO_new(3)BIO_push(3)BIO_read(3)SMIME_text(3)SMIME_write_CMS(3)SMIME_write_PKCS7(3)
π HISTORY π
SMIME_crlf_copy() first appeared in OpenSSL 1.0.0 and has been available since OpenBSD 4.9. Iconic longevity, fr fr. π
π BUGS π
Heads up, bestie:SMIME_crlf_copy()silently ignores most errors and may return1even if it lost part or all of the data in transit. That is not a slay. π
Only blocking BIOs are supported. If any of the BIO arguments is non-blocking, part or all of the data is likely to be silently lost in transit. Check your BIOs, please. π
xoxo, this page is from Debian and dated June 11, 2025 β SMIME_CRLF_COPY(3) signing off π
π«Ά
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms