update libressl to v2.7.4
[unleashed.git] / lib / libcrypto / man / engine.3
blobd0b83d77453982f0999d5f5f5fe8919a8a556ce0
1 .\" $OpenBSD: engine.3,v 1.13 2018/03/22 21:08:22 schwarze Exp $
2 .\" full merge up to: OpenSSL crypto/engine e6390aca Jul 21 10:06:03 2015 -0400
3 .\" selective merge up to: man3/ENGINE_add 1f13ad31 Dec 25 17:50:39 2017 +0800
4 .\"
5 .\" This file was written by Geoff Thorpe <geoff@openssl.org>
6 .\" with contributions from Paul Yang <yang.yang@baishancloud.com>.
7 .\" Copyright (c) 2002, 2004, 2007, 2015, 2017 The OpenSSL Project.
8 .\" All rights reserved.
9 .\"
10 .\" Redistribution and use in source and binary forms, with or without
11 .\" modification, are permitted provided that the following conditions
12 .\" are met:
13 .\"
14 .\" 1. Redistributions of source code must retain the above copyright
15 .\"    notice, this list of conditions and the following disclaimer.
16 .\"
17 .\" 2. Redistributions in binary form must reproduce the above copyright
18 .\"    notice, this list of conditions and the following disclaimer in
19 .\"    the documentation and/or other materials provided with the
20 .\"    distribution.
21 .\"
22 .\" 3. All advertising materials mentioning features or use of this
23 .\"    software must display the following acknowledgment:
24 .\"    "This product includes software developed by the OpenSSL Project
25 .\"    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
26 .\"
27 .\" 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
28 .\"    endorse or promote products derived from this software without
29 .\"    prior written permission. For written permission, please contact
30 .\"    openssl-core@openssl.org.
31 .\"
32 .\" 5. Products derived from this software may not be called "OpenSSL"
33 .\"    nor may "OpenSSL" appear in their names without prior written
34 .\"    permission of the OpenSSL Project.
35 .\"
36 .\" 6. Redistributions of any form whatsoever must retain the following
37 .\"    acknowledgment:
38 .\"    "This product includes software developed by the OpenSSL Project
39 .\"    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
40 .\"
41 .\" THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
42 .\" EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
43 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
44 .\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
45 .\" ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
46 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
47 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
48 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
49 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
50 .\" STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
51 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52 .\" OF THE POSSIBILITY OF SUCH DAMAGE.
53 .\"
54 .Dd $Mdocdate: March 22 2018 $
55 .Dt ENGINE 3
56 .Os
57 .Sh NAME
58 .Nm ENGINE_get_first ,
59 .Nm ENGINE_get_last ,
60 .Nm ENGINE_get_next ,
61 .Nm ENGINE_get_prev ,
62 .Nm ENGINE_add ,
63 .Nm ENGINE_remove ,
64 .Nm ENGINE_by_id ,
65 .Nm ENGINE_init ,
66 .Nm ENGINE_finish ,
67 .Nm ENGINE_load_openssl ,
68 .Nm ENGINE_load_dynamic ,
69 .Nm ENGINE_load_cryptodev ,
70 .Nm ENGINE_load_builtin_engines ,
71 .Nm ENGINE_cleanup ,
72 .Nm ENGINE_get_default_RSA ,
73 .Nm ENGINE_get_default_DSA ,
74 .Nm ENGINE_get_default_ECDH ,
75 .Nm ENGINE_get_default_ECDSA ,
76 .Nm ENGINE_get_default_DH ,
77 .Nm ENGINE_get_default_RAND ,
78 .Nm ENGINE_get_cipher_engine ,
79 .Nm ENGINE_get_digest_engine ,
80 .Nm ENGINE_set_default_RSA ,
81 .Nm ENGINE_set_default_DSA ,
82 .Nm ENGINE_set_default_ECDH ,
83 .Nm ENGINE_set_default_ECDSA ,
84 .Nm ENGINE_set_default_DH ,
85 .Nm ENGINE_set_default_RAND ,
86 .Nm ENGINE_set_default_ciphers ,
87 .Nm ENGINE_set_default_digests ,
88 .Nm ENGINE_set_default_string ,
89 .Nm ENGINE_set_default ,
90 .Nm ENGINE_get_table_flags ,
91 .Nm ENGINE_set_table_flags ,
92 .Nm ENGINE_register_RSA ,
93 .Nm ENGINE_unregister_RSA ,
94 .Nm ENGINE_register_all_RSA ,
95 .Nm ENGINE_register_DSA ,
96 .Nm ENGINE_unregister_DSA ,
97 .Nm ENGINE_register_all_DSA ,
98 .Nm ENGINE_register_ECDH ,
99 .Nm ENGINE_unregister_ECDH ,
100 .Nm ENGINE_register_all_ECDH ,
101 .Nm ENGINE_register_ECDSA ,
102 .Nm ENGINE_unregister_ECDSA ,
103 .Nm ENGINE_register_all_ECDSA ,
104 .Nm ENGINE_register_DH ,
105 .Nm ENGINE_unregister_DH ,
106 .Nm ENGINE_register_all_DH ,
107 .Nm ENGINE_register_RAND ,
108 .Nm ENGINE_unregister_RAND ,
109 .Nm ENGINE_register_all_RAND ,
110 .Nm ENGINE_register_STORE ,
111 .Nm ENGINE_unregister_STORE ,
112 .Nm ENGINE_register_all_STORE ,
113 .Nm ENGINE_register_ciphers ,
114 .Nm ENGINE_unregister_ciphers ,
115 .Nm ENGINE_register_all_ciphers ,
116 .Nm ENGINE_register_digests ,
117 .Nm ENGINE_unregister_digests ,
118 .Nm ENGINE_register_all_digests ,
119 .Nm ENGINE_register_complete ,
120 .Nm ENGINE_register_all_complete ,
121 .Nm ENGINE_ctrl ,
122 .Nm ENGINE_cmd_is_executable ,
123 .Nm ENGINE_ctrl_cmd ,
124 .Nm ENGINE_ctrl_cmd_string ,
125 .Nm ENGINE_new ,
126 .Nm ENGINE_free ,
127 .Nm ENGINE_up_ref ,
128 .Nm ENGINE_set_id ,
129 .Nm ENGINE_set_name ,
130 .Nm ENGINE_set_RSA ,
131 .Nm ENGINE_set_DSA ,
132 .Nm ENGINE_set_ECDH ,
133 .Nm ENGINE_set_ECDSA ,
134 .Nm ENGINE_set_DH ,
135 .Nm ENGINE_set_RAND ,
136 .Nm ENGINE_set_STORE ,
137 .Nm ENGINE_set_destroy_function ,
138 .Nm ENGINE_set_init_function ,
139 .Nm ENGINE_set_finish_function ,
140 .Nm ENGINE_set_ctrl_function ,
141 .Nm ENGINE_set_load_privkey_function ,
142 .Nm ENGINE_set_load_pubkey_function ,
143 .Nm ENGINE_set_ciphers ,
144 .Nm ENGINE_set_digests ,
145 .Nm ENGINE_set_flags ,
146 .Nm ENGINE_set_cmd_defns ,
147 .Nm ENGINE_get_id ,
148 .Nm ENGINE_get_name ,
149 .Nm ENGINE_get_RSA ,
150 .Nm ENGINE_get_DSA ,
151 .Nm ENGINE_get_ECDH ,
152 .Nm ENGINE_get_ECDSA ,
153 .Nm ENGINE_get_DH ,
154 .Nm ENGINE_get_RAND ,
155 .Nm ENGINE_get_STORE ,
156 .Nm ENGINE_get_destroy_function ,
157 .Nm ENGINE_get_init_function ,
158 .Nm ENGINE_get_finish_function ,
159 .Nm ENGINE_get_ctrl_function ,
160 .Nm ENGINE_get_load_privkey_function ,
161 .Nm ENGINE_get_load_pubkey_function ,
162 .Nm ENGINE_get_ciphers ,
163 .Nm ENGINE_get_digests ,
164 .Nm ENGINE_get_cipher ,
165 .Nm ENGINE_get_digest ,
166 .Nm ENGINE_get_flags ,
167 .Nm ENGINE_get_cmd_defns ,
168 .Nm ENGINE_load_private_key ,
169 .Nm ENGINE_load_public_key
170 .Nd ENGINE cryptographic module support
171 .Sh SYNOPSIS
172 .In openssl/engine.h
173 .Ft ENGINE *
174 .Fn ENGINE_get_first void
175 .Ft ENGINE *
176 .Fn ENGINE_get_last void
177 .Ft ENGINE *
178 .Fo ENGINE_get_next
179 .Fa "ENGINE *e"
181 .Ft ENGINE *
182 .Fo ENGINE_get_prev
183 .Fa "ENGINE *e"
185 .Ft int
186 .Fo ENGINE_add
187 .Fa "ENGINE *e"
189 .Ft int
190 .Fo ENGINE_remove
191 .Fa "ENGINE *e"
193 .Ft ENGINE *
194 .Fo ENGINE_by_id
195 .Fa "const char *id"
197 .Ft int
198 .Fo ENGINE_init
199 .Fa "ENGINE *e"
201 .Ft int
202 .Fo ENGINE_finish
203 .Fa "ENGINE *e"
205 .Ft void
206 .Fn ENGINE_load_openssl void
207 .Ft void
208 .Fn ENGINE_load_dynamic void
209 .Ft void
210 .Fn ENGINE_load_cryptodev void
211 .Ft void
212 .Fn ENGINE_load_builtin_engines void
213 .Ft void
214 .Fn ENGINE_cleanup void
215 .Ft ENGINE *
216 .Fn ENGINE_get_default_RSA void
217 .Ft ENGINE *
218 .Fn ENGINE_get_default_DSA void
219 .Ft ENGINE *
220 .Fn ENGINE_get_default_ECDH void
221 .Ft ENGINE *
222 .Fn ENGINE_get_default_ECDSA void
223 .Ft ENGINE *
224 .Fn ENGINE_get_default_DH void
225 .Ft ENGINE *
226 .Fn ENGINE_get_default_RAND void
227 .Ft ENGINE *
228 .Fo ENGINE_get_cipher_engine
229 .Fa "int nid"
231 .Ft ENGINE *
232 .Fo ENGINE_get_digest_engine
233 .Fa "int nid"
235 .Ft int
236 .Fo ENGINE_set_default_RSA
237 .Fa "ENGINE *e"
239 .Ft int
240 .Fo ENGINE_set_default_DSA
241 .Fa "ENGINE *e"
243 .Ft int
244 .Fo ENGINE_set_default_ECDH
245 .Fa "ENGINE *e"
247 .Ft int
248 .Fo ENGINE_set_default_ECDSA
249 .Fa "ENGINE *e"
251 .Ft int
252 .Fo ENGINE_set_default_DH
253 .Fa "ENGINE *e"
255 .Ft int
256 .Fo ENGINE_set_default_RAND
257 .Fa "ENGINE *e"
259 .Ft int
260 .Fo ENGINE_set_default_ciphers
261 .Fa "ENGINE *e"
263 .Ft int
264 .Fo ENGINE_set_default_digests
265 .Fa "ENGINE *e"
267 .Ft int
268 .Fo ENGINE_set_default_string
269 .Fa "ENGINE *e"
270 .Fa "const char *list"
272 .Ft int
273 .Fo ENGINE_set_default
274 .Fa "ENGINE *e"
275 .Fa "unsigned int flags"
277 .Ft unsigned int
278 .Fn ENGINE_get_table_flags void
279 .Ft void
280 .Fo ENGINE_set_table_flags
281 .Fa "unsigned int flags"
283 .Ft int
284 .Fo ENGINE_register_RSA
285 .Fa "ENGINE *e"
287 .Ft void
288 .Fo ENGINE_unregister_RSA
289 .Fa "ENGINE *e"
291 .Ft void
292 .Fn ENGINE_register_all_RSA void
293 .Ft int
294 .Fo ENGINE_register_DSA
295 .Fa "ENGINE *e"
297 .Ft void
298 .Fo ENGINE_unregister_DSA
299 .Fa "ENGINE *e"
301 .Ft void
302 .Fn ENGINE_register_all_DSA void
303 .Ft int
304 .Fo ENGINE_register_ECDH
305 .Fa "ENGINE *e"
307 .Ft void
308 .Fo ENGINE_unregister_ECDH
309 .Fa "ENGINE *e"
311 .Ft void
312 .Fn ENGINE_register_all_ECDH void
313 .Ft int
314 .Fo ENGINE_register_ECDSA
315 .Fa "ENGINE *e"
317 .Ft void
318 .Fo ENGINE_unregister_ECDSA
319 .Fa "ENGINE *e"
321 .Ft void
322 .Fn ENGINE_register_all_ECDSA void
323 .Ft int
324 .Fo ENGINE_register_DH
325 .Fa "ENGINE *e"
327 .Ft void
328 .Fo ENGINE_unregister_DH
329 .Fa "ENGINE *e"
331 .Ft void
332 .Fn ENGINE_register_all_DH void
333 .Ft int
334 .Fo ENGINE_register_RAND
335 .Fa "ENGINE *e"
337 .Ft void
338 .Fo ENGINE_unregister_RAND
339 .Fa "ENGINE *e"
341 .Ft void
342 .Fn ENGINE_register_all_RAND void
343 .Ft int
344 .Fo ENGINE_register_STORE
345 .Fa "ENGINE *e"
347 .Ft void
348 .Fo ENGINE_unregister_STORE
349 .Fa "ENGINE *e"
351 .Ft void
352 .Fn ENGINE_register_all_STORE void
353 .Ft int
354 .Fo ENGINE_register_ciphers
355 .Fa "ENGINE *e"
357 .Ft void
358 .Fo ENGINE_unregister_ciphers
359 .Fa "ENGINE *e"
361 .Ft void
362 .Fn ENGINE_register_all_ciphers void
363 .Ft int
364 .Fo ENGINE_register_digests
365 .Fa "ENGINE *e"
367 .Ft void
368 .Fo ENGINE_unregister_digests
369 .Fa "ENGINE *e"
371 .Ft void
372 .Fn ENGINE_register_all_digests void
373 .Ft int
374 .Fo ENGINE_register_complete
375 .Fa "ENGINE *e"
377 .Ft int
378 .Fn ENGINE_register_all_complete void
379 .Ft int
380 .Fo ENGINE_ctrl
381 .Fa "ENGINE *e"
382 .Fa "int cmd"
383 .Fa "long i"
384 .Fa "void *p"
385 .Fa "void (*f)(void)"
387 .Ft int
388 .Fo ENGINE_cmd_is_executable
389 .Fa "ENGINE *e"
390 .Fa "int cmd"
392 .Ft int
393 .Fo ENGINE_ctrl_cmd
394 .Fa "ENGINE *e"
395 .Fa "const char *cmd_name"
396 .Fa "long i"
397 .Fa "void *p"
398 .Fa "void (*f)(void)"
399 .Fa "int cmd_optional"
401 .Ft int
402 .Fo ENGINE_ctrl_cmd_string
403 .Fa "ENGINE *e"
404 .Fa "const char *cmd_name"
405 .Fa "const char *arg"
406 .Fa "int cmd_optional"
408 .Ft ENGINE *
409 .Fn ENGINE_new void
410 .Ft int
411 .Fo ENGINE_free
412 .Fa "ENGINE *e"
414 .Ft int
415 .Fo ENGINE_up_ref
416 .Fa "ENGINE *e"
418 .Ft int
419 .Fo ENGINE_set_id
420 .Fa "ENGINE *e"
421 .Fa "const char *id"
423 .Ft int
424 .Fo ENGINE_set_name
425 .Fa "ENGINE *e"
426 .Fa "const char *name"
428 .Ft int
429 .Fo ENGINE_set_RSA
430 .Fa "ENGINE *e"
431 .Fa "const RSA_METHOD *rsa_meth"
433 .Ft int
434 .Fo ENGINE_set_DSA
435 .Fa "ENGINE *e"
436 .Fa "const DSA_METHOD *dsa_meth"
438 .Ft int
439 .Fo ENGINE_set_ECDH
440 .Fa "ENGINE *e"
441 .Fa "const ECDH_METHOD *dh_meth"
443 .Ft int
444 .Fo ENGINE_set_ECDSA
445 .Fa "ENGINE *e"
446 .Fa "const ECDSA_METHOD *dh_meth"
448 .Ft int
449 .Fo ENGINE_set_DH
450 .Fa "ENGINE *e"
451 .Fa "const DH_METHOD *dh_meth"
453 .Ft int
454 .Fo ENGINE_set_RAND
455 .Fa "ENGINE *e"
456 .Fa "const RAND_METHOD *rand_meth"
458 .Ft int
459 .Fo ENGINE_set_STORE
460 .Fa "ENGINE *e"
461 .Fa "const STORE_METHOD *rand_meth"
463 .Ft int
464 .Fo ENGINE_set_destroy_function
465 .Fa "ENGINE *e"
466 .Fa "ENGINE_GEN_INT_FUNC_PTR destroy_f"
468 .Ft int
469 .Fo ENGINE_set_init_function
470 .Fa "ENGINE *e"
471 .Fa "ENGINE_GEN_INT_FUNC_PTR init_f"
473 .Ft int
474 .Fo ENGINE_set_finish_function
475 .Fa "ENGINE *e"
476 .Fa "ENGINE_GEN_INT_FUNC_PTR finish_f"
478 .Ft int
479 .Fo ENGINE_set_ctrl_function
480 .Fa "ENGINE *e"
481 .Fa "ENGINE_CTRL_FUNC_PTR ctrl_f"
483 .Ft int
484 .Fo ENGINE_set_load_privkey_function
485 .Fa "ENGINE *e"
486 .Fa "ENGINE_LOAD_KEY_PTR loadpriv_f"
488 .Ft int
489 .Fo ENGINE_set_load_pubkey_function
490 .Fa "ENGINE *e"
491 .Fa "ENGINE_LOAD_KEY_PTR loadpub_f"
493 .Ft int
494 .Fo ENGINE_set_ciphers
495 .Fa "ENGINE *e"
496 .Fa "ENGINE_CIPHERS_PTR f"
498 .Ft int
499 .Fo ENGINE_set_digests
500 .Fa "ENGINE *e"
501 .Fa "ENGINE_DIGESTS_PTR f"
503 .Ft int
504 .Fo ENGINE_set_flags
505 .Fa "ENGINE *e"
506 .Fa "int flags"
508 .Ft int
509 .Fo ENGINE_set_cmd_defns
510 .Fa "ENGINE *e"
511 .Fa "const ENGINE_CMD_DEFN *defns"
513 .Ft const char *
514 .Fo ENGINE_get_id
515 .Fa "const ENGINE *e"
517 .Ft const char *
518 .Fo ENGINE_get_name
519 .Fa "const ENGINE *e"
521 .Ft const RSA_METHOD *
522 .Fo ENGINE_get_RSA
523 .Fa "const ENGINE *e"
525 .Ft const DSA_METHOD *
526 .Fo ENGINE_get_DSA
527 .Fa "const ENGINE *e"
529 .Ft const ECDH_METHOD *
530 .Fo ENGINE_get_ECDH
531 .Fa "const ENGINE *e"
533 .Ft const ECDSA_METHOD *
534 .Fo ENGINE_get_ECDSA
535 .Fa "const ENGINE *e"
537 .Ft const DH_METHOD *
538 .Fo ENGINE_get_DH
539 .Fa "const ENGINE *e"
541 .Ft const RAND_METHOD *
542 .Fo ENGINE_get_RAND
543 .Fa "const ENGINE *e"
545 .Ft const STORE_METHOD *
546 .Fo ENGINE_get_STORE
547 .Fa "const ENGINE *e"
549 .Ft ENGINE_GEN_INT_FUNC_PTR
550 .Fo ENGINE_get_destroy_function
551 .Fa "const ENGINE *e"
553 .Ft ENGINE_GEN_INT_FUNC_PTR
554 .Fo ENGINE_get_init_function
555 .Fa "const ENGINE *e"
557 .Ft ENGINE_GEN_INT_FUNC_PTR
558 .Fo ENGINE_get_finish_function
559 .Fa "const ENGINE *e"
561 .Ft ENGINE_CTRL_FUNC_PTR
562 .Fo ENGINE_get_ctrl_function
563 .Fa "const ENGINE *e"
565 .Ft ENGINE_LOAD_KEY_PTR
566 .Fo ENGINE_get_load_privkey_function
567 .Fa "const ENGINE *e"
569 .Ft ENGINE_LOAD_KEY_PTR
570 .Fo ENGINE_get_load_pubkey_function
571 .Fa "const ENGINE *e"
573 .Ft ENGINE_CIPHERS_PTR
574 .Fo ENGINE_get_ciphers
575 .Fa "const ENGINE *e"
577 .Ft ENGINE_DIGESTS_PTR
578 .Fo ENGINE_get_digests
579 .Fa "const ENGINE *e"
581 .Ft const EVP_CIPHER *
582 .Fo ENGINE_get_cipher
583 .Fa "ENGINE *e"
584 .Fa "int nid"
586 .Ft const EVP_MD *
587 .Fo ENGINE_get_digest
588 .Fa "ENGINE *e"
589 .Fa "int nid"
591 .Ft int
592 .Fo ENGINE_get_flags
593 .Fa "const ENGINE *e"
595 .Ft const ENGINE_CMD_DEFN *
596 .Fo ENGINE_get_cmd_defns
597 .Fa "const ENGINE *e"
599 .Ft EVP_PKEY *
600 .Fo ENGINE_load_private_key
601 .Fa "ENGINE *e"
602 .Fa "const char *key_id"
603 .Fa "UI_METHOD *ui_method"
604 .Fa "void *callback_data"
606 .Ft EVP_PKEY *
607 .Fo ENGINE_load_public_key
608 .Fa "ENGINE *e"
609 .Fa "const char *key_id"
610 .Fa "UI_METHOD *ui_method"
611 .Fa "void *callback_data"
613 .Sh DESCRIPTION
614 These functions create, manipulate, and use cryptographic modules
615 in the form of
616 .Vt ENGINE
617 objects.
618 These objects act as containers for implementations of cryptographic
619 algorithms, and support a reference-counted mechanism to allow them to
620 be dynamically loaded in and out of the running application.
622 The cryptographic functionality that can be provided by an
623 .Vt ENGINE
624 implementation includes the following abstractions:
626 .Bl -bullet -compact
628 .Vt RSA_METHOD :
629 for providing alternative RSA implementations
631 .Vt DSA_METHOD , DH_METHOD , RAND_METHOD , ECDH_METHOD ,
632 .Vt ECDSA_METHOD , STORE_METHOD :
633 similarly for other OpenSSL APIs
635 .Vt EVP_CIPHER :
636 potentially multiple cipher algorithms (indexed by 'nid')
638 .Vt EVP_DIGEST :
639 potentially multiple hash algorithms (indexed by 'nid')
641 key-loading: loading public and/or private EVP_PKEY keys
643 .Ss Reference counting and handles
644 Due to the modular nature of the
645 .Nm engine
646 API, pointers to
647 .Vt ENGINE Ns s
648 need to be treated as handles - i.e. not only as pointers, but also
649 as references to the underlying
650 .Vt ENGINE
651 object.
652 One should obtain a new reference when making copies of an
653 .Vt ENGINE
654 pointer if the copies will be used (and released) independently.
656 .Vt ENGINE
657 objects have two levels of reference-counting to match the way in
658 which the objects are used.
659 At the most basic level, each
660 .Vt ENGINE
661 pointer is inherently a
662 .Sy structural
663 reference - a structural reference is required to use the pointer value
664 at all, as this kind of reference is a guarantee that the structure cannot
665 be deallocated until the reference is released.
667 However, a structural reference provides no guarantee that the
668 .Vt ENGINE
669 is initialised and able to use any of its cryptographic implementations.
670 Indeed it's quite possible that most
671 .Vt ENGINE Ns s
672 will not initialise at all in typical environments, as
673 .Vt ENGINE Ns s
674 are typically used to support specialised hardware.
675 To use an
676 .Vt ENGINE Ap s
677 functionality, you need a
678 .Sy functional
679 reference.
680 This kind of reference can be considered a specialised form of
681 structural reference, because each functional reference implicitly
682 contains a structural reference as well - however to avoid
683 difficult-to-find programming bugs, it is recommended to treat the two
684 kinds of reference independently.
685 If you have a functional reference to an
686 .Vt ENGINE ,
687 you have a guarantee that the
688 .Vt ENGINE
689 has been initialised and is ready to perform cryptographic operations and
690 will remain uninitialised until after you have released your
691 reference.
693 .Em Structural references
695 This basic type of reference is used for instantiating new
696 .Vt ENGINE Ns s ,
697 iterating across OpenSSL's internal linked-list of loaded
698 .Vt ENGINE Ns s ,
699 reading information about an
700 .Vt ENGINE ,
701 etc.
702 Essentially a structural reference is sufficient if you only need to
703 query or manipulate the data of an
704 .Vt ENGINE
705 implementation rather than use its functionality.
708 .Fn ENGINE_new
709 function returns a structural reference to a new (empty)
710 .Vt ENGINE
711 object.
712 There are other
713 .Nm engine
714 API functions that return structural references such as
715 .Fn ENGINE_by_id ,
716 .Fn ENGINE_get_first ,
717 .Fn ENGINE_get_last ,
718 .Fn ENGINE_get_next ,
720 .Fn ENGINE_get_prev .
721 All structural references should be released by a corresponding call
722 to the
723 .Fn ENGINE_free
724 function.
726 .Vt ENGINE
727 object itself will only actually be cleaned up and deallocated when
728 the last structural reference is released.
730 It should also be noted that many
731 .Nm engine
732 API function calls that accept a structural reference will internally
733 obtain another reference.
734 Typically this happens whenever the supplied
735 .Vt ENGINE
736 will be needed by OpenSSL after the function has returned.
737 For example, the function to add a new
738 .Vt ENGINE
739 to OpenSSL's internal list is
740 .Fn ENGINE_add .
741 If this function returns success, OpenSSL will have stored a new
742 structural reference internally so the caller is still responsible for
743 freeing their own reference with
744 .Fn ENGINE_free
745 when they are finished with it.
746 In a similar way, some functions will automatically release the
747 structural reference passed to it if part of the function's job is
748 to do so.
749 For example, the
750 .Fn ENGINE_get_next
752 .Fn ENGINE_get_prev
753 functions are used for iterating across the internal
754 .Vt ENGINE
755 list.
756 They
757 will return a new structural reference to the next (or previous)
758 .Vt ENGINE
759 in the list or
760 .Dv NULL
761 if at the end (or beginning) of the list, but in either case the
762 structural reference passed to the function is released on behalf
763 of the caller.
765 To clarify a particular function's handling of references, one should
766 always consult that function's manual page, or failing that the
767 .In openssl/engine.h
768 header file includes some hints.
770 .Em Functional references
772 As mentioned, functional references exist when the cryptographic
773 functionality of an
774 .Vt ENGINE
775 is required to be available.
776 A functional reference can be obtained in one of two ways; from an
777 existing structural reference to the required
778 .Vt ENGINE ,
779 or by asking OpenSSL for the default operational
780 .Vt ENGINE
781 for a given cryptographic purpose.
783 To obtain a functional reference from an existing structural reference,
784 call the
785 .Fn ENGINE_init
786 function.
787 This returns zero if the
788 .Vt ENGINE
789 was not already operational and couldn't be successfully initialised
790 (e.g. lack of system drivers, no special hardware attached),
791 otherwise it will return non-zero to indicate that the
792 .Vt ENGINE
793 is now operational and will have allocated a new
794 .Sy functional
795 reference to the
796 .Vt ENGINE .
797 All functional references are released by calling
798 .Fn ENGINE_finish ,
799 which removes the implicit structural reference as well.
801 The second way to get a functional reference is by asking OpenSSL for a
802 default implementation for a given task, e.g.
804 .Fn ENGINE_get_default_RSA ,
805 .Fn ENGINE_get_default_cipher_engine ,
806 etc.
807 These are discussed in the next section, though they are not usually
808 required by application programmers as they are used automatically when
809 creating and using the relevant algorithm-specific types in OpenSSL,
810 such as RSA, DSA, EVP_CIPHER_CTX, etc.
811 .Ss Default implementations
812 For each supported abstraction, the
813 .Nm engine
814 code maintains an internal table of state to control which
815 implementations are available for a given abstraction and which
816 should be used by default.
817 These implementations are registered in the tables and indexed by an
818 .Fa nid
819 value, because abstractions like
820 .Vt EVP_CIPHER
822 .Vt EVP_DIGEST
823 support many distinct algorithms and modes, and
824 .Vt ENGINE Ns s
825 can support arbitrarily many of them.
826 In the case of other abstractions like RSA, DSA, etc., there is
827 only one "algorithm" so all implementations implicitly register
828 using the same
829 .Fa nid
830 index.
832 When a default
833 .Vt ENGINE
834 is requested for a given abstraction/algorithm/mode, (e.g. when
835 calling
836 .Fn RSA_new_method NULL ) ,
837 a "get_default" call will be made to the
838 .Nm engine
839 subsystem to process the corresponding state table and return
840 a functional reference to an initialised
841 .Vt ENGINE
842 whose implementation should be used.
843 If no
844 .Vt ENGINE
845 should (or can) be used, it will return
846 .Dv NULL
847 and the caller will operate with a
848 .Dv NULL
849 .Vt ENGINE
850 handle.
851 This usually equates to using the conventional software implementation.
852 In the latter case, OpenSSL will from then on behave the way it used to
853 before the
854 .Nm engine
855 API existed.
857 Each state table has a flag to note whether it has processed this
858 "get_default" query since the table was last modified, because to
859 process this question it must iterate across all the registered
860 .Vt ENGINE Ns s
861 in the table trying to initialise each of them in turn, in case one of
862 them is operational.
863 If it returns a functional reference to an
864 .Vt ENGINE ,
865 it will also cache another reference to speed up processing future
866 queries (without needing to iterate across the table).
867 Likewise, it will cache a
868 .Dv NULL
869 response if no
870 .Vt ENGINE
871 was available so that future queries won't repeat the same iteration
872 unless the state table changes.
873 This behaviour can also be changed; if the
874 .Dv ENGINE_TABLE_FLAG_NOINIT
875 flag is set (using
876 .Fn ENGINE_set_table_flags ) ,
877 no attempted initialisations will take place, instead the only way for
878 the state table to return a
879 .Pf non- Dv NULL
880 .Vt ENGINE
881 to the "get_default" query will be if one is expressly set in the table.
882 For example,
883 .Fn ENGINE_set_default_RSA
884 does the same job as
885 .Fn ENGINE_register_RSA
886 except that it also sets the state table's cached response for the
887 "get_default" query.
888 In the case of abstractions like
889 .Vt EVP_CIPHER ,
890 where implementations are indexed by
891 .Fa nid ,
892 these flags and cached-responses are distinct for each
893 .Fa nid
894 value.
895 .Ss Application requirements
896 This section will explain the basic things an application programmer
897 should support to make the most useful elements of the
898 .Nm engine
899 functionality available to the user.
900 The first thing to consider is whether the programmer wishes to make
901 alternative
902 .Vt ENGINE
903 modules available to the application and user.
904 OpenSSL maintains an internal linked list of "visible"
905 .Vt ENGINE Ns s
906 from which it has to operate.
907 At start-up, this list is empty, and in fact if an application does
908 not call any
909 .Nm engine
910 API calls and it uses static
911 linking against openssl, then the resulting application binary will
912 not contain any alternative
913 .Nm engine
914 code at all.
915 So the first consideration is whether any/all available
916 .Vt ENGINE
917 implementations should be made visible to OpenSSL.
918 This is controlled by calling the various "load" functions, e.g.
919 .Fn ENGINE_load_builtin_engines
920 to make all
921 .Vt ENGINE
922 implementations bundled with OpenSSL available.
924 Note that
925 .Fn ENGINE_load_dynamic
926 is a placeholder and does not enable dynamic engine loading support.
928 Having called any of these functions,
929 .Vt ENGINE
930 objects would have been dynamically allocated and populated with
931 these implementations and linked into OpenSSL's internal linked
932 list.
934 If no
935 .Nm engine
936 API functions are called at all in an application, then there are
937 no inherent memory leaks to worry about from the
938 .Nm engine
939 functionality, however if any
940 .Vt ENGINE Ns s
941 are loaded, even if they are never registered or used, it is necessary
942 to use the
943 .Fn ENGINE_cleanup
944 function to correspondingly cleanup before program exit, if the caller
945 wishes to avoid memory leaks.
946 This mechanism uses an internal callback registration table so that any
947 .Nm engine
948 API functionality that knows it requires cleanup can register its
949 cleanup details to be called during
950 .Fn ENGINE_cleanup .
951 This approach allows
952 .Fn ENGINE_cleanup
953 to clean up after any
954 .Nm engine
955 functionality at all that your program uses, yet doesn't automatically
956 create linker dependencies to all possible
957 .Nm engine
958 functionality - only the cleanup callbacks required by the functionality
959 you do use will be required by the linker.
961 The fact that
962 .Vt ENGINE Ns s
963 are made visible to OpenSSL (and thus are linked into the program
964 and loaded into memory at run-time) does not mean they are "registered"
965 or called into use by OpenSSL automatically - that behaviour is
966 something for the application to control.
967 Some applications will want to allow the user to specify exactly which
968 .Vt ENGINE
969 they want used if any is to be used at all.
970 Others may prefer to load all support and have OpenSSL automatically use
971 at run-time any
972 .Vt ENGINE
973 that is able to successfully initialised - i.e. to assume that this
974 corresponds to acceleration hardware attached to the machine or
975 some such thing.
976 There are probably numerous other ways in which applications may prefer
977 to handle things, so we will simply illustrate the consequences as they
978 apply to a couple of simple cases and leave developers to consider these
979 and the source code to openssl's builtin utilities as guides.
981 .Em Using a specific ENGINE implementation
983 Here we'll assume an application has been configured by its user or
984 admin to want to use the "ACME"
985 .Vt ENGINE
986 if it is available in the version of OpenSSL the application was
987 compiled with.
988 If it is available, it should be used by default for all RSA, DSA, and
989 symmetric cipher operations, otherwise OpenSSL should use its builtin
990 software as usual.
991 The following code illustrates how to approach this:
992 .Bd -literal
993 ENGINE *e;
994 const char *engine_id = "ACME";
995 ENGINE_load_builtin_engines();
996 e = ENGINE_by_id(engine_id);
997 if (!e)
998         /* the engine isn't available */
999         return;
1000 if (!ENGINE_init(e)) {
1001         /* the engine couldn't initialise, release 'e' */
1002         ENGINE_free(e);
1003         return;
1005 if (!ENGINE_set_default_RSA(e))
1006         /* This should only happen when 'e' can't initialise, but the previous
1007          * statement suggests it did. */
1008         abort();
1009 ENGINE_set_default_DSA(e);
1010 ENGINE_set_default_ciphers(e);
1011 /* Release the functional reference from ENGINE_init() */
1012 ENGINE_finish(e);
1013 /* Release the structural reference from ENGINE_by_id() */
1014 ENGINE_free(e);
1017 .Em Automatically using builtin ENGINE implementations
1019 Here we'll assume we want to load and register all
1020 .Vt ENGINE
1021 implementations bundled with OpenSSL, such that for any cryptographic
1022 algorithm required by OpenSSL - if there is an
1023 .Vt ENGINE
1024 that implements it and can be initialised, it should be used.
1025 The following code illustrates how this can work;
1026 .Bd -literal
1027 /* Load all bundled ENGINEs into memory and make them visible */
1028 ENGINE_load_builtin_engines();
1029 /* Register all of them for every algorithm they collectively implement */
1030 ENGINE_register_all_complete();
1033 That's all that's required.
1034 For example, the next time OpenSSL tries to set up an RSA key, any bundled
1035 .Vt ENGINE Ns s
1036 that implement
1037 .Vt RSA_METHOD
1038 will be passed to
1039 .Fn ENGINE_init
1040 and if any of those succeed, that
1041 .Vt ENGINE
1042 will be set as the default for RSA use from then on.
1043 .Ss Advanced configuration support
1044 There is a mechanism supported by the
1045 .Nm engine
1046 framework that allows each
1047 .Vt ENGINE
1048 implementation to define an arbitrary set of configuration
1049 "commands" and expose them to OpenSSL and any applications based on
1050 OpenSSL.
1051 This mechanism is entirely based on the use of name-value pairs
1052 and assumes ASCII input (no unicode or UTF for now!), so it is ideal if
1053 applications want to provide a transparent way for users to provide
1054 arbitrary configuration "directives" directly to such
1055 .Vt ENGINE Ns s .
1056 It is also possible for the application to dynamically interrogate the
1057 loaded
1058 .Vt ENGINE
1059 implementations for the names, descriptions, and input flags of
1060 their available "control commands", providing a more flexible
1061 configuration scheme.
1062 However, if the user is expected to know which
1063 .Vt ENGINE
1064 device he/she is using (in the case of specialised hardware, this
1065 goes without saying) then applications may not need to concern
1066 themselves with discovering the supported control commands and
1067 simply prefer to pass settings into
1068 .Vt ENGINE s
1069 exactly as they are provided by the user.
1071 Before illustrating how control commands work, it is worth mentioning
1072 what they are typically used for.
1073 Broadly speaking there are two uses for control commands; the first is
1074 to provide the necessary details to the implementation (which may know
1075 nothing at all specific to the host system) so that it can be
1076 initialised for use.
1077 This could include the path to any driver or config files it needs to
1078 load, required network addresses, smart-card identifiers, passwords to
1079 initialise protected devices, logging information, etc.
1080 This class of commands typically needs to be passed to an
1081 .Vt ENGINE
1082 .Sy before
1083 attempting to initialise it, i.e. before calling
1084 .Fn ENGINE_init .
1085 The other class of commands consist of settings or operations that tweak
1086 certain behaviour or cause certain operations to take place, and these
1087 commands may work either before or after
1088 .Fn ENGINE_init ,
1089 or in some cases both.
1090 .Vt ENGINE
1091 implementations should provide indications of this in the descriptions
1092 attached to builtin control commands and/or in external product
1093 documentation.
1095 .Em Issuing control commands to an ENGINE
1097 Let's illustrate by example; a function for which the caller supplies
1098 the name of the
1099 .Vt ENGINE
1100 it wishes to use, a table of string-pairs for use before initialisation,
1101 and another table for use after initialisation.
1102 Note that the string-pairs used for control commands consist of a
1103 command "name" followed by the command "parameter" - the parameter
1104 could be
1105 .Dv NULL
1106 in some cases but the name cannot.
1107 This function should initialise the
1108 .Vt ENGINE
1109 (issuing the "pre" commands beforehand and the "post" commands
1110 afterwards) and set it as the default for everything except RAND
1111 and then return a boolean success or failure.
1112 .Bd -literal
1114 generic_load_engine_fn(const char *engine_id,
1115     const char **pre_cmds, int pre_num,
1116     const char **post_cmds, int post_num)
1118         ENGINE *e = ENGINE_by_id(engine_id);
1120         if (!e)
1121                 return 0;
1122         while (pre_num--) {
1123                 if (!ENGINE_ctrl_cmd_string(e,
1124                     pre_cmds[0], pre_cmds[1], 0)) {
1125                         fprintf(stderr,
1126                             "Failed command (%s - %s:%s)\en",
1127                             engine_id, pre_cmds[0],
1128                             pre_cmds[1] ? pre_cmds[1] : "(NULL)");
1129                         ENGINE_free(e);
1130                         return 0;
1131                 }
1132                 pre_cmds += 2;
1133         }
1134         if (!ENGINE_init(e)) {
1135                 fprintf(stderr, "Failed initialisation\en");
1136                 ENGINE_free(e);
1137                 return 0;
1138         }
1139         /*
1140          * ENGINE_init() returned a functional reference,
1141          * so free the structural reference from
1142          * ENGINE_by_id().
1143          */
1144         ENGINE_free(e);
1145         while (post_num--) {
1146                 if (!ENGINE_ctrl_cmd_string(e,
1147                     post_cmds[0], post_cmds[1], 0)) {
1148                         fprintf(stderr,
1149                             "Failed command (%s - %s:%s)\en",
1150                             engine_id, post_cmds[0],
1151                             post_cmds[1] ? post_cmds[1] : "(NULL)");
1152                         ENGINE_finish(e);
1153                         return 0;
1154                 }
1155                 post_cmds += 2;
1156         }
1157         ENGINE_set_default(e, ENGINE_METHOD_ALL & ~ENGINE_METHOD_RAND);
1158         /* Success */
1159         return 1;
1163 Note that
1164 .Fn ENGINE_ctrl_cmd_string
1165 accepts a boolean argument that can relax the semantics of the function.
1166 If set to non-zero it will only return failure if the
1167 .Vt ENGINE
1168 supported the given command name but failed while executing it, if the
1169 .Vt ENGINE
1170 doesn't support the command name it will simply return success without
1171 doing anything.
1172 In this case we assume the user is only supplying commands specific to
1173 the given
1174 .Vt ENGINE
1175 so we set this to FALSE.
1177 .Em Discovering supported control commands
1179 It is possible to discover at run-time the names, numerical-ids,
1180 descriptions and input parameters of the control commands supported by an
1181 .Vt ENGINE
1182 using a structural reference.
1183 Note that some control commands are defined by OpenSSL itself and it
1184 will intercept and handle these control commands on behalf of the
1185 .Vt ENGINE ,
1186 i.e. the
1187 .Vt ENGINE Ap s
1188 ctrl() handler is not used for the control command.
1189 .In openssl/engine.h
1190 defines an index,
1191 .Dv ENGINE_CMD_BASE ,
1192 that all control commands implemented by
1193 .Vt ENGINE Ns s
1194 should be numbered from.
1195 Any command value lower than this symbol is considered a "generic"
1196 command is handled directly by the OpenSSL core routines.
1198 It is using these "core" control commands that one can discover the
1199 control commands implemented by a given
1200 .Vt ENGINE ,
1201 specifically the commands:
1202 .Bd -literal
1203 #define ENGINE_HAS_CTRL_FUNCTION                10
1204 #define ENGINE_CTRL_GET_FIRST_CMD_TYPE          11
1205 #define ENGINE_CTRL_GET_NEXT_CMD_TYPE           12
1206 #define ENGINE_CTRL_GET_CMD_FROM_NAME           13
1207 #define ENGINE_CTRL_GET_NAME_LEN_FROM_CMD       14
1208 #define ENGINE_CTRL_GET_NAME_FROM_CMD           15
1209 #define ENGINE_CTRL_GET_DESC_LEN_FROM_CMD       16
1210 #define ENGINE_CTRL_GET_DESC_FROM_CMD           17
1211 #define ENGINE_CTRL_GET_CMD_FLAGS               18
1214 Whilst these commands are automatically processed by the OpenSSL
1215 framework code, they use various properties exposed by each
1216 .Vt ENGINE
1217 to process these queries.
1219 .Vt ENGINE
1220 has 3 properties it exposes that can affect how this behaves;
1221 it can supply a ctrl() handler, it can specify
1222 .Dv ENGINE_FLAGS_MANUAL_CMD_CTRL
1223 in the
1224 .Vt ENGINE Ap s
1225 flags, and it can expose an array of control command descriptions.
1226 If an
1227 .Vt ENGINE
1228 specifies the
1229 .Dv ENGINE_FLAGS_MANUAL_CMD_CTRL
1230 flag, then it will simply pass all these "core" control commands
1231 directly to the
1232 .Vt ENGINE Ap s
1233 ctrl() handler (and thus, it must have supplied one), so it is up
1234 to the
1235 .Vt ENGINE
1236 to reply to these "discovery" commands itself.
1237 If that flag is not set, then the OpenSSL framework code will work with
1238 the following rules;
1239 .Bl -tag -width Ds
1240 .It If no ctrl() handler is supplied:
1241 .Dv ENGINE_HAS_CTRL_FUNCTION
1242 returns FALSE (zero), all other commands fail.
1243 .It If a ctrl() handler was supplied but no array of control commands:
1244 .Dv ENGINE_HAS_CTRL_FUNCTION
1245 returns TRUE, all other commands fail.
1246 .It If a ctrl() handler and array of control commands was supplied:
1247 .Dv ENGINE_HAS_CTRL_FUNCTION
1248 returns TRUE, all other commands proceed processing...
1251 If the
1252 .Vt ENGINE Ns s
1253 array of control commands is empty, then all other commands will fail.
1254 Otherwise
1255 .Dv ENGINE_CTRL_GET_FIRST_CMD_TYPE
1256 returns the identifier of the first command supported by the
1257 .Vt ENGINE ,
1258 .Dv ENGINE_GET_NEXT_CMD_TYPE
1259 takes the identifier of a command supported by the
1260 .Vt ENGINE
1261 and returns the next command identifier or fails if there are no more,
1262 .Dv ENGINE_CMD_FROM_NAME
1263 takes a string name for a command and returns the corresponding
1264 identifier or fails if no such command name exists, and the remaining
1265 commands take a command identifier and return properties of the
1266 corresponding commands.
1267 All except
1268 .Dv ENGINE_CTRL_GET_FLAGS
1269 return the string length of a command name or description, or
1270 populate a supplied character buffer with a copy of the command
1271 name or description.
1272 .Dv ENGINE_CTRL_GET_FLAGS
1273 returns a bitwise-OR'd mask of the following possible values:
1274 .Bd -literal
1275 #define ENGINE_CMD_FLAG_NUMERIC         (unsigned int)0x0001
1276 #define ENGINE_CMD_FLAG_STRING          (unsigned int)0x0002
1277 #define ENGINE_CMD_FLAG_NO_INPUT        (unsigned int)0x0004
1278 #define ENGINE_CMD_FLAG_INTERNAL        (unsigned int)0x0008
1281 If the
1282 .Dv ENGINE_CMD_FLAG_INTERNAL
1283 flag is set, then any other flags are purely informational to the caller.
1284 This flag will prevent the command being usable for any higher-level
1285 .Vt ENGINE
1286 functions such as
1287 .Fn ENGINE_ctrl_cmd_string .
1288 "INTERNAL" commands are not intended to be exposed to text-based
1289 configuration by applications, administrations, users, etc.
1290 These can support arbitrary operations via
1291 .Fn ENGINE_ctrl ,
1292 including passing to and/or from the control commands data of any
1293 arbitrary type.
1294 These commands are supported in the discovery mechanisms simply allow
1295 applications to determine if an
1296 .Vt ENGINE
1297 supports certain specific commands it might want to use (e.g.
1298 application "foo" might query various
1299 .Vt ENGINE Ns s
1300 to see if they implement "FOO_GET_VENDOR_LOGO_GIF" - and
1301 .Vt ENGINE
1302 could therefore decide whether or not to support this "foo"-specific
1303 extension).
1304 .Sh RETURN VALUES
1305 .Fn ENGINE_get_first ,
1306 .Fn ENGINE_get_last ,
1307 .Fn ENGINE_get_next ,
1308 .Fn ENGINE_get_prev ,
1309 .Fn ENGINE_by_id ,
1310 .Fn ENGINE_get_cipher_engine ,
1311 .Fn ENGINE_get_digest_engine ,
1312 .Fn ENGINE_new ,
1313 and all
1314 .Fn ENGINE_get_default_*
1315 functions return a valid
1316 .Vt ENGINE
1317 structure or
1318 .Dv NULL
1319 if an error occurred.
1321 .Fn ENGINE_add ,
1322 .Fn ENGINE_remove ,
1323 .Fn ENGINE_init ,
1324 .Fn ENGINE_finish ,
1325 .Fn ENGINE_ctrl_cmd ,
1326 .Fn ENGINE_ctrl_cmd_string ,
1327 .Fn ENGINE_free ,
1328 .Fn ENGINE_up_ref ,
1329 and all
1330 .Fn ENGINE_set_*
1332 .Fn ENGINE_register_*
1333 functions return 1 on success or 0 on error.
1335 .Fn ENGINE_get_table_flags
1336 returns an unsigned integer value representing the global table
1337 flags which are used to control the registration behaviour of
1338 .Vt ENGINE
1339 implementations.
1342 .Fn ENGINE_ctrl ,
1343 positive return values indicate success and negative return values
1344 indicate failure.
1345 The meaning of a zero return value depends on the particular
1346 .Fa cmd
1347 and may indicate both success and failure, which is pathetic.
1349 .Fn ENGINE_cmd_is_executable
1350 returns 1 if
1351 .Fa cmd
1352 is executable or 0 otherwise.
1354 .Fn ENGINE_get_id
1356 .Fn ENGINE_get_name
1357 return a pointer to an internal string representing the identifier
1358 and the name of
1359 .Fa e ,
1360 respectively.
1362 .Fn ENGINE_get_RSA ,
1363 .Fn ENGINE_get_DSA ,
1364 .Fn ENGINE_get_DH ,
1365 .Fn ENGINE_get_RAND ,
1367 .Fn ENGINE_get_STORE
1368 return a method structure for the respective algorithm.
1370 .Fn ENGINE_get_destroy_function ,
1371 .Fn ENGINE_get_init_function ,
1372 .Fn ENGINE_get_finish_function ,
1373 .Fn ENGINE_get_ctrl_function ,
1374 .Fn ENGINE_get_load_privkey_function ,
1375 .Fn ENGINE_get_load_pubkey_function ,
1376 .Fn ENGINE_get_ciphers ,
1378 .Fn ENGINE_get_digests
1379 return a function pointer to the respective callback.
1381 .Fn ENGINE_get_cipher
1382 returns a valid
1383 .Vt EVP_CIPHER
1384 structure on success or
1385 .Dv NULL
1386 if an error occurred.
1388 .Fn ENGINE_get_digest
1389 returns a valid
1390 .Vt EVP_MD
1391 structure on success or
1392 .Dv NULL
1393 if an error occurred.
1395 .Fn ENGINE_get_flags
1396 returns an integer representing the flags
1397 which are used to control various behaviours of an
1398 .Vt ENGINE .
1400 .Fn ENGINE_get_cmd_defns
1401 returns an
1402 .Vt ENGINE_CMD_DEFN
1403 structure or
1404 .Dv NULL
1405 if none is set.
1407 .Fn ENGINE_load_private_key
1409 .Fn ENGINE_load_public_key
1410 return a valid
1411 .Vt EVP_PKEY
1412 structure on success or
1413 .Dv NULL
1414 if an error occurred.
1415 .Sh SEE ALSO
1416 .Xr DH_new 3 ,
1417 .Xr DSA_new 3 ,
1418 .Xr ENGINE_add_conf_module 3 ,
1419 .Xr ENGINE_set_ex_data 3 ,
1420 .Xr RSA_new 3
1421 .Sh HISTORY
1422 The engine API first appeared in OpenSSL 0.9.7
1423 and has been available since
1424 .Ox 3.2 .