Merge branch 'dev' of feistymeow.org:feisty_meow into dev
[feisty_meow.git] / production / 3rdparty / deprecated / openssl / include / openssl / objects.h
1 /*
2  * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3  *
4  * Licensed under the OpenSSL license (the "License").  You may not use
5  * this file except in compliance with the License.  You can obtain a copy
6  * in the file LICENSE in the source distribution or at
7  * https://www.openssl.org/source/license.html
8  */
9
10 #ifndef HEADER_OBJECTS_H
11 # define HEADER_OBJECTS_H
12
13 # define USE_OBJ_MAC
14
15 # ifdef USE_OBJ_MAC
16 #  include <openssl/obj_mac.h>
17 # else
18 #  define SN_undef                        "UNDEF"
19 #  define LN_undef                        "undefined"
20 #  define NID_undef                       0
21 #  define OBJ_undef                       0L
22
23 #  define SN_Algorithm                    "Algorithm"
24 #  define LN_algorithm                    "algorithm"
25 #  define NID_algorithm                   38
26 #  define OBJ_algorithm                   1L,3L,14L,3L,2L
27
28 #  define LN_rsadsi                       "rsadsi"
29 #  define NID_rsadsi                      1
30 #  define OBJ_rsadsi                      1L,2L,840L,113549L
31
32 #  define LN_pkcs                         "pkcs"
33 #  define NID_pkcs                        2
34 #  define OBJ_pkcs                        OBJ_rsadsi,1L
35
36 #  define SN_md2                          "MD2"
37 #  define LN_md2                          "md2"
38 #  define NID_md2                         3
39 #  define OBJ_md2                         OBJ_rsadsi,2L,2L
40
41 #  define SN_md5                          "MD5"
42 #  define LN_md5                          "md5"
43 #  define NID_md5                         4
44 #  define OBJ_md5                         OBJ_rsadsi,2L,5L
45
46 #  define SN_rc4                          "RC4"
47 #  define LN_rc4                          "rc4"
48 #  define NID_rc4                         5
49 #  define OBJ_rc4                         OBJ_rsadsi,3L,4L
50
51 #  define LN_rsaEncryption                "rsaEncryption"
52 #  define NID_rsaEncryption               6
53 #  define OBJ_rsaEncryption               OBJ_pkcs,1L,1L
54
55 #  define SN_md2WithRSAEncryption         "RSA-MD2"
56 #  define LN_md2WithRSAEncryption         "md2WithRSAEncryption"
57 #  define NID_md2WithRSAEncryption        7
58 #  define OBJ_md2WithRSAEncryption        OBJ_pkcs,1L,2L
59
60 #  define SN_md5WithRSAEncryption         "RSA-MD5"
61 #  define LN_md5WithRSAEncryption         "md5WithRSAEncryption"
62 #  define NID_md5WithRSAEncryption        8
63 #  define OBJ_md5WithRSAEncryption        OBJ_pkcs,1L,4L
64
65 #  define SN_pbeWithMD2AndDES_CBC         "PBE-MD2-DES"
66 #  define LN_pbeWithMD2AndDES_CBC         "pbeWithMD2AndDES-CBC"
67 #  define NID_pbeWithMD2AndDES_CBC        9
68 #  define OBJ_pbeWithMD2AndDES_CBC        OBJ_pkcs,5L,1L
69
70 #  define SN_pbeWithMD5AndDES_CBC         "PBE-MD5-DES"
71 #  define LN_pbeWithMD5AndDES_CBC         "pbeWithMD5AndDES-CBC"
72 #  define NID_pbeWithMD5AndDES_CBC        10
73 #  define OBJ_pbeWithMD5AndDES_CBC        OBJ_pkcs,5L,3L
74
75 #  define LN_X500                         "X500"
76 #  define NID_X500                        11
77 #  define OBJ_X500                        2L,5L
78
79 #  define LN_X509                         "X509"
80 #  define NID_X509                        12
81 #  define OBJ_X509                        OBJ_X500,4L
82
83 #  define SN_commonName                   "CN"
84 #  define LN_commonName                   "commonName"
85 #  define NID_commonName                  13
86 #  define OBJ_commonName                  OBJ_X509,3L
87
88 #  define SN_countryName                  "C"
89 #  define LN_countryName                  "countryName"
90 #  define NID_countryName                 14
91 #  define OBJ_countryName                 OBJ_X509,6L
92
93 #  define SN_localityName                 "L"
94 #  define LN_localityName                 "localityName"
95 #  define NID_localityName                15
96 #  define OBJ_localityName                OBJ_X509,7L
97
98 /* Postal Address? PA */
99
100 /* should be "ST" (rfc1327) but MS uses 'S' */
101 #  define SN_stateOrProvinceName          "ST"
102 #  define LN_stateOrProvinceName          "stateOrProvinceName"
103 #  define NID_stateOrProvinceName         16
104 #  define OBJ_stateOrProvinceName         OBJ_X509,8L
105
106 #  define SN_organizationName             "O"
107 #  define LN_organizationName             "organizationName"
108 #  define NID_organizationName            17
109 #  define OBJ_organizationName            OBJ_X509,10L
110
111 #  define SN_organizationalUnitName       "OU"
112 #  define LN_organizationalUnitName       "organizationalUnitName"
113 #  define NID_organizationalUnitName      18
114 #  define OBJ_organizationalUnitName      OBJ_X509,11L
115
116 #  define SN_rsa                          "RSA"
117 #  define LN_rsa                          "rsa"
118 #  define NID_rsa                         19
119 #  define OBJ_rsa                         OBJ_X500,8L,1L,1L
120
121 #  define LN_pkcs7                        "pkcs7"
122 #  define NID_pkcs7                       20
123 #  define OBJ_pkcs7                       OBJ_pkcs,7L
124
125 #  define LN_pkcs7_data                   "pkcs7-data"
126 #  define NID_pkcs7_data                  21
127 #  define OBJ_pkcs7_data                  OBJ_pkcs7,1L
128
129 #  define LN_pkcs7_signed                 "pkcs7-signedData"
130 #  define NID_pkcs7_signed                22
131 #  define OBJ_pkcs7_signed                OBJ_pkcs7,2L
132
133 #  define LN_pkcs7_enveloped              "pkcs7-envelopedData"
134 #  define NID_pkcs7_enveloped             23
135 #  define OBJ_pkcs7_enveloped             OBJ_pkcs7,3L
136
137 #  define LN_pkcs7_signedAndEnveloped     "pkcs7-signedAndEnvelopedData"
138 #  define NID_pkcs7_signedAndEnveloped    24
139 #  define OBJ_pkcs7_signedAndEnveloped    OBJ_pkcs7,4L
140
141 #  define LN_pkcs7_digest                 "pkcs7-digestData"
142 #  define NID_pkcs7_digest                25
143 #  define OBJ_pkcs7_digest                OBJ_pkcs7,5L
144
145 #  define LN_pkcs7_encrypted              "pkcs7-encryptedData"
146 #  define NID_pkcs7_encrypted             26
147 #  define OBJ_pkcs7_encrypted             OBJ_pkcs7,6L
148
149 #  define LN_pkcs3                        "pkcs3"
150 #  define NID_pkcs3                       27
151 #  define OBJ_pkcs3                       OBJ_pkcs,3L
152
153 #  define LN_dhKeyAgreement               "dhKeyAgreement"
154 #  define NID_dhKeyAgreement              28
155 #  define OBJ_dhKeyAgreement              OBJ_pkcs3,1L
156
157 #  define SN_des_ecb                      "DES-ECB"
158 #  define LN_des_ecb                      "des-ecb"
159 #  define NID_des_ecb                     29
160 #  define OBJ_des_ecb                     OBJ_algorithm,6L
161
162 #  define SN_des_cfb64                    "DES-CFB"
163 #  define LN_des_cfb64                    "des-cfb"
164 #  define NID_des_cfb64                   30
165 /* IV + num */
166 #  define OBJ_des_cfb64                   OBJ_algorithm,9L
167
168 #  define SN_des_cbc                      "DES-CBC"
169 #  define LN_des_cbc                      "des-cbc"
170 #  define NID_des_cbc                     31
171 /* IV */
172 #  define OBJ_des_cbc                     OBJ_algorithm,7L
173
174 #  define SN_des_ede                      "DES-EDE"
175 #  define LN_des_ede                      "des-ede"
176 #  define NID_des_ede                     32
177 /* ?? */
178 #  define OBJ_des_ede                     OBJ_algorithm,17L
179
180 #  define SN_des_ede3                     "DES-EDE3"
181 #  define LN_des_ede3                     "des-ede3"
182 #  define NID_des_ede3                    33
183
184 #  define SN_idea_cbc                     "IDEA-CBC"
185 #  define LN_idea_cbc                     "idea-cbc"
186 #  define NID_idea_cbc                    34
187 #  define OBJ_idea_cbc                    1L,3L,6L,1L,4L,1L,188L,7L,1L,1L,2L
188
189 #  define SN_idea_cfb64                   "IDEA-CFB"
190 #  define LN_idea_cfb64                   "idea-cfb"
191 #  define NID_idea_cfb64                  35
192
193 #  define SN_idea_ecb                     "IDEA-ECB"
194 #  define LN_idea_ecb                     "idea-ecb"
195 #  define NID_idea_ecb                    36
196
197 #  define SN_rc2_cbc                      "RC2-CBC"
198 #  define LN_rc2_cbc                      "rc2-cbc"
199 #  define NID_rc2_cbc                     37
200 #  define OBJ_rc2_cbc                     OBJ_rsadsi,3L,2L
201
202 #  define SN_rc2_ecb                      "RC2-ECB"
203 #  define LN_rc2_ecb                      "rc2-ecb"
204 #  define NID_rc2_ecb                     38
205
206 #  define SN_rc2_cfb64                    "RC2-CFB"
207 #  define LN_rc2_cfb64                    "rc2-cfb"
208 #  define NID_rc2_cfb64                   39
209
210 #  define SN_rc2_ofb64                    "RC2-OFB"
211 #  define LN_rc2_ofb64                    "rc2-ofb"
212 #  define NID_rc2_ofb64                   40
213
214 #  define SN_sha                          "SHA"
215 #  define LN_sha                          "sha"
216 #  define NID_sha                         41
217 #  define OBJ_sha                         OBJ_algorithm,18L
218
219 #  define SN_shaWithRSAEncryption         "RSA-SHA"
220 #  define LN_shaWithRSAEncryption         "shaWithRSAEncryption"
221 #  define NID_shaWithRSAEncryption        42
222 #  define OBJ_shaWithRSAEncryption        OBJ_algorithm,15L
223
224 #  define SN_des_ede_cbc                  "DES-EDE-CBC"
225 #  define LN_des_ede_cbc                  "des-ede-cbc"
226 #  define NID_des_ede_cbc                 43
227
228 #  define SN_des_ede3_cbc                 "DES-EDE3-CBC"
229 #  define LN_des_ede3_cbc                 "des-ede3-cbc"
230 #  define NID_des_ede3_cbc                44
231 #  define OBJ_des_ede3_cbc                OBJ_rsadsi,3L,7L
232
233 #  define SN_des_ofb64                    "DES-OFB"
234 #  define LN_des_ofb64                    "des-ofb"
235 #  define NID_des_ofb64                   45
236 #  define OBJ_des_ofb64                   OBJ_algorithm,8L
237
238 #  define SN_idea_ofb64                   "IDEA-OFB"
239 #  define LN_idea_ofb64                   "idea-ofb"
240 #  define NID_idea_ofb64                  46
241
242 #  define LN_pkcs9                        "pkcs9"
243 #  define NID_pkcs9                       47
244 #  define OBJ_pkcs9                       OBJ_pkcs,9L
245
246 #  define SN_pkcs9_emailAddress           "Email"
247 #  define LN_pkcs9_emailAddress           "emailAddress"
248 #  define NID_pkcs9_emailAddress          48
249 #  define OBJ_pkcs9_emailAddress          OBJ_pkcs9,1L
250
251 #  define LN_pkcs9_unstructuredName       "unstructuredName"
252 #  define NID_pkcs9_unstructuredName      49
253 #  define OBJ_pkcs9_unstructuredName      OBJ_pkcs9,2L
254
255 #  define LN_pkcs9_contentType            "contentType"
256 #  define NID_pkcs9_contentType           50
257 #  define OBJ_pkcs9_contentType           OBJ_pkcs9,3L
258
259 #  define LN_pkcs9_messageDigest          "messageDigest"
260 #  define NID_pkcs9_messageDigest         51
261 #  define OBJ_pkcs9_messageDigest         OBJ_pkcs9,4L
262
263 #  define LN_pkcs9_signingTime            "signingTime"
264 #  define NID_pkcs9_signingTime           52
265 #  define OBJ_pkcs9_signingTime           OBJ_pkcs9,5L
266
267 #  define LN_pkcs9_countersignature       "countersignature"
268 #  define NID_pkcs9_countersignature      53
269 #  define OBJ_pkcs9_countersignature      OBJ_pkcs9,6L
270
271 #  define LN_pkcs9_challengePassword      "challengePassword"
272 #  define NID_pkcs9_challengePassword     54
273 #  define OBJ_pkcs9_challengePassword     OBJ_pkcs9,7L
274
275 #  define LN_pkcs9_unstructuredAddress    "unstructuredAddress"
276 #  define NID_pkcs9_unstructuredAddress   55
277 #  define OBJ_pkcs9_unstructuredAddress   OBJ_pkcs9,8L
278
279 #  define LN_pkcs9_extCertAttributes      "extendedCertificateAttributes"
280 #  define NID_pkcs9_extCertAttributes     56
281 #  define OBJ_pkcs9_extCertAttributes     OBJ_pkcs9,9L
282
283 #  define SN_netscape                     "Netscape"
284 #  define LN_netscape                     "Netscape Communications Corp."
285 #  define NID_netscape                    57
286 #  define OBJ_netscape                    2L,16L,840L,1L,113730L
287
288 #  define SN_netscape_cert_extension      "nsCertExt"
289 #  define LN_netscape_cert_extension      "Netscape Certificate Extension"
290 #  define NID_netscape_cert_extension     58
291 #  define OBJ_netscape_cert_extension     OBJ_netscape,1L
292
293 #  define SN_netscape_data_type           "nsDataType"
294 #  define LN_netscape_data_type           "Netscape Data Type"
295 #  define NID_netscape_data_type          59
296 #  define OBJ_netscape_data_type          OBJ_netscape,2L
297
298 #  define SN_des_ede_cfb64                "DES-EDE-CFB"
299 #  define LN_des_ede_cfb64                "des-ede-cfb"
300 #  define NID_des_ede_cfb64               60
301
302 #  define SN_des_ede3_cfb64               "DES-EDE3-CFB"
303 #  define LN_des_ede3_cfb64               "des-ede3-cfb"
304 #  define NID_des_ede3_cfb64              61
305
306 #  define SN_des_ede_ofb64                "DES-EDE-OFB"
307 #  define LN_des_ede_ofb64                "des-ede-ofb"
308 #  define NID_des_ede_ofb64               62
309
310 #  define SN_des_ede3_ofb64               "DES-EDE3-OFB"
311 #  define LN_des_ede3_ofb64               "des-ede3-ofb"
312 #  define NID_des_ede3_ofb64              63
313
314 /* I'm not sure about the object ID */
315 #  define SN_sha1                         "SHA1"
316 #  define LN_sha1                         "sha1"
317 #  define NID_sha1                        64
318 #  define OBJ_sha1                        OBJ_algorithm,26L
319 /* 28 Jun 1996 - eay */
320 /* #define OBJ_sha1                     1L,3L,14L,2L,26L,05L <- wrong */
321
322 #  define SN_sha1WithRSAEncryption        "RSA-SHA1"
323 #  define LN_sha1WithRSAEncryption        "sha1WithRSAEncryption"
324 #  define NID_sha1WithRSAEncryption       65
325 #  define OBJ_sha1WithRSAEncryption       OBJ_pkcs,1L,5L
326
327 #  define SN_dsaWithSHA                   "DSA-SHA"
328 #  define LN_dsaWithSHA                   "dsaWithSHA"
329 #  define NID_dsaWithSHA                  66
330 #  define OBJ_dsaWithSHA                  OBJ_algorithm,13L
331
332 #  define SN_dsa_2                        "DSA-old"
333 #  define LN_dsa_2                        "dsaEncryption-old"
334 #  define NID_dsa_2                       67
335 #  define OBJ_dsa_2                       OBJ_algorithm,12L
336
337 /* proposed by microsoft to RSA */
338 #  define SN_pbeWithSHA1AndRC2_CBC        "PBE-SHA1-RC2-64"
339 #  define LN_pbeWithSHA1AndRC2_CBC        "pbeWithSHA1AndRC2-CBC"
340 #  define NID_pbeWithSHA1AndRC2_CBC       68
341 #  define OBJ_pbeWithSHA1AndRC2_CBC       OBJ_pkcs,5L,11L
342
343 /*
344  * proposed by microsoft to RSA as pbeWithSHA1AndRC4: it is now defined
345  * explicitly in PKCS#5 v2.0 as id-PBKDF2 which is something completely
346  * different.
347  */
348 #  define LN_id_pbkdf2                    "PBKDF2"
349 #  define NID_id_pbkdf2                   69
350 #  define OBJ_id_pbkdf2                   OBJ_pkcs,5L,12L
351
352 #  define SN_dsaWithSHA1_2                "DSA-SHA1-old"
353 #  define LN_dsaWithSHA1_2                "dsaWithSHA1-old"
354 #  define NID_dsaWithSHA1_2               70
355 /* Got this one from 'sdn706r20.pdf' which is actually an NSA document :-) */
356 #  define OBJ_dsaWithSHA1_2               OBJ_algorithm,27L
357
358 #  define SN_netscape_cert_type           "nsCertType"
359 #  define LN_netscape_cert_type           "Netscape Cert Type"
360 #  define NID_netscape_cert_type          71
361 #  define OBJ_netscape_cert_type          OBJ_netscape_cert_extension,1L
362
363 #  define SN_netscape_base_url            "nsBaseUrl"
364 #  define LN_netscape_base_url            "Netscape Base Url"
365 #  define NID_netscape_base_url           72
366 #  define OBJ_netscape_base_url           OBJ_netscape_cert_extension,2L
367
368 #  define SN_netscape_revocation_url      "nsRevocationUrl"
369 #  define LN_netscape_revocation_url      "Netscape Revocation Url"
370 #  define NID_netscape_revocation_url     73
371 #  define OBJ_netscape_revocation_url     OBJ_netscape_cert_extension,3L
372
373 #  define SN_netscape_ca_revocation_url   "nsCaRevocationUrl"
374 #  define LN_netscape_ca_revocation_url   "Netscape CA Revocation Url"
375 #  define NID_netscape_ca_revocation_url  74
376 #  define OBJ_netscape_ca_revocation_url  OBJ_netscape_cert_extension,4L
377
378 #  define SN_netscape_renewal_url         "nsRenewalUrl"
379 #  define LN_netscape_renewal_url         "Netscape Renewal Url"
380 #  define NID_netscape_renewal_url        75
381 #  define OBJ_netscape_renewal_url        OBJ_netscape_cert_extension,7L
382
383 #  define SN_netscape_ca_policy_url       "nsCaPolicyUrl"
384 #  define LN_netscape_ca_policy_url       "Netscape CA Policy Url"
385 #  define NID_netscape_ca_policy_url      76
386 #  define OBJ_netscape_ca_policy_url      OBJ_netscape_cert_extension,8L
387
388 #  define SN_netscape_ssl_server_name     "nsSslServerName"
389 #  define LN_netscape_ssl_server_name     "Netscape SSL Server Name"
390 #  define NID_netscape_ssl_server_name    77
391 #  define OBJ_netscape_ssl_server_name    OBJ_netscape_cert_extension,12L
392
393 #  define SN_netscape_comment             "nsComment"
394 #  define LN_netscape_comment             "Netscape Comment"
395 #  define NID_netscape_comment            78
396 #  define OBJ_netscape_comment            OBJ_netscape_cert_extension,13L
397
398 #  define SN_netscape_cert_sequence       "nsCertSequence"
399 #  define LN_netscape_cert_sequence       "Netscape Certificate Sequence"
400 #  define NID_netscape_cert_sequence      79
401 #  define OBJ_netscape_cert_sequence      OBJ_netscape_data_type,5L
402
403 #  define SN_desx_cbc                     "DESX-CBC"
404 #  define LN_desx_cbc                     "desx-cbc"
405 #  define NID_desx_cbc                    80
406
407 #  define SN_id_ce                        "id-ce"
408 #  define NID_id_ce                       81
409 #  define OBJ_id_ce                       2L,5L,29L
410
411 #  define SN_subject_key_identifier       "subjectKeyIdentifier"
412 #  define LN_subject_key_identifier       "X509v3 Subject Key Identifier"
413 #  define NID_subject_key_identifier      82
414 #  define OBJ_subject_key_identifier      OBJ_id_ce,14L
415
416 #  define SN_key_usage                    "keyUsage"
417 #  define LN_key_usage                    "X509v3 Key Usage"
418 #  define NID_key_usage                   83
419 #  define OBJ_key_usage                   OBJ_id_ce,15L
420
421 #  define SN_private_key_usage_period     "privateKeyUsagePeriod"
422 #  define LN_private_key_usage_period     "X509v3 Private Key Usage Period"
423 #  define NID_private_key_usage_period    84
424 #  define OBJ_private_key_usage_period    OBJ_id_ce,16L
425
426 #  define SN_subject_alt_name             "subjectAltName"
427 #  define LN_subject_alt_name             "X509v3 Subject Alternative Name"
428 #  define NID_subject_alt_name            85
429 #  define OBJ_subject_alt_name            OBJ_id_ce,17L
430
431 #  define SN_issuer_alt_name              "issuerAltName"
432 #  define LN_issuer_alt_name              "X509v3 Issuer Alternative Name"
433 #  define NID_issuer_alt_name             86
434 #  define OBJ_issuer_alt_name             OBJ_id_ce,18L
435
436 #  define SN_basic_constraints            "basicConstraints"
437 #  define LN_basic_constraints            "X509v3 Basic Constraints"
438 #  define NID_basic_constraints           87
439 #  define OBJ_basic_constraints           OBJ_id_ce,19L
440
441 #  define SN_crl_number                   "crlNumber"
442 #  define LN_crl_number                   "X509v3 CRL Number"
443 #  define NID_crl_number                  88
444 #  define OBJ_crl_number                  OBJ_id_ce,20L
445
446 #  define SN_certificate_policies         "certificatePolicies"
447 #  define LN_certificate_policies         "X509v3 Certificate Policies"
448 #  define NID_certificate_policies        89
449 #  define OBJ_certificate_policies        OBJ_id_ce,32L
450
451 #  define SN_authority_key_identifier     "authorityKeyIdentifier"
452 #  define LN_authority_key_identifier     "X509v3 Authority Key Identifier"
453 #  define NID_authority_key_identifier    90
454 #  define OBJ_authority_key_identifier    OBJ_id_ce,35L
455
456 #  define SN_bf_cbc                       "BF-CBC"
457 #  define LN_bf_cbc                       "bf-cbc"
458 #  define NID_bf_cbc                      91
459 #  define OBJ_bf_cbc                      1L,3L,6L,1L,4L,1L,3029L,1L,2L
460
461 #  define SN_bf_ecb                       "BF-ECB"
462 #  define LN_bf_ecb                       "bf-ecb"
463 #  define NID_bf_ecb                      92
464
465 #  define SN_bf_cfb64                     "BF-CFB"
466 #  define LN_bf_cfb64                     "bf-cfb"
467 #  define NID_bf_cfb64                    93
468
469 #  define SN_bf_ofb64                     "BF-OFB"
470 #  define LN_bf_ofb64                     "bf-ofb"
471 #  define NID_bf_ofb64                    94
472
473 #  define SN_mdc2                         "MDC2"
474 #  define LN_mdc2                         "mdc2"
475 #  define NID_mdc2                        95
476 #  define OBJ_mdc2                        2L,5L,8L,3L,101L
477 /* An alternative?                      1L,3L,14L,3L,2L,19L */
478
479 #  define SN_mdc2WithRSA                  "RSA-MDC2"
480 #  define LN_mdc2WithRSA                  "mdc2withRSA"
481 #  define NID_mdc2WithRSA                 96
482 #  define OBJ_mdc2WithRSA                 2L,5L,8L,3L,100L
483
484 #  define SN_rc4_40                       "RC4-40"
485 #  define LN_rc4_40                       "rc4-40"
486 #  define NID_rc4_40                      97
487
488 #  define SN_rc2_40_cbc                   "RC2-40-CBC"
489 #  define LN_rc2_40_cbc                   "rc2-40-cbc"
490 #  define NID_rc2_40_cbc                  98
491
492 #  define SN_givenName                    "G"
493 #  define LN_givenName                    "givenName"
494 #  define NID_givenName                   99
495 #  define OBJ_givenName                   OBJ_X509,42L
496
497 #  define SN_surname                      "S"
498 #  define LN_surname                      "surname"
499 #  define NID_surname                     100
500 #  define OBJ_surname                     OBJ_X509,4L
501
502 #  define SN_initials                     "I"
503 #  define LN_initials                     "initials"
504 #  define NID_initials                    101
505 #  define OBJ_initials                    OBJ_X509,43L
506
507 #  define SN_uniqueIdentifier             "UID"
508 #  define LN_uniqueIdentifier             "uniqueIdentifier"
509 #  define NID_uniqueIdentifier            102
510 #  define OBJ_uniqueIdentifier            OBJ_X509,45L
511
512 #  define SN_crl_distribution_points      "crlDistributionPoints"
513 #  define LN_crl_distribution_points      "X509v3 CRL Distribution Points"
514 #  define NID_crl_distribution_points     103
515 #  define OBJ_crl_distribution_points     OBJ_id_ce,31L
516
517 #  define SN_md5WithRSA                   "RSA-NP-MD5"
518 #  define LN_md5WithRSA                   "md5WithRSA"
519 #  define NID_md5WithRSA                  104
520 #  define OBJ_md5WithRSA                  OBJ_algorithm,3L
521
522 #  define SN_serialNumber                 "SN"
523 #  define LN_serialNumber                 "serialNumber"
524 #  define NID_serialNumber                105
525 #  define OBJ_serialNumber                OBJ_X509,5L
526
527 #  define SN_title                        "T"
528 #  define LN_title                        "title"
529 #  define NID_title                       106
530 #  define OBJ_title                       OBJ_X509,12L
531
532 #  define SN_description                  "D"
533 #  define LN_description                  "description"
534 #  define NID_description                 107
535 #  define OBJ_description                 OBJ_X509,13L
536
537 /* CAST5 is CAST-128, I'm just sticking with the documentation */
538 #  define SN_cast5_cbc                    "CAST5-CBC"
539 #  define LN_cast5_cbc                    "cast5-cbc"
540 #  define NID_cast5_cbc                   108
541 #  define OBJ_cast5_cbc                   1L,2L,840L,113533L,7L,66L,10L
542
543 #  define SN_cast5_ecb                    "CAST5-ECB"
544 #  define LN_cast5_ecb                    "cast5-ecb"
545 #  define NID_cast5_ecb                   109
546
547 #  define SN_cast5_cfb64                  "CAST5-CFB"
548 #  define LN_cast5_cfb64                  "cast5-cfb"
549 #  define NID_cast5_cfb64                 110
550
551 #  define SN_cast5_ofb64                  "CAST5-OFB"
552 #  define LN_cast5_ofb64                  "cast5-ofb"
553 #  define NID_cast5_ofb64                 111
554
555 #  define LN_pbeWithMD5AndCast5_CBC       "pbeWithMD5AndCast5CBC"
556 #  define NID_pbeWithMD5AndCast5_CBC      112
557 #  define OBJ_pbeWithMD5AndCast5_CBC      1L,2L,840L,113533L,7L,66L,12L
558
559 /*-
560  * This is one sun will soon be using :-(
561  * id-dsa-with-sha1 ID  ::= {
562  *   iso(1) member-body(2) us(840) x9-57 (10040) x9cm(4) 3 }
563  */
564 #  define SN_dsaWithSHA1                  "DSA-SHA1"
565 #  define LN_dsaWithSHA1                  "dsaWithSHA1"
566 #  define NID_dsaWithSHA1                 113
567 #  define OBJ_dsaWithSHA1                 1L,2L,840L,10040L,4L,3L
568
569 #  define NID_md5_sha1                    114
570 #  define SN_md5_sha1                     "MD5-SHA1"
571 #  define LN_md5_sha1                     "md5-sha1"
572
573 #  define SN_sha1WithRSA                  "RSA-SHA1-2"
574 #  define LN_sha1WithRSA                  "sha1WithRSA"
575 #  define NID_sha1WithRSA                 115
576 #  define OBJ_sha1WithRSA                 OBJ_algorithm,29L
577
578 #  define SN_dsa                          "DSA"
579 #  define LN_dsa                          "dsaEncryption"
580 #  define NID_dsa                         116
581 #  define OBJ_dsa                         1L,2L,840L,10040L,4L,1L
582
583 #  define SN_ripemd160                    "RIPEMD160"
584 #  define LN_ripemd160                    "ripemd160"
585 #  define NID_ripemd160                   117
586 #  define OBJ_ripemd160                   1L,3L,36L,3L,2L,1L
587
588 /*
589  * The name should actually be rsaSignatureWithripemd160, but I'm going to
590  * continue using the convention I'm using with the other ciphers
591  */
592 #  define SN_ripemd160WithRSA             "RSA-RIPEMD160"
593 #  define LN_ripemd160WithRSA             "ripemd160WithRSA"
594 #  define NID_ripemd160WithRSA            119
595 #  define OBJ_ripemd160WithRSA            1L,3L,36L,3L,3L,1L,2L
596
597 /*-
598  * Taken from rfc2040
599  *  RC5_CBC_Parameters ::= SEQUENCE {
600  *      version           INTEGER (v1_0(16)),
601  *      rounds            INTEGER (8..127),
602  *      blockSizeInBits   INTEGER (64, 128),
603  *      iv                OCTET STRING OPTIONAL
604  *      }
605  */
606 #  define SN_rc5_cbc                      "RC5-CBC"
607 #  define LN_rc5_cbc                      "rc5-cbc"
608 #  define NID_rc5_cbc                     120
609 #  define OBJ_rc5_cbc                     OBJ_rsadsi,3L,8L
610
611 #  define SN_rc5_ecb                      "RC5-ECB"
612 #  define LN_rc5_ecb                      "rc5-ecb"
613 #  define NID_rc5_ecb                     121
614
615 #  define SN_rc5_cfb64                    "RC5-CFB"
616 #  define LN_rc5_cfb64                    "rc5-cfb"
617 #  define NID_rc5_cfb64                   122
618
619 #  define SN_rc5_ofb64                    "RC5-OFB"
620 #  define LN_rc5_ofb64                    "rc5-ofb"
621 #  define NID_rc5_ofb64                   123
622
623 #  define SN_rle_compression              "RLE"
624 #  define LN_rle_compression              "run length compression"
625 #  define NID_rle_compression             124
626 #  define OBJ_rle_compression             1L,1L,1L,1L,666L,1L
627
628 #  define SN_zlib_compression             "ZLIB"
629 #  define LN_zlib_compression             "zlib compression"
630 #  define NID_zlib_compression            125
631 #  define OBJ_zlib_compression            1L,1L,1L,1L,666L,2L
632
633 #  define SN_ext_key_usage                "extendedKeyUsage"
634 #  define LN_ext_key_usage                "X509v3 Extended Key Usage"
635 #  define NID_ext_key_usage               126
636 #  define OBJ_ext_key_usage               OBJ_id_ce,37
637
638 #  define SN_id_pkix                      "PKIX"
639 #  define NID_id_pkix                     127
640 #  define OBJ_id_pkix                     1L,3L,6L,1L,5L,5L,7L
641
642 #  define SN_id_kp                        "id-kp"
643 #  define NID_id_kp                       128
644 #  define OBJ_id_kp                       OBJ_id_pkix,3L
645
646 /* PKIX extended key usage OIDs */
647
648 #  define SN_server_auth                  "serverAuth"
649 #  define LN_server_auth                  "TLS Web Server Authentication"
650 #  define NID_server_auth                 129
651 #  define OBJ_server_auth                 OBJ_id_kp,1L
652
653 #  define SN_client_auth                  "clientAuth"
654 #  define LN_client_auth                  "TLS Web Client Authentication"
655 #  define NID_client_auth                 130
656 #  define OBJ_client_auth                 OBJ_id_kp,2L
657
658 #  define SN_code_sign                    "codeSigning"
659 #  define LN_code_sign                    "Code Signing"
660 #  define NID_code_sign                   131
661 #  define OBJ_code_sign                   OBJ_id_kp,3L
662
663 #  define SN_email_protect                "emailProtection"
664 #  define LN_email_protect                "E-mail Protection"
665 #  define NID_email_protect               132
666 #  define OBJ_email_protect               OBJ_id_kp,4L
667
668 #  define SN_time_stamp                   "timeStamping"
669 #  define LN_time_stamp                   "Time Stamping"
670 #  define NID_time_stamp                  133
671 #  define OBJ_time_stamp                  OBJ_id_kp,8L
672
673 /* Additional extended key usage OIDs: Microsoft */
674
675 #  define SN_ms_code_ind                  "msCodeInd"
676 #  define LN_ms_code_ind                  "Microsoft Individual Code Signing"
677 #  define NID_ms_code_ind                 134
678 #  define OBJ_ms_code_ind                 1L,3L,6L,1L,4L,1L,311L,2L,1L,21L
679
680 #  define SN_ms_code_com                  "msCodeCom"
681 #  define LN_ms_code_com                  "Microsoft Commercial Code Signing"
682 #  define NID_ms_code_com                 135
683 #  define OBJ_ms_code_com                 1L,3L,6L,1L,4L,1L,311L,2L,1L,22L
684
685 #  define SN_ms_ctl_sign                  "msCTLSign"
686 #  define LN_ms_ctl_sign                  "Microsoft Trust List Signing"
687 #  define NID_ms_ctl_sign                 136
688 #  define OBJ_ms_ctl_sign                 1L,3L,6L,1L,4L,1L,311L,10L,3L,1L
689
690 #  define SN_ms_sgc                       "msSGC"
691 #  define LN_ms_sgc                       "Microsoft Server Gated Crypto"
692 #  define NID_ms_sgc                      137
693 #  define OBJ_ms_sgc                      1L,3L,6L,1L,4L,1L,311L,10L,3L,3L
694
695 #  define SN_ms_efs                       "msEFS"
696 #  define LN_ms_efs                       "Microsoft Encrypted File System"
697 #  define NID_ms_efs                      138
698 #  define OBJ_ms_efs                      1L,3L,6L,1L,4L,1L,311L,10L,3L,4L
699
700 /* Additional usage: Netscape */
701
702 #  define SN_ns_sgc                       "nsSGC"
703 #  define LN_ns_sgc                       "Netscape Server Gated Crypto"
704 #  define NID_ns_sgc                      139
705 #  define OBJ_ns_sgc                      OBJ_netscape,4L,1L
706
707 #  define SN_delta_crl                    "deltaCRL"
708 #  define LN_delta_crl                    "X509v3 Delta CRL Indicator"
709 #  define NID_delta_crl                   140
710 #  define OBJ_delta_crl                   OBJ_id_ce,27L
711
712 #  define SN_crl_reason                   "CRLReason"
713 #  define LN_crl_reason                   "CRL Reason Code"
714 #  define NID_crl_reason                  141
715 #  define OBJ_crl_reason                  OBJ_id_ce,21L
716
717 #  define SN_invalidity_date              "invalidityDate"
718 #  define LN_invalidity_date              "Invalidity Date"
719 #  define NID_invalidity_date             142
720 #  define OBJ_invalidity_date             OBJ_id_ce,24L
721
722 #  define SN_sxnet                        "SXNetID"
723 #  define LN_sxnet                        "Strong Extranet ID"
724 #  define NID_sxnet                       143
725 #  define OBJ_sxnet                       1L,3L,101L,1L,4L,1L
726
727 /* PKCS12 and related OBJECT IDENTIFIERS */
728
729 #  define OBJ_pkcs12                      OBJ_pkcs,12L
730 #  define OBJ_pkcs12_pbeids               OBJ_pkcs12, 1
731
732 #  define SN_pbe_WithSHA1And128BitRC4     "PBE-SHA1-RC4-128"
733 #  define LN_pbe_WithSHA1And128BitRC4     "pbeWithSHA1And128BitRC4"
734 #  define NID_pbe_WithSHA1And128BitRC4    144
735 #  define OBJ_pbe_WithSHA1And128BitRC4    OBJ_pkcs12_pbeids, 1L
736
737 #  define SN_pbe_WithSHA1And40BitRC4      "PBE-SHA1-RC4-40"
738 #  define LN_pbe_WithSHA1And40BitRC4      "pbeWithSHA1And40BitRC4"
739 #  define NID_pbe_WithSHA1And40BitRC4     145
740 #  define OBJ_pbe_WithSHA1And40BitRC4     OBJ_pkcs12_pbeids, 2L
741
742 #  define SN_pbe_WithSHA1And3_Key_TripleDES_CBC   "PBE-SHA1-3DES"
743 #  define LN_pbe_WithSHA1And3_Key_TripleDES_CBC   "pbeWithSHA1And3-KeyTripleDES-CBC"
744 #  define NID_pbe_WithSHA1And3_Key_TripleDES_CBC  146
745 #  define OBJ_pbe_WithSHA1And3_Key_TripleDES_CBC  OBJ_pkcs12_pbeids, 3L
746
747 #  define SN_pbe_WithSHA1And2_Key_TripleDES_CBC   "PBE-SHA1-2DES"
748 #  define LN_pbe_WithSHA1And2_Key_TripleDES_CBC   "pbeWithSHA1And2-KeyTripleDES-CBC"
749 #  define NID_pbe_WithSHA1And2_Key_TripleDES_CBC  147
750 #  define OBJ_pbe_WithSHA1And2_Key_TripleDES_CBC  OBJ_pkcs12_pbeids, 4L
751
752 #  define SN_pbe_WithSHA1And128BitRC2_CBC         "PBE-SHA1-RC2-128"
753 #  define LN_pbe_WithSHA1And128BitRC2_CBC         "pbeWithSHA1And128BitRC2-CBC"
754 #  define NID_pbe_WithSHA1And128BitRC2_CBC        148
755 #  define OBJ_pbe_WithSHA1And128BitRC2_CBC        OBJ_pkcs12_pbeids, 5L
756
757 #  define SN_pbe_WithSHA1And40BitRC2_CBC  "PBE-SHA1-RC2-40"
758 #  define LN_pbe_WithSHA1And40BitRC2_CBC  "pbeWithSHA1And40BitRC2-CBC"
759 #  define NID_pbe_WithSHA1And40BitRC2_CBC 149
760 #  define OBJ_pbe_WithSHA1And40BitRC2_CBC OBJ_pkcs12_pbeids, 6L
761
762 #  define OBJ_pkcs12_Version1     OBJ_pkcs12, 10L
763
764 #  define OBJ_pkcs12_BagIds       OBJ_pkcs12_Version1, 1L
765
766 #  define LN_keyBag               "keyBag"
767 #  define NID_keyBag              150
768 #  define OBJ_keyBag              OBJ_pkcs12_BagIds, 1L
769
770 #  define LN_pkcs8ShroudedKeyBag  "pkcs8ShroudedKeyBag"
771 #  define NID_pkcs8ShroudedKeyBag 151
772 #  define OBJ_pkcs8ShroudedKeyBag OBJ_pkcs12_BagIds, 2L
773
774 #  define LN_certBag              "certBag"
775 #  define NID_certBag             152
776 #  define OBJ_certBag             OBJ_pkcs12_BagIds, 3L
777
778 #  define LN_crlBag               "crlBag"
779 #  define NID_crlBag              153
780 #  define OBJ_crlBag              OBJ_pkcs12_BagIds, 4L
781
782 #  define LN_secretBag            "secretBag"
783 #  define NID_secretBag           154
784 #  define OBJ_secretBag           OBJ_pkcs12_BagIds, 5L
785
786 #  define LN_safeContentsBag      "safeContentsBag"
787 #  define NID_safeContentsBag     155
788 #  define OBJ_safeContentsBag     OBJ_pkcs12_BagIds, 6L
789
790 #  define LN_friendlyName         "friendlyName"
791 #  define NID_friendlyName        156
792 #  define OBJ_friendlyName        OBJ_pkcs9, 20L
793
794 #  define LN_localKeyID           "localKeyID"
795 #  define NID_localKeyID          157
796 #  define OBJ_localKeyID          OBJ_pkcs9, 21L
797
798 #  define OBJ_certTypes           OBJ_pkcs9, 22L
799
800 #  define LN_x509Certificate      "x509Certificate"
801 #  define NID_x509Certificate     158
802 #  define OBJ_x509Certificate     OBJ_certTypes, 1L
803
804 #  define LN_sdsiCertificate      "sdsiCertificate"
805 #  define NID_sdsiCertificate     159
806 #  define OBJ_sdsiCertificate     OBJ_certTypes, 2L
807
808 #  define OBJ_crlTypes            OBJ_pkcs9, 23L
809
810 #  define LN_x509Crl              "x509Crl"
811 #  define NID_x509Crl             160
812 #  define OBJ_x509Crl             OBJ_crlTypes, 1L
813
814 /* PKCS#5 v2 OIDs */
815
816 #  define LN_pbes2                "PBES2"
817 #  define NID_pbes2               161
818 #  define OBJ_pbes2               OBJ_pkcs,5L,13L
819
820 #  define LN_pbmac1               "PBMAC1"
821 #  define NID_pbmac1              162
822 #  define OBJ_pbmac1              OBJ_pkcs,5L,14L
823
824 #  define LN_hmacWithSHA1         "hmacWithSHA1"
825 #  define NID_hmacWithSHA1        163
826 #  define OBJ_hmacWithSHA1        OBJ_rsadsi,2L,7L
827
828 /* Policy Qualifier Ids */
829
830 #  define LN_id_qt_cps            "Policy Qualifier CPS"
831 #  define SN_id_qt_cps            "id-qt-cps"
832 #  define NID_id_qt_cps           164
833 #  define OBJ_id_qt_cps           OBJ_id_pkix,2L,1L
834
835 #  define LN_id_qt_unotice        "Policy Qualifier User Notice"
836 #  define SN_id_qt_unotice        "id-qt-unotice"
837 #  define NID_id_qt_unotice       165
838 #  define OBJ_id_qt_unotice       OBJ_id_pkix,2L,2L
839
840 #  define SN_rc2_64_cbc                   "RC2-64-CBC"
841 #  define LN_rc2_64_cbc                   "rc2-64-cbc"
842 #  define NID_rc2_64_cbc                  166
843
844 #  define SN_SMIMECapabilities            "SMIME-CAPS"
845 #  define LN_SMIMECapabilities            "S/MIME Capabilities"
846 #  define NID_SMIMECapabilities           167
847 #  define OBJ_SMIMECapabilities           OBJ_pkcs9,15L
848
849 #  define SN_pbeWithMD2AndRC2_CBC         "PBE-MD2-RC2-64"
850 #  define LN_pbeWithMD2AndRC2_CBC         "pbeWithMD2AndRC2-CBC"
851 #  define NID_pbeWithMD2AndRC2_CBC        168
852 #  define OBJ_pbeWithMD2AndRC2_CBC        OBJ_pkcs,5L,4L
853
854 #  define SN_pbeWithMD5AndRC2_CBC         "PBE-MD5-RC2-64"
855 #  define LN_pbeWithMD5AndRC2_CBC         "pbeWithMD5AndRC2-CBC"
856 #  define NID_pbeWithMD5AndRC2_CBC        169
857 #  define OBJ_pbeWithMD5AndRC2_CBC        OBJ_pkcs,5L,6L
858
859 #  define SN_pbeWithSHA1AndDES_CBC        "PBE-SHA1-DES"
860 #  define LN_pbeWithSHA1AndDES_CBC        "pbeWithSHA1AndDES-CBC"
861 #  define NID_pbeWithSHA1AndDES_CBC       170
862 #  define OBJ_pbeWithSHA1AndDES_CBC       OBJ_pkcs,5L,10L
863
864 /* Extension request OIDs */
865
866 #  define LN_ms_ext_req                   "Microsoft Extension Request"
867 #  define SN_ms_ext_req                   "msExtReq"
868 #  define NID_ms_ext_req                  171
869 #  define OBJ_ms_ext_req                  1L,3L,6L,1L,4L,1L,311L,2L,1L,14L
870
871 #  define LN_ext_req                      "Extension Request"
872 #  define SN_ext_req                      "extReq"
873 #  define NID_ext_req                     172
874 #  define OBJ_ext_req                     OBJ_pkcs9,14L
875
876 #  define SN_name                         "name"
877 #  define LN_name                         "name"
878 #  define NID_name                        173
879 #  define OBJ_name                        OBJ_X509,41L
880
881 #  define SN_dnQualifier                  "dnQualifier"
882 #  define LN_dnQualifier                  "dnQualifier"
883 #  define NID_dnQualifier                 174
884 #  define OBJ_dnQualifier                 OBJ_X509,46L
885
886 #  define SN_id_pe                        "id-pe"
887 #  define NID_id_pe                       175
888 #  define OBJ_id_pe                       OBJ_id_pkix,1L
889
890 #  define SN_id_ad                        "id-ad"
891 #  define NID_id_ad                       176
892 #  define OBJ_id_ad                       OBJ_id_pkix,48L
893
894 #  define SN_info_access                  "authorityInfoAccess"
895 #  define LN_info_access                  "Authority Information Access"
896 #  define NID_info_access                 177
897 #  define OBJ_info_access                 OBJ_id_pe,1L
898
899 #  define SN_ad_OCSP                      "OCSP"
900 #  define LN_ad_OCSP                      "OCSP"
901 #  define NID_ad_OCSP                     178
902 #  define OBJ_ad_OCSP                     OBJ_id_ad,1L
903
904 #  define SN_ad_ca_issuers                "caIssuers"
905 #  define LN_ad_ca_issuers                "CA Issuers"
906 #  define NID_ad_ca_issuers               179
907 #  define OBJ_ad_ca_issuers               OBJ_id_ad,2L
908
909 #  define SN_OCSP_sign                    "OCSPSigning"
910 #  define LN_OCSP_sign                    "OCSP Signing"
911 #  define NID_OCSP_sign                   180
912 #  define OBJ_OCSP_sign                   OBJ_id_kp,9L
913 # endif                         /* USE_OBJ_MAC */
914
915 # include <openssl/bio.h>
916 # include <openssl/asn1.h>
917
918 # define OBJ_NAME_TYPE_UNDEF             0x00
919 # define OBJ_NAME_TYPE_MD_METH           0x01
920 # define OBJ_NAME_TYPE_CIPHER_METH       0x02
921 # define OBJ_NAME_TYPE_PKEY_METH         0x03
922 # define OBJ_NAME_TYPE_COMP_METH         0x04
923 # define OBJ_NAME_TYPE_NUM               0x05
924
925 # define OBJ_NAME_ALIAS                  0x8000
926
927 # define OBJ_BSEARCH_VALUE_ON_NOMATCH            0x01
928 # define OBJ_BSEARCH_FIRST_VALUE_ON_MATCH        0x02
929
930
931 #ifdef  __cplusplus
932 extern "C" {
933 #endif
934
935 typedef struct obj_name_st {
936     int type;
937     int alias;
938     const char *name;
939     const char *data;
940 } OBJ_NAME;
941
942 # define         OBJ_create_and_add_object(a,b,c) OBJ_create(a,b,c)
943
944 int OBJ_NAME_init(void);
945 int OBJ_NAME_new_index(unsigned long (*hash_func) (const char *),
946                        int (*cmp_func) (const char *, const char *),
947                        void (*free_func) (const char *, int, const char *));
948 const char *OBJ_NAME_get(const char *name, int type);
949 int OBJ_NAME_add(const char *name, int type, const char *data);
950 int OBJ_NAME_remove(const char *name, int type);
951 void OBJ_NAME_cleanup(int type); /* -1 for everything */
952 void OBJ_NAME_do_all(int type, void (*fn) (const OBJ_NAME *, void *arg),
953                      void *arg);
954 void OBJ_NAME_do_all_sorted(int type,
955                             void (*fn) (const OBJ_NAME *, void *arg),
956                             void *arg);
957
958 ASN1_OBJECT *OBJ_dup(const ASN1_OBJECT *o);
959 ASN1_OBJECT *OBJ_nid2obj(int n);
960 const char *OBJ_nid2ln(int n);
961 const char *OBJ_nid2sn(int n);
962 int OBJ_obj2nid(const ASN1_OBJECT *o);
963 ASN1_OBJECT *OBJ_txt2obj(const char *s, int no_name);
964 int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name);
965 int OBJ_txt2nid(const char *s);
966 int OBJ_ln2nid(const char *s);
967 int OBJ_sn2nid(const char *s);
968 int OBJ_cmp(const ASN1_OBJECT *a, const ASN1_OBJECT *b);
969 const void *OBJ_bsearch_(const void *key, const void *base, int num, int size,
970                          int (*cmp) (const void *, const void *));
971 const void *OBJ_bsearch_ex_(const void *key, const void *base, int num,
972                             int size,
973                             int (*cmp) (const void *, const void *),
974                             int flags);
975
976 # define _DECLARE_OBJ_BSEARCH_CMP_FN(scope, type1, type2, nm)    \
977   static int nm##_cmp_BSEARCH_CMP_FN(const void *, const void *); \
978   static int nm##_cmp(type1 const *, type2 const *); \
979   scope type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num)
980
981 # define DECLARE_OBJ_BSEARCH_CMP_FN(type1, type2, cmp)   \
982   _DECLARE_OBJ_BSEARCH_CMP_FN(static, type1, type2, cmp)
983 # define DECLARE_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm)     \
984   type2 * OBJ_bsearch_##nm(type1 *key, type2 const *base, int num)
985
986 /*-
987  * Unsolved problem: if a type is actually a pointer type, like
988  * nid_triple is, then its impossible to get a const where you need
989  * it. Consider:
990  *
991  * typedef int nid_triple[3];
992  * const void *a_;
993  * const nid_triple const *a = a_;
994  *
995  * The assignement discards a const because what you really want is:
996  *
997  * const int const * const *a = a_;
998  *
999  * But if you do that, you lose the fact that a is an array of 3 ints,
1000  * which breaks comparison functions.
1001  *
1002  * Thus we end up having to cast, sadly, or unpack the
1003  * declarations. Or, as I finally did in this case, delcare nid_triple
1004  * to be a struct, which it should have been in the first place.
1005  *
1006  * Ben, August 2008.
1007  *
1008  * Also, strictly speaking not all types need be const, but handling
1009  * the non-constness means a lot of complication, and in practice
1010  * comparison routines do always not touch their arguments.
1011  */
1012
1013 # define IMPLEMENT_OBJ_BSEARCH_CMP_FN(type1, type2, nm)  \
1014   static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)    \
1015       { \
1016       type1 const *a = a_; \
1017       type2 const *b = b_; \
1018       return nm##_cmp(a,b); \
1019       } \
1020   static type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \
1021       { \
1022       return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
1023                                         nm##_cmp_BSEARCH_CMP_FN); \
1024       } \
1025       extern void dummy_prototype(void)
1026
1027 # define IMPLEMENT_OBJ_BSEARCH_GLOBAL_CMP_FN(type1, type2, nm)   \
1028   static int nm##_cmp_BSEARCH_CMP_FN(const void *a_, const void *b_)    \
1029       { \
1030       type1 const *a = a_; \
1031       type2 const *b = b_; \
1032       return nm##_cmp(a,b); \
1033       } \
1034   type2 *OBJ_bsearch_##nm(type1 *key, type2 const *base, int num) \
1035       { \
1036       return (type2 *)OBJ_bsearch_(key, base, num, sizeof(type2), \
1037                                         nm##_cmp_BSEARCH_CMP_FN); \
1038       } \
1039       extern void dummy_prototype(void)
1040
1041 # define OBJ_bsearch(type1,key,type2,base,num,cmp)                              \
1042   ((type2 *)OBJ_bsearch_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \
1043                          num,sizeof(type2),                             \
1044                          ((void)CHECKED_PTR_OF(type1,cmp##_type_1),     \
1045                           (void)CHECKED_PTR_OF(type2,cmp##_type_2),     \
1046                           cmp##_BSEARCH_CMP_FN)))
1047
1048 # define OBJ_bsearch_ex(type1,key,type2,base,num,cmp,flags)                      \
1049   ((type2 *)OBJ_bsearch_ex_(CHECKED_PTR_OF(type1,key),CHECKED_PTR_OF(type2,base), \
1050                          num,sizeof(type2),                             \
1051                          ((void)CHECKED_PTR_OF(type1,cmp##_type_1),     \
1052                           (void)type_2=CHECKED_PTR_OF(type2,cmp##_type_2), \
1053                           cmp##_BSEARCH_CMP_FN)),flags)
1054
1055 int OBJ_new_nid(int num);
1056 int OBJ_add_object(const ASN1_OBJECT *obj);
1057 int OBJ_create(const char *oid, const char *sn, const char *ln);
1058 #if OPENSSL_API_COMPAT < 0x10100000L
1059 # define OBJ_cleanup() while(0) continue
1060 #endif
1061 int OBJ_create_objects(BIO *in);
1062
1063 size_t OBJ_length(const ASN1_OBJECT *obj);
1064 const unsigned char *OBJ_get0_data(const ASN1_OBJECT *obj);
1065
1066 int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid);
1067 int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid);
1068 int OBJ_add_sigid(int signid, int dig_id, int pkey_id);
1069 void OBJ_sigid_free(void);
1070
1071 /* BEGIN ERROR CODES */
1072 /*
1073  * The following lines are auto generated by the script mkerr.pl. Any changes
1074  * made after this point may be overwritten when the script is next run.
1075  */
1076
1077 int ERR_load_OBJ_strings(void);
1078
1079 /* Error codes for the OBJ functions. */
1080
1081 /* Function codes. */
1082 # define OBJ_F_OBJ_ADD_OBJECT                             105
1083 # define OBJ_F_OBJ_CREATE                                 100
1084 # define OBJ_F_OBJ_DUP                                    101
1085 # define OBJ_F_OBJ_NAME_NEW_INDEX                         106
1086 # define OBJ_F_OBJ_NID2LN                                 102
1087 # define OBJ_F_OBJ_NID2OBJ                                103
1088 # define OBJ_F_OBJ_NID2SN                                 104
1089
1090 /* Reason codes. */
1091 # define OBJ_R_OID_EXISTS                                 102
1092 # define OBJ_R_UNKNOWN_NID                                101
1093
1094 # ifdef  __cplusplus
1095 }
1096 # endif
1097 #endif