---
name: "libressl-SMIME_crlf_copy"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-SMIME_crlf_copy"
---

# libressl-SMIME\_crlf\_copy(3)

buffered copy between BIOs

## NAME

**SMIME\_crlf\_copy** – buffered copy between BIOs

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#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.

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.

## SEE ALSO

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.

## BUGS

**SMIME\_crlf\_copy**() silently ignores most errors and may return 1 even if it lost part or all of the data in transit.

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.
