diff options
Diffstat (limited to 'src/lib/libcrypto/man/engine.3')
| -rw-r--r-- | src/lib/libcrypto/man/engine.3 | 385 |
1 files changed, 2 insertions, 383 deletions
diff --git a/src/lib/libcrypto/man/engine.3 b/src/lib/libcrypto/man/engine.3 index fac4fa13e1..ebcc95f310 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.15 2018/04/15 01:43:45 schwarze Exp $ | 1 | .\" $OpenBSD: engine.3,v 1.16 2018/04/15 17:02:03 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 | .\" |
| @@ -55,227 +55,8 @@ | |||
| 55 | .Dt ENGINE 3 | 55 | .Dt ENGINE 3 |
| 56 | .Os | 56 | .Os |
| 57 | .Sh NAME | 57 | .Sh NAME |
| 58 | .Nm ENGINE_load_openssl , | 58 | .Nm engine |
| 59 | .Nm ENGINE_load_dynamic , | ||
| 60 | .Nm ENGINE_load_builtin_engines , | ||
| 61 | .Nm ENGINE_cleanup , | ||
| 62 | .Nm ENGINE_new , | ||
| 63 | .Nm ENGINE_free , | ||
| 64 | .Nm ENGINE_up_ref , | ||
| 65 | .Nm ENGINE_set_id , | ||
| 66 | .Nm ENGINE_set_name , | ||
| 67 | .Nm ENGINE_set_RSA , | ||
| 68 | .Nm ENGINE_set_DSA , | ||
| 69 | .Nm ENGINE_set_ECDH , | ||
| 70 | .Nm ENGINE_set_ECDSA , | ||
| 71 | .Nm ENGINE_set_DH , | ||
| 72 | .Nm ENGINE_set_RAND , | ||
| 73 | .Nm ENGINE_set_STORE , | ||
| 74 | .Nm ENGINE_set_destroy_function , | ||
| 75 | .Nm ENGINE_set_load_privkey_function , | ||
| 76 | .Nm ENGINE_set_load_pubkey_function , | ||
| 77 | .Nm ENGINE_set_ciphers , | ||
| 78 | .Nm ENGINE_set_digests , | ||
| 79 | .Nm ENGINE_set_flags , | ||
| 80 | .Nm ENGINE_get_id , | ||
| 81 | .Nm ENGINE_get_name , | ||
| 82 | .Nm ENGINE_get_RSA , | ||
| 83 | .Nm ENGINE_get_DSA , | ||
| 84 | .Nm ENGINE_get_ECDH , | ||
| 85 | .Nm ENGINE_get_ECDSA , | ||
| 86 | .Nm ENGINE_get_DH , | ||
| 87 | .Nm ENGINE_get_RAND , | ||
| 88 | .Nm ENGINE_get_STORE , | ||
| 89 | .Nm ENGINE_get_destroy_function , | ||
| 90 | .Nm ENGINE_get_load_privkey_function , | ||
| 91 | .Nm ENGINE_get_load_pubkey_function , | ||
| 92 | .Nm ENGINE_get_ciphers , | ||
| 93 | .Nm ENGINE_get_digests , | ||
| 94 | .Nm ENGINE_get_cipher , | ||
| 95 | .Nm ENGINE_get_digest , | ||
| 96 | .Nm ENGINE_get_flags , | ||
| 97 | .Nm ENGINE_load_private_key , | ||
| 98 | .Nm ENGINE_load_public_key | ||
| 99 | .Nd ENGINE cryptographic module support | 59 | .Nd ENGINE cryptographic module support |
| 100 | .Sh SYNOPSIS | ||
| 101 | .In openssl/engine.h | ||
| 102 | .Ft void | ||
| 103 | .Fn ENGINE_load_openssl void | ||
| 104 | .Ft void | ||
| 105 | .Fn ENGINE_load_dynamic void | ||
| 106 | .Ft void | ||
| 107 | .Fn ENGINE_load_builtin_engines void | ||
| 108 | .Ft void | ||
| 109 | .Fn ENGINE_cleanup void | ||
| 110 | .Ft ENGINE * | ||
| 111 | .Fn ENGINE_new void | ||
| 112 | .Ft int | ||
| 113 | .Fo ENGINE_free | ||
| 114 | .Fa "ENGINE *e" | ||
| 115 | .Fc | ||
| 116 | .Ft int | ||
| 117 | .Fo ENGINE_up_ref | ||
| 118 | .Fa "ENGINE *e" | ||
| 119 | .Fc | ||
| 120 | .Ft int | ||
| 121 | .Fo ENGINE_set_id | ||
| 122 | .Fa "ENGINE *e" | ||
| 123 | .Fa "const char *id" | ||
| 124 | .Fc | ||
| 125 | .Ft int | ||
| 126 | .Fo ENGINE_set_name | ||
| 127 | .Fa "ENGINE *e" | ||
| 128 | .Fa "const char *name" | ||
| 129 | .Fc | ||
| 130 | .Ft int | ||
| 131 | .Fo ENGINE_set_RSA | ||
| 132 | .Fa "ENGINE *e" | ||
| 133 | .Fa "const RSA_METHOD *rsa_meth" | ||
| 134 | .Fc | ||
| 135 | .Ft int | ||
| 136 | .Fo ENGINE_set_DSA | ||
| 137 | .Fa "ENGINE *e" | ||
| 138 | .Fa "const DSA_METHOD *dsa_meth" | ||
| 139 | .Fc | ||
| 140 | .Ft int | ||
| 141 | .Fo ENGINE_set_ECDH | ||
| 142 | .Fa "ENGINE *e" | ||
| 143 | .Fa "const ECDH_METHOD *dh_meth" | ||
| 144 | .Fc | ||
| 145 | .Ft int | ||
| 146 | .Fo ENGINE_set_ECDSA | ||
| 147 | .Fa "ENGINE *e" | ||
| 148 | .Fa "const ECDSA_METHOD *dh_meth" | ||
| 149 | .Fc | ||
| 150 | .Ft int | ||
| 151 | .Fo ENGINE_set_DH | ||
| 152 | .Fa "ENGINE *e" | ||
| 153 | .Fa "const DH_METHOD *dh_meth" | ||
| 154 | .Fc | ||
| 155 | .Ft int | ||
| 156 | .Fo ENGINE_set_RAND | ||
| 157 | .Fa "ENGINE *e" | ||
| 158 | .Fa "const RAND_METHOD *rand_meth" | ||
| 159 | .Fc | ||
| 160 | .Ft int | ||
| 161 | .Fo ENGINE_set_STORE | ||
| 162 | .Fa "ENGINE *e" | ||
| 163 | .Fa "const STORE_METHOD *rand_meth" | ||
| 164 | .Fc | ||
| 165 | .Ft int | ||
| 166 | .Fo ENGINE_set_destroy_function | ||
| 167 | .Fa "ENGINE *e" | ||
| 168 | .Fa "ENGINE_GEN_INT_FUNC_PTR destroy_f" | ||
| 169 | .Fc | ||
| 170 | .Ft int | ||
| 171 | .Fo ENGINE_set_load_privkey_function | ||
| 172 | .Fa "ENGINE *e" | ||
| 173 | .Fa "ENGINE_LOAD_KEY_PTR loadpriv_f" | ||
| 174 | .Fc | ||
| 175 | .Ft int | ||
| 176 | .Fo ENGINE_set_load_pubkey_function | ||
| 177 | .Fa "ENGINE *e" | ||
| 178 | .Fa "ENGINE_LOAD_KEY_PTR loadpub_f" | ||
| 179 | .Fc | ||
| 180 | .Ft int | ||
| 181 | .Fo ENGINE_set_ciphers | ||
| 182 | .Fa "ENGINE *e" | ||
| 183 | .Fa "ENGINE_CIPHERS_PTR f" | ||
| 184 | .Fc | ||
| 185 | .Ft int | ||
| 186 | .Fo ENGINE_set_digests | ||
| 187 | .Fa "ENGINE *e" | ||
| 188 | .Fa "ENGINE_DIGESTS_PTR f" | ||
| 189 | .Fc | ||
| 190 | .Ft int | ||
| 191 | .Fo ENGINE_set_flags | ||
| 192 | .Fa "ENGINE *e" | ||
| 193 | .Fa "int flags" | ||
| 194 | .Fc | ||
| 195 | .Ft const char * | ||
| 196 | .Fo ENGINE_get_id | ||
| 197 | .Fa "const ENGINE *e" | ||
| 198 | .Fc | ||
| 199 | .Ft const char * | ||
| 200 | .Fo ENGINE_get_name | ||
| 201 | .Fa "const ENGINE *e" | ||
| 202 | .Fc | ||
| 203 | .Ft const RSA_METHOD * | ||
| 204 | .Fo ENGINE_get_RSA | ||
| 205 | .Fa "const ENGINE *e" | ||
| 206 | .Fc | ||
| 207 | .Ft const DSA_METHOD * | ||
| 208 | .Fo ENGINE_get_DSA | ||
| 209 | .Fa "const ENGINE *e" | ||
| 210 | .Fc | ||
| 211 | .Ft const ECDH_METHOD * | ||
| 212 | .Fo ENGINE_get_ECDH | ||
| 213 | .Fa "const ENGINE *e" | ||
| 214 | .Fc | ||
| 215 | .Ft const ECDSA_METHOD * | ||
| 216 | .Fo ENGINE_get_ECDSA | ||
| 217 | .Fa "const ENGINE *e" | ||
| 218 | .Fc | ||
| 219 | .Ft const DH_METHOD * | ||
| 220 | .Fo ENGINE_get_DH | ||
| 221 | .Fa "const ENGINE *e" | ||
| 222 | .Fc | ||
| 223 | .Ft const RAND_METHOD * | ||
| 224 | .Fo ENGINE_get_RAND | ||
| 225 | .Fa "const ENGINE *e" | ||
| 226 | .Fc | ||
| 227 | .Ft const STORE_METHOD * | ||
| 228 | .Fo ENGINE_get_STORE | ||
| 229 | .Fa "const ENGINE *e" | ||
| 230 | .Fc | ||
| 231 | .Ft ENGINE_GEN_INT_FUNC_PTR | ||
| 232 | .Fo ENGINE_get_destroy_function | ||
| 233 | .Fa "const ENGINE *e" | ||
| 234 | .Fc | ||
| 235 | .Ft ENGINE_LOAD_KEY_PTR | ||
| 236 | .Fo ENGINE_get_load_privkey_function | ||
| 237 | .Fa "const ENGINE *e" | ||
| 238 | .Fc | ||
| 239 | .Ft ENGINE_LOAD_KEY_PTR | ||
| 240 | .Fo ENGINE_get_load_pubkey_function | ||
| 241 | .Fa "const ENGINE *e" | ||
| 242 | .Fc | ||
| 243 | .Ft ENGINE_CIPHERS_PTR | ||
| 244 | .Fo ENGINE_get_ciphers | ||
| 245 | .Fa "const ENGINE *e" | ||
| 246 | .Fc | ||
| 247 | .Ft ENGINE_DIGESTS_PTR | ||
| 248 | .Fo ENGINE_get_digests | ||
| 249 | .Fa "const ENGINE *e" | ||
| 250 | .Fc | ||
| 251 | .Ft const EVP_CIPHER * | ||
| 252 | .Fo ENGINE_get_cipher | ||
| 253 | .Fa "ENGINE *e" | ||
| 254 | .Fa "int nid" | ||
| 255 | .Fc | ||
| 256 | .Ft const EVP_MD * | ||
| 257 | .Fo ENGINE_get_digest | ||
| 258 | .Fa "ENGINE *e" | ||
| 259 | .Fa "int nid" | ||
| 260 | .Fc | ||
| 261 | .Ft int | ||
| 262 | .Fo ENGINE_get_flags | ||
| 263 | .Fa "const ENGINE *e" | ||
| 264 | .Fc | ||
| 265 | .Ft EVP_PKEY * | ||
| 266 | .Fo ENGINE_load_private_key | ||
| 267 | .Fa "ENGINE *e" | ||
| 268 | .Fa "const char *key_id" | ||
| 269 | .Fa "UI_METHOD *ui_method" | ||
| 270 | .Fa "void *callback_data" | ||
| 271 | .Fc | ||
| 272 | .Ft EVP_PKEY * | ||
| 273 | .Fo ENGINE_load_public_key | ||
| 274 | .Fa "ENGINE *e" | ||
| 275 | .Fa "const char *key_id" | ||
| 276 | .Fa "UI_METHOD *ui_method" | ||
| 277 | .Fa "void *callback_data" | ||
| 278 | .Fc | ||
| 279 | .Sh DESCRIPTION | 60 | .Sh DESCRIPTION |
| 280 | These functions create, manipulate, and use cryptographic modules | 61 | These functions create, manipulate, and use cryptographic modules |
| 281 | in the form of | 62 | in the form of |
| @@ -369,64 +150,6 @@ Essentially a structural reference is sufficient if you only need to | |||
| 369 | query or manipulate the data of an | 150 | query or manipulate the data of an |
| 370 | .Vt ENGINE | 151 | .Vt ENGINE |
| 371 | implementation rather than use its functionality. | 152 | implementation rather than use its functionality. |
| 372 | .Pp | ||
| 373 | .Fn ENGINE_new | ||
| 374 | allocates and initializes an empty | ||
| 375 | .Vt ENGINE | ||
| 376 | object and sets its structural reference count to 1 | ||
| 377 | and its functional reference count to 0. | ||
| 378 | Many functions increment the structural reference count by 1 | ||
| 379 | when successful. | ||
| 380 | Some of them, including | ||
| 381 | .Xr ENGINE_by_id 3 , | ||
| 382 | .Xr ENGINE_get_first 3 , | ||
| 383 | .Xr ENGINE_get_last 3 , | ||
| 384 | .Xr ENGINE_get_next 3 , | ||
| 385 | and | ||
| 386 | .Xr ENGINE_get_prev 3 , | ||
| 387 | do so because they return a structural reference to the user. | ||
| 388 | Other functions, including | ||
| 389 | .Xr ENGINE_add 3 , | ||
| 390 | .Xr ENGINE_init 3 , | ||
| 391 | .Xr ENGINE_get_cipher_engine 3 , | ||
| 392 | .Xr ENGINE_get_digest_engine 3 , | ||
| 393 | and the | ||
| 394 | .Xr ENGINE_get_default_RSA 3 | ||
| 395 | and | ||
| 396 | .Xr ENGINE_set_default 3 | ||
| 397 | families of functions | ||
| 398 | do so because they store a structural refence internally. | ||
| 399 | .Fn ENGINE_up_ref | ||
| 400 | explicitly increment the structural reference count by 1. | ||
| 401 | .Pp | ||
| 402 | .Fn ENGINE_free | ||
| 403 | decrements the structural reference count by 1, | ||
| 404 | and if it reaches 0, the cleanup function associated with | ||
| 405 | .Fa e | ||
| 406 | is called, and both the memory used internally by | ||
| 407 | .Fa e | ||
| 408 | and | ||
| 409 | .Fa e | ||
| 410 | itself are freed. | ||
| 411 | If | ||
| 412 | .Fa e | ||
| 413 | is a | ||
| 414 | .Dv NULL | ||
| 415 | pointer, no action occurs. | ||
| 416 | Many functions internally call the equivalent of | ||
| 417 | .Fn ENGINE_free . | ||
| 418 | Some of them, including | ||
| 419 | .Xr ENGINE_get_next 3 | ||
| 420 | and | ||
| 421 | .Xr ENGINE_get_prev 3 , | ||
| 422 | thus invalidate the structural reference passed in by the user. | ||
| 423 | Other functions, including | ||
| 424 | .Xr ENGINE_finish 3 , | ||
| 425 | .Xr ENGINE_remove 3 , | ||
| 426 | and the | ||
| 427 | .Xr ENGINE_set_default 3 | ||
| 428 | family of functions | ||
| 429 | do so when an internally stored structural reference is no longer needed. | ||
| 430 | .Ss Application requirements | 153 | .Ss Application requirements |
| 431 | This section will explain the basic things an application programmer | 154 | This section will explain the basic things an application programmer |
| 432 | should support to make the most useful elements of the | 155 | should support to make the most useful elements of the |
| @@ -450,15 +173,6 @@ code at all. | |||
| 450 | So the first consideration is whether any/all available | 173 | So the first consideration is whether any/all available |
| 451 | .Vt ENGINE | 174 | .Vt ENGINE |
| 452 | implementations should be made visible to OpenSSL. | 175 | implementations should be made visible to OpenSSL. |
| 453 | This is controlled by calling the various "load" functions, e.g. | ||
| 454 | .Fn ENGINE_load_builtin_engines | ||
| 455 | to make all | ||
| 456 | .Vt ENGINE | ||
| 457 | implementations bundled with OpenSSL available. | ||
| 458 | .Pp | ||
| 459 | Note that | ||
| 460 | .Fn ENGINE_load_dynamic | ||
| 461 | is a placeholder and does not enable dynamic engine loading support. | ||
| 462 | .Pp | 176 | .Pp |
| 463 | Having called any of these functions, | 177 | Having called any of these functions, |
| 464 | .Vt ENGINE | 178 | .Vt ENGINE |
| @@ -466,33 +180,6 @@ objects would have been dynamically allocated and populated with | |||
| 466 | these implementations and linked into OpenSSL's internal linked | 180 | these implementations and linked into OpenSSL's internal linked |
| 467 | list. | 181 | list. |
| 468 | .Pp | 182 | .Pp |
| 469 | If no | ||
| 470 | .Nm engine | ||
| 471 | API functions are called at all in an application, then there are | ||
| 472 | no inherent memory leaks to worry about from the | ||
| 473 | .Nm engine | ||
| 474 | functionality, however if any | ||
| 475 | .Vt ENGINE Ns s | ||
| 476 | are loaded, even if they are never registered or used, it is necessary | ||
| 477 | to use the | ||
| 478 | .Fn ENGINE_cleanup | ||
| 479 | function to correspondingly cleanup before program exit, if the caller | ||
| 480 | wishes to avoid memory leaks. | ||
| 481 | This mechanism uses an internal callback registration table so that any | ||
| 482 | .Nm engine | ||
| 483 | API functionality that knows it requires cleanup can register its | ||
| 484 | cleanup details to be called during | ||
| 485 | .Fn ENGINE_cleanup . | ||
| 486 | This approach allows | ||
| 487 | .Fn ENGINE_cleanup | ||
| 488 | to clean up after any | ||
| 489 | .Nm engine | ||
| 490 | functionality at all that your program uses, yet doesn't automatically | ||
| 491 | create linker dependencies to all possible | ||
| 492 | .Nm engine | ||
| 493 | functionality - only the cleanup callbacks required by the functionality | ||
| 494 | you do use will be required by the linker. | ||
| 495 | .Pp | ||
| 496 | The fact that | 183 | The fact that |
| 497 | .Vt ENGINE Ns s | 184 | .Vt ENGINE Ns s |
| 498 | are made visible to OpenSSL (and thus are linked into the program | 185 | are made visible to OpenSSL (and thus are linked into the program |
| @@ -836,74 +523,6 @@ to see if they implement "FOO_GET_VENDOR_LOGO_GIF" - and | |||
| 836 | .Vt ENGINE | 523 | .Vt ENGINE |
| 837 | could therefore decide whether or not to support this "foo"-specific | 524 | could therefore decide whether or not to support this "foo"-specific |
| 838 | extension). | 525 | extension). |
| 839 | .Sh RETURN VALUES | ||
| 840 | .Fn ENGINE_get_cipher_engine , | ||
| 841 | .Fn ENGINE_get_digest_engine , | ||
| 842 | and | ||
| 843 | .Fn ENGINE_new | ||
| 844 | return a valid | ||
| 845 | .Vt ENGINE | ||
| 846 | structure or | ||
| 847 | .Dv NULL | ||
| 848 | if an error occurred. | ||
| 849 | .Pp | ||
| 850 | .Fn ENGINE_free , | ||
| 851 | .Fn ENGINE_up_ref , | ||
| 852 | and all | ||
| 853 | .Fn ENGINE_set_* | ||
| 854 | functions return 1 on success or 0 on error. | ||
| 855 | .Pp | ||
| 856 | .Fn ENGINE_get_id | ||
| 857 | and | ||
| 858 | .Fn ENGINE_get_name | ||
| 859 | return a pointer to an internal string representing the identifier | ||
| 860 | and the name of | ||
| 861 | .Fa e , | ||
| 862 | respectively. | ||
| 863 | .Pp | ||
| 864 | .Fn ENGINE_get_RSA , | ||
| 865 | .Fn ENGINE_get_DSA , | ||
| 866 | .Fn ENGINE_get_DH , | ||
| 867 | .Fn ENGINE_get_RAND , | ||
| 868 | and | ||
| 869 | .Fn ENGINE_get_STORE | ||
| 870 | return a method structure for the respective algorithm. | ||
| 871 | .Pp | ||
| 872 | .Fn ENGINE_get_destroy_function , | ||
| 873 | .Fn ENGINE_get_load_privkey_function , | ||
| 874 | .Fn ENGINE_get_load_pubkey_function , | ||
| 875 | .Fn ENGINE_get_ciphers , | ||
| 876 | and | ||
| 877 | .Fn ENGINE_get_digests | ||
| 878 | return a function pointer to the respective callback. | ||
| 879 | .Pp | ||
| 880 | .Fn ENGINE_get_cipher | ||
| 881 | returns a valid | ||
| 882 | .Vt EVP_CIPHER | ||
| 883 | structure on success or | ||
| 884 | .Dv NULL | ||
| 885 | if an error occurred. | ||
| 886 | .Pp | ||
| 887 | .Fn ENGINE_get_digest | ||
| 888 | returns a valid | ||
| 889 | .Vt EVP_MD | ||
| 890 | structure on success or | ||
| 891 | .Dv NULL | ||
| 892 | if an error occurred. | ||
| 893 | .Pp | ||
| 894 | .Fn ENGINE_get_flags | ||
| 895 | returns an integer representing the flags | ||
| 896 | which are used to control various behaviours of an | ||
| 897 | .Vt ENGINE . | ||
| 898 | .Pp | ||
| 899 | .Fn ENGINE_load_private_key | ||
| 900 | and | ||
| 901 | .Fn ENGINE_load_public_key | ||
| 902 | return a valid | ||
| 903 | .Vt EVP_PKEY | ||
| 904 | structure on success or | ||
| 905 | .Dv NULL | ||
| 906 | if an error occurred. | ||
| 907 | .Sh SEE ALSO | 526 | .Sh SEE ALSO |
| 908 | .Xr DH_new 3 , | 527 | .Xr DH_new 3 , |
| 909 | .Xr DSA_new 3 , | 528 | .Xr DSA_new 3 , |
