xref: /freebsd/crypto/openssl/doc/internal/man3/ossl_cmp_msg_create.pod (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1=pod
2
3=head1 NAME
4
5OSSL_CMP_PKIBODY_IR,
6OSSL_CMP_PKIBODY_IP,
7OSSL_CMP_PKIBODY_CR,
8OSSL_CMP_PKIBODY_CP,
9OSSL_CMP_PKIBODY_P10CR,
10OSSL_CMP_PKIBODY_POPDECC,
11OSSL_CMP_PKIBODY_POPDECR,
12OSSL_CMP_PKIBODY_KUR,
13OSSL_CMP_PKIBODY_KUP,
14OSSL_CMP_PKIBODY_KRR,
15OSSL_CMP_PKIBODY_KRP,
16OSSL_CMP_PKIBODY_RR,
17OSSL_CMP_PKIBODY_RP,
18OSSL_CMP_PKIBODY_CCR,
19OSSL_CMP_PKIBODY_CCP,
20OSSL_CMP_PKIBODY_CKUANN,
21OSSL_CMP_PKIBODY_CANN,
22OSSL_CMP_PKIBODY_RANN,
23OSSL_CMP_PKIBODY_CRLANN,
24OSSL_CMP_PKIBODY_PKICONF,
25OSSL_CMP_PKIBODY_NESTED,
26OSSL_CMP_PKIBODY_GENM,
27OSSL_CMP_PKIBODY_GENP,
28OSSL_CMP_PKIBODY_ERROR,
29OSSL_CMP_PKIBODY_CERTCONF,
30OSSL_CMP_PKIBODY_POLLREQ,
31OSSL_CMP_PKIBODY_POLLREP,
32ossl_cmp_bodytype_to_string,
33ossl_cmp_msg_get_bodytype,
34ossl_cmp_msg_set_bodytype,
35ossl_cmp_msg_create,
36ossl_cmp_msg_gen_ITAV_push0,
37ossl_cmp_msg_gen_ITAVs_push1
38- functions handling CMP messages
39
40=head1 SYNOPSIS
41
42 #include "cmp_local.h"
43
44 #define OSSL_CMP_PKIBODY_IR        0
45 #define OSSL_CMP_PKIBODY_IP        1
46 #define OSSL_CMP_PKIBODY_CR        2
47 #define OSSL_CMP_PKIBODY_CP        3
48 #define OSSL_CMP_PKIBODY_P10CR     4
49 #define OSSL_CMP_PKIBODY_POPDECC   5
50 #define OSSL_CMP_PKIBODY_POPDECR   6
51 #define OSSL_CMP_PKIBODY_KUR       7
52 #define OSSL_CMP_PKIBODY_KUP       8
53 #define OSSL_CMP_PKIBODY_KRR       9
54 #define OSSL_CMP_PKIBODY_KRP      10
55 #define OSSL_CMP_PKIBODY_RR       11
56 #define OSSL_CMP_PKIBODY_RP       12
57 #define OSSL_CMP_PKIBODY_CCR      13
58 #define OSSL_CMP_PKIBODY_CCP      14
59 #define OSSL_CMP_PKIBODY_CKUANN   15
60 #define OSSL_CMP_PKIBODY_CANN     16
61 #define OSSL_CMP_PKIBODY_RANN     17
62 #define OSSL_CMP_PKIBODY_CRLANN   18
63 #define OSSL_CMP_PKIBODY_PKICONF  19
64 #define OSSL_CMP_PKIBODY_NESTED   20
65 #define OSSL_CMP_PKIBODY_GENM     21
66 #define OSSL_CMP_PKIBODY_GENP     22
67 #define OSSL_CMP_PKIBODY_ERROR    23
68 #define OSSL_CMP_PKIBODY_CERTCONF 24
69 #define OSSL_CMP_PKIBODY_POLLREQ  25
70 #define OSSL_CMP_PKIBODY_POLLREP  26
71
72  const char *ossl_cmp_bodytype_to_string(int type);
73  int ossl_cmp_msg_get_bodytype(const OSSL_CMP_MSG *msg);
74  int ossl_cmp_msg_set_bodytype( OSSL_CMP_MSG *msg, int type);
75  OSSL_CMP_MSG *ossl_cmp_msg_create(OSSL_CMP_CTX *ctx, int bodytype);
76  int ossl_cmp_msg_gen_ITAV_push0(OSSL_CMP_MSG *msg, OSSL_CMP_ITAV *itav);
77  int ossl_cmp_msg_gen_ITAVs_push1(OSSL_CMP_MSG *msg,
78                                    STACK_OF(OSSL_CMP_ITAV) *itavs);
79
80=head1 DESCRIPTION
81
82ossl_cmp_bodytype_to_string() returns the name of the given body type as string,
83or "illegal body type" on error.
84
85ossl_cmp_msg_get_bodytype() returns the body type of the given PKIMessage,
86or -1 on error.
87
88ossl_cmp_msg_set_bodytype() sets the type of the message contained in
89the PKIMessage body field.
90Returns 1 on success, 0 on error.
91
92ossl_cmp_msg_create() creates and initializes an B<OSSL_CMP_MSG> structure,
93using fields of B<ctx> for the header and B<bodytype> for the body.
94If the current B<transactionID> field in I<ctx> indicates that there is no
95current transaction, it creates and stores a random one with 128 bits length.
96Thus, the I<ctx> may be modified by this and related ossl_cmp_*_new() functions.
97Returns pointer to created B<OSSL_CMP_MSG> on success, NULL on error.
98
99ossl_cmp_msg_gen_ITAV_push0() pushes the B<itav> to the body of the
100PKIMessage B<msg> of GenMsg or GenRep type. Consumes the B<itavs> pointer.
101Returns 1 on success, 0 on error.
102
103ossl_cmp_msg_gen_ITAVs_push1() adds a copy of the B<itavs> stack to the body
104of the PKIMessage B<msg> of GenMsg or GenRep type.
105Does not consume the B<itavs> pointer nor its elements.
106Returns 1 on success, 0 on error.
107
108=head1 NOTES
109
110CMP is defined in RFC 4210 (and CRMF in RFC 4211).
111
112=head1 RETURN VALUES
113
114See the individual functions above.
115
116=head1 SEE ALSO
117
118L<ossl_cmp_hdr_init(3)>,
119L<OSSL_CMP_CTX_new(3)>, L<OSSL_CMP_exec_certreq(3)>
120
121=head1 HISTORY
122
123The OpenSSL CMP support was added in OpenSSL 3.0.
124
125=head1 COPYRIGHT
126
127Copyright 2007-2021 The OpenSSL Project Authors. All Rights Reserved.
128
129Licensed under the Apache License 2.0 (the "License").  You may not use
130this file except in compliance with the License.  You can obtain a copy
131in the file LICENSE in the source distribution or at
132L<https://www.openssl.org/source/license.html>.
133
134=cut
135