Commit c192d4b6f8 for openssl.org
commit c192d4b6f82fd34fa0191c0fde6c3b8ab5240123
Author: Bob Beck <beck@openssl.org>
Date: Wed Jun 17 18:42:20 2026 -0600
Convert BIO_snprintf() callers that ignore the return value to snprintf().
Where the return value is discarded, BIO_snprintf() and snprintf() are
interchangeable: both write the same bytes and NUL-terminate the buffer.
The conversion is mechanical.
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Andrew Dinh <andrewd@openssl.org>
MergeDate: Wed Aug 26 16:20:07 2026
(Merged from https://github.com/openssl/openssl/pull/31640)
diff --git a/apps/cmp.c b/apps/cmp.c
index 278e344b7c..f094b7f465 100644
--- a/apps/cmp.c
+++ b/apps/cmp.c
@@ -12,8 +12,9 @@
/* This app is disabled when OPENSSL_NO_CMP is defined. */
#include "internal/e_os.h"
-#include <string.h>
#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
#include "apps.h"
#include "http_server.h"
@@ -2302,7 +2303,7 @@ static int setup_client_ctx(OSSL_CMP_CTX *ctx)
if (!OSSL_CMP_CTX_set_option(ctx, OSSL_CMP_OPT_USE_TLS, opt_tls_used))
goto err;
- BIO_snprintf(server_port, sizeof(server_port), "%s", port);
+ snprintf(server_port, sizeof(server_port), "%s", port);
if (opt_path == NULL)
used_path = path;
if (!OSSL_CMP_CTX_set1_server(ctx, host)
@@ -2312,13 +2313,13 @@ static int setup_client_ctx(OSSL_CMP_CTX *ctx)
goto oom;
if (opt_no_proxy != NULL && !OSSL_CMP_CTX_set1_no_proxy(ctx, opt_no_proxy))
goto oom;
- (void)BIO_snprintf(server_buf, sizeof(server_buf), "http%s://%s:%s/%s",
+ (void)snprintf(server_buf, sizeof(server_buf), "http%s://%s:%s/%s",
opt_tls_used ? "s" : "", host, port,
*used_path == '/' ? used_path + 1 : used_path);
proxy_host = OSSL_HTTP_adapt_proxy(opt_proxy, opt_no_proxy, host, use_ssl);
if (proxy_host != NULL)
- (void)BIO_snprintf(proxy_buf, sizeof(proxy_buf), " via %s", proxy_host);
+ (void)snprintf(proxy_buf, sizeof(proxy_buf), " via %s", proxy_host);
set_path:
#endif
@@ -2588,7 +2589,7 @@ static int save_cert_or_delete(X509 *cert, const char *file, const char *desc)
if (cert == NULL) {
char desc_cert[80];
- BIO_snprintf(desc_cert, sizeof(desc_cert), "%s certificate", desc);
+ snprintf(desc_cert, sizeof(desc_cert), "%s certificate", desc);
return delete_file(file, desc_cert);
} else {
STACK_OF(X509) *certs = sk_X509_new_null();
@@ -2837,7 +2838,7 @@ static int read_config(void)
char *conf_argv[3];
char arg1[82];
- BIO_snprintf(arg1, 81, "-%s", (char *)opt->name);
+ snprintf(arg1, 81, "-%s", (char *)opt->name);
conf_argv[0] = prog;
conf_argv[1] = arg1;
if (opt->valtype == '-') {
diff --git a/apps/enc.c b/apps/enc.c
index 3d06a6ef03..87e6f9530e 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -473,7 +473,7 @@ int enc_main(int argc, char **argv)
for (;;) {
char prompt[200];
- BIO_snprintf(prompt, sizeof(prompt), "enter %s %s password:",
+ snprintf(prompt, sizeof(prompt), "enter %s %s password:",
EVP_CIPHER_get0_name(cipher),
(enc) ? "encryption" : "decryption");
strbuf[0] = '\0';
diff --git a/apps/kdf.c b/apps/kdf.c
index 7eaa1a19de..c8674afec5 100644
--- a/apps/kdf.c
+++ b/apps/kdf.c
@@ -7,6 +7,7 @@
* https://www.openssl.org/source/license.html
*/
+#include <stdio.h>
#include <string.h>
#include "apps.h"
@@ -65,7 +66,7 @@ static char *alloc_kdf_algorithm_name(STACK_OF(OPENSSL_STRING) **optp,
return NULL;
res = app_malloc(len, "algorithm name");
- BIO_snprintf(res, len, "%s:%s", name, arg);
+ snprintf(res, len, "%s:%s", name, arg);
if (sk_OPENSSL_STRING_push(*optp, res))
return res;
OPENSSL_free(res);
diff --git a/apps/lib/apps.c b/apps/lib/apps.c
index 3b792b5768..5159e325cc 100644
--- a/apps/lib/apps.c
+++ b/apps/lib/apps.c
@@ -1760,9 +1760,9 @@ int save_serial(const char *serialfile, const char *suffix,
OPENSSL_strlcpy(buf[0], serialfile, BSIZE);
} else {
#ifndef OPENSSL_SYS_VMS
- BIO_snprintf(buf[0], sizeof(buf[0]), "%s.%s", serialfile, suffix);
+ snprintf(buf[0], sizeof(buf[0]), "%s.%s", serialfile, suffix);
#else
- BIO_snprintf(buf[0], sizeof(buf[0]), "%s-%s", serialfile, suffix);
+ snprintf(buf[0], sizeof(buf[0]), "%s-%s", serialfile, suffix);
#endif
}
out = BIO_new_file(buf[0], "w");
@@ -1804,11 +1804,11 @@ int rotate_serial(const char *serialfile, const char *new_suffix,
goto err;
}
#ifndef OPENSSL_SYS_VMS
- BIO_snprintf(buf[0], sizeof(buf[0]), "%s.%s", serialfile, new_suffix);
- BIO_snprintf(buf[1], sizeof(buf[1]), "%s.%s", serialfile, old_suffix);
+ snprintf(buf[0], sizeof(buf[0]), "%s.%s", serialfile, new_suffix);
+ snprintf(buf[1], sizeof(buf[1]), "%s.%s", serialfile, old_suffix);
#else
- BIO_snprintf(buf[0], sizeof(buf[0]), "%s-%s", serialfile, new_suffix);
- BIO_snprintf(buf[1], sizeof(buf[1]), "%s-%s", serialfile, old_suffix);
+ snprintf(buf[0], sizeof(buf[0]), "%s-%s", serialfile, new_suffix);
+ snprintf(buf[1], sizeof(buf[1]), "%s-%s", serialfile, old_suffix);
#endif
if (rename(serialfile, buf[1]) < 0 && errno != ENOENT
#ifdef ENOTDIR
@@ -1893,9 +1893,9 @@ CA_DB *load_index(const char *dbfile, DB_ATTR *db_attr)
goto err;
#ifndef OPENSSL_SYS_VMS
- BIO_snprintf(buf, sizeof(buf), "%s.attr", dbfile);
+ snprintf(buf, sizeof(buf), "%s.attr", dbfile);
#else
- BIO_snprintf(buf, sizeof(buf), "%s-attr", dbfile);
+ snprintf(buf, sizeof(buf), "%s-attr", dbfile);
#endif
dbattr_conf = app_load_config_quiet(buf);
@@ -1976,13 +1976,13 @@ int save_index(const char *dbfile, const char *suffix, CA_DB *db)
goto err;
}
#ifndef OPENSSL_SYS_VMS
- BIO_snprintf(buf[2], sizeof(buf[2]), "%s.attr", dbfile);
- BIO_snprintf(buf[1], sizeof(buf[1]), "%s.attr.%s", dbfile, suffix);
- BIO_snprintf(buf[0], sizeof(buf[0]), "%s.%s", dbfile, suffix);
+ snprintf(buf[2], sizeof(buf[2]), "%s.attr", dbfile);
+ snprintf(buf[1], sizeof(buf[1]), "%s.attr.%s", dbfile, suffix);
+ snprintf(buf[0], sizeof(buf[0]), "%s.%s", dbfile, suffix);
#else
- BIO_snprintf(buf[2], sizeof(buf[2]), "%s-attr", dbfile);
- BIO_snprintf(buf[1], sizeof(buf[1]), "%s-attr-%s", dbfile, suffix);
- BIO_snprintf(buf[0], sizeof(buf[0]), "%s-%s", dbfile, suffix);
+ snprintf(buf[2], sizeof(buf[2]), "%s-attr", dbfile);
+ snprintf(buf[1], sizeof(buf[1]), "%s-attr-%s", dbfile, suffix);
+ snprintf(buf[0], sizeof(buf[0]), "%s-%s", dbfile, suffix);
#endif
out = BIO_new_file(buf[0], "w");
if (out == NULL) {
@@ -2026,17 +2026,17 @@ int rotate_index(const char *dbfile, const char *new_suffix,
goto err;
}
#ifndef OPENSSL_SYS_VMS
- BIO_snprintf(buf[4], sizeof(buf[4]), "%s.attr", dbfile);
- BIO_snprintf(buf[3], sizeof(buf[3]), "%s.attr.%s", dbfile, old_suffix);
- BIO_snprintf(buf[2], sizeof(buf[2]), "%s.attr.%s", dbfile, new_suffix);
- BIO_snprintf(buf[1], sizeof(buf[1]), "%s.%s", dbfile, old_suffix);
- BIO_snprintf(buf[0], sizeof(buf[0]), "%s.%s", dbfile, new_suffix);
+ snprintf(buf[4], sizeof(buf[4]), "%s.attr", dbfile);
+ snprintf(buf[3], sizeof(buf[3]), "%s.attr.%s", dbfile, old_suffix);
+ snprintf(buf[2], sizeof(buf[2]), "%s.attr.%s", dbfile, new_suffix);
+ snprintf(buf[1], sizeof(buf[1]), "%s.%s", dbfile, old_suffix);
+ snprintf(buf[0], sizeof(buf[0]), "%s.%s", dbfile, new_suffix);
#else
- BIO_snprintf(buf[4], sizeof(buf[4]), "%s-attr", dbfile);
- BIO_snprintf(buf[3], sizeof(buf[3]), "%s-attr-%s", dbfile, old_suffix);
- BIO_snprintf(buf[2], sizeof(buf[2]), "%s-attr-%s", dbfile, new_suffix);
- BIO_snprintf(buf[1], sizeof(buf[1]), "%s-%s", dbfile, old_suffix);
- BIO_snprintf(buf[0], sizeof(buf[0]), "%s-%s", dbfile, new_suffix);
+ snprintf(buf[4], sizeof(buf[4]), "%s-attr", dbfile);
+ snprintf(buf[3], sizeof(buf[3]), "%s-attr-%s", dbfile, old_suffix);
+ snprintf(buf[2], sizeof(buf[2]), "%s-attr-%s", dbfile, new_suffix);
+ snprintf(buf[1], sizeof(buf[1]), "%s-%s", dbfile, old_suffix);
+ snprintf(buf[0], sizeof(buf[0]), "%s-%s", dbfile, new_suffix);
#endif
if (rename(dbfile, buf[1]) < 0 && errno != ENOENT
#ifdef ENOTDIR
diff --git a/apps/lib/http_server.c b/apps/lib/http_server.c
index d470fb8c58..1fa65d9212 100644
--- a/apps/lib/http_server.c
+++ b/apps/lib/http_server.c
@@ -18,6 +18,7 @@
#endif
#include <ctype.h>
+#include <stdio.h>
#include "internal/e_os.h"
#include "http_server.h"
#include "internal/sockets.h" /* for openssl_fdset() */
@@ -197,7 +198,7 @@ BIO *http_server_init(const char *prog, const char *port, int verb)
int port_num;
char name[40];
- BIO_snprintf(name, sizeof(name), "*:%s", port); /* port may be "0" */
+ snprintf(name, sizeof(name), "*:%s", port); /* port may be "0" */
if (verb >= 0 && !log_set_verbosity(prog, verb))
return NULL;
bufbio = BIO_new(BIO_f_buffer());
diff --git a/apps/lib/log.c b/apps/lib/log.c
index 8ed7a3bc2b..63a7655df9 100644
--- a/apps/lib/log.c
+++ b/apps/lib/log.c
@@ -7,6 +7,8 @@
* https://www.openssl.org/source/license.html
*/
+#include <stdio.h>
+
#include <openssl/trace.h>
#include "apps.h"
#include "log.h"
@@ -49,7 +51,7 @@ static void log_with_prefix(const char *prog, const char *fmt, va_list ap)
if (pre == NULL)
return;
- (void)BIO_snprintf(prefix, sizeof(prefix), "%s: ", prog);
+ (void)snprintf(prefix, sizeof(prefix), "%s: ", prog);
(void)BIO_set_prefix(pre, prefix);
bio = BIO_push(pre, bio_err);
(void)BIO_vprintf(bio, fmt, ap);
diff --git a/apps/lib/opt.c b/apps/lib/opt.c
index d139346cc2..b33affeb00 100644
--- a/apps/lib/opt.c
+++ b/apps/lib/opt.c
@@ -15,6 +15,7 @@
#include "app_libctx.h"
#include "internal/nelem.h"
#include "internal/numbers.h"
+#include <stdio.h>
#include <string.h>
#if !defined(OPENSSL_SYS_MSDOS)
#include <unistd.h>
@@ -148,7 +149,7 @@ char *opt_appname(const char *argv0)
size_t len = strlen(prog);
if (argv0 != NULL)
- BIO_snprintf(prog + len, sizeof(prog) - len - 1, " %s", argv0);
+ snprintf(prog + len, sizeof(prog) - len - 1, " %s", argv0);
return prog;
}
diff --git a/apps/lib/s_cb.c b/apps/lib/s_cb.c
index dcd5690e4d..8c014fca8c 100644
--- a/apps/lib/s_cb.c
+++ b/apps/lib/s_cb.c
@@ -711,11 +711,11 @@ void msg_cb(int write_p, int version, int content_type, const void *buf,
}
if (str_content_type[0] == '\0') {
- BIO_snprintf(tmpbuf, sizeof(tmpbuf) - 1, ", Unknown (content_type=%d)", content_type);
+ snprintf(tmpbuf, sizeof(tmpbuf) - 1, ", Unknown (content_type=%d)", content_type);
str_content_type = tmpbuf;
}
} else {
- BIO_snprintf(tmpbuf, sizeof(tmpbuf) - 1, "Not TLS data or unknown version (version=%d, content_type=%d)", version, content_type);
+ snprintf(tmpbuf, sizeof(tmpbuf) - 1, "Not TLS data or unknown version (version=%d, content_type=%d)", version, content_type);
str_version = tmpbuf;
}
diff --git a/apps/lib/vms_term_sock.c b/apps/lib/vms_term_sock.c
index 8cdca03f3f..1704511802 100644
--- a/apps/lib/vms_term_sock.c
+++ b/apps/lib/vms_term_sock.c
@@ -368,7 +368,7 @@ static int CreateSocketPair(int SocketFamily,
/*
** Get the binary (64-bit) time of the specified timeout value
*/
- BIO_snprintf(AscTimeBuff, sizeof(AscTimeBuff), "0 0:0:%02d.00", SOCKET_PAIR_TIMEOUT_VALUE);
+ snprintf(AscTimeBuff, sizeof(AscTimeBuff), "0 0:0:%02d.00", SOCKET_PAIR_TIMEOUT_VALUE);
AscTimeDesc.dsc$w_length = strlen(AscTimeBuff);
AscTimeDesc.dsc$a_pointer = AscTimeBuff;
status = sys$bintim(&AscTimeDesc, BinTimeBuff);
@@ -579,7 +579,7 @@ static void LogMessage(char *msg, ...)
/*
** Format the message buffer
*/
- BIO_snprintf(MsgBuff, sizeof(MsgBuff), "%02d-%s-%04d %02d:%02d:%02d [%08X] %s\n",
+ snprintf(MsgBuff, sizeof(MsgBuff), "%02d-%s-%04d %02d:%02d:%02d [%08X] %s\n",
LocTime->tm_mday, Month[LocTime->tm_mon],
(LocTime->tm_year + 1900), LocTime->tm_hour, LocTime->tm_min,
LocTime->tm_sec, pid, msg);
diff --git a/apps/mac.c b/apps/mac.c
index 61044eb633..daa22a3bd9 100644
--- a/apps/mac.c
+++ b/apps/mac.c
@@ -7,6 +7,7 @@
* https://www.openssl.org/source/license.html
*/
+#include <stdio.h>
#include <string.h>
#include "apps.h"
@@ -68,7 +69,7 @@ static char *alloc_mac_algorithm_name(STACK_OF(OPENSSL_STRING) **optp,
return NULL;
res = app_malloc(len, "algorithm name");
- BIO_snprintf(res, len, "%s:%s", name, arg);
+ snprintf(res, len, "%s:%s", name, arg);
if (sk_OPENSSL_STRING_push(*optp, res))
return res;
OPENSSL_free(res);
diff --git a/apps/openssl.c b/apps/openssl.c
index 4df297e3c4..1b48e63bdc 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -123,7 +123,7 @@ static size_t internal_trace_cb(const char *buf, size_t cnt,
tid = CRYPTO_THREAD_get_current_id();
hex = OPENSSL_buf2hexstr((const unsigned char *)&tid, sizeof(tid));
- BIO_snprintf(buffer, sizeof(buffer), "TRACE[%s]:%s: ",
+ snprintf(buffer, sizeof(buffer), "TRACE[%s]:%s: ",
hex == NULL ? "<null>" : hex,
OSSL_trace_get_category_name(category));
OPENSSL_free(hex);
diff --git a/apps/passwd.c b/apps/passwd.c
index 1750f12f76..a2fff324aa 100644
--- a/apps/passwd.c
+++ b/apps/passwd.c
@@ -7,6 +7,7 @@
* https://www.openssl.org/source/license.html
*/
+#include <stdio.h>
#include <string.h>
#include "apps.h"
@@ -594,7 +595,7 @@ static char *shacrypt(const char *passwd, const char *magic, const char *salt)
if (rounds_custom) {
char tmp_buf[80]; /* "rounds=999999999" */
- BIO_snprintf(tmp_buf, sizeof(tmp_buf), "rounds=%u", rounds);
+ snprintf(tmp_buf, sizeof(tmp_buf), "rounds=%u", rounds);
#ifdef CHARSET_EBCDIC
/* In case we're really on a ASCII based platform and just pretend */
if (tmp_buf[0] != 0x72) /* ASCII 'r' */
diff --git a/apps/pkeyutl.c b/apps/pkeyutl.c
index 5f9c3284f0..3d7cce54c1 100644
--- a/apps/pkeyutl.c
+++ b/apps/pkeyutl.c
@@ -10,6 +10,7 @@
#include "apps.h"
#include "progs.h"
#include <limits.h>
+#include <stdio.h>
#include <string.h>
#include <openssl/err.h>
#include <openssl/pem.h>
@@ -400,7 +401,7 @@ int pkeyutl_main(int argc, char **argv)
char passwd_buf[4096];
int r;
- BIO_snprintf(passwd_buf, sizeof(passwd_buf), "Enter %s: ", opt);
+ snprintf(passwd_buf, sizeof(passwd_buf), "Enter %s: ", opt);
r = EVP_read_pw_string(passwd_buf, sizeof(passwd_buf) - 1,
passwd_buf, 0);
if (r < 0) {
diff --git a/apps/rehash.c b/apps/rehash.c
index 93e757faa9..0f3beef8d9 100644
--- a/apps/rehash.c
+++ b/apps/rehash.c
@@ -432,7 +432,7 @@ static int do_dir(const char *dirname, enum Hash h)
nextep = ep->next;
if (ep->old_id < bp->num_needed) {
/* Link exists, and is used as-is */
- BIO_snprintf(buf, buflen, "%08x.%s%d", bp->hash,
+ snprintf(buf, buflen, "%08x.%s%d", bp->hash,
suffixes[bp->type], ep->old_id);
if (verbose)
BIO_printf(bio_out, "link %s -> %s\n",
@@ -442,7 +442,7 @@ static int do_dir(const char *dirname, enum Hash h)
while (bit_isset(idmask, nextid))
nextid++;
- BIO_snprintf(buf, buflen, "%s%s%08x.%s%d",
+ snprintf(buf, buflen, "%s%s%08x.%s%d",
dirname, pathsep, bp->hash,
suffixes[bp->type], nextid);
if (verbose)
@@ -464,7 +464,7 @@ static int do_dir(const char *dirname, enum Hash h)
bit_set(idmask, nextid);
} else if (remove_links) {
/* Link to be deleted */
- BIO_snprintf(buf, buflen, "%s%s%08x.%s%d",
+ snprintf(buf, buflen, "%s%s%08x.%s%d",
dirname, pathsep, bp->hash,
suffixes[bp->type], ep->old_id);
if (verbose)
diff --git a/apps/s_client.c b/apps/s_client.c
index 651e7fe724..f5aecec132 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -343,7 +343,7 @@ static int serverinfo_cli_parse_cb(SSL *s, unsigned int ext_type,
ext_buf[3] = (unsigned char)(inlen);
memcpy(ext_buf + 4, in, inlen);
- BIO_snprintf(pem_name, sizeof(pem_name), "SERVERINFO FOR EXTENSION %u",
+ snprintf(pem_name, sizeof(pem_name), "SERVERINFO FOR EXTENSION %u",
ext_type);
PEM_write_bio(bio_c_out, pem_name, "", ext_buf, (long)(4 + inlen));
return 1;
diff --git a/apps/speed.c b/apps/speed.c
index 569f438a39..d121dfe076 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -2622,7 +2622,7 @@ int speed_main(int argc, char **argv)
if (evp_mac_mdname == NULL)
goto end;
evp_hmac_name = app_malloc(hmac_name_len, "HMAC name");
- BIO_snprintf(evp_hmac_name, hmac_name_len, "hmac(%s)", evp_mac_mdname);
+ snprintf(evp_hmac_name, hmac_name_len, "hmac(%s)", evp_mac_mdname);
names[D_HMAC] = evp_hmac_name;
params[0] = OSSL_PARAM_construct_utf8_string(OSSL_MAC_PARAM_DIGEST,
@@ -3030,7 +3030,7 @@ int speed_main(int argc, char **argv)
goto end;
}
evp_cmac_name = app_malloc(len, "CMAC name");
- BIO_snprintf(evp_cmac_name, len, "cmac(%s)", evp_mac_ciphername);
+ snprintf(evp_cmac_name, len, "cmac(%s)", evp_mac_ciphername);
names[D_EVP_CMAC] = evp_cmac_name;
params[0] = OSSL_PARAM_construct_utf8_string(OSSL_ALG_PARAM_CIPHER,
diff --git a/crypto/asn1/a_strex.c b/crypto/asn1/a_strex.c
index 4315355632..e6e58988d4 100644
--- a/crypto/asn1/a_strex.c
+++ b/crypto/asn1/a_strex.c
@@ -76,13 +76,13 @@ static int do_esc_char(uint32_t c, unsigned short flags, char *do_quotes,
if (c > UNICODE_MAX)
return -1;
if (c > 0xffff) {
- BIO_snprintf(tmphex, sizeof(tmphex), "\\W%08" PRIX32, c);
+ snprintf(tmphex, sizeof(tmphex), "\\W%08" PRIX32, c);
if (!io_ch(arg, tmphex, 10))
return -1;
return 10;
}
if (c > 0xff) {
- BIO_snprintf(tmphex, sizeof(tmphex), "\\U%04" PRIX32, c);
+ snprintf(tmphex, sizeof(tmphex), "\\U%04" PRIX32, c);
if (!io_ch(arg, tmphex, 6))
return -1;
return 6;
@@ -108,7 +108,7 @@ static int do_esc_char(uint32_t c, unsigned short flags, char *do_quotes,
return 2;
}
if (chflgs & (ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_ESC_2254)) {
- BIO_snprintf(tmphex, 11, "\\%02X", chtmp);
+ snprintf(tmphex, 11, "\\%02X", chtmp);
if (!io_ch(arg, tmphex, 3))
return -1;
return 3;
diff --git a/crypto/asn1/asn1_parse.c b/crypto/asn1/asn1_parse.c
index 27d09dc9fe..f78e0b36c9 100644
--- a/crypto/asn1/asn1_parse.c
+++ b/crypto/asn1/asn1_parse.c
@@ -64,13 +64,13 @@ static int asn1_print_info(BIO *bp, long offset, int depth, int hl, long len,
*/
p = str;
if ((xclass & V_ASN1_PRIVATE) == V_ASN1_PRIVATE)
- BIO_snprintf(str, sizeof(str), "priv [ %d ] ", tag);
+ snprintf(str, sizeof(str), "priv [ %d ] ", tag);
else if ((xclass & V_ASN1_CONTEXT_SPECIFIC) == V_ASN1_CONTEXT_SPECIFIC)
- BIO_snprintf(str, sizeof(str), "cont [ %d ]", tag);
+ snprintf(str, sizeof(str), "cont [ %d ]", tag);
else if ((xclass & V_ASN1_APPLICATION) == V_ASN1_APPLICATION)
- BIO_snprintf(str, sizeof(str), "appl [ %d ]", tag);
+ snprintf(str, sizeof(str), "appl [ %d ]", tag);
else if (tag > 30)
- BIO_snprintf(str, sizeof(str), "<ASN1 %d>", tag);
+ snprintf(str, sizeof(str), "<ASN1 %d>", tag);
else
p = ASN1_tag2str(tag);
diff --git a/crypto/bio/bio_addr.c b/crypto/bio/bio_addr.c
index a53ec7047f..a92ce03269 100644
--- a/crypto/bio/bio_addr.c
+++ b/crypto/bio/bio_addr.c
@@ -265,7 +265,7 @@ static int addr_strings(const BIO_ADDR *ap, int numeric,
* didn't go the way one might expect.
*/
if (serv[0] == '\0') {
- BIO_snprintf(serv, sizeof(serv), "%d",
+ snprintf(serv, sizeof(serv), "%d",
ntohs(BIO_ADDR_rawport(ap)));
}
@@ -279,7 +279,7 @@ static int addr_strings(const BIO_ADDR *ap, int numeric,
*hostname = OPENSSL_strdup(inet_ntoa(ap->s_in.sin_addr));
if (service != NULL) {
char serv[6]; /* port is 16 bits => max 5 decimal digits */
- BIO_snprintf(serv, sizeof(serv), "%d", ntohs(ap->s_in.sin_port));
+ snprintf(serv, sizeof(serv), "%d", ntohs(ap->s_in.sin_port));
*service = OPENSSL_strdup(serv);
}
}
diff --git a/crypto/bio/bio_cb.c b/crypto/bio/bio_cb.c
index db7b6d1b2f..f0e387eb1b 100644
--- a/crypto/bio/bio_cb.c
+++ b/crypto/bio/bio_cb.c
@@ -40,72 +40,72 @@ long BIO_debug_callback_ex(BIO *bio, int cmd, const char *argp, size_t len,
switch (cmd) {
case BIO_CB_FREE:
- BIO_snprintf(p, left, "Free - %s\n", bio->method->name);
+ snprintf(p, left, "Free - %s\n", bio->method->name);
break;
case BIO_CB_READ:
if (bio->method->type & BIO_TYPE_DESCRIPTOR)
- BIO_snprintf(p, left, "read(%d,%zu) - %s fd=%d\n",
+ snprintf(p, left, "read(%d,%zu) - %s fd=%d\n",
bio->num, len,
bio->method->name, bio->num);
else
- BIO_snprintf(p, left, "read(%d,%zu) - %s\n",
+ snprintf(p, left, "read(%d,%zu) - %s\n",
bio->num, len, bio->method->name);
break;
case BIO_CB_WRITE:
if (bio->method->type & BIO_TYPE_DESCRIPTOR)
- BIO_snprintf(p, left, "write(%d,%zu) - %s fd=%d\n",
+ snprintf(p, left, "write(%d,%zu) - %s fd=%d\n",
bio->num, len,
bio->method->name, bio->num);
else
- BIO_snprintf(p, left, "write(%d,%zu) - %s\n",
+ snprintf(p, left, "write(%d,%zu) - %s\n",
bio->num, len, bio->method->name);
break;
case BIO_CB_PUTS:
- BIO_snprintf(p, left, "puts() - %s\n", bio->method->name);
+ snprintf(p, left, "puts() - %s\n", bio->method->name);
break;
case BIO_CB_GETS:
- BIO_snprintf(p, left, "gets(%zu) - %s\n", len,
+ snprintf(p, left, "gets(%zu) - %s\n", len,
bio->method->name);
break;
case BIO_CB_CTRL:
- BIO_snprintf(p, left, "ctrl(%d) - %s\n", argi,
+ snprintf(p, left, "ctrl(%d) - %s\n", argi,
bio->method->name);
break;
case BIO_CB_RECVMMSG:
args = (BIO_MMSG_CB_ARGS *)argp;
- BIO_snprintf(p, left, "recvmmsg(%zu) - %s",
+ snprintf(p, left, "recvmmsg(%zu) - %s",
args->num_msg, bio->method->name);
break;
case BIO_CB_SENDMMSG:
args = (BIO_MMSG_CB_ARGS *)argp;
- BIO_snprintf(p, left, "sendmmsg(%zu) - %s",
+ snprintf(p, left, "sendmmsg(%zu) - %s",
args->num_msg, bio->method->name);
break;
case BIO_CB_RETURN | BIO_CB_READ:
- BIO_snprintf(p, left, "read return %d processed: %zu\n", ret, l);
+ snprintf(p, left, "read return %d processed: %zu\n", ret, l);
break;
case BIO_CB_RETURN | BIO_CB_WRITE:
- BIO_snprintf(p, left, "write return %d processed: %zu\n", ret, l);
+ snprintf(p, left, "write return %d processed: %zu\n", ret, l);
break;
case BIO_CB_RETURN | BIO_CB_GETS:
- BIO_snprintf(p, left, "gets return %d processed: %zu\n", ret, l);
+ snprintf(p, left, "gets return %d processed: %zu\n", ret, l);
break;
case BIO_CB_RETURN | BIO_CB_PUTS:
- BIO_snprintf(p, left, "puts return %d processed: %zu\n", ret, l);
+ snprintf(p, left, "puts return %d processed: %zu\n", ret, l);
break;
case BIO_CB_RETURN | BIO_CB_CTRL:
- BIO_snprintf(p, left, "ctrl return %d\n", ret);
+ snprintf(p, left, "ctrl return %d\n", ret);
break;
case BIO_CB_RETURN | BIO_CB_RECVMMSG:
- BIO_snprintf(p, left, "recvmmsg processed: %zu\n", len);
+ snprintf(p, left, "recvmmsg processed: %zu\n", len);
ret_ = (long)len;
break;
case BIO_CB_RETURN | BIO_CB_SENDMMSG:
- BIO_snprintf(p, left, "sendmmsg processed: %zu\n", len);
+ snprintf(p, left, "sendmmsg processed: %zu\n", len);
ret_ = (long)len;
break;
default:
- BIO_snprintf(p, left, "bio callback - unknown type (%d)\n", cmd);
+ snprintf(p, left, "bio callback - unknown type (%d)\n", cmd);
break;
}
diff --git a/crypto/bio/bio_dump.c b/crypto/bio/bio_dump.c
index d03485c797..1c08c49e6b 100644
--- a/crypto/bio/bio_dump.c
+++ b/crypto/bio/bio_dump.c
@@ -55,7 +55,7 @@ int BIO_dump_indent_cb(int (*cb)(const void *data, size_t len, void *u),
strcpy(buf + n, " ");
} else {
ch = *(s + i * dump_width + j) & 0xff;
- BIO_snprintf(buf + n, 4, "%02x%c", ch,
+ snprintf(buf + n, 4, "%02x%c", ch,
j == 7 ? '-' : ' ');
}
n += 3;
diff --git a/crypto/bio/bss_log.c b/crypto/bio/bss_log.c
index 2928ae5c41..5eb5d9c130 100644
--- a/crypto/bio/bss_log.c
+++ b/crypto/bio/bss_log.c
@@ -240,7 +240,7 @@ static void xsyslog(BIO *bp, int priority, const char *string)
break;
}
- BIO_snprintf(pidbuf, sizeof(pidbuf), "[%lu] ", GetCurrentProcessId());
+ snprintf(pidbuf, sizeof(pidbuf), "[%lu] ", GetCurrentProcessId());
lpszStrings[0] = pidbuf;
lpszStrings[1] = string;
diff --git a/crypto/bn/bn_print.c b/crypto/bn/bn_print.c
index a04e6cf0c2..d45aa9603b 100644
--- a/crypto/bn/bn_print.c
+++ b/crypto/bn/bn_print.c
@@ -61,10 +61,10 @@ char *BN_options(void)
if (!init) {
init++;
#ifdef BN_LLONG
- BIO_snprintf(data, sizeof(data), "bn(%zu,%zu)",
+ snprintf(data, sizeof(data), "bn(%zu,%zu)",
sizeof(BN_ULLONG) * 8, sizeof(BN_ULONG) * 8);
#else
- BIO_snprintf(data, sizeof(data), "bn(%zu,%zu)",
+ snprintf(data, sizeof(data), "bn(%zu,%zu)",
sizeof(BN_ULONG) * 8, sizeof(BN_ULONG) * 8);
#endif
}
diff --git a/crypto/cmp/cmp_http.c b/crypto/cmp/cmp_http.c
index 5f42a85623..0f86133c5d 100644
--- a/crypto/cmp/cmp_http.c
+++ b/crypto/cmp/cmp_http.c
@@ -9,6 +9,8 @@
* https://www.openssl.org/source/license.html
*/
+#include <stdio.h>
+
#include "cmp_local.h"
static int keep_alive(int want_keep_alive, int body_type, BIO **bios)
@@ -54,7 +56,7 @@ OSSL_CMP_MSG *OSSL_CMP_MSG_http_perform(OSSL_CMP_CTX *ctx,
bios = OSSL_CMP_CTX_get_transfer_cb_arg(ctx);
if (ctx->serverPort != 0)
- BIO_snprintf(server_port, sizeof(server_port), "%d", ctx->serverPort);
+ snprintf(server_port, sizeof(server_port), "%d", ctx->serverPort);
tls_used = ctx->tls_used >= 0 ? ctx->tls_used != 0
: OSSL_CMP_CTX_get_http_cb_arg(ctx) != NULL; /* backward compat */
if (ctx->http_ctx == NULL) { /* using existing connection or yet not set up own connection */
diff --git a/crypto/cmp/cmp_util.c b/crypto/cmp/cmp_util.c
index c50d317ddc..d6a24cf73d 100644
--- a/crypto/cmp/cmp_util.c
+++ b/crypto/cmp/cmp_util.c
@@ -9,6 +9,7 @@
* https://www.openssl.org/source/license.html
*/
+#include <stdio.h>
#include <string.h>
#include <openssl/cmp_util.h>
#include "cmp_local.h" /* just for decls of internal functions defined here */
@@ -170,13 +171,13 @@ void OSSL_CMP_print_errors_cb(OSSL_CMP_log_cb_t log_fn)
}
#endif
if (rs == NULL) {
- BIO_snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)", reason);
+ snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)", reason);
rs = rsbuf;
}
if (data != NULL && (flags & ERR_TXT_STRING) != 0)
- BIO_snprintf(msg, sizeof(msg), "%s:%s", rs, data);
+ snprintf(msg, sizeof(msg), "%s:%s", rs, data);
else
- BIO_snprintf(msg, sizeof(msg), "%s", rs);
+ snprintf(msg, sizeof(msg), "%s", rs);
if (log_fn == NULL) {
#ifndef OPENSSL_NO_STDIO
diff --git a/crypto/conf/conf_def.c b/crypto/conf/conf_def.c
index e41fdbe6c7..421eb8d0b8 100644
--- a/crypto/conf/conf_def.c
+++ b/crypto/conf/conf_def.c
@@ -587,7 +587,7 @@ err:
#endif
if (line != NULL)
*line = eline;
- BIO_snprintf(btmp, sizeof(btmp), "%ld", eline);
+ snprintf(btmp, sizeof(btmp), "%ld", eline);
ERR_add_error_data(2, "line ", btmp);
if (h != conf->data) {
CONF_free(conf->data);
diff --git a/crypto/conf/conf_mod.c b/crypto/conf/conf_mod.c
index 9f55954bf9..9070f2967e 100644
--- a/crypto/conf/conf_mod.c
+++ b/crypto/conf/conf_mod.c
@@ -672,7 +672,7 @@ char *CONF_get1_default_config_file(void)
if (file == NULL)
return NULL;
- BIO_snprintf(file, size, "%s%s%s", t, sep, OPENSSL_CONF);
+ snprintf(file, size, "%s%s%s", t, sep, OPENSSL_CONF);
return file;
}
diff --git a/crypto/ct/ct_prn.c b/crypto/ct/ct_prn.c
index 64323a8e50..6388cd32d9 100644
--- a/crypto/ct/ct_prn.c
+++ b/crypto/ct/ct_prn.c
@@ -11,6 +11,8 @@
#error "CT is disabled"
#endif
+#include <stdio.h>
+
#include <openssl/asn1.h>
#include <openssl/bio.h>
@@ -40,7 +42,7 @@ static void timestamp_print(uint64_t timestamp, BIO *out)
* Note GeneralizedTime from ASN1_GENERALIZETIME_adj is always 15
* characters long with a final Z. Update it with fractional seconds.
*/
- BIO_snprintf(genstr, sizeof(genstr), "%.14s.%03dZ",
+ snprintf(genstr, sizeof(genstr), "%.14s.%03dZ",
ASN1_STRING_get0_data(gen), (unsigned int)(timestamp % 1000));
if (ASN1_GENERALIZEDTIME_set_string(gen, genstr))
ASN1_GENERALIZEDTIME_print(out, gen);
diff --git a/crypto/cversion.c b/crypto/cversion.c
index 98f7e2798b..fabf1963e7 100644
--- a/crypto/cversion.c
+++ b/crypto/cversion.c
@@ -59,9 +59,9 @@ static CRYPTO_ONCE version_strings_once = CRYPTO_ONCE_STATIC_INIT;
DEFINE_RUN_ONCE_STATIC(version_strings_setup)
{
- BIO_snprintf(openssldir, sizeof(openssldir), "OPENSSLDIR: \"%s\"",
+ snprintf(openssldir, sizeof(openssldir), "OPENSSLDIR: \"%s\"",
ossl_get_openssldir());
- BIO_snprintf(modulesdir, sizeof(modulesdir), "MODULESDIR: \"%s\"",
+ snprintf(modulesdir, sizeof(modulesdir), "MODULESDIR: \"%s\"",
ossl_get_modulesdir());
return 1;
}
diff --git a/crypto/dso/dso_dl.c b/crypto/dso/dso_dl.c
index ff51764dea..bbf96ac52c 100644
--- a/crypto/dso/dso_dl.c
+++ b/crypto/dso/dso_dl.c
@@ -7,6 +7,8 @@
* https://www.openssl.org/source/license.html
*/
+#include <stdio.h>
+
#include "dso_local.h"
#ifdef DSO_DL
@@ -228,13 +230,13 @@ static char *dl_name_converter(DSO *dso, const char *filename)
return NULL;
}
if (transform)
- BIO_snprintf(translated, rsize,
+ snprintf(translated, rsize,
(DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0
? "lib%s%s"
: "%s%s",
filename, DSO_EXTENSION);
else
- BIO_snprintf(translated, rsize, "%s", filename);
+ snprintf(translated, rsize, "%s", filename);
return translated;
}
diff --git a/crypto/dso/dso_dlfcn.c b/crypto/dso/dso_dlfcn.c
index 2649300974..4b570177e9 100644
--- a/crypto/dso/dso_dlfcn.c
+++ b/crypto/dso/dso_dlfcn.c
@@ -16,6 +16,8 @@
#define _GNU_SOURCE /* make sure dladdr is declared */
#endif
+#include <stdio.h>
+
#include "dso_local.h"
#include "internal/e_os.h"
@@ -262,11 +264,11 @@ static char *dlfcn_name_converter(DSO *dso, const char *filename)
}
if (transform) {
if ((DSO_flags(dso) & DSO_FLAG_NAME_TRANSLATION_EXT_ONLY) == 0)
- BIO_snprintf(translated, rsize, "lib%s" DSO_EXTENSION, filename);
+ snprintf(translated, rsize, "lib%s" DSO_EXTENSION, filename);
else
- BIO_snprintf(translated, rsize, "%s" DSO_EXTENSION, filename);
+ snprintf(translated, rsize, "%s" DSO_EXTENSION, filename);
} else {
- BIO_snprintf(translated, rsize, "%s", filename);
+ snprintf(translated, rsize, "%s", filename);
}
return translated;
}
diff --git a/crypto/dso/dso_win32.c b/crypto/dso/dso_win32.c
index 6ac6727fda..ee0321ba77 100644
--- a/crypto/dso/dso_win32.c
+++ b/crypto/dso/dso_win32.c
@@ -7,6 +7,8 @@
* https://www.openssl.org/source/license.html
*/
+#include <stdio.h>
+
#include "internal/e_os.h"
#include "dso_local.h"
@@ -413,7 +415,7 @@ static char *win32_name_converter(DSO *dso, const char *filename)
ERR_raise(ERR_LIB_DSO, DSO_R_NAME_TRANSLATION_FAILED);
return NULL;
}
- BIO_snprintf(translated, len, "%s%s", filename, transform ? ".dll" : "");
+ snprintf(translated, len, "%s%s", filename, transform ? ".dll" : "");
return translated;
}
diff --git a/crypto/err/err.c b/crypto/err/err.c
index bf637e1d45..5bc39e9dbe 100644
--- a/crypto/err/err.c
+++ b/crypto/err/err.c
@@ -523,7 +523,7 @@ void ossl_err_string_int(unsigned long e, const char *func,
l = ERR_GET_LIB(e);
ls = ERR_lib_error_string(e);
if (ls == NULL) {
- BIO_snprintf(lsbuf, sizeof(lsbuf), "lib(%lu)", l);
+ snprintf(lsbuf, sizeof(lsbuf), "lib(%lu)", l);
ls = lsbuf;
}
@@ -543,15 +543,15 @@ void ossl_err_string_int(unsigned long e, const char *func,
}
#endif
if (rs == NULL) {
- BIO_snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)",
+ snprintf(rsbuf, sizeof(rsbuf), "reason(%lu)",
r & ~(ERR_RFLAGS_MASK << ERR_RFLAGS_OFFSET));
rs = rsbuf;
}
- BIO_snprintf(buf, len, "error:%08lX:%s:%s:%s", e, ls, func, rs);
+ snprintf(buf, len, "error:%08lX:%s:%s:%s", e, ls, func, rs);
if (strlen(buf) == len - 1) {
/* Didn't fit; use a minimal format. */
- BIO_snprintf(buf, len, "err:%lx:%lx:%lx:%lx", e, l, 0L, r);
+ snprintf(buf, len, "err:%lx:%lx:%lx:%lx", e, l, 0L, r);
}
}
diff --git a/crypto/err/err_prn.c b/crypto/err/err_prn.c
index b4970da437..d3f704056e 100644
--- a/crypto/err/err_prn.c
+++ b/crypto/err/err_prn.c
@@ -32,11 +32,11 @@ void ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),
data = "";
hex = ossl_buf2hexstr_sep((const unsigned char *)&tid, sizeof(tid), '\0');
- BIO_snprintf(buf, sizeof(buf), "%s:", hex == NULL ? "<null>" : hex);
+ snprintf(buf, sizeof(buf), "%s:", hex == NULL ? "<null>" : hex);
offset = (int)strlen(buf);
ossl_err_string_int(l, func, buf + offset, sizeof(buf) - offset);
offset += (int)strlen(buf + offset);
- BIO_snprintf(buf + offset, sizeof(buf) - offset, ":%s:%d:%s\n",
+ snprintf(buf + offset, sizeof(buf) - offset, ":%s:%d:%s\n",
file, line, data);
OPENSSL_free(hex);
if (cb(buf, strlen(buf), u) <= 0)
diff --git a/crypto/evp/ctrl_params_translate.c b/crypto/evp/ctrl_params_translate.c
index d0529166d7..f605900cb5 100644
--- a/crypto/evp/ctrl_params_translate.c
+++ b/crypto/evp/ctrl_params_translate.c
@@ -15,6 +15,7 @@
*/
#include "internal/deprecated.h"
+#include <stdio.h>
#include <string.h>
/* The following includes get us all the EVP_PKEY_CTRL macros */
@@ -1426,7 +1427,7 @@ static int fix_rsa_pss_saltlen(enum state state,
break;
}
if (i == OSSL_NELEM(str_value_map)) {
- BIO_snprintf(ctx->name_buf, sizeof(ctx->name_buf), "%d", ctx->p1);
+ snprintf(ctx->name_buf, sizeof(ctx->name_buf), "%d", ctx->p1);
} else {
/* This won't truncate but it will quiet static analysers */
strncpy(ctx->name_buf, str_value_map[i].ptr, sizeof(ctx->name_buf) - 1);
diff --git a/crypto/http/http_client.c b/crypto/http/http_client.c
index 34d3a2cccc..84c511f08c 100644
--- a/crypto/http/http_client.c
+++ b/crypto/http/http_client.c
@@ -1242,7 +1242,7 @@ BIO *OSSL_HTTP_exchange(OSSL_HTTP_REQ_CTX *rctx, char **redirection_url)
#endif
) {
if (rctx->server != NULL && *rctx->server != '\0') {
- BIO_snprintf(buf, sizeof(buf), "server=http%s://%s%s%s",
+ snprintf(buf, sizeof(buf), "server=http%s://%s%s%s",
rctx->use_ssl ? "s" : "", rctx->server,
rctx->port != NULL ? ":" : "",
rctx->port != NULL ? rctx->port : "");
@@ -1251,7 +1251,7 @@ BIO *OSSL_HTTP_exchange(OSSL_HTTP_REQ_CTX *rctx, char **redirection_url)
if (rctx->proxy != NULL)
ERR_add_error_data(2, " proxy=", rctx->proxy);
if (err == 0) {
- BIO_snprintf(buf, sizeof(buf), " peer has disconnected%s",
+ snprintf(buf, sizeof(buf), " peer has disconnected%s",
rctx->use_ssl ? " violating the protocol" : ", likely because it requires the use of TLS");
ERR_add_error_data(1, buf);
}
diff --git a/crypto/http/http_lib.c b/crypto/http/http_lib.c
index 0c394a2d9a..bd462b22e7 100644
--- a/crypto/http/http_lib.c
+++ b/crypto/http/http_lib.c
@@ -11,7 +11,6 @@
#include <string.h>
#include <openssl/http.h>
#include <openssl/httperr.h>
-#include <openssl/bio.h> /* for BIO_snprintf() */
#include <openssl/err.h>
#include "internal/cryptlib.h" /* for ossl_assert() */
#ifndef OPENSSL_NO_SOCK
@@ -181,7 +180,7 @@ int OSSL_parse_url(const char *url, char **pscheme, char **puser, char **phost,
if ((*ppath = OPENSSL_malloc(buflen)) == NULL)
goto err;
- BIO_snprintf(*ppath, buflen, "/%s", path);
+ snprintf(*ppath, buflen, "/%s", path);
}
return 1;
diff --git a/crypto/info.c b/crypto/info.c
index 4baece2246..af27896709 100644
--- a/crypto/info.c
+++ b/crypto/info.c
@@ -241,7 +241,7 @@ DEFINE_RUN_ONCE_STATIC(init_info_strings)
{
char buf[32];
- BIO_snprintf(buf, sizeof(buf), "JITTER (%d)", jent_version());
+ snprintf(buf, sizeof(buf), "JITTER (%d)", jent_version());
add_seeds_string(buf);
}
#endif
diff --git a/crypto/mem.c b/crypto/mem.c
index 408c8edfc0..792f0109a7 100644
--- a/crypto/mem.c
+++ b/crypto/mem.c
@@ -154,7 +154,7 @@ static int shouldfail(void)
char buff[80];
if (md_tracefd > 0) {
- BIO_snprintf(buff, sizeof(buff),
+ snprintf(buff, sizeof(buff),
"%c C%ld %%%d R%d\n",
shoulditfail ? '-' : '+', md_count, md_fail_percent, roll);
len = strlen(buff);
diff --git a/crypto/objects/obj_dat.c b/crypto/objects/obj_dat.c
index 570fde8d15..cbb98f4030 100644
--- a/crypto/objects/obj_dat.c
+++ b/crypto/objects/obj_dat.c
@@ -508,7 +508,7 @@ int OBJ_obj2txt(char *buf, int buf_len, const ASN1_OBJECT *a, int no_name)
n += i;
OPENSSL_free(bndec);
} else {
- BIO_snprintf(tbuf, sizeof(tbuf), ".%lu", l);
+ snprintf(tbuf, sizeof(tbuf), ".%lu", l);
i = (int)strlen(tbuf);
if (buf && buf_len > 0) {
OPENSSL_strlcpy(buf, tbuf, buf_len);
diff --git a/crypto/pem/pem_lib.c b/crypto/pem/pem_lib.c
index 8eff7e950a..b2a84fdab6 100644
--- a/crypto/pem/pem_lib.c
+++ b/crypto/pem/pem_lib.c
@@ -82,7 +82,7 @@ void PEM_proc_type(char *buf, int type)
else
str = "BAD-TYPE";
- BIO_snprintf(p, PEM_BUFSIZE - (size_t)(p - buf), "Proc-Type: 4,%s\n", str);
+ snprintf(p, PEM_BUFSIZE - (size_t)(p - buf), "Proc-Type: 4,%s\n", str);
}
void PEM_dek_info(char *buf, const char *type, int len, const char *str)
diff --git a/crypto/pem/pem_pkey.c b/crypto/pem/pem_pkey.c
index d6eb42c602..55744f3d65 100644
--- a/crypto/pem/pem_pkey.c
+++ b/crypto/pem/pem_pkey.c
@@ -360,7 +360,7 @@ int PEM_write_bio_PrivateKey_traditional(BIO *bp, const EVP_PKEY *x,
EVP_PKEY_free(copy);
return 0;
}
- BIO_snprintf(pem_str, 80, "%s PRIVATE KEY", x->ameth->pem_str);
+ snprintf(pem_str, 80, "%s PRIVATE KEY", x->ameth->pem_str);
ret = PEM_ASN1_write_bio((i2d_of_void *)i2d_PrivateKey,
pem_str, bp, x, enc, kstr, klen, cb, u);
@@ -400,7 +400,7 @@ legacy:
if (!x->ameth || !x->ameth->param_encode)
return 0;
- BIO_snprintf(pem_str, 80, "%s PARAMETERS", x->ameth->pem_str);
+ snprintf(pem_str, 80, "%s PARAMETERS", x->ameth->pem_str);
return PEM_ASN1_write_bio((i2d_of_void *)x->ameth->param_encode,
pem_str, out, x, NULL, NULL, 0, 0, NULL);
}
diff --git a/crypto/property/property_parse.c b/crypto/property/property_parse.c
index 869d19da85..3a55a992b3 100644
--- a/crypto/property/property_parse.c
+++ b/crypto/property/property_parse.c
@@ -685,7 +685,7 @@ static void put_num(int64_t val, char **buf, size_t *remain, size_t *needed)
if (*remain == 0)
return;
- BIO_snprintf(*buf, *remain, "%lld", (long long int)val);
+ snprintf(*buf, *remain, "%lld", (long long int)val);
if (*remain < len) {
*buf += *remain;
*remain = 0;
diff --git a/crypto/ts/ts_rsp_sign.c b/crypto/ts/ts_rsp_sign.c
index 76afe331f6..ed58845254 100644
--- a/crypto/ts/ts_rsp_sign.c
+++ b/crypto/ts/ts_rsp_sign.c
@@ -7,6 +7,8 @@
* https://www.openssl.org/source/license.html
*/
+#include <stdio.h>
+
#include "internal/e_os.h"
#include <openssl/objects.h>
@@ -863,7 +865,7 @@ static ASN1_GENERALIZEDTIME *TS_RESP_set_genTime_with_precision(
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
if (precision > 0) {
- BIO_snprintf(p, 2 + precision, ".%06ld", usec);
+ snprintf(p, 2 + precision, ".%06ld", usec);
p += strlen(p);
/*
diff --git a/crypto/x509/by_dir.c b/crypto/x509/by_dir.c
index e93ab4d47f..4dd9fe9e83 100644
--- a/crypto/x509/by_dir.c
+++ b/crypto/x509/by_dir.c
@@ -310,12 +310,12 @@ static int get_cert_by_subject_ex(X509_LOOKUP *xl, X509_LOOKUP_TYPE type,
* This is special. When c == '\0', no directory separator
* should be added.
*/
- BIO_snprintf(b->data, b->max,
+ snprintf(b->data, b->max,
"%s%08lx.%s%d", ent->dir, h, postfix, k);
} else
#endif
{
- BIO_snprintf(b->data, b->max,
+ snprintf(b->data, b->max,
"%s%c%08lx.%s%d", ent->dir, c, h, postfix, k);
}
#ifndef OPENSSL_NO_POSIX_IO
diff --git a/crypto/x509/v3_info.c b/crypto/x509/v3_info.c
index e49e251667..9b42d24b20 100644
--- a/crypto/x509/v3_info.c
+++ b/crypto/x509/v3_info.c
@@ -84,7 +84,7 @@ static STACK_OF(CONF_VALUE) *i2v_AUTHORITY_INFO_ACCESS(
ntmp = OPENSSL_malloc(nlen);
if (ntmp == NULL)
goto err;
- BIO_snprintf(ntmp, nlen, "%s - %s", objtmp, vtmp->name);
+ snprintf(ntmp, nlen, "%s - %s", objtmp, vtmp->name);
OPENSSL_free(vtmp->name);
vtmp->name = ntmp;
}
diff --git a/crypto/x509/v3_san.c b/crypto/x509/v3_san.c
index 611f5ff181..025cd25ca9 100644
--- a/crypto/x509/v3_san.c
+++ b/crypto/x509/v3_san.c
@@ -128,7 +128,7 @@ STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method,
break;
default:
if (OBJ_obj2txt(oline, sizeof(oline), gen->d.otherName->type_id, 0) > 0)
- BIO_snprintf(othername, sizeof(othername), "othername: %s",
+ snprintf(othername, sizeof(othername), "othername: %s",
oline);
else
OPENSSL_strlcpy(othername, "othername", sizeof(othername));
diff --git a/crypto/x509/v3_utl.c b/crypto/x509/v3_utl.c
index 70f4bd8e34..0e78b7b516 100644
--- a/crypto/x509/v3_utl.c
+++ b/crypto/x509/v3_utl.c
@@ -1104,7 +1104,7 @@ char *ossl_ipaddr_to_asc(const unsigned char *p, int len)
switch (len) {
case 4: /* IPv4 */
- BIO_snprintf(buf, sizeof(buf), "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
+ snprintf(buf, sizeof(buf), "%d.%d.%d.%d", p[0], p[1], p[2], p[3]);
break;
case 16: /* IPv6 */
for (out = buf, i = 8, remain = sizeof(buf);
@@ -1117,7 +1117,7 @@ char *ossl_ipaddr_to_asc(const unsigned char *p, int len)
}
break;
default:
- BIO_snprintf(buf, sizeof(buf), "<invalid length=%d>", len);
+ snprintf(buf, sizeof(buf), "<invalid length=%d>", len);
break;
}
return OPENSSL_strdup(buf);
diff --git a/providers/implementations/storemgmt/file_store.c b/providers/implementations/storemgmt/file_store.c
index 894685ce8c..54be17598b 100644
--- a/providers/implementations/storemgmt/file_store.c
+++ b/providers/implementations/storemgmt/file_store.c
@@ -9,6 +9,7 @@
/* This file has quite some overlap with engines/e_loader_attic.c */
+#include <stdio.h>
#include <string.h>
#include "internal/e_os.h" /* for stat() */
#include <sys/stat.h> /* for struct stat */
@@ -368,7 +369,7 @@ static int file_set_ctx_params(void *loaderctx, const OSSL_PARAM params[])
hash = X509_NAME_hash_ex(x509_name,
ossl_prov_ctx_get0_libctx(ctx->provctx), NULL,
&ok);
- BIO_snprintf(ctx->_.dir.search_name, sizeof(ctx->_.dir.search_name),
+ snprintf(ctx->_.dir.search_name, sizeof(ctx->_.dir.search_name),
"%08lx", hash);
end:
X509_NAME_free(x509_name);
diff --git a/ssl/quic/qlog.c b/ssl/quic/qlog.c
index a09c76ca2a..9b3cdd2f56 100644
--- a/ssl/quic/qlog.c
+++ b/ssl/quic/qlog.c
@@ -340,7 +340,7 @@ static void qlog_event_seq_header(QLOG *qlog)
if (qlog->info.override_impl_name != NULL) {
p = qlog->info.override_impl_name;
} else {
- BIO_snprintf(buf, sizeof(buf), "OpenSSL/%s (%s)",
+ snprintf(buf, sizeof(buf), "OpenSSL/%s (%s)",
OpenSSL_version(OPENSSL_FULL_VERSION_STRING),
OpenSSL_version(OPENSSL_PLATFORM) + 10);
}
diff --git a/ssl/quic/qlog_event_helpers.c b/ssl/quic/qlog_event_helpers.c
index 83eebe82ad..5e5cba65ea 100644
--- a/ssl/quic/qlog_event_helpers.c
+++ b/ssl/quic/qlog_event_helpers.c
@@ -7,6 +7,8 @@
* https://www.openssl.org/source/license.html
*/
+#include <stdio.h>
+
#include "internal/qlog_event_helpers.h"
#include "internal/common.h"
#include "internal/packet.h"
@@ -130,7 +132,7 @@ void ossl_qlog_event_connectivity_connection_closed(QLOG *qlog,
if (tcause->error_code >= OSSL_QUIC_ERR_CRYPTO_ERR_BEGIN
&& tcause->error_code <= OSSL_QUIC_ERR_CRYPTO_ERR_END) {
- BIO_snprintf(ce, sizeof(ce), "crypto_error_0x%03llx",
+ snprintf(ce, sizeof(ce), "crypto_error_0x%03llx",
(unsigned long long)tcause->error_code);
m = ce;
}
diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c
index 160f5e4291..ce14497483 100644
--- a/ssl/ssl_ciph.c
+++ b/ssl/ssl_ciph.c
@@ -1894,7 +1894,7 @@ char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int len)
break;
}
- BIO_snprintf(buf, len, format, cipher->name, ver, kx, au, enc, mac);
+ snprintf(buf, len, format, cipher->name, ver, kx, au, enc, mac);
return buf;
}
diff --git a/test/cmactest.c b/test/cmactest.c
index 36e2a3c61d..9fd2e6e479 100644
--- a/test/cmactest.c
+++ b/test/cmactest.c
@@ -307,7 +307,7 @@ static char *pt(unsigned char *md, size_t len)
static char buf[81];
for (i = 0; i < len && (i + 1) * OSSL_HEX_CHARS_PER_BYTE < sizeof(buf); i++)
- BIO_snprintf(buf + i * OSSL_HEX_CHARS_PER_BYTE,
+ snprintf(buf + i * OSSL_HEX_CHARS_PER_BYTE,
OSSL_HEX_CHARS_PER_BYTE + 1, "%02x", md[i]);
return buf;
}
diff --git a/test/drbgtest.c b/test/drbgtest.c
index 0828ebf7b5..0dced82667 100644
--- a/test/drbgtest.c
+++ b/test/drbgtest.c
@@ -415,7 +415,7 @@ static int test_rand_reseed_on_fork(EVP_RAND_CTX *primary,
presult[0].pindex = presult[1].pindex = i;
- BIO_snprintf(presult[0].name, sizeof(presult[0].name), "child %d", i);
+ snprintf(presult[0].name, sizeof(presult[0].name), "child %d", i);
strcpy(presult[1].name, presult[0].name);
/* collect the random output of the children */
diff --git a/test/dtls_mtu_test.c b/test/dtls_mtu_test.c
index a70a6e840a..58735e27a3 100644
--- a/test/dtls_mtu_test.c
+++ b/test/dtls_mtu_test.c
@@ -30,7 +30,7 @@ static unsigned int clnt_psk_callback(SSL *ssl, const char *hint,
unsigned char *psk,
unsigned int max_psk_len)
{
- BIO_snprintf(ident, max_ident_len, "psk");
+ snprintf(ident, max_ident_len, "psk");
if (max_psk_len > 20)
max_psk_len = 20;
diff --git a/test/ech_test.c b/test/ech_test.c
index b383b4255a..69f46aad77 100644
--- a/test/ech_test.c
+++ b/test/ech_test.c
@@ -1060,7 +1060,7 @@ static int ech_test_file_read(int run)
fullname = OPENSSL_malloc(fnlen);
if (fullname == NULL)
goto end;
- BIO_snprintf(fullname, fnlen, "%s/%s", certsdir, ft->fname);
+ snprintf(fullname, fnlen, "%s/%s", certsdir, ft->fname);
if (verbose)
TEST_info("testing read of %s", fullname);
in = BIO_new_file(fullname, "r");
@@ -1320,7 +1320,7 @@ static int test_ech_roundtrip_helper(int idx, int combo)
aeadind = idx % aeadsz;
/* initialise early data stuff, just in case */
memset(ed, 'A', sizeof(ed));
- BIO_snprintf(suitestr, 100, "%s,%s,%s", kem_str_list[kemind],
+ snprintf(suitestr, 100, "%s,%s,%s", kem_str_list[kemind],
kdf_str_list[kdfind], aead_str_list[aeadind]);
if (verbose)
TEST_info("Doing: iter: %d, suite: %s", idx, suitestr);
diff --git a/test/errtest.c b/test/errtest.c
index 7183548080..d686f257a7 100644
--- a/test/errtest.c
+++ b/test/errtest.c
@@ -83,11 +83,11 @@ static int test_print_error_format(void)
reason = strerror(syserr);
#else
lib = "lib(2)";
- BIO_snprintf(reasonbuf, sizeof(reasonbuf), "reason(%lu)", reasoncode);
+ snprintf(reasonbuf, sizeof(reasonbuf), "reason(%lu)", reasoncode);
reason = reasonbuf;
#endif
- BIO_snprintf(expected, sizeof(expected), expected_format,
+ snprintf(expected, sizeof(expected), expected_format,
errorcode, lib, func, reason, file, line);
if (!TEST_ptr(bio = BIO_new(BIO_s_mem())))
diff --git a/test/evp_pkey_provided_test.c b/test/evp_pkey_provided_test.c
index 0464d12b7b..316b60e09a 100644
--- a/test/evp_pkey_provided_test.c
+++ b/test/evp_pkey_provided_test.c
@@ -93,7 +93,7 @@ static int compare_with_file(const char *alg, int type, BIO *membio)
goto err;
}
- BIO_snprintf(filename, sizeof(filename), "%s.%s", alg, suffix);
+ snprintf(filename, sizeof(filename), "%s.%s", alg, suffix);
fullfile = test_mk_file_path(datadir, filename);
if (!TEST_ptr(fullfile))
goto err;
diff --git a/test/evp_test.c b/test/evp_test.c
index ef6dea9664..ecad8583be 100644
--- a/test/evp_test.c
+++ b/test/evp_test.c
@@ -1648,12 +1648,12 @@ static int cipher_test_run(EVP_TEST *t)
if (inp_misalign == 1 && in_place == 1)
break;
if (in_place == 1) {
- BIO_snprintf(aux_err, sizeof(aux_err),
+ snprintf(aux_err, sizeof(aux_err),
"%s in-place, %sfragmented",
out_misalign ? "misaligned" : "aligned",
frag ? "" : "not ");
} else {
- BIO_snprintf(aux_err, sizeof(aux_err),
+ snprintf(aux_err, sizeof(aux_err),
"%s output and %s input, %sfragmented",
out_misalign ? "misaligned" : "aligned",
inp_misalign ? "misaligned" : "aligned",
diff --git a/test/hmactest.c b/test/hmactest.c
index 4d75a8d5f4..8f3574025f 100644
--- a/test/hmactest.c
+++ b/test/hmactest.c
@@ -308,7 +308,7 @@ static char *pt(unsigned char *md, unsigned int len)
if (md == NULL)
return NULL;
for (i = 0; i < len && (i + 1) * OSSL_HEX_CHARS_PER_BYTE < sizeof(buf); i++)
- BIO_snprintf(buf + i * OSSL_HEX_CHARS_PER_BYTE,
+ snprintf(buf + i * OSSL_HEX_CHARS_PER_BYTE,
OSSL_HEX_CHARS_PER_BYTE + 1, "%02x", md[i]);
return buf;
}
diff --git a/test/hpke_test.c b/test/hpke_test.c
index cd43c0e9a1..9fbc130aef 100644
--- a/test/hpke_test.c
+++ b/test/hpke_test.c
@@ -1192,7 +1192,7 @@ static int test_hpke_suite_strs(void)
for (kemind = 0; kemind != OSSL_NELEM(kem_str_list); kemind++) {
for (kdfind = 0; kdfind != OSSL_NELEM(kdf_str_list); kdfind++) {
for (aeadind = 0; aeadind != OSSL_NELEM(aead_str_list); aeadind++) {
- BIO_snprintf(sstr, 128, "%s,%s,%s", kem_str_list[kemind],
+ snprintf(sstr, 128, "%s,%s,%s", kem_str_list[kemind],
kdf_str_list[kdfind], aead_str_list[aeadind]);
if (!TEST_true(OSSL_HPKE_str2suite(sstr, &stirred))) {
if (verbose)
diff --git a/test/http_test.c b/test/http_test.c
index d122a45426..74455c3fda 100644
--- a/test/http_test.c
+++ b/test/http_test.c
@@ -165,7 +165,7 @@ static int test_http_method(int do_get, int do_txt, int suggested_status)
int res = 0;
int real_server = do_txt && 0; /* remove "&& 0" for using real server */
- BIO_snprintf(path, sizeof(path), "/%d%s", suggested_status,
+ snprintf(path, sizeof(path), "/%d%s", suggested_status,
do_get > 1 ? "/will-be-redirected" : RPATH);
if (do_txt) {
content_type = "text/plain";
diff --git a/test/pkcs12_format_test.c b/test/pkcs12_format_test.c
index 4ae4cbfec5..af2af40605 100644
--- a/test/pkcs12_format_test.c
+++ b/test/pkcs12_format_test.c
@@ -443,7 +443,7 @@ static int test_single_key(PKCS12_ENC *enc)
char fname[80];
PKCS12_BUILDER *pb;
- BIO_snprintf(fname, sizeof(fname), "1key_ciph-%s_iter-%d.p12",
+ snprintf(fname, sizeof(fname), "1key_ciph-%s_iter-%d.p12",
OBJ_nid2sn(enc->nid), enc->iter);
pb = new_pkcs12_builder(fname);
@@ -543,7 +543,7 @@ static int test_single_cert_mac(PKCS12_ENC *mac)
char fname[80];
PKCS12_BUILDER *pb;
- BIO_snprintf(fname, sizeof(fname), "1cert_mac-%s_iter-%d.p12",
+ snprintf(fname, sizeof(fname), "1cert_mac-%s_iter-%d.p12",
OBJ_nid2sn(mac->nid), mac->iter);
pb = new_pkcs12_builder(fname);
@@ -704,7 +704,7 @@ static int test_single_secret(PKCS12_ENC *enc)
char fname[80];
PKCS12_BUILDER *pb;
- BIO_snprintf(fname, sizeof(fname), "1secret_ciph-%s_iter-%d.p12",
+ snprintf(fname, sizeof(fname), "1secret_ciph-%s_iter-%d.p12",
OBJ_nid2sn(enc->nid), enc->iter);
pb = new_pkcs12_builder(fname);
custom_nid = get_custom_oid();
diff --git a/test/property_test.c b/test/property_test.c
index b2ccbce326..58bc92f6c0 100644
--- a/test/property_test.c
+++ b/test/property_test.c
@@ -622,7 +622,7 @@ static int test_query_cache_stochastic(void)
for (i = 1; i <= max; i++) {
v[i] = 2 * i;
- BIO_snprintf(buf, sizeof(buf), "n=%d\n", i);
+ snprintf(buf, sizeof(buf), "n=%d\n", i);
if (!TEST_true(ossl_method_store_add(store, &prov, i, buf, "abc",
&up_ref, &down_ref))
|| !TEST_true(ossl_method_store_cache_set(store, &prov, i,
@@ -636,7 +636,7 @@ static int test_query_cache_stochastic(void)
}
}
for (i = 1; i <= max; i++) {
- BIO_snprintf(buf, sizeof(buf), "n=%d\n", i);
+ snprintf(buf, sizeof(buf), "n=%d\n", i);
if (!ossl_method_store_cache_get(store, NULL, i, buf, &result)
|| result != v + i)
errors++;
diff --git a/test/provider_internal_test.c b/test/provider_internal_test.c
index 65411d322e..b3b8dda394 100644
--- a/test/provider_internal_test.c
+++ b/test/provider_internal_test.c
@@ -41,7 +41,7 @@ static const char *expected_greeting1(const char *name)
{
static char expected_greeting[256] = "";
- BIO_snprintf(expected_greeting, sizeof(expected_greeting),
+ snprintf(expected_greeting, sizeof(expected_greeting),
"Hello OpenSSL %.20s, greetings from %s!",
OPENSSL_VERSION_STR, name);
diff --git a/test/provider_test.c b/test/provider_test.c
index 475f9ba08c..32dfd96c0e 100644
--- a/test/provider_test.c
+++ b/test/provider_test.c
@@ -45,7 +45,7 @@ static int test_provider(OSSL_LIB_CTX **libctx, const char *name,
int dolegacycheck = (legacy != NULL);
OSSL_PROVIDER *deflt = NULL, *base = NULL;
- BIO_snprintf(expected_greeting, sizeof(expected_greeting),
+ snprintf(expected_greeting, sizeof(expected_greeting),
"Hello OpenSSL %.20s, greetings from %s!",
OPENSSL_VERSION_STR, name);
diff --git a/test/quic-openssl-docker/hq-interop/quic-hq-interop.c b/test/quic-openssl-docker/hq-interop/quic-hq-interop.c
index 7f7347a0df..27ad63efa0 100644
--- a/test/quic-openssl-docker/hq-interop/quic-hq-interop.c
+++ b/test/quic-openssl-docker/hq-interop/quic-hq-interop.c
@@ -589,11 +589,11 @@ static size_t build_request_set(SSL *ssl)
outnames[poll_idx] = req;
/* Format the http request */
- BIO_snprintf(req_string, REQ_STRING_SZ, "GET /%s\r\n", req);
+ snprintf(req_string, REQ_STRING_SZ, "GET /%s\r\n", req);
/* build the outfile request path */
memset(outfilename, 0, REQ_STRING_SZ);
- BIO_snprintf(outfilename, REQ_STRING_SZ, "/downloads/%s", req);
+ snprintf(outfilename, REQ_STRING_SZ, "/downloads/%s", req);
/* open a bio to write the file */
outbiolist[poll_idx] = BIO_new_file(outfilename, "w+");
diff --git a/test/quic_multistream_test.c b/test/quic_multistream_test.c
index d4be41fd31..2fabc294f8 100644
--- a/test/quic_multistream_test.c
+++ b/test/quic_multistream_test.c
@@ -702,7 +702,7 @@ static int helper_init(struct helper *h, const char *script_name,
goto err;
/* Set title for qlog purposes. */
- BIO_snprintf(title, sizeof(title), "quic_multistream_test: %s", script_name);
+ snprintf(title, sizeof(title), "quic_multistream_test: %s", script_name);
if (!TEST_true(ossl_quic_set_diag_title(h->c_ctx, title)))
goto err;
@@ -5239,7 +5239,7 @@ static int test_script(int idx)
}
#endif
- BIO_snprintf(script_name, sizeof(script_name), "script %d", script_idx + 1);
+ snprintf(script_name, sizeof(script_name), "script %d", script_idx + 1);
TEST_info("Running script %d (order=%d, blocking=%d)", script_idx + 1,
free_order, blocking);
@@ -5325,7 +5325,7 @@ static ossl_unused int test_dyn_frame_types(int idx)
s[i].arg2 = forbidden_frame_types[idx].expected_err;
}
- BIO_snprintf(script_name, sizeof(script_name),
+ snprintf(script_name, sizeof(script_name),
"dyn script %d", idx);
return run_script(dyn_frame_types_script, script_name, 0, 0);
diff --git a/test/radix/quic_bindings.c b/test/radix/quic_bindings.c
index 7b95d43f2d..8a6d2904b4 100644
--- a/test/radix/quic_bindings.c
+++ b/test/radix/quic_bindings.c
@@ -388,7 +388,7 @@ static void RADIX_PROCESS_report_thread_results(RADIX_PROCESS *rp, BIO *bio)
"Result for child thread with index %zu:\n",
rp->node_idx, rp->process_idx, rt->thread_idx, rt->thread_idx);
- BIO_snprintf(pfx_buf, sizeof(pfx_buf), "# -T-%2zu:\t# ", rt->thread_idx);
+ snprintf(pfx_buf, sizeof(pfx_buf), "# -T-%2zu:\t# ", rt->thread_idx);
BIO_set_prefix(bio_err, pfx_buf);
l = BIO_get_mem_data(rt->debug_bio, &p);
diff --git a/test/ssl_old_test.c b/test/ssl_old_test.c
index 58870193b0..ce90169979 100644
--- a/test/ssl_old_test.c
+++ b/test/ssl_old_test.c
@@ -1945,7 +1945,7 @@ int doit_localhost(SSL *s_ssl, SSL *c_ssl, int family, long count,
if (BIO_do_accept(acpt) <= 0)
goto err;
- BIO_snprintf(addr_str, sizeof(addr_str), ":%s", BIO_get_accept_port(acpt));
+ snprintf(addr_str, sizeof(addr_str), ":%s", BIO_get_accept_port(acpt));
client = BIO_new_connect(addr_str);
if (!client)
diff --git a/test/ssl_test.c b/test/ssl_test.c
index 6bec28f6e5..8e01bd7bee 100644
--- a/test/ssl_test.c
+++ b/test/ssl_test.c
@@ -400,7 +400,7 @@ static int test_handshake(int idx)
HANDSHAKE_RESULT *result = NULL;
char test_app[MAX_TESTCASE_NAME_LENGTH];
- BIO_snprintf(test_app, sizeof(test_app), "test-%d", idx);
+ snprintf(test_app, sizeof(test_app), "test-%d", idx);
test_ctx = SSL_TEST_CTX_create(conf, test_app, libctx);
if (!TEST_ptr(test_ctx))
diff --git a/test/sslapitest.c b/test/sslapitest.c
index 7b585abd58..ac84276224 100644
--- a/test/sslapitest.c
+++ b/test/sslapitest.c
@@ -224,7 +224,7 @@ static int compare_hex_encoded_buffer(const char *hex_encoded,
return 1;
for (i = j = 0; i < raw_length && j + 1 < hex_length; i++, j += 2) {
- BIO_snprintf(hexed, sizeof(hexed), "%02x", raw[i]);
+ snprintf(hexed, sizeof(hexed), "%02x", raw[i]);
if (!TEST_int_eq(hexed[0], hex_encoded[j])
|| !TEST_int_eq(hexed[1], hex_encoded[j + 1]))
return 1;
diff --git a/test/testutil/testutil_init.c b/test/testutil/testutil_init.c
index e4ca6e3a42..3145945c79 100644
--- a/test/testutil/testutil_init.c
+++ b/test/testutil/testutil_init.c
@@ -33,7 +33,7 @@ static size_t internal_trace_cb(const char *buf, size_t cnt,
tid = CRYPTO_THREAD_get_current_id();
hex = OPENSSL_buf2hexstr((const unsigned char *)&tid, sizeof(tid));
- BIO_snprintf(buffer, sizeof(buffer), "TRACE[%s]:%s: ",
+ snprintf(buffer, sizeof(buffer), "TRACE[%s]:%s: ",
hex, OSSL_trace_get_category_name(category));
OPENSSL_free(hex);
BIO_set_prefix(trace_data->bio, buffer);
diff --git a/test/threadstest.c b/test/threadstest.c
index 50a5d90340..969ef1680d 100644
--- a/test/threadstest.c
+++ b/test/threadstest.c
@@ -1190,10 +1190,10 @@ static void test_obj_create_one(void)
char tids[12], oid[40], sn[30], ln[30];
int id = get_new_uid();
- BIO_snprintf(tids, sizeof(tids), "%d", id);
- BIO_snprintf(oid, sizeof(oid), "1.3.6.1.4.1.16604.%s", tids);
- BIO_snprintf(sn, sizeof(sn), "short-name-%s", tids);
- BIO_snprintf(ln, sizeof(ln), "long-name-%s", tids);
+ snprintf(tids, sizeof(tids), "%d", id);
+ snprintf(oid, sizeof(oid), "1.3.6.1.4.1.16604.%s", tids);
+ snprintf(sn, sizeof(sn), "short-name-%s", tids);
+ snprintf(ln, sizeof(ln), "long-name-%s", tids);
if (!TEST_int_ne(id, 0)
|| !TEST_true(id = OBJ_create(oid, sn, ln))
|| !TEST_true(OBJ_add_sigid(id, NID_sha3_256, NID_rsa)))
@@ -1379,7 +1379,7 @@ static void test_obj_create_worker(void)
for (i = 0; i < 4; i++) {
now = time(NULL);
- BIO_snprintf(name, sizeof(name), "Time in Seconds = %ld", (long)now);
+ snprintf(name, sizeof(name), "Time in Seconds = %ld", (long)now);
while (now == time(NULL))
/* no-op */;
nid = OBJ_create(NULL, NULL, name);
diff --git a/test/tls-provider.c b/test/tls-provider.c
index 2f708197be..537ee8efb5 100644
--- a/test/tls-provider.c
+++ b/test/tls-provider.c
@@ -428,7 +428,7 @@ static int tls_prov_get_capabilities(void *provctx, const char *capability,
dummy_group_names[i] = OPENSSL_zalloc(dummy_name_max_size);
if (dummy_group_names[i] == NULL)
return 0;
- BIO_snprintf(dummy_group_names[i],
+ snprintf(dummy_group_names[i],
dummy_name_max_size,
"%s%d", dummy_base, i);
}
diff --git a/test/v3nametest.c b/test/v3nametest.c
index bfdee4d309..c5d4eb80e7 100644
--- a/test/v3nametest.c
+++ b/test/v3nametest.c
@@ -246,7 +246,7 @@ static int check_message(const struct set_name_fn *fn, const char *op,
if (match < 0)
return 1;
- BIO_snprintf(msg, sizeof(msg), "%s: %s: [%s] %s [%s]",
+ snprintf(msg, sizeof(msg), "%s: %s: [%s] %s [%s]",
fn->name, op, nameincert,
match ? "matches" : "does not match", name);
if (is_exception(msg))
diff --git a/test/x509_time_test.c b/test/x509_time_test.c
index 59dad294ef..2347fc69b4 100644
--- a/test/x509_time_test.c
+++ b/test/x509_time_test.c
@@ -628,7 +628,7 @@ static int test_days(int n)
struct tm t;
int r;
- BIO_snprintf(d, sizeof(d), "%04d%02d%02d050505Z",
+ snprintf(d, sizeof(d), "%04d%02d%02d050505Z",
day_of_week_tests[n].y, day_of_week_tests[n].m,
day_of_week_tests[n].d);