diff options
| author | tb <> | 2024-03-02 09:18:28 +0000 |
|---|---|---|
| committer | tb <> | 2024-03-02 09:18:28 +0000 |
| commit | 624e55f48614f7c5aaa62d91eee54f0862c62db0 (patch) | |
| tree | a10ae269ac1b72561a9a6dc886dfb556d16c89ba /src/lib/libcrypto/bio | |
| parent | 19ff5a07b9eda695a529279cb69d7708907ffac2 (diff) | |
| download | openbsd-624e55f48614f7c5aaa62d91eee54f0862c62db0.tar.gz openbsd-624e55f48614f7c5aaa62d91eee54f0862c62db0.tar.bz2 openbsd-624e55f48614f7c5aaa62d91eee54f0862c62db0.zip | |
Remove BIO_{sn,v,vsn}printf(3)
Unsued printing functionality. If something should need this we can readily
add it back.
ok jsing
Diffstat (limited to 'src/lib/libcrypto/bio')
| -rw-r--r-- | src/lib/libcrypto/bio/b_print.c | 59 | ||||
| -rw-r--r-- | src/lib/libcrypto/bio/bio.h | 18 | ||||
| -rw-r--r-- | src/lib/libcrypto/bio/bio_local.h | 6 |
3 files changed, 11 insertions, 72 deletions
diff --git a/src/lib/libcrypto/bio/b_print.c b/src/lib/libcrypto/bio/b_print.c index a750ac413f..f6943ea3f3 100644 --- a/src/lib/libcrypto/bio/b_print.c +++ b/src/lib/libcrypto/bio/b_print.c | |||
| @@ -1,21 +1,10 @@ | |||
| 1 | /* $OpenBSD: b_print.c,v 1.27 2023/07/05 21:23:37 beck Exp $ */ | 1 | /* $OpenBSD: b_print.c,v 1.28 2024/03/02 09:18:28 tb Exp $ */ |
| 2 | 2 | ||
| 3 | /* Theo de Raadt places this file in the public domain. */ | 3 | /* Theo de Raadt places this file in the public domain. */ |
| 4 | 4 | ||
| 5 | #include <openssl/bio.h> | 5 | #include <openssl/bio.h> |
| 6 | 6 | ||
| 7 | int | 7 | #include "bio_local.h" |
| 8 | BIO_printf(BIO *bio, const char *format, ...) | ||
| 9 | { | ||
| 10 | va_list args; | ||
| 11 | int ret; | ||
| 12 | |||
| 13 | va_start(args, format); | ||
| 14 | ret = BIO_vprintf(bio, format, args); | ||
| 15 | va_end(args); | ||
| 16 | return (ret); | ||
| 17 | } | ||
| 18 | LCRYPTO_ALIAS(BIO_printf); | ||
| 19 | 8 | ||
| 20 | #ifdef HAVE_FUNOPEN | 9 | #ifdef HAVE_FUNOPEN |
| 21 | static int | 10 | static int |
| @@ -40,7 +29,6 @@ BIO_vprintf(BIO *bio, const char *format, va_list args) | |||
| 40 | fail: | 29 | fail: |
| 41 | return (ret); | 30 | return (ret); |
| 42 | } | 31 | } |
| 43 | LCRYPTO_ALIAS(BIO_vprintf); | ||
| 44 | 32 | ||
| 45 | #else /* !HAVE_FUNOPEN */ | 33 | #else /* !HAVE_FUNOPEN */ |
| 46 | 34 | ||
| @@ -57,55 +45,18 @@ BIO_vprintf(BIO *bio, const char *format, va_list args) | |||
| 57 | free(buf); | 45 | free(buf); |
| 58 | return (ret); | 46 | return (ret); |
| 59 | } | 47 | } |
| 60 | LCRYPTO_ALIAS(BIO_vprintf); | ||
| 61 | 48 | ||
| 62 | #endif /* HAVE_FUNOPEN */ | 49 | #endif /* HAVE_FUNOPEN */ |
| 63 | 50 | ||
| 64 | /* | ||
| 65 | * BIO_snprintf and BIO_vsnprintf return -1 for overflow, | ||
| 66 | * due to the history of this API. Justification: | ||
| 67 | * | ||
| 68 | * Traditional snprintf surfaced in 4.4BSD, and returned | ||
| 69 | * "number of bytes wanted". Solaris and Windows opted to | ||
| 70 | * return -1. A draft standard was written which returned -1. | ||
| 71 | * Due to the large volume of code already using the first | ||
| 72 | * semantics, the draft was repaired before standardization to | ||
| 73 | * specify "number of bytes wanted" plus "-1 for character conversion | ||
| 74 | * style errors". Solaris adapted to this rule, but Windows stuck | ||
| 75 | * with -1. | ||
| 76 | * | ||
| 77 | * Original OpenSSL comment which is full of lies: | ||
| 78 | * | ||
| 79 | * "In case of truncation, return -1 like traditional snprintf. | ||
| 80 | * (Current drafts for ISO/IEC 9899 say snprintf should return | ||
| 81 | * the number of characters that would have been written, | ||
| 82 | * had the buffer been large enough.)" | ||
| 83 | */ | ||
| 84 | int | 51 | int |
| 85 | BIO_snprintf(char *buf, size_t n, const char *format, ...) | 52 | BIO_printf(BIO *bio, const char *format, ...) |
| 86 | { | 53 | { |
| 87 | va_list args; | 54 | va_list args; |
| 88 | int ret; | 55 | int ret; |
| 89 | 56 | ||
| 90 | va_start(args, format); | 57 | va_start(args, format); |
| 91 | ret = vsnprintf(buf, n, format, args); | 58 | ret = BIO_vprintf(bio, format, args); |
| 92 | va_end(args); | 59 | va_end(args); |
| 93 | |||
| 94 | if (ret >= n || ret == -1) | ||
| 95 | return (-1); | ||
| 96 | return (ret); | ||
| 97 | } | ||
| 98 | LCRYPTO_ALIAS(BIO_snprintf); | ||
| 99 | |||
| 100 | int | ||
| 101 | BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) | ||
| 102 | { | ||
| 103 | int ret; | ||
| 104 | |||
| 105 | ret = vsnprintf(buf, n, format, args); | ||
| 106 | |||
| 107 | if (ret >= n || ret == -1) | ||
| 108 | return (-1); | ||
| 109 | return (ret); | 60 | return (ret); |
| 110 | } | 61 | } |
| 111 | LCRYPTO_ALIAS(BIO_vsnprintf); | 62 | LCRYPTO_ALIAS(BIO_printf); |
diff --git a/src/lib/libcrypto/bio/bio.h b/src/lib/libcrypto/bio/bio.h index b955524c45..10b0924f73 100644 --- a/src/lib/libcrypto/bio/bio.h +++ b/src/lib/libcrypto/bio/bio.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bio.h,v 1.60 2023/08/25 12:37:33 schwarze Exp $ */ | 1 | /* $OpenBSD: bio.h,v 1.61 2024/03/02 09:18:28 tb 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 | * |
| @@ -648,25 +648,9 @@ void BIO_copy_next_retry(BIO *b); | |||
| 648 | #ifndef __MINGW_PRINTF_FORMAT | 648 | #ifndef __MINGW_PRINTF_FORMAT |
| 649 | int BIO_printf(BIO *bio, const char *format, ...) | 649 | int BIO_printf(BIO *bio, const char *format, ...) |
| 650 | __attribute__((__format__(__printf__, 2, 3), __nonnull__(2))); | 650 | __attribute__((__format__(__printf__, 2, 3), __nonnull__(2))); |
| 651 | int BIO_vprintf(BIO *bio, const char *format, va_list args) | ||
| 652 | __attribute__((__format__(__printf__, 2, 0), __nonnull__(2))); | ||
| 653 | int BIO_snprintf(char *buf, size_t n, const char *format, ...) | ||
| 654 | __attribute__((__deprecated__, __format__(__printf__, 3, 4), | ||
| 655 | __nonnull__(3))); | ||
| 656 | int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) | ||
| 657 | __attribute__((__deprecated__, __format__(__printf__, 3, 0), | ||
| 658 | __nonnull__(3))); | ||
| 659 | #else | 651 | #else |
| 660 | int BIO_printf(BIO *bio, const char *format, ...) | 652 | int BIO_printf(BIO *bio, const char *format, ...) |
| 661 | __attribute__((__format__(__MINGW_PRINTF_FORMAT, 2, 3), __nonnull__(2))); | 653 | __attribute__((__format__(__MINGW_PRINTF_FORMAT, 2, 3), __nonnull__(2))); |
| 662 | int BIO_vprintf(BIO *bio, const char *format, va_list args) | ||
| 663 | __attribute__((__format__(__MINGW_PRINTF_FORMAT, 2, 0), __nonnull__(2))); | ||
| 664 | int BIO_snprintf(char *buf, size_t n, const char *format, ...) | ||
| 665 | __attribute__((__deprecated__, __format__(__MINGW_PRINTF_FORMAT, 3, 4), | ||
| 666 | __nonnull__(3))); | ||
| 667 | int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) | ||
| 668 | __attribute__((__deprecated__, __format__(__MINGW_PRINTF_FORMAT, 3, 0), | ||
| 669 | __nonnull__(3))); | ||
| 670 | #endif | 654 | #endif |
| 671 | 655 | ||
| 672 | void ERR_load_BIO_strings(void); | 656 | void ERR_load_BIO_strings(void); |
diff --git a/src/lib/libcrypto/bio/bio_local.h b/src/lib/libcrypto/bio/bio_local.h index 4eecf7e04a..f59b5756c9 100644 --- a/src/lib/libcrypto/bio/bio_local.h +++ b/src/lib/libcrypto/bio/bio_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bio_local.h,v 1.5 2022/12/02 19:44:04 tb Exp $ */ | 1 | /* $OpenBSD: bio_local.h,v 1.6 2024/03/02 09:18:28 tb 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 | * |
| @@ -59,6 +59,8 @@ | |||
| 59 | #ifndef HEADER_BIO_LOCAL_H | 59 | #ifndef HEADER_BIO_LOCAL_H |
| 60 | #define HEADER_BIO_LOCAL_H | 60 | #define HEADER_BIO_LOCAL_H |
| 61 | 61 | ||
| 62 | #include <stdarg.h> | ||
| 63 | |||
| 62 | __BEGIN_HIDDEN_DECLS | 64 | __BEGIN_HIDDEN_DECLS |
| 63 | 65 | ||
| 64 | struct bio_method_st { | 66 | struct bio_method_st { |
| @@ -118,6 +120,8 @@ typedef struct bio_f_buffer_ctx_struct { | |||
| 118 | int obuf_off; /* write/read offset */ | 120 | int obuf_off; /* write/read offset */ |
| 119 | } BIO_F_BUFFER_CTX; | 121 | } BIO_F_BUFFER_CTX; |
| 120 | 122 | ||
| 123 | int BIO_vprintf(BIO *bio, const char *format, va_list args); | ||
| 124 | |||
| 121 | __END_HIDDEN_DECLS | 125 | __END_HIDDEN_DECLS |
| 122 | 126 | ||
| 123 | #endif /* !HEADER_BIO_LOCAL_H */ | 127 | #endif /* !HEADER_BIO_LOCAL_H */ |
