diff options
Diffstat (limited to 'src/lib/libcrypto/man/OPENSSL_sk_new.3')
| -rw-r--r-- | src/lib/libcrypto/man/OPENSSL_sk_new.3 | 597 |
1 files changed, 0 insertions, 597 deletions
diff --git a/src/lib/libcrypto/man/OPENSSL_sk_new.3 b/src/lib/libcrypto/man/OPENSSL_sk_new.3 deleted file mode 100644 index 5df45534f7..0000000000 --- a/src/lib/libcrypto/man/OPENSSL_sk_new.3 +++ /dev/null | |||
| @@ -1,597 +0,0 @@ | |||
| 1 | .\" $OpenBSD: OPENSSL_sk_new.3,v 1.12 2021/03/12 05:18:00 jsg Exp $ | ||
| 2 | .\" | ||
| 3 | .\" Copyright (c) 2018 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: March 12 2021 $ | ||
| 18 | .Dt OPENSSL_SK_NEW 3 | ||
| 19 | .Os | ||
| 20 | .Sh NAME | ||
| 21 | .Nm sk_new_null , | ||
| 22 | .Nm sk_new , | ||
| 23 | .Nm sk_set_cmp_func , | ||
| 24 | .Nm sk_dup , | ||
| 25 | .Nm sk_free , | ||
| 26 | .Nm sk_pop_free , | ||
| 27 | .Nm sk_num , | ||
| 28 | .Nm sk_value , | ||
| 29 | .Nm sk_find , | ||
| 30 | .Nm sk_find_ex , | ||
| 31 | .Nm sk_sort , | ||
| 32 | .Nm sk_is_sorted , | ||
| 33 | .Nm sk_push , | ||
| 34 | .Nm sk_unshift , | ||
| 35 | .Nm sk_insert , | ||
| 36 | .Nm sk_set , | ||
| 37 | .Nm sk_pop , | ||
| 38 | .Nm sk_shift , | ||
| 39 | .Nm sk_delete , | ||
| 40 | .Nm sk_delete_ptr , | ||
| 41 | .Nm sk_zero | ||
| 42 | .Nd variable-sized arrays of void pointers, called OpenSSL stacks | ||
| 43 | .Sh SYNOPSIS | ||
| 44 | .In openssl/stack.h | ||
| 45 | .Ft _STACK * | ||
| 46 | .Fn sk_new_null void | ||
| 47 | .Ft _STACK * | ||
| 48 | .Fo sk_new | ||
| 49 | .Fa "int (*compfunc)(const void *, const void *)" | ||
| 50 | .Fc | ||
| 51 | .Ft old_function_pointer | ||
| 52 | .Fo sk_set_cmp_func | ||
| 53 | .Fa "_STACK *stack" | ||
| 54 | .Fa "int (*compfunc)(const void *, const void *)" | ||
| 55 | .Fc | ||
| 56 | .Ft _STACK * | ||
| 57 | .Fo sk_dup | ||
| 58 | .Fa "_STACK *stack" | ||
| 59 | .Fc | ||
| 60 | .Ft void | ||
| 61 | .Fo sk_free | ||
| 62 | .Fa "_STACK *stack" | ||
| 63 | .Fc | ||
| 64 | .Ft void | ||
| 65 | .Fo sk_pop_free | ||
| 66 | .Fa "_STACK *stack" | ||
| 67 | .Fa "void (*freefunc)(void *)" | ||
| 68 | .Fc | ||
| 69 | .Ft int | ||
| 70 | .Fo sk_num | ||
| 71 | .Fa "const _STACK *stack" | ||
| 72 | .Fc | ||
| 73 | .Ft void * | ||
| 74 | .Fo sk_value | ||
| 75 | .Fa "const _STACK *stack" | ||
| 76 | .Fa "int index" | ||
| 77 | .Fc | ||
| 78 | .Ft int | ||
| 79 | .Fo sk_find | ||
| 80 | .Fa "_STACK *stack" | ||
| 81 | .Fa "void *wanted" | ||
| 82 | .Fc | ||
| 83 | .Ft int | ||
| 84 | .Fo sk_find_ex | ||
| 85 | .Fa "_STACK *stack" | ||
| 86 | .Fa "void *wanted" | ||
| 87 | .Fc | ||
| 88 | .Ft void | ||
| 89 | .Fo sk_sort | ||
| 90 | .Fa "_STACK *stack" | ||
| 91 | .Fc | ||
| 92 | .Ft int | ||
| 93 | .Fo sk_is_sorted | ||
| 94 | .Fa "const _STACK *stack" | ||
| 95 | .Fc | ||
| 96 | .Ft int | ||
| 97 | .Fo sk_push | ||
| 98 | .Fa "_STACK *stack" | ||
| 99 | .Fa "void *new_item" | ||
| 100 | .Fc | ||
| 101 | .Ft int | ||
| 102 | .Fo sk_unshift | ||
| 103 | .Fa "_STACK *stack" | ||
| 104 | .Fa "void *new_item" | ||
| 105 | .Fc | ||
| 106 | .Ft int | ||
| 107 | .Fo sk_insert | ||
| 108 | .Fa "_STACK *stack" | ||
| 109 | .Fa "void *new_item" | ||
| 110 | .Fa "int index" | ||
| 111 | .Fc | ||
| 112 | .Ft void * | ||
| 113 | .Fo sk_set | ||
| 114 | .Fa "_STACK *stack" | ||
| 115 | .Fa "int index" | ||
| 116 | .Fa "void *new_item" | ||
| 117 | .Fc | ||
| 118 | .Ft void * | ||
| 119 | .Fo sk_pop | ||
| 120 | .Fa "_STACK *stack" | ||
| 121 | .Fc | ||
| 122 | .Ft void * | ||
| 123 | .Fo sk_shift | ||
| 124 | .Fa "_STACK *stack" | ||
| 125 | .Fc | ||
| 126 | .Ft void * | ||
| 127 | .Fo sk_delete | ||
| 128 | .Fa "_STACK *stack" | ||
| 129 | .Fa "int index" | ||
| 130 | .Fc | ||
| 131 | .Ft void * | ||
| 132 | .Fo sk_delete_ptr | ||
| 133 | .Fa "_STACK *stack" | ||
| 134 | .Fa "void *wanted" | ||
| 135 | .Fc | ||
| 136 | .Ft void | ||
| 137 | .Fo sk_zero | ||
| 138 | .Fa "_STACK *stack" | ||
| 139 | .Fc | ||
| 140 | .Sh DESCRIPTION | ||
| 141 | OpenSSL introduced an idiosyncratic concept of variable sized arrays | ||
| 142 | of pointers and somewhat misleadingly called such an array a | ||
| 143 | .Dq stack . | ||
| 144 | Intrinsically, and as documented in this manual page, OpenSSL stacks | ||
| 145 | are not type safe but only handle | ||
| 146 | .Vt void * | ||
| 147 | function arguments and return values. | ||
| 148 | .Pp | ||
| 149 | OpenSSL also provides a fragile, unusually complicated system of | ||
| 150 | macro-generated wrappers that offers superficial type safety at the | ||
| 151 | expense of extensive obfuscation, implemented using large amounts | ||
| 152 | of autogenerated code involving exceedingly ugly, nested | ||
| 153 | .Xr cpp 1 | ||
| 154 | macros; see the | ||
| 155 | .Xr STACK_OF 3 | ||
| 156 | manual page for details. | ||
| 157 | .Pp | ||
| 158 | The fundamental data type is the | ||
| 159 | .Vt _STACK | ||
| 160 | structure. | ||
| 161 | It stores a variable number of void pointers | ||
| 162 | and remembers the number of pointers currently stored. | ||
| 163 | It can optionally hold a pointer to a comparison function. | ||
| 164 | As long as no comparison function is installed, the order of pointers | ||
| 165 | is meaningful; as soon as a comparison function is installed, it | ||
| 166 | becomes ill-defined. | ||
| 167 | .Pp | ||
| 168 | .Fn sk_new_null | ||
| 169 | allocates and initializes a new, empty stack. | ||
| 170 | .Fn sk_new | ||
| 171 | is identical except that it also installs | ||
| 172 | .Fa compfunc | ||
| 173 | as the comparison function for the new stack object. | ||
| 174 | .Fn sk_set_cmp_func | ||
| 175 | installs | ||
| 176 | .Fa compfunc | ||
| 177 | for the existing | ||
| 178 | .Fa stack . | ||
| 179 | The | ||
| 180 | .Fa compfunc | ||
| 181 | is allowed to be | ||
| 182 | .Dv NULL , | ||
| 183 | but the | ||
| 184 | .Fa stack | ||
| 185 | is not. | ||
| 186 | .Pp | ||
| 187 | .Fn sk_dup | ||
| 188 | creates a shallow copy of the given | ||
| 189 | .Fa stack , | ||
| 190 | which must not be a | ||
| 191 | .Dv NULL | ||
| 192 | pointer. | ||
| 193 | It neither copies the objects pointed to from the stack nor | ||
| 194 | increases their reference counts, but merely copies the pointers. | ||
| 195 | Extreme care must be taken in order to avoid freeing the memory twice, | ||
| 196 | for example by calling | ||
| 197 | .Fn sk_free | ||
| 198 | on one copy and only calling | ||
| 199 | .Fn sk_pop_free | ||
| 200 | on the other. | ||
| 201 | .Pp | ||
| 202 | .Fn sk_free | ||
| 203 | frees the given | ||
| 204 | .Fa stack . | ||
| 205 | It does not free any of the pointers stored on the stack. | ||
| 206 | Unless these pointers are merely copies of pointers owned by | ||
| 207 | other objects, they must be freed before calling | ||
| 208 | .Fn sk_free , | ||
| 209 | in order to avoid leaking memory. | ||
| 210 | If | ||
| 211 | .Fa stack | ||
| 212 | is a | ||
| 213 | .Dv NULL | ||
| 214 | pointer, no action occurs. | ||
| 215 | .Pp | ||
| 216 | .Fn sk_pop_free | ||
| 217 | is severely misnamed. | ||
| 218 | It does not at all do what one would expect from a function called | ||
| 219 | .Dq pop . | ||
| 220 | Instead, it does the same as | ||
| 221 | .Fn sk_free , | ||
| 222 | except that it also calls the function | ||
| 223 | .Fa freefunc | ||
| 224 | on each of the pointers contained in the | ||
| 225 | .Fa stack . | ||
| 226 | If the calls to | ||
| 227 | .Fa freefunc | ||
| 228 | are intended to free the memory in use by the objects on the stack, | ||
| 229 | ensure that no other pointers to the same objects remain elsewhere. | ||
| 230 | .Pp | ||
| 231 | .Fn sk_find | ||
| 232 | searches the | ||
| 233 | .Fa stack | ||
| 234 | for the | ||
| 235 | .Fa wanted | ||
| 236 | pointer. | ||
| 237 | If the | ||
| 238 | .Fa stack | ||
| 239 | contains more than one copy of the | ||
| 240 | .Fa wanted | ||
| 241 | pointer, only the first match is found. | ||
| 242 | If a comparison function is installed for the stack, the stack is | ||
| 243 | first sorted with | ||
| 244 | .Fn sk_sort , | ||
| 245 | and instead of comparing pointers, two pointers are considered to match | ||
| 246 | if the comparison function returns 0. | ||
| 247 | .Pp | ||
| 248 | .Fn sk_find_ex | ||
| 249 | is identical to | ||
| 250 | .Fn sk_find | ||
| 251 | except that if the | ||
| 252 | .Fa stack | ||
| 253 | is not empty but no match is found, | ||
| 254 | the index of some pointer considered closest to | ||
| 255 | .Fa wanted | ||
| 256 | is returned. | ||
| 257 | .Pp | ||
| 258 | .Fn sk_sort | ||
| 259 | sorts the | ||
| 260 | .Fa stack | ||
| 261 | using | ||
| 262 | .Xr qsort 3 | ||
| 263 | and the installed comparison function. | ||
| 264 | If | ||
| 265 | .Fa stack | ||
| 266 | is a | ||
| 267 | .Dv NULL | ||
| 268 | pointer or already considered sorted, no action occurs. | ||
| 269 | This function can only be called if a comparison function is installed. | ||
| 270 | .Pp | ||
| 271 | .Fn sk_is_sorted | ||
| 272 | reports whether the | ||
| 273 | .Fa stack | ||
| 274 | is considered sorted. | ||
| 275 | Calling | ||
| 276 | .Fn sk_new_null | ||
| 277 | or | ||
| 278 | .Fn sk_new , | ||
| 279 | successfully calling | ||
| 280 | .Fn sk_push , | ||
| 281 | .Fn sk_unshift , | ||
| 282 | .Fn sk_insert , | ||
| 283 | or | ||
| 284 | .Fn sk_set , | ||
| 285 | or changing the comparison function sets the state to unsorted. | ||
| 286 | If a comparison function is installed, calling | ||
| 287 | .Fn sk_sort , | ||
| 288 | .Fn sk_find , | ||
| 289 | or | ||
| 290 | .Fn sk_find_ex | ||
| 291 | sets the state to sorted. | ||
| 292 | .Pp | ||
| 293 | .Fn sk_push | ||
| 294 | pushes | ||
| 295 | .Fa new_item | ||
| 296 | onto the end of the | ||
| 297 | .Fa stack , | ||
| 298 | increasing the number of pointers by 1. | ||
| 299 | If | ||
| 300 | .Fa stack | ||
| 301 | is a | ||
| 302 | .Dv NULL | ||
| 303 | pointer, no action occurs. | ||
| 304 | .Pp | ||
| 305 | .Fn sk_unshift | ||
| 306 | inserts | ||
| 307 | .Fa new_item | ||
| 308 | at the beginning of the | ||
| 309 | .Fa stack , | ||
| 310 | such that it gets the index 0. | ||
| 311 | The number of pointers increases by 1. | ||
| 312 | If | ||
| 313 | .Fa stack | ||
| 314 | is a | ||
| 315 | .Dv NULL | ||
| 316 | pointer, no action occurs. | ||
| 317 | .Pp | ||
| 318 | .Fn sk_insert | ||
| 319 | inserts the | ||
| 320 | .Fa new_item | ||
| 321 | into the | ||
| 322 | .Fa stack | ||
| 323 | such that it gets the given | ||
| 324 | .Fa index . | ||
| 325 | If | ||
| 326 | .Fa index | ||
| 327 | is less than 0 or greater than or equal to | ||
| 328 | .Fn sk_num stack , | ||
| 329 | the effect is the same as for | ||
| 330 | .Fn sk_push . | ||
| 331 | If | ||
| 332 | .Fa stack | ||
| 333 | is a | ||
| 334 | .Dv NULL | ||
| 335 | pointer, no action occurs. | ||
| 336 | .Pp | ||
| 337 | .Fn sk_set | ||
| 338 | replaces the pointer with the given | ||
| 339 | .Fa index | ||
| 340 | on the | ||
| 341 | .Fa stack | ||
| 342 | with the | ||
| 343 | .Fa new_item . | ||
| 344 | The old pointer is not freed, | ||
| 345 | which may leak memory if no copy of it exists elsewhere. | ||
| 346 | If | ||
| 347 | .Fa stack | ||
| 348 | is a | ||
| 349 | .Dv NULL | ||
| 350 | pointer or if | ||
| 351 | .Fa index | ||
| 352 | is less than 0 or greater than or equal to | ||
| 353 | .Fn sk_num stack , | ||
| 354 | no action occurs. | ||
| 355 | .Pp | ||
| 356 | .Fn sk_pop | ||
| 357 | and | ||
| 358 | .Fn sk_shift | ||
| 359 | remove the pointer with the highest or lowest index from the | ||
| 360 | .Fa stack , | ||
| 361 | respectively, reducing the number of pointers by 1. | ||
| 362 | If | ||
| 363 | .Fa stack | ||
| 364 | is a | ||
| 365 | .Dv NULL | ||
| 366 | pointer or if it is empty, no action occurs. | ||
| 367 | .Pp | ||
| 368 | .Fn sk_delete | ||
| 369 | removes the pointer with the given | ||
| 370 | .Fa index | ||
| 371 | from the | ||
| 372 | .Fa stack , | ||
| 373 | reducing the number of pointers by 1. | ||
| 374 | If | ||
| 375 | .Fa stack | ||
| 376 | is a | ||
| 377 | .Dv NULL | ||
| 378 | pointer or the | ||
| 379 | .Fa index | ||
| 380 | is less than 0 or greater than or equal to | ||
| 381 | .Fn sk_num stack , | ||
| 382 | no action occurs. | ||
| 383 | .Pp | ||
| 384 | .Fn sk_delete_ptr | ||
| 385 | removes the | ||
| 386 | .Fa wanted | ||
| 387 | pointer from the | ||
| 388 | .Fa stack , | ||
| 389 | reducing the number of pointers by 1 if it is found. | ||
| 390 | It never uses a comparison function | ||
| 391 | but only compares pointers themselves. | ||
| 392 | The | ||
| 393 | .Fa stack | ||
| 394 | pointer must not be | ||
| 395 | .Dv NULL . | ||
| 396 | .Pp | ||
| 397 | .Fn sk_zero | ||
| 398 | removes all pointers from the | ||
| 399 | .Fa stack . | ||
| 400 | It does not free any of the pointers. | ||
| 401 | Unless these pointers are merely copies of pointers owned by other | ||
| 402 | objects, they must be freed before calling | ||
| 403 | .Fn sk_zero , | ||
| 404 | in order to avoid leaking memory. | ||
| 405 | If | ||
| 406 | .Fa stack | ||
| 407 | is a | ||
| 408 | .Dv NULL | ||
| 409 | pointer, no action occurs. | ||
| 410 | .Sh RETURN VALUES | ||
| 411 | .Fn sk_new_null , | ||
| 412 | .Fn sk_new , | ||
| 413 | and | ||
| 414 | .Fn sk_dup | ||
| 415 | return a pointer to the newly allocated stack object or | ||
| 416 | .Dv NULL | ||
| 417 | if insufficient memory is available. | ||
| 418 | .Pp | ||
| 419 | .Fn sk_set_cmp_func | ||
| 420 | returns a pointer to the comparison function | ||
| 421 | that was previously installed for the | ||
| 422 | .Fa stack | ||
| 423 | or | ||
| 424 | .Dv NULL | ||
| 425 | if none was installed. | ||
| 426 | .Pp | ||
| 427 | .Fn sk_num | ||
| 428 | returns the number of pointers currently stored on the | ||
| 429 | .Fa stack , | ||
| 430 | or \-1 if | ||
| 431 | .Fa stack | ||
| 432 | is a | ||
| 433 | .Dv NULL | ||
| 434 | pointer. | ||
| 435 | .Pp | ||
| 436 | .Fn sk_value | ||
| 437 | returns the pointer with the given | ||
| 438 | .Fa index | ||
| 439 | from the | ||
| 440 | .Fa stack , | ||
| 441 | or | ||
| 442 | .Dv NULL | ||
| 443 | if | ||
| 444 | .Fa stack | ||
| 445 | is a | ||
| 446 | .Dv NULL | ||
| 447 | pointer or if the | ||
| 448 | .Fa index | ||
| 449 | is less than 0 or greater than or equal to | ||
| 450 | .Fn sk_num stack . | ||
| 451 | .Pp | ||
| 452 | .Fn sk_find | ||
| 453 | returns the lowest index considered to match or \-1 if | ||
| 454 | .Fa stack | ||
| 455 | is a | ||
| 456 | .Dv NULL | ||
| 457 | pointer or if no match is found. | ||
| 458 | .Pp | ||
| 459 | .Fn sk_find_ex | ||
| 460 | returns some index or \-1 if | ||
| 461 | .Fa stack | ||
| 462 | is a | ||
| 463 | .Dv NULL | ||
| 464 | pointer or empty. | ||
| 465 | .Pp | ||
| 466 | .Fn sk_is_sorted | ||
| 467 | returns 1 if the | ||
| 468 | .Fa stack | ||
| 469 | is considered sorted or if it is a | ||
| 470 | .Dv NULL | ||
| 471 | pointer, or 0 otherwise. | ||
| 472 | .Pp | ||
| 473 | .Fn sk_push , | ||
| 474 | .Fn sk_unshift , | ||
| 475 | and | ||
| 476 | .Fn sk_insert | ||
| 477 | return the new number of pointers on the | ||
| 478 | .Fa stack | ||
| 479 | or 0 if | ||
| 480 | .Fa stack | ||
| 481 | is a | ||
| 482 | .Dv NULL | ||
| 483 | pointer or if memory allocation fails. | ||
| 484 | .Pp | ||
| 485 | .Fn sk_set | ||
| 486 | returns | ||
| 487 | .Fa new_item | ||
| 488 | or | ||
| 489 | .Dv NULL | ||
| 490 | if | ||
| 491 | .Fa stack | ||
| 492 | is a | ||
| 493 | .Dv NULL | ||
| 494 | pointer or if the | ||
| 495 | .Fa index | ||
| 496 | is less than 0 or greater than or equal to | ||
| 497 | .Fn sk_num stack . | ||
| 498 | .Pp | ||
| 499 | .Fn sk_pop | ||
| 500 | and | ||
| 501 | .Fn sk_shift | ||
| 502 | return the deleted pointer or | ||
| 503 | .Dv NULL | ||
| 504 | if | ||
| 505 | .Fa stack | ||
| 506 | is a | ||
| 507 | .Dv NULL | ||
| 508 | pointer or if it is empty. | ||
| 509 | .Pp | ||
| 510 | .Fn sk_delete | ||
| 511 | returns the deleted pointer or | ||
| 512 | .Dv NULL | ||
| 513 | if | ||
| 514 | .Fa stack | ||
| 515 | is a | ||
| 516 | .Dv NULL | ||
| 517 | pointer or if the | ||
| 518 | .Fa index | ||
| 519 | is less than 0 or greater than or equal to | ||
| 520 | .Fn sk_num stack . | ||
| 521 | .Pp | ||
| 522 | .Fn sk_delete_ptr | ||
| 523 | returns | ||
| 524 | .Fa wanted | ||
| 525 | or | ||
| 526 | .Dv NULL | ||
| 527 | if it is not found. | ||
| 528 | .Sh SEE ALSO | ||
| 529 | .Xr STACK_OF 3 | ||
| 530 | .Sh HISTORY | ||
| 531 | .Fn sk_new_null , | ||
| 532 | .Fn sk_new , | ||
| 533 | .Fn sk_free , | ||
| 534 | .Fn sk_pop_free , | ||
| 535 | .Fn sk_num , | ||
| 536 | .Fn sk_value , | ||
| 537 | .Fn sk_find , | ||
| 538 | .Fn sk_push , | ||
| 539 | .Fn sk_unshift , | ||
| 540 | .Fn sk_insert , | ||
| 541 | .Fn sk_pop , | ||
| 542 | .Fn sk_shift , | ||
| 543 | .Fn sk_delete , | ||
| 544 | and | ||
| 545 | .Fn sk_delete_ptr | ||
| 546 | first appeared in SSLeay 0.5.1. | ||
| 547 | .Fn sk_set_cmp_func , | ||
| 548 | .Fn sk_dup , | ||
| 549 | and | ||
| 550 | .Fn sk_zero | ||
| 551 | first appeared in SSLeay 0.8.0. | ||
| 552 | These functions have been available since | ||
| 553 | .Ox 2.4 . | ||
| 554 | .Pp | ||
| 555 | .Fn sk_set | ||
| 556 | first appeared in OpenSSL 0.9.3. | ||
| 557 | .Fn sk_sort | ||
| 558 | first appeared in OpenSSL 0.9.4. | ||
| 559 | Both functions have been available since | ||
| 560 | .Ox 2.6 . | ||
| 561 | .Pp | ||
| 562 | .Fn sk_is_sorted | ||
| 563 | first appeared in OpenSSL 0.9.7e and has been available since | ||
| 564 | .Ox 3.8 . | ||
| 565 | .Pp | ||
| 566 | .Fn sk_find_ex | ||
| 567 | first appeared in OpenSSL 0.9.8 and has been available since | ||
| 568 | .Ox 4.5 . | ||
| 569 | .Sh BUGS | ||
| 570 | Even if a comparison function is installed, empty stacks and | ||
| 571 | stacks containing a single pointer are sometimes considered | ||
| 572 | sorted and sometimes considered unsorted. | ||
| 573 | .Pp | ||
| 574 | If a comparison function is installed, the concept of | ||
| 575 | .Dq first match | ||
| 576 | in | ||
| 577 | .Fn sk_find | ||
| 578 | and | ||
| 579 | .Fn sk_find_ex | ||
| 580 | is ill-defined because | ||
| 581 | .Xr qsort 3 | ||
| 582 | is not a stable sorting function. | ||
| 583 | It is probably best to only assume that they return an arbitrary match. | ||
| 584 | .Pp | ||
| 585 | The concept of | ||
| 586 | .Dq closest | ||
| 587 | for | ||
| 588 | .Fn sk_find_ex | ||
| 589 | is even less clearly defined. | ||
| 590 | The match may sometimes be smaller and sometimes larger than | ||
| 591 | .Fa wanted , | ||
| 592 | even if both smaller and larger pointers exist in the | ||
| 593 | .Fa stack . | ||
| 594 | Besides, it is again ill-defined | ||
| 595 | which of several pointers that compare equal is selected. | ||
| 596 | It is probably best to not assume anything about the selection | ||
| 597 | for cases where there is no match. | ||
