BIO_new_NDEF(3)

BIO_NEW_NDEF(3) Library Functions Manual BIO_NEW_NDEF(3)

NAME

BIO_new_NDEFgeneric constructor for streaming BIO chains

SYNOPSIS

#include <openssl/asn1.h>

BIO *
BIO_new_NDEF(BIO *out_bio, ASN1_VALUE *val_in, const ASN1_ITEM *it);

DESCRIPTION

BIO_new_NDEF() is a wrapper around BIO_new(3) with a BIO type of BIO_f_asn1(3) that supports streaming by providing the following additional functionality.

The data type it needs to support streaming. Of the data types built into the library, currently only CMS_ContentInfo and PKCS7 support that. The argument val_in needs to be of that type.

A structure containing the following data is saved using BIO_ctrl(3) with an argument of BIO_C_SET_EX_ARG as described in BIO_f_asn1(3):

  • the data type it
  • the input value val_in
  • a pointer to the unsigned char * content buffer of val_in, extracted using a type-specific callback function
  • a pointer to the new asn1 BIO
  • a pointer to the beginning of the BIO chain; this may be the asn1 BIO itself, or one or more filter BIOs may be prepended to it in a type-specific manner, for example digest or encoding BIOs

In order to handle the output from the new asn1 BIO, the out_bio is appended to it using BIO_push(3). The out_bio can be a single sink BIO or a BIO chain ending in a sink BIO.

A built-in prefix function is installed with BIO_asn1_set_prefix(3) that encodes val_in using ASN1_item_ndef_i2d(3), and a built-in suffix function is installed that finalizes the written structures in a type-specific way.

RETURN VALUES

BIO_new_NDEF() returns a pointer to the beginning of the constructed BIO chain or NULL if it does not support streaming or if memory allocation fails.

SEE ALSO

ASN1_item_ndef_i2d(3), BIO_ctrl(3), BIO_f_asn1(3), BIO_new(3), BIO_new_CMS(3), BIO_push(3), i2d_ASN1_bio_stream(3)

HISTORY

BIO_new_NDEF() first appeared in OpenSSL 1.0.0 and has been available since OpenBSD 4.9.

December 13, 2021 Linux 6.12.85-6.12-alt1