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