summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/man/engine.3
diff options
context:
space:
mode:
authorschwarze <>2018-04-15 01:43:45 +0000
committerschwarze <>2018-04-15 01:43:45 +0000
commit83e8d72fcb33da2c34c5964418ed6fa3b12d08c7 (patch)
treeb200b1089b2fc8e8d079bc4aa2d58db943197f7c /src/lib/libcrypto/man/engine.3
parentca2431d035ec6e4a115f384ff029c2316dd0d465 (diff)
downloadopenbsd-83e8d72fcb33da2c34c5964418ed6fa3b12d08c7.tar.gz
openbsd-83e8d72fcb33da2c34c5964418ed6fa3b12d08c7.tar.bz2
openbsd-83e8d72fcb33da2c34c5964418ed6fa3b12d08c7.zip
Rewrite the ENGINE_*(3) documentation from scratch (step 1,
covering 60% of the documented functions). The old, abominable engine(3) manual page shall die soon.
Diffstat (limited to 'src/lib/libcrypto/man/engine.3')
-rw-r--r--src/lib/libcrypto/man/engine.3557
1 files changed, 28 insertions, 529 deletions
diff --git a/src/lib/libcrypto/man/engine.3 b/src/lib/libcrypto/man/engine.3
index d93f06f024..fac4fa13e1 100644
--- a/src/lib/libcrypto/man/engine.3
+++ b/src/lib/libcrypto/man/engine.3
@@ -1,4 +1,4 @@
1.\" $OpenBSD: engine.3,v 1.14 2018/04/14 11:38:32 schwarze Exp $ 1.\" $OpenBSD: engine.3,v 1.15 2018/04/15 01:43:45 schwarze Exp $
2.\" full merge up to: OpenSSL crypto/engine e6390aca Jul 21 10:06:03 2015 -0400 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 3.\" selective merge up to: man3/ENGINE_add 1f13ad31 Dec 25 17:50:39 2017 +0800
4.\" 4.\"
@@ -51,77 +51,14 @@
51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 51.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
52.\" OF THE POSSIBILITY OF SUCH DAMAGE. 52.\" OF THE POSSIBILITY OF SUCH DAMAGE.
53.\" 53.\"
54.Dd $Mdocdate: April 14 2018 $ 54.Dd $Mdocdate: April 15 2018 $
55.Dt ENGINE 3 55.Dt ENGINE 3
56.Os 56.Os
57.Sh NAME 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 , 58.Nm ENGINE_load_openssl ,
68.Nm ENGINE_load_dynamic , 59.Nm ENGINE_load_dynamic ,
69.Nm ENGINE_load_cryptodev ,
70.Nm ENGINE_load_builtin_engines , 60.Nm ENGINE_load_builtin_engines ,
71.Nm ENGINE_cleanup , 61.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 , 62.Nm ENGINE_new ,
126.Nm ENGINE_free , 63.Nm ENGINE_free ,
127.Nm ENGINE_up_ref , 64.Nm ENGINE_up_ref ,
@@ -135,15 +72,11 @@
135.Nm ENGINE_set_RAND , 72.Nm ENGINE_set_RAND ,
136.Nm ENGINE_set_STORE , 73.Nm ENGINE_set_STORE ,
137.Nm ENGINE_set_destroy_function , 74.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 , 75.Nm ENGINE_set_load_privkey_function ,
142.Nm ENGINE_set_load_pubkey_function , 76.Nm ENGINE_set_load_pubkey_function ,
143.Nm ENGINE_set_ciphers , 77.Nm ENGINE_set_ciphers ,
144.Nm ENGINE_set_digests , 78.Nm ENGINE_set_digests ,
145.Nm ENGINE_set_flags , 79.Nm ENGINE_set_flags ,
146.Nm ENGINE_set_cmd_defns ,
147.Nm ENGINE_get_id , 80.Nm ENGINE_get_id ,
148.Nm ENGINE_get_name , 81.Nm ENGINE_get_name ,
149.Nm ENGINE_get_RSA , 82.Nm ENGINE_get_RSA ,
@@ -154,9 +87,6 @@
154.Nm ENGINE_get_RAND , 87.Nm ENGINE_get_RAND ,
155.Nm ENGINE_get_STORE , 88.Nm ENGINE_get_STORE ,
156.Nm ENGINE_get_destroy_function , 89.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 , 90.Nm ENGINE_get_load_privkey_function ,
161.Nm ENGINE_get_load_pubkey_function , 91.Nm ENGINE_get_load_pubkey_function ,
162.Nm ENGINE_get_ciphers , 92.Nm ENGINE_get_ciphers ,
@@ -164,248 +94,20 @@
164.Nm ENGINE_get_cipher , 94.Nm ENGINE_get_cipher ,
165.Nm ENGINE_get_digest , 95.Nm ENGINE_get_digest ,
166.Nm ENGINE_get_flags , 96.Nm ENGINE_get_flags ,
167.Nm ENGINE_get_cmd_defns ,
168.Nm ENGINE_load_private_key , 97.Nm ENGINE_load_private_key ,
169.Nm ENGINE_load_public_key 98.Nm ENGINE_load_public_key
170.Nd ENGINE cryptographic module support 99.Nd ENGINE cryptographic module support
171.Sh SYNOPSIS 100.Sh SYNOPSIS
172.In openssl/engine.h 101.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"
180.Fc
181.Ft ENGINE *
182.Fo ENGINE_get_prev
183.Fa "ENGINE *e"
184.Fc
185.Ft int
186.Fo ENGINE_add
187.Fa "ENGINE *e"
188.Fc
189.Ft int
190.Fo ENGINE_remove
191.Fa "ENGINE *e"
192.Fc
193.Ft ENGINE *
194.Fo ENGINE_by_id
195.Fa "const char *id"
196.Fc
197.Ft int
198.Fo ENGINE_init
199.Fa "ENGINE *e"
200.Fc
201.Ft int
202.Fo ENGINE_finish
203.Fa "ENGINE *e"
204.Fc
205.Ft void 102.Ft void
206.Fn ENGINE_load_openssl void 103.Fn ENGINE_load_openssl void
207.Ft void 104.Ft void
208.Fn ENGINE_load_dynamic void 105.Fn ENGINE_load_dynamic void
209.Ft void 106.Ft void
210.Fn ENGINE_load_cryptodev void
211.Ft void
212.Fn ENGINE_load_builtin_engines void 107.Fn ENGINE_load_builtin_engines void
213.Ft void 108.Ft void
214.Fn ENGINE_cleanup void 109.Fn ENGINE_cleanup void
215.Ft ENGINE * 110.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"
230.Fc
231.Ft ENGINE *
232.Fo ENGINE_get_digest_engine
233.Fa "int nid"
234.Fc
235.Ft int
236.Fo ENGINE_set_default_RSA
237.Fa "ENGINE *e"
238.Fc
239.Ft int
240.Fo ENGINE_set_default_DSA
241.Fa "ENGINE *e"
242.Fc
243.Ft int
244.Fo ENGINE_set_default_ECDH
245.Fa "ENGINE *e"
246.Fc
247.Ft int
248.Fo ENGINE_set_default_ECDSA
249.Fa "ENGINE *e"
250.Fc
251.Ft int
252.Fo ENGINE_set_default_DH
253.Fa "ENGINE *e"
254.Fc
255.Ft int
256.Fo ENGINE_set_default_RAND
257.Fa "ENGINE *e"
258.Fc
259.Ft int
260.Fo ENGINE_set_default_ciphers
261.Fa "ENGINE *e"
262.Fc
263.Ft int
264.Fo ENGINE_set_default_digests
265.Fa "ENGINE *e"
266.Fc
267.Ft int
268.Fo ENGINE_set_default_string
269.Fa "ENGINE *e"
270.Fa "const char *list"
271.Fc
272.Ft int
273.Fo ENGINE_set_default
274.Fa "ENGINE *e"
275.Fa "unsigned int flags"
276.Fc
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"
282.Fc
283.Ft int
284.Fo ENGINE_register_RSA
285.Fa "ENGINE *e"
286.Fc
287.Ft void
288.Fo ENGINE_unregister_RSA
289.Fa "ENGINE *e"
290.Fc
291.Ft void
292.Fn ENGINE_register_all_RSA void
293.Ft int
294.Fo ENGINE_register_DSA
295.Fa "ENGINE *e"
296.Fc
297.Ft void
298.Fo ENGINE_unregister_DSA
299.Fa "ENGINE *e"
300.Fc
301.Ft void
302.Fn ENGINE_register_all_DSA void
303.Ft int
304.Fo ENGINE_register_ECDH
305.Fa "ENGINE *e"
306.Fc
307.Ft void
308.Fo ENGINE_unregister_ECDH
309.Fa "ENGINE *e"
310.Fc
311.Ft void
312.Fn ENGINE_register_all_ECDH void
313.Ft int
314.Fo ENGINE_register_ECDSA
315.Fa "ENGINE *e"
316.Fc
317.Ft void
318.Fo ENGINE_unregister_ECDSA
319.Fa "ENGINE *e"
320.Fc
321.Ft void
322.Fn ENGINE_register_all_ECDSA void
323.Ft int
324.Fo ENGINE_register_DH
325.Fa "ENGINE *e"
326.Fc
327.Ft void
328.Fo ENGINE_unregister_DH
329.Fa "ENGINE *e"
330.Fc
331.Ft void
332.Fn ENGINE_register_all_DH void
333.Ft int
334.Fo ENGINE_register_RAND
335.Fa "ENGINE *e"
336.Fc
337.Ft void
338.Fo ENGINE_unregister_RAND
339.Fa "ENGINE *e"
340.Fc
341.Ft void
342.Fn ENGINE_register_all_RAND void
343.Ft int
344.Fo ENGINE_register_STORE
345.Fa "ENGINE *e"
346.Fc
347.Ft void
348.Fo ENGINE_unregister_STORE
349.Fa "ENGINE *e"
350.Fc
351.Ft void
352.Fn ENGINE_register_all_STORE void
353.Ft int
354.Fo ENGINE_register_ciphers
355.Fa "ENGINE *e"
356.Fc
357.Ft void
358.Fo ENGINE_unregister_ciphers
359.Fa "ENGINE *e"
360.Fc
361.Ft void
362.Fn ENGINE_register_all_ciphers void
363.Ft int
364.Fo ENGINE_register_digests
365.Fa "ENGINE *e"
366.Fc
367.Ft void
368.Fo ENGINE_unregister_digests
369.Fa "ENGINE *e"
370.Fc
371.Ft void
372.Fn ENGINE_register_all_digests void
373.Ft int
374.Fo ENGINE_register_complete
375.Fa "ENGINE *e"
376.Fc
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)"
386.Fc
387.Ft int
388.Fo ENGINE_cmd_is_executable
389.Fa "ENGINE *e"
390.Fa "int cmd"
391.Fc
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"
400.Fc
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"
407.Fc
408.Ft ENGINE *
409.Fn ENGINE_new void 111.Fn ENGINE_new void
410.Ft int 112.Ft int
411.Fo ENGINE_free 113.Fo ENGINE_free
@@ -466,21 +168,6 @@
466.Fa "ENGINE_GEN_INT_FUNC_PTR destroy_f" 168.Fa "ENGINE_GEN_INT_FUNC_PTR destroy_f"
467.Fc 169.Fc
468.Ft int 170.Ft int
469.Fo ENGINE_set_init_function
470.Fa "ENGINE *e"
471.Fa "ENGINE_GEN_INT_FUNC_PTR init_f"
472.Fc
473.Ft int
474.Fo ENGINE_set_finish_function
475.Fa "ENGINE *e"
476.Fa "ENGINE_GEN_INT_FUNC_PTR finish_f"
477.Fc
478.Ft int
479.Fo ENGINE_set_ctrl_function
480.Fa "ENGINE *e"
481.Fa "ENGINE_CTRL_FUNC_PTR ctrl_f"
482.Fc
483.Ft int
484.Fo ENGINE_set_load_privkey_function 171.Fo ENGINE_set_load_privkey_function
485.Fa "ENGINE *e" 172.Fa "ENGINE *e"
486.Fa "ENGINE_LOAD_KEY_PTR loadpriv_f" 173.Fa "ENGINE_LOAD_KEY_PTR loadpriv_f"
@@ -505,11 +192,6 @@
505.Fa "ENGINE *e" 192.Fa "ENGINE *e"
506.Fa "int flags" 193.Fa "int flags"
507.Fc 194.Fc
508.Ft int
509.Fo ENGINE_set_cmd_defns
510.Fa "ENGINE *e"
511.Fa "const ENGINE_CMD_DEFN *defns"
512.Fc
513.Ft const char * 195.Ft const char *
514.Fo ENGINE_get_id 196.Fo ENGINE_get_id
515.Fa "const ENGINE *e" 197.Fa "const ENGINE *e"
@@ -550,18 +232,6 @@
550.Fo ENGINE_get_destroy_function 232.Fo ENGINE_get_destroy_function
551.Fa "const ENGINE *e" 233.Fa "const ENGINE *e"
552.Fc 234.Fc
553.Ft ENGINE_GEN_INT_FUNC_PTR
554.Fo ENGINE_get_init_function
555.Fa "const ENGINE *e"
556.Fc
557.Ft ENGINE_GEN_INT_FUNC_PTR
558.Fo ENGINE_get_finish_function
559.Fa "const ENGINE *e"
560.Fc
561.Ft ENGINE_CTRL_FUNC_PTR
562.Fo ENGINE_get_ctrl_function
563.Fa "const ENGINE *e"
564.Fc
565.Ft ENGINE_LOAD_KEY_PTR 235.Ft ENGINE_LOAD_KEY_PTR
566.Fo ENGINE_get_load_privkey_function 236.Fo ENGINE_get_load_privkey_function
567.Fa "const ENGINE *e" 237.Fa "const ENGINE *e"
@@ -592,10 +262,6 @@
592.Fo ENGINE_get_flags 262.Fo ENGINE_get_flags
593.Fa "const ENGINE *e" 263.Fa "const ENGINE *e"
594.Fc 264.Fc
595.Ft const ENGINE_CMD_DEFN *
596.Fo ENGINE_get_cmd_defns
597.Fa "const ENGINE *e"
598.Fc
599.Ft EVP_PKEY * 265.Ft EVP_PKEY *
600.Fo ENGINE_load_private_key 266.Fo ENGINE_load_private_key
601.Fa "ENGINE *e" 267.Fa "ENGINE *e"
@@ -712,20 +378,23 @@ and its functional reference count to 0.
712Many functions increment the structural reference count by 1 378Many functions increment the structural reference count by 1
713when successful. 379when successful.
714Some of them, including 380Some of them, including
715.Fn ENGINE_by_id , 381.Xr ENGINE_by_id 3 ,
716.Fn ENGINE_get_first , 382.Xr ENGINE_get_first 3 ,
717.Fn ENGINE_get_last , 383.Xr ENGINE_get_last 3 ,
718.Fn ENGINE_get_next , 384.Xr ENGINE_get_next 3 ,
719and 385and
720.Fn ENGINE_get_prev , 386.Xr ENGINE_get_prev 3 ,
721do so because they return a structural reference to the user. 387do so because they return a structural reference to the user.
722Other functions, including 388Other functions, including
723.Fn ENGINE_add , 389.Xr ENGINE_add 3 ,
724.Fn ENGINE_init , 390.Xr ENGINE_init 3 ,
725.Fn ENGINE_get_default_* , 391.Xr ENGINE_get_cipher_engine 3 ,
726.Fn ENGINE_get_*_engine , 392.Xr ENGINE_get_digest_engine 3 ,
393and the
394.Xr ENGINE_get_default_RSA 3
727and 395and
728.Fn ENGINE_set_default_* , 396.Xr ENGINE_set_default 3
397families of functions
729do so because they store a structural refence internally. 398do so because they store a structural refence internally.
730.Fn ENGINE_up_ref 399.Fn ENGINE_up_ref
731explicitly increment the structural reference count by 1. 400explicitly increment the structural reference count by 1.
@@ -747,144 +416,17 @@ pointer, no action occurs.
747Many functions internally call the equivalent of 416Many functions internally call the equivalent of
748.Fn ENGINE_free . 417.Fn ENGINE_free .
749Some of them, including 418Some of them, including
750.Fn ENGINE_get_next 419.Xr ENGINE_get_next 3
751and 420and
752.Fn ENGINE_get_prev , 421.Xr ENGINE_get_prev 3 ,
753thus invalidate the structural reference passed in by the user. 422thus invalidate the structural reference passed in by the user.
754Other functions, including 423Other functions, including
755.Fn ENGINE_finish , 424.Xr ENGINE_finish 3 ,
756.Fn ENGINE_remove , 425.Xr ENGINE_remove 3 ,
757.Fn ENGINE_get_default_* , 426and the
758.Fn ENGINE_get_*_engine , 427.Xr ENGINE_set_default 3
759and 428family of functions
760.Fn ENGINE_set_default_* ,
761do so when an internally stored structural reference is no longer needed. 429do so when an internally stored structural reference is no longer needed.
762.Pp
763.Em Functional references
764.Pp
765As mentioned, functional references exist when the cryptographic
766functionality of an
767.Vt ENGINE
768is required to be available.
769A functional reference can be obtained in one of two ways; from an
770existing structural reference to the required
771.Vt ENGINE ,
772or by asking OpenSSL for the default operational
773.Vt ENGINE
774for a given cryptographic purpose.
775.Pp
776To obtain a functional reference from an existing structural reference,
777call the
778.Fn ENGINE_init
779function.
780This returns zero if the
781.Vt ENGINE
782was not already operational and couldn't be successfully initialised
783(e.g. lack of system drivers, no special hardware attached),
784otherwise it will return non-zero to indicate that the
785.Vt ENGINE
786is now operational and will have allocated a new
787.Sy functional
788reference to the
789.Vt ENGINE .
790All functional references are released by calling
791.Fn ENGINE_finish ,
792which removes the implicit structural reference as well.
793.Pp
794The second way to get a functional reference is by asking OpenSSL for a
795default implementation for a given task, e.g.
796by
797.Fn ENGINE_get_default_RSA ,
798.Fn ENGINE_get_default_cipher_engine ,
799etc.
800These are discussed in the next section, though they are not usually
801required by application programmers as they are used automatically when
802creating and using the relevant algorithm-specific types in OpenSSL,
803such as RSA, DSA, EVP_CIPHER_CTX, etc.
804.Ss Default implementations
805For each supported abstraction, the
806.Nm engine
807code maintains an internal table of state to control which
808implementations are available for a given abstraction and which
809should be used by default.
810These implementations are registered in the tables and indexed by an
811.Fa nid
812value, because abstractions like
813.Vt EVP_CIPHER
814and
815.Vt EVP_DIGEST
816support many distinct algorithms and modes, and
817.Vt ENGINE Ns s
818can support arbitrarily many of them.
819In the case of other abstractions like RSA, DSA, etc., there is
820only one "algorithm" so all implementations implicitly register
821using the same
822.Fa nid
823index.
824.Pp
825When a default
826.Vt ENGINE
827is requested for a given abstraction/algorithm/mode, (e.g. when
828calling
829.Fn RSA_new_method NULL ) ,
830a "get_default" call will be made to the
831.Nm engine
832subsystem to process the corresponding state table and return
833a functional reference to an initialised
834.Vt ENGINE
835whose implementation should be used.
836If no
837.Vt ENGINE
838should (or can) be used, it will return
839.Dv NULL
840and the caller will operate with a
841.Dv NULL
842.Vt ENGINE
843handle.
844This usually equates to using the conventional software implementation.
845In the latter case, OpenSSL will from then on behave the way it used to
846before the
847.Nm engine
848API existed.
849.Pp
850Each state table has a flag to note whether it has processed this
851"get_default" query since the table was last modified, because to
852process this question it must iterate across all the registered
853.Vt ENGINE Ns s
854in the table trying to initialise each of them in turn, in case one of
855them is operational.
856If it returns a functional reference to an
857.Vt ENGINE ,
858it will also cache another reference to speed up processing future
859queries (without needing to iterate across the table).
860Likewise, it will cache a
861.Dv NULL
862response if no
863.Vt ENGINE
864was available so that future queries won't repeat the same iteration
865unless the state table changes.
866This behaviour can also be changed; if the
867.Dv ENGINE_TABLE_FLAG_NOINIT
868flag is set (using
869.Fn ENGINE_set_table_flags ) ,
870no attempted initialisations will take place, instead the only way for
871the state table to return a
872.Pf non- Dv NULL
873.Vt ENGINE
874to the "get_default" query will be if one is expressly set in the table.
875For example,
876.Fn ENGINE_set_default_RSA
877does the same job as
878.Fn ENGINE_register_RSA
879except that it also sets the state table's cached response for the
880"get_default" query.
881In the case of abstractions like
882.Vt EVP_CIPHER ,
883where implementations are indexed by
884.Fa nid ,
885these flags and cached-responses are distinct for each
886.Fa nid
887value.
888.Ss Application requirements 430.Ss Application requirements
889This section will explain the basic things an application programmer 431This section will explain the basic things an application programmer
890should support to make the most useful elements of the 432should support to make the most useful elements of the
@@ -1029,7 +571,7 @@ For example, the next time OpenSSL tries to set up an RSA key, any bundled
1029that implement 571that implement
1030.Vt RSA_METHOD 572.Vt RSA_METHOD
1031will be passed to 573will be passed to
1032.Fn ENGINE_init 574.Xr ENGINE_init 3
1033and if any of those succeed, that 575and if any of those succeed, that
1034.Vt ENGINE 576.Vt ENGINE
1035will be set as the default for RSA use from then on. 577will be set as the default for RSA use from then on.
@@ -1074,11 +616,11 @@ This class of commands typically needs to be passed to an
1074.Vt ENGINE 616.Vt ENGINE
1075.Sy before 617.Sy before
1076attempting to initialise it, i.e. before calling 618attempting to initialise it, i.e. before calling
1077.Fn ENGINE_init . 619.Xr ENGINE_init 3 .
1078The other class of commands consist of settings or operations that tweak 620The other class of commands consist of settings or operations that tweak
1079certain behaviour or cause certain operations to take place, and these 621certain behaviour or cause certain operations to take place, and these
1080commands may work either before or after 622commands may work either before or after
1081.Fn ENGINE_init , 623.Xr ENGINE_init 3 ,
1082or in some cases both. 624or in some cases both.
1083.Vt ENGINE 625.Vt ENGINE
1084implementations should provide indications of this in the descriptions 626implementations should provide indications of this in the descriptions
@@ -1295,55 +837,22 @@ to see if they implement "FOO_GET_VENDOR_LOGO_GIF" - and
1295could therefore decide whether or not to support this "foo"-specific 837could therefore decide whether or not to support this "foo"-specific
1296extension). 838extension).
1297.Sh RETURN VALUES 839.Sh RETURN VALUES
1298.Fn ENGINE_get_first ,
1299.Fn ENGINE_get_last ,
1300.Fn ENGINE_get_next ,
1301.Fn ENGINE_get_prev ,
1302.Fn ENGINE_by_id ,
1303.Fn ENGINE_get_cipher_engine , 840.Fn ENGINE_get_cipher_engine ,
1304.Fn ENGINE_get_digest_engine , 841.Fn ENGINE_get_digest_engine ,
1305.Fn ENGINE_new , 842and
1306and all 843.Fn ENGINE_new
1307.Fn ENGINE_get_default_* 844return a valid
1308functions return a valid
1309.Vt ENGINE 845.Vt ENGINE
1310structure or 846structure or
1311.Dv NULL 847.Dv NULL
1312if an error occurred. 848if an error occurred.
1313.Pp 849.Pp
1314.Fn ENGINE_add ,
1315.Fn ENGINE_remove ,
1316.Fn ENGINE_init ,
1317.Fn ENGINE_finish ,
1318.Fn ENGINE_ctrl_cmd ,
1319.Fn ENGINE_ctrl_cmd_string ,
1320.Fn ENGINE_free , 850.Fn ENGINE_free ,
1321.Fn ENGINE_up_ref , 851.Fn ENGINE_up_ref ,
1322and all 852and all
1323.Fn ENGINE_set_* 853.Fn ENGINE_set_*
1324and
1325.Fn ENGINE_register_*
1326functions return 1 on success or 0 on error. 854functions return 1 on success or 0 on error.
1327.Pp 855.Pp
1328.Fn ENGINE_get_table_flags
1329returns an unsigned integer value representing the global table
1330flags which are used to control the registration behaviour of
1331.Vt ENGINE
1332implementations.
1333.Pp
1334For
1335.Fn ENGINE_ctrl ,
1336positive return values indicate success and negative return values
1337indicate failure.
1338The meaning of a zero return value depends on the particular
1339.Fa cmd
1340and may indicate both success and failure, which is pathetic.
1341.Pp
1342.Fn ENGINE_cmd_is_executable
1343returns 1 if
1344.Fa cmd
1345is executable or 0 otherwise.
1346.Pp
1347.Fn ENGINE_get_id 856.Fn ENGINE_get_id
1348and 857and
1349.Fn ENGINE_get_name 858.Fn ENGINE_get_name
@@ -1361,9 +870,6 @@ and
1361return a method structure for the respective algorithm. 870return a method structure for the respective algorithm.
1362.Pp 871.Pp
1363.Fn ENGINE_get_destroy_function , 872.Fn ENGINE_get_destroy_function ,
1364.Fn ENGINE_get_init_function ,
1365.Fn ENGINE_get_finish_function ,
1366.Fn ENGINE_get_ctrl_function ,
1367.Fn ENGINE_get_load_privkey_function , 873.Fn ENGINE_get_load_privkey_function ,
1368.Fn ENGINE_get_load_pubkey_function , 874.Fn ENGINE_get_load_pubkey_function ,
1369.Fn ENGINE_get_ciphers , 875.Fn ENGINE_get_ciphers ,
@@ -1390,13 +896,6 @@ returns an integer representing the flags
1390which are used to control various behaviours of an 896which are used to control various behaviours of an
1391.Vt ENGINE . 897.Vt ENGINE .
1392.Pp 898.Pp
1393.Fn ENGINE_get_cmd_defns
1394returns an
1395.Vt ENGINE_CMD_DEFN
1396structure or
1397.Dv NULL
1398if none is set.
1399.Pp
1400.Fn ENGINE_load_private_key 899.Fn ENGINE_load_private_key
1401and 900and
1402.Fn ENGINE_load_public_key 901.Fn ENGINE_load_public_key