xref: /freebsd/crypto/openssl/doc/internal/man3/ossl_DER_w_bn.pod (revision 06c3fb2749bda94cb5201f81ffdb8fa6c3161b2e)
1=pod
2
3=head1 NAME
4
5ossl_DER_w_boolean, ossl_DER_w_uint32, ossl_DER_w_bn, ossl_DER_w_null,
6ossl_DER_w_octet_string, ossl_DER_w_octet_string_uint32
7- internal DER writers for DER primitives
8
9=head1 SYNOPSIS
10
11 #include "internal/der.h"
12
13 int ossl_DER_w_boolean(WPACKET *pkt, int tag, int b);
14 int ossl_DER_w_uint32(WPACKET *pkt, int tag, uint32_t v);
15 int ossl_DER_w_bn(WPACKET *pkt, int tag, const BIGNUM *v);
16 int ossl_DER_w_null(WPACKET *pkt, int tag);
17 int ossl_DER_w_octet_string(WPACKET *pkt, int tag,
18                             const unsigned char *data, size_t data_n);
19 int ossl_DER_w_octet_string_uint32(WPACKET *pkt, int tag, uint32_t value);
20
21=head1 DESCRIPTION
22
23All functions described here behave the same way, they prepend
24(remember that DER writers are used backwards) the DER encoding of
25their respective value to the already written output buffer held by
26I<pkt>.
27
28ossl_DER_w_boolean() writes the primitive BOOLEAN using the value I<b>.
29Any value that evaluates as true will render a B<true> BOOLEAN,
30otherwise a B<false> BOOLEAN.
31
32ossl_DER_w_uint32() and ossl_DER_w_bn() both write the primitive INTEGER using
33the value I<v>.
34
35=for comment Other similar functions for diverse C integers should be
36added.
37
38ossl_DER_w_null() writes the primitive NULL.
39
40ossl_DER_w_octet_string() writes the primitive OCTET STRING using the bytes
41from I<data> with a length of I<data_n>.
42
43ossl_DER_w_octet_string_uint32() writes the primitive OCTET STRING using a
4432 bit value in I<value>.
45
46=head1 RETURN VALUES
47
48All the functions return 1 on success and 0 on failure.  Failure may
49mean that the buffer held by the I<pkt> is too small, but may also
50mean that the values given to the functions are invalid, such as the provided
51I<tag> value being too large for the implementation.
52
53=head1 SEE ALSO
54
55L<DERlib(7)>
56
57=head1 COPYRIGHT
58
59Copyright 2020-2022 The OpenSSL Project Authors. All Rights Reserved.
60
61Licensed under the Apache License 2.0 (the "License").  You may not use
62this file except in compliance with the License.  You can obtain a copy
63in the file LICENSE in the source distribution or at
64L<https://www.openssl.org/source/license.html>.
65
66=cut
67