Add X509_NAME_hash_ex() to be able to check if it failed due to unsupported SHA1
[openssl.git] / doc / man3 / OSSL_ENCODER_to_bio.pod
1 =pod
2
3 =head1 NAME
4
5 OSSL_ENCODER_to_data,
6 OSSL_ENCODER_to_bio,
7 OSSL_ENCODER_to_fp
8 - Routines to perform an encoding
9
10 =head1 SYNOPSIS
11
12  #include <openssl/encoder.h>
13
14  int OSSL_ENCODER_to_data(OSSL_ENCODER_CTX *ctx, unsigned char **pdata,
15                           size_t *pdata_len);
16  int OSSL_ENCODER_to_bio(OSSL_ENCODER_CTX *ctx, BIO *out);
17  int OSSL_ENCODER_to_fp(OSSL_ENCODER_CTX *ctx, FILE *fp);
18
19 Feature availability macros:
20
21 =over 4
22
23 =item OSSL_ENCODER_to_fp() is only available when B<OPENSSL_NO_STDIO>
24 is undefined.
25
26 =back
27
28 =head1 DESCRIPTION
29
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
39 remaining bytes.
40
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>.
43
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>.
46
47 =for comment Know your encoder!
48
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.
52
53 =head1 RETURN VALUES
54
55 OSSL_ENCODER_to_bio(), OSSL_ENCODER_to_fp() and OSSL_ENCODER_to_data()
56 return 1 on success, or 0 on failure.
57
58 =begin comment TODO(3.0) Add examples!
59
60 =head1 EXAMPLES
61
62 Text, because pod2xxx doesn't like empty sections
63
64 =end comment
65
66 =head1 SEE ALSO
67
68 L<provider(7)>, L<OSSL_ENCODER_CTX(3)>
69
70 =head1 HISTORY
71
72 The functions described here were added in OpenSSL 3.0.
73
74 =head1 COPYRIGHT
75
76 Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
77
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>.
82
83 =cut