diff --git a/crypto/asn1/a_gentm.c b/crypto/asn1/a_gentm.c index ff1f97cbb..f1c4e09de 100644 --- a/crypto/asn1/a_gentm.c +++ b/crypto/asn1/a_gentm.c @@ -123,9 +123,9 @@ ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_adj(ASN1_GENERALIZEDTIME *s, } char buf[16]; - BIO_snprintf(buf, sizeof(buf), "%04d%02d%02d%02d%02d%02dZ", - data.tm_year + 1900, data.tm_mon + 1, data.tm_mday, data.tm_hour, - data.tm_min, data.tm_sec); + snprintf(buf, sizeof(buf), "%04d%02d%02d%02d%02d%02dZ", data.tm_year + 1900, + data.tm_mon + 1, data.tm_mday, data.tm_hour, data.tm_min, + data.tm_sec); int free_s = 0; if (s == NULL) { diff --git a/crypto/asn1/a_strex.c b/crypto/asn1/a_strex.c index f21d14655..dcc87f1e4 100644 --- a/crypto/asn1/a_strex.c +++ b/crypto/asn1/a_strex.c @@ -89,18 +89,18 @@ static int do_esc_char(uint32_t c, unsigned long flags, char *do_quotes, char buf[16]; // Large enough for "\\W01234567". unsigned char u8 = (unsigned char)c; if (c > 0xffff) { - BIO_snprintf(buf, sizeof(buf), "\\W%08" PRIX32, c); + snprintf(buf, sizeof(buf), "\\W%08" PRIX32, c); } else if (c > 0xff) { - BIO_snprintf(buf, sizeof(buf), "\\U%04" PRIX32, c); + snprintf(buf, sizeof(buf), "\\U%04" PRIX32, c); } else if ((flags & ASN1_STRFLGS_ESC_MSB) && c > 0x7f) { - BIO_snprintf(buf, sizeof(buf), "\\%02X", c); + snprintf(buf, sizeof(buf), "\\%02X", c); } else if ((flags & ASN1_STRFLGS_ESC_CTRL) && is_control_character(c)) { - BIO_snprintf(buf, sizeof(buf), "\\%02X", c); + snprintf(buf, sizeof(buf), "\\%02X", c); } else if (flags & ASN1_STRFLGS_ESC_2253) { // See RFC 2253, sections 2.4 and 4. if (c == '\\' || c == '"') { // Quotes and backslashes are always escaped, quoted or not. - BIO_snprintf(buf, sizeof(buf), "\\%c", (int)c); + snprintf(buf, sizeof(buf), "\\%c", (int)c); } else if (c == ',' || c == '+' || c == '<' || c == '>' || c == ';' || (is_first && (c == ' ' || c == '#')) || (is_last && (c == ' '))) { @@ -111,13 +111,13 @@ static int do_esc_char(uint32_t c, unsigned long flags, char *do_quotes, } return maybe_write(out, &u8, 1) ? 1 : -1; } - BIO_snprintf(buf, sizeof(buf), "\\%c", (int)c); + snprintf(buf, sizeof(buf), "\\%c", (int)c); } else { return maybe_write(out, &u8, 1) ? 1 : -1; } } else if ((flags & ESC_FLAGS) && c == '\\') { // If any escape flags are set, also escape backslashes. - BIO_snprintf(buf, sizeof(buf), "\\%c", (int)c); + snprintf(buf, sizeof(buf), "\\%c", (int)c); } else { return maybe_write(out, &u8, 1) ? 1 : -1; } diff --git a/crypto/asn1/a_utctm.c b/crypto/asn1/a_utctm.c index 82f2df631..45fc71f63 100644 --- a/crypto/asn1/a_utctm.c +++ b/crypto/asn1/a_utctm.c @@ -124,9 +124,9 @@ ASN1_UTCTIME *ASN1_UTCTIME_adj(ASN1_UTCTIME *s, int64_t posix_time, int offset_d } char buf[14]; - BIO_snprintf(buf, sizeof(buf), "%02d%02d%02d%02d%02d%02dZ", - data.tm_year % 100, data.tm_mon + 1, data.tm_mday, data.tm_hour, - data.tm_min, data.tm_sec); + snprintf(buf, sizeof(buf), "%02d%02d%02d%02d%02d%02dZ", data.tm_year % 100, + data.tm_mon + 1, data.tm_mday, data.tm_hour, data.tm_min, + data.tm_sec); int free_s = 0; if (s == NULL) { diff --git a/crypto/bio/bio_test.cc b/crypto/bio/bio_test.cc index 8827ce614..135039288 100644 --- a/crypto/bio/bio_test.cc +++ b/crypto/bio/bio_test.cc @@ -48,7 +48,7 @@ static std::string LastSocketError() { return strerror(errno); } #else static std::string LastSocketError() { char buf[DECIMAL_SIZE(int) + 1]; - BIO_snprintf(buf, sizeof(buf), "%d", WSAGetLastError()); + snprintf(buf, sizeof(buf), "%d", WSAGetLastError()); return buf; } #endif @@ -99,11 +99,9 @@ TEST(BIOTest, SocketConnect) { char hostname[80]; if (ss.ss_family == AF_INET6) { - BIO_snprintf(hostname, sizeof(hostname), "[::1]:%d", - ntohs(sin6->sin6_port)); + snprintf(hostname, sizeof(hostname), "[::1]:%d", ntohs(sin6->sin6_port)); } else if (ss.ss_family == AF_INET) { - BIO_snprintf(hostname, sizeof(hostname), "127.0.0.1:%d", - ntohs(sin->sin_port)); + snprintf(hostname, sizeof(hostname), "127.0.0.1:%d", ntohs(sin->sin_port)); } // Connect to it with a connect BIO. diff --git a/crypto/bio/connect.c b/crypto/bio/connect.c index fda8f8522..cf52ddec2 100644 --- a/crypto/bio/connect.c +++ b/crypto/bio/connect.c @@ -532,7 +532,7 @@ int BIO_set_conn_port(BIO *bio, const char *port_str) { int BIO_set_conn_int_port(BIO *bio, const int *port) { char buf[DECIMAL_SIZE(int) + 1]; - BIO_snprintf(buf, sizeof(buf), "%d", *port); + snprintf(buf, sizeof(buf), "%d", *port); return BIO_set_conn_port(bio, buf); } diff --git a/crypto/bytestring/cbs.c b/crypto/bytestring/cbs.c index eb7e4dc98..631f284f1 100644 --- a/crypto/bytestring/cbs.c +++ b/crypto/bytestring/cbs.c @@ -694,7 +694,7 @@ int CBS_is_unsigned_asn1_integer(const CBS *cbs) { static int add_decimal(CBB *out, uint64_t v) { char buf[DECIMAL_SIZE(uint64_t) + 1]; - BIO_snprintf(buf, sizeof(buf), "%" PRIu64, v); + snprintf(buf, sizeof(buf), "%" PRIu64, v); return CBB_add_bytes(out, (const uint8_t *)buf, strlen(buf)); } diff --git a/crypto/conf/conf.c b/crypto/conf/conf.c index 523de78fb..6b9833d97 100644 --- a/crypto/conf/conf.c +++ b/crypto/conf/conf.c @@ -574,7 +574,7 @@ err: if (out_error_line != NULL) { *out_error_line = eline; } - BIO_snprintf(btmp, sizeof btmp, "%ld", eline); + snprintf(btmp, sizeof btmp, "%ld", eline); ERR_add_error_data(2, "line ", btmp); if (v != NULL) { diff --git a/crypto/err/err.c b/crypto/err/err.c index a8a53af77..d041c5fec 100644 --- a/crypto/err/err.c +++ b/crypto/err/err.c @@ -554,17 +554,17 @@ char *ERR_error_string_n(uint32_t packed_error, char *buf, size_t len) { char lib_buf[64], reason_buf[64]; if (lib_str == NULL) { - BIO_snprintf(lib_buf, sizeof(lib_buf), "lib(%u)", lib); + snprintf(lib_buf, sizeof(lib_buf), "lib(%u)", lib); lib_str = lib_buf; } if (reason_str == NULL) { - BIO_snprintf(reason_buf, sizeof(reason_buf), "reason(%u)", reason); - reason_str = reason_buf; - } + snprintf(reason_buf, sizeof(reason_buf), "reason(%u)", reason); + reason_str = reason_buf; + } - BIO_snprintf(buf, len, "error:%08" PRIx32 ":%s:OPENSSL_internal:%s", - packed_error, lib_str, reason_str); + snprintf(buf, len, "error:%08" PRIx32 ":%s:OPENSSL_internal:%s", packed_error, + lib_str, reason_str); if (strlen(buf) == len - 1) { // output may be truncated; make sure we always have 5 colon-separated @@ -617,8 +617,8 @@ void ERR_print_errors_cb(ERR_print_errors_callback_t callback, void *ctx) { } ERR_error_string_n(packed_error, buf, sizeof(buf)); - BIO_snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", thread_hash, buf, - file, line, (flags & ERR_FLAG_STRING) ? data : ""); + snprintf(buf2, sizeof(buf2), "%lu:%s:%s:%d:%s\n", thread_hash, buf, file, + line, (flags & ERR_FLAG_STRING) ? data : ""); if (callback(buf2, strlen(buf2), ctx) <= 0) { break; } diff --git a/crypto/fipsmodule/ec/p256-nistz_test.cc b/crypto/fipsmodule/ec/p256-nistz_test.cc index 56eed08a0..263db5030 100644 --- a/crypto/fipsmodule/ec/p256-nistz_test.cc +++ b/crypto/fipsmodule/ec/p256-nistz_test.cc @@ -194,7 +194,7 @@ static std::string FieldElementToString(const BN_ULONG a[P256_LIMBS]) { std::string ret; for (size_t i = P256_LIMBS-1; i < P256_LIMBS; i--) { char buf[2 * BN_BYTES + 1]; - BIO_snprintf(buf, sizeof(buf), BN_HEX_FMT2, a[i]); + snprintf(buf, sizeof(buf), BN_HEX_FMT2, a[i]); ret += buf; } return ret; diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c index fb4de2d1b..a34496f86 100644 --- a/crypto/x509/by_dir.c +++ b/crypto/x509/by_dir.c @@ -312,8 +312,7 @@ static int get_cert_by_subject(X509_LOOKUP *xl, int type, X509_NAME *name, hent = NULL; } for (;;) { - BIO_snprintf(b->data, b->max, "%s/%08lx.%s%d", ent->dir, h, postfix, - k); + snprintf(b->data, b->max, "%s/%08lx.%s%d", ent->dir, h, postfix, k); #ifndef OPENSSL_NO_POSIX_IO #if defined(_WIN32) && !defined(stat) #define stat _stat diff --git a/crypto/x509v3/v3_alt.c b/crypto/x509v3/v3_alt.c index ddd112a2e..e3c15f5b9 100644 --- a/crypto/x509v3/v3_alt.c +++ b/crypto/x509v3/v3_alt.c @@ -173,13 +173,12 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(const X509V3_EXT_METHOD *method, case GEN_IPADD: p = gen->d.ip->data; if (gen->d.ip->length == 4) { - BIO_snprintf(oline, sizeof(oline), "%d.%d.%d.%d", p[0], p[1], p[2], - p[3]); + snprintf(oline, sizeof(oline), "%d.%d.%d.%d", p[0], p[1], p[2], p[3]); } else if (gen->d.ip->length == 16) { oline[0] = 0; for (i = 0; i < 8; i++) { uint16_t v = ((uint16_t)p[0] << 8) | p[1]; - BIO_snprintf(htmp, sizeof(htmp), "%X", v); + snprintf(htmp, sizeof(htmp), "%X", v); p += 2; OPENSSL_strlcat(oline, htmp, sizeof(oline)); if (i != 7) { diff --git a/decrepit/ssl/ssl_decrepit.c b/decrepit/ssl/ssl_decrepit.c index 32f703e1f..a155c0f46 100644 --- a/decrepit/ssl/ssl_decrepit.c +++ b/decrepit/ssl/ssl_decrepit.c @@ -150,7 +150,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, break; } - int r = BIO_snprintf(buf, sizeof(buf), "%s/%s", path, dirent->d_name); + int r = snprintf(buf, sizeof(buf), "%s/%s", path, dirent->d_name); if (r <= 0 || r >= (int)sizeof(buf) || !SSL_add_file_cert_subjects_to_stack(stack, buf)) { diff --git a/ssl/ssl_cipher.cc b/ssl/ssl_cipher.cc index 6f2098981..fd8cef95d 100644 --- a/ssl/ssl_cipher.cc +++ b/ssl/ssl_cipher.cc @@ -1682,8 +1682,8 @@ const char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, return "Buffer too small"; } - BIO_snprintf(buf, len, "%-23s Kx=%-8s Au=%-4s Enc=%-9s Mac=%-4s\n", - cipher->name, kx, au, enc, mac); + snprintf(buf, len, "%-23s Kx=%-8s Au=%-4s Enc=%-9s Mac=%-4s\n", cipher->name, + kx, au, enc, mac); return buf; }