xref: /openssl/doc/man3/OSSL_CMP_ATAV_set0.pod (revision 7ed6de99)
1=pod
2
3=head1 NAME
4
5OSSL_CMP_ATAV,
6OSSL_CMP_ATAV_create,
7OSSL_CMP_ATAV_set0,
8OSSL_CMP_ATAV_get0_type,
9OSSL_CMP_ATAV_get0_value,
10OSSL_CMP_ATAV_new_algId,
11OSSL_CMP_ATAV_get0_algId,
12OSSL_CMP_ATAV_new_rsaKeyLen,
13OSSL_CMP_ATAV_get_rsaKeyLen,
14OSSL_CMP_ATAVS,
15OSSL_CMP_ATAV_push1,
16OSSL_CMP_ATAV_free
17- OSSL_CMP_ATAV utility functions
18
19=head1 SYNOPSIS
20
21 #include <openssl/cmp.h>
22
23 typedef OSSL_CRMF_ATTRIBUTETYPEANDVALUE OSSL_CMP_ATAV;
24 OSSL_CMP_ATAV *OSSL_CMP_ATAV_create(ASN1_OBJECT *type, ASN1_TYPE *value);
25 void OSSL_CMP_ATAV_set0(OSSL_CMP_ATAV *atav, ASN1_OBJECT *type,
26                         ASN1_TYPE *value);
27 ASN1_OBJECT *OSSL_CMP_ATAV_get0_type(const OSSL_CMP_ATAV *atav);
28 ASN1_TYPE *OSSL_CMP_ATAV_get0_value(const OSSL_CMP_ATAV *atav);
29
30 OSSL_CMP_ATAV *OSSL_CMP_ATAV_new_algId(const X509_ALGOR *alg);
31 X509_ALGOR *OSSL_CMP_ATAV_get0_algId(const OSSL_CMP_ATAV *atav);
32 OSSL_CMP_ATAV *OSSL_CMP_ATAV_new_rsaKeyLen(int len);
33 int OSSL_CMP_ATAV_get_rsaKeyLen(const OSSL_CMP_ATAV *atav);
34
35 typedef STACK_OF(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) OSSL_CMP_ATAVS;
36 int OSSL_CMP_ATAV_push1(OSSL_CMP_ATAVS **sk_p, const OSSL_CMP_ATAV *atav);
37 void OSSL_CMP_ATAV_free(OSSL_CMP_ATAV *atav);
38
39=head1 DESCRIPTION
40
41B<OSSL_CMP_ATAV> is a short hand of B<OSSL_CRMF_ATTRIBUTETYPEANDVALUE>,
42defined in RFC 4211 Appendix B.
43It is typically used in CertRequest structures,
44but also in CertReqTemplateContent structures for key specifications.
45
46OSSL_CMP_ATAV_create() creates a new B<OSSL_CMP_ATAV> structure and fills it in.
47It combines OSSL_CMP_ATAV_new() and OSSL_CMP_ATAV_set0().
48
49OSSL_CMP_ATAV_set0() sets the I<atav> with an infoType of I<type> and an
50infoValue of I<value>.
51The pointers I<type> and I<value> may be NULL, otherwise
52they must B<not> be freed up after the call because their ownership
53is transferred to I<atav>. The I<itav> pointer must not be NULL.
54
55OSSL_CMP_ATAV_get0_type() returns a direct pointer to the infoType
56in the I<atav> unless it is NULL.
57
58OSSL_CMP_ATAV_get0_value() returns a direct pointer to the infoValue
59in the I<atav> as generic B<ASN1_TYPE> pointer unless I<atav> is NULL.
60
61OSSL_CMP_ATAV_new_algId() creates a new B<OSSL_CMP_ATAV> structure of type
62B<algId> and fills it in with a copy of the given I<alg>.
63
64OSSL_CMP_ATAV_get0_algId() returns
65a direct pointer to the algId infoValue in the I<atav> of type B<X509_ALGOR>
66or NULL if I<atav> is NULL or does not contain an algId.
67
68OSSL_CMP_ATAV_new_rsaKeyLen() creates a new B<OSSL_CMP_ATAV> structure of type
69B<rsaKeyLen> and fills it in with the given I<len>, which must be positive.
70
71OSSL_CMP_ATAV_get_rsaKeyLen() returns
72the RSA key length in rsaKeyLen infoValue in the I<atav>,
73-1 if I<atav> is NULL or does not contain an rsaKeyLen or cannot be parsed,
74or -2 if the value is less than 1 or is greater than INT_MAX.
75
76OSSL_CMP_ATAV_push1() pushes a copy of I<atav> to the stack of B<OSSL_CMP_ATAV>
77pointed to by I<*sk_p>. It creates a new stack if I<*sk_p> points to NULL.
78
79OSSL_CMP_ATAV_free() deallocates I<atav>. It is defined as a macro.
80
81=head1 NOTES
82
83CMP is defined in RFC 4210. CRMF is defined in RFC 4211.
84
85=head1 RETURN VALUES
86
87OSSL_CMP_ATAV_create(),
88OSSL_CMP_ATAV_new_algId(), and OSSL_CMP_ATAV_new_rsaKeyLen()
89return a pointer to the ATAV structure on success, or NULL on error.
90
91OSSL_CMP_ATAV_set0() and OSSL_CMP_ATAV_free() do not return a value.
92
93OSSL_CMP_ATAV_get0_type(), OSSL_CMP_ATAV_get0_value(), and
94OSSL_CMP_ATAV_get0_algId()
95return the respective pointer or NULL if their input is NULL.
96
97OSSL_CMP_ATAV_get_rsaKeyLen() return a key length in bits or < 0 on error.
98
99OSSL_CMP_ATAV_push1() returns 1 on success, 0 on error.
100
101=head1 SEE ALSO
102
103L<OSSL_CMP_ITAV_new0_certReqTemplate(3)>, L<ASN1_TYPE_set(3)>
104
105=head1 HISTORY
106
107The B<OSSL_CMP_ATAV> type and related functions were added in OpenSSL 3.4.
108
109=head1 COPYRIGHT
110
111Copyright 2022-2024 The OpenSSL Project Authors. All Rights Reserved.
112
113Licensed under the Apache License 2.0 (the "License").  You may not use
114this file except in compliance with the License.  You can obtain a copy
115in the file LICENSE in the source distribution or at
116L<https://www.openssl.org/source/license.html>.
117
118=cut
119