diff options
Diffstat (limited to 'src/lib/libcrypto/bio/bio_lib.c')
-rw-r--r-- | src/lib/libcrypto/bio/bio_lib.c | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bio/bio_lib.c b/src/lib/libcrypto/bio/bio_lib.c index d14507884b..31127cb444 100644 --- a/src/lib/libcrypto/bio/bio_lib.c +++ b/src/lib/libcrypto/bio/bio_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bio_lib.c,v 1.44 2023/03/15 06:14:02 tb Exp $ */ | 1 | /* $OpenBSD: bio_lib.c,v 1.45 2023/07/05 21:23:37 beck Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -129,6 +129,7 @@ BIO_get_new_index(void) | |||
129 | 129 | ||
130 | return index; | 130 | return index; |
131 | } | 131 | } |
132 | LCRYPTO_ALIAS(BIO_get_new_index); | ||
132 | 133 | ||
133 | BIO * | 134 | BIO * |
134 | BIO_new(const BIO_METHOD *method) | 135 | BIO_new(const BIO_METHOD *method) |
@@ -147,6 +148,7 @@ BIO_new(const BIO_METHOD *method) | |||
147 | } | 148 | } |
148 | return (ret); | 149 | return (ret); |
149 | } | 150 | } |
151 | LCRYPTO_ALIAS(BIO_new); | ||
150 | 152 | ||
151 | int | 153 | int |
152 | BIO_set(BIO *bio, const BIO_METHOD *method) | 154 | BIO_set(BIO *bio, const BIO_METHOD *method) |
@@ -176,6 +178,7 @@ BIO_set(BIO *bio, const BIO_METHOD *method) | |||
176 | } | 178 | } |
177 | return (1); | 179 | return (1); |
178 | } | 180 | } |
181 | LCRYPTO_ALIAS(BIO_set); | ||
179 | 182 | ||
180 | int | 183 | int |
181 | BIO_free(BIO *a) | 184 | BIO_free(BIO *a) |
@@ -201,12 +204,14 @@ BIO_free(BIO *a) | |||
201 | free(a); | 204 | free(a); |
202 | return (1); | 205 | return (1); |
203 | } | 206 | } |
207 | LCRYPTO_ALIAS(BIO_free); | ||
204 | 208 | ||
205 | void | 209 | void |
206 | BIO_vfree(BIO *a) | 210 | BIO_vfree(BIO *a) |
207 | { | 211 | { |
208 | BIO_free(a); | 212 | BIO_free(a); |
209 | } | 213 | } |
214 | LCRYPTO_ALIAS(BIO_vfree); | ||
210 | 215 | ||
211 | int | 216 | int |
212 | BIO_up_ref(BIO *bio) | 217 | BIO_up_ref(BIO *bio) |
@@ -214,108 +219,126 @@ BIO_up_ref(BIO *bio) | |||
214 | int refs = CRYPTO_add(&bio->references, 1, CRYPTO_LOCK_BIO); | 219 | int refs = CRYPTO_add(&bio->references, 1, CRYPTO_LOCK_BIO); |
215 | return (refs > 1) ? 1 : 0; | 220 | return (refs > 1) ? 1 : 0; |
216 | } | 221 | } |
222 | LCRYPTO_ALIAS(BIO_up_ref); | ||
217 | 223 | ||
218 | void * | 224 | void * |
219 | BIO_get_data(BIO *a) | 225 | BIO_get_data(BIO *a) |
220 | { | 226 | { |
221 | return (a->ptr); | 227 | return (a->ptr); |
222 | } | 228 | } |
229 | LCRYPTO_ALIAS(BIO_get_data); | ||
223 | 230 | ||
224 | void | 231 | void |
225 | BIO_set_data(BIO *a, void *ptr) | 232 | BIO_set_data(BIO *a, void *ptr) |
226 | { | 233 | { |
227 | a->ptr = ptr; | 234 | a->ptr = ptr; |
228 | } | 235 | } |
236 | LCRYPTO_ALIAS(BIO_set_data); | ||
229 | 237 | ||
230 | int | 238 | int |
231 | BIO_get_init(BIO *a) | 239 | BIO_get_init(BIO *a) |
232 | { | 240 | { |
233 | return a->init; | 241 | return a->init; |
234 | } | 242 | } |
243 | LCRYPTO_ALIAS(BIO_get_init); | ||
235 | 244 | ||
236 | void | 245 | void |
237 | BIO_set_init(BIO *a, int init) | 246 | BIO_set_init(BIO *a, int init) |
238 | { | 247 | { |
239 | a->init = init; | 248 | a->init = init; |
240 | } | 249 | } |
250 | LCRYPTO_ALIAS(BIO_set_init); | ||
241 | 251 | ||
242 | int | 252 | int |
243 | BIO_get_shutdown(BIO *a) | 253 | BIO_get_shutdown(BIO *a) |
244 | { | 254 | { |
245 | return (a->shutdown); | 255 | return (a->shutdown); |
246 | } | 256 | } |
257 | LCRYPTO_ALIAS(BIO_get_shutdown); | ||
247 | 258 | ||
248 | void | 259 | void |
249 | BIO_set_shutdown(BIO *a, int shut) | 260 | BIO_set_shutdown(BIO *a, int shut) |
250 | { | 261 | { |
251 | a->shutdown = shut; | 262 | a->shutdown = shut; |
252 | } | 263 | } |
264 | LCRYPTO_ALIAS(BIO_set_shutdown); | ||
253 | 265 | ||
254 | void | 266 | void |
255 | BIO_clear_flags(BIO *b, int flags) | 267 | BIO_clear_flags(BIO *b, int flags) |
256 | { | 268 | { |
257 | b->flags &= ~flags; | 269 | b->flags &= ~flags; |
258 | } | 270 | } |
271 | LCRYPTO_ALIAS(BIO_clear_flags); | ||
259 | 272 | ||
260 | int | 273 | int |
261 | BIO_test_flags(const BIO *b, int flags) | 274 | BIO_test_flags(const BIO *b, int flags) |
262 | { | 275 | { |
263 | return (b->flags & flags); | 276 | return (b->flags & flags); |
264 | } | 277 | } |
278 | LCRYPTO_ALIAS(BIO_test_flags); | ||
265 | 279 | ||
266 | void | 280 | void |
267 | BIO_set_flags(BIO *b, int flags) | 281 | BIO_set_flags(BIO *b, int flags) |
268 | { | 282 | { |
269 | b->flags |= flags; | 283 | b->flags |= flags; |
270 | } | 284 | } |
285 | LCRYPTO_ALIAS(BIO_set_flags); | ||
271 | 286 | ||
272 | BIO_callback_fn | 287 | BIO_callback_fn |
273 | BIO_get_callback(const BIO *b) | 288 | BIO_get_callback(const BIO *b) |
274 | { | 289 | { |
275 | return b->callback; | 290 | return b->callback; |
276 | } | 291 | } |
292 | LCRYPTO_ALIAS(BIO_get_callback); | ||
277 | 293 | ||
278 | void | 294 | void |
279 | BIO_set_callback(BIO *b, BIO_callback_fn cb) | 295 | BIO_set_callback(BIO *b, BIO_callback_fn cb) |
280 | { | 296 | { |
281 | b->callback = cb; | 297 | b->callback = cb; |
282 | } | 298 | } |
299 | LCRYPTO_ALIAS(BIO_set_callback); | ||
283 | 300 | ||
284 | BIO_callback_fn_ex | 301 | BIO_callback_fn_ex |
285 | BIO_get_callback_ex(const BIO *b) | 302 | BIO_get_callback_ex(const BIO *b) |
286 | { | 303 | { |
287 | return b->callback_ex; | 304 | return b->callback_ex; |
288 | } | 305 | } |
306 | LCRYPTO_ALIAS(BIO_get_callback_ex); | ||
289 | 307 | ||
290 | void | 308 | void |
291 | BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex cb) | 309 | BIO_set_callback_ex(BIO *b, BIO_callback_fn_ex cb) |
292 | { | 310 | { |
293 | b->callback_ex = cb; | 311 | b->callback_ex = cb; |
294 | } | 312 | } |
313 | LCRYPTO_ALIAS(BIO_set_callback_ex); | ||
295 | 314 | ||
296 | void | 315 | void |
297 | BIO_set_callback_arg(BIO *b, char *arg) | 316 | BIO_set_callback_arg(BIO *b, char *arg) |
298 | { | 317 | { |
299 | b->cb_arg = arg; | 318 | b->cb_arg = arg; |
300 | } | 319 | } |
320 | LCRYPTO_ALIAS(BIO_set_callback_arg); | ||
301 | 321 | ||
302 | char * | 322 | char * |
303 | BIO_get_callback_arg(const BIO *b) | 323 | BIO_get_callback_arg(const BIO *b) |
304 | { | 324 | { |
305 | return b->cb_arg; | 325 | return b->cb_arg; |
306 | } | 326 | } |
327 | LCRYPTO_ALIAS(BIO_get_callback_arg); | ||
307 | 328 | ||
308 | const char * | 329 | const char * |
309 | BIO_method_name(const BIO *b) | 330 | BIO_method_name(const BIO *b) |
310 | { | 331 | { |
311 | return b->method->name; | 332 | return b->method->name; |
312 | } | 333 | } |
334 | LCRYPTO_ALIAS(BIO_method_name); | ||
313 | 335 | ||
314 | int | 336 | int |
315 | BIO_method_type(const BIO *b) | 337 | BIO_method_type(const BIO *b) |
316 | { | 338 | { |
317 | return b->method->type; | 339 | return b->method->type; |
318 | } | 340 | } |
341 | LCRYPTO_ALIAS(BIO_method_type); | ||
319 | 342 | ||
320 | int | 343 | int |
321 | BIO_read(BIO *b, void *out, int outl) | 344 | BIO_read(BIO *b, void *out, int outl) |
@@ -373,6 +396,7 @@ BIO_read(BIO *b, void *out, int outl) | |||
373 | 396 | ||
374 | return (ret); | 397 | return (ret); |
375 | } | 398 | } |
399 | LCRYPTO_ALIAS(BIO_read); | ||
376 | 400 | ||
377 | int | 401 | int |
378 | BIO_write(BIO *b, const void *in, int inl) | 402 | BIO_write(BIO *b, const void *in, int inl) |
@@ -429,6 +453,7 @@ BIO_write(BIO *b, const void *in, int inl) | |||
429 | 453 | ||
430 | return (ret); | 454 | return (ret); |
431 | } | 455 | } |
456 | LCRYPTO_ALIAS(BIO_write); | ||
432 | 457 | ||
433 | int | 458 | int |
434 | BIO_puts(BIO *b, const char *in) | 459 | BIO_puts(BIO *b, const char *in) |
@@ -473,6 +498,7 @@ BIO_puts(BIO *b, const char *in) | |||
473 | 498 | ||
474 | return (ret); | 499 | return (ret); |
475 | } | 500 | } |
501 | LCRYPTO_ALIAS(BIO_puts); | ||
476 | 502 | ||
477 | int | 503 | int |
478 | BIO_gets(BIO *b, char *in, int inl) | 504 | BIO_gets(BIO *b, char *in, int inl) |
@@ -515,6 +541,7 @@ BIO_gets(BIO *b, char *in, int inl) | |||
515 | 541 | ||
516 | return (ret); | 542 | return (ret); |
517 | } | 543 | } |
544 | LCRYPTO_ALIAS(BIO_gets); | ||
518 | 545 | ||
519 | int | 546 | int |
520 | BIO_indent(BIO *b, int indent, int max) | 547 | BIO_indent(BIO *b, int indent, int max) |
@@ -528,6 +555,7 @@ BIO_indent(BIO *b, int indent, int max) | |||
528 | return 0; | 555 | return 0; |
529 | return 1; | 556 | return 1; |
530 | } | 557 | } |
558 | LCRYPTO_ALIAS(BIO_indent); | ||
531 | 559 | ||
532 | long | 560 | long |
533 | BIO_int_ctrl(BIO *b, int cmd, long larg, int iarg) | 561 | BIO_int_ctrl(BIO *b, int cmd, long larg, int iarg) |
@@ -537,6 +565,7 @@ BIO_int_ctrl(BIO *b, int cmd, long larg, int iarg) | |||
537 | i = iarg; | 565 | i = iarg; |
538 | return (BIO_ctrl(b, cmd, larg, (char *)&i)); | 566 | return (BIO_ctrl(b, cmd, larg, (char *)&i)); |
539 | } | 567 | } |
568 | LCRYPTO_ALIAS(BIO_int_ctrl); | ||
540 | 569 | ||
541 | char * | 570 | char * |
542 | BIO_ptr_ctrl(BIO *b, int cmd, long larg) | 571 | BIO_ptr_ctrl(BIO *b, int cmd, long larg) |
@@ -548,6 +577,7 @@ BIO_ptr_ctrl(BIO *b, int cmd, long larg) | |||
548 | else | 577 | else |
549 | return (p); | 578 | return (p); |
550 | } | 579 | } |
580 | LCRYPTO_ALIAS(BIO_ptr_ctrl); | ||
551 | 581 | ||
552 | long | 582 | long |
553 | BIO_ctrl(BIO *b, int cmd, long larg, void *parg) | 583 | BIO_ctrl(BIO *b, int cmd, long larg, void *parg) |
@@ -577,6 +607,7 @@ BIO_ctrl(BIO *b, int cmd, long larg, void *parg) | |||
577 | 607 | ||
578 | return (ret); | 608 | return (ret); |
579 | } | 609 | } |
610 | LCRYPTO_ALIAS(BIO_ctrl); | ||
580 | 611 | ||
581 | long | 612 | long |
582 | BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) | 613 | BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) |
@@ -607,6 +638,7 @@ BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) | |||
607 | 638 | ||
608 | return (ret); | 639 | return (ret); |
609 | } | 640 | } |
641 | LCRYPTO_ALIAS(BIO_callback_ctrl); | ||
610 | 642 | ||
611 | /* It is unfortunate to duplicate in functions what the BIO_(w)pending macros | 643 | /* It is unfortunate to duplicate in functions what the BIO_(w)pending macros |
612 | * do; but those macros have inappropriate return type, and for interfacing | 644 | * do; but those macros have inappropriate return type, and for interfacing |
@@ -616,12 +648,14 @@ BIO_ctrl_pending(BIO *bio) | |||
616 | { | 648 | { |
617 | return BIO_ctrl(bio, BIO_CTRL_PENDING, 0, NULL); | 649 | return BIO_ctrl(bio, BIO_CTRL_PENDING, 0, NULL); |
618 | } | 650 | } |
651 | LCRYPTO_ALIAS(BIO_ctrl_pending); | ||
619 | 652 | ||
620 | size_t | 653 | size_t |
621 | BIO_ctrl_wpending(BIO *bio) | 654 | BIO_ctrl_wpending(BIO *bio) |
622 | { | 655 | { |
623 | return BIO_ctrl(bio, BIO_CTRL_WPENDING, 0, NULL); | 656 | return BIO_ctrl(bio, BIO_CTRL_WPENDING, 0, NULL); |
624 | } | 657 | } |
658 | LCRYPTO_ALIAS(BIO_ctrl_wpending); | ||
625 | 659 | ||
626 | 660 | ||
627 | /* | 661 | /* |
@@ -649,6 +683,7 @@ BIO_push(BIO *b, BIO *bio) | |||
649 | BIO_ctrl(b, BIO_CTRL_PUSH, 0, lb); | 683 | BIO_ctrl(b, BIO_CTRL_PUSH, 0, lb); |
650 | return (b); | 684 | return (b); |
651 | } | 685 | } |
686 | LCRYPTO_ALIAS(BIO_push); | ||
652 | 687 | ||
653 | /* Remove the first and return the rest */ | 688 | /* Remove the first and return the rest */ |
654 | BIO * | 689 | BIO * |
@@ -671,6 +706,7 @@ BIO_pop(BIO *b) | |||
671 | b->prev_bio = NULL; | 706 | b->prev_bio = NULL; |
672 | return (ret); | 707 | return (ret); |
673 | } | 708 | } |
709 | LCRYPTO_ALIAS(BIO_pop); | ||
674 | 710 | ||
675 | BIO * | 711 | BIO * |
676 | BIO_get_retry_BIO(BIO *bio, int *reason) | 712 | BIO_get_retry_BIO(BIO *bio, int *reason) |
@@ -690,18 +726,21 @@ BIO_get_retry_BIO(BIO *bio, int *reason) | |||
690 | *reason = last->retry_reason; | 726 | *reason = last->retry_reason; |
691 | return (last); | 727 | return (last); |
692 | } | 728 | } |
729 | LCRYPTO_ALIAS(BIO_get_retry_BIO); | ||
693 | 730 | ||
694 | int | 731 | int |
695 | BIO_get_retry_reason(BIO *bio) | 732 | BIO_get_retry_reason(BIO *bio) |
696 | { | 733 | { |
697 | return (bio->retry_reason); | 734 | return (bio->retry_reason); |
698 | } | 735 | } |
736 | LCRYPTO_ALIAS(BIO_get_retry_reason); | ||
699 | 737 | ||
700 | void | 738 | void |
701 | BIO_set_retry_reason(BIO *bio, int reason) | 739 | BIO_set_retry_reason(BIO *bio, int reason) |
702 | { | 740 | { |
703 | bio->retry_reason = reason; | 741 | bio->retry_reason = reason; |
704 | } | 742 | } |
743 | LCRYPTO_ALIAS(BIO_set_retry_reason); | ||
705 | 744 | ||
706 | BIO * | 745 | BIO * |
707 | BIO_find_type(BIO *bio, int type) | 746 | BIO_find_type(BIO *bio, int type) |
@@ -724,6 +763,7 @@ BIO_find_type(BIO *bio, int type) | |||
724 | } while (bio != NULL); | 763 | } while (bio != NULL); |
725 | return (NULL); | 764 | return (NULL); |
726 | } | 765 | } |
766 | LCRYPTO_ALIAS(BIO_find_type); | ||
727 | 767 | ||
728 | BIO * | 768 | BIO * |
729 | BIO_next(BIO *b) | 769 | BIO_next(BIO *b) |
@@ -732,6 +772,7 @@ BIO_next(BIO *b) | |||
732 | return NULL; | 772 | return NULL; |
733 | return b->next_bio; | 773 | return b->next_bio; |
734 | } | 774 | } |
775 | LCRYPTO_ALIAS(BIO_next); | ||
735 | 776 | ||
736 | /* | 777 | /* |
737 | * Two chains "bio -> oldtail" and "oldhead -> next" become | 778 | * Two chains "bio -> oldtail" and "oldhead -> next" become |
@@ -753,6 +794,7 @@ BIO_set_next(BIO *bio, BIO *next) | |||
753 | if (next != NULL) | 794 | if (next != NULL) |
754 | next->prev_bio = bio; | 795 | next->prev_bio = bio; |
755 | } | 796 | } |
797 | LCRYPTO_ALIAS(BIO_set_next); | ||
756 | 798 | ||
757 | void | 799 | void |
758 | BIO_free_all(BIO *bio) | 800 | BIO_free_all(BIO *bio) |
@@ -770,6 +812,7 @@ BIO_free_all(BIO *bio) | |||
770 | break; | 812 | break; |
771 | } | 813 | } |
772 | } | 814 | } |
815 | LCRYPTO_ALIAS(BIO_free_all); | ||
773 | 816 | ||
774 | BIO * | 817 | BIO * |
775 | BIO_dup_chain(BIO *in) | 818 | BIO_dup_chain(BIO *in) |
@@ -813,6 +856,7 @@ err: | |||
813 | return (NULL); | 856 | return (NULL); |
814 | 857 | ||
815 | } | 858 | } |
859 | LCRYPTO_ALIAS(BIO_dup_chain); | ||
816 | 860 | ||
817 | void | 861 | void |
818 | BIO_copy_next_retry(BIO *b) | 862 | BIO_copy_next_retry(BIO *b) |
@@ -820,6 +864,7 @@ BIO_copy_next_retry(BIO *b) | |||
820 | BIO_set_flags(b, BIO_get_retry_flags(b->next_bio)); | 864 | BIO_set_flags(b, BIO_get_retry_flags(b->next_bio)); |
821 | b->retry_reason = b->next_bio->retry_reason; | 865 | b->retry_reason = b->next_bio->retry_reason; |
822 | } | 866 | } |
867 | LCRYPTO_ALIAS(BIO_copy_next_retry); | ||
823 | 868 | ||
824 | int | 869 | int |
825 | BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | 870 | BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, |
@@ -828,18 +873,21 @@ BIO_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, | |||
828 | return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, argl, argp, | 873 | return CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_BIO, argl, argp, |
829 | new_func, dup_func, free_func); | 874 | new_func, dup_func, free_func); |
830 | } | 875 | } |
876 | LCRYPTO_ALIAS(BIO_get_ex_new_index); | ||
831 | 877 | ||
832 | int | 878 | int |
833 | BIO_set_ex_data(BIO *bio, int idx, void *data) | 879 | BIO_set_ex_data(BIO *bio, int idx, void *data) |
834 | { | 880 | { |
835 | return (CRYPTO_set_ex_data(&(bio->ex_data), idx, data)); | 881 | return (CRYPTO_set_ex_data(&(bio->ex_data), idx, data)); |
836 | } | 882 | } |
883 | LCRYPTO_ALIAS(BIO_set_ex_data); | ||
837 | 884 | ||
838 | void * | 885 | void * |
839 | BIO_get_ex_data(BIO *bio, int idx) | 886 | BIO_get_ex_data(BIO *bio, int idx) |
840 | { | 887 | { |
841 | return (CRYPTO_get_ex_data(&(bio->ex_data), idx)); | 888 | return (CRYPTO_get_ex_data(&(bio->ex_data), idx)); |
842 | } | 889 | } |
890 | LCRYPTO_ALIAS(BIO_get_ex_data); | ||
843 | 891 | ||
844 | unsigned long | 892 | unsigned long |
845 | BIO_number_read(BIO *bio) | 893 | BIO_number_read(BIO *bio) |
@@ -848,6 +896,7 @@ BIO_number_read(BIO *bio) | |||
848 | return bio->num_read; | 896 | return bio->num_read; |
849 | return 0; | 897 | return 0; |
850 | } | 898 | } |
899 | LCRYPTO_ALIAS(BIO_number_read); | ||
851 | 900 | ||
852 | unsigned long | 901 | unsigned long |
853 | BIO_number_written(BIO *bio) | 902 | BIO_number_written(BIO *bio) |
@@ -856,3 +905,4 @@ BIO_number_written(BIO *bio) | |||
856 | return bio->num_write; | 905 | return bio->num_write; |
857 | return 0; | 906 | return 0; |
858 | } | 907 | } |
908 | LCRYPTO_ALIAS(BIO_number_written); | ||