ENGINE_add.3ossl 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816
  1. .\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42)
  2. .\"
  3. .\" Standard preamble:
  4. .\" ========================================================================
  5. .de Sp \" Vertical space (when we can't use .PP)
  6. .if t .sp .5v
  7. .if n .sp
  8. ..
  9. .de Vb \" Begin verbatim text
  10. .ft CW
  11. .nf
  12. .ne \\$1
  13. ..
  14. .de Ve \" End verbatim text
  15. .ft R
  16. .fi
  17. ..
  18. .\" Set up some character translations and predefined strings. \*(-- will
  19. .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
  20. .\" double quote, and \*(R" will give a right double quote. \*(C+ will
  21. .\" give a nicer C++. Capital omega is used to do unbreakable dashes and
  22. .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
  23. .\" nothing in troff, for use with C<>.
  24. .tr \(*W-
  25. .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
  26. .ie n \{\
  27. . ds -- \(*W-
  28. . ds PI pi
  29. . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
  30. . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
  31. . ds L" ""
  32. . ds R" ""
  33. . ds C` ""
  34. . ds C' ""
  35. 'br\}
  36. .el\{\
  37. . ds -- \|\(em\|
  38. . ds PI \(*p
  39. . ds L" ``
  40. . ds R" ''
  41. . ds C`
  42. . ds C'
  43. 'br\}
  44. .\"
  45. .\" Escape single quotes in literal strings from groff's Unicode transform.
  46. .ie \n(.g .ds Aq \(aq
  47. .el .ds Aq '
  48. .\"
  49. .\" If the F register is >0, we'll generate index entries on stderr for
  50. .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
  51. .\" entries marked with X<> in POD. Of course, you'll have to process the
  52. .\" output yourself in some meaningful fashion.
  53. .\"
  54. .\" Avoid warning from groff about undefined register 'F'.
  55. .de IX
  56. ..
  57. .nr rF 0
  58. .if \n(.g .if rF .nr rF 1
  59. .if (\n(rF:(\n(.g==0)) \{\
  60. . if \nF \{\
  61. . de IX
  62. . tm Index:\\$1\t\\n%\t"\\$2"
  63. ..
  64. . if !\nF==2 \{\
  65. . nr % 0
  66. . nr F 2
  67. . \}
  68. . \}
  69. .\}
  70. .rr rF
  71. .\"
  72. .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
  73. .\" Fear. Run. Save yourself. No user-serviceable parts.
  74. . \" fudge factors for nroff and troff
  75. .if n \{\
  76. . ds #H 0
  77. . ds #V .8m
  78. . ds #F .3m
  79. . ds #[ \f1
  80. . ds #] \fP
  81. .\}
  82. .if t \{\
  83. . ds #H ((1u-(\\\\n(.fu%2u))*.13m)
  84. . ds #V .6m
  85. . ds #F 0
  86. . ds #[ \&
  87. . ds #] \&
  88. .\}
  89. . \" simple accents for nroff and troff
  90. .if n \{\
  91. . ds ' \&
  92. . ds ` \&
  93. . ds ^ \&
  94. . ds , \&
  95. . ds ~ ~
  96. . ds /
  97. .\}
  98. .if t \{\
  99. . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
  100. . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
  101. . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
  102. . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
  103. . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
  104. . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
  105. .\}
  106. . \" troff and (daisy-wheel) nroff accents
  107. .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
  108. .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
  109. .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
  110. .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
  111. .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
  112. .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
  113. .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
  114. .ds ae a\h'-(\w'a'u*4/10)'e
  115. .ds Ae A\h'-(\w'A'u*4/10)'E
  116. . \" corrections for vroff
  117. .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
  118. .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
  119. . \" for low resolution devices (crt and lpr)
  120. .if \n(.H>23 .if \n(.V>19 \
  121. \{\
  122. . ds : e
  123. . ds 8 ss
  124. . ds o a
  125. . ds d- d\h'-1'\(ga
  126. . ds D- D\h'-1'\(hy
  127. . ds th \o'bp'
  128. . ds Th \o'LP'
  129. . ds ae ae
  130. . ds Ae AE
  131. .\}
  132. .rm #[ #] #H #V #F C
  133. .\" ========================================================================
  134. .\"
  135. .IX Title "ENGINE_ADD 3ossl"
  136. .TH ENGINE_ADD 3ossl "2024-09-03" "3.3.2" "OpenSSL"
  137. .\" For nroff, turn off justification. Always turn off hyphenation; it makes
  138. .\" way too many mistakes in technical documents.
  139. .if n .ad l
  140. .nh
  141. .SH "NAME"
  142. ENGINE_get_DH, ENGINE_get_DSA,
  143. ENGINE_by_id, ENGINE_get_cipher_engine, ENGINE_get_default_DH,
  144. ENGINE_get_default_DSA,
  145. ENGINE_get_default_RAND,
  146. ENGINE_get_default_RSA, ENGINE_get_digest_engine, ENGINE_get_first,
  147. ENGINE_get_last, ENGINE_get_next, ENGINE_get_prev, ENGINE_new,
  148. ENGINE_get_ciphers, ENGINE_get_ctrl_function, ENGINE_get_digests,
  149. ENGINE_get_destroy_function, ENGINE_get_finish_function,
  150. ENGINE_get_init_function, ENGINE_get_load_privkey_function,
  151. ENGINE_get_load_pubkey_function, ENGINE_load_private_key,
  152. ENGINE_load_public_key, ENGINE_get_RAND, ENGINE_get_RSA, ENGINE_get_id,
  153. ENGINE_get_name, ENGINE_get_cmd_defns, ENGINE_get_cipher,
  154. ENGINE_get_digest, ENGINE_add, ENGINE_cmd_is_executable,
  155. ENGINE_ctrl, ENGINE_ctrl_cmd, ENGINE_ctrl_cmd_string,
  156. ENGINE_finish, ENGINE_free, ENGINE_get_flags, ENGINE_init,
  157. ENGINE_register_DH, ENGINE_register_DSA,
  158. ENGINE_register_RAND, ENGINE_register_RSA,
  159. ENGINE_register_all_complete, ENGINE_register_ciphers,
  160. ENGINE_register_complete, ENGINE_register_digests, ENGINE_remove,
  161. ENGINE_set_DH, ENGINE_set_DSA,
  162. ENGINE_set_RAND, ENGINE_set_RSA, ENGINE_set_ciphers,
  163. ENGINE_set_cmd_defns, ENGINE_set_ctrl_function, ENGINE_set_default,
  164. ENGINE_set_default_DH, ENGINE_set_default_DSA,
  165. ENGINE_set_default_RAND, ENGINE_set_default_RSA,
  166. ENGINE_set_default_ciphers, ENGINE_set_default_digests,
  167. ENGINE_set_default_string, ENGINE_set_destroy_function,
  168. ENGINE_set_digests, ENGINE_set_finish_function, ENGINE_set_flags,
  169. ENGINE_set_id, ENGINE_set_init_function, ENGINE_set_load_privkey_function,
  170. ENGINE_set_load_pubkey_function, ENGINE_set_name, ENGINE_up_ref,
  171. ENGINE_get_table_flags, ENGINE_cleanup,
  172. ENGINE_load_builtin_engines, ENGINE_register_all_DH,
  173. ENGINE_register_all_DSA,
  174. ENGINE_register_all_RAND,
  175. ENGINE_register_all_RSA, ENGINE_register_all_ciphers,
  176. ENGINE_register_all_digests, ENGINE_set_table_flags, ENGINE_unregister_DH,
  177. ENGINE_unregister_DSA,
  178. ENGINE_unregister_RAND, ENGINE_unregister_RSA, ENGINE_unregister_ciphers,
  179. ENGINE_unregister_digests
  180. \&\- ENGINE cryptographic module support
  181. .SH "SYNOPSIS"
  182. .IX Header "SYNOPSIS"
  183. .Vb 1
  184. \& #include <openssl/engine.h>
  185. .Ve
  186. .PP
  187. The following functions have been deprecated since OpenSSL 3.0, and can be
  188. hidden entirely by defining \fB\s-1OPENSSL_API_COMPAT\s0\fR with a suitable version value,
  189. see \fBopenssl_user_macros\fR\|(7):
  190. .PP
  191. .Vb 4
  192. \& ENGINE *ENGINE_get_first(void);
  193. \& ENGINE *ENGINE_get_last(void);
  194. \& ENGINE *ENGINE_get_next(ENGINE *e);
  195. \& ENGINE *ENGINE_get_prev(ENGINE *e);
  196. \&
  197. \& int ENGINE_add(ENGINE *e);
  198. \& int ENGINE_remove(ENGINE *e);
  199. \&
  200. \& ENGINE *ENGINE_by_id(const char *id);
  201. \&
  202. \& int ENGINE_init(ENGINE *e);
  203. \& int ENGINE_finish(ENGINE *e);
  204. \&
  205. \& void ENGINE_load_builtin_engines(void);
  206. \&
  207. \& ENGINE *ENGINE_get_default_RSA(void);
  208. \& ENGINE *ENGINE_get_default_DSA(void);
  209. \& ENGINE *ENGINE_get_default_DH(void);
  210. \& ENGINE *ENGINE_get_default_RAND(void);
  211. \& ENGINE *ENGINE_get_cipher_engine(int nid);
  212. \& ENGINE *ENGINE_get_digest_engine(int nid);
  213. \&
  214. \& int ENGINE_set_default_RSA(ENGINE *e);
  215. \& int ENGINE_set_default_DSA(ENGINE *e);
  216. \& int ENGINE_set_default_DH(ENGINE *e);
  217. \& int ENGINE_set_default_RAND(ENGINE *e);
  218. \& int ENGINE_set_default_ciphers(ENGINE *e);
  219. \& int ENGINE_set_default_digests(ENGINE *e);
  220. \& int ENGINE_set_default_string(ENGINE *e, const char *list);
  221. \&
  222. \& int ENGINE_set_default(ENGINE *e, unsigned int flags);
  223. \&
  224. \& unsigned int ENGINE_get_table_flags(void);
  225. \& void ENGINE_set_table_flags(unsigned int flags);
  226. \&
  227. \& int ENGINE_register_RSA(ENGINE *e);
  228. \& void ENGINE_unregister_RSA(ENGINE *e);
  229. \& void ENGINE_register_all_RSA(void);
  230. \& int ENGINE_register_DSA(ENGINE *e);
  231. \& void ENGINE_unregister_DSA(ENGINE *e);
  232. \& void ENGINE_register_all_DSA(void);
  233. \& int ENGINE_register_DH(ENGINE *e);
  234. \& void ENGINE_unregister_DH(ENGINE *e);
  235. \& void ENGINE_register_all_DH(void);
  236. \& int ENGINE_register_RAND(ENGINE *e);
  237. \& void ENGINE_unregister_RAND(ENGINE *e);
  238. \& void ENGINE_register_all_RAND(void);
  239. \& int ENGINE_register_ciphers(ENGINE *e);
  240. \& void ENGINE_unregister_ciphers(ENGINE *e);
  241. \& void ENGINE_register_all_ciphers(void);
  242. \& int ENGINE_register_digests(ENGINE *e);
  243. \& void ENGINE_unregister_digests(ENGINE *e);
  244. \& void ENGINE_register_all_digests(void);
  245. \& int ENGINE_register_complete(ENGINE *e);
  246. \& int ENGINE_register_all_complete(void);
  247. \&
  248. \& int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void));
  249. \& int ENGINE_cmd_is_executable(ENGINE *e, int cmd);
  250. \& int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,
  251. \& long i, void *p, void (*f)(void), int cmd_optional);
  252. \& int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
  253. \& int cmd_optional);
  254. \&
  255. \& ENGINE *ENGINE_new(void);
  256. \& int ENGINE_free(ENGINE *e);
  257. \& int ENGINE_up_ref(ENGINE *e);
  258. \&
  259. \& int ENGINE_set_id(ENGINE *e, const char *id);
  260. \& int ENGINE_set_name(ENGINE *e, const char *name);
  261. \& int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);
  262. \& int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);
  263. \& int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);
  264. \& int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);
  265. \& int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f);
  266. \& int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f);
  267. \& int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f);
  268. \& int ENGINE_set_ctrl_function(ENGINE *e, ENGINE_CTRL_FUNC_PTR ctrl_f);
  269. \& int ENGINE_set_load_privkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpriv_f);
  270. \& int ENGINE_set_load_pubkey_function(ENGINE *e, ENGINE_LOAD_KEY_PTR loadpub_f);
  271. \& int ENGINE_set_ciphers(ENGINE *e, ENGINE_CIPHERS_PTR f);
  272. \& int ENGINE_set_digests(ENGINE *e, ENGINE_DIGESTS_PTR f);
  273. \& int ENGINE_set_flags(ENGINE *e, int flags);
  274. \& int ENGINE_set_cmd_defns(ENGINE *e, const ENGINE_CMD_DEFN *defns);
  275. \&
  276. \& const char *ENGINE_get_id(const ENGINE *e);
  277. \& const char *ENGINE_get_name(const ENGINE *e);
  278. \& const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);
  279. \& const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);
  280. \& const DH_METHOD *ENGINE_get_DH(const ENGINE *e);
  281. \& const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);
  282. \& ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e);
  283. \& ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);
  284. \& ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e);
  285. \& ENGINE_CTRL_FUNC_PTR ENGINE_get_ctrl_function(const ENGINE *e);
  286. \& ENGINE_LOAD_KEY_PTR ENGINE_get_load_privkey_function(const ENGINE *e);
  287. \& ENGINE_LOAD_KEY_PTR ENGINE_get_load_pubkey_function(const ENGINE *e);
  288. \& ENGINE_CIPHERS_PTR ENGINE_get_ciphers(const ENGINE *e);
  289. \& ENGINE_DIGESTS_PTR ENGINE_get_digests(const ENGINE *e);
  290. \& const EVP_CIPHER *ENGINE_get_cipher(ENGINE *e, int nid);
  291. \& const EVP_MD *ENGINE_get_digest(ENGINE *e, int nid);
  292. \& int ENGINE_get_flags(const ENGINE *e);
  293. \& const ENGINE_CMD_DEFN *ENGINE_get_cmd_defns(const ENGINE *e);
  294. \&
  295. \& EVP_PKEY *ENGINE_load_private_key(ENGINE *e, const char *key_id,
  296. \& UI_METHOD *ui_method, void *callback_data);
  297. \& EVP_PKEY *ENGINE_load_public_key(ENGINE *e, const char *key_id,
  298. \& UI_METHOD *ui_method, void *callback_data);
  299. .Ve
  300. .PP
  301. The following function has been deprecated since OpenSSL 1.1.0, and can be
  302. hidden entirely by defining \fB\s-1OPENSSL_API_COMPAT\s0\fR with a suitable version value,
  303. see \fBopenssl_user_macros\fR\|(7):
  304. .PP
  305. .Vb 1
  306. \& void ENGINE_cleanup(void);
  307. .Ve
  308. .SH "DESCRIPTION"
  309. .IX Header "DESCRIPTION"
  310. All of the functions described on this page are deprecated.
  311. Applications should instead use the provider APIs.
  312. .PP
  313. These functions create, manipulate, and use cryptographic modules in the
  314. form of \fB\s-1ENGINE\s0\fR objects. These objects act as containers for
  315. implementations of cryptographic algorithms, and support a
  316. reference-counted mechanism to allow them to be dynamically loaded in and
  317. out of the running application.
  318. .PP
  319. The cryptographic functionality that can be provided by an \fB\s-1ENGINE\s0\fR
  320. implementation includes the following abstractions;
  321. .PP
  322. .Vb 6
  323. \& RSA_METHOD \- for providing alternative RSA implementations
  324. \& DSA_METHOD, DH_METHOD, RAND_METHOD, ECDH_METHOD, ECDSA_METHOD,
  325. \& \- similarly for other OpenSSL APIs
  326. \& EVP_CIPHER \- potentially multiple cipher algorithms (indexed by \*(Aqnid\*(Aq)
  327. \& EVP_DIGEST \- potentially multiple hash algorithms (indexed by \*(Aqnid\*(Aq)
  328. \& key\-loading \- loading public and/or private EVP_PKEY keys
  329. .Ve
  330. .SS "Reference counting and handles"
  331. .IX Subsection "Reference counting and handles"
  332. Due to the modular nature of the \s-1ENGINE API,\s0 pointers to ENGINEs need to be
  333. treated as handles \- i.e. not only as pointers, but also as references to
  334. the underlying \s-1ENGINE\s0 object. Ie. one should obtain a new reference when
  335. making copies of an \s-1ENGINE\s0 pointer if the copies will be used (and
  336. released) independently.
  337. .PP
  338. \&\s-1ENGINE\s0 objects have two levels of reference-counting to match the way in
  339. which the objects are used. At the most basic level, each \s-1ENGINE\s0 pointer is
  340. inherently a \fBstructural\fR reference \- a structural reference is required
  341. to use the pointer value at all, as this kind of reference is a guarantee
  342. that the structure can not be deallocated until the reference is released.
  343. .PP
  344. However, a structural reference provides no guarantee that the \s-1ENGINE\s0 is
  345. initialised and able to use any of its cryptographic
  346. implementations. Indeed it's quite possible that most ENGINEs will not
  347. initialise at all in typical environments, as ENGINEs are typically used to
  348. support specialised hardware. To use an \s-1ENGINE\s0's functionality, you need a
  349. \&\fBfunctional\fR reference. This kind of reference can be considered a
  350. specialised form of structural reference, because each functional reference
  351. implicitly contains a structural reference as well \- however to avoid
  352. difficult-to-find programming bugs, it is recommended to treat the two
  353. kinds of reference independently. If you have a functional reference to an
  354. \&\s-1ENGINE,\s0 you have a guarantee that the \s-1ENGINE\s0 has been initialised and
  355. is ready to perform cryptographic operations, and will remain initialised
  356. until after you have released your reference.
  357. .PP
  358. \&\fIStructural references\fR
  359. .PP
  360. This basic type of reference is used for instantiating new ENGINEs,
  361. iterating across OpenSSL's internal linked-list of loaded
  362. ENGINEs, reading information about an \s-1ENGINE,\s0 etc. Essentially a structural
  363. reference is sufficient if you only need to query or manipulate the data of
  364. an \s-1ENGINE\s0 implementation rather than use its functionality.
  365. .PP
  366. The \fBENGINE_new()\fR function returns a structural reference to a new (empty)
  367. \&\s-1ENGINE\s0 object. There are other \s-1ENGINE API\s0 functions that return structural
  368. references such as; \fBENGINE_by_id()\fR, \fBENGINE_get_first()\fR, \fBENGINE_get_last()\fR,
  369. \&\fBENGINE_get_next()\fR, \fBENGINE_get_prev()\fR. All structural references should be
  370. released by a corresponding to call to the \fBENGINE_free()\fR function \- the
  371. \&\s-1ENGINE\s0 object itself will only actually be cleaned up and deallocated when
  372. the last structural reference is released. If the argument to \fBENGINE_free()\fR
  373. is \s-1NULL,\s0 nothing is done.
  374. .PP
  375. It should also be noted that many \s-1ENGINE API\s0 function calls that accept a
  376. structural reference will internally obtain another reference \- typically
  377. this happens whenever the supplied \s-1ENGINE\s0 will be needed by OpenSSL after
  378. the function has returned. Eg. the function to add a new \s-1ENGINE\s0 to
  379. OpenSSL's internal list is \fBENGINE_add()\fR \- if this function returns success,
  380. then OpenSSL will have stored a new structural reference internally so the
  381. caller is still responsible for freeing their own reference with
  382. \&\fBENGINE_free()\fR when they are finished with it. In a similar way, some
  383. functions will automatically release the structural reference passed to it
  384. if part of the function's job is to do so. Eg. the \fBENGINE_get_next()\fR and
  385. \&\fBENGINE_get_prev()\fR functions are used for iterating across the internal
  386. \&\s-1ENGINE\s0 list \- they will return a new structural reference to the next (or
  387. previous) \s-1ENGINE\s0 in the list or \s-1NULL\s0 if at the end (or beginning) of the
  388. list, but in either case the structural reference passed to the function is
  389. released on behalf of the caller.
  390. .PP
  391. To clarify a particular function's handling of references, one should
  392. always consult that function's documentation \*(L"man\*(R" page, or failing that
  393. the \fI<openssl/engine.h>\fR header file includes some hints.
  394. .PP
  395. \&\fIFunctional references\fR
  396. .PP
  397. As mentioned, functional references exist when the cryptographic
  398. functionality of an \s-1ENGINE\s0 is required to be available. A functional
  399. reference can be obtained in one of two ways; from an existing structural
  400. reference to the required \s-1ENGINE,\s0 or by asking OpenSSL for the default
  401. operational \s-1ENGINE\s0 for a given cryptographic purpose.
  402. .PP
  403. To obtain a functional reference from an existing structural reference,
  404. call the \fBENGINE_init()\fR function. This returns zero if the \s-1ENGINE\s0 was not
  405. already operational and couldn't be successfully initialised (e.g. lack of
  406. system drivers, no special hardware attached, etc), otherwise it will
  407. return nonzero to indicate that the \s-1ENGINE\s0 is now operational and will
  408. have allocated a new \fBfunctional\fR reference to the \s-1ENGINE.\s0 All functional
  409. references are released by calling \fBENGINE_finish()\fR (which removes the
  410. implicit structural reference as well).
  411. .PP
  412. The second way to get a functional reference is by asking OpenSSL for a
  413. default implementation for a given task, e.g. by \fBENGINE_get_default_RSA()\fR,
  414. \&\fBENGINE_get_default_cipher_engine()\fR, etc. These are discussed in the next
  415. section, though they are not usually required by application programmers as
  416. they are used automatically when creating and using the relevant
  417. algorithm-specific types in OpenSSL, such as \s-1RSA, DSA, EVP_CIPHER_CTX,\s0 etc.
  418. .SS "Default implementations"
  419. .IX Subsection "Default implementations"
  420. For each supported abstraction, the \s-1ENGINE\s0 code maintains an internal table
  421. of state to control which implementations are available for a given
  422. abstraction and which should be used by default. These implementations are
  423. registered in the tables and indexed by an 'nid' value, because
  424. abstractions like \s-1EVP_CIPHER\s0 and \s-1EVP_DIGEST\s0 support many distinct
  425. algorithms and modes, and ENGINEs can support arbitrarily many of them.
  426. In the case of other abstractions like \s-1RSA, DSA,\s0 etc, there is only one
  427. \&\*(L"algorithm\*(R" so all implementations implicitly register using the same 'nid'
  428. index.
  429. .PP
  430. When a default \s-1ENGINE\s0 is requested for a given abstraction/algorithm/mode, (e.g.
  431. when calling RSA_new_method(\s-1NULL\s0)), a \*(L"get_default\*(R" call will be made to the
  432. \&\s-1ENGINE\s0 subsystem to process the corresponding state table and return a
  433. functional reference to an initialised \s-1ENGINE\s0 whose implementation should be
  434. used. If no \s-1ENGINE\s0 should (or can) be used, it will return \s-1NULL\s0 and the caller
  435. will operate with a \s-1NULL ENGINE\s0 handle \- this usually equates to using the
  436. conventional software implementation. In the latter case, OpenSSL will from
  437. then on behave the way it used to before the \s-1ENGINE API\s0 existed.
  438. .PP
  439. Each state table has a flag to note whether it has processed this
  440. \&\*(L"get_default\*(R" query since the table was last modified, because to process
  441. this question it must iterate across all the registered ENGINEs in the
  442. table trying to initialise each of them in turn, in case one of them is
  443. operational. If it returns a functional reference to an \s-1ENGINE,\s0 it will
  444. also cache another reference to speed up processing future queries (without
  445. needing to iterate across the table). Likewise, it will cache a \s-1NULL\s0
  446. response if no \s-1ENGINE\s0 was available so that future queries won't repeat the
  447. same iteration unless the state table changes. This behaviour can also be
  448. changed; if the \s-1ENGINE_TABLE_FLAG_NOINIT\s0 flag is set (using
  449. \&\fBENGINE_set_table_flags()\fR), no attempted initialisations will take place,
  450. instead the only way for the state table to return a non-NULL \s-1ENGINE\s0 to the
  451. \&\*(L"get_default\*(R" query will be if one is expressly set in the table. Eg.
  452. \&\fBENGINE_set_default_RSA()\fR does the same job as \fBENGINE_register_RSA()\fR except
  453. that it also sets the state table's cached response for the \*(L"get_default\*(R"
  454. query. In the case of abstractions like \s-1EVP_CIPHER,\s0 where implementations are
  455. indexed by 'nid', these flags and cached-responses are distinct for each 'nid'
  456. value.
  457. .SS "Application requirements"
  458. .IX Subsection "Application requirements"
  459. This section will explain the basic things an application programmer should
  460. support to make the most useful elements of the \s-1ENGINE\s0 functionality
  461. available to the user. The first thing to consider is whether the
  462. programmer wishes to make alternative \s-1ENGINE\s0 modules available to the
  463. application and user. OpenSSL maintains an internal linked list of
  464. \&\*(L"visible\*(R" ENGINEs from which it has to operate \- at start-up, this list is
  465. empty and in fact if an application does not call any \s-1ENGINE API\s0 calls and
  466. it uses static linking against openssl, then the resulting application
  467. binary will not contain any alternative \s-1ENGINE\s0 code at all. So the first
  468. consideration is whether any/all available \s-1ENGINE\s0 implementations should be
  469. made visible to OpenSSL \- this is controlled by calling the various \*(L"load\*(R"
  470. functions.
  471. .PP
  472. The fact that ENGINEs are made visible to OpenSSL (and thus are linked into
  473. the program and loaded into memory at run-time) does not mean they are
  474. \&\*(L"registered\*(R" or called into use by OpenSSL automatically \- that behaviour
  475. is something for the application to control. Some applications
  476. will want to allow the user to specify exactly which \s-1ENGINE\s0 they want used
  477. if any is to be used at all. Others may prefer to load all support and have
  478. OpenSSL automatically use at run-time any \s-1ENGINE\s0 that is able to
  479. successfully initialise \- i.e. to assume that this corresponds to
  480. acceleration hardware attached to the machine or some such thing. There are
  481. probably numerous other ways in which applications may prefer to handle
  482. things, so we will simply illustrate the consequences as they apply to a
  483. couple of simple cases and leave developers to consider these and the
  484. source code to openssl's built-in utilities as guides.
  485. .PP
  486. If no \s-1ENGINE API\s0 functions are called within an application, then OpenSSL
  487. will not allocate any internal resources. Prior to OpenSSL 1.1.0, however,
  488. if any ENGINEs are loaded, even if not registered or used, it was necessary to
  489. call \fBENGINE_cleanup()\fR before the program exits.
  490. .PP
  491. \&\fIUsing a specific \s-1ENGINE\s0 implementation\fR
  492. .PP
  493. Here we'll assume an application has been configured by its user or admin
  494. to want to use the \*(L"\s-1ACME\*(R" ENGINE\s0 if it is available in the version of
  495. OpenSSL the application was compiled with. If it is available, it should be
  496. used by default for all \s-1RSA, DSA,\s0 and symmetric cipher operations, otherwise
  497. OpenSSL should use its built-in software as per usual. The following code
  498. illustrates how to approach this;
  499. .PP
  500. .Vb 10
  501. \& ENGINE *e;
  502. \& const char *engine_id = "ACME";
  503. \& ENGINE_load_builtin_engines();
  504. \& e = ENGINE_by_id(engine_id);
  505. \& if (!e)
  506. \& /* the engine isn\*(Aqt available */
  507. \& return;
  508. \& if (!ENGINE_init(e)) {
  509. \& /* the engine couldn\*(Aqt initialise, release \*(Aqe\*(Aq */
  510. \& ENGINE_free(e);
  511. \& return;
  512. \& }
  513. \& if (!ENGINE_set_default_RSA(e))
  514. \& /*
  515. \& * This should only happen when \*(Aqe\*(Aq can\*(Aqt initialise, but the previous
  516. \& * statement suggests it did.
  517. \& */
  518. \& abort();
  519. \& ENGINE_set_default_DSA(e);
  520. \& ENGINE_set_default_ciphers(e);
  521. \& /* Release the functional reference from ENGINE_init() */
  522. \& ENGINE_finish(e);
  523. \& /* Release the structural reference from ENGINE_by_id() */
  524. \& ENGINE_free(e);
  525. .Ve
  526. .PP
  527. \&\fIAutomatically using built-in \s-1ENGINE\s0 implementations\fR
  528. .PP
  529. Here we'll assume we want to load and register all \s-1ENGINE\s0 implementations
  530. bundled with OpenSSL, such that for any cryptographic algorithm required by
  531. OpenSSL \- if there is an \s-1ENGINE\s0 that implements it and can be initialised,
  532. it should be used. The following code illustrates how this can work;
  533. .PP
  534. .Vb 4
  535. \& /* Load all bundled ENGINEs into memory and make them visible */
  536. \& ENGINE_load_builtin_engines();
  537. \& /* Register all of them for every algorithm they collectively implement */
  538. \& ENGINE_register_all_complete();
  539. .Ve
  540. .PP
  541. That's all that's required. Eg. the next time OpenSSL tries to set up an
  542. \&\s-1RSA\s0 key, any bundled ENGINEs that implement \s-1RSA_METHOD\s0 will be passed to
  543. \&\fBENGINE_init()\fR and if any of those succeed, that \s-1ENGINE\s0 will be set as the
  544. default for \s-1RSA\s0 use from then on.
  545. .SS "Advanced configuration support"
  546. .IX Subsection "Advanced configuration support"
  547. There is a mechanism supported by the \s-1ENGINE\s0 framework that allows each
  548. \&\s-1ENGINE\s0 implementation to define an arbitrary set of configuration
  549. \&\*(L"commands\*(R" and expose them to OpenSSL and any applications based on
  550. OpenSSL. This mechanism is entirely based on the use of name-value pairs
  551. and assumes \s-1ASCII\s0 input (no unicode or \s-1UTF\s0 for now!), so it is ideal if
  552. applications want to provide a transparent way for users to provide
  553. arbitrary configuration \*(L"directives\*(R" directly to such ENGINEs. It is also
  554. possible for the application to dynamically interrogate the loaded \s-1ENGINE\s0
  555. implementations for the names, descriptions, and input flags of their
  556. available \*(L"control commands\*(R", providing a more flexible configuration
  557. scheme. However, if the user is expected to know which \s-1ENGINE\s0 device he/she
  558. is using (in the case of specialised hardware, this goes without saying)
  559. then applications may not need to concern themselves with discovering the
  560. supported control commands and simply prefer to pass settings into ENGINEs
  561. exactly as they are provided by the user.
  562. .PP
  563. Before illustrating how control commands work, it is worth mentioning what
  564. they are typically used for. Broadly speaking there are two uses for
  565. control commands; the first is to provide the necessary details to the
  566. implementation (which may know nothing at all specific to the host system)
  567. so that it can be initialised for use. This could include the path to any
  568. driver or config files it needs to load, required network addresses,
  569. smart-card identifiers, passwords to initialise protected devices,
  570. logging information, etc etc. This class of commands typically needs to be
  571. passed to an \s-1ENGINE\s0 \fBbefore\fR attempting to initialise it, i.e. before
  572. calling \fBENGINE_init()\fR. The other class of commands consist of settings or
  573. operations that tweak certain behaviour or cause certain operations to take
  574. place, and these commands may work either before or after \fBENGINE_init()\fR, or
  575. in some cases both. \s-1ENGINE\s0 implementations should provide indications of
  576. this in the descriptions attached to built-in control commands and/or in
  577. external product documentation.
  578. .PP
  579. \&\fIIssuing control commands to an \s-1ENGINE\s0\fR
  580. .PP
  581. Let's illustrate by example; a function for which the caller supplies the
  582. name of the \s-1ENGINE\s0 it wishes to use, a table of string-pairs for use before
  583. initialisation, and another table for use after initialisation. Note that
  584. the string-pairs used for control commands consist of a command \*(L"name\*(R"
  585. followed by the command \*(L"parameter\*(R" \- the parameter could be \s-1NULL\s0 in some
  586. cases but the name can not. This function should initialise the \s-1ENGINE\s0
  587. (issuing the \*(L"pre\*(R" commands beforehand and the \*(L"post\*(R" commands afterwards)
  588. and set it as the default for everything except \s-1RAND\s0 and then return a
  589. boolean success or failure.
  590. .PP
  591. .Vb 10
  592. \& int generic_load_engine_fn(const char *engine_id,
  593. \& const char **pre_cmds, int pre_num,
  594. \& const char **post_cmds, int post_num)
  595. \& {
  596. \& ENGINE *e = ENGINE_by_id(engine_id);
  597. \& if (!e) return 0;
  598. \& while (pre_num\-\-) {
  599. \& if (!ENGINE_ctrl_cmd_string(e, pre_cmds[0], pre_cmds[1], 0)) {
  600. \& fprintf(stderr, "Failed command (%s \- %s:%s)\en", engine_id,
  601. \& pre_cmds[0], pre_cmds[1] ? pre_cmds[1] : "(NULL)");
  602. \& ENGINE_free(e);
  603. \& return 0;
  604. \& }
  605. \& pre_cmds += 2;
  606. \& }
  607. \& if (!ENGINE_init(e)) {
  608. \& fprintf(stderr, "Failed initialisation\en");
  609. \& ENGINE_free(e);
  610. \& return 0;
  611. \& }
  612. \& /*
  613. \& * ENGINE_init() returned a functional reference, so free the structural
  614. \& * reference from ENGINE_by_id().
  615. \& */
  616. \& ENGINE_free(e);
  617. \& while (post_num\-\-) {
  618. \& if (!ENGINE_ctrl_cmd_string(e, post_cmds[0], post_cmds[1], 0)) {
  619. \& fprintf(stderr, "Failed command (%s \- %s:%s)\en", engine_id,
  620. \& post_cmds[0], post_cmds[1] ? post_cmds[1] : "(NULL)");
  621. \& ENGINE_finish(e);
  622. \& return 0;
  623. \& }
  624. \& post_cmds += 2;
  625. \& }
  626. \& ENGINE_set_default(e, ENGINE_METHOD_ALL & ~ENGINE_METHOD_RAND);
  627. \& /* Success */
  628. \& return 1;
  629. \& }
  630. .Ve
  631. .PP
  632. Note that \fBENGINE_ctrl_cmd_string()\fR accepts a boolean argument that can
  633. relax the semantics of the function \- if set nonzero it will only return
  634. failure if the \s-1ENGINE\s0 supported the given command name but failed while
  635. executing it, if the \s-1ENGINE\s0 doesn't support the command name it will simply
  636. return success without doing anything. In this case we assume the user is
  637. only supplying commands specific to the given \s-1ENGINE\s0 so we set this to
  638. \&\s-1FALSE.\s0
  639. .PP
  640. \&\fIDiscovering supported control commands\fR
  641. .PP
  642. It is possible to discover at run-time the names, numerical-ids, descriptions
  643. and input parameters of the control commands supported by an \s-1ENGINE\s0 using a
  644. structural reference. Note that some control commands are defined by OpenSSL
  645. itself and it will intercept and handle these control commands on behalf of the
  646. \&\s-1ENGINE,\s0 i.e. the \s-1ENGINE\s0's \fBctrl()\fR handler is not used for the control command.
  647. \&\fI<openssl/engine.h>\fR defines an index, \s-1ENGINE_CMD_BASE,\s0 that all control
  648. commands implemented by ENGINEs should be numbered from. Any command value
  649. lower than this symbol is considered a \*(L"generic\*(R" command is handled directly
  650. by the OpenSSL core routines.
  651. .PP
  652. It is using these \*(L"core\*(R" control commands that one can discover the control
  653. commands implemented by a given \s-1ENGINE,\s0 specifically the commands:
  654. .PP
  655. .Vb 9
  656. \& ENGINE_HAS_CTRL_FUNCTION
  657. \& ENGINE_CTRL_GET_FIRST_CMD_TYPE
  658. \& ENGINE_CTRL_GET_NEXT_CMD_TYPE
  659. \& ENGINE_CTRL_GET_CMD_FROM_NAME
  660. \& ENGINE_CTRL_GET_NAME_LEN_FROM_CMD
  661. \& ENGINE_CTRL_GET_NAME_FROM_CMD
  662. \& ENGINE_CTRL_GET_DESC_LEN_FROM_CMD
  663. \& ENGINE_CTRL_GET_DESC_FROM_CMD
  664. \& ENGINE_CTRL_GET_CMD_FLAGS
  665. .Ve
  666. .PP
  667. Whilst these commands are automatically processed by the OpenSSL framework code,
  668. they use various properties exposed by each \s-1ENGINE\s0 to process these
  669. queries. An \s-1ENGINE\s0 has 3 properties it exposes that can affect how this behaves;
  670. it can supply a \fBctrl()\fR handler, it can specify \s-1ENGINE_FLAGS_MANUAL_CMD_CTRL\s0 in
  671. the \s-1ENGINE\s0's flags, and it can expose an array of control command descriptions.
  672. If an \s-1ENGINE\s0 specifies the \s-1ENGINE_FLAGS_MANUAL_CMD_CTRL\s0 flag, then it will
  673. simply pass all these \*(L"core\*(R" control commands directly to the \s-1ENGINE\s0's \fBctrl()\fR
  674. handler (and thus, it must have supplied one), so it is up to the \s-1ENGINE\s0 to
  675. reply to these \*(L"discovery\*(R" commands itself. If that flag is not set, then the
  676. OpenSSL framework code will work with the following rules:
  677. .PP
  678. .Vb 9
  679. \& if no ctrl() handler supplied;
  680. \& ENGINE_HAS_CTRL_FUNCTION returns FALSE (zero),
  681. \& all other commands fail.
  682. \& if a ctrl() handler was supplied but no array of control commands;
  683. \& ENGINE_HAS_CTRL_FUNCTION returns TRUE,
  684. \& all other commands fail.
  685. \& if a ctrl() handler and array of control commands was supplied;
  686. \& ENGINE_HAS_CTRL_FUNCTION returns TRUE,
  687. \& all other commands proceed processing ...
  688. .Ve
  689. .PP
  690. If the \s-1ENGINE\s0's array of control commands is empty then all other commands will
  691. fail, otherwise; \s-1ENGINE_CTRL_GET_FIRST_CMD_TYPE\s0 returns the identifier of
  692. the first command supported by the \s-1ENGINE, ENGINE_GET_NEXT_CMD_TYPE\s0 takes the
  693. identifier of a command supported by the \s-1ENGINE\s0 and returns the next command
  694. identifier or fails if there are no more, \s-1ENGINE_CMD_FROM_NAME\s0 takes a string
  695. name for a command and returns the corresponding identifier or fails if no such
  696. command name exists, and the remaining commands take a command identifier and
  697. return properties of the corresponding commands. All except
  698. \&\s-1ENGINE_CTRL_GET_FLAGS\s0 return the string length of a command name or description,
  699. or populate a supplied character buffer with a copy of the command name or
  700. description. \s-1ENGINE_CTRL_GET_FLAGS\s0 returns a bitwise-OR'd mask of the following
  701. possible values:
  702. .PP
  703. .Vb 4
  704. \& ENGINE_CMD_FLAG_NUMERIC
  705. \& ENGINE_CMD_FLAG_STRING
  706. \& ENGINE_CMD_FLAG_NO_INPUT
  707. \& ENGINE_CMD_FLAG_INTERNAL
  708. .Ve
  709. .PP
  710. If the \s-1ENGINE_CMD_FLAG_INTERNAL\s0 flag is set, then any other flags are purely
  711. informational to the caller \- this flag will prevent the command being usable
  712. for any higher-level \s-1ENGINE\s0 functions such as \fBENGINE_ctrl_cmd_string()\fR.
  713. \&\*(L"\s-1INTERNAL\*(R"\s0 commands are not intended to be exposed to text-based configuration
  714. by applications, administrations, users, etc. These can support arbitrary
  715. operations via \fBENGINE_ctrl()\fR, including passing to and/or from the control
  716. commands data of any arbitrary type. These commands are supported in the
  717. discovery mechanisms simply to allow applications to determine if an \s-1ENGINE\s0
  718. supports certain specific commands it might want to use (e.g. application \*(L"foo\*(R"
  719. might query various ENGINEs to see if they implement \*(L"\s-1FOO_GET_VENDOR_LOGO_GIF\*(R"\s0 \-
  720. and \s-1ENGINE\s0 could therefore decide whether or not to support this \*(L"foo\*(R"\-specific
  721. extension).
  722. .SH "ENVIRONMENT"
  723. .IX Header "ENVIRONMENT"
  724. .IP "\fB\s-1OPENSSL_ENGINES\s0\fR" 4
  725. .IX Item "OPENSSL_ENGINES"
  726. The path to the engines directory.
  727. Ignored in set-user-ID and set-group-ID programs.
  728. .SH "RETURN VALUES"
  729. .IX Header "RETURN VALUES"
  730. \&\fBENGINE_get_first()\fR, \fBENGINE_get_last()\fR, \fBENGINE_get_next()\fR and \fBENGINE_get_prev()\fR
  731. return a valid \fB\s-1ENGINE\s0\fR structure or \s-1NULL\s0 if an error occurred.
  732. .PP
  733. \&\fBENGINE_add()\fR and \fBENGINE_remove()\fR return 1 on success or 0 on error.
  734. .PP
  735. \&\fBENGINE_by_id()\fR returns a valid \fB\s-1ENGINE\s0\fR structure or \s-1NULL\s0 if an error occurred.
  736. .PP
  737. \&\fBENGINE_init()\fR and \fBENGINE_finish()\fR return 1 on success or 0 on error.
  738. .PP
  739. All \fBENGINE_get_default_TYPE()\fR functions, \fBENGINE_get_cipher_engine()\fR and
  740. \&\fBENGINE_get_digest_engine()\fR return a valid \fB\s-1ENGINE\s0\fR structure on success or \s-1NULL\s0
  741. if an error occurred.
  742. .PP
  743. All \fBENGINE_set_default_TYPE()\fR functions return 1 on success or 0 on error.
  744. .PP
  745. \&\fBENGINE_set_default()\fR returns 1 on success or 0 on error.
  746. .PP
  747. \&\fBENGINE_get_table_flags()\fR returns an unsigned integer value representing the
  748. global table flags which are used to control the registration behaviour of
  749. \&\fB\s-1ENGINE\s0\fR implementations.
  750. .PP
  751. All \fBENGINE_register_TYPE()\fR functions return 1 on success or 0 on error.
  752. .PP
  753. \&\fBENGINE_register_complete()\fR and \fBENGINE_register_all_complete()\fR always return 1.
  754. .PP
  755. \&\fBENGINE_ctrl()\fR returns a positive value on success or others on error.
  756. .PP
  757. \&\fBENGINE_cmd_is_executable()\fR returns 1 if \fBcmd\fR is executable or 0 otherwise.
  758. .PP
  759. \&\fBENGINE_ctrl_cmd()\fR and \fBENGINE_ctrl_cmd_string()\fR return 1 on success or 0 on error.
  760. .PP
  761. \&\fBENGINE_new()\fR returns a valid \fB\s-1ENGINE\s0\fR structure on success or \s-1NULL\s0 if an error
  762. occurred.
  763. .PP
  764. \&\fBENGINE_free()\fR always returns 1.
  765. .PP
  766. \&\fBENGINE_up_ref()\fR returns 1 on success or 0 on error.
  767. .PP
  768. \&\fBENGINE_set_id()\fR and \fBENGINE_set_name()\fR return 1 on success or 0 on error.
  769. .PP
  770. All other \fBENGINE_set_*\fR functions return 1 on success or 0 on error.
  771. .PP
  772. \&\fBENGINE_get_id()\fR and \fBENGINE_get_name()\fR return a string representing the identifier
  773. and the name of the \s-1ENGINE\s0 \fBe\fR respectively.
  774. .PP
  775. \&\fBENGINE_get_RSA()\fR, \fBENGINE_get_DSA()\fR, \fBENGINE_get_DH()\fR and \fBENGINE_get_RAND()\fR
  776. return corresponding method structures for each algorithms.
  777. .PP
  778. \&\fBENGINE_get_destroy_function()\fR, \fBENGINE_get_init_function()\fR,
  779. \&\fBENGINE_get_finish_function()\fR, \fBENGINE_get_ctrl_function()\fR,
  780. \&\fBENGINE_get_load_privkey_function()\fR, \fBENGINE_get_load_pubkey_function()\fR,
  781. \&\fBENGINE_get_ciphers()\fR and \fBENGINE_get_digests()\fR return corresponding function
  782. pointers of the callbacks.
  783. .PP
  784. \&\fBENGINE_get_cipher()\fR returns a valid \fB\s-1EVP_CIPHER\s0\fR structure on success or \s-1NULL\s0
  785. if an error occurred.
  786. .PP
  787. \&\fBENGINE_get_digest()\fR returns a valid \fB\s-1EVP_MD\s0\fR structure on success or \s-1NULL\s0 if an
  788. error occurred.
  789. .PP
  790. \&\fBENGINE_get_flags()\fR returns an integer representing the \s-1ENGINE\s0 flags which are
  791. used to control various behaviours of an \s-1ENGINE.\s0
  792. .PP
  793. \&\fBENGINE_get_cmd_defns()\fR returns an \fB\s-1ENGINE_CMD_DEFN\s0\fR structure or \s-1NULL\s0 if it's
  794. not set.
  795. .PP
  796. \&\fBENGINE_load_private_key()\fR and \fBENGINE_load_public_key()\fR return a valid \fB\s-1EVP_PKEY\s0\fR
  797. structure on success or \s-1NULL\s0 if an error occurred.
  798. .SH "SEE ALSO"
  799. .IX Header "SEE ALSO"
  800. \&\fBOPENSSL_init_crypto\fR\|(3), \fBRSA_new_method\fR\|(3), \fBDSA_new\fR\|(3), \fBDH_new\fR\|(3),
  801. \&\fBRAND_bytes\fR\|(3), \fBconfig\fR\|(5)
  802. .SH "HISTORY"
  803. .IX Header "HISTORY"
  804. All of these functions were deprecated in OpenSSL 3.0.
  805. .PP
  806. \&\fBENGINE_cleanup()\fR was deprecated in OpenSSL 1.1.0 by the automatic cleanup
  807. done by \fBOPENSSL_cleanup()\fR
  808. and should not be used.
  809. .SH "COPYRIGHT"
  810. .IX Header "COPYRIGHT"
  811. Copyright 2002\-2024 The OpenSSL Project Authors. All Rights Reserved.
  812. .PP
  813. Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use
  814. this file except in compliance with the License. You can obtain a copy
  815. in the file \s-1LICENSE\s0 in the source distribution or at
  816. <https://www.openssl.org/source/license.html>.