blob: 8b1a5aa2bbffa87138e389ff0b7f1e0cf6023de6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
.\"
.\" SPDX-Copyright-Identifier: BSD-2-Clause
.\"
.\" Copyright (C) 2024 Kyle Evans <kevans@FreeBSD.org>
.\"
.Dd March 2, 2024
.Dt LIBDER_WRITE 3
.Os
.Sh NAME
.Nm libder_write
.Nd writing DER encoded buffers
.Sh LIBRARY
.Lb libder
.Sh SYNOPSIS
.In libder.h
.Ft uint8_t *
.Fn libder_write "struct libder_ctx *ctx" "struct libder_object *root" "uint8_t *buf" "size_t *bufsize"
.Sh DESCRIPTION
The
.Fn libder_write
writes the specified
.Fa root
into the given
.Fa buf
of size
.Fa bufsize .
If a
.Dv NULL
and
.Dv 0
are passed in, then
.Fn libder_write
will alllocate a buffer just large enough to fit the encoded
.Fa root .
Upon successful write,
.Fn libder_write
will return a pointer to the buffer used, and
.Fa *bufsize
is updated to indicate how many bytes were written.
On failure,
.Dv NULL
is returned and
.Fa *bufsize
will remain unmodified.
.Pp
Normalization rules are applied at write time, if specified via
.Xr libder_set_normalize 3 .
Note that applications do not typically need to enable normalization, as they
are all enabled by default.
.Sh SEE ALSO
.Xr libder 3 ,
.Xr libder_obj 3 ,
.Xr libder_read 3 ,
.Xr libder_type 3
|