objects.h 44 KB

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