libressl-SMIME_crlf_copy3
Buffered copy between bios
Usage
Crypto Library (libcrypto, -lcrypto)
#include <openssl/asn1.h>
int
SMIME_crlf_copy(BIO *in_bio, BIO *out_bio, int flags);
Overview
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.
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.
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.
In any case, BIO_flush(3) is called on the output at the end of the function.
Return values
SMIME_crlf_copy() is intended to return 1 on success or 0 on failure.