diff options
Diffstat (limited to 'src/lib/libcrypto/man/ENGINE_ctrl.3')
| -rw-r--r-- | src/lib/libcrypto/man/ENGINE_ctrl.3 | 470 |
1 files changed, 0 insertions, 470 deletions
diff --git a/src/lib/libcrypto/man/ENGINE_ctrl.3 b/src/lib/libcrypto/man/ENGINE_ctrl.3 deleted file mode 100644 index b4965a5a03..0000000000 --- a/src/lib/libcrypto/man/ENGINE_ctrl.3 +++ /dev/null | |||
| @@ -1,470 +0,0 @@ | |||
| 1 | .\" $OpenBSD: ENGINE_ctrl.3,v 1.5 2022/01/15 23:38:50 jsg Exp $ | ||
| 2 | .\" content checked up to: | ||
| 3 | .\" OpenSSL ENGINE_add 1f13ad31 Dec 25 17:50:39 2017 +0800 | ||
| 4 | .\" | ||
| 5 | .\" Copyright (c) 2018 Ingo Schwarze <schwarze@openbsd.org> | ||
| 6 | .\" | ||
| 7 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 8 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 9 | .\" copyright notice and this permission notice appear in all copies. | ||
| 10 | .\" | ||
| 11 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 12 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 13 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 14 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 15 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 16 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 17 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 18 | .\" | ||
| 19 | .Dd $Mdocdate: January 15 2022 $ | ||
| 20 | .Dt ENGINE_CTRL 3 | ||
| 21 | .Os | ||
| 22 | .Sh NAME | ||
| 23 | .Nm ENGINE_ctrl , | ||
| 24 | .Nm ENGINE_cmd_is_executable , | ||
| 25 | .Nm ENGINE_ctrl_cmd , | ||
| 26 | .Nm ENGINE_ctrl_cmd_string , | ||
| 27 | .Nm ENGINE_set_ctrl_function , | ||
| 28 | .Nm ENGINE_get_ctrl_function , | ||
| 29 | .Nm ENGINE_set_cmd_defns , | ||
| 30 | .Nm ENGINE_get_cmd_defns | ||
| 31 | .Nd control commands for ENGINE objects | ||
| 32 | .Sh SYNOPSIS | ||
| 33 | .In openssl/engine.h | ||
| 34 | .Ft int | ||
| 35 | .Fo ENGINE_ctrl | ||
| 36 | .Fa "ENGINE *e" | ||
| 37 | .Fa "int cmd" | ||
| 38 | .Fa "long i" | ||
| 39 | .Fa "void *p" | ||
| 40 | .Fa "void (*f)(void)" | ||
| 41 | .Fc | ||
| 42 | .Ft int | ||
| 43 | .Fo ENGINE_cmd_is_executable | ||
| 44 | .Fa "ENGINE *e" | ||
| 45 | .Fa "int cmd" | ||
| 46 | .Fc | ||
| 47 | .Ft int | ||
| 48 | .Fo ENGINE_ctrl_cmd | ||
| 49 | .Fa "ENGINE *e" | ||
| 50 | .Fa "const char *cmd_name" | ||
| 51 | .Fa "long i" | ||
| 52 | .Fa "void *p" | ||
| 53 | .Fa "void (*f)(void)" | ||
| 54 | .Fa "int cmd_optional" | ||
| 55 | .Fc | ||
| 56 | .Ft int | ||
| 57 | .Fo ENGINE_ctrl_cmd_string | ||
| 58 | .Fa "ENGINE *e" | ||
| 59 | .Fa "const char *cmd_name" | ||
| 60 | .Fa "const char *arg" | ||
| 61 | .Fa "int cmd_optional" | ||
| 62 | .Fc | ||
| 63 | .Ft typedef int | ||
| 64 | .Fo (*ENGINE_CTRL_FUNC_PTR) | ||
| 65 | .Fa "ENGINE *e" | ||
| 66 | .Fa "int cmd" | ||
| 67 | .Fa "long i" | ||
| 68 | .Fa "void *p" | ||
| 69 | .Fa "void (*f)(void)" | ||
| 70 | .Fc | ||
| 71 | .Ft int | ||
| 72 | .Fo ENGINE_set_ctrl_function | ||
| 73 | .Fa "ENGINE *e" | ||
| 74 | .Fa "ENGINE_CTRL_FUNC_PTR ctrl_f" | ||
| 75 | .Fc | ||
| 76 | .Ft ENGINE_CTRL_FUNC_PTR | ||
| 77 | .Fo ENGINE_get_ctrl_function | ||
| 78 | .Fa "const ENGINE *e" | ||
| 79 | .Fc | ||
| 80 | .Ft int | ||
| 81 | .Fo ENGINE_set_cmd_defns | ||
| 82 | .Fa "ENGINE *e" | ||
| 83 | .Fa "const ENGINE_CMD_DEFN *defns" | ||
| 84 | .Fc | ||
| 85 | .Ft const ENGINE_CMD_DEFN * | ||
| 86 | .Fo ENGINE_get_cmd_defns | ||
| 87 | .Fa "const ENGINE *e" | ||
| 88 | .Fc | ||
| 89 | .Sh DESCRIPTION | ||
| 90 | .Fn ENGINE_ctrl | ||
| 91 | calls the built-in or user-defined | ||
| 92 | .Fa cmd | ||
| 93 | for the engine | ||
| 94 | .Fa e , | ||
| 95 | passing the arguments | ||
| 96 | .Fa i | ||
| 97 | and | ||
| 98 | .Fa p . | ||
| 99 | .Pp | ||
| 100 | User-defined commands can be used before | ||
| 101 | .Xr ENGINE_init 3 | ||
| 102 | to provide data required for initialization | ||
| 103 | or at any time to modify the behaviour of an engine. | ||
| 104 | .Pp | ||
| 105 | Most built-in commands operate on user-defined commands installed with | ||
| 106 | .Fn ENGINE_set_cmd_defns , | ||
| 107 | either using the | ||
| 108 | .Fa p | ||
| 109 | argument to indicate the user-defined command with the command name | ||
| 110 | .Fa cmd_name | ||
| 111 | or using the | ||
| 112 | .Fa i | ||
| 113 | argument to indicate the user-defined command with the command number | ||
| 114 | .Fa cmd_num . | ||
| 115 | The | ||
| 116 | .Fa cmd | ||
| 117 | arguments to call the built-in commands are as follows: | ||
| 118 | .Bl -tag -width Ds | ||
| 119 | .It Dv ENGINE_CTRL_GET_CMD_FLAGS | ||
| 120 | Return the | ||
| 121 | .Fa cmd_flags | ||
| 122 | of the user-defined command with the number | ||
| 123 | .Fa i , | ||
| 124 | or a number less than or equal to 0 if an error occurs or | ||
| 125 | the command number does not exist. | ||
| 126 | A return value of 0 indicates failure if | ||
| 127 | .Fa e | ||
| 128 | is | ||
| 129 | .Dv NULL | ||
| 130 | or has a reference count of 0, or success if | ||
| 131 | .Fa e | ||
| 132 | is valid. | ||
| 133 | .It Dv ENGINE_CTRL_GET_CMD_FROM_NAME | ||
| 134 | Return the positive command number | ||
| 135 | of the user-defined command with the name | ||
| 136 | .Fa p , | ||
| 137 | or a number less than or equal to 0 if an error occurs or no | ||
| 138 | matching name is found. | ||
| 139 | .It Dv ENGINE_CTRL_GET_DESC_FROM_CMD | ||
| 140 | Copy the description of the user-defined command with the number | ||
| 141 | .Fa i | ||
| 142 | into the buffer | ||
| 143 | .Fa p | ||
| 144 | and NUL-terminate it. | ||
| 145 | It is the responsibility of the caller to make sure that the buffer | ||
| 146 | .Fa p | ||
| 147 | is large enough, either by calling | ||
| 148 | .Dv ENGINE_CTRL_GET_DESC_LEN_FROM_CMD | ||
| 149 | first or using knowledge about the array passed to | ||
| 150 | .Fn ENGINE_set_cmd_defns . | ||
| 151 | The return value is the number of bytes written | ||
| 152 | .Em including | ||
| 153 | the terminating NUL byte, or a number less than or equal to 0 | ||
| 154 | if an error occurs. | ||
| 155 | .It Dv ENGINE_CTRL_GET_DESC_LEN_FROM_CMD | ||
| 156 | Return the length in bytes | ||
| 157 | .Em excluding | ||
| 158 | the terminating NUL byte | ||
| 159 | of the description of the user-defined command with the number | ||
| 160 | .Fa i , | ||
| 161 | or a number less than or equal to 0 if an error occurs. | ||
| 162 | A return value of 0 indicates failure if | ||
| 163 | .Fa e | ||
| 164 | is | ||
| 165 | .Dv NULL | ||
| 166 | or has a reference count of 0, or success if | ||
| 167 | .Fa e | ||
| 168 | is valid. | ||
| 169 | .It Dv ENGINE_CTRL_GET_FIRST_CMD_TYPE | ||
| 170 | Return the positive command number | ||
| 171 | of the first user-defined command installed with | ||
| 172 | .Fn ENGINE_set_cmd_defns | ||
| 173 | or a number less than or equal to 0 if an error occurs or no | ||
| 174 | user-defined command has been installed. | ||
| 175 | .It Dv ENGINE_CTRL_GET_NAME_FROM_CMD | ||
| 176 | Copy the name of the user-defined command with the number | ||
| 177 | .Fa i | ||
| 178 | into the buffer | ||
| 179 | .Fa p | ||
| 180 | and NUL-terminate it. | ||
| 181 | It is the responsibility of the caller to make sure that the buffer | ||
| 182 | .Fa p | ||
| 183 | is large enough, either by calling | ||
| 184 | .Dv ENGINE_CTRL_GET_NAME_LEN_FROM_CMD | ||
| 185 | first or using knowledge about the array passed to | ||
| 186 | .Fn ENGINE_set_cmd_defns . | ||
| 187 | The return value is the number of bytes written | ||
| 188 | .Em including | ||
| 189 | the terminating NUL byte, or a number less than or equal to 0 | ||
| 190 | if an error occurs. | ||
| 191 | .It Dv ENGINE_CTRL_GET_NAME_LEN_FROM_CMD | ||
| 192 | Return the length in bytes | ||
| 193 | .Em excluding | ||
| 194 | the terminating NULL byte | ||
| 195 | of the name of the user-defined command with the number | ||
| 196 | .Fa i , | ||
| 197 | or a number less than or equal to 0 if an error occurs. | ||
| 198 | A return value of 0 indicates failure if | ||
| 199 | .Fa e | ||
| 200 | is | ||
| 201 | .Dv NULL | ||
| 202 | or has a reference count of 0, or success if | ||
| 203 | .Fa e | ||
| 204 | is valid. | ||
| 205 | .It Dv ENGINE_CTRL_GET_NEXT_CMD_TYPE | ||
| 206 | Return the positive command number of the next user-defined command | ||
| 207 | after the user-defined command with the number | ||
| 208 | .Fa i , | ||
| 209 | or a number less than or equal to 0 if an error occurs or if | ||
| 210 | .Fa i | ||
| 211 | is the last user-defined command. | ||
| 212 | Together with | ||
| 213 | .Dv ENGINE_CTRL_GET_FIRST_CMD_TYPE , | ||
| 214 | this can be used to iterate the user-defined commands installed with | ||
| 215 | .Fn ENGINE_set_cmd_defns . | ||
| 216 | .It Dv ENGINE_CTRL_HAS_CTRL_FUNCTION | ||
| 217 | Return 1 if | ||
| 218 | .Fa e | ||
| 219 | has its own | ||
| 220 | .Fa ctrl_f | ||
| 221 | installed with | ||
| 222 | .Fn ENGINE_set_ctrl_function | ||
| 223 | or 0 otherwise. | ||
| 224 | .El | ||
| 225 | .Pp | ||
| 226 | .Fn ENGINE_ctrl_cmd | ||
| 227 | translates the | ||
| 228 | .Fa cmd_name | ||
| 229 | of a user-defined command to a | ||
| 230 | .Fa cmd | ||
| 231 | number and calls | ||
| 232 | .Fn ENGINE_ctrl | ||
| 233 | on it. | ||
| 234 | If | ||
| 235 | .Fa cmd_optional | ||
| 236 | is non-zero, lack of a | ||
| 237 | .Fa ctrl_f | ||
| 238 | in | ||
| 239 | .Fa e | ||
| 240 | and translation failure with | ||
| 241 | .Dv ENGINE_CTRL_GET_CMD_FROM_NAME | ||
| 242 | are considered success, and the command has no effect. | ||
| 243 | Otherwise, these problems cause | ||
| 244 | .Fn ENGINE_ctrl_cmd | ||
| 245 | to fail. | ||
| 246 | .Pp | ||
| 247 | Neither | ||
| 248 | .Fn ENGINE_ctrl | ||
| 249 | nor | ||
| 250 | .Fn ENGINE_ctrl_cmd | ||
| 251 | ever call the | ||
| 252 | .Fa f | ||
| 253 | callback, but merely pass it on as an argument to the engine-specific | ||
| 254 | .Fa ctrl_f | ||
| 255 | control function. | ||
| 256 | It is up to | ||
| 257 | .Fa ctrl_f | ||
| 258 | how to use it, or alternatively to ignore it as well. | ||
| 259 | .Pp | ||
| 260 | .Fn ENGINE_ctrl_cmd_string | ||
| 261 | translates the | ||
| 262 | .Fa cmd_name | ||
| 263 | of a user-defined command to a | ||
| 264 | .Fa cmd | ||
| 265 | number. | ||
| 266 | If that command has the | ||
| 267 | .Dv ENGINE_CMD_FLAG_NO_INPUT | ||
| 268 | flag set, | ||
| 269 | .Fa arg | ||
| 270 | must be | ||
| 271 | .Dv NULL | ||
| 272 | and | ||
| 273 | .Fn ENGINE_ctrl | ||
| 274 | is called with | ||
| 275 | .Fa i | ||
| 276 | set to 0 and | ||
| 277 | .Fa p | ||
| 278 | set to | ||
| 279 | .Dv NULL . | ||
| 280 | Otherwise, | ||
| 281 | .Fa arg | ||
| 282 | must not be | ||
| 283 | .Dv NULL . | ||
| 284 | If the command accepts string input, | ||
| 285 | .Fa i | ||
| 286 | is set to 0 and | ||
| 287 | .Fa arg | ||
| 288 | is passed as the | ||
| 289 | .Fa p | ||
| 290 | argument to | ||
| 291 | .Fn ENGINE_ctrl . | ||
| 292 | Otherwise, | ||
| 293 | .Fa arg | ||
| 294 | is converted with | ||
| 295 | .Xr strtol 3 | ||
| 296 | and passed as the | ||
| 297 | .Fa i | ||
| 298 | argument to | ||
| 299 | .Fn ENGINE_ctrl , | ||
| 300 | setting | ||
| 301 | .Fa p | ||
| 302 | to | ||
| 303 | .Dv NULL . | ||
| 304 | .Pp | ||
| 305 | .Fn ENGINE_set_ctrl_function | ||
| 306 | installs | ||
| 307 | .Fa ctrl_f | ||
| 308 | as the engine-specific control function for | ||
| 309 | .Fa e . | ||
| 310 | Future calls to | ||
| 311 | .Fn ENGINE_ctrl | ||
| 312 | will call that function, passing on their arguments unchanged, if the | ||
| 313 | .Fa cmd | ||
| 314 | is not built-in to the library or if the | ||
| 315 | .Dv ENGINE_FLAGS_MANUAL_CMD_CTRL | ||
| 316 | flag is set in | ||
| 317 | .Fa e . | ||
| 318 | Let the | ||
| 319 | .Fa ctrl_f | ||
| 320 | return positive values on success or negative values on failure. | ||
| 321 | Avoid return values of 0 because they cause dangerous ambiguity. | ||
| 322 | In particular, | ||
| 323 | .Fn ENGINE_ctrl_cmd | ||
| 324 | and | ||
| 325 | .Fn ENGINE_ctrl_cmd_string | ||
| 326 | cannot be used with user-defined commands | ||
| 327 | that may return 0 on success. | ||
| 328 | .Pp | ||
| 329 | .Fn ENGINE_set_cmd_defns | ||
| 330 | install an array of command definitions in | ||
| 331 | .Fa e . | ||
| 332 | .Pp | ||
| 333 | The structure | ||
| 334 | .Vt ENGINE_CMD_DEFN | ||
| 335 | has the following fields: | ||
| 336 | .Bl -tag -width Ds | ||
| 337 | .It Fa "unsigned int cmd_num" | ||
| 338 | A positive, unique, monotonically increasing command number. | ||
| 339 | Avoid using numbers below | ||
| 340 | .Dv ENGINE_CMD_BASE . | ||
| 341 | .It Fa "const char *cmd_name" | ||
| 342 | The unique name of the command. | ||
| 343 | .It Fa "const char *cmd_desc" | ||
| 344 | A short description of the command. | ||
| 345 | .It Fa "unsigned int cmd_flags" | ||
| 346 | The bitwise OR of zero or more of the following flags: | ||
| 347 | .Bl -tag -width Ds | ||
| 348 | .It Dv ENGINE_CMD_FLAG_NUMERIC | ||
| 349 | The command uses | ||
| 350 | .Fa i . | ||
| 351 | .It Dv ENGINE_CMD_FLAG_STRING | ||
| 352 | The command uses | ||
| 353 | .Fa p . | ||
| 354 | .It Dv ENGINE_CMD_FLAG_NO_INPUT | ||
| 355 | The command neither uses | ||
| 356 | .Fa i | ||
| 357 | nor | ||
| 358 | .Fa p . | ||
| 359 | .It Dv ENGINE_CMD_FLAG_INTERNAL | ||
| 360 | This flag has no effect and is only provided for compatibility. | ||
| 361 | .El | ||
| 362 | .El | ||
| 363 | .Pp | ||
| 364 | The last element of | ||
| 365 | .Fa defns | ||
| 366 | does not specify a command, but must have a | ||
| 367 | .Fa cmd_num | ||
| 368 | of 0 and a | ||
| 369 | .Fa cmd_name | ||
| 370 | of | ||
| 371 | .Dv NULL | ||
| 372 | to indicate the end of the array. | ||
| 373 | .Sh RETURN VALUES | ||
| 374 | For | ||
| 375 | .Fn ENGINE_ctrl , | ||
| 376 | positive return values indicate success and negative return values | ||
| 377 | indicate failure. | ||
| 378 | The meaning of a zero return value depends on the particular | ||
| 379 | .Fa cmd | ||
| 380 | and may indicate both success and failure, which is pathetic. | ||
| 381 | .Pp | ||
| 382 | Regardless of the | ||
| 383 | .Fa cmd , | ||
| 384 | .Fn ENGINE_ctrl | ||
| 385 | returns 0 if | ||
| 386 | .Fa e | ||
| 387 | is | ||
| 388 | .Dv NULL | ||
| 389 | or has a reference count of 0. | ||
| 390 | This is quite unfortunate for commands like | ||
| 391 | .Dv ENGINE_CTRL_GET_CMD_FLAGS | ||
| 392 | where 0 may indicate success, so make sure | ||
| 393 | .Fa e | ||
| 394 | is valid before issuing a control command. | ||
| 395 | .Pp | ||
| 396 | For built-in commands except | ||
| 397 | .Dv ENGINE_CTRL_HAS_CTRL_FUNCTION , | ||
| 398 | .Fn ENGINE_ctrl | ||
| 399 | returns \-1 if | ||
| 400 | .Dv ENGINE_FLAGS_MANUAL_CMD_CTRL | ||
| 401 | is set but no | ||
| 402 | .Fa ctrl_f | ||
| 403 | has been installed with | ||
| 404 | .Fn ENGINE_set_ctrl_function . | ||
| 405 | .Pp | ||
| 406 | For commands that are not built in, | ||
| 407 | .Fn ENGINE_ctrl | ||
| 408 | returns 0 if no | ||
| 409 | .Fa ctrl_f | ||
| 410 | has been installed with | ||
| 411 | .Fn ENGINE_set_ctrl_function . | ||
| 412 | .Pp | ||
| 413 | .Fn ENGINE_cmd_is_executable | ||
| 414 | returns 1 if the user-defined | ||
| 415 | .Fa cmd | ||
| 416 | is executable and has at least one of the flags | ||
| 417 | .Dv ENGINE_CMD_FLAG_NUMERIC , | ||
| 418 | .Dv ENGINE_CMD_FLAG_STRING , | ||
| 419 | and | ||
| 420 | .Dv ENGINE_CMD_FLAG_NO_INPUT | ||
| 421 | set, or 0 otherwise. | ||
| 422 | .Pp | ||
| 423 | .Fn ENGINE_ctrl_cmd | ||
| 424 | and | ||
| 425 | .Fn ENGINE_ctrl_cmd_string | ||
| 426 | return 1 on success or 0 on error. | ||
| 427 | .Pp | ||
| 428 | .Fn ENGINE_set_ctrl_function | ||
| 429 | and | ||
| 430 | .Fn ENGINE_set_cmd_defns | ||
| 431 | always return 1. | ||
| 432 | .Pp | ||
| 433 | .Fn ENGINE_get_ctrl_function | ||
| 434 | returns a pointer to the function | ||
| 435 | .Fa ctrl_f | ||
| 436 | installed with | ||
| 437 | .Fn ENGINE_set_ctrl_function , | ||
| 438 | or | ||
| 439 | .Dv NULL | ||
| 440 | if none has been installed. | ||
| 441 | .Pp | ||
| 442 | .Fn ENGINE_get_cmd_defns | ||
| 443 | returns the array of command definitions installed in | ||
| 444 | .Fa e | ||
| 445 | or | ||
| 446 | .Dv NULL | ||
| 447 | if none is installed. | ||
| 448 | .Sh SEE ALSO | ||
| 449 | .Xr ENGINE_add 3 , | ||
| 450 | .Xr ENGINE_init 3 , | ||
| 451 | .Xr ENGINE_new 3 , | ||
| 452 | .Xr ENGINE_register_RSA 3 , | ||
| 453 | .Xr ENGINE_set_flags 3 , | ||
| 454 | .Xr ENGINE_set_RSA 3 | ||
| 455 | .Sh HISTORY | ||
| 456 | .Fn ENGINE_ctrl , | ||
| 457 | .Fn ENGINE_set_ctrl_function , | ||
| 458 | and | ||
| 459 | .Fn ENGINE_get_ctrl_function | ||
| 460 | first appeared in OpenSSL 0.9.7 and have been available since | ||
| 461 | .Ox 2.9 . | ||
| 462 | .Pp | ||
| 463 | .Fn ENGINE_cmd_is_executable , | ||
| 464 | .Fn ENGINE_ctrl_cmd , | ||
| 465 | .Fn ENGINE_ctrl_cmd_string , | ||
| 466 | .Fn ENGINE_set_cmd_defns , | ||
| 467 | and | ||
| 468 | .Fn ENGINE_get_cmd_defns | ||
| 469 | first appeared in OpenSSL 0.9.7 and have been available since | ||
| 470 | .Ox 3.2 . | ||
