summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/doc/engine.pod
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/doc/engine.pod')
-rw-r--r--src/lib/libcrypto/doc/engine.pod212
1 files changed, 95 insertions, 117 deletions
diff --git a/src/lib/libcrypto/doc/engine.pod b/src/lib/libcrypto/doc/engine.pod
index c77dad5562..f5ab1c3e50 100644
--- a/src/lib/libcrypto/doc/engine.pod
+++ b/src/lib/libcrypto/doc/engine.pod
@@ -23,21 +23,26 @@ engine - ENGINE cryptographic module support
23 23
24 void ENGINE_load_openssl(void); 24 void ENGINE_load_openssl(void);
25 void ENGINE_load_dynamic(void); 25 void ENGINE_load_dynamic(void);
26 void ENGINE_load_cswift(void); 26 #ifndef OPENSSL_NO_STATIC_ENGINE
27 void ENGINE_load_chil(void); 27 void ENGINE_load_4758cca(void);
28 void ENGINE_load_aep(void);
28 void ENGINE_load_atalla(void); 29 void ENGINE_load_atalla(void);
30 void ENGINE_load_chil(void);
31 void ENGINE_load_cswift(void);
32 void ENGINE_load_gmp(void);
29 void ENGINE_load_nuron(void); 33 void ENGINE_load_nuron(void);
30 void ENGINE_load_ubsec(void);
31 void ENGINE_load_aep(void);
32 void ENGINE_load_sureware(void); 34 void ENGINE_load_sureware(void);
33 void ENGINE_load_4758cca(void); 35 void ENGINE_load_ubsec(void);
34 void ENGINE_load_openbsd_dev_crypto(void); 36 #endif
37 void ENGINE_load_cryptodev(void);
35 void ENGINE_load_builtin_engines(void); 38 void ENGINE_load_builtin_engines(void);
36 39
37 void ENGINE_cleanup(void); 40 void ENGINE_cleanup(void);
38 41
39 ENGINE *ENGINE_get_default_RSA(void); 42 ENGINE *ENGINE_get_default_RSA(void);
40 ENGINE *ENGINE_get_default_DSA(void); 43 ENGINE *ENGINE_get_default_DSA(void);
44 ENGINE *ENGINE_get_default_ECDH(void);
45 ENGINE *ENGINE_get_default_ECDSA(void);
41 ENGINE *ENGINE_get_default_DH(void); 46 ENGINE *ENGINE_get_default_DH(void);
42 ENGINE *ENGINE_get_default_RAND(void); 47 ENGINE *ENGINE_get_default_RAND(void);
43 ENGINE *ENGINE_get_cipher_engine(int nid); 48 ENGINE *ENGINE_get_cipher_engine(int nid);
@@ -45,6 +50,8 @@ engine - ENGINE cryptographic module support
45 50
46 int ENGINE_set_default_RSA(ENGINE *e); 51 int ENGINE_set_default_RSA(ENGINE *e);
47 int ENGINE_set_default_DSA(ENGINE *e); 52 int ENGINE_set_default_DSA(ENGINE *e);
53 int ENGINE_set_default_ECDH(ENGINE *e);
54 int ENGINE_set_default_ECDSA(ENGINE *e);
48 int ENGINE_set_default_DH(ENGINE *e); 55 int ENGINE_set_default_DH(ENGINE *e);
49 int ENGINE_set_default_RAND(ENGINE *e); 56 int ENGINE_set_default_RAND(ENGINE *e);
50 int ENGINE_set_default_ciphers(ENGINE *e); 57 int ENGINE_set_default_ciphers(ENGINE *e);
@@ -62,12 +69,21 @@ engine - ENGINE cryptographic module support
62 int ENGINE_register_DSA(ENGINE *e); 69 int ENGINE_register_DSA(ENGINE *e);
63 void ENGINE_unregister_DSA(ENGINE *e); 70 void ENGINE_unregister_DSA(ENGINE *e);
64 void ENGINE_register_all_DSA(void); 71 void ENGINE_register_all_DSA(void);
72 int ENGINE_register_ECDH(ENGINE *e);
73 void ENGINE_unregister_ECDH(ENGINE *e);
74 void ENGINE_register_all_ECDH(void);
75 int ENGINE_register_ECDSA(ENGINE *e);
76 void ENGINE_unregister_ECDSA(ENGINE *e);
77 void ENGINE_register_all_ECDSA(void);
65 int ENGINE_register_DH(ENGINE *e); 78 int ENGINE_register_DH(ENGINE *e);
66 void ENGINE_unregister_DH(ENGINE *e); 79 void ENGINE_unregister_DH(ENGINE *e);
67 void ENGINE_register_all_DH(void); 80 void ENGINE_register_all_DH(void);
68 int ENGINE_register_RAND(ENGINE *e); 81 int ENGINE_register_RAND(ENGINE *e);
69 void ENGINE_unregister_RAND(ENGINE *e); 82 void ENGINE_unregister_RAND(ENGINE *e);
70 void ENGINE_register_all_RAND(void); 83 void ENGINE_register_all_RAND(void);
84 int ENGINE_register_STORE(ENGINE *e);
85 void ENGINE_unregister_STORE(ENGINE *e);
86 void ENGINE_register_all_STORE(void);
71 int ENGINE_register_ciphers(ENGINE *e); 87 int ENGINE_register_ciphers(ENGINE *e);
72 void ENGINE_unregister_ciphers(ENGINE *e); 88 void ENGINE_unregister_ciphers(ENGINE *e);
73 void ENGINE_register_all_ciphers(void); 89 void ENGINE_register_all_ciphers(void);
@@ -77,12 +93,12 @@ engine - ENGINE cryptographic module support
77 int ENGINE_register_complete(ENGINE *e); 93 int ENGINE_register_complete(ENGINE *e);
78 int ENGINE_register_all_complete(void); 94 int ENGINE_register_all_complete(void);
79 95
80 int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()); 96 int ENGINE_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void));
81 int ENGINE_cmd_is_executable(ENGINE *e, int cmd); 97 int ENGINE_cmd_is_executable(ENGINE *e, int cmd);
82 int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name, 98 int ENGINE_ctrl_cmd(ENGINE *e, const char *cmd_name,
83 long i, void *p, void (*f)(), int cmd_optional); 99 long i, void *p, void (*f)(void), int cmd_optional);
84 int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg, 100 int ENGINE_ctrl_cmd_string(ENGINE *e, const char *cmd_name, const char *arg,
85 int cmd_optional); 101 int cmd_optional);
86 102
87 int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg); 103 int ENGINE_set_ex_data(ENGINE *e, int idx, void *arg);
88 void *ENGINE_get_ex_data(const ENGINE *e, int idx); 104 void *ENGINE_get_ex_data(const ENGINE *e, int idx);
@@ -92,13 +108,17 @@ engine - ENGINE cryptographic module support
92 108
93 ENGINE *ENGINE_new(void); 109 ENGINE *ENGINE_new(void);
94 int ENGINE_free(ENGINE *e); 110 int ENGINE_free(ENGINE *e);
111 int ENGINE_up_ref(ENGINE *e);
95 112
96 int ENGINE_set_id(ENGINE *e, const char *id); 113 int ENGINE_set_id(ENGINE *e, const char *id);
97 int ENGINE_set_name(ENGINE *e, const char *name); 114 int ENGINE_set_name(ENGINE *e, const char *name);
98 int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth); 115 int ENGINE_set_RSA(ENGINE *e, const RSA_METHOD *rsa_meth);
99 int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth); 116 int ENGINE_set_DSA(ENGINE *e, const DSA_METHOD *dsa_meth);
117 int ENGINE_set_ECDH(ENGINE *e, const ECDH_METHOD *dh_meth);
118 int ENGINE_set_ECDSA(ENGINE *e, const ECDSA_METHOD *dh_meth);
100 int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth); 119 int ENGINE_set_DH(ENGINE *e, const DH_METHOD *dh_meth);
101 int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth); 120 int ENGINE_set_RAND(ENGINE *e, const RAND_METHOD *rand_meth);
121 int ENGINE_set_STORE(ENGINE *e, const STORE_METHOD *rand_meth);
102 int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f); 122 int ENGINE_set_destroy_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR destroy_f);
103 int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f); 123 int ENGINE_set_init_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR init_f);
104 int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f); 124 int ENGINE_set_finish_function(ENGINE *e, ENGINE_GEN_INT_FUNC_PTR finish_f);
@@ -114,8 +134,11 @@ engine - ENGINE cryptographic module support
114 const char *ENGINE_get_name(const ENGINE *e); 134 const char *ENGINE_get_name(const ENGINE *e);
115 const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e); 135 const RSA_METHOD *ENGINE_get_RSA(const ENGINE *e);
116 const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e); 136 const DSA_METHOD *ENGINE_get_DSA(const ENGINE *e);
137 const ECDH_METHOD *ENGINE_get_ECDH(const ENGINE *e);
138 const ECDSA_METHOD *ENGINE_get_ECDSA(const ENGINE *e);
117 const DH_METHOD *ENGINE_get_DH(const ENGINE *e); 139 const DH_METHOD *ENGINE_get_DH(const ENGINE *e);
118 const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e); 140 const RAND_METHOD *ENGINE_get_RAND(const ENGINE *e);
141 const STORE_METHOD *ENGINE_get_STORE(const ENGINE *e);
119 ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e); 142 ENGINE_GEN_INT_FUNC_PTR ENGINE_get_destroy_function(const ENGINE *e);
120 ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e); 143 ENGINE_GEN_INT_FUNC_PTR ENGINE_get_init_function(const ENGINE *e);
121 ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e); 144 ENGINE_GEN_INT_FUNC_PTR ENGINE_get_finish_function(const ENGINE *e);
@@ -148,7 +171,8 @@ The cryptographic functionality that can be provided by an B<ENGINE>
148implementation includes the following abstractions; 171implementation includes the following abstractions;
149 172
150 RSA_METHOD - for providing alternative RSA implementations 173 RSA_METHOD - for providing alternative RSA implementations
151 DSA_METHOD, DH_METHOD, RAND_METHOD - alternative DSA, DH, and RAND 174 DSA_METHOD, DH_METHOD, RAND_METHOD, ECDH_METHOD, ECDSA_METHOD,
175 STORE_METHOD - similarly for other OpenSSL APIs
152 EVP_CIPHER - potentially multiple cipher algorithms (indexed by 'nid') 176 EVP_CIPHER - potentially multiple cipher algorithms (indexed by 'nid')
153 EVP_DIGEST - potentially multiple hash algorithms (indexed by 'nid') 177 EVP_DIGEST - potentially multiple hash algorithms (indexed by 'nid')
154 key-loading - loading public and/or private EVP_PKEY keys 178 key-loading - loading public and/or private EVP_PKEY keys
@@ -157,52 +181,45 @@ implementation includes the following abstractions;
157 181
158Due to the modular nature of the ENGINE API, pointers to ENGINEs need to be 182Due to the modular nature of the ENGINE API, pointers to ENGINEs need to be
159treated as handles - ie. not only as pointers, but also as references to 183treated as handles - ie. not only as pointers, but also as references to
160the underlying ENGINE object. Ie. you should obtain a new reference when 184the underlying ENGINE object. Ie. one should obtain a new reference when
161making copies of an ENGINE pointer if the copies will be used (and 185making copies of an ENGINE pointer if the copies will be used (and
162released) independantly. 186released) independently.
163 187
164ENGINE objects have two levels of reference-counting to match the way in 188ENGINE objects have two levels of reference-counting to match the way in
165which the objects are used. At the most basic level, each ENGINE pointer is 189which the objects are used. At the most basic level, each ENGINE pointer is
166inherently a B<structural> reference - you need a structural reference 190inherently a B<structural> reference - a structural reference is required
167simply to refer to the pointer value at all, as this kind of reference is 191to use the pointer value at all, as this kind of reference is a guarantee
168your guarantee that the structure can not be deallocated until you release 192that the structure can not be deallocated until the reference is released.
169your reference. 193
170 194However, a structural reference provides no guarantee that the ENGINE is
171However, a structural reference provides no guarantee that the ENGINE has 195initiliased and able to use any of its cryptographic
172been initiliased to be usable to perform any of its cryptographic 196implementations. Indeed it's quite possible that most ENGINEs will not
173implementations - and indeed it's quite possible that most ENGINEs will not 197initialise at all in typical environments, as ENGINEs are typically used to
174initialised at all on standard setups, as ENGINEs are typically used to
175support specialised hardware. To use an ENGINE's functionality, you need a 198support specialised hardware. To use an ENGINE's functionality, you need a
176B<functional> reference. This kind of reference can be considered a 199B<functional> reference. This kind of reference can be considered a
177specialised form of structural reference, because each functional reference 200specialised form of structural reference, because each functional reference
178implicitly contains a structural reference as well - however to avoid 201implicitly contains a structural reference as well - however to avoid
179difficult-to-find programming bugs, it is recommended to treat the two 202difficult-to-find programming bugs, it is recommended to treat the two
180kinds of reference independantly. If you have a functional reference to an 203kinds of reference independently. If you have a functional reference to an
181ENGINE, you have a guarantee that the ENGINE has been initialised ready to 204ENGINE, you have a guarantee that the ENGINE has been initialised ready to
182perform cryptographic operations and will not be uninitialised or cleaned 205perform cryptographic operations and will remain uninitialised
183up until after you have released your reference. 206until after you have released your reference.
184
185We will discuss the two kinds of reference separately, including how to
186tell which one you are dealing with at any given point in time (after all
187they are both simply (ENGINE *) pointers, the difference is in the way they
188are used).
189 207
190I<Structural references> 208I<Structural references>
191 209
192This basic type of reference is typically used for creating new ENGINEs 210This basic type of reference is used for instantiating new ENGINEs,
193dynamically, iterating across OpenSSL's internal linked-list of loaded 211iterating across OpenSSL's internal linked-list of loaded
194ENGINEs, reading information about an ENGINE, etc. Essentially a structural 212ENGINEs, reading information about an ENGINE, etc. Essentially a structural
195reference is sufficient if you only need to query or manipulate the data of 213reference is sufficient if you only need to query or manipulate the data of
196an ENGINE implementation rather than use its functionality. 214an ENGINE implementation rather than use its functionality.
197 215
198The ENGINE_new() function returns a structural reference to a new (empty) 216The ENGINE_new() function returns a structural reference to a new (empty)
199ENGINE object. Other than that, structural references come from return 217ENGINE object. There are other ENGINE API functions that return structural
200values to various ENGINE API functions such as; ENGINE_by_id(), 218references such as; ENGINE_by_id(), ENGINE_get_first(), ENGINE_get_last(),
201ENGINE_get_first(), ENGINE_get_last(), ENGINE_get_next(), 219ENGINE_get_next(), ENGINE_get_prev(). All structural references should be
202ENGINE_get_prev(). All structural references should be released by a 220released by a corresponding to call to the ENGINE_free() function - the
203corresponding to call to the ENGINE_free() function - the ENGINE object 221ENGINE object itself will only actually be cleaned up and deallocated when
204itself will only actually be cleaned up and deallocated when the last 222the last structural reference is released.
205structural reference is released.
206 223
207It should also be noted that many ENGINE API function calls that accept a 224It should also be noted that many ENGINE API function calls that accept a
208structural reference will internally obtain another reference - typically 225structural reference will internally obtain another reference - typically
@@ -237,15 +254,9 @@ call the ENGINE_init() function. This returns zero if the ENGINE was not
237already operational and couldn't be successfully initialised (eg. lack of 254already operational and couldn't be successfully initialised (eg. lack of
238system drivers, no special hardware attached, etc), otherwise it will 255system drivers, no special hardware attached, etc), otherwise it will
239return non-zero to indicate that the ENGINE is now operational and will 256return non-zero to indicate that the ENGINE is now operational and will
240have allocated a new B<functional> reference to the ENGINE. In this case, 257have allocated a new B<functional> reference to the ENGINE. All functional
241the supplied ENGINE pointer is, from the point of the view of the caller, 258references are released by calling ENGINE_finish() (which removes the
242both a structural reference and a functional reference - so if the caller 259implicit structural reference as well).
243intends to use it as a functional reference it should free the structural
244reference with ENGINE_free() first. If the caller wishes to use it only as
245a structural reference (eg. if the ENGINE_init() call was simply to test if
246the ENGINE seems available/online), then it should free the functional
247reference; all functional references are released by the ENGINE_finish()
248function.
249 260
250The second way to get a functional reference is by asking OpenSSL for a 261The second way to get a functional reference is by asking OpenSSL for a
251default implementation for a given task, eg. by ENGINE_get_default_RSA(), 262default implementation for a given task, eg. by ENGINE_get_default_RSA(),
@@ -259,26 +270,21 @@ algorithm-specific types in OpenSSL, such as RSA, DSA, EVP_CIPHER_CTX, etc.
259For each supported abstraction, the ENGINE code maintains an internal table 270For each supported abstraction, the ENGINE code maintains an internal table
260of state to control which implementations are available for a given 271of state to control which implementations are available for a given
261abstraction and which should be used by default. These implementations are 272abstraction and which should be used by default. These implementations are
262registered in the tables separated-out by an 'nid' index, because 273registered in the tables and indexed by an 'nid' value, because
263abstractions like EVP_CIPHER and EVP_DIGEST support many distinct 274abstractions like EVP_CIPHER and EVP_DIGEST support many distinct
264algorithms and modes - ENGINEs will support different numbers and 275algorithms and modes, and ENGINEs can support arbitrarily many of them.
265combinations of these. In the case of other abstractions like RSA, DSA, 276In the case of other abstractions like RSA, DSA, etc, there is only one
266etc, there is only one "algorithm" so all implementations implicitly 277"algorithm" so all implementations implicitly register using the same 'nid'
267register using the same 'nid' index. ENGINEs can be B<registered> into 278index.
268these tables to make themselves available for use automatically by the 279
269various abstractions, eg. RSA. For illustrative purposes, we continue with 280When a default ENGINE is requested for a given abstraction/algorithm/mode, (eg.
270the RSA example, though all comments apply similarly to the other 281when calling RSA_new_method(NULL)), a "get_default" call will be made to the
271abstractions (they each get their own table and linkage to the 282ENGINE subsystem to process the corresponding state table and return a
272corresponding section of openssl code). 283functional reference to an initialised ENGINE whose implementation should be
273 284used. If no ENGINE should (or can) be used, it will return NULL and the caller
274When a new RSA key is being created, ie. in RSA_new_method(), a 285will operate with a NULL ENGINE handle - this usually equates to using the
275"get_default" call will be made to the ENGINE subsystem to process the RSA 286conventional software implementation. In the latter case, OpenSSL will from
276state table and return a functional reference to an initialised ENGINE 287then on behave the way it used to before the ENGINE API existed.
277whose RSA_METHOD should be used. If no ENGINE should (or can) be used, it
278will return NULL and the RSA key will operate with a NULL ENGINE handle by
279using the conventional RSA implementation in OpenSSL (and will from then on
280behave the way it used to before the ENGINE API existed - for details see
281L<RSA_new_method(3)|RSA_new_method(3)>).
282 288
283Each state table has a flag to note whether it has processed this 289Each state table has a flag to note whether it has processed this
284"get_default" query since the table was last modified, because to process 290"get_default" query since the table was last modified, because to process
@@ -295,36 +301,9 @@ instead the only way for the state table to return a non-NULL ENGINE to the
295"get_default" query will be if one is expressly set in the table. Eg. 301"get_default" query will be if one is expressly set in the table. Eg.
296ENGINE_set_default_RSA() does the same job as ENGINE_register_RSA() except 302ENGINE_set_default_RSA() does the same job as ENGINE_register_RSA() except
297that it also sets the state table's cached response for the "get_default" 303that it also sets the state table's cached response for the "get_default"
298query. 304query. In the case of abstractions like EVP_CIPHER, where implementations are
299 305indexed by 'nid', these flags and cached-responses are distinct for each 'nid'
300In the case of abstractions like EVP_CIPHER, where implementations are 306value.
301indexed by 'nid', these flags and cached-responses are distinct for each
302'nid' value.
303
304It is worth illustrating the difference between "registration" of ENGINEs
305into these per-algorithm state tables and using the alternative
306"set_default" functions. The latter handles both "registration" and also
307setting the cached "default" ENGINE in each relevant state table - so
308registered ENGINEs will only have a chance to be initialised for use as a
309default if a default ENGINE wasn't already set for the same state table.
310Eg. if ENGINE X supports cipher nids {A,B} and RSA, ENGINE Y supports
311ciphers {A} and DSA, and the following code is executed;
312
313 ENGINE_register_complete(X);
314 ENGINE_set_default(Y, ENGINE_METHOD_ALL);
315 e1 = ENGINE_get_default_RSA();
316 e2 = ENGINE_get_cipher_engine(A);
317 e3 = ENGINE_get_cipher_engine(B);
318 e4 = ENGINE_get_default_DSA();
319 e5 = ENGINE_get_cipher_engine(C);
320
321The results would be as follows;
322
323 assert(e1 == X);
324 assert(e2 == Y);
325 assert(e3 == X);
326 assert(e4 == Y);
327 assert(e5 == NULL);
328 307
329=head2 Application requirements 308=head2 Application requirements
330 309
@@ -360,7 +339,7 @@ mention an important API function;
360 339
361If no ENGINE API functions are called at all in an application, then there 340If no ENGINE API functions are called at all in an application, then there
362are no inherent memory leaks to worry about from the ENGINE functionality, 341are no inherent memory leaks to worry about from the ENGINE functionality,
363however if any ENGINEs are "load"ed, even if they are never registered or 342however if any ENGINEs are loaded, even if they are never registered or
364used, it is necessary to use the ENGINE_cleanup() function to 343used, it is necessary to use the ENGINE_cleanup() function to
365correspondingly cleanup before program exit, if the caller wishes to avoid 344correspondingly cleanup before program exit, if the caller wishes to avoid
366memory leaks. This mechanism uses an internal callback registration table 345memory leaks. This mechanism uses an internal callback registration table
@@ -375,7 +354,7 @@ linker.
375The fact that ENGINEs are made visible to OpenSSL (and thus are linked into 354The fact that ENGINEs are made visible to OpenSSL (and thus are linked into
376the program and loaded into memory at run-time) does not mean they are 355the program and loaded into memory at run-time) does not mean they are
377"registered" or called into use by OpenSSL automatically - that behaviour 356"registered" or called into use by OpenSSL automatically - that behaviour
378is something for the application to have control over. Some applications 357is something for the application to control. Some applications
379will want to allow the user to specify exactly which ENGINE they want used 358will want to allow the user to specify exactly which ENGINE they want used
380if any is to be used at all. Others may prefer to load all support and have 359if any is to be used at all. Others may prefer to load all support and have
381OpenSSL automatically use at run-time any ENGINE that is able to 360OpenSSL automatically use at run-time any ENGINE that is able to
@@ -433,7 +412,7 @@ it should be used. The following code illustrates how this can work;
433That's all that's required. Eg. the next time OpenSSL tries to set up an 412That's all that's required. Eg. the next time OpenSSL tries to set up an
434RSA key, any bundled ENGINEs that implement RSA_METHOD will be passed to 413RSA key, any bundled ENGINEs that implement RSA_METHOD will be passed to
435ENGINE_init() and if any of those succeed, that ENGINE will be set as the 414ENGINE_init() and if any of those succeed, that ENGINE will be set as the
436default for use with RSA from then on. 415default for RSA use from then on.
437 416
438=head2 Advanced configuration support 417=head2 Advanced configuration support
439 418
@@ -441,7 +420,7 @@ There is a mechanism supported by the ENGINE framework that allows each
441ENGINE implementation to define an arbitrary set of configuration 420ENGINE implementation to define an arbitrary set of configuration
442"commands" and expose them to OpenSSL and any applications based on 421"commands" and expose them to OpenSSL and any applications based on
443OpenSSL. This mechanism is entirely based on the use of name-value pairs 422OpenSSL. This mechanism is entirely based on the use of name-value pairs
444and and assumes ASCII input (no unicode or UTF for now!), so it is ideal if 423and assumes ASCII input (no unicode or UTF for now!), so it is ideal if
445applications want to provide a transparent way for users to provide 424applications want to provide a transparent way for users to provide
446arbitrary configuration "directives" directly to such ENGINEs. It is also 425arbitrary configuration "directives" directly to such ENGINEs. It is also
447possible for the application to dynamically interrogate the loaded ENGINE 426possible for the application to dynamically interrogate the loaded ENGINE
@@ -450,8 +429,8 @@ available "control commands", providing a more flexible configuration
450scheme. However, if the user is expected to know which ENGINE device he/she 429scheme. However, if the user is expected to know which ENGINE device he/she
451is using (in the case of specialised hardware, this goes without saying) 430is using (in the case of specialised hardware, this goes without saying)
452then applications may not need to concern themselves with discovering the 431then applications may not need to concern themselves with discovering the
453supported control commands and simply prefer to allow settings to passed 432supported control commands and simply prefer to pass settings into ENGINEs
454into ENGINEs exactly as they are provided by the user. 433exactly as they are provided by the user.
455 434
456Before illustrating how control commands work, it is worth mentioning what 435Before illustrating how control commands work, it is worth mentioning what
457they are typically used for. Broadly speaking there are two uses for 436they are typically used for. Broadly speaking there are two uses for
@@ -459,13 +438,13 @@ control commands; the first is to provide the necessary details to the
459implementation (which may know nothing at all specific to the host system) 438implementation (which may know nothing at all specific to the host system)
460so that it can be initialised for use. This could include the path to any 439so that it can be initialised for use. This could include the path to any
461driver or config files it needs to load, required network addresses, 440driver or config files it needs to load, required network addresses,
462smart-card identifiers, passwords to initialise password-protected devices, 441smart-card identifiers, passwords to initialise protected devices,
463logging information, etc etc. This class of commands typically needs to be 442logging information, etc etc. This class of commands typically needs to be
464passed to an ENGINE B<before> attempting to initialise it, ie. before 443passed to an ENGINE B<before> attempting to initialise it, ie. before
465calling ENGINE_init(). The other class of commands consist of settings or 444calling ENGINE_init(). The other class of commands consist of settings or
466operations that tweak certain behaviour or cause certain operations to take 445operations that tweak certain behaviour or cause certain operations to take
467place, and these commands may work either before or after ENGINE_init(), or 446place, and these commands may work either before or after ENGINE_init(), or
468in same cases both. ENGINE implementations should provide indications of 447in some cases both. ENGINE implementations should provide indications of
469this in the descriptions attached to builtin control commands and/or in 448this in the descriptions attached to builtin control commands and/or in
470external product documentation. 449external product documentation.
471 450
@@ -529,14 +508,14 @@ FALSE.
529I<Discovering supported control commands> 508I<Discovering supported control commands>
530 509
531It is possible to discover at run-time the names, numerical-ids, descriptions 510It is possible to discover at run-time the names, numerical-ids, descriptions
532and input parameters of the control commands supported from a structural 511and input parameters of the control commands supported by an ENGINE using a
533reference to any ENGINE. It is first important to note that some control 512structural reference. Note that some control commands are defined by OpenSSL
534commands are defined by OpenSSL itself and it will intercept and handle these 513itself and it will intercept and handle these control commands on behalf of the
535control commands on behalf of the ENGINE, ie. the ENGINE's ctrl() handler is not 514ENGINE, ie. the ENGINE's ctrl() handler is not used for the control command.
536used for the control command. openssl/engine.h defines a symbol, 515openssl/engine.h defines an index, ENGINE_CMD_BASE, that all control commands
537ENGINE_CMD_BASE, that all control commands implemented by ENGINEs from. Any 516implemented by ENGINEs should be numbered from. Any command value lower than
538command value lower than this symbol is considered a "generic" command is 517this symbol is considered a "generic" command is handled directly by the
539handled directly by the OpenSSL core routines. 518OpenSSL core routines.
540 519
541It is using these "core" control commands that one can discover the the control 520It is using these "core" control commands that one can discover the the control
542commands implemented by a given ENGINE, specifically the commands; 521commands implemented by a given ENGINE, specifically the commands;
@@ -552,8 +531,8 @@ commands implemented by a given ENGINE, specifically the commands;
552 #define ENGINE_CTRL_GET_CMD_FLAGS 18 531 #define ENGINE_CTRL_GET_CMD_FLAGS 18
553 532
554Whilst these commands are automatically processed by the OpenSSL framework code, 533Whilst these commands are automatically processed by the OpenSSL framework code,
555they use various properties exposed by each ENGINE by which to process these 534they use various properties exposed by each ENGINE to process these
556queries. An ENGINE has 3 properties it exposes that can affect this behaviour; 535queries. An ENGINE has 3 properties it exposes that can affect how this behaves;
557it can supply a ctrl() handler, it can specify ENGINE_FLAGS_MANUAL_CMD_CTRL in 536it can supply a ctrl() handler, it can specify ENGINE_FLAGS_MANUAL_CMD_CTRL in
558the ENGINE's flags, and it can expose an array of control command descriptions. 537the ENGINE's flags, and it can expose an array of control command descriptions.
559If an ENGINE specifies the ENGINE_FLAGS_MANUAL_CMD_CTRL flag, then it will 538If an ENGINE specifies the ENGINE_FLAGS_MANUAL_CMD_CTRL flag, then it will
@@ -608,14 +587,13 @@ extension).
608The ENGINE API and internal architecture is currently being reviewed. Slated for 587The ENGINE API and internal architecture is currently being reviewed. Slated for
609possible release in 0.9.8 is support for transparent loading of "dynamic" 588possible release in 0.9.8 is support for transparent loading of "dynamic"
610ENGINEs (built as self-contained shared-libraries). This would allow ENGINE 589ENGINEs (built as self-contained shared-libraries). This would allow ENGINE
611implementations to be provided independantly of OpenSSL libraries and/or 590implementations to be provided independently of OpenSSL libraries and/or
612OpenSSL-based applications, and would also remove any requirement for 591OpenSSL-based applications, and would also remove any requirement for
613applications to explicitly use the "dynamic" ENGINE to bind to shared-library 592applications to explicitly use the "dynamic" ENGINE to bind to shared-library
614implementations. 593implementations.
615 594
616=head1 SEE ALSO 595=head1 SEE ALSO
617 596
618L<rsa(3)|rsa(3)>, L<dsa(3)|dsa(3)>, L<dh(3)|dh(3)>, L<rand(3)|rand(3)>, 597L<rsa(3)|rsa(3)>, L<dsa(3)|dsa(3)>, L<dh(3)|dh(3)>, L<rand(3)|rand(3)>
619L<RSA_new_method(3)|RSA_new_method(3)>
620 598
621=cut 599=cut