8 - Routines to perform an encoding
12 #include <openssl/encoder.h>
14 int OSSL_ENCODER_to_data(OSSL_ENCODER_CTX *ctx, unsigned char **pdata,
16 int OSSL_ENCODER_to_bio(OSSL_ENCODER_CTX *ctx, BIO *out);
17 int OSSL_ENCODER_to_fp(OSSL_ENCODER_CTX *ctx, FILE *fp);
19 Feature availability macros:
23 =item OSSL_ENCODER_to_fp() is only available when B<OPENSSL_NO_STDIO>
30 OSSL_ENCODER_to_data() runs the encoding process for the context I<ctx>,
31 with the output going to the I<*pdata> and I<*pdata_len>.
32 If I<*pdata> is NULL when OSSL_ENCODER_to_data() is called, a buffer will be
33 allocated using L<OPENSSL_zalloc(3)>, and I<*pdata> will be set to point at
34 the start of that buffer, and I<*pdata_len> will be assigned its length when
35 OSSL_ENCODER_to_data() returns.
36 If I<*pdata> is non-NULL when OSSL_ENCODER_to_data() is called, I<*pdata_len>
37 is assumed to have its size. In this case, I<*pdata> will be set to point
38 after the encoded bytes, and I<*pdata_len> will be assigned the number of
41 OSSL_ENCODER_to_bio() runs the encoding process for the context I<ctx>, with
42 the output going to the B<BIO> I<out>.
44 OSSL_ENCODER_to_fp() does the same thing as OSSL_ENCODER_to_bio(), except
45 that the output is going to the B<FILE> I<fp>.
47 =for comment Know your encoder!
49 For OSSL_ENCODER_to_bio() and OSSL_ENCODER_to_fp(), the application is
50 required to set up the B<BIO> or B<FILE> properly, for example to have
51 it in text or binary mode as is appropriate for the encoder output type.
55 OSSL_ENCODER_to_bio(), OSSL_ENCODER_to_fp() and OSSL_ENCODER_to_data()
56 return 1 on success, or 0 on failure.
58 =begin comment TODO(3.0) Add examples!
62 Text, because pod2xxx doesn't like empty sections
68 L<provider(7)>, L<OSSL_ENCODER_CTX(3)>
72 The functions described here were added in OpenSSL 3.0.
76 Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
78 Licensed under the Apache License 2.0 (the "License"). You may not use
79 this file except in compliance with the License. You can obtain a copy
80 in the file LICENSE in the source distribution or at
81 L<https://www.openssl.org/source/license.html>.