xref: /aosp_15_r20/external/boringssl/src/include/openssl/obj.h (revision 8fb009dc861624b67b6cdb62ea21f0f22d0c584b)
1*8fb009dcSAndroid Build Coastguard Worker /* Copyright (C) 1995-1998 Eric Young ([email protected])
2*8fb009dcSAndroid Build Coastguard Worker  * All rights reserved.
3*8fb009dcSAndroid Build Coastguard Worker  *
4*8fb009dcSAndroid Build Coastguard Worker  * This package is an SSL implementation written
5*8fb009dcSAndroid Build Coastguard Worker  * by Eric Young ([email protected]).
6*8fb009dcSAndroid Build Coastguard Worker  * The implementation was written so as to conform with Netscapes SSL.
7*8fb009dcSAndroid Build Coastguard Worker  *
8*8fb009dcSAndroid Build Coastguard Worker  * This library is free for commercial and non-commercial use as long as
9*8fb009dcSAndroid Build Coastguard Worker  * the following conditions are aheared to.  The following conditions
10*8fb009dcSAndroid Build Coastguard Worker  * apply to all code found in this distribution, be it the RC4, RSA,
11*8fb009dcSAndroid Build Coastguard Worker  * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
12*8fb009dcSAndroid Build Coastguard Worker  * included with this distribution is covered by the same copyright terms
13*8fb009dcSAndroid Build Coastguard Worker  * except that the holder is Tim Hudson ([email protected]).
14*8fb009dcSAndroid Build Coastguard Worker  *
15*8fb009dcSAndroid Build Coastguard Worker  * Copyright remains Eric Young's, and as such any Copyright notices in
16*8fb009dcSAndroid Build Coastguard Worker  * the code are not to be removed.
17*8fb009dcSAndroid Build Coastguard Worker  * If this package is used in a product, Eric Young should be given attribution
18*8fb009dcSAndroid Build Coastguard Worker  * as the author of the parts of the library used.
19*8fb009dcSAndroid Build Coastguard Worker  * This can be in the form of a textual message at program startup or
20*8fb009dcSAndroid Build Coastguard Worker  * in documentation (online or textual) provided with the package.
21*8fb009dcSAndroid Build Coastguard Worker  *
22*8fb009dcSAndroid Build Coastguard Worker  * Redistribution and use in source and binary forms, with or without
23*8fb009dcSAndroid Build Coastguard Worker  * modification, are permitted provided that the following conditions
24*8fb009dcSAndroid Build Coastguard Worker  * are met:
25*8fb009dcSAndroid Build Coastguard Worker  * 1. Redistributions of source code must retain the copyright
26*8fb009dcSAndroid Build Coastguard Worker  *    notice, this list of conditions and the following disclaimer.
27*8fb009dcSAndroid Build Coastguard Worker  * 2. Redistributions in binary form must reproduce the above copyright
28*8fb009dcSAndroid Build Coastguard Worker  *    notice, this list of conditions and the following disclaimer in the
29*8fb009dcSAndroid Build Coastguard Worker  *    documentation and/or other materials provided with the distribution.
30*8fb009dcSAndroid Build Coastguard Worker  * 3. All advertising materials mentioning features or use of this software
31*8fb009dcSAndroid Build Coastguard Worker  *    must display the following acknowledgement:
32*8fb009dcSAndroid Build Coastguard Worker  *    "This product includes cryptographic software written by
33*8fb009dcSAndroid Build Coastguard Worker  *     Eric Young ([email protected])"
34*8fb009dcSAndroid Build Coastguard Worker  *    The word 'cryptographic' can be left out if the rouines from the library
35*8fb009dcSAndroid Build Coastguard Worker  *    being used are not cryptographic related :-).
36*8fb009dcSAndroid Build Coastguard Worker  * 4. If you include any Windows specific code (or a derivative thereof) from
37*8fb009dcSAndroid Build Coastguard Worker  *    the apps directory (application code) you must include an acknowledgement:
38*8fb009dcSAndroid Build Coastguard Worker  *    "This product includes software written by Tim Hudson ([email protected])"
39*8fb009dcSAndroid Build Coastguard Worker  *
40*8fb009dcSAndroid Build Coastguard Worker  * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
41*8fb009dcSAndroid Build Coastguard Worker  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42*8fb009dcSAndroid Build Coastguard Worker  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
43*8fb009dcSAndroid Build Coastguard Worker  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
44*8fb009dcSAndroid Build Coastguard Worker  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45*8fb009dcSAndroid Build Coastguard Worker  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
46*8fb009dcSAndroid Build Coastguard Worker  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47*8fb009dcSAndroid Build Coastguard Worker  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
48*8fb009dcSAndroid Build Coastguard Worker  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
49*8fb009dcSAndroid Build Coastguard Worker  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50*8fb009dcSAndroid Build Coastguard Worker  * SUCH DAMAGE.
51*8fb009dcSAndroid Build Coastguard Worker  *
52*8fb009dcSAndroid Build Coastguard Worker  * The licence and distribution terms for any publically available version or
53*8fb009dcSAndroid Build Coastguard Worker  * derivative of this code cannot be changed.  i.e. this code cannot simply be
54*8fb009dcSAndroid Build Coastguard Worker  * copied and put under another distribution licence
55*8fb009dcSAndroid Build Coastguard Worker  * [including the GNU Public Licence.] */
56*8fb009dcSAndroid Build Coastguard Worker 
57*8fb009dcSAndroid Build Coastguard Worker #ifndef OPENSSL_HEADER_OBJ_H
58*8fb009dcSAndroid Build Coastguard Worker #define OPENSSL_HEADER_OBJ_H
59*8fb009dcSAndroid Build Coastguard Worker 
60*8fb009dcSAndroid Build Coastguard Worker #include <openssl/base.h>
61*8fb009dcSAndroid Build Coastguard Worker 
62*8fb009dcSAndroid Build Coastguard Worker #include <openssl/bytestring.h>
63*8fb009dcSAndroid Build Coastguard Worker #include <openssl/nid.h>  // IWYU pragma: export
64*8fb009dcSAndroid Build Coastguard Worker 
65*8fb009dcSAndroid Build Coastguard Worker #if defined(__cplusplus)
66*8fb009dcSAndroid Build Coastguard Worker extern "C" {
67*8fb009dcSAndroid Build Coastguard Worker #endif
68*8fb009dcSAndroid Build Coastguard Worker 
69*8fb009dcSAndroid Build Coastguard Worker 
70*8fb009dcSAndroid Build Coastguard Worker // The objects library deals with the registration and indexing of ASN.1 object
71*8fb009dcSAndroid Build Coastguard Worker // identifiers. These values are often written as a dotted sequence of numbers,
72*8fb009dcSAndroid Build Coastguard Worker // e.g. 1.2.840.113549.1.9.16.3.9.
73*8fb009dcSAndroid Build Coastguard Worker //
74*8fb009dcSAndroid Build Coastguard Worker // Internally, OpenSSL likes to deal with these values by numbering them with
75*8fb009dcSAndroid Build Coastguard Worker // numbers called "nids". OpenSSL has a large, built-in database of common
76*8fb009dcSAndroid Build Coastguard Worker // object identifiers and also has both short and long names for them.
77*8fb009dcSAndroid Build Coastguard Worker //
78*8fb009dcSAndroid Build Coastguard Worker // This library provides functions for translating between object identifiers,
79*8fb009dcSAndroid Build Coastguard Worker // nids, short names and long names.
80*8fb009dcSAndroid Build Coastguard Worker //
81*8fb009dcSAndroid Build Coastguard Worker // The nid values should not be used outside of a single process: they are not
82*8fb009dcSAndroid Build Coastguard Worker // stable identifiers.
83*8fb009dcSAndroid Build Coastguard Worker 
84*8fb009dcSAndroid Build Coastguard Worker 
85*8fb009dcSAndroid Build Coastguard Worker // Basic operations.
86*8fb009dcSAndroid Build Coastguard Worker 
87*8fb009dcSAndroid Build Coastguard Worker // OBJ_dup returns a duplicate copy of |obj| or NULL on allocation failure. The
88*8fb009dcSAndroid Build Coastguard Worker // caller must call |ASN1_OBJECT_free| on the result to release it.
89*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *obj);
90*8fb009dcSAndroid Build Coastguard Worker 
91*8fb009dcSAndroid Build Coastguard Worker // OBJ_cmp returns a value less than, equal to or greater than zero if |a| is
92*8fb009dcSAndroid Build Coastguard Worker // less than, equal to or greater than |b|, respectively.
93*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b);
94*8fb009dcSAndroid Build Coastguard Worker 
95*8fb009dcSAndroid Build Coastguard Worker // OBJ_get0_data returns a pointer to the DER representation of |obj|. This is
96*8fb009dcSAndroid Build Coastguard Worker // the contents of the DER-encoded identifier, not including the tag and length.
97*8fb009dcSAndroid Build Coastguard Worker // If |obj| does not have an associated object identifier (i.e. it is a nid-only
98*8fb009dcSAndroid Build Coastguard Worker // value), this value is the empty string.
99*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT const uint8_t *OBJ_get0_data(const ASN1_OBJECT *obj);
100*8fb009dcSAndroid Build Coastguard Worker 
101*8fb009dcSAndroid Build Coastguard Worker // OBJ_length returns the length of the DER representation of |obj|. This is the
102*8fb009dcSAndroid Build Coastguard Worker // contents of the DER-encoded identifier, not including the tag and length. If
103*8fb009dcSAndroid Build Coastguard Worker // |obj| does not have an associated object identifier (i.e. it is a nid-only
104*8fb009dcSAndroid Build Coastguard Worker // value), this value is the empty string.
105*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT size_t OBJ_length(const ASN1_OBJECT *obj);
106*8fb009dcSAndroid Build Coastguard Worker 
107*8fb009dcSAndroid Build Coastguard Worker 
108*8fb009dcSAndroid Build Coastguard Worker // Looking up nids.
109*8fb009dcSAndroid Build Coastguard Worker 
110*8fb009dcSAndroid Build Coastguard Worker // OBJ_obj2nid returns the nid corresponding to |obj|, or |NID_undef| if no
111*8fb009dcSAndroid Build Coastguard Worker // such object is known.
112*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT int OBJ_obj2nid(const ASN1_OBJECT *obj);
113*8fb009dcSAndroid Build Coastguard Worker 
114*8fb009dcSAndroid Build Coastguard Worker // OBJ_cbs2nid returns the nid corresponding to the DER data in |cbs|, or
115*8fb009dcSAndroid Build Coastguard Worker // |NID_undef| if no such object is known.
116*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT int OBJ_cbs2nid(const CBS *cbs);
117*8fb009dcSAndroid Build Coastguard Worker 
118*8fb009dcSAndroid Build Coastguard Worker // OBJ_sn2nid returns the nid corresponding to |short_name|, or |NID_undef| if
119*8fb009dcSAndroid Build Coastguard Worker // no such short name is known.
120*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT int OBJ_sn2nid(const char *short_name);
121*8fb009dcSAndroid Build Coastguard Worker 
122*8fb009dcSAndroid Build Coastguard Worker // OBJ_ln2nid returns the nid corresponding to |long_name|, or |NID_undef| if
123*8fb009dcSAndroid Build Coastguard Worker // no such long name is known.
124*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT int OBJ_ln2nid(const char *long_name);
125*8fb009dcSAndroid Build Coastguard Worker 
126*8fb009dcSAndroid Build Coastguard Worker // OBJ_txt2nid returns the nid corresponding to |s|, which may be a short name,
127*8fb009dcSAndroid Build Coastguard Worker // long name, or an ASCII string containing a dotted sequence of numbers. It
128*8fb009dcSAndroid Build Coastguard Worker // returns the nid or NID_undef if unknown.
129*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT int OBJ_txt2nid(const char *s);
130*8fb009dcSAndroid Build Coastguard Worker 
131*8fb009dcSAndroid Build Coastguard Worker 
132*8fb009dcSAndroid Build Coastguard Worker // Getting information about nids.
133*8fb009dcSAndroid Build Coastguard Worker 
134*8fb009dcSAndroid Build Coastguard Worker // OBJ_nid2obj returns the |ASN1_OBJECT| corresponding to |nid|, or NULL if
135*8fb009dcSAndroid Build Coastguard Worker // |nid| is unknown.
136*8fb009dcSAndroid Build Coastguard Worker //
137*8fb009dcSAndroid Build Coastguard Worker // Although the output is not const, this function returns a static, immutable
138*8fb009dcSAndroid Build Coastguard Worker // |ASN1_OBJECT|. It is not necessary to release the object with
139*8fb009dcSAndroid Build Coastguard Worker // |ASN1_OBJECT_free|.
140*8fb009dcSAndroid Build Coastguard Worker //
141*8fb009dcSAndroid Build Coastguard Worker // However, functions like |X509_ALGOR_set0| expect to take ownership of a
142*8fb009dcSAndroid Build Coastguard Worker // possibly dynamically-allocated |ASN1_OBJECT|. |ASN1_OBJECT_free| is a no-op
143*8fb009dcSAndroid Build Coastguard Worker // for static |ASN1_OBJECT|s, so |OBJ_nid2obj| is compatible with such
144*8fb009dcSAndroid Build Coastguard Worker // functions.
145*8fb009dcSAndroid Build Coastguard Worker //
146*8fb009dcSAndroid Build Coastguard Worker // Callers are encouraged to store the result of this function in a const
147*8fb009dcSAndroid Build Coastguard Worker // pointer. However, if using functions like |X509_ALGOR_set0|, callers may use
148*8fb009dcSAndroid Build Coastguard Worker // a non-const pointer and manage ownership.
149*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT ASN1_OBJECT *OBJ_nid2obj(int nid);
150*8fb009dcSAndroid Build Coastguard Worker 
151*8fb009dcSAndroid Build Coastguard Worker // OBJ_get_undef returns the object for |NID_undef|. Prefer this function over
152*8fb009dcSAndroid Build Coastguard Worker // |OBJ_nid2obj| to avoid pulling in the full OID table.
153*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT const ASN1_OBJECT *OBJ_get_undef(void);
154*8fb009dcSAndroid Build Coastguard Worker 
155*8fb009dcSAndroid Build Coastguard Worker // OBJ_nid2sn returns the short name for |nid|, or NULL if |nid| is unknown.
156*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT const char *OBJ_nid2sn(int nid);
157*8fb009dcSAndroid Build Coastguard Worker 
158*8fb009dcSAndroid Build Coastguard Worker // OBJ_nid2ln returns the long name for |nid|, or NULL if |nid| is unknown.
159*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT const char *OBJ_nid2ln(int nid);
160*8fb009dcSAndroid Build Coastguard Worker 
161*8fb009dcSAndroid Build Coastguard Worker // OBJ_nid2cbb writes |nid| as an ASN.1 OBJECT IDENTIFIER to |out|. It returns
162*8fb009dcSAndroid Build Coastguard Worker // one on success or zero otherwise.
163*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT int OBJ_nid2cbb(CBB *out, int nid);
164*8fb009dcSAndroid Build Coastguard Worker 
165*8fb009dcSAndroid Build Coastguard Worker 
166*8fb009dcSAndroid Build Coastguard Worker // Dealing with textual representations of object identifiers.
167*8fb009dcSAndroid Build Coastguard Worker 
168*8fb009dcSAndroid Build Coastguard Worker // OBJ_txt2obj returns an ASN1_OBJECT for the textual representation in |s|.
169*8fb009dcSAndroid Build Coastguard Worker // If |dont_search_names| is zero, then |s| will be matched against the long
170*8fb009dcSAndroid Build Coastguard Worker // and short names of a known objects to find a match. Otherwise |s| must
171*8fb009dcSAndroid Build Coastguard Worker // contain an ASCII string with a dotted sequence of numbers. The resulting
172*8fb009dcSAndroid Build Coastguard Worker // object need not be previously known. It returns a freshly allocated
173*8fb009dcSAndroid Build Coastguard Worker // |ASN1_OBJECT| or NULL on error.
174*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT ASN1_OBJECT *OBJ_txt2obj(const char *s, int dont_search_names);
175*8fb009dcSAndroid Build Coastguard Worker 
176*8fb009dcSAndroid Build Coastguard Worker // OBJ_obj2txt converts |obj| to a textual representation. If
177*8fb009dcSAndroid Build Coastguard Worker // |always_return_oid| is zero then |obj| will be matched against known objects
178*8fb009dcSAndroid Build Coastguard Worker // and the long (preferably) or short name will be used if found. Otherwise
179*8fb009dcSAndroid Build Coastguard Worker // |obj| will be converted into a dotted sequence of integers. If |out| is not
180*8fb009dcSAndroid Build Coastguard Worker // NULL, then at most |out_len| bytes of the textual form will be written
181*8fb009dcSAndroid Build Coastguard Worker // there. If |out_len| is at least one, then string written to |out| will
182*8fb009dcSAndroid Build Coastguard Worker // always be NUL terminated. It returns the number of characters that could
183*8fb009dcSAndroid Build Coastguard Worker // have been written, not including the final NUL, or -1 on error.
184*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT int OBJ_obj2txt(char *out, int out_len, const ASN1_OBJECT *obj,
185*8fb009dcSAndroid Build Coastguard Worker                                int always_return_oid);
186*8fb009dcSAndroid Build Coastguard Worker 
187*8fb009dcSAndroid Build Coastguard Worker 
188*8fb009dcSAndroid Build Coastguard Worker // Adding objects at runtime.
189*8fb009dcSAndroid Build Coastguard Worker 
190*8fb009dcSAndroid Build Coastguard Worker // OBJ_create adds a known object and returns the NID of the new object, or
191*8fb009dcSAndroid Build Coastguard Worker // NID_undef on error.
192*8fb009dcSAndroid Build Coastguard Worker //
193*8fb009dcSAndroid Build Coastguard Worker // WARNING: This function modifies global state. The table cannot contain
194*8fb009dcSAndroid Build Coastguard Worker // duplicate OIDs, short names, or long names. If two callers in the same
195*8fb009dcSAndroid Build Coastguard Worker // address space add conflicting values, only one registration will take effect.
196*8fb009dcSAndroid Build Coastguard Worker // Avoid this function if possible. Instead, callers can process OIDs unknown to
197*8fb009dcSAndroid Build Coastguard Worker // BoringSSL by acting on the byte representation directly. See
198*8fb009dcSAndroid Build Coastguard Worker // |ASN1_OBJECT_create|, |OBJ_get0_data|, and |OBJ_length|.
199*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT int OBJ_create(const char *oid, const char *short_name,
200*8fb009dcSAndroid Build Coastguard Worker                               const char *long_name);
201*8fb009dcSAndroid Build Coastguard Worker 
202*8fb009dcSAndroid Build Coastguard Worker 
203*8fb009dcSAndroid Build Coastguard Worker // Handling signature algorithm identifiers.
204*8fb009dcSAndroid Build Coastguard Worker //
205*8fb009dcSAndroid Build Coastguard Worker // Some NIDs (e.g. sha256WithRSAEncryption) specify both a digest algorithm and
206*8fb009dcSAndroid Build Coastguard Worker // a public key algorithm. The following functions map between pairs of digest
207*8fb009dcSAndroid Build Coastguard Worker // and public-key algorithms and the NIDs that specify their combination.
208*8fb009dcSAndroid Build Coastguard Worker //
209*8fb009dcSAndroid Build Coastguard Worker // Sometimes the combination NID leaves the digest unspecified (e.g.
210*8fb009dcSAndroid Build Coastguard Worker // rsassaPss). In these cases, the digest NID is |NID_undef|.
211*8fb009dcSAndroid Build Coastguard Worker 
212*8fb009dcSAndroid Build Coastguard Worker // OBJ_find_sigid_algs finds the digest and public-key NIDs that correspond to
213*8fb009dcSAndroid Build Coastguard Worker // the signing algorithm |sign_nid|. If successful, it sets |*out_digest_nid|
214*8fb009dcSAndroid Build Coastguard Worker // and |*out_pkey_nid| and returns one. Otherwise it returns zero. Any of
215*8fb009dcSAndroid Build Coastguard Worker // |out_digest_nid| or |out_pkey_nid| can be NULL if the caller doesn't need
216*8fb009dcSAndroid Build Coastguard Worker // that output value.
217*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT int OBJ_find_sigid_algs(int sign_nid, int *out_digest_nid,
218*8fb009dcSAndroid Build Coastguard Worker                                        int *out_pkey_nid);
219*8fb009dcSAndroid Build Coastguard Worker 
220*8fb009dcSAndroid Build Coastguard Worker // OBJ_find_sigid_by_algs finds the signature NID that corresponds to the
221*8fb009dcSAndroid Build Coastguard Worker // combination of |digest_nid| and |pkey_nid|. If success, it sets
222*8fb009dcSAndroid Build Coastguard Worker // |*out_sign_nid| and returns one. Otherwise it returns zero. The
223*8fb009dcSAndroid Build Coastguard Worker // |out_sign_nid| argument can be NULL if the caller only wishes to learn
224*8fb009dcSAndroid Build Coastguard Worker // whether the combination is valid.
225*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT int OBJ_find_sigid_by_algs(int *out_sign_nid, int digest_nid,
226*8fb009dcSAndroid Build Coastguard Worker                                           int pkey_nid);
227*8fb009dcSAndroid Build Coastguard Worker 
228*8fb009dcSAndroid Build Coastguard Worker 
229*8fb009dcSAndroid Build Coastguard Worker // Deprecated functions.
230*8fb009dcSAndroid Build Coastguard Worker 
231*8fb009dcSAndroid Build Coastguard Worker typedef struct obj_name_st {
232*8fb009dcSAndroid Build Coastguard Worker   int type;
233*8fb009dcSAndroid Build Coastguard Worker   int alias;
234*8fb009dcSAndroid Build Coastguard Worker   const char *name;
235*8fb009dcSAndroid Build Coastguard Worker   const char *data;
236*8fb009dcSAndroid Build Coastguard Worker } OBJ_NAME;
237*8fb009dcSAndroid Build Coastguard Worker 
238*8fb009dcSAndroid Build Coastguard Worker #define OBJ_NAME_TYPE_MD_METH 1
239*8fb009dcSAndroid Build Coastguard Worker #define OBJ_NAME_TYPE_CIPHER_METH 2
240*8fb009dcSAndroid Build Coastguard Worker 
241*8fb009dcSAndroid Build Coastguard Worker // OBJ_NAME_do_all_sorted calls |callback| zero or more times, each time with
242*8fb009dcSAndroid Build Coastguard Worker // the name of a different primitive. If |type| is |OBJ_NAME_TYPE_MD_METH| then
243*8fb009dcSAndroid Build Coastguard Worker // the primitives will be hash functions, alternatively if |type| is
244*8fb009dcSAndroid Build Coastguard Worker // |OBJ_NAME_TYPE_CIPHER_METH| then the primitives will be ciphers or cipher
245*8fb009dcSAndroid Build Coastguard Worker // modes.
246*8fb009dcSAndroid Build Coastguard Worker //
247*8fb009dcSAndroid Build Coastguard Worker // This function is ill-specified and should never be used.
248*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT void OBJ_NAME_do_all_sorted(
249*8fb009dcSAndroid Build Coastguard Worker     int type, void (*callback)(const OBJ_NAME *, void *arg), void *arg);
250*8fb009dcSAndroid Build Coastguard Worker 
251*8fb009dcSAndroid Build Coastguard Worker // OBJ_NAME_do_all calls |OBJ_NAME_do_all_sorted|.
252*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT void OBJ_NAME_do_all(int type, void (*callback)(const OBJ_NAME *,
253*8fb009dcSAndroid Build Coastguard Worker                                                                void *arg),
254*8fb009dcSAndroid Build Coastguard Worker                                     void *arg);
255*8fb009dcSAndroid Build Coastguard Worker 
256*8fb009dcSAndroid Build Coastguard Worker // OBJ_cleanup does nothing.
257*8fb009dcSAndroid Build Coastguard Worker OPENSSL_EXPORT void OBJ_cleanup(void);
258*8fb009dcSAndroid Build Coastguard Worker 
259*8fb009dcSAndroid Build Coastguard Worker 
260*8fb009dcSAndroid Build Coastguard Worker #if defined(__cplusplus)
261*8fb009dcSAndroid Build Coastguard Worker }  // extern C
262*8fb009dcSAndroid Build Coastguard Worker #endif
263*8fb009dcSAndroid Build Coastguard Worker 
264*8fb009dcSAndroid Build Coastguard Worker #define OBJ_R_UNKNOWN_NID 100
265*8fb009dcSAndroid Build Coastguard Worker #define OBJ_R_INVALID_OID_STRING 101
266*8fb009dcSAndroid Build Coastguard Worker 
267*8fb009dcSAndroid Build Coastguard Worker #endif  // OPENSSL_HEADER_OBJ_H
268