diff options
Diffstat (limited to 'src/lib/libcrypto/man/X509_LOOKUP_new.3')
| -rw-r--r-- | src/lib/libcrypto/man/X509_LOOKUP_new.3 | 616 |
1 files changed, 0 insertions, 616 deletions
diff --git a/src/lib/libcrypto/man/X509_LOOKUP_new.3 b/src/lib/libcrypto/man/X509_LOOKUP_new.3 deleted file mode 100644 index 02420d664b..0000000000 --- a/src/lib/libcrypto/man/X509_LOOKUP_new.3 +++ /dev/null | |||
| @@ -1,616 +0,0 @@ | |||
| 1 | .\" $OpenBSD: X509_LOOKUP_new.3,v 1.4 2021/08/06 19:09:56 schwarze Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2021 Ingo Schwarze <schwarze@openbsd.org> | ||
| 4 | .\" | ||
| 5 | .\" Permission to use, copy, modify, and distribute this software for any | ||
| 6 | .\" purpose with or without fee is hereby granted, provided that the above | ||
| 7 | .\" copyright notice and this permission notice appear in all copies. | ||
| 8 | .\" | ||
| 9 | .\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
| 10 | .\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
| 11 | .\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
| 12 | .\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
| 13 | .\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
| 16 | .\" | ||
| 17 | .Dd $Mdocdate: August 6 2021 $ | ||
| 18 | .Dt X509_LOOKUP_NEW 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm X509_LOOKUP_new , | ||
| 22 | .Nm X509_LOOKUP_free , | ||
| 23 | .Nm X509_LOOKUP_ctrl , | ||
| 24 | .Nm X509_LOOKUP_add_dir , | ||
| 25 | .Nm X509_LOOKUP_load_file , | ||
| 26 | .Nm X509_LOOKUP_add_mem , | ||
| 27 | .Nm X509_LOOKUP_by_subject , | ||
| 28 | .Nm X509_LOOKUP_init , | ||
| 29 | .Nm X509_LOOKUP_shutdown , | ||
| 30 | .Nm X509_LOOKUP_by_issuer_serial , | ||
| 31 | .Nm X509_LOOKUP_by_fingerprint , | ||
| 32 | .Nm X509_LOOKUP_by_alias , | ||
| 33 | .Nm X509_get_default_cert_dir , | ||
| 34 | .Nm X509_get_default_cert_file , | ||
| 35 | .Nm X509_get_default_cert_dir_env , | ||
| 36 | .Nm X509_get_default_cert_file_env | ||
| 37 | .\" X509_get_default_private_dir is intentionally undocumented | ||
| 38 | .\" because it appears to be unused by any real-world software | ||
| 39 | .\" and because it doesn't do much in the first place. | ||
| 40 | .Nd certificate lookup object | ||
| 41 | .Sh SYNOPSIS | ||
| 42 | .In openssl/x509_vfy.h | ||
| 43 | .Ft X509_LOOKUP * | ||
| 44 | .Fn X509_LOOKUP_new "X509_LOOKUP_METHOD *method" | ||
| 45 | .Ft void | ||
| 46 | .Fn X509_LOOKUP_free "X509_LOOKUP *lookup" | ||
| 47 | .Ft int | ||
| 48 | .Fo X509_LOOKUP_ctrl | ||
| 49 | .Fa "X509_LOOKUP *lookup" | ||
| 50 | .Fa "int command" | ||
| 51 | .Fa "const char *source" | ||
| 52 | .Fa "long type" | ||
| 53 | .Fa "char **ret" | ||
| 54 | .Fc | ||
| 55 | .Ft int | ||
| 56 | .Fo X509_LOOKUP_add_dir | ||
| 57 | .Fa "X509_LOOKUP *lookup" | ||
| 58 | .Fa "const char *source" | ||
| 59 | .Fa "long type" | ||
| 60 | .Fc | ||
| 61 | .Ft int | ||
| 62 | .Fo X509_LOOKUP_load_file | ||
| 63 | .Fa "X509_LOOKUP *lookup" | ||
| 64 | .Fa "const char *source" | ||
| 65 | .Fa "long type" | ||
| 66 | .Fc | ||
| 67 | .Ft int | ||
| 68 | .Fo X509_LOOKUP_add_mem | ||
| 69 | .Fa "X509_LOOKUP *lookup" | ||
| 70 | .Fa "const struct iovec *source" | ||
| 71 | .Fa "long type" | ||
| 72 | .Fc | ||
| 73 | .Ft int | ||
| 74 | .Fo X509_LOOKUP_by_subject | ||
| 75 | .Fa "X509_LOOKUP *lookup" | ||
| 76 | .Fa "int type" | ||
| 77 | .Fa "X509_NAME *name" | ||
| 78 | .Fa "X509_OBJECT *object" | ||
| 79 | .Fc | ||
| 80 | .Ft int | ||
| 81 | .Fn X509_LOOKUP_init "X509_LOOKUP *lookup" | ||
| 82 | .Ft int | ||
| 83 | .Fn X509_LOOKUP_shutdown "X509_LOOKUP *lookup" | ||
| 84 | .Ft int | ||
| 85 | .Fo X509_LOOKUP_by_issuer_serial | ||
| 86 | .Fa "X509_LOOKUP *lookup" | ||
| 87 | .Fa "int type" | ||
| 88 | .Fa "X509_NAME *name" | ||
| 89 | .Fa "ASN1_INTEGER *serial" | ||
| 90 | .Fa "X509_OBJECT *object" | ||
| 91 | .Fc | ||
| 92 | .Ft int | ||
| 93 | .Fo X509_LOOKUP_by_fingerprint | ||
| 94 | .Fa "X509_LOOKUP *lookup" | ||
| 95 | .Fa "int type" | ||
| 96 | .Fa "const unsigned char *bytes" | ||
| 97 | .Fa "int length" | ||
| 98 | .Fa "X509_OBJECT *object" | ||
| 99 | .Fc | ||
| 100 | .Ft int | ||
| 101 | .Fo X509_LOOKUP_by_alias | ||
| 102 | .Fa "X509_LOOKUP *lookup" | ||
| 103 | .Fa "int type" | ||
| 104 | .Fa "const char *string" | ||
| 105 | .Fa "int length" | ||
| 106 | .Fa "X509_OBJECT *object" | ||
| 107 | .Fc | ||
| 108 | .In openssl/x509.h | ||
| 109 | .Ft const char * | ||
| 110 | .Fn X509_get_default_cert_dir void | ||
| 111 | .Ft const char * | ||
| 112 | .Fn X509_get_default_cert_file void | ||
| 113 | .Ft const char * | ||
| 114 | .Fn X509_get_default_cert_dir_env void | ||
| 115 | .Ft const char * | ||
| 116 | .Fn X509_get_default_cert_file_env void | ||
| 117 | .Sh DESCRIPTION | ||
| 118 | .Fn X509_LOOKUP_new | ||
| 119 | allocates a new, empty | ||
| 120 | .Vt X509_LOOKUP | ||
| 121 | object and associates it with the | ||
| 122 | .Fa method | ||
| 123 | which is a static objects returned from either | ||
| 124 | .Xr X509_LOOKUP_hash_dir 3 | ||
| 125 | or | ||
| 126 | .Xr X509_LOOKUP_file 3 | ||
| 127 | or | ||
| 128 | .Xr X509_LOOKUP_mem 3 . | ||
| 129 | .Pp | ||
| 130 | .Fn X509_LOOKUP_free | ||
| 131 | releases the memory used by | ||
| 132 | .Fa lookup . | ||
| 133 | If | ||
| 134 | .Fa lookup | ||
| 135 | is a | ||
| 136 | .Dv NULL | ||
| 137 | pointer, no action occurs. | ||
| 138 | .Pp | ||
| 139 | The operation of | ||
| 140 | .Fn X509_LOOKUP_ctrl | ||
| 141 | depends on the | ||
| 142 | .Vt X509_LOOKUP_METHOD | ||
| 143 | used by | ||
| 144 | .Fa lookup : | ||
| 145 | .Bl -tag -width 4n | ||
| 146 | .It Xr X509_LOOKUP_hash_dir 3 | ||
| 147 | The | ||
| 148 | .Fa command | ||
| 149 | is required to be | ||
| 150 | .Dv X509_L_ADD_DIR | ||
| 151 | and the | ||
| 152 | .Fa source | ||
| 153 | argument is interpreted | ||
| 154 | as a colon-separated, NUL-terminated list of directory names. | ||
| 155 | These directories are added to an internal list of directories to search | ||
| 156 | for certificate files of the given | ||
| 157 | .Fa type . | ||
| 158 | .Pp | ||
| 159 | If | ||
| 160 | .Fa type | ||
| 161 | is | ||
| 162 | .Dv X509_FILETYPE_DEFAULT , | ||
| 163 | the | ||
| 164 | .Fa source | ||
| 165 | argument is ignored and | ||
| 166 | .Pa /etc/ssl/certs | ||
| 167 | and a type of | ||
| 168 | .Dv X509_FILETYPE_PEM | ||
| 169 | are used instead. | ||
| 170 | .Pp | ||
| 171 | .Fn X509_LOOKUP_add_dir | ||
| 172 | is a macro that calls | ||
| 173 | .Fn X509_LOOKUP_ctrl | ||
| 174 | with a | ||
| 175 | .Fa command | ||
| 176 | of | ||
| 177 | .Dv X509_L_ADD_DIR | ||
| 178 | and | ||
| 179 | .Fa ret | ||
| 180 | set to | ||
| 181 | .Dv NULL . | ||
| 182 | .Pp | ||
| 183 | This lookup method is peculiar in so far as calling | ||
| 184 | .Fn X509_LOOKUP_ctrl | ||
| 185 | on a lookup object using it does not yet add any certificates to the associated | ||
| 186 | .Vt X509_STORE | ||
| 187 | object. | ||
| 188 | They need to be added selectively using | ||
| 189 | .Fn X509_LOOKUP_by_subject . | ||
| 190 | .It Xr X509_LOOKUP_file 3 | ||
| 191 | The | ||
| 192 | .Fa command | ||
| 193 | is required to be | ||
| 194 | .Dv X509_L_FILE_LOAD | ||
| 195 | and the | ||
| 196 | .Fa source | ||
| 197 | argument is interpreted as a NUL-terminated file name. | ||
| 198 | If the | ||
| 199 | .Fa type | ||
| 200 | is | ||
| 201 | .Dv X509_FILETYPE_PEM , | ||
| 202 | the file is read with | ||
| 203 | .Xr BIO_new_file 3 | ||
| 204 | and | ||
| 205 | .Xr PEM_X509_INFO_read_bio 3 | ||
| 206 | and the certificates and revocation lists found are added to the | ||
| 207 | .Vt X509_STORE | ||
| 208 | object associated with | ||
| 209 | .Fa lookup | ||
| 210 | using | ||
| 211 | .Xr X509_STORE_add_cert 3 | ||
| 212 | and | ||
| 213 | .Xr X509_STORE_add_crl 3 . | ||
| 214 | If | ||
| 215 | .Fa type | ||
| 216 | is | ||
| 217 | .Dv X509_FILETYPE_DEFAULT , | ||
| 218 | the | ||
| 219 | .Fa source | ||
| 220 | argument is ignored and | ||
| 221 | .Pa /etc/ssl/certs.pem | ||
| 222 | and a type of | ||
| 223 | .Dv X509_FILETYPE_PEM | ||
| 224 | are used instead. | ||
| 225 | If | ||
| 226 | .Fa type | ||
| 227 | is | ||
| 228 | .Dv X509_FILETYPE_ASN1 , | ||
| 229 | the file is read with | ||
| 230 | .Xr d2i_X509_bio 3 | ||
| 231 | and the single certificate is added to the | ||
| 232 | .Vt X509_STORE | ||
| 233 | object associated with | ||
| 234 | .Fa lookup | ||
| 235 | using | ||
| 236 | .Xr X509_STORE_add_cert 3 . | ||
| 237 | .Pp | ||
| 238 | .Fn X509_LOOKUP_load_file | ||
| 239 | is a macro calling | ||
| 240 | .Fn X509_LOOKUP_ctrl | ||
| 241 | with a | ||
| 242 | .Fa command | ||
| 243 | of | ||
| 244 | .Dv X509_L_FILE_LOAD | ||
| 245 | and | ||
| 246 | .Fa ret | ||
| 247 | set to | ||
| 248 | .Dv NULL . | ||
| 249 | .It Xr X509_LOOKUP_mem 3 | ||
| 250 | The | ||
| 251 | .Fa command | ||
| 252 | and | ||
| 253 | .Fa type | ||
| 254 | are required to be | ||
| 255 | .Dv X509_L_MEM | ||
| 256 | and | ||
| 257 | .Dv X509_FILETYPE_PEM , | ||
| 258 | respectively. | ||
| 259 | The | ||
| 260 | .Fa source | ||
| 261 | argument is interpreted as a pointer to an | ||
| 262 | .Vt iovec | ||
| 263 | structure defined in | ||
| 264 | .In sys/uio.h . | ||
| 265 | The memory area described by that structure is read with | ||
| 266 | .Xr BIO_new_mem_buf 3 | ||
| 267 | and | ||
| 268 | .Xr PEM_X509_INFO_read_bio 3 | ||
| 269 | and the certificates and revocation lists found are added to the | ||
| 270 | .Vt X509_STORE | ||
| 271 | object associated with | ||
| 272 | .Fa lookup | ||
| 273 | using | ||
| 274 | .Xr X509_STORE_add_cert 3 | ||
| 275 | and | ||
| 276 | .Xr X509_STORE_add_crl 3 . | ||
| 277 | .Pp | ||
| 278 | .Fn X509_LOOKUP_add_mem | ||
| 279 | is a macro calling | ||
| 280 | .Fn X509_LOOKUP_ctrl | ||
| 281 | with a command of | ||
| 282 | .Dv X509_L_MEM | ||
| 283 | and | ||
| 284 | .Fa ret | ||
| 285 | set to | ||
| 286 | .Dv NULL . | ||
| 287 | .El | ||
| 288 | .Pp | ||
| 289 | .Fn X509_LOOKUP_ctrl | ||
| 290 | always ignores the | ||
| 291 | .Fa ret | ||
| 292 | argument when the built-in | ||
| 293 | .Vt X509_LOOKUP_METHOD | ||
| 294 | objects are used. | ||
| 295 | .Pp | ||
| 296 | When using built-in | ||
| 297 | .Vt X509_LOOKUP_METHOD | ||
| 298 | objects, | ||
| 299 | .Fn X509_LOOKUP_by_subject | ||
| 300 | is only useful if | ||
| 301 | .Fa lookup | ||
| 302 | uses | ||
| 303 | .Xr X509_LOOKUP_hash_dir 3 . | ||
| 304 | It passes the | ||
| 305 | .Fa name | ||
| 306 | to | ||
| 307 | .Xr X509_NAME_hash 3 | ||
| 308 | and converts the resulting hash to an eight-digit lower-case | ||
| 309 | hexadecimal number. | ||
| 310 | .Pp | ||
| 311 | If the | ||
| 312 | .Fa type | ||
| 313 | is | ||
| 314 | .Dv X509_LU_X509 , | ||
| 315 | it searches the configured directories for files having that name, | ||
| 316 | with a file name extension that is a small, non-negative decimal integer | ||
| 317 | starting at | ||
| 318 | .Qq ".0" . | ||
| 319 | These files are read with | ||
| 320 | .Xr X509_load_cert_file 3 . | ||
| 321 | In each directory, the search is ended once a file with the expected name | ||
| 322 | and extension does not exists. | ||
| 323 | .Pp | ||
| 324 | If the | ||
| 325 | .Fa type | ||
| 326 | is | ||
| 327 | .Dv X509_LU_CRL , | ||
| 328 | the file name extensions are expected to have a prefix of | ||
| 329 | .Qq "r" , | ||
| 330 | i.e. they start with | ||
| 331 | .Qq ".r0" , | ||
| 332 | and the files are read with | ||
| 333 | .Xr X509_load_crl_file 3 . | ||
| 334 | .Pp | ||
| 335 | In case of success, the first match is returned in the | ||
| 336 | .Pf * Fa object | ||
| 337 | provided by the caller, overwriting any previous content. | ||
| 338 | .Pp | ||
| 339 | Unless an application program manually constructs its own | ||
| 340 | .Vt X509_LOOKUP_METHOD | ||
| 341 | object containing its own callback functions, | ||
| 342 | .Fn X509_LOOKUP_init , | ||
| 343 | .Fn X509_LOOKUP_shutdown , | ||
| 344 | .Fn X509_LOOKUP_by_issuer_serial , | ||
| 345 | .Fn X509_LOOKUP_by_fingerprint , | ||
| 346 | and | ||
| 347 | .Fn X509_LOOKUP_by_alias | ||
| 348 | have no effect. | ||
| 349 | .Fn X509_LOOKUP_init | ||
| 350 | is supposed to be called after | ||
| 351 | .Fn X509_LOOKUP_new | ||
| 352 | and before using the | ||
| 353 | .Fa lookup | ||
| 354 | object, | ||
| 355 | .Fn X509_LOOKUP_shutdown | ||
| 356 | after using it and before | ||
| 357 | .Fn X509_LOOKUP_free . | ||
| 358 | .Sh RETURN VALUES | ||
| 359 | .Fn X509_LOOKUP_new | ||
| 360 | returns the new object or | ||
| 361 | .Dv NULL | ||
| 362 | if memory allocation fails. | ||
| 363 | .Pp | ||
| 364 | .Fn X509_LOOKUP_ctrl | ||
| 365 | returns 1 for success or 0 for failure. | ||
| 366 | If | ||
| 367 | .Fa lookup | ||
| 368 | uses a user-defined | ||
| 369 | .Vt X509_LOOKUP_METHOD | ||
| 370 | object, it might also return \-1 for internal errors. | ||
| 371 | .Pp | ||
| 372 | .Fn X509_LOOKUP_by_subject | ||
| 373 | returns | ||
| 374 | .Dv X509_LU_X509 | ||
| 375 | for success or | ||
| 376 | .Dv X509_LU_FAIL | ||
| 377 | for failure. | ||
| 378 | In particular, it fails if | ||
| 379 | .Fa lookup | ||
| 380 | uses | ||
| 381 | .Xr X509_LOOKUP_file 3 | ||
| 382 | or | ||
| 383 | .Xr X509_LOOKUP_mem 3 , | ||
| 384 | if | ||
| 385 | .Fa name | ||
| 386 | is | ||
| 387 | .Dv NULL , | ||
| 388 | if | ||
| 389 | .Fa type | ||
| 390 | is neither | ||
| 391 | .Dv X509_LU_X509 | ||
| 392 | nor | ||
| 393 | .Dv X509_LU_CRL , | ||
| 394 | if no match is found, or if memory allocation fails. | ||
| 395 | If | ||
| 396 | .Fa lookup | ||
| 397 | uses a user-defined | ||
| 398 | .Vt X509_LOOKUP_METHOD | ||
| 399 | object, it might also return negative values for internal errors. | ||
| 400 | .Pp | ||
| 401 | .Fn X509_LOOKUP_init | ||
| 402 | and | ||
| 403 | .Fn X509_LOOKUP_shutdown | ||
| 404 | are supposed to return 1 for success and 0 for failure. | ||
| 405 | When using the built-in | ||
| 406 | .Vt X509_LOOKUP_METHOD | ||
| 407 | objects, they always return 1. | ||
| 408 | .Pp | ||
| 409 | .Fn X509_LOOKUP_by_issuer_serial , | ||
| 410 | .Fn X509_LOOKUP_by_fingerprint , | ||
| 411 | and | ||
| 412 | .Fn X509_LOOKUP_by_alias | ||
| 413 | always return | ||
| 414 | .Dv X509_LU_FAIL | ||
| 415 | when using the built-in | ||
| 416 | .Vt X509_LOOKUP_METHOD | ||
| 417 | objects. | ||
| 418 | .Pp | ||
| 419 | .Fn X509_get_default_cert_dir | ||
| 420 | returns a pointer to the constant string | ||
| 421 | .Qq /etc/ssl/certs , | ||
| 422 | .Fn X509_get_default_cert_file | ||
| 423 | to | ||
| 424 | .Qq /etc/ssl/certs.pem , | ||
| 425 | .Fn X509_get_default_cert_dir_env | ||
| 426 | to | ||
| 427 | .Qq SSL_CERT_DIR , | ||
| 428 | and | ||
| 429 | .Fn X509_get_default_cert_file_env | ||
| 430 | to | ||
| 431 | .Qq SSL_CERT_FILE . | ||
| 432 | .Sh ENVIRONMENT | ||
| 433 | For reasons of security and simplicity, | ||
| 434 | LibreSSL ignores the environment variables | ||
| 435 | .Ev SSL_CERT_DIR | ||
| 436 | and | ||
| 437 | .Ev SSL_CERT_FILE , | ||
| 438 | but other library implementations may use their contents instead | ||
| 439 | of the standard locations for trusted certificates, and a few | ||
| 440 | third-party application programs also inspect these variables | ||
| 441 | directly and may pass their values to | ||
| 442 | .Fn X509_LOOKUP_add_dir | ||
| 443 | and | ||
| 444 | .Fn X509_LOOKUP_load_file . | ||
| 445 | .Sh FILES | ||
| 446 | .Bl -tag -width /etc/ssl/certs.pem -compact | ||
| 447 | .It Pa /etc/ssl/certs/ | ||
| 448 | default directory for storing trusted certificates | ||
| 449 | .It Pa /etc/ssl/certs.pem | ||
| 450 | default file for storing trusted certificates | ||
| 451 | .El | ||
| 452 | .Sh ERRORS | ||
| 453 | The following diagnostics can be retrieved with | ||
| 454 | .Xr ERR_get_error 3 , | ||
| 455 | .Xr ERR_GET_REASON 3 , | ||
| 456 | and | ||
| 457 | .Xr ERR_reason_error_string 3 : | ||
| 458 | .Bl -tag -width Ds | ||
| 459 | .It Dv ERR_R_ASN1_LIB Qq "ASN1 lib" | ||
| 460 | .Xr d2i_X509_bio 3 | ||
| 461 | failed in | ||
| 462 | .Fn X509_LOOKUP_ctrl . | ||
| 463 | .It Dv X509_R_BAD_X509_FILETYPE Qq "bad x509 filetype" | ||
| 464 | .Fn X509_LOOKUP_ctrl | ||
| 465 | was called with an invalid | ||
| 466 | .Fa type . | ||
| 467 | .It Dv ERR_R_BUF_LIB Qq "BUF lib" | ||
| 468 | Memory allocation failed in | ||
| 469 | .Fn X509_LOOKUP_by_subject . | ||
| 470 | .It Dv X509_R_INVALID_DIRECTORY Qq "invalid directory" | ||
| 471 | The | ||
| 472 | .Fa source | ||
| 473 | argument of | ||
| 474 | .Fn X509_LOOKUP_ctrl | ||
| 475 | with | ||
| 476 | .Dv X509_L_ADD_DIR | ||
| 477 | or | ||
| 478 | .Fn X509_LOOKUP_add_dir | ||
| 479 | was | ||
| 480 | .Dv NULL | ||
| 481 | or an empty string. | ||
| 482 | .It Dv X509_R_LOADING_CERT_DIR Qq "loading cert dir" | ||
| 483 | .Fn X509_LOOKUP_ctrl | ||
| 484 | with | ||
| 485 | .Dv X509_L_ADD_DIR | ||
| 486 | or | ||
| 487 | .Fn X509_LOOKUP_add_dir | ||
| 488 | was called with | ||
| 489 | .Dv X509_FILETYPE_DEFAULT | ||
| 490 | and adding the default directories failed. | ||
| 491 | This error is added after and in addition to a more specific diagnostic. | ||
| 492 | .It Dv X509_R_LOADING_DEFAULTS Qq "loading defaults" | ||
| 493 | .Fn X509_LOOKUP_ctrl | ||
| 494 | with | ||
| 495 | .Dv X509_L_FILE_LOAD | ||
| 496 | or | ||
| 497 | .Fn X509_LOOKUP_load_file | ||
| 498 | was called with | ||
| 499 | .Dv X509_FILETYPE_DEFAULT | ||
| 500 | and adding the certificates and revocation lists failed. | ||
| 501 | This error is added after and in addition to a more specific diagnostic. | ||
| 502 | .It Dv ERR_R_MALLOC_FAILURE Qq "malloc failure" | ||
| 503 | Memory allocation failed in | ||
| 504 | .Fn X509_LOOKUP_ctrl | ||
| 505 | or | ||
| 506 | .Fn X509_LOOKUP_by_subject . | ||
| 507 | .It Dv ERR_R_PEM_LIB Qq "PEM lib" | ||
| 508 | .Xr PEM_X509_INFO_read_bio 3 , | ||
| 509 | .Xr PEM_read_bio_X509_AUX 3 , | ||
| 510 | or | ||
| 511 | .Xr PEM_read_bio_X509_CRL 3 | ||
| 512 | failed in | ||
| 513 | .Fn X509_LOOKUP_ctrl . | ||
| 514 | .It Dv ERR_R_SYS_LIB Qq "system lib" | ||
| 515 | .Xr BIO_new 3 , | ||
| 516 | .Xr BIO_new_file 3 , | ||
| 517 | or | ||
| 518 | .Xr BIO_read_filename 3 | ||
| 519 | failed in | ||
| 520 | .Fn X509_LOOKUP_ctrl . | ||
| 521 | .It Dv X509_R_WRONG_LOOKUP_TYPE Qq "wrong lookup type" | ||
| 522 | .Fn X509_LOOKUP_by_subject | ||
| 523 | was called with an invalid | ||
| 524 | .Fa type . | ||
| 525 | .El | ||
| 526 | .Pp | ||
| 527 | Passing an invalid | ||
| 528 | .Fa command | ||
| 529 | to | ||
| 530 | .Fn X509_LOOKUP_ctrl | ||
| 531 | or calling | ||
| 532 | .Fn X509_LOOKUP_by_subject | ||
| 533 | with a | ||
| 534 | .Dv NULL | ||
| 535 | .Fa name | ||
| 536 | or with arguments that yield no match | ||
| 537 | causes failure but provides no diagnostics. | ||
| 538 | .Sh SEE ALSO | ||
| 539 | .Xr d2i_X509_bio 3 , | ||
| 540 | .Xr PEM_read_bio_X509_AUX 3 , | ||
| 541 | .Xr PEM_X509_INFO_read_bio 3 , | ||
| 542 | .Xr X509_LOOKUP_hash_dir 3 , | ||
| 543 | .Xr X509_NAME_hash 3 , | ||
| 544 | .Xr X509_NAME_new 3 , | ||
| 545 | .Xr X509_new 3 , | ||
| 546 | .Xr X509_OBJECT_get_type 3 , | ||
| 547 | .Xr X509_STORE_add_cert 3 , | ||
| 548 | .Xr X509_STORE_get_by_subject 3 | ||
| 549 | .Sh HISTORY | ||
| 550 | .Fn X509_get_default_cert_dir , | ||
| 551 | .Fn X509_get_default_cert_file , | ||
| 552 | .Fn X509_get_default_cert_dir_env , | ||
| 553 | and | ||
| 554 | .Fn X509_get_default_cert_file_env | ||
| 555 | first appeared in SSLeay 0.4.1 and have been available since | ||
| 556 | .Ox 2.4 . | ||
| 557 | .Pp | ||
| 558 | .Fn X509_LOOKUP_add_mem | ||
| 559 | first appeared in | ||
| 560 | .Ox 5.7 . | ||
| 561 | .Pp | ||
| 562 | The other functions first appeared in SSLeay 0.8.0 | ||
| 563 | and have been available since | ||
| 564 | .Ox 2.4 . | ||
| 565 | .Sh BUGS | ||
| 566 | If the | ||
| 567 | .Fa type | ||
| 568 | is | ||
| 569 | .Dv X509_FILETYPE_DEFAULT | ||
| 570 | or | ||
| 571 | .Dv X509_FILETYPE_PEM , | ||
| 572 | .Fn X509_LOOKUP_ctrl | ||
| 573 | with | ||
| 574 | .Dv X509_L_FILE_LOAD | ||
| 575 | and | ||
| 576 | .Fn X509_LOOKUP_load_file | ||
| 577 | silently ignore failure of | ||
| 578 | .Xr X509_STORE_add_cert 3 | ||
| 579 | and | ||
| 580 | .Xr X509_STORE_add_crl 3 | ||
| 581 | and indicate success anyway. | ||
| 582 | .Pp | ||
| 583 | Handling of a | ||
| 584 | .Dv NULL | ||
| 585 | .Fa source | ||
| 586 | is inconsistent for | ||
| 587 | .Fn X509_LOOKUP_ctrl | ||
| 588 | with | ||
| 589 | .Dv X509_L_FILE_LOAD | ||
| 590 | and for | ||
| 591 | .Fn X509_LOOKUP_load_file . | ||
| 592 | With | ||
| 593 | .Dv X509_FILETYPE_PEM , | ||
| 594 | it causes failure, but with | ||
| 595 | .Dv X509_FILETYPE_ASN1 , | ||
| 596 | no action occurs and success is indicated. | ||
| 597 | .Pp | ||
| 598 | When called on a | ||
| 599 | .Fa lookup | ||
| 600 | object using | ||
| 601 | .Xr X509_LOOKUP_mem 3 , | ||
| 602 | .Fn X509_LOOKUP_ctrl | ||
| 603 | raises | ||
| 604 | .Dv ERR_R_PEM_LIB | ||
| 605 | when called with an invalid | ||
| 606 | .Fa command | ||
| 607 | or | ||
| 608 | .Fa type , | ||
| 609 | when | ||
| 610 | .Xr BIO_new_mem_buf 3 | ||
| 611 | fails, when | ||
| 612 | .Fa source | ||
| 613 | contains zero objects, or when | ||
| 614 | .Xr X509_STORE_add_cert 3 | ||
| 615 | fails on the first object encountered, which is all inconsistent | ||
| 616 | with the behaviour of the other lookup methods. | ||
