Commit 7b6c638dd5 for openssl.org
commit 7b6c638dd516a595196a3f715422427755e7c47a
Author: Philip Prindeville <philipp@redfish-solutions.com>
Date: Mon Jan 19 14:12:20 2026 -0700
Cleanup of printing in apps
Don't use BIO_printf() where BIO_puts() will do.
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
MergeDate: Fri Feb 13 15:05:38 2026
(Merged from https://github.com/openssl/openssl/pull/29677)
diff --git a/apps/asn1parse.c b/apps/asn1parse.c
index fbd9d7c334..0361c28579 100644
--- a/apps/asn1parse.c
+++ b/apps/asn1parse.c
@@ -192,7 +192,7 @@ int asn1parse_main(int argc, char **argv)
goto end;
if (genconf == NULL && genstr == NULL && informat == FORMAT_PEM) {
if (PEM_read_bio(in, &name, &header, &str, &num) != 1) {
- BIO_printf(bio_err, "Error reading PEM file\n");
+ BIO_puts(bio_err, "Error reading PEM file\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -258,7 +258,7 @@ int asn1parse_main(int argc, char **argv)
at = d2i_ASN1_TYPE(NULL, &ctmpbuf, tmplen);
ASN1_TYPE_free(atmp);
if (!at) {
- BIO_printf(bio_err, "Error parsing structure\n");
+ BIO_puts(bio_err, "Error parsing structure\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -279,7 +279,7 @@ int asn1parse_main(int argc, char **argv)
}
if (offset < 0 || offset >= num) {
- BIO_printf(bio_err, "Error: offset out of range\n");
+ BIO_puts(bio_err, "Error: offset out of range\n");
goto end;
}
@@ -289,7 +289,7 @@ int asn1parse_main(int argc, char **argv)
length = (unsigned int)num;
if (derout != NULL) {
if (BIO_write(derout, str + offset, length) != (int)length) {
- BIO_printf(bio_err, "Error writing output\n");
+ BIO_puts(bio_err, "Error writing output\n");
ERR_print_errors(bio_err);
goto end;
}
diff --git a/apps/ca.c b/apps/ca.c
index 07d8ef23b9..06dc483c7b 100644
--- a/apps/ca.c
+++ b/apps/ca.c
@@ -623,7 +623,7 @@ end_of_options:
if (passin == NULL) {
free_passin = 1;
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
goto end;
}
}
@@ -645,7 +645,7 @@ end_of_options:
goto end;
if (!X509_check_private_key(x509, pkey)) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"CA certificate and CA private key do not match\n");
goto end;
}
@@ -692,7 +692,7 @@ end_of_options:
outdir = NCONF_get_string(conf, section, ENV_NEW_CERTS_DIR);
if (outdir == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"there needs to be defined a directory for new certificate to be placed in\n");
goto end;
}
@@ -765,7 +765,7 @@ end_of_options:
TXT_DB_write(bio_out, db->db);
BIO_printf(bio_err, "%d entries loaded from the database\n",
sk_OPENSSL_PSTRING_num(db->db->data));
- BIO_printf(bio_err, "generating index\n");
+ BIO_puts(bio_err, "generating index\n");
}
if (index_index(db) <= 0)
@@ -779,11 +779,11 @@ end_of_options:
i = do_updatedb(db, NULL);
if (i == -1) {
- BIO_printf(bio_err, "Malloc failure\n");
+ BIO_puts(bio_err, "Malloc failure\n");
goto end;
} else if (i == 0) {
if (verbose)
- BIO_printf(bio_err, "No entries found to mark expired\n");
+ BIO_puts(bio_err, "No entries found to mark expired\n");
} else {
if (!save_index(dbfile, "new", db))
goto end;
@@ -920,27 +920,27 @@ end_of_options:
days = 0;
}
if (enddate == NULL && days == 0) {
- BIO_printf(bio_err, "cannot lookup how many days to certify for\n");
+ BIO_puts(bio_err, "cannot lookup how many days to certify for\n");
goto end;
}
if (days != 0 && enddate != NULL)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: -enddate or -not_after option overriding -days option\n");
if (rand_ser) {
if ((serial = BN_new()) == NULL || !rand_serial(serial, NULL)) {
- BIO_printf(bio_err, "error generating serial number\n");
+ BIO_puts(bio_err, "error generating serial number\n");
goto end;
}
} else {
serial = load_serial(serialfile, NULL, create_ser, NULL);
if (serial == NULL) {
- BIO_printf(bio_err, "error while loading serial number\n");
+ BIO_puts(bio_err, "error while loading serial number\n");
goto end;
}
if (verbose) {
if (BN_is_zero(serial)) {
- BIO_printf(bio_err, "next serial number is 00\n");
+ BIO_puts(bio_err, "next serial number is 00\n");
} else {
if ((f = BN_bn2hex(serial)) == NULL)
goto end;
@@ -956,7 +956,7 @@ end_of_options:
}
if ((cert_sk = sk_X509_new_null()) == NULL) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
if (spkac_file != NULL) {
@@ -970,11 +970,11 @@ end_of_options:
goto end;
if (j > 0) {
total_done++;
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
if (!BN_add_word(serial, 1))
goto end;
if (!sk_X509_push(cert_sk, x)) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
}
@@ -991,11 +991,11 @@ end_of_options:
goto end;
if (j > 0) {
total_done++;
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
if (!BN_add_word(serial, 1))
goto end;
if (!sk_X509_push(cert_sk, x)) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
}
@@ -1011,11 +1011,11 @@ end_of_options:
goto end;
if (j > 0) {
total_done++;
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
if (!BN_add_word(serial, 1))
goto end;
if (!sk_X509_push(cert_sk, x)) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
}
@@ -1032,13 +1032,13 @@ end_of_options:
goto end;
if (j > 0) {
total_done++;
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
if (!BN_add_word(serial, 1)) {
X509_free(x);
goto end;
}
if (!sk_X509_push(cert_sk, x)) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
X509_free(x);
goto end;
}
@@ -1057,12 +1057,12 @@ end_of_options:
(void)BIO_flush(bio_err);
tmp[0] = '\0';
if (fgets(tmp, sizeof(tmp), stdin) == NULL) {
- BIO_printf(bio_err, "CERTIFICATION CANCELED: I/O error\n");
+ BIO_puts(bio_err, "CERTIFICATION CANCELED: I/O error\n");
ret = 0;
goto end;
}
if (tmp[0] != 'y' && tmp[0] != 'Y') {
- BIO_printf(bio_err, "CERTIFICATION CANCELED\n");
+ BIO_puts(bio_err, "CERTIFICATION CANCELED\n");
ret = 0;
goto end;
}
@@ -1085,7 +1085,7 @@ end_of_options:
#endif
if (verbose)
- BIO_printf(bio_err, "writing new certificates\n");
+ BIO_puts(bio_err, "writing new certificates\n");
for (i = 0; i < sk_X509_num(cert_sk); i++) {
BIO *Cout = NULL;
@@ -1097,7 +1097,7 @@ end_of_options:
char *n = new_cert + outdirlen;
if (outdirlen + filen_len > PATH_MAX) {
- BIO_printf(bio_err, "certificate file name too long\n");
+ BIO_puts(bio_err, "certificate file name too long\n");
goto end;
}
@@ -1146,7 +1146,7 @@ end_of_options:
if (!rotate_index(dbfile, "new", "old"))
goto end;
- BIO_printf(bio_err, "Database updated\n");
+ BIO_puts(bio_err, "Database updated\n");
}
}
@@ -1174,7 +1174,7 @@ end_of_options:
if (crlnumberfile != NULL) {
if ((crlnumber = load_serial(crlnumberfile, NULL, 0, NULL))
== NULL) {
- BIO_printf(bio_err, "error while loading CRL number\n");
+ BIO_puts(bio_err, "error while loading CRL number\n");
goto end;
}
}
@@ -1188,13 +1188,13 @@ end_of_options:
crlhours = 0;
}
if ((crl_nextupdate == NULL) && (crldays == 0) && (crlhours == 0) && (crlsec == 0)) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"cannot lookup how long until the next CRL is issued\n");
goto end;
}
if (verbose)
- BIO_printf(bio_err, "making CRL\n");
+ BIO_puts(bio_err, "making CRL\n");
if ((crl = X509_CRL_new_ex(app_get0_libctx(), app_get0_propq())) == NULL)
goto end;
if (!X509_CRL_set_issuer_name(crl, X509_get_subject_name(x509)))
@@ -1243,7 +1243,7 @@ end_of_options:
/* we now have a CRL */
if (verbose)
- BIO_printf(bio_err, "signing CRL\n");
+ BIO_puts(bio_err, "signing CRL\n");
/* Add any extensions asked for */
@@ -1301,7 +1301,7 @@ end_of_options:
/*****************************************************************/
if (dorevoke) {
if (infile == NULL) {
- BIO_printf(bio_err, "no input files\n");
+ BIO_puts(bio_err, "no input files\n");
goto end;
} else {
X509 *revcert;
@@ -1323,7 +1323,7 @@ end_of_options:
if (!rotate_index(dbfile, "new", "old"))
goto end;
- BIO_printf(bio_err, "Database updated\n");
+ BIO_puts(bio_err, "Database updated\n");
}
}
ret = 0;
@@ -1381,31 +1381,31 @@ static int certify(X509 **xret, const char *infile, int informat,
if (req == NULL)
goto end;
if ((pktmp = X509_REQ_get0_pubkey(req)) == NULL) {
- BIO_printf(bio_err, "Error unpacking public key\n");
+ BIO_puts(bio_err, "Error unpacking public key\n");
goto end;
}
if (verbose)
X509_REQ_print_ex(bio_err, req, nameopt, X509_FLAG_COMPAT);
- BIO_printf(bio_err, "Check that the request matches the signature\n");
+ BIO_puts(bio_err, "Check that the request matches the signature\n");
ok = 0;
if (selfsign && !X509_REQ_check_private_key(req, pkey)) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Certificate request and CA private key do not match\n");
goto end;
}
i = do_X509_REQ_verify(req, pktmp, vfyopts);
if (i < 0) {
- BIO_printf(bio_err, "Signature verification problems...\n");
+ BIO_puts(bio_err, "Signature verification problems...\n");
goto end;
}
if (i == 0) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Signature did not match the certificate request\n");
goto end;
}
- BIO_printf(bio_err, "Signature ok\n");
+ BIO_puts(bio_err, "Signature ok\n");
ok = do_body(xret, pkey, x509, dgst, sigopts, policy, db, serial, subj,
chtype, multirdn, email_dn, startdate, enddate, days, batch,
@@ -1442,24 +1442,24 @@ static int certify_cert(X509 **xret, const char *infile, int certformat,
if (verbose)
X509_print(bio_err, template_cert);
- BIO_printf(bio_err, "Check that the request matches the signature\n");
+ BIO_puts(bio_err, "Check that the request matches the signature\n");
if ((pktmp = X509_get0_pubkey(template_cert)) == NULL) {
- BIO_printf(bio_err, "error unpacking public key\n");
+ BIO_puts(bio_err, "error unpacking public key\n");
goto end;
}
i = do_X509_verify(template_cert, pktmp, vfyopts);
if (i < 0) {
ok = 0;
- BIO_printf(bio_err, "Signature verification problems....\n");
+ BIO_puts(bio_err, "Signature verification problems....\n");
goto end;
}
if (i == 0) {
ok = 0;
- BIO_printf(bio_err, "Signature did not match the certificate\n");
+ BIO_puts(bio_err, "Signature did not match the certificate\n");
goto end;
} else {
- BIO_printf(bio_err, "Signature ok\n");
+ BIO_puts(bio_err, "Signature ok\n");
}
if ((rreq = X509_to_X509_REQ(template_cert, NULL, NULL)) == NULL)
@@ -1515,7 +1515,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
}
if (default_op)
- BIO_printf(bio_err, "The Subject's Distinguished Name is as follows\n");
+ BIO_puts(bio_err, "The Subject's Distinguished Name is as follows\n");
name = X509_REQ_get_subject_name(req);
for (i = 0; i < X509_NAME_entry_count(name); i++) {
@@ -1544,14 +1544,14 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
/* check some things */
if (nid == NID_pkcs9_emailAddress && str->type != V_ASN1_IA5STRING) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"\nemailAddress type needs to be of type IA5STRING\n");
goto end;
}
if (str->type != V_ASN1_BMPSTRING && str->type != V_ASN1_UTF8STRING) {
j = ASN1_PRINTABLE_type(str->data, str->length);
if ((j == V_ASN1_T61STRING && str->type != V_ASN1_T61STRING) || (j == V_ASN1_IA5STRING && str->type == V_ASN1_PRINTABLESTRING)) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"\nThe string contains characters that are illegal for the ASN.1 type\n");
goto end;
}
@@ -1563,7 +1563,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
/* Ok, now we check the 'policy' stuff. */
if ((subject = X509_NAME_new()) == NULL) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
@@ -1661,7 +1661,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
if (push != NULL) {
if (!X509_NAME_add_entry(subject, push, -1, 0)) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
}
@@ -1680,7 +1680,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
/* We are now totally happy, lets make and sign the certificate */
if (verbose)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Everything appears to be ok, creating and signing the certificate\n");
if ((ret = X509_new_ex(app_get0_libctx(), app_get0_propq())) == NULL)
@@ -1724,7 +1724,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
if (!X509V3_set_issuer_pkey(&ext_ctx, pkey))
goto end;
if (!cert_matches_key(ret, pkey))
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: Signature key and public key of cert do not match\n");
}
@@ -1732,7 +1732,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
if (ext_sect) {
if (extfile_conf != NULL) {
if (verbose)
- BIO_printf(bio_err, "Extra configuration file found\n");
+ BIO_puts(bio_err, "Extra configuration file found\n");
/* Use the extfile_conf configuration db LHASH */
X509V3_set_nconf(&ext_ctx, extfile_conf);
@@ -1745,7 +1745,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
goto end;
}
if (verbose)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Successfully added extensions from file.\n");
} else if (ext_sect) {
/* We found extensions to be set from config file */
@@ -1759,7 +1759,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
}
if (verbose)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Successfully added extensions from config\n");
}
}
@@ -1767,12 +1767,12 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
/* Copy extensions from request (if any) */
if (!copy_extensions(ret, req, ext_copy)) {
- BIO_printf(bio_err, "ERROR: adding extensions from request\n");
+ BIO_puts(bio_err, "ERROR: adding extensions from request\n");
goto end;
}
if (verbose)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"The subject name appears to be ok, checking database for clashes\n");
/* Build the correct Subject if no e-mail is wanted in the subject. */
@@ -1785,7 +1785,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
* because this retains its structure.
*/
if ((dn_subject = X509_NAME_dup(subject)) == NULL) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
i = -1;
@@ -1806,7 +1806,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
row[DB_name] = X509_NAME_oneline(X509_get_subject_name(ret), NULL, 0);
if (row[DB_name] == NULL) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
@@ -1815,7 +1815,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
else
row[DB_serial] = BN_bn2hex(serial);
if (row[DB_serial] == NULL) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
@@ -1828,7 +1828,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
OPENSSL_free(row[DB_name]);
row[DB_name] = OPENSSL_strdup(row[DB_serial]);
if (row[DB_name] == NULL) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
}
@@ -1849,13 +1849,13 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
BIO_printf(bio_err,
"ERROR:Serial number %s has already been issued,\n",
row[DB_serial]);
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
" check the database/serial_file for corruption\n");
}
}
if (rrow != NULL) {
- BIO_printf(bio_err, "The matching entry has the following details\n");
+ BIO_puts(bio_err, "The matching entry has the following details\n");
if (rrow[DB_type][0] == DB_TYPE_EXP)
p = "Expired";
else if (rrow[DB_type][0] == DB_TYPE_REV)
@@ -1892,7 +1892,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
}
if (!default_op) {
- BIO_printf(bio_err, "Certificate Details:\n");
+ BIO_puts(bio_err, "Certificate Details:\n");
/*
* Never print signature details because signature not present
*/
@@ -1900,25 +1900,25 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
X509_print_ex(bio_err, ret, nameopt, certopt);
}
- BIO_printf(bio_err, "Certificate is to be certified until ");
+ BIO_puts(bio_err, "Certificate is to be certified until ");
ASN1_TIME_print_ex(bio_err, X509_get0_notAfter(ret), dateopt);
if (days)
BIO_printf(bio_err, " (%ld days)", days);
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
if (!batch) {
- BIO_printf(bio_err, "Sign the certificate? [y/n]:");
+ BIO_puts(bio_err, "Sign the certificate? [y/n]:");
(void)BIO_flush(bio_err);
buf[0] = '\0';
if (fgets(buf, sizeof(buf), stdin) == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"CERTIFICATE WILL NOT BE CERTIFIED: I/O error\n");
ok = 0;
goto end;
}
if (!(buf[0] == 'y' || buf[0] == 'Y')) {
- BIO_printf(bio_err, "CERTIFICATE WILL NOT BE CERTIFIED\n");
+ BIO_puts(bio_err, "CERTIFICATE WILL NOT BE CERTIFIED\n");
ok = 0;
goto end;
}
@@ -1941,7 +1941,7 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
row[DB_file] = OPENSSL_strdup("unknown");
if ((row[DB_type] == NULL) || (row[DB_file] == NULL)
|| (row[DB_name] == NULL)) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
@@ -1951,8 +1951,9 @@ static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509,
irow[DB_NUMBER] = NULL;
if (!TXT_DB_insert(db->db, irow)) {
- BIO_printf(bio_err, "failed to update database\n");
- BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error);
+ BIO_printf(bio_err, "failed to update database\n"
+ "TXT_DB error number %ld\n",
+ db->db->error);
goto end;
}
irow = NULL;
@@ -2063,7 +2064,7 @@ static int certify_spkac(X509 **xret, const char *infile, EVP_PKEY *pkey,
if (strcmp(type, "SPKAC") == 0) {
spki = NETSCAPE_SPKI_b64_decode(cv->value, -1);
if (spki == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"unable to load Netscape SPKAC structure\n");
goto end;
}
@@ -2085,21 +2086,21 @@ static int certify_spkac(X509 **xret, const char *infile, EVP_PKEY *pkey,
* Now extract the key from the SPKI structure.
*/
- BIO_printf(bio_err, "Check that the SPKAC request matches the signature\n");
+ BIO_puts(bio_err, "Check that the SPKAC request matches the signature\n");
if ((pktmp = NETSCAPE_SPKI_get_pubkey(spki)) == NULL) {
- BIO_printf(bio_err, "error unpacking SPKAC public key\n");
+ BIO_puts(bio_err, "error unpacking SPKAC public key\n");
goto end;
}
j = NETSCAPE_SPKI_verify(spki, pktmp);
if (j <= 0) {
EVP_PKEY_free(pktmp);
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"signature verification failed on SPKAC public key\n");
goto end;
}
- BIO_printf(bio_err, "Signature ok\n");
+ BIO_puts(bio_err, "Signature ok\n");
X509_REQ_set_pubkey(req, pktmp);
EVP_PKEY_free(pktmp);
@@ -2147,7 +2148,7 @@ static int do_revoke(X509 *x509, CA_DB *db, REVINFO_TYPE rev_type,
row[DB_name] = OPENSSL_strdup(row[DB_serial]);
}
if ((row[DB_name] == NULL) || (row[DB_serial] == NULL)) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
/*
@@ -2170,7 +2171,7 @@ static int do_revoke(X509 *x509, CA_DB *db, REVINFO_TYPE rev_type,
row[DB_file] = OPENSSL_strdup("unknown");
if (row[DB_type] == NULL || row[DB_file] == NULL) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto end;
}
@@ -2180,8 +2181,9 @@ static int do_revoke(X509 *x509, CA_DB *db, REVINFO_TYPE rev_type,
irow[DB_NUMBER] = NULL;
if (!TXT_DB_insert(db->db, irow)) {
- BIO_printf(bio_err, "failed to update database\n");
- BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error);
+ BIO_printf(bio_err, "failed to update database\n"
+ "TXT_DB error number %ld\n",
+ db->db->error);
OPENSSL_free(irow);
goto end;
}
@@ -2213,7 +2215,7 @@ static int do_revoke(X509 *x509, CA_DB *db, REVINFO_TYPE rev_type,
BIO_printf(bio_err, "Revoking Certificate %s.\n", rrow[DB_serial]);
rev_str = make_revocation_str(rev_type, value);
if (!rev_str) {
- BIO_printf(bio_err, "Error in revocation arguments\n");
+ BIO_puts(bio_err, "Error in revocation arguments\n");
goto end;
}
rrow[DB_type][0] = DB_TYPE_REV;
@@ -2528,13 +2530,13 @@ static int old_entry_print(const ASN1_OBJECT *obj, const ASN1_STRING *str)
BIO_puts(bio_err, buf);
if (str->type == V_ASN1_PRINTABLESTRING)
- BIO_printf(bio_err, "PRINTABLE:'");
+ BIO_puts(bio_err, "PRINTABLE:'");
else if (str->type == V_ASN1_T61STRING)
- BIO_printf(bio_err, "T61STRING:'");
+ BIO_puts(bio_err, "T61STRING:'");
else if (str->type == V_ASN1_IA5STRING)
- BIO_printf(bio_err, "IA5STRING:'");
+ BIO_puts(bio_err, "IA5STRING:'");
else if (str->type == V_ASN1_UNIVERSALSTRING)
- BIO_printf(bio_err, "UNIVERSALSTRING:'");
+ BIO_puts(bio_err, "UNIVERSALSTRING:'");
else
BIO_printf(bio_err, "ASN.1 %2d:'", str->type);
@@ -2545,12 +2547,12 @@ static int old_entry_print(const ASN1_OBJECT *obj, const ASN1_STRING *str)
else if (*p & 0x80)
BIO_printf(bio_err, "\\0x%02X", *p);
else if ((unsigned char)*p == 0xf7)
- BIO_printf(bio_err, "^?");
+ BIO_puts(bio_err, "^?");
else
BIO_printf(bio_err, "^%c", *p + '@');
p++;
}
- BIO_printf(bio_err, "'\n");
+ BIO_puts(bio_err, "'\n");
return 1;
}
@@ -2567,7 +2569,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
tmp = OPENSSL_strdup(str);
if (!tmp) {
- BIO_printf(bio_err, "memory allocation failure\n");
+ BIO_puts(bio_err, "memory allocation failure\n");
goto end;
}
@@ -2589,7 +2591,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
if (prevtm) {
*prevtm = ASN1_UTCTIME_new();
if (*prevtm == NULL) {
- BIO_printf(bio_err, "memory allocation failure\n");
+ BIO_puts(bio_err, "memory allocation failure\n");
goto end;
}
if (!ASN1_UTCTIME_set_string(*prevtm, rtime_str)) {
@@ -2613,7 +2615,7 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
reason_code = OCSP_REVOKED_STATUS_REMOVEFROMCRL;
} else if (reason_code == 8) { /* Hold instruction */
if (!arg_str) {
- BIO_printf(bio_err, "missing hold instruction\n");
+ BIO_puts(bio_err, "missing hold instruction\n");
goto end;
}
reason_code = OCSP_REVOKED_STATUS_CERTIFICATEHOLD;
@@ -2629,12 +2631,12 @@ int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold,
ASN1_OBJECT_free(hold);
} else if ((reason_code == 9) || (reason_code == 10)) {
if (!arg_str) {
- BIO_printf(bio_err, "missing compromised time\n");
+ BIO_puts(bio_err, "missing compromised time\n");
goto end;
}
comp_time = ASN1_GENERALIZEDTIME_new();
if (comp_time == NULL) {
- BIO_printf(bio_err, "memory allocation failure\n");
+ BIO_puts(bio_err, "memory allocation failure\n");
goto end;
}
if (!ASN1_GENERALIZEDTIME_set_string(comp_time, arg_str)) {
diff --git a/apps/ciphers.c b/apps/ciphers.c
index 3f2e73c13a..88e3c9d533 100644
--- a/apps/ciphers.c
+++ b/apps/ciphers.c
@@ -199,13 +199,13 @@ int ciphers_main(int argc, char **argv)
#endif
if (ciphersuites != NULL && !SSL_CTX_set_ciphersuites(ctx, ciphersuites)) {
- BIO_printf(bio_err, "Error setting TLSv1.3 ciphersuites\n");
+ BIO_puts(bio_err, "Error setting TLSv1.3 ciphersuites\n");
goto err;
}
if (ciphers != NULL) {
if (!SSL_CTX_set_cipher_list(ctx, ciphers)) {
- BIO_printf(bio_err, "Error in cipher list\n");
+ BIO_puts(bio_err, "Error in cipher list\n");
goto err;
}
}
@@ -229,10 +229,10 @@ int ciphers_main(int argc, char **argv)
if (p == NULL)
break;
if (i != 0)
- BIO_printf(bio_out, ":");
- BIO_printf(bio_out, "%s", p);
+ BIO_puts(bio_out, ":");
+ BIO_puts(bio_out, p);
}
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, "\n");
} else {
for (i = 0; i < sk_SSL_CIPHER_num(sk); i++) {
diff --git a/apps/cmp.c b/apps/cmp.c
index eb48acbfbc..6240f9838d 100644
--- a/apps/cmp.c
+++ b/apps/cmp.c
@@ -1541,7 +1541,7 @@ static SSL_CTX *setup_ssl_ctx(OSSL_CMP_CTX *ctx, const char *host)
}
sk_X509_free(tls_extra);
if (res == 0) {
- BIO_printf(bio_err, "error: unable to add TLS extra certs\n");
+ BIO_puts(bio_err, "error: unable to add TLS extra certs\n");
goto err;
}
}
@@ -3385,12 +3385,12 @@ static void print_keyspec(OSSL_CMP_ATAVS *keySpec)
const void *param;
X509_ALGOR_get0(&oid, ¶mtype, ¶m, alg);
- BIO_printf(mem, "Key algorithm: ");
+ BIO_puts(mem, "Key algorithm: ");
i2a_ASN1_OBJECT(mem, oid);
if (paramtype == V_ASN1_UNDEF || alg->parameter == NULL) {
- BIO_printf(mem, "\n");
+ BIO_puts(mem, "\n");
} else {
- BIO_printf(mem, " - ");
+ BIO_puts(mem, " - ");
ASN1_item_print(mem, (ASN1_VALUE *)alg,
0, ASN1_ITEM_rptr(X509_ALGOR), NULL);
}
@@ -3705,7 +3705,7 @@ int cmp_main(int argc, char **argv)
ret = -1;
if (ret <= 0) {
if (ret == -1)
- BIO_printf(bio_err, "Use -help for summary.\n");
+ BIO_puts(bio_err, "Use -help for summary.\n");
goto err;
}
}
diff --git a/apps/cms.c b/apps/cms.c
index df13876b23..35f4166bd3 100644
--- a/apps/cms.c
+++ b/apps/cms.c
@@ -323,7 +323,7 @@ static CMS_ContentInfo *load_content_info(int informat, BIO *in, int flags,
ret = CMS_ContentInfo_new_ex(app_get0_libctx(), app_get0_propq());
if (ret == NULL) {
- BIO_printf(bio_err, "Error allocating CMS_contentinfo\n");
+ BIO_puts(bio_err, "Error allocating CMS_contentinfo\n");
return NULL;
}
switch (informat) {
@@ -791,7 +791,7 @@ int cms_main(int argc, char **argv)
keyidx += sk_OPENSSL_STRING_num(skkeys);
}
if (keyidx < 0) {
- BIO_printf(bio_err, "No key specified\n");
+ BIO_puts(bio_err, "No key specified\n");
goto opthelp;
}
if (key_param == NULL || key_param->idx != keyidx) {
@@ -908,7 +908,7 @@ int cms_main(int argc, char **argv)
goto end;
}
if (sksigners == NULL) {
- BIO_printf(bio_err, "No signer certificate specified\n");
+ BIO_puts(bio_err, "No signer certificate specified\n");
goto opthelp;
}
signerfile = NULL;
@@ -916,23 +916,23 @@ int cms_main(int argc, char **argv)
} else if (operation == SMIME_DECRYPT) {
if (recipfile == NULL && keyfile == NULL
&& secret_key == NULL && pwri_pass == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"No recipient certificate or key specified\n");
goto opthelp;
}
} else if (operation == SMIME_ENCRYPT) {
if (*argv == NULL && secret_key == NULL
&& pwri_pass == NULL && sk_X509_num(encerts) <= 0) {
- BIO_printf(bio_err, "No recipient(s) certificate(s) specified\n");
+ BIO_puts(bio_err, "No recipient(s) certificate(s) specified\n");
goto opthelp;
}
} else if (!operation) {
- BIO_printf(bio_err, "No operation option (-encrypt|-decrypt|-sign|-verify|...) specified.\n");
+ BIO_puts(bio_err, "No operation option (-encrypt|-decrypt|-sign|-verify|...) specified.\n");
goto opthelp;
}
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
goto end;
}
@@ -940,19 +940,19 @@ int cms_main(int argc, char **argv)
if ((operation & SMIME_SIGNERS) == 0) {
if ((flags & CMS_DETACHED) == 0)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: -nodetach option is ignored for non-signing operation\n");
flags &= ~CMS_DETACHED;
}
if ((operation & SMIME_IP) == 0 && contfile != NULL)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: -contfile option is ignored for the given operation\n");
if (operation != SMIME_ENCRYPT && *argv != NULL)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: recipient certificate file parameters ignored for operation other than -encrypt\n");
if (operation != SMIME_ENCRYPT && recip_first != NULL)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: -recip_kdf and -recip_ukm parameters ignored for operation other than -encrypt\n");
if ((flags & CMS_BINARY) != 0) {
@@ -970,7 +970,7 @@ int cms_main(int argc, char **argv)
if (!cipher)
cipher = (EVP_CIPHER *)EVP_aes_256_cbc();
if (secret_key && !secret_keyid) {
- BIO_printf(bio_err, "No secret key id\n");
+ BIO_puts(bio_err, "No secret key id\n");
goto end;
}
@@ -1025,20 +1025,20 @@ int cms_main(int argc, char **argv)
if (digesthex != NULL) {
if (operation != SMIME_SIGN) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Cannot use -digest for non-signing operation\n");
goto end;
}
if (infile != NULL
|| (flags & CMS_DETACHED) == 0
|| (flags & CMS_STREAM) != 0) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Cannot use -digest when -in, -nodetach or streaming is used\n");
goto end;
}
digestbin = OPENSSL_hexstr2buf(digesthex, &digestlen);
if (digestbin == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Invalid hex value after -digest\n");
goto end;
}
@@ -1213,7 +1213,7 @@ int cms_main(int argc, char **argv)
if (originator != NULL
&& ERR_GET_REASON(ERR_peek_error())
== CMS_R_ERROR_UNSUPPORTED_STATIC_KEY_AGREEMENT) {
- BIO_printf(bio_err, "Cannot use originator for encryption\n");
+ BIO_puts(bio_err, "Cannot use originator for encryption\n");
goto end;
}
goto end;
@@ -1327,7 +1327,7 @@ int cms_main(int argc, char **argv)
}
if (cms == NULL) {
- BIO_printf(bio_err, "Error creating CMS structure\n");
+ BIO_puts(bio_err, "Error creating CMS structure\n");
goto end;
}
@@ -1360,7 +1360,7 @@ int cms_main(int argc, char **argv)
}
if (!CMS_decrypt(cms, NULL, NULL, indata, out, flags)) {
- BIO_printf(bio_err, "Error decrypting CMS structure\n");
+ BIO_puts(bio_err, "Error decrypting CMS structure\n");
goto end;
}
} else if (operation == SMIME_DATA_OUT) {
@@ -1371,9 +1371,9 @@ int cms_main(int argc, char **argv)
goto end;
} else if (operation == SMIME_DIGEST_VERIFY) {
if (CMS_digest_verify(cms, indata, out, flags) > 0) {
- BIO_printf(bio_err, "Verification successful\n");
+ BIO_puts(bio_err, "Verification successful\n");
} else {
- BIO_printf(bio_err, "Verification failure\n");
+ BIO_puts(bio_err, "Verification failure\n");
goto end;
}
} else if (operation == SMIME_ENCRYPTED_DECRYPT) {
@@ -1407,9 +1407,9 @@ int cms_main(int argc, char **argv)
} else if (operation == SMIME_VERIFY_RECEIPT) {
if (CMS_verify_receipt(rcms, cms, other, store, flags) > 0) {
- BIO_printf(bio_err, "Verification successful\n");
+ BIO_puts(bio_err, "Verification successful\n");
} else {
- BIO_printf(bio_err, "Verification failure\n");
+ BIO_puts(bio_err, "Verification failure\n");
goto end;
}
} else {
@@ -1445,11 +1445,11 @@ int cms_main(int argc, char **argv)
} else if (outformat == FORMAT_ASN1) {
ret = i2d_CMS_bio_stream(out, cms, in, flags);
} else {
- BIO_printf(bio_err, "Bad output format for CMS file\n");
+ BIO_puts(bio_err, "Bad output format for CMS file\n");
goto end;
}
if (ret <= 0) {
- BIO_printf(bio_err, "Error writing CMS output\n");
+ BIO_puts(bio_err, "Error writing CMS output\n");
ret = 6;
goto end;
}
diff --git a/apps/configutl.c b/apps/configutl.c
index e564ce06d3..8f785aca13 100644
--- a/apps/configutl.c
+++ b/apps/configutl.c
@@ -28,20 +28,20 @@ static void print_escaped_value(BIO *out, const char *value)
case '#':
case '\\':
case '$':
- BIO_printf(out, "\\");
+ BIO_puts(out, "\\");
BIO_write(out, p, 1);
break;
case '\n':
- BIO_printf(out, "%s", "\\n");
+ BIO_puts(out, "\\n");
break;
case '\r':
- BIO_printf(out, "%s", "\\r");
+ BIO_puts(out, "\\r");
break;
case '\b':
- BIO_printf(out, "%s", "\\b");
+ BIO_puts(out, "\\b");
break;
case '\t':
- BIO_printf(out, "%s", "\\t");
+ BIO_puts(out, "\\t");
break;
case ' ':
if (p == value || p[1] == '\0') {
@@ -56,7 +56,7 @@ static void print_escaped_value(BIO *out, const char *value)
* more trouble than adding the quotes just around the
* first and last leading and trailing space.
*/
- BIO_printf(out, "%s", "\" \"");
+ BIO_puts(out, "\" \"");
break;
}
/* FALLTHROUGH */
@@ -80,7 +80,7 @@ static void print_section(BIO *out, const CONF *cnf, OPENSSL_CSTRING section_nam
BIO_printf(out, "%s = ", value->name);
print_escaped_value(out, value->value);
- BIO_printf(out, "\n");
+ BIO_puts(out, "\n");
}
}
diff --git a/apps/crl.c b/apps/crl.c
index 3c0987b98e..f59cdb98b9 100644
--- a/apps/crl.c
+++ b/apps/crl.c
@@ -252,20 +252,20 @@ int crl_main(int argc, char **argv)
goto end;
ctx = X509_STORE_CTX_new();
if (ctx == NULL || !X509_STORE_CTX_init(ctx, store, NULL, NULL)) {
- BIO_printf(bio_err, "Error initialising X509 store\n");
+ BIO_puts(bio_err, "Error initialising X509 store\n");
goto end;
}
xobj = X509_STORE_CTX_get_obj_by_subject(ctx, X509_LU_X509,
X509_CRL_get_issuer(x));
if (xobj == NULL) {
- BIO_printf(bio_err, "Error getting CRL issuer certificate\n");
+ BIO_puts(bio_err, "Error getting CRL issuer certificate\n");
goto end;
}
pkey = X509_get_pubkey(X509_OBJECT_get0_X509(xobj));
X509_OBJECT_free(xobj);
if (pkey == NULL) {
- BIO_printf(bio_err, "Error getting CRL issuer public key\n");
+ BIO_puts(bio_err, "Error getting CRL issuer public key\n");
goto end;
}
i = X509_CRL_verify(x, pkey);
@@ -273,11 +273,10 @@ int crl_main(int argc, char **argv)
if (i < 0)
goto end;
if (i == 0) {
- BIO_printf(bio_err, "verify failure\n");
+ BIO_puts(bio_err, "verify failure\n");
goto end;
- } else {
- BIO_printf(bio_err, "verify OK\n");
- }
+ } else
+ BIO_puts(bio_err, "verify OK\n");
}
if (crldiff != NULL) {
@@ -322,7 +321,7 @@ int crl_main(int argc, char **argv)
ASN1_INTEGER *crlnum;
crlnum = X509_CRL_get_ext_d2i(x, NID_crl_number, NULL, NULL);
- BIO_printf(bio_out, "crlNumber=");
+ BIO_puts(bio_out, "crlNumber=");
if (crlnum) {
BIO_puts(bio_out, "0x");
i2a_ASN1_INTEGER(bio_out, crlnum);
@@ -330,7 +329,7 @@ int crl_main(int argc, char **argv)
} else {
BIO_puts(bio_out, "<NONE>");
}
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, "\n");
}
if (hash == i) {
int ok;
@@ -338,7 +337,7 @@ int crl_main(int argc, char **argv)
app_get0_propq(), &ok);
if (num > 1)
- BIO_printf(bio_out, "issuer name hash=");
+ BIO_puts(bio_out, "issuer name hash=");
if (ok) {
BIO_printf(bio_out, "%08lx\n", hash_value);
} else {
@@ -349,23 +348,23 @@ int crl_main(int argc, char **argv)
#ifndef OPENSSL_NO_MD5
if (hash_old == i) {
if (num > 1)
- BIO_printf(bio_out, "issuer name old hash=");
+ BIO_puts(bio_out, "issuer name old hash=");
BIO_printf(bio_out, "%08lx\n",
X509_NAME_hash_old(X509_CRL_get_issuer(x)));
}
#endif
if (lastupdate == i) {
- BIO_printf(bio_out, "lastUpdate=");
+ BIO_puts(bio_out, "lastUpdate=");
ASN1_TIME_print_ex(bio_out, X509_CRL_get0_lastUpdate(x), dateopt);
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, "\n");
}
if (nextupdate == i) {
- BIO_printf(bio_out, "nextUpdate=");
+ BIO_puts(bio_out, "nextUpdate=");
if (X509_CRL_get0_nextUpdate(x))
ASN1_TIME_print_ex(bio_out, X509_CRL_get0_nextUpdate(x), dateopt);
else
- BIO_printf(bio_out, "NONE");
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, "NONE");
+ BIO_puts(bio_out, "\n");
}
if (fingerprint == i) {
int j;
@@ -373,7 +372,7 @@ int crl_main(int argc, char **argv)
unsigned char md[EVP_MAX_MD_SIZE];
if (!X509_CRL_digest(x, digest, md, &n)) {
- BIO_printf(bio_err, "out of memory\n");
+ BIO_puts(bio_err, "out of memory\n");
goto end;
}
BIO_printf(bio_out, "%s Fingerprint=",
@@ -401,7 +400,7 @@ int crl_main(int argc, char **argv)
else
i = PEM_write_bio_X509_CRL(out, x);
if (!i) {
- BIO_printf(bio_err, "unable to write CRL\n");
+ BIO_puts(bio_err, "unable to write CRL\n");
goto end;
}
ret = 0;
diff --git a/apps/crl2pkcs7.c b/apps/crl2pkcs7.c
index 72d385250a..30f876d3fb 100644
--- a/apps/crl2pkcs7.c
+++ b/apps/crl2pkcs7.c
@@ -121,7 +121,7 @@ int crl2pkcs7_main(int argc, char **argv)
else if (informat == FORMAT_PEM)
crl = PEM_read_bio_X509_CRL(in, NULL, NULL, NULL);
if (crl == NULL) {
- BIO_printf(bio_err, "unable to load CRL\n");
+ BIO_puts(bio_err, "unable to load CRL\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -156,7 +156,7 @@ int crl2pkcs7_main(int argc, char **argv)
for (i = 0; i < sk_OPENSSL_STRING_num(certflst); i++) {
certfile = sk_OPENSSL_STRING_value(certflst, i);
if (add_certs_from_file(cert_stack, certfile) < 0) {
- BIO_printf(bio_err, "error loading certificates\n");
+ BIO_puts(bio_err, "error loading certificates\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -172,7 +172,7 @@ int crl2pkcs7_main(int argc, char **argv)
else if (outformat == FORMAT_PEM)
i = PEM_write_bio_PKCS7(out, p7);
if (!i) {
- BIO_printf(bio_err, "unable to write pkcs7 object\n");
+ BIO_puts(bio_err, "unable to write pkcs7 object\n");
ERR_print_errors(bio_err);
goto end;
}
diff --git a/apps/dgst.c b/apps/dgst.c
index 71520af6c8..cf4522e1b4 100644
--- a/apps/dgst.c
+++ b/apps/dgst.c
@@ -151,12 +151,12 @@ int dgst_main(int argc, char **argv)
ret = EXIT_SUCCESS;
goto end;
case OPT_LIST:
- BIO_printf(bio_out, "Supported digests:\n");
+ BIO_puts(bio_out, "Supported digests:\n");
dec.bio = bio_out;
dec.n = 0;
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_MD_METH,
show_digests, &dec);
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, "\n");
ret = EXIT_SUCCESS;
goto end;
case OPT_C:
@@ -282,7 +282,7 @@ int dgst_main(int argc, char **argv)
}
if (do_verify && sigfile == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"No signature to verify: use the -signature option\n");
goto end;
}
@@ -299,7 +299,7 @@ int dgst_main(int argc, char **argv)
}
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
goto end;
}
@@ -315,7 +315,7 @@ int dgst_main(int argc, char **argv)
goto end;
if ((!(mac_name == NULL) + !(keyfile == NULL) + !(hmac_key == NULL)) > 1) {
- BIO_printf(bio_err, "MAC and signing key cannot both be specified\n");
+ BIO_puts(bio_err, "MAC and signing key cannot both be specified\n");
goto end;
}
@@ -387,7 +387,7 @@ int dgst_main(int argc, char **argv)
if (oneshot_sign) {
mctx = signctx;
} else if (BIO_get_md_ctx(bmd, &mctx) <= 0) {
- BIO_printf(bio_err, "Error getting context\n");
+ BIO_puts(bio_err, "Error getting context\n");
goto end;
}
if (do_verify)
@@ -399,7 +399,7 @@ int dgst_main(int argc, char **argv)
app_get0_libctx(),
app_get0_propq(), sigkey, NULL);
if (res == 0) {
- BIO_printf(bio_err, "Error setting context\n");
+ BIO_puts(bio_err, "Error setting context\n");
goto end;
}
if (sigopts != NULL) {
@@ -419,17 +419,17 @@ int dgst_main(int argc, char **argv)
EVP_MD_CTX *mctx = NULL;
if (oneshot_sign) {
- BIO_printf(bio_err, "Oneshot algorithms don't use a digest\n");
+ BIO_puts(bio_err, "Oneshot algorithms don't use a digest\n");
goto end;
}
if (BIO_get_md_ctx(bmd, &mctx) <= 0) {
- BIO_printf(bio_err, "Error getting context\n");
+ BIO_puts(bio_err, "Error getting context\n");
goto end;
}
if (md == NULL)
md = (EVP_MD *)EVP_sha256();
if (!EVP_DigestInit_ex(mctx, md, NULL)) {
- BIO_printf(bio_err, "Error setting digest\n");
+ BIO_puts(bio_err, "Error setting digest\n");
goto end;
}
}
@@ -464,7 +464,7 @@ int dgst_main(int argc, char **argv)
}
if (xoflen > 0) {
if (!EVP_MD_xof(md)) {
- BIO_printf(bio_err, "Length can only be specified for XOF\n");
+ BIO_puts(bio_err, "Length can only be specified for XOF\n");
goto end;
}
/*
@@ -473,7 +473,7 @@ int dgst_main(int argc, char **argv)
* and verify_final methods.
*/
if (sigkey != NULL) {
- BIO_printf(bio_err, "Signing key cannot be specified for XOF\n");
+ BIO_puts(bio_err, "Signing key cannot be specified for XOF\n");
goto end;
}
}
@@ -552,10 +552,10 @@ static void show_digests(const OBJ_NAME *name, void *arg)
BIO_printf(dec->bio, "-%-25s", name->name);
if (++dec->n == 3) {
- BIO_printf(dec->bio, "\n");
+ BIO_puts(dec->bio, "\n");
dec->n = 0;
} else {
- BIO_printf(dec->bio, " ");
+ BIO_puts(dec->bio, " ");
}
EVP_MD_free(md);
@@ -631,21 +631,21 @@ static void print_out(BIO *out, unsigned char *buf, size_t len,
}
for (i = 0; i < (int)len; i++) {
if (sep && (i != 0))
- BIO_printf(out, ":");
+ BIO_puts(out, ":");
BIO_printf(out, "%02x", buf[i]);
}
- BIO_printf(out, "\n");
+ BIO_puts(out, "\n");
}
}
static void print_verify_result(BIO *out, int i)
{
if (i > 0)
- BIO_printf(out, "Verified OK\n");
+ BIO_puts(out, "Verified OK\n");
else if (i == 0)
- BIO_printf(out, "Verification failure\n");
+ BIO_puts(out, "Verification failure\n");
else
- BIO_printf(bio_err, "Error verifying data\n");
+ BIO_puts(bio_err, "Error verifying data\n");
}
int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen,
@@ -681,7 +681,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen
BIO_get_md_ctx(bp, &ctx);
if (!EVP_DigestSignFinal(ctx, NULL, &tmplen)) {
- BIO_printf(bio_err, "Error getting maximum length of signed data\n");
+ BIO_puts(bio_err, "Error getting maximum length of signed data\n");
goto end;
}
if (tmplen > BUFSIZE) {
@@ -690,7 +690,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen
buf = allocated_buf;
}
if (!EVP_DigestSignFinal(ctx, buf, &len)) {
- BIO_printf(bio_err, "Error signing data\n");
+ BIO_puts(bio_err, "Error signing data\n");
goto end;
}
} else if (xoflen > 0) {
@@ -705,7 +705,7 @@ int do_fp(BIO *out, unsigned char *buf, BIO *bp, int sep, int binout, int xoflen
BIO_get_md_ctx(bp, &ctx);
if (!EVP_DigestFinalXOF(ctx, buf, len)) {
- BIO_printf(bio_err, "Error Digesting Data\n");
+ BIO_puts(bio_err, "Error Digesting Data\n");
goto end;
}
} else {
@@ -751,18 +751,18 @@ static int do_fp_oneshot_sign(BIO *out, EVP_MD_CTX *ctx, BIO *in, int sep, int b
}
if (key != NULL) {
if (EVP_DigestSign(ctx, NULL, &len, buf, buflen) != 1) {
- BIO_printf(bio_err, "Error getting maximum length of signed data\n");
+ BIO_puts(bio_err, "Error getting maximum length of signed data\n");
goto end;
}
sig = app_malloc(len, "Signature buffer");
if (EVP_DigestSign(ctx, sig, &len, buf, buflen) != 1) {
- BIO_printf(bio_err, "Error signing data\n");
+ BIO_puts(bio_err, "Error signing data\n");
goto end;
}
print_out(out, sig, len, sep, binout, sig_name, NULL, file);
ret = EXIT_SUCCESS;
} else {
- BIO_printf(bio_err, "key must be set for one-shot algorithms\n");
+ BIO_puts(bio_err, "key must be set for one-shot algorithms\n");
goto end;
}
diff --git a/apps/dhparam.c b/apps/dhparam.c
index dc6648aa92..5f0735b51f 100644
--- a/apps/dhparam.c
+++ b/apps/dhparam.c
@@ -178,7 +178,7 @@ int dhparam_main(int argc, char **argv)
num = DEFBITS;
if (dsaparam && g) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error, generator may not be chosen for DSA parameters\n");
goto end;
}
@@ -218,16 +218,16 @@ int dhparam_main(int argc, char **argv)
if (dsaparam) {
if (EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, num) <= 0) {
- BIO_printf(bio_err, "Error, unable to set DSA prime length\n");
+ BIO_puts(bio_err, "Error, unable to set DSA prime length\n");
goto end;
}
} else {
if (EVP_PKEY_CTX_set_dh_paramgen_prime_len(ctx, num) <= 0) {
- BIO_printf(bio_err, "Error, unable to set DH prime length\n");
+ BIO_puts(bio_err, "Error, unable to set DH prime length\n");
goto end;
}
if (EVP_PKEY_CTX_set_dh_paramgen_generator(ctx, g) <= 0) {
- BIO_printf(bio_err, "Error, unable to set generator\n");
+ BIO_puts(bio_err, "Error, unable to set generator\n");
goto end;
}
}
@@ -301,13 +301,13 @@ int dhparam_main(int argc, char **argv)
OSSL_DECODER_CTX_free(decoderctx);
} while (!done);
if (tmppkey == NULL) {
- BIO_printf(bio_err, "Error, unable to load parameters\n");
+ BIO_puts(bio_err, "Error, unable to load parameters\n");
goto end;
}
if (dsaparam) {
if (!EVP_PKEY_is_a(tmppkey, "DSA")) {
- BIO_printf(bio_err, "Error, unable to load DSA parameters\n");
+ BIO_puts(bio_err, "Error, unable to load DSA parameters\n");
goto end;
}
pkey = dsa_to_dh(tmppkey);
@@ -316,7 +316,7 @@ int dhparam_main(int argc, char **argv)
} else {
if (!EVP_PKEY_is_a(tmppkey, "DH")
&& !EVP_PKEY_is_a(tmppkey, "DHX")) {
- BIO_printf(bio_err, "Error, unable to load DH parameters\n");
+ BIO_puts(bio_err, "Error, unable to load DH parameters\n");
goto end;
}
pkey = tmppkey;
@@ -334,14 +334,14 @@ int dhparam_main(int argc, char **argv)
if (check) {
ctx = EVP_PKEY_CTX_new_from_pkey(app_get0_libctx(), pkey, app_get0_propq());
if (ctx == NULL) {
- BIO_printf(bio_err, "Error, failed to check DH parameters\n");
+ BIO_puts(bio_err, "Error, failed to check DH parameters\n");
goto end;
}
if (EVP_PKEY_param_check(ctx) <= 0) {
- BIO_printf(bio_err, "Error, invalid parameters generated\n");
+ BIO_puts(bio_err, "Error, invalid parameters generated\n");
goto end;
}
- BIO_printf(bio_err, "DH parameters appear to be ok.\n");
+ BIO_puts(bio_err, "DH parameters appear to be ok.\n");
}
if (!noout) {
@@ -354,7 +354,7 @@ int dhparam_main(int argc, char **argv)
if (ectx == NULL || !OSSL_ENCODER_to_bio(ectx, out)) {
OSSL_ENCODER_CTX_free(ectx);
- BIO_printf(bio_err, "Error, unable to write DH parameters\n");
+ BIO_puts(bio_err, "Error, unable to write DH parameters\n");
goto end;
}
OSSL_ENCODER_CTX_free(ectx);
@@ -387,7 +387,7 @@ static EVP_PKEY *dsa_to_dh(EVP_PKEY *dh)
if (!EVP_PKEY_get_bn_param(dh, OSSL_PKEY_PARAM_FFC_P, &bn_p)
|| !EVP_PKEY_get_bn_param(dh, OSSL_PKEY_PARAM_FFC_Q, &bn_q)
|| !EVP_PKEY_get_bn_param(dh, OSSL_PKEY_PARAM_FFC_G, &bn_g)) {
- BIO_printf(bio_err, "Error, failed to set DH parameters\n");
+ BIO_puts(bio_err, "Error, failed to set DH parameters\n");
goto err;
}
@@ -399,7 +399,7 @@ static EVP_PKEY *dsa_to_dh(EVP_PKEY *dh)
|| !OSSL_PARAM_BLD_push_BN(tmpl, OSSL_PKEY_PARAM_FFC_G,
bn_g)
|| (params = OSSL_PARAM_BLD_to_param(tmpl)) == NULL) {
- BIO_printf(bio_err, "Error, failed to set DH parameters\n");
+ BIO_puts(bio_err, "Error, failed to set DH parameters\n");
goto err;
}
@@ -407,7 +407,7 @@ static EVP_PKEY *dsa_to_dh(EVP_PKEY *dh)
if (ctx == NULL
|| EVP_PKEY_fromdata_init(ctx) <= 0
|| EVP_PKEY_fromdata(ctx, &pkey, EVP_PKEY_KEY_PARAMETERS, params) <= 0) {
- BIO_printf(bio_err, "Error, failed to set DH parameters\n");
+ BIO_puts(bio_err, "Error, failed to set DH parameters\n");
goto err;
}
diff --git a/apps/dsa.c b/apps/dsa.c
index ac7172f41d..532001d527 100644
--- a/apps/dsa.c
+++ b/apps/dsa.c
@@ -174,23 +174,23 @@ int dsa_main(int argc, char **argv)
private = !pubin && (!pubout || text);
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {
- BIO_printf(bio_err, "Error getting passwords\n");
+ BIO_puts(bio_err, "Error getting passwords\n");
goto end;
}
- BIO_printf(bio_err, "read DSA key\n");
+ BIO_puts(bio_err, "read DSA key\n");
if (pubin)
pkey = load_pubkey(infile, informat, 1, passin, "public key");
else
pkey = load_key(infile, informat, 1, passin, "private key");
if (pkey == NULL) {
- BIO_printf(bio_err, "unable to load Key\n");
+ BIO_puts(bio_err, "unable to load Key\n");
ERR_print_errors(bio_err);
goto end;
}
if (!EVP_PKEY_is_a(pkey, "DSA")) {
- BIO_printf(bio_err, "Not a DSA key\n");
+ BIO_puts(bio_err, "Not a DSA key\n");
goto end;
}
@@ -215,9 +215,9 @@ int dsa_main(int argc, char **argv)
ERR_print_errors(bio_err);
goto end;
}
- BIO_printf(out, "Public Key=");
+ BIO_puts(out, "Public Key=");
BN_print(out, pub_key);
- BIO_printf(out, "\n");
+ BIO_puts(out, "\n");
BN_free(pub_key);
}
@@ -225,7 +225,7 @@ int dsa_main(int argc, char **argv)
ret = 0;
goto end;
}
- BIO_printf(bio_err, "writing DSA key\n");
+ BIO_puts(bio_err, "writing DSA key\n");
if (outformat == FORMAT_ASN1) {
output_type = "DER";
} else if (outformat == FORMAT_PEM) {
@@ -234,12 +234,12 @@ int dsa_main(int argc, char **argv)
output_type = "MSBLOB";
} else if (outformat == FORMAT_PVK) {
if (pubin) {
- BIO_printf(bio_err, "PVK form impossible with public key input\n");
+ BIO_puts(bio_err, "PVK form impossible with public key input\n");
goto end;
}
output_type = "PVK";
} else {
- BIO_printf(bio_err, "bad output format specified for outfile\n");
+ BIO_puts(bio_err, "bad output format specified for outfile\n");
goto end;
}
@@ -287,13 +287,13 @@ int dsa_main(int argc, char **argv)
params[0] = OSSL_PARAM_construct_int("encrypt-level", &pvk_encr);
if (!OSSL_ENCODER_CTX_set_params(ectx, params)) {
- BIO_printf(bio_err, "invalid PVK encryption level\n");
+ BIO_puts(bio_err, "invalid PVK encryption level\n");
goto end;
}
}
if (!OSSL_ENCODER_to_bio(ectx, out)) {
- BIO_printf(bio_err, "unable to write key\n");
+ BIO_puts(bio_err, "unable to write key\n");
goto end;
}
ret = 0;
diff --git a/apps/dsaparam.c b/apps/dsaparam.c
index cec9b7af4d..550ac8488c 100644
--- a/apps/dsaparam.c
+++ b/apps/dsaparam.c
@@ -153,7 +153,7 @@ int dsaparam_main(int argc, char **argv)
ctx = EVP_PKEY_CTX_new_from_name(app_get0_libctx(), "DSA", app_get0_propq());
if (ctx == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error, DSA parameter generation context allocation failed\n");
goto end;
}
@@ -167,23 +167,23 @@ int dsaparam_main(int argc, char **argv)
EVP_PKEY_CTX_set_app_data(ctx, bio_err);
if (verbose) {
EVP_PKEY_CTX_set_cb(ctx, progress_cb);
- BIO_printf(bio_err, "Generating DSA parameters, %d bit long prime\n",
+ BIO_printf(bio_err, "Generating DSA parameters, %d bit long prime\n"
+ "This could take some time\n",
num);
- BIO_printf(bio_err, "This could take some time\n");
}
if (EVP_PKEY_paramgen_init(ctx) <= 0) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error, DSA key generation paramgen init failed\n");
goto end;
}
if (EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, num) <= 0) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error, DSA key generation setting bit length failed\n");
goto end;
}
if (numqbits > 0) {
if (EVP_PKEY_CTX_set_dsa_paramgen_q_bits(ctx, numqbits) <= 0) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error, DSA key generation setting subprime bit length failed\n");
goto end;
}
@@ -214,7 +214,7 @@ int dsaparam_main(int argc, char **argv)
else
i = PEM_write_bio_Parameters(out, params);
if (!i) {
- BIO_printf(bio_err, "Error, unable to write DSA parameters\n");
+ BIO_puts(bio_err, "Error, unable to write DSA parameters\n");
goto end;
}
}
@@ -228,7 +228,7 @@ int dsaparam_main(int argc, char **argv)
goto end;
}
if (EVP_PKEY_keygen_init(ctx) <= 0) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error, unable to initialise for key generation\n");
goto end;
}
diff --git a/apps/ec.c b/apps/ec.c
index a5abc34ac3..4d0df11841 100644
--- a/apps/ec.c
+++ b/apps/ec.c
@@ -172,7 +172,7 @@ int ec_main(int argc, char **argv)
private = !pubin && (text || (!param_out && !pubout));
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {
- BIO_printf(bio_err, "Error getting passwords\n");
+ BIO_puts(bio_err, "Error getting passwords\n");
goto end;
}
@@ -182,7 +182,7 @@ int ec_main(int argc, char **argv)
eckey = load_key(infile, informat, 1, passin, "private key");
if (eckey == NULL) {
- BIO_printf(bio_err, "unable to load Key\n");
+ BIO_puts(bio_err, "unable to load Key\n");
goto end;
}
@@ -194,25 +194,25 @@ int ec_main(int argc, char **argv)
&& !EVP_PKEY_set_utf8_string_param(
eckey, OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT,
point_format)) {
- BIO_printf(bio_err, "unable to set point conversion format\n");
+ BIO_puts(bio_err, "unable to set point conversion format\n");
goto end;
}
if (asn1_encoding != NULL
&& !EVP_PKEY_set_utf8_string_param(
eckey, OSSL_PKEY_PARAM_EC_ENCODING, asn1_encoding)) {
- BIO_printf(bio_err, "unable to set asn1 encoding format\n");
+ BIO_puts(bio_err, "unable to set asn1 encoding format\n");
goto end;
}
if (no_public) {
if (!EVP_PKEY_set_int_param(eckey, OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC, 0)) {
- BIO_printf(bio_err, "unable to disable public key encoding\n");
+ BIO_puts(bio_err, "unable to disable public key encoding\n");
goto end;
}
} else {
if (!EVP_PKEY_set_int_param(eckey, OSSL_PKEY_PARAM_EC_INCLUDE_PUBLIC, 1)) {
- BIO_printf(bio_err, "unable to enable public key encoding\n");
+ BIO_puts(bio_err, "unable to enable public key encoding\n");
goto end;
}
}
@@ -221,7 +221,7 @@ int ec_main(int argc, char **argv)
assert(pubin || private);
if ((pubin && EVP_PKEY_print_public(out, eckey, 0, NULL) <= 0)
|| (!pubin && EVP_PKEY_print_private(out, eckey, 0, NULL) <= 0)) {
- BIO_printf(bio_err, "unable to print EC key\n");
+ BIO_puts(bio_err, "unable to print EC key\n");
goto end;
}
}
@@ -229,13 +229,13 @@ int ec_main(int argc, char **argv)
if (check) {
pctx = EVP_PKEY_CTX_new_from_pkey(NULL, eckey, NULL);
if (pctx == NULL) {
- BIO_printf(bio_err, "unable to check EC key\n");
+ BIO_puts(bio_err, "unable to check EC key\n");
goto end;
}
if (EVP_PKEY_check(pctx) <= 0)
- BIO_printf(bio_err, "EC Key Invalid!\n");
+ BIO_puts(bio_err, "EC Key Invalid!\n");
else
- BIO_printf(bio_err, "EC Key valid.\n");
+ BIO_puts(bio_err, "EC Key valid.\n");
ERR_print_errors(bio_err);
}
@@ -269,7 +269,7 @@ int ec_main(int argc, char **argv)
strlen(passout));
}
if (!OSSL_ENCODER_to_bio(ectx, out)) {
- BIO_printf(bio_err, "unable to write EC key\n");
+ BIO_puts(bio_err, "unable to write EC key\n");
goto end;
}
}
diff --git a/apps/ecparam.c b/apps/ecparam.c
index 27f8039e3b..bab4aab855 100644
--- a/apps/ecparam.c
+++ b/apps/ecparam.c
@@ -91,8 +91,7 @@ static int list_builtin_curves(BIO *out)
if (sname == NULL)
sname = "";
- BIO_printf(out, " %-10s: ", sname);
- BIO_printf(out, "%s\n", comment);
+ BIO_printf(out, " %-10s: %s\n", sname, comment);
}
OPENSSL_free(curves);
return 1;
@@ -210,11 +209,11 @@ int ecparam_main(int argc, char **argv)
OSSL_PARAM *p = params;
if (strcmp(curve_name, "secp192r1") == 0) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"using curve name prime192v1 instead of secp192r1\n");
curve_name = SN_X9_62_prime192v1;
} else if (strcmp(curve_name, "secp256r1") == 0) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"using curve name prime256v1 instead of secp256r1\n");
curve_name = SN_X9_62_prime256v1;
}
@@ -239,7 +238,7 @@ int ecparam_main(int argc, char **argv)
|| EVP_PKEY_keygen_init(gctx_params) <= 0
|| EVP_PKEY_CTX_set_params(gctx_params, params) <= 0
|| EVP_PKEY_keygen(gctx_params, ¶ms_key) <= 0) {
- BIO_printf(bio_err, "unable to generate key\n");
+ BIO_puts(bio_err, "unable to generate key\n");
goto end;
}
} else {
@@ -258,14 +257,14 @@ int ecparam_main(int argc, char **argv)
&& !EVP_PKEY_set_utf8_string_param(
params_key, OSSL_PKEY_PARAM_EC_POINT_CONVERSION_FORMAT,
point_format)) {
- BIO_printf(bio_err, "unable to set point conversion format\n");
+ BIO_puts(bio_err, "unable to set point conversion format\n");
goto end;
}
if (asn1_encoding != NULL
&& !EVP_PKEY_set_utf8_string_param(
params_key, OSSL_PKEY_PARAM_EC_ENCODING, asn1_encoding)) {
- BIO_printf(bio_err, "unable to set asn1 encoding format\n");
+ BIO_puts(bio_err, "unable to set asn1 encoding format\n");
goto end;
}
}
@@ -273,7 +272,7 @@ int ecparam_main(int argc, char **argv)
if (no_seed
&& !EVP_PKEY_set_octet_string_param(params_key, OSSL_PKEY_PARAM_EC_SEED,
NULL, 0)) {
- BIO_printf(bio_err, "unable to clear seed\n");
+ BIO_puts(bio_err, "unable to clear seed\n");
goto end;
}
@@ -283,27 +282,27 @@ int ecparam_main(int argc, char **argv)
if (text
&& EVP_PKEY_print_params(out, params_key, 0, NULL) <= 0) {
- BIO_printf(bio_err, "unable to print params\n");
+ BIO_puts(bio_err, "unable to print params\n");
goto end;
}
if (check || check_named) {
- BIO_printf(bio_err, "checking elliptic curve parameters: ");
+ BIO_puts(bio_err, "checking elliptic curve parameters: ");
if (check_named
&& !EVP_PKEY_set_utf8_string_param(params_key,
OSSL_PKEY_PARAM_EC_GROUP_CHECK_TYPE,
OSSL_PKEY_EC_GROUP_CHECK_NAMED)) {
- BIO_printf(bio_err, "unable to set check_type\n");
+ BIO_puts(bio_err, "unable to set check_type\n");
goto end;
}
pctx = EVP_PKEY_CTX_new_from_pkey(app_get0_libctx(), params_key,
app_get0_propq());
if (pctx == NULL || EVP_PKEY_param_check(pctx) <= 0) {
- BIO_printf(bio_err, "failed\n");
+ BIO_puts(bio_err, "failed\n");
goto end;
}
- BIO_printf(bio_err, "ok\n");
+ BIO_puts(bio_err, "ok\n");
}
if (outformat == FORMAT_ASN1 && genkey)
@@ -314,7 +313,7 @@ int ecparam_main(int argc, char **argv)
params_key, OSSL_KEYMGMT_SELECT_DOMAIN_PARAMETERS,
outformat == FORMAT_ASN1 ? "DER" : "PEM", NULL, NULL);
if (!OSSL_ENCODER_to_bio(ectx_params, out)) {
- BIO_printf(bio_err, "unable to write elliptic curve parameters\n");
+ BIO_puts(bio_err, "unable to write elliptic curve parameters\n");
goto end;
}
}
@@ -332,7 +331,7 @@ int ecparam_main(int argc, char **argv)
app_get0_propq());
if (EVP_PKEY_keygen_init(gctx_key) <= 0
|| EVP_PKEY_keygen(gctx_key, &key) <= 0) {
- BIO_printf(bio_err, "unable to generate key\n");
+ BIO_puts(bio_err, "unable to generate key\n");
goto end;
}
assert(private);
@@ -340,8 +339,8 @@ int ecparam_main(int argc, char **argv)
key, OSSL_KEYMGMT_SELECT_ALL,
outformat == FORMAT_ASN1 ? "DER" : "PEM", NULL, NULL);
if (!OSSL_ENCODER_to_bio(ectx_key, out)) {
- BIO_printf(bio_err, "unable to write elliptic "
- "curve parameters\n");
+ BIO_puts(bio_err, "unable to write elliptic "
+ "curve parameters\n");
goto end;
}
}
diff --git a/apps/enc.c b/apps/enc.c
index 57e66e4e38..8f2bd72815 100644
--- a/apps/enc.c
+++ b/apps/enc.c
@@ -243,12 +243,12 @@ int enc_main(int argc, char **argv)
ret = 0;
goto end;
case OPT_LIST:
- BIO_printf(bio_out, "Supported ciphers:\n");
+ BIO_puts(bio_out, "Supported ciphers:\n");
dec.bio = bio_out;
dec.n = 0;
OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_CIPHER_METH,
show_ciphers, &dec);
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, "\n");
ret = 0;
goto end;
case OPT_E:
@@ -424,7 +424,7 @@ int enc_main(int argc, char **argv)
if (base64 && bsize < 80)
bsize = 80;
if (verbose)
- BIO_printf(bio_err, "bufsize=%d\n", bsize);
+ BIO_printf(bio_out, "bufsize=%d\n", bsize);
#ifndef OPENSSL_NO_ZLIB
if (do_zlib)
@@ -447,7 +447,7 @@ int enc_main(int argc, char **argv)
if (infile == NULL) {
if (!streamable && printkey != 2) { /* if just print key and exit, it's ok */
- BIO_printf(bio_err, "Unstreamable cipher mode\n");
+ BIO_puts(bio_err, "Unstreamable cipher mode\n");
goto end;
}
in = dup_bio_in(informat);
@@ -459,7 +459,7 @@ int enc_main(int argc, char **argv)
if (str == NULL && passarg != NULL) {
if (!app_passwd(passarg, NULL, &pass, NULL)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
goto end;
}
str = pass;
@@ -486,13 +486,13 @@ int enc_main(int argc, char **argv)
break;
}
if (i < 0) {
- BIO_printf(bio_err, "bad password read\n");
+ BIO_puts(bio_err, "bad password read\n");
goto end;
}
}
} else {
#endif
- BIO_printf(bio_err, "password required\n");
+ BIO_puts(bio_err, "password required\n");
goto end;
}
}
@@ -583,13 +583,13 @@ int enc_main(int argc, char **argv)
sptr = NULL;
} else {
if (hsalt != NULL && !set_hex(hsalt, salt, saltlen)) {
- BIO_printf(bio_err, "invalid hex salt value\n");
+ BIO_puts(bio_err, "invalid hex salt value\n");
goto end;
}
if (enc) { /* encryption */
if (hsalt == NULL) {
if (RAND_bytes(salt, saltlen) <= 0) {
- BIO_printf(bio_err, "RAND_bytes failed\n");
+ BIO_puts(bio_err, "RAND_bytes failed\n");
goto end;
}
/*
@@ -604,25 +604,25 @@ int enc_main(int argc, char **argv)
(char *)salt,
saltlen)
!= saltlen)) {
- BIO_printf(bio_err, "error writing output file\n");
+ BIO_puts(bio_err, "error writing output file\n");
goto end;
}
}
} else { /* decryption */
if (hsalt == NULL) {
if (BIO_read(rbio, mbuf, sizeof(mbuf)) != sizeof(mbuf)) {
- BIO_printf(bio_err, "error reading input file\n");
+ BIO_puts(bio_err, "error reading input file\n");
goto end;
}
if (memcmp(mbuf, magic, sizeof(mbuf)) == 0) { /* file IS salted */
if (BIO_read(rbio, salt,
saltlen)
!= saltlen) {
- BIO_printf(bio_err, "error reading input file\n");
+ BIO_puts(bio_err, "error reading input file\n");
goto end;
}
} else { /* file is NOT salted, NO salt available */
- BIO_printf(bio_err, "bad magic number\n");
+ BIO_puts(bio_err, "bad magic number\n");
goto end;
}
}
@@ -643,7 +643,7 @@ int enc_main(int argc, char **argv)
if (!PKCS5_PBKDF2_HMAC(str, (int)str_len, sptr, islen,
iter, dgst, iklen + ivlen, tmpkeyiv)) {
- BIO_printf(bio_err, "PKCS5_PBKDF2_HMAC failed\n");
+ BIO_puts(bio_err, "PKCS5_PBKDF2_HMAC failed\n");
goto end;
}
/* split and move data back to global buffer */
@@ -651,13 +651,13 @@ int enc_main(int argc, char **argv)
memcpy(iv, tmpkeyiv + iklen, ivlen);
rawkey_set = 1;
} else {
- BIO_printf(bio_err, "*** WARNING : "
- "deprecated key derivation used.\n"
- "Using -iter or -pbkdf2 would be better.\n");
+ BIO_puts(bio_err, "*** WARNING : "
+ "deprecated key derivation used.\n"
+ "Using -iter or -pbkdf2 would be better.\n");
if (!EVP_BytesToKey(cipher, dgst, sptr,
(unsigned char *)str, (int)str_len,
1, key, iv)) {
- BIO_printf(bio_err, "EVP_BytesToKey failed\n");
+ BIO_puts(bio_err, "EVP_BytesToKey failed\n");
goto end;
}
rawkey_set = 1;
@@ -675,9 +675,9 @@ int enc_main(int argc, char **argv)
int siz = EVP_CIPHER_get_iv_length(cipher);
if (siz == 0) {
- BIO_printf(bio_err, "warning: iv not used by this cipher\n");
+ BIO_puts(bio_err, "warning: iv not used by this cipher\n");
} else if (!set_hex(hiv, iv, siz)) {
- BIO_printf(bio_err, "invalid hex iv value\n");
+ BIO_puts(bio_err, "invalid hex iv value\n");
goto end;
}
}
@@ -688,12 +688,12 @@ int enc_main(int argc, char **argv)
* No IV was explicitly set and no IV was generated.
* Hence the IV is undefined, making correct decryption impossible.
*/
- BIO_printf(bio_err, "iv undefined\n");
+ BIO_puts(bio_err, "iv undefined\n");
goto end;
}
if (hkey != NULL) {
if (!set_hex(hkey, key, EVP_CIPHER_get_key_length(cipher))) {
- BIO_printf(bio_err, "invalid hex key value\n");
+ BIO_puts(bio_err, "invalid hex key value\n");
goto end;
}
/* wiping secret data as we no longer need it */
@@ -706,7 +706,7 @@ int enc_main(int argc, char **argv)
* or an opaque symmetric key. We do not allow both options simultaneously.
*/
if (rawkey_set > 0 && (skeyopts != NULL || skeyuri != NULL)) {
- BIO_printf(bio_err, "Either a raw key or the skeyopt/skeyuri args must be used.\n");
+ BIO_puts(bio_err, "Either a raw key or the skeyopt/skeyuri args must be used.\n");
goto end;
}
@@ -735,7 +735,7 @@ int enc_main(int argc, char **argv)
char *storepass = NULL;
if (!app_passwd(storepassarg, NULL, &storepass, NULL)) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error getting store password from 'storepass' argument\n");
}
@@ -806,11 +806,11 @@ int enc_main(int argc, char **argv)
if (inl <= 0)
break;
if (!streamable && !BIO_eof(rbio)) { /* do not output data */
- BIO_printf(bio_err, "Unstreamable cipher mode\n");
+ BIO_puts(bio_err, "Unstreamable cipher mode\n");
goto end;
}
if (BIO_write(wbio, (char *)buff, inl) != inl) {
- BIO_printf(bio_err, "error writing output file\n");
+ BIO_puts(bio_err, "error writing output file\n");
goto end;
}
if (!streamable)
@@ -818,16 +818,17 @@ int enc_main(int argc, char **argv)
}
if (!BIO_flush(wbio)) {
if (enc)
- BIO_printf(bio_err, "bad encrypt\n");
+ BIO_puts(bio_err, "bad encrypt\n");
else
- BIO_printf(bio_err, "bad decrypt\n");
+ BIO_puts(bio_err, "bad decrypt\n");
goto end;
}
ret = 0;
if (verbose) {
- BIO_printf(bio_err, "bytes read : %8ju\n", BIO_number_read(in));
- BIO_printf(bio_err, "bytes written: %8ju\n", BIO_number_written(out));
+ BIO_printf(bio_err, "bytes read : %8ju\n"
+ "bytes written: %8ju\n",
+ BIO_number_read(in), BIO_number_written(out));
}
end:
ERR_print_errors(bio_err);
@@ -868,10 +869,10 @@ static void show_ciphers(const OBJ_NAME *name, void *arg)
BIO_printf(dec->bio, "-%-25s", name->name);
if (++dec->n == 3) {
- BIO_printf(dec->bio, "\n");
+ BIO_puts(dec->bio, "\n");
dec->n = 0;
} else
- BIO_printf(dec->bio, " ");
+ BIO_puts(dec->bio, " ");
}
static int set_hex(const char *in, unsigned char *out, int size)
@@ -882,17 +883,17 @@ static int set_hex(const char *in, unsigned char *out, int size)
i = size * 2;
n = (int)strlen(in);
if (n > i) {
- BIO_printf(bio_err, "hex string is too long, ignoring excess\n");
+ BIO_puts(bio_err, "hex string is too long, ignoring excess\n");
n = i; /* ignore exceeding part */
} else if (n < i) {
- BIO_printf(bio_err, "hex string is too short, padding with zero bytes to length\n");
+ BIO_puts(bio_err, "hex string is too short, padding with zero bytes to length\n");
}
memset(out, 0, size);
for (i = 0; i < n; i++) {
j = (unsigned char)*in++;
if (!isxdigit(j)) {
- BIO_printf(bio_err, "non-hex digit\n");
+ BIO_puts(bio_err, "non-hex digit\n");
return 0;
}
j = (unsigned char)OPENSSL_hexchar2int(j);
diff --git a/apps/fipsinstall.c b/apps/fipsinstall.c
index 1341a3f826..ef2567c819 100644
--- a/apps/fipsinstall.c
+++ b/apps/fipsinstall.c
@@ -314,7 +314,7 @@ static int load_fips_prov_and_run_self_test(const char *prov_name,
prov = OSSL_PROVIDER_load(NULL, prov_name);
if (prov == NULL) {
- BIO_printf(bio_err, "Failed to load FIPS module\n");
+ BIO_puts(bio_err, "Failed to load FIPS module\n");
goto end;
}
if (!quiet) {
@@ -326,7 +326,7 @@ static int load_fips_prov_and_run_self_test(const char *prov_name,
&build, sizeof(build));
*p = OSSL_PARAM_construct_end();
if (!OSSL_PROVIDER_get_params(prov, params)) {
- BIO_printf(bio_err, "Failed to query FIPS module parameters\n");
+ BIO_puts(bio_err, "Failed to query FIPS module parameters\n");
goto end;
}
if (OSSL_PARAM_modified(params))
@@ -340,7 +340,7 @@ static int load_fips_prov_and_run_self_test(const char *prov_name,
&vers, sizeof(vers));
*p = OSSL_PARAM_construct_end();
if (!OSSL_PROVIDER_get_params(prov, params)) {
- BIO_printf(bio_err, "Failed to query FIPS module parameters\n");
+ BIO_puts(bio_err, "Failed to query FIPS module parameters\n");
goto end;
}
}
@@ -368,11 +368,13 @@ static int print_mac(BIO *bio, const char *label, const unsigned char *mac,
static int write_config_header(BIO *out, const char *prov_name,
const char *section)
{
- return BIO_printf(out, "openssl_conf = openssl_init\n\n")
- && BIO_printf(out, "[openssl_init]\n")
- && BIO_printf(out, "providers = provider_section\n\n")
- && BIO_printf(out, "[provider_section]\n")
- && BIO_printf(out, "%s = %s\n\n", prov_name, section);
+ return (BIO_printf(out, "openssl_conf = openssl_init\n\n"
+ "[openssl_init]\n"
+ "providers = provider_section\n\n"
+ "[provider_section]\n"
+ "%s = %s\n\n",
+ prov_name, section)
+ > 0);
}
/*
@@ -391,106 +393,69 @@ static int write_config_fips_section(BIO *out, const char *section,
{
int ret = 0;
- if (BIO_printf(out, "[%s]\n", section) <= 0
- || BIO_printf(out, "activate = 1\n") <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_FIPS_PARAM_INSTALL_VERSION,
- VERSION_VAL)
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_FIPS_PARAM_CONDITIONAL_ERRORS,
- opts->conditional_errors ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_SECURITY_CHECKS,
- opts->security_checks ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_HMAC_KEY_CHECK,
- opts->hmac_key_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_KMAC_KEY_CHECK,
- opts->kmac_key_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_TLS1_PRF_EMS_CHECK,
- opts->tls_prf_ems_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_NO_SHORT_MAC,
- opts->no_short_mac ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_DRBG_TRUNC_DIGEST,
- opts->drgb_no_trunc_dgst ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_SIGNATURE_DIGEST_CHECK,
- opts->signature_digest_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_HKDF_DIGEST_CHECK,
- opts->hkdf_digest_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n",
- OSSL_PROV_PARAM_TLS13_KDF_DIGEST_CHECK,
- opts->tls13_kdf_digest_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n",
- OSSL_PROV_PARAM_TLS1_PRF_DIGEST_CHECK,
- opts->tls1_prf_digest_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n",
- OSSL_PROV_PARAM_SSHKDF_DIGEST_CHECK,
- opts->sshkdf_digest_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_SSKDF_DIGEST_CHECK,
- opts->sskdf_digest_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n",
- OSSL_PROV_PARAM_X963KDF_DIGEST_CHECK,
- opts->x963kdf_digest_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_DSA_SIGN_DISABLED,
- opts->dsa_sign_disabled ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_TDES_ENCRYPT_DISABLED,
- opts->tdes_encrypt_disabled ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n",
- OSSL_PROV_PARAM_RSA_PKCS15_PAD_DISABLED,
- opts->rsa_pkcs15_padding_disabled ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n",
- OSSL_PROV_PARAM_RSA_PSS_SALTLEN_CHECK,
- opts->rsa_pss_saltlen_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n",
- OSSL_PROV_PARAM_RSA_SIGN_X931_PAD_DISABLED,
- opts->sign_x931_padding_disabled ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_HKDF_KEY_CHECK,
- opts->hkdf_key_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_KBKDF_KEY_CHECK,
- opts->kbkdf_key_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n",
- OSSL_PROV_PARAM_TLS13_KDF_KEY_CHECK,
- opts->tls13_kdf_key_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_TLS1_PRF_KEY_CHECK,
- opts->tls1_prf_key_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_SSHKDF_KEY_CHECK,
- opts->sshkdf_key_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_SSKDF_KEY_CHECK,
- opts->sskdf_key_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_X963KDF_KEY_CHECK,
- opts->x963kdf_key_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_X942KDF_KEY_CHECK,
- opts->x942kdf_key_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n",
- OSSL_PROV_PARAM_PBKDF2_LOWER_BOUND_CHECK,
- opts->pbkdf2_lower_bound_check ? "1" : "0")
- <= 0
- || BIO_printf(out, "%s = %s\n", OSSL_PROV_PARAM_ECDH_COFACTOR_CHECK,
- opts->ecdh_cofactor_check ? "1" : "0")
+ if (BIO_printf(out, "[%s]\n"
+ "activate = 1\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n"
+ "%s = %s\n",
+ section,
+ OSSL_PROV_FIPS_PARAM_INSTALL_VERSION, VERSION_VAL,
+ OSSL_PROV_FIPS_PARAM_CONDITIONAL_ERRORS, opts->conditional_errors ? "1" : "0",
+ OSSL_PROV_PARAM_SECURITY_CHECKS, opts->security_checks ? "1" : "0",
+ OSSL_PROV_PARAM_HMAC_KEY_CHECK, opts->hmac_key_check ? "1" : "0",
+ OSSL_PROV_PARAM_KMAC_KEY_CHECK, opts->kmac_key_check ? "1" : "0",
+ OSSL_PROV_PARAM_TLS1_PRF_EMS_CHECK, opts->tls_prf_ems_check ? "1" : "0",
+ OSSL_PROV_PARAM_NO_SHORT_MAC, opts->no_short_mac ? "1" : "0",
+ OSSL_PROV_PARAM_DRBG_TRUNC_DIGEST, opts->drgb_no_trunc_dgst ? "1" : "0",
+ OSSL_PROV_PARAM_SIGNATURE_DIGEST_CHECK, opts->signature_digest_check ? "1" : "0",
+ OSSL_PROV_PARAM_HKDF_DIGEST_CHECK, opts->hkdf_digest_check ? "1" : "0",
+ OSSL_PROV_PARAM_TLS13_KDF_DIGEST_CHECK, opts->tls13_kdf_digest_check ? "1" : "0",
+ OSSL_PROV_PARAM_TLS1_PRF_DIGEST_CHECK, opts->tls1_prf_digest_check ? "1" : "0",
+ OSSL_PROV_PARAM_SSHKDF_DIGEST_CHECK, opts->sshkdf_digest_check ? "1" : "0",
+ OSSL_PROV_PARAM_SSKDF_DIGEST_CHECK, opts->sskdf_digest_check ? "1" : "0",
+ OSSL_PROV_PARAM_X963KDF_DIGEST_CHECK, opts->x963kdf_digest_check ? "1" : "0",
+ OSSL_PROV_PARAM_DSA_SIGN_DISABLED, opts->dsa_sign_disabled ? "1" : "0",
+ OSSL_PROV_PARAM_TDES_ENCRYPT_DISABLED, opts->tdes_encrypt_disabled ? "1" : "0",
+ OSSL_PROV_PARAM_RSA_PKCS15_PAD_DISABLED, opts->rsa_pkcs15_padding_disabled ? "1" : "0",
+ OSSL_PROV_PARAM_RSA_PSS_SALTLEN_CHECK, opts->rsa_pss_saltlen_check ? "1" : "0",
+ OSSL_PROV_PARAM_RSA_SIGN_X931_PAD_DISABLED, opts->sign_x931_padding_disabled ? "1" : "0",
+ OSSL_PROV_PARAM_HKDF_KEY_CHECK, opts->hkdf_key_check ? "1" : "0",
+ OSSL_PROV_PARAM_KBKDF_KEY_CHECK, opts->kbkdf_key_check ? "1" : "0",
+ OSSL_PROV_PARAM_TLS13_KDF_KEY_CHECK, opts->tls13_kdf_key_check ? "1" : "0",
+ OSSL_PROV_PARAM_TLS1_PRF_KEY_CHECK, opts->tls1_prf_key_check ? "1" : "0",
+ OSSL_PROV_PARAM_SSHKDF_KEY_CHECK, opts->sshkdf_key_check ? "1" : "0",
+ OSSL_PROV_PARAM_SSKDF_KEY_CHECK, opts->sskdf_key_check ? "1" : "0",
+ OSSL_PROV_PARAM_X963KDF_KEY_CHECK, opts->x963kdf_key_check ? "1" : "0",
+ OSSL_PROV_PARAM_X942KDF_KEY_CHECK, opts->x942kdf_key_check ? "1" : "0",
+ OSSL_PROV_PARAM_PBKDF2_LOWER_BOUND_CHECK, opts->pbkdf2_lower_bound_check ? "1" : "0",
+ OSSL_PROV_PARAM_ECDH_COFACTOR_CHECK, opts->ecdh_cofactor_check ? "1" : "0")
<= 0
|| !print_mac(out, OSSL_PROV_FIPS_PARAM_MODULE_MAC, module_mac,
module_mac_len)
@@ -580,37 +545,37 @@ static int verify_config(const char *infile, const char *section,
s = NCONF_get_string(conf, section, OSSL_PROV_FIPS_PARAM_INSTALL_VERSION);
if (s == NULL || strcmp(s, VERSION_VAL) != 0) {
- BIO_printf(bio_err, "version not found\n");
+ BIO_puts(bio_err, "version not found\n");
goto end;
}
s = NCONF_get_string(conf, section, OSSL_PROV_FIPS_PARAM_MODULE_MAC);
if (s == NULL) {
- BIO_printf(bio_err, "Module integrity MAC not found\n");
+ BIO_puts(bio_err, "Module integrity MAC not found\n");
goto end;
}
buf1 = OPENSSL_hexstr2buf(s, &len);
if (buf1 == NULL
|| (size_t)len != module_mac_len
|| memcmp(module_mac, buf1, module_mac_len) != 0) {
- BIO_printf(bio_err, "Module integrity mismatch\n");
+ BIO_puts(bio_err, "Module integrity mismatch\n");
goto end;
}
if (install_mac != NULL && install_mac_len > 0) {
s = NCONF_get_string(conf, section, OSSL_PROV_FIPS_PARAM_INSTALL_STATUS);
if (s == NULL || strcmp(s, INSTALL_STATUS_VAL) != 0) {
- BIO_printf(bio_err, "install status not found\n");
+ BIO_puts(bio_err, "install status not found\n");
goto end;
}
s = NCONF_get_string(conf, section, OSSL_PROV_FIPS_PARAM_INSTALL_MAC);
if (s == NULL) {
- BIO_printf(bio_err, "Install indicator MAC not found\n");
+ BIO_puts(bio_err, "Install indicator MAC not found\n");
goto end;
}
buf2 = OPENSSL_hexstr2buf(s, &len);
if (buf2 == NULL
|| (size_t)len != install_mac_len
|| memcmp(install_mac, buf2, install_mac_len) != 0) {
- BIO_printf(bio_err, "Install indicator status mismatch\n");
+ BIO_puts(bio_err, "Install indicator status mismatch\n");
goto end;
}
}
@@ -861,7 +826,7 @@ int fipsinstall_main(int argc, char **argv)
module_bio = bio_open_default(module_fname, 'r', FORMAT_BINARY);
if (module_bio == NULL) {
- BIO_printf(bio_err, "Failed to open module file\n");
+ BIO_puts(bio_err, "Failed to open module file\n");
goto end;
}
@@ -877,7 +842,7 @@ int fipsinstall_main(int argc, char **argv)
ctx = EVP_MAC_CTX_new(mac);
if (ctx == NULL) {
- BIO_printf(bio_err, "Unable to create MAC CTX for module check\n");
+ BIO_puts(bio_err, "Unable to create MAC CTX for module check\n");
goto end;
}
@@ -889,7 +854,7 @@ int fipsinstall_main(int argc, char **argv)
goto end;
if (!EVP_MAC_CTX_set_params(ctx, params)) {
- BIO_printf(bio_err, "MAC parameter error\n");
+ BIO_puts(bio_err, "MAC parameter error\n");
ERR_print_errors(bio_err);
ok = 0;
}
@@ -900,7 +865,7 @@ int fipsinstall_main(int argc, char **argv)
ctx2 = EVP_MAC_CTX_dup(ctx);
if (ctx2 == NULL) {
- BIO_printf(bio_err, "Unable to create MAC CTX for install indicator\n");
+ BIO_puts(bio_err, "Unable to create MAC CTX for install indicator\n");
goto end;
}
@@ -911,7 +876,7 @@ int fipsinstall_main(int argc, char **argv)
mem_bio = BIO_new_mem_buf((const void *)INSTALL_STATUS_VAL,
(int)strlen(INSTALL_STATUS_VAL));
if (mem_bio == NULL) {
- BIO_printf(bio_err, "Unable to create memory BIO\n");
+ BIO_puts(bio_err, "Unable to create memory BIO\n");
goto end;
}
if (!do_mac(ctx2, read_buffer, mem_bio, install_mac, &install_mac_len))
@@ -924,7 +889,7 @@ int fipsinstall_main(int argc, char **argv)
install_mac, install_mac_len))
goto end;
if (!quiet)
- BIO_printf(bio_err, "VERIFY PASSED\n");
+ BIO_puts(bio_err, "VERIFY PASSED\n");
} else {
conf = generate_config_and_load(prov_name, section_name, module_mac,
module_mac_len, &fips_opts);
@@ -947,7 +912,7 @@ int fipsinstall_main(int argc, char **argv)
fout = out_fname == NULL ? dup_bio_out(FORMAT_TEXT)
: bio_open_default(out_fname, 'w', FORMAT_TEXT);
if (fout == NULL) {
- BIO_printf(bio_err, "Failed to open file\n");
+ BIO_puts(bio_err, "Failed to open file\n");
goto end;
}
@@ -956,7 +921,7 @@ int fipsinstall_main(int argc, char **argv)
install_mac, install_mac_len))
goto end;
if (!quiet)
- BIO_printf(bio_err, "INSTALL PASSED\n");
+ BIO_puts(bio_err, "INSTALL PASSED\n");
}
ret = 0;
diff --git a/apps/gendsa.c b/apps/gendsa.c
index bc0f5e5ba1..539f468303 100644
--- a/apps/gendsa.c
+++ b/apps/gendsa.c
@@ -117,7 +117,7 @@ int gendsa_main(int argc, char **argv)
private = 1;
if (!app_passwd(NULL, passoutarg, NULL, &passout)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
goto end;
}
@@ -136,13 +136,13 @@ int gendsa_main(int argc, char **argv)
ctx = EVP_PKEY_CTX_new_from_pkey(app_get0_libctx(), pkey, app_get0_propq());
if (ctx == NULL) {
- BIO_printf(bio_err, "unable to create PKEY context\n");
+ BIO_puts(bio_err, "unable to create PKEY context\n");
goto end;
}
EVP_PKEY_free(pkey);
pkey = NULL;
if (EVP_PKEY_keygen_init(ctx) <= 0) {
- BIO_printf(bio_err, "unable to set up for key generation\n");
+ BIO_puts(bio_err, "unable to set up for key generation\n");
goto end;
}
pkey = app_keygen(ctx, "DSA", nbits, verbose);
@@ -151,7 +151,7 @@ int gendsa_main(int argc, char **argv)
assert(private);
if (!PEM_write_bio_PrivateKey(out, pkey, enc, NULL, 0, NULL, passout)) {
- BIO_printf(bio_err, "unable to output generated key\n");
+ BIO_puts(bio_err, "unable to output generated key\n");
goto end;
}
ret = 0;
diff --git a/apps/genpkey.c b/apps/genpkey.c
index aa8089b301..8ad80a16a7 100644
--- a/apps/genpkey.c
+++ b/apps/genpkey.c
@@ -108,7 +108,7 @@ static void show_gen_pkeyopt(const char *algname, OSSL_LIB_CTX *libctx, const ch
if (params == NULL)
goto cleanup;
- BIO_printf(bio_err, "\nThe possible -pkeyopt arguments are:\n");
+ BIO_puts(bio_err, "\nThe possible -pkeyopt arguments are:\n");
for (i = 0; params[i].key != NULL; ++i) {
const char *name = param_datatype_2name(params[i].data_type, &ishex);
@@ -245,7 +245,7 @@ int genpkey_main(int argc, char **argv)
if (!opt_cipher(ciphername, &cipher))
goto opthelp;
if (ciphername != NULL && do_param == 1) {
- BIO_printf(bio_err, "Cannot use cipher with -genparam option\n");
+ BIO_puts(bio_err, "Cannot use cipher with -genparam option\n");
goto opthelp;
}
@@ -290,7 +290,7 @@ int genpkey_main(int argc, char **argv)
if (rv > 0 && mem_outpubkey != NULL)
rv = i2d_PUBKEY_bio(mem_outpubkey, pkey);
} else {
- BIO_printf(bio_err, "Bad format specified for key\n");
+ BIO_puts(bio_err, "Bad format specified for key\n");
goto end;
}
diff --git a/apps/genrsa.c b/apps/genrsa.c
index 1412d3cf34..a52fc168fe 100644
--- a/apps/genrsa.c
+++ b/apps/genrsa.c
@@ -171,7 +171,7 @@ int genrsa_main(int argc, char **argv)
if (!opt_cipher(ciphername, &enc))
goto end;
if (!app_passwd(NULL, passoutarg, NULL, &passout)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
goto end;
}
@@ -188,19 +188,19 @@ int genrsa_main(int argc, char **argv)
EVP_PKEY_CTX_set_app_data(ctx, bio_err);
if (EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, num) <= 0) {
- BIO_printf(bio_err, "Error setting RSA length\n");
+ BIO_puts(bio_err, "Error setting RSA length\n");
goto end;
}
if (!BN_set_word(bn, f4)) {
- BIO_printf(bio_err, "Error allocating RSA public exponent\n");
+ BIO_puts(bio_err, "Error allocating RSA public exponent\n");
goto end;
}
if (EVP_PKEY_CTX_set1_rsa_keygen_pubexp(ctx, bn) <= 0) {
- BIO_printf(bio_err, "Error setting RSA public exponent\n");
+ BIO_puts(bio_err, "Error setting RSA public exponent\n");
goto end;
}
if (EVP_PKEY_CTX_set_rsa_keygen_primes(ctx, primes) <= 0) {
- BIO_printf(bio_err, "Error setting number of primes\n");
+ BIO_puts(bio_err, "Error setting number of primes\n");
goto end;
}
pkey = app_keygen(ctx, "RSA", num, verbose);
@@ -213,7 +213,7 @@ int genrsa_main(int argc, char **argv)
/* Every RSA key has an 'e' */
EVP_PKEY_get_bn_param(pkey, "e", &e);
if (e == NULL) {
- BIO_printf(bio_err, "Error cannot access RSA e\n");
+ BIO_puts(bio_err, "Error cannot access RSA e\n");
goto end;
}
hexe = BN_bn2hex(e);
diff --git a/apps/kdf.c b/apps/kdf.c
index dae13c8fcf..22643cb6a1 100644
--- a/apps/kdf.c
+++ b/apps/kdf.c
@@ -162,7 +162,7 @@ int kdf_main(int argc, char **argv)
goto err;
if (!EVP_KDF_CTX_set_params(ctx, params)) {
- BIO_printf(bio_err, "KDF parameter error\n");
+ BIO_puts(bio_err, "KDF parameter error\n");
ERR_print_errors(bio_err);
ok = 0;
}
@@ -176,7 +176,7 @@ int kdf_main(int argc, char **argv)
goto err;
if (dkm_len <= 0) {
- BIO_printf(bio_err, "Invalid derived key length.\n");
+ BIO_puts(bio_err, "Invalid derived key length.\n");
goto err;
}
dkm_bytes = app_malloc(dkm_len, "out buffer");
@@ -184,7 +184,7 @@ int kdf_main(int argc, char **argv)
goto err;
if (!EVP_KDF_derive(ctx, dkm_bytes, dkm_len, NULL)) {
- BIO_printf(bio_err, "EVP_KDF_derive failed\n");
+ BIO_puts(bio_err, "EVP_KDF_derive failed\n");
goto err;
}
@@ -193,7 +193,7 @@ int kdf_main(int argc, char **argv)
} else {
hexout = OPENSSL_buf2hexstr(dkm_bytes, dkm_len);
if (hexout == NULL) {
- BIO_printf(bio_err, "Memory allocation failure\n");
+ BIO_puts(bio_err, "Memory allocation failure\n");
goto err;
}
BIO_printf(out, "%s\n\n", hexout);
diff --git a/apps/lib/app_params.c b/apps/lib/app_params.c
index cfd48ebc35..ebbedbe8be 100644
--- a/apps/lib/app_params.c
+++ b/apps/lib/app_params.c
@@ -158,13 +158,13 @@ void print_param_value(const OSSL_PARAM *p, int indent)
if (OSSL_PARAM_get_uint64(p, &u))
BIO_printf(bio_out, "%llu\n", (unsigned long long int)u);
else
- BIO_printf(bio_out, "error getting value\n");
+ BIO_puts(bio_out, "error getting value\n");
break;
case OSSL_PARAM_INTEGER:
if (OSSL_PARAM_get_int64(p, &i))
BIO_printf(bio_out, "%lld\n", (long long int)i);
else
- BIO_printf(bio_out, "error getting value\n");
+ BIO_puts(bio_out, "error getting value\n");
break;
case OSSL_PARAM_UTF8_PTR:
print_param_utf8((const char **)p->data, p->return_size);
diff --git a/apps/lib/app_rand.c b/apps/lib/app_rand.c
index 061211a0b6..7bcd59e116 100644
--- a/apps/lib/app_rand.c
+++ b/apps/lib/app_rand.c
@@ -84,7 +84,7 @@ int app_RAND_write(void)
if (save_rand_file == NULL)
return 1;
if (RAND_write_file(save_rand_file) == -1) {
- BIO_printf(bio_err, "Cannot write random bytes:\n");
+ BIO_puts(bio_err, "Cannot write random bytes:\n");
ERR_print_errors(bio_err);
ret = 0;
}
diff --git a/apps/lib/app_x509.c b/apps/lib/app_x509.c
index 11cb3fa342..4c1e94d887 100644
--- a/apps/lib/app_x509.c
+++ b/apps/lib/app_x509.c
@@ -25,7 +25,7 @@ static ASN1_OCTET_STRING *mk_octet_string(void *value, size_t value_n)
ASN1_OCTET_STRING *v = ASN1_OCTET_STRING_new();
if (v == NULL) {
- BIO_printf(bio_err, "error: allocation failed\n");
+ BIO_puts(bio_err, "error: allocation failed\n");
} else if (!ASN1_OCTET_STRING_set(v, value, (int)value_n)) {
ASN1_OCTET_STRING_free(v);
v = NULL;
@@ -42,7 +42,7 @@ static int x509_ctrl(void *object, int cmd, void *value, size_t value_n)
ASN1_OCTET_STRING *v = mk_octet_string(value, value_n);
if (v == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"error: setting distinguishing ID in certificate failed\n");
return 0;
}
@@ -65,7 +65,7 @@ static int x509_req_ctrl(void *object, int cmd, void *value, size_t value_n)
ASN1_OCTET_STRING *v = mk_octet_string(value, value_n);
if (v == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"error: setting distinguishing ID in certificate signing request failed\n");
return 0;
}
diff --git a/apps/lib/apps.c b/apps/lib/apps.c
index adab4d94a7..2ae56e2c15 100644
--- a/apps/lib/apps.c
+++ b/apps/lib/apps.c
@@ -163,7 +163,7 @@ char *get_passwd(const char *pass, const char *desc)
if (!app_passwd(pass, NULL, &result, NULL))
BIO_printf(bio_err, "Error getting password for %s\n", desc);
if (pass != NULL && result == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Trying plain input string (better precede with 'pass:')\n");
result = OPENSSL_strdup(pass);
if (result == NULL)
@@ -244,7 +244,7 @@ static char *app_get_pass(const char *arg, int keepbio)
if (btmp == NULL) {
BIO_free_all(pwdbio);
pwdbio = NULL;
- BIO_printf(bio_err, "Out of memory\n");
+ BIO_puts(bio_err, "Out of memory\n");
return NULL;
}
pwdbio = BIO_push(btmp, pwdbio);
@@ -253,7 +253,7 @@ static char *app_get_pass(const char *arg, int keepbio)
unbuffer(stdin);
pwdbio = dup_bio_in(FORMAT_TEXT);
if (pwdbio == NULL) {
- BIO_printf(bio_err, "Can't open BIO for stdin\n");
+ BIO_puts(bio_err, "Can't open BIO for stdin\n");
return NULL;
}
} else {
@@ -276,7 +276,7 @@ static char *app_get_pass(const char *arg, int keepbio)
pwdbio = NULL;
}
if (i <= 0) {
- BIO_printf(bio_err, "Error reading password from BIO\n");
+ BIO_puts(bio_err, "Error reading password from BIO\n");
return NULL;
}
tmp = strchr(tpass, '\n');
@@ -332,7 +332,7 @@ CONF *app_load_config_bio(BIO *in, const char *filename)
if (filename != NULL)
BIO_printf(bio_err, "config file \"%s\"\n", filename);
else
- BIO_printf(bio_err, "config input");
+ BIO_puts(bio_err, "config input");
NCONF_free(conf);
return NULL;
@@ -342,7 +342,7 @@ CONF *app_load_config_verbose(const char *filename, int verbose)
{
if (verbose) {
if (*filename == '\0')
- BIO_printf(bio_err, "No configuration used\n");
+ BIO_puts(bio_err, "No configuration used\n");
else
BIO_printf(bio_err, "Using configuration from %s\n", filename);
}
@@ -376,7 +376,7 @@ int app_load_modules(const CONF *config)
return 1;
if (CONF_modules_load(config, NULL, 0) <= 0) {
- BIO_printf(bio_err, "Error configuring OpenSSL modules\n");
+ BIO_puts(bio_err, "Error configuring OpenSSL modules\n");
ERR_print_errors(bio_err);
NCONF_free(to_free);
return 0;
@@ -758,7 +758,7 @@ STACK_OF(X509) *load_certs_multifile(char *files, const char *source,
return result;
oom:
- BIO_printf(bio_err, "out of memory\n");
+ BIO_puts(bio_err, "out of memory\n");
err:
clear_free(pass);
OSSL_STACK_OF_X509_free(certs);
@@ -934,7 +934,7 @@ int load_key_certs_crls(const char *uri, int format, int maybe_stdin,
if (pcerts != NULL) {
if (*pcerts == NULL && (*pcerts = sk_X509_new_null()) == NULL) {
if (!quiet)
- BIO_printf(bio_err, "Out of memory loading");
+ BIO_puts(bio_err, "Out of memory loading");
goto end;
}
/*
@@ -948,7 +948,7 @@ int load_key_certs_crls(const char *uri, int format, int maybe_stdin,
if (pcrls != NULL) {
if (*pcrls == NULL && (*pcrls = sk_X509_CRL_new_null()) == NULL) {
if (!quiet)
- BIO_printf(bio_err, "Out of memory loading");
+ BIO_puts(bio_err, "Out of memory loading");
goto end;
}
/*
@@ -971,7 +971,7 @@ int load_key_certs_crls(const char *uri, int format, int maybe_stdin,
if (!maybe_stdin) {
if (!quiet)
- BIO_printf(bio_err, "No filename or uri specified for loading\n");
+ BIO_puts(bio_err, "No filename or uri specified for loading\n");
goto end;
}
uri = "<stdin>";
@@ -989,14 +989,14 @@ int load_key_certs_crls(const char *uri, int format, int maybe_stdin,
}
if (ctx == NULL) {
if (!quiet)
- BIO_printf(bio_err, "Could not open file or uri for loading");
+ BIO_puts(bio_err, "Could not open file or uri for loading");
goto end;
}
/* expect == 0 means here multiple types of credentials are to be loaded */
if (expect > 0 && !OSSL_STORE_expect(ctx, expect)) {
if (!quiet)
- BIO_printf(bio_err, "Internal error trying to load");
+ BIO_puts(bio_err, "Internal error trying to load");
goto end;
}
@@ -1088,7 +1088,7 @@ int load_key_certs_crls(const char *uri, int format, int maybe_stdin,
if (!ok) {
failed = OSSL_STORE_INFO_type_string(type);
if (!quiet)
- BIO_printf(bio_err, "Error reading");
+ BIO_puts(bio_err, "Error reading");
break;
}
}
@@ -1106,7 +1106,7 @@ end:
pskey = NULL;
failed = FAIL_NAME;
if (failed != NULL && !quiet)
- BIO_printf(bio_err, "Could not find or decode");
+ BIO_puts(bio_err, "Could not find or decode");
}
if (failed != NULL && !quiet) {
@@ -1128,7 +1128,7 @@ end:
ERR_pop_to_mark();
ERR_set_mark();
}
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
ERR_print_errors(bio_err);
ERR_clear_last_mark();
} else {
@@ -1371,8 +1371,7 @@ void print_name(BIO *out, const char *title, const X509_NAME *nm)
}
if (lflags == XN_FLAG_COMPAT) {
buf = X509_NAME_oneline(nm, 0, 0);
- BIO_puts(out, buf);
- BIO_puts(out, "\n");
+ BIO_printf(out, "%s\n", buf);
OPENSSL_free(buf);
} else {
if (mline)
@@ -1387,7 +1386,7 @@ void print_bignum_var(BIO *out, const BIGNUM *in, const char *var,
{
BIO_printf(out, " static unsigned char %s_%d[] = {", var, len);
if (BN_is_zero(in)) {
- BIO_printf(out, "\n 0x00");
+ BIO_puts(out, "\n 0x00");
} else {
int i, l;
@@ -1400,7 +1399,7 @@ void print_bignum_var(BIO *out, const BIGNUM *in, const char *var,
BIO_printf(out, "0x%02X", buffer[i]);
}
}
- BIO_printf(out, "\n };\n");
+ BIO_puts(out, "\n };\n");
}
void print_array(BIO *out, const char *title, int len, const unsigned char *d)
@@ -1410,13 +1409,13 @@ void print_array(BIO *out, const char *title, int len, const unsigned char *d)
BIO_printf(out, "unsigned char %s[%d] = {", title, len);
for (i = 0; i < len; i++) {
if ((i % 10) == 0)
- BIO_printf(out, "\n ");
+ BIO_puts(out, "\n ");
if (i < len - 1)
BIO_printf(out, "0x%02X, ", d[i]);
else
BIO_printf(out, "0x%02X", d[i]);
}
- BIO_printf(out, "\n};\n");
+ BIO_puts(out, "\n};\n");
}
X509_STORE *setup_verify(const char *CAfile, int noCAfile,
@@ -1552,7 +1551,7 @@ BIGNUM *load_serial(const char *serialfile, int *exists, int create,
ERR_clear_error();
ret = BN_new();
if (ret == NULL) {
- BIO_printf(bio_err, "Out of memory\n");
+ BIO_puts(bio_err, "Out of memory\n");
} else if (!rand_serial(ret, ai)) {
BIO_printf(bio_err, "Error creating random number to store in %s\n",
serialfile);
@@ -1567,7 +1566,7 @@ BIGNUM *load_serial(const char *serialfile, int *exists, int create,
}
ret = ASN1_INTEGER_to_BN(ai, NULL);
if (ret == NULL) {
- BIO_printf(bio_err, "Error converting number from bin to BIGNUM\n");
+ BIO_puts(bio_err, "Error converting number from bin to BIGNUM\n");
goto err;
}
}
@@ -1598,7 +1597,7 @@ int save_serial(const char *serialfile, const char *suffix,
else
j = strlen(serialfile) + strlen(suffix) + 1;
if (j >= BSIZE) {
- BIO_printf(bio_err, "File name too long\n");
+ BIO_puts(bio_err, "File name too long\n");
goto err;
}
@@ -1617,7 +1616,7 @@ int save_serial(const char *serialfile, const char *suffix,
}
if ((ai = BN_to_ASN1_INTEGER(serial, NULL)) == NULL) {
- BIO_printf(bio_err, "error converting serial to ASN.1 format\n");
+ BIO_puts(bio_err, "error converting serial to ASN.1 format\n");
goto err;
}
i2a_ASN1_INTEGER(out, ai);
@@ -1646,7 +1645,7 @@ int rotate_serial(const char *serialfile, const char *new_suffix,
if (i > j)
j = i;
if (j + 1 >= BSIZE) {
- BIO_printf(bio_err, "File name too long\n");
+ BIO_puts(bio_err, "File name too long\n");
goto err;
}
#ifndef OPENSSL_SYS_VMS
@@ -1805,7 +1804,7 @@ int save_index(const char *dbfile, const char *suffix, CA_DB *db)
j = (int)(strlen(dbfile) + strlen(suffix));
if (j + 6 >= BSIZE) {
- BIO_printf(bio_err, "File name too long\n");
+ BIO_puts(bio_err, "File name too long\n");
goto err;
}
#ifndef OPENSSL_SYS_VMS
@@ -1855,7 +1854,7 @@ int rotate_index(const char *dbfile, const char *new_suffix,
if (i > j)
j = i;
if (j + 6 >= BSIZE) {
- BIO_printf(bio_err, "File name too long\n");
+ BIO_puts(bio_err, "File name too long\n");
goto err;
}
#ifndef OPENSSL_SYS_VMS
@@ -2882,8 +2881,8 @@ double app_tminterval(int stop, int usertime)
SYSTEMTIME systime;
if (usertime && warning) {
- BIO_printf(bio_err, "To get meaningful results, run "
- "this program on idle system.\n");
+ BIO_puts(bio_err, "To get meaningful results, run "
+ "this program on idle system.\n");
warning = 0;
}
GetSystemTime(&systime);
@@ -2920,8 +2919,8 @@ double app_tminterval(int stop, int usertime)
static int warning = 1;
if (usertime && warning) {
- BIO_printf(bio_err, "To get meaningful results, run "
- "this program on idle system.\n");
+ BIO_puts(bio_err, "To get meaningful results, run "
+ "this program on idle system.\n");
warning = 0;
}
#ifdef CLOCK_REALTIME
@@ -3412,12 +3411,12 @@ int set_cert_times(X509 *x, const char *startdate, const char *enddate,
return 0;
if (startdate == NULL || strcmp(startdate, "today") == 0) {
if (X509_gmtime_adj(X509_getm_notBefore(x), 0) == NULL) {
- BIO_printf(bio_err, "Error setting notBefore certificate field\n");
+ BIO_puts(bio_err, "Error setting notBefore certificate field\n");
return 0;
}
} else {
if (!ASN1_TIME_set_string_X509(X509_getm_notBefore(x), startdate)) {
- BIO_printf(bio_err, "Error setting notBefore certificate field\n");
+ BIO_puts(bio_err, "Error setting notBefore certificate field\n");
return 0;
}
}
@@ -3427,11 +3426,11 @@ int set_cert_times(X509 *x, const char *startdate, const char *enddate,
}
if (enddate == NULL) {
if (X509_time_adj_ex(X509_getm_notAfter(x), days, 0, NULL) == NULL) {
- BIO_printf(bio_err, "Error setting notAfter certificate field\n");
+ BIO_puts(bio_err, "Error setting notAfter certificate field\n");
return 0;
}
} else if (!ASN1_TIME_set_string_X509(X509_getm_notAfter(x), enddate)) {
- BIO_printf(bio_err, "Error setting notAfter certificate field\n");
+ BIO_puts(bio_err, "Error setting notAfter certificate field\n");
return 0;
}
if (ASN1_TIME_compare(X509_get0_notAfter(x), X509_get0_notBefore(x)) < 0) {
@@ -3563,11 +3562,11 @@ EVP_PKEY *app_keygen(EVP_PKEY_CTX *ctx, const char *alg, int bits, int verbose)
if (bits > 0)
BIO_printf(bio_err, " with %d bits\n", bits);
else
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
}
if (!RAND_status())
- BIO_printf(bio_err, "Warning: generating random key material may take a long time\n"
- "if the system has a poor entropy source\n");
+ BIO_puts(bio_err, "Warning: generating random key material may take a long time\n"
+ "if the system has a poor entropy source\n");
if (EVP_PKEY_keygen(ctx, &res) <= 0)
BIO_printf(bio_err, "%s: Error generating %s key\n", opt_getprog(),
alg != NULL ? alg : "asymmetric");
@@ -3579,8 +3578,8 @@ EVP_PKEY *app_paramgen(EVP_PKEY_CTX *ctx, const char *alg)
EVP_PKEY *res = NULL;
if (!RAND_status())
- BIO_printf(bio_err, "Warning: generating random key parameters may take a long time\n"
- "if the system has a poor entropy source\n");
+ BIO_puts(bio_err, "Warning: generating random key parameters may take a long time\n"
+ "if the system has a poor entropy source\n");
if (EVP_PKEY_paramgen(ctx, &res) <= 0)
BIO_printf(bio_err, "%s: Generating %s key parameters failed\n",
opt_getprog(), alg != NULL ? alg : "asymmetric");
diff --git a/apps/lib/apps_ui.c b/apps/lib/apps_ui.c
index ecfa25e076..3677232884 100644
--- a/apps/lib/apps_ui.c
+++ b/apps/lib/apps_ui.c
@@ -171,7 +171,7 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_data)
prompt_info = cb_data->prompt_info;
prompt = UI_construct_prompt(ui, "pass phrase", prompt_info);
if (prompt == NULL) {
- BIO_printf(bio_err, "Out of memory\n");
+ BIO_puts(bio_err, "Out of memory\n");
UI_free(ui);
return 0;
}
@@ -200,13 +200,13 @@ int password_callback(char *buf, int bufsiz, int verify, PW_CB_DATA *cb_data)
if (ok >= 0)
res = (int)strlen(buf);
if (ok == -1) {
- BIO_printf(bio_err, "User interface error\n");
+ BIO_puts(bio_err, "User interface error\n");
ERR_print_errors(bio_err);
OPENSSL_cleanse(buf, (unsigned int)bufsiz);
res = 0;
}
if (ok == -2) {
- BIO_printf(bio_err, "aborted!\n");
+ BIO_puts(bio_err, "aborted!\n");
OPENSSL_cleanse(buf, (unsigned int)bufsiz);
res = 0;
}
diff --git a/apps/lib/cmp_mock_srv.c b/apps/lib/cmp_mock_srv.c
index bf8b06c390..294da84646 100644
--- a/apps/lib/cmp_mock_srv.c
+++ b/apps/lib/cmp_mock_srv.c
@@ -614,10 +614,10 @@ static void process_error(OSSL_CMP_SRV_CTX *srv_ctx, const OSSL_CMP_MSG *error,
return;
}
- BIO_printf(bio_err, "mock server received error:\n");
+ BIO_puts(bio_err, "mock server received error:\n");
if (statusInfo == NULL) {
- BIO_printf(bio_err, "pkiStatusInfo absent\n");
+ BIO_puts(bio_err, "pkiStatusInfo absent\n");
} else {
sibuf = OSSL_CMP_snprint_PKIStatusInfo(statusInfo, buf, sizeof(buf));
BIO_printf(bio_err, "pkiStatusInfo: %s\n",
@@ -625,22 +625,22 @@ static void process_error(OSSL_CMP_SRV_CTX *srv_ctx, const OSSL_CMP_MSG *error,
}
if (errorCode == NULL)
- BIO_printf(bio_err, "errorCode absent\n");
+ BIO_puts(bio_err, "errorCode absent\n");
else
BIO_printf(bio_err, "errorCode: %ld\n", ASN1_INTEGER_get(errorCode));
if (sk_ASN1_UTF8STRING_num(errorDetails) <= 0) {
- BIO_printf(bio_err, "errorDetails absent\n");
+ BIO_puts(bio_err, "errorDetails absent\n");
} else {
- BIO_printf(bio_err, "errorDetails: ");
+ BIO_puts(bio_err, "errorDetails: ");
for (i = 0; i < sk_ASN1_UTF8STRING_num(errorDetails); i++) {
if (i > 0)
- BIO_printf(bio_err, ", ");
+ BIO_puts(bio_err, ", ");
ASN1_STRING_print_ex(bio_err,
sk_ASN1_UTF8STRING_value(errorDetails, i),
ASN1_STRFLGS_ESC_QUOTE);
}
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
}
}
diff --git a/apps/lib/log.c b/apps/lib/log.c
index d686cfbdf2..eee7a07e8e 100644
--- a/apps/lib/log.c
+++ b/apps/lib/log.c
@@ -53,7 +53,7 @@ static void log_with_prefix(const char *prog, const char *fmt, va_list ap)
(void)BIO_set_prefix(pre, prefix);
bio = BIO_push(pre, bio_err);
(void)BIO_vprintf(bio, fmt, ap);
- (void)BIO_printf(bio, "\n");
+ (void)BIO_puts(bio, "\n");
(void)BIO_flush(bio);
(void)BIO_pop(pre);
BIO_free(pre);
@@ -92,7 +92,7 @@ void trace_log_message(int category,
#else
(void)BIO_vprintf(out, fmt, ap);
#endif
- (void)BIO_printf(out, "\n");
+ (void)BIO_puts(out, "\n");
OSSL_trace_end(category, out);
}
if (verbosity < level) {
diff --git a/apps/lib/names.c b/apps/lib/names.c
index 24a146819b..25f8f96a50 100644
--- a/apps/lib/names.c
+++ b/apps/lib/names.c
@@ -33,14 +33,14 @@ void print_names(BIO *out, STACK_OF(OPENSSL_CSTRING) *names)
sk_OPENSSL_CSTRING_sort(names);
if (i > 1)
- BIO_printf(out, "{ ");
+ BIO_puts(out, "{ ");
for (j = 0; j < i; j++) {
const char *name = sk_OPENSSL_CSTRING_value(names, j);
if (j > 0)
- BIO_printf(out, ", ");
+ BIO_puts(out, ", ");
BIO_printf(out, "%s", name);
}
if (i > 1)
- BIO_printf(out, " }");
+ BIO_puts(out, " }");
}
diff --git a/apps/lib/s_cb.c b/apps/lib/s_cb.c
index c1e9e673ab..29c98950e7 100644
--- a/apps/lib/s_cb.c
+++ b/apps/lib/s_cb.c
@@ -89,17 +89,17 @@ int verify_callback(int ok, X509_STORE_CTX *ctx)
case X509_V_ERR_CERT_NOT_YET_VALID:
case X509_V_ERR_ERROR_IN_CERT_NOT_BEFORE_FIELD:
if (err_cert != NULL) {
- BIO_printf(bio_err, "notBefore=");
+ BIO_puts(bio_err, "notBefore=");
ASN1_TIME_print(bio_err, X509_get0_notBefore(err_cert));
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
}
break;
case X509_V_ERR_CERT_HAS_EXPIRED:
case X509_V_ERR_ERROR_IN_CERT_NOT_AFTER_FIELD:
if (err_cert != NULL) {
- BIO_printf(bio_err, "notAfter=");
+ BIO_puts(bio_err, "notAfter=");
ASN1_TIME_print(bio_err, X509_get0_notAfter(err_cert));
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
}
break;
case X509_V_ERR_NO_EXPLICIT_POLICY:
@@ -148,7 +148,7 @@ int set_cert_stuff(SSL_CTX *ctx, char *cert_file, char *key_file)
* context
*/
if (!SSL_CTX_check_private_key(ctx)) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Private key does not match the certificate public key\n");
return 0;
}
@@ -164,13 +164,13 @@ int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key,
if (cert == NULL)
return 1;
if (SSL_CTX_use_certificate(ctx, cert) <= 0) {
- BIO_printf(bio_err, "error setting certificate\n");
+ BIO_puts(bio_err, "error setting certificate\n");
ERR_print_errors(bio_err);
return 0;
}
if (SSL_CTX_use_PrivateKey(ctx, key) <= 0) {
- BIO_printf(bio_err, "error setting private key\n");
+ BIO_puts(bio_err, "error setting private key\n");
ERR_print_errors(bio_err);
return 0;
}
@@ -179,17 +179,17 @@ int set_cert_key_stuff(SSL_CTX *ctx, X509 *cert, EVP_PKEY *key,
* Now we know that a key and cert have been set against the SSL context
*/
if (!SSL_CTX_check_private_key(ctx)) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Private key does not match the certificate public key\n");
return 0;
}
if (chain && !SSL_CTX_set1_chain(ctx, chain)) {
- BIO_printf(bio_err, "error setting certificate chain\n");
+ BIO_puts(bio_err, "error setting certificate chain\n");
ERR_print_errors(bio_err);
return 0;
}
if (build_chain && !SSL_CTX_build_cert_chain(ctx, chflags)) {
- BIO_printf(bio_err, "error building certificate chain\n");
+ BIO_puts(bio_err, "error building certificate chain\n");
ERR_print_errors(bio_err);
return 0;
}
@@ -319,7 +319,7 @@ static int do_print_sigalgs(BIO *out, SSL *s, int shared)
}
sstr = get_sigtype(sign_nid);
if (sstr)
- BIO_printf(out, "%s", sstr);
+ BIO_puts(out, sstr);
else
BIO_printf(out, "0x%02X", (int)rsign);
if (hash_nid != NID_undef)
@@ -399,7 +399,8 @@ int ssl_print_groups(BIO *out, SSL *s, int noshared)
if (i)
BIO_puts(out, ":");
nid = groups[i];
- BIO_printf(out, "%s", SSL_group_to_name(s, nid));
+ const char *name = SSL_group_to_name(s, nid);
+ BIO_puts(out, ((name != NULL) ? name : "(null)"));
}
OPENSSL_free(groups);
if (noshared) {
@@ -412,7 +413,8 @@ int ssl_print_groups(BIO *out, SSL *s, int noshared)
if (i)
BIO_puts(out, ":");
nid = SSL_get_shared_group(s, i);
- BIO_printf(out, "%s", SSL_group_to_name(s, nid));
+ const char *name = SSL_group_to_name(s, nid);
+ BIO_puts(out, ((name != NULL) ? name : "(null)"));
}
if (ngroups == 0)
BIO_puts(out, "NONE");
@@ -723,16 +725,16 @@ void msg_cb(int write_p, int version, int content_type, const void *buf,
if (len > 0) {
size_t num, i;
- BIO_printf(bio, " ");
+ BIO_puts(bio, " ");
num = len;
for (i = 0; i < num; i++) {
if (i % 16 == 0 && i > 0)
- BIO_printf(bio, "\n ");
+ BIO_puts(bio, "\n ");
BIO_printf(bio, " %02x", ((const unsigned char *)buf)[i]);
}
if (i < len)
- BIO_printf(bio, " ...");
- BIO_printf(bio, "\n");
+ BIO_puts(bio, " ...");
+ BIO_puts(bio, "\n");
}
(void)BIO_flush(bio);
}
@@ -855,7 +857,7 @@ int generate_stateless_cookie_callback(SSL *ssl, unsigned char *cookie,
/* Initialize a random secret */
if (!cookie_initialized) {
if (RAND_bytes(cookie_secret, COOKIE_SECRET_LENGTH) <= 0) {
- BIO_printf(bio_err, "error setting random cookie secret\n");
+ BIO_puts(bio_err, "error setting random cookie secret\n");
return 0;
}
cookie_initialized = 1;
@@ -864,7 +866,7 @@ int generate_stateless_cookie_callback(SSL *ssl, unsigned char *cookie,
if (SSL_is_dtls(ssl)) {
lpeer = peer = BIO_ADDR_new();
if (peer == NULL) {
- BIO_printf(bio_err, "memory full\n");
+ BIO_puts(bio_err, "memory full\n");
return 0;
}
@@ -876,7 +878,7 @@ int generate_stateless_cookie_callback(SSL *ssl, unsigned char *cookie,
/* Create buffer with peer's address and port */
if (!BIO_ADDR_rawaddress(peer, NULL, &length)) {
- BIO_printf(bio_err, "Failed getting peer address\n");
+ BIO_puts(bio_err, "Failed getting peer address\n");
BIO_ADDR_free(lpeer);
return 0;
}
@@ -893,7 +895,7 @@ int generate_stateless_cookie_callback(SSL *ssl, unsigned char *cookie,
cookie_secret, COOKIE_SECRET_LENGTH, buffer, length,
cookie, DTLS1_COOKIE_LENGTH, cookie_len)
== NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error calculating HMAC-SHA1 of buffer with secret\n");
goto end;
}
@@ -983,11 +985,11 @@ static void print_chain_flags(SSL *s, int flags)
BIO_printf(bio_err, "\t%s: %s\n",
pp->name,
(flags & pp->retval) ? "OK" : "NOT OK");
- BIO_printf(bio_err, "\tSuite B: ");
+ BIO_puts(bio_err, "\tSuite B: ");
if (SSL_set_cert_flags(s, 0) & SSL_CERT_FLAG_SUITEB_128_LOS)
BIO_puts(bio_err, flags & CERT_PKEY_SUITEB ? "OK\n" : "NOT OK\n");
else
- BIO_printf(bio_err, "not tested\n");
+ BIO_puts(bio_err, "not tested\n");
}
/*
@@ -1109,7 +1111,7 @@ int load_excert(SSL_EXCERT **pexc)
}
for (; exc; exc = exc->next) {
if (exc->certfile == NULL) {
- BIO_printf(bio_err, "Missing filename\n");
+ BIO_puts(bio_err, "Missing filename\n");
return 0;
}
exc->cert = load_cert(exc->certfile, exc->certform,
@@ -1264,7 +1266,7 @@ void print_verify_detail(SSL *s, BIO *bio)
if (verify_err == X509_V_OK) {
const char *peername = SSL_get0_peername(s);
- BIO_printf(bio, "Verification: OK\n");
+ BIO_puts(bio, "Verification: OK\n");
if (peername != NULL)
BIO_printf(bio, "Verified peername: %s\n", peername);
} else {
@@ -1302,7 +1304,7 @@ void print_verify_detail(SSL *s, BIO *bio)
: "matched the EE",
mdpth);
else
- BIO_printf(bio, "matched the peer raw public key\n");
+ BIO_puts(bio, "matched the peer raw public key\n");
OPENSSL_free(hexdata);
}
}
@@ -1331,7 +1333,7 @@ void print_ssl_summary(SSL *s)
BIO_printf(bio_err, "Signature type: %s\n", sigalg);
print_verify_detail(s, bio_err);
} else if (peer_rpk != NULL) {
- BIO_printf(bio_err, "Peer used raw public key\n");
+ BIO_puts(bio_err, "Peer used raw public key\n");
if (SSL_get0_peer_signature_name(s, &sigalg))
BIO_printf(bio_err, "Signature type: %s\n", sigalg);
print_verify_detail(s, bio_err);
@@ -1597,7 +1599,7 @@ void ssl_ctx_security_debug(SSL_CTX *ctx, int verbose)
static void keylog_callback(const SSL *ssl, const char *line)
{
if (bio_keylog == NULL) {
- BIO_printf(bio_err, "Keylog callback is invoked without valid file!\n");
+ BIO_puts(bio_err, "Keylog callback is invoked without valid file!\n");
return;
}
@@ -1666,7 +1668,7 @@ void ssl_print_secure_renegotiation_notes(BIO *bio, SSL *s)
BIO_printf(bio, "Secure Renegotiation IS%s supported\n",
SSL_get_secure_renegotiation_support(s) ? "" : " NOT");
} else {
- BIO_printf(bio, "This TLS version forbids renegotiation.\n");
+ BIO_puts(bio, "This TLS version forbids renegotiation.\n");
}
}
diff --git a/apps/lib/s_socket.c b/apps/lib/s_socket.c
index 5a6d938edf..ec37fefeac 100644
--- a/apps/lib/s_socket.c
+++ b/apps/lib/s_socket.c
@@ -176,7 +176,7 @@ int init_client(int *sock, const char *host, const char *port,
/* Save the address */
if (tfo || !doconn) {
if (ba_ret == NULL) {
- BIO_printf(bio_err, "Internal error\n");
+ BIO_puts(bio_err, "Internal error\n");
BIO_closesocket(*sock);
*sock = INVALID_SOCKET;
goto out;
@@ -248,7 +248,7 @@ int report_server_accept(BIO *out, int asock, int with_address, int with_pid)
{
int success = 1;
- if (BIO_printf(out, "ACCEPT") <= 0)
+ if (BIO_puts(out, "ACCEPT") <= 0)
return 0;
if (with_address) {
char *hostname, *service;
@@ -263,13 +263,13 @@ int report_server_accept(BIO *out, int asock, int with_address, int with_pid)
hostname, service)
> 0;
else
- (void)BIO_printf(out, "unknown:error\n");
+ (void)BIO_puts(out, "unknown:error\n");
OPENSSL_free(hostname);
OPENSSL_free(service);
}
if (with_pid)
success *= BIO_printf(out, " PID=%d", getpid()) > 0;
- success *= BIO_printf(out, "\n") > 0;
+ success *= BIO_puts(out, "\n") > 0;
(void)BIO_flush(out);
return success;
diff --git a/apps/lib/tlssrp_depr.c b/apps/lib/tlssrp_depr.c
index 058f47b90f..dc9a18aee6 100644
--- a/apps/lib/tlssrp_depr.c
+++ b/apps/lib/tlssrp_depr.c
@@ -65,12 +65,12 @@ static int ssl_srp_verify_param_cb(SSL *s, void *arg)
if (((N = SSL_get_srp_N(s)) == NULL) || ((g = SSL_get_srp_g(s)) == NULL))
return 0;
if (srp_arg->debug || srp_arg->msg || srp_arg->amp == 1) {
- BIO_printf(bio_err, "SRP parameters:\n");
- BIO_printf(bio_err, "\tN=");
+ BIO_puts(bio_err, "SRP parameters:\n"
+ "\tN=");
BN_print(bio_err, N);
- BIO_printf(bio_err, "\n\tg=");
+ BIO_puts(bio_err, "\n\tg=");
BN_print(bio_err, g);
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
}
if (SRP_check_known_gN_param(g, N))
@@ -78,7 +78,7 @@ static int ssl_srp_verify_param_cb(SSL *s, void *arg)
if (srp_arg->amp == 1) {
if (srp_arg->debug)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"SRP param N and g are not known params, going to check deeper.\n");
/*
@@ -89,7 +89,7 @@ static int ssl_srp_verify_param_cb(SSL *s, void *arg)
if (BN_num_bits(g) <= BN_BITS && srp_Verify_N_and_g(N, g))
return 1;
}
- BIO_printf(bio_err, "SRP param N and g rejected.\n");
+ BIO_puts(bio_err, "SRP param N and g rejected.\n");
return 0;
}
@@ -105,7 +105,7 @@ static char *ssl_give_srp_client_pwd_cb(SSL *s, void *arg)
cb_tmp.password = (char *)srp_arg->srppassin;
cb_tmp.prompt_info = "SRP user";
if ((l = password_callback(pass, PWD_STRLEN, 0, &cb_tmp)) < 0) {
- BIO_printf(bio_err, "Can't read Password\n");
+ BIO_puts(bio_err, "Can't read Password\n");
OPENSSL_free(pass);
return NULL;
}
@@ -118,7 +118,7 @@ int set_up_srp_arg(SSL_CTX *ctx, SRP_ARG *srp_arg, int srp_lateuser, int c_msg,
int c_debug)
{
if (!srp_lateuser && !SSL_CTX_set_srp_username(ctx, srp_arg->srplogin)) {
- BIO_printf(bio_err, "Unable to set SRP username\n");
+ BIO_puts(bio_err, "Unable to set SRP username\n");
return 0;
}
srp_arg->msg = c_msg;
@@ -194,7 +194,7 @@ int set_up_srp_verifier_file(SSL_CTX *ctx, srpsrvparm *srp_callback_parm,
srp_callback_parm->login = NULL;
if (srp_callback_parm->vb == NULL) {
- BIO_printf(bio_err, "Failed to initialize SRP verifier file\n");
+ BIO_puts(bio_err, "Failed to initialize SRP verifier file\n");
return 0;
}
if ((ret = SRP_VBASE_init(srp_callback_parm->vb,
@@ -222,5 +222,5 @@ void lookup_srp_user(srpsrvparm *srp_callback_parm, BIO *bio_s_out)
BIO_printf(bio_s_out, "LOOKUP done %s\n",
srp_callback_parm->user->info);
else
- BIO_printf(bio_s_out, "LOOKUP not successful\n");
+ BIO_puts(bio_s_out, "LOOKUP not successful\n");
}
diff --git a/apps/list.c b/apps/list.c
index 2edd010046..cbd1f4e377 100644
--- a/apps/list.c
+++ b/apps/list.c
@@ -115,7 +115,7 @@ static void list_ciphers(const char *prefix)
int i;
if (ciphers == NULL) {
- BIO_printf(bio_err, "ERROR: Memory allocation\n");
+ BIO_puts(bio_err, "ERROR: Memory allocation\n");
return;
}
#ifndef OPENSSL_NO_DEPRECATED_3_0
@@ -137,7 +137,7 @@ static void list_ciphers(const char *prefix)
names = sk_OPENSSL_CSTRING_new(name_cmp);
if (names != NULL && EVP_CIPHER_names_do_all(c, collect_names, names)) {
- BIO_printf(bio_out, " ");
+ BIO_puts(bio_out, " ");
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s\n",
@@ -200,7 +200,7 @@ static void list_digests(const char *prefix)
int i;
if (digests == NULL) {
- BIO_printf(bio_err, "ERROR: Memory allocation\n");
+ BIO_puts(bio_err, "ERROR: Memory allocation\n");
return;
}
#ifndef OPENSSL_NO_DEPRECATED_3_0
@@ -222,7 +222,7 @@ static void list_digests(const char *prefix)
names = sk_OPENSSL_CSTRING_new(name_cmp);
if (names != NULL && EVP_MD_names_do_all(m, collect_names, names)) {
- BIO_printf(bio_out, " ");
+ BIO_puts(bio_out, " ");
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s\n",
@@ -268,10 +268,10 @@ static void list_macs(void)
int i;
if (macs == NULL) {
- BIO_printf(bio_err, "ERROR: Memory allocation\n");
+ BIO_puts(bio_err, "ERROR: Memory allocation\n");
return;
}
- BIO_printf(bio_out, "Provided MACs:\n");
+ BIO_puts(bio_out, "Provided MACs:\n");
EVP_MAC_do_all_provided(app_get0_libctx(), collect_macs, macs);
sk_EVP_MAC_sort(macs);
for (i = 0; i < sk_EVP_MAC_num(macs); i++) {
@@ -283,7 +283,7 @@ static void list_macs(void)
names = sk_OPENSSL_CSTRING_new(name_cmp);
if (names != NULL && EVP_MAC_names_do_all(m, collect_names, names)) {
- BIO_printf(bio_out, " ");
+ BIO_puts(bio_out, " ");
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s\n",
@@ -333,10 +333,10 @@ static void list_kdfs(void)
int i;
if (kdfs == NULL) {
- BIO_printf(bio_err, "ERROR: Memory allocation\n");
+ BIO_puts(bio_err, "ERROR: Memory allocation\n");
return;
}
- BIO_printf(bio_out, "Provided KDFs and PDFs:\n");
+ BIO_puts(bio_out, "Provided KDFs and PDFs:\n");
EVP_KDF_do_all_provided(app_get0_libctx(), collect_kdfs, kdfs);
sk_EVP_KDF_sort(kdfs);
for (i = 0; i < sk_EVP_KDF_num(kdfs); i++) {
@@ -348,7 +348,7 @@ static void list_kdfs(void)
names = sk_OPENSSL_CSTRING_new(name_cmp);
if (names != NULL && EVP_KDF_names_do_all(k, collect_names, names)) {
- BIO_printf(bio_out, " ");
+ BIO_puts(bio_out, " ");
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s\n",
@@ -404,10 +404,10 @@ static void list_random_generators(void)
int i;
if (rands == NULL) {
- BIO_printf(bio_err, "ERROR: Memory allocation\n");
+ BIO_puts(bio_err, "ERROR: Memory allocation\n");
return;
}
- BIO_printf(bio_out, "Provided RNGs and seed sources:\n");
+ BIO_puts(bio_out, "Provided RNGs and seed sources:\n");
EVP_RAND_do_all_provided(app_get0_libctx(), collect_rands, rands);
sk_EVP_RAND_sort(rands);
for (i = 0; i < sk_EVP_RAND_num(rands); i++) {
@@ -416,8 +416,7 @@ static void list_random_generators(void)
if (select_name != NULL
&& OPENSSL_strcasecmp(EVP_RAND_get0_name(m), select_name) != 0)
continue;
- BIO_printf(bio_out, " %s", EVP_RAND_get0_name(m));
- BIO_printf(bio_out, " @ %s\n",
+ BIO_printf(bio_out, " %s @ %s\n", EVP_RAND_get0_name(m),
OSSL_PROVIDER_get0_name(EVP_RAND_get0_provider(m)));
if (verbose) {
@@ -449,8 +448,7 @@ static void display_random(const char *name, EVP_RAND_CTX *drbg)
if (drbg != NULL) {
rand = EVP_RAND_CTX_get0_rand(drbg);
- BIO_printf(bio_out, " %s", EVP_RAND_get0_name(rand));
- BIO_printf(bio_out, " @ %s\n",
+ BIO_printf(bio_out, " %s @ %s\n", EVP_RAND_get0_name(rand),
OSSL_PROVIDER_get0_name(EVP_RAND_get0_provider(rand)));
switch (EVP_RAND_get_state(drbg)) {
@@ -532,10 +530,10 @@ static void list_encoders(void)
encoders = sk_OSSL_ENCODER_new(encoder_cmp);
if (encoders == NULL) {
- BIO_printf(bio_err, "ERROR: Memory allocation\n");
+ BIO_puts(bio_err, "ERROR: Memory allocation\n");
return;
}
- BIO_printf(bio_out, "Provided ENCODERs:\n");
+ BIO_puts(bio_out, "Provided ENCODERs:\n");
OSSL_ENCODER_do_all_provided(app_get0_libctx(), collect_encoders,
encoders);
sk_OSSL_ENCODER_sort(encoders);
@@ -549,7 +547,7 @@ static void list_encoders(void)
names = sk_OPENSSL_CSTRING_new(name_cmp);
if (names != NULL && OSSL_ENCODER_names_do_all(k, collect_names, names)) {
- BIO_printf(bio_out, " ");
+ BIO_puts(bio_out, " ");
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s (%s)\n",
@@ -598,10 +596,10 @@ static void list_decoders(void)
decoders = sk_OSSL_DECODER_new(decoder_cmp);
if (decoders == NULL) {
- BIO_printf(bio_err, "ERROR: Memory allocation\n");
+ BIO_puts(bio_err, "ERROR: Memory allocation\n");
return;
}
- BIO_printf(bio_out, "Provided DECODERs:\n");
+ BIO_puts(bio_out, "Provided DECODERs:\n");
OSSL_DECODER_do_all_provided(app_get0_libctx(), collect_decoders,
decoders);
sk_OSSL_DECODER_sort(decoders);
@@ -615,7 +613,7 @@ static void list_decoders(void)
names = sk_OPENSSL_CSTRING_new(name_cmp);
if (names != NULL && OSSL_DECODER_names_do_all(k, collect_names, names)) {
- BIO_printf(bio_out, " ");
+ BIO_puts(bio_out, " ");
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s (%s)\n",
@@ -674,14 +672,14 @@ static void list_keymanagers(void)
if (names != NULL && EVP_KEYMGMT_names_do_all(k, collect_names, names)) {
const char *desc = EVP_KEYMGMT_get0_description(k);
- BIO_printf(bio_out, " Name: ");
+ BIO_puts(bio_out, " Name: ");
if (desc != NULL)
- BIO_printf(bio_out, "%s", desc);
+ BIO_puts(bio_out, desc);
else
- BIO_printf(bio_out, "%s", sk_OPENSSL_CSTRING_value(names, 0));
- BIO_printf(bio_out, "\n");
- BIO_printf(bio_out, " Type: Provider Algorithm\n");
- BIO_printf(bio_out, " IDs: ");
+ BIO_puts(bio_out, sk_OPENSSL_CSTRING_value(names, 0));
+ BIO_puts(bio_out, "\n"
+ " Type: Provider Algorithm\n"
+ " IDs: ");
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s\n",
OSSL_PROVIDER_get0_name(EVP_KEYMGMT_get0_provider(k)));
@@ -737,14 +735,14 @@ static void list_skeymanagers(void)
if (names != NULL && EVP_SKEYMGMT_names_do_all(k, collect_names, names)) {
const char *desc = EVP_SKEYMGMT_get0_description(k);
- BIO_printf(bio_out, " Name: ");
+ BIO_puts(bio_out, " Name: ");
if (desc != NULL)
- BIO_printf(bio_out, "%s", desc);
+ BIO_puts(bio_out, desc);
else
- BIO_printf(bio_out, "%s", sk_OPENSSL_CSTRING_value(names, 0));
- BIO_printf(bio_out, "\n");
- BIO_printf(bio_out, " Type: Provider Algorithm\n");
- BIO_printf(bio_out, " IDs: ");
+ BIO_puts(bio_out, sk_OPENSSL_CSTRING_value(names, 0));
+ BIO_puts(bio_out, "\n");
+ BIO_puts(bio_out, " Type: Provider Algorithm\n");
+ BIO_puts(bio_out, " IDs: ");
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s\n",
OSSL_PROVIDER_get0_name(EVP_SKEYMGMT_get0_provider(k)));
@@ -791,7 +789,7 @@ static void list_signatures(void)
names = sk_OPENSSL_CSTRING_new(name_cmp);
if (names != NULL && EVP_SIGNATURE_names_do_all(k, collect_names, names)) {
count++;
- BIO_printf(bio_out, " ");
+ BIO_puts(bio_out, " ");
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s\n",
@@ -812,7 +810,7 @@ static void list_signatures(void)
}
sk_EVP_SIGNATURE_pop_free(sig_stack, EVP_SIGNATURE_free);
if (count == 0)
- BIO_printf(bio_out, " -\n");
+ BIO_puts(bio_out, " -\n");
}
static int list_provider_tls_sigalgs(const OSSL_PARAM params[], void *data)
@@ -823,8 +821,8 @@ static int list_provider_tls_sigalgs(const OSSL_PARAM params[], void *data)
p = OSSL_PARAM_locate_const(params, OSSL_CAPABILITY_TLS_SIGALG_IANA_NAME);
if (p != NULL && p->data_type == OSSL_PARAM_UTF8_STRING) {
if (*((int *)data) > 0)
- BIO_printf(bio_out, ":");
- BIO_printf(bio_out, "%s", (char *)(p->data));
+ BIO_puts(bio_out, ":");
+ BIO_puts(bio_out, (p->data != NULL) ? (char *)(p->data) : "(null)");
/* mark presence of a provider-based sigalg */
*((int *)data) = 2;
}
@@ -849,20 +847,20 @@ static void list_tls_groups(int version, int all)
int i, num;
if ((groups = sk_OPENSSL_CSTRING_new_null()) == NULL) {
- BIO_printf(bio_err, "ERROR: Memory allocation\n");
+ BIO_puts(bio_err, "ERROR: Memory allocation\n");
return;
}
if ((ctx = SSL_CTX_new(TLS_method())) == NULL) {
- BIO_printf(bio_err, "ERROR: Memory allocation\n");
+ BIO_puts(bio_err, "ERROR: Memory allocation\n");
goto err;
}
if (!SSL_CTX_set_min_proto_version(ctx, version)
|| !SSL_CTX_set_max_proto_version(ctx, version)) {
- BIO_printf(bio_err, "ERROR: setting TLS protocol version\n");
+ BIO_puts(bio_err, "ERROR: setting TLS protocol version\n");
goto err;
}
if (!SSL_CTX_get0_implemented_groups(ctx, all, groups)) {
- BIO_printf(bio_err, "ERROR: getting implemented TLS group list\n");
+ BIO_puts(bio_err, "ERROR: getting implemented TLS group list\n");
goto err;
}
num = sk_OPENSSL_CSTRING_num(groups);
@@ -884,19 +882,19 @@ static void list_tls_signatures(void)
if (builtin_sigalgs != NULL) {
if (builtin_sigalgs[0] != 0) {
- BIO_printf(bio_out, "%s", builtin_sigalgs);
+ BIO_puts(bio_out, builtin_sigalgs);
tls_sigalg_listed = 1;
}
OPENSSL_free(builtin_sigalgs);
}
if (!OSSL_PROVIDER_do_all(NULL, list_tls_sigalg_caps, &tls_sigalg_listed))
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"ERROR: could not list all provider signature algorithms\n");
if (tls_sigalg_listed < 2)
BIO_printf(bio_out,
"\nNo TLS sig algs registered by currently active providers");
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, "\n");
}
DEFINE_STACK_OF(EVP_KEM)
@@ -935,7 +933,7 @@ static void list_kems(void)
names = sk_OPENSSL_CSTRING_new(name_cmp);
if (names != NULL && EVP_KEM_names_do_all(k, collect_names, names)) {
count++;
- BIO_printf(bio_out, " ");
+ BIO_puts(bio_out, " ");
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s\n",
@@ -956,7 +954,7 @@ static void list_kems(void)
}
sk_EVP_KEM_pop_free(kem_stack, EVP_KEM_free);
if (count == 0)
- BIO_printf(bio_out, " -\n");
+ BIO_puts(bio_out, " -\n");
}
DEFINE_STACK_OF(EVP_ASYM_CIPHER)
@@ -997,7 +995,7 @@ static void list_asymciphers(void)
if (names != NULL
&& EVP_ASYM_CIPHER_names_do_all(k, collect_names, names)) {
count++;
- BIO_printf(bio_out, " ");
+ BIO_puts(bio_out, " ");
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s\n",
@@ -1018,7 +1016,7 @@ static void list_asymciphers(void)
}
sk_EVP_ASYM_CIPHER_pop_free(asymciph_stack, EVP_ASYM_CIPHER_free);
if (count == 0)
- BIO_printf(bio_out, " -\n");
+ BIO_puts(bio_out, " -\n");
}
DEFINE_STACK_OF(EVP_KEYEXCH)
@@ -1057,7 +1055,7 @@ static void list_keyexchanges(void)
names = sk_OPENSSL_CSTRING_new(name_cmp);
if (names != NULL && EVP_KEYEXCH_names_do_all(k, collect_names, names)) {
count++;
- BIO_printf(bio_out, " ");
+ BIO_puts(bio_out, " ");
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s\n",
@@ -1078,7 +1076,7 @@ static void list_keyexchanges(void)
}
sk_EVP_KEYEXCH_pop_free(kex_stack, EVP_KEYEXCH_free);
if (count == 0)
- BIO_printf(bio_out, " -\n");
+ BIO_puts(bio_out, " -\n");
}
static void list_objects(void)
@@ -1115,7 +1113,7 @@ static void list_objects(void)
if (n > oid_size) {
oid_buf = OPENSSL_realloc(oid_buf, n + 1);
if (oid_buf == NULL) {
- BIO_printf(bio_err, "ERROR: Memory allocation\n");
+ BIO_puts(bio_err, "ERROR: Memory allocation\n");
break; /* Error */
}
oid_size = n + 1;
@@ -1162,7 +1160,7 @@ static void list_options_for_command(const char *command)
BIO_printf(bio_out, "%s %c\n", o->name, c == '\0' ? '-' : c);
}
/* Always output the -- marker since it is sometimes documented. */
- BIO_printf(bio_out, "- -\n");
+ BIO_puts(bio_out, "- -\n");
}
static int is_md_available(const char *name)
@@ -1228,32 +1226,32 @@ static void list_type(FUNC_TYPE ft, int one)
BIO_printf(bio_out, "%s\n", fp->name);
} else {
if (i % dc.columns == 0 && i > 0)
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, "\n");
BIO_printf(bio_out, "%-*s", dc.width, fp->name);
i++;
}
}
if (!one)
- BIO_printf(bio_out, "\n\n");
+ BIO_puts(bio_out, "\n\n");
}
static void list_pkey(void)
{
- BIO_printf(bio_out, "Provided:\n");
- BIO_printf(bio_out, " Key Managers:\n");
+ BIO_puts(bio_out, "Provided:\n"
+ " Key Managers:\n");
list_keymanagers();
}
static void list_pkey_meth(void)
{
- BIO_printf(bio_out, "Provided:\n");
- BIO_printf(bio_out, " Encryption:\n");
+ BIO_puts(bio_out, "Provided:\n"
+ " Encryption:\n");
list_asymciphers();
- BIO_printf(bio_out, " Key Exchange:\n");
+ BIO_puts(bio_out, " Key Exchange:\n");
list_keyexchanges();
- BIO_printf(bio_out, " Signatures:\n");
+ BIO_puts(bio_out, " Signatures:\n");
list_signatures();
- BIO_printf(bio_out, " Key encapsulation:\n");
+ BIO_puts(bio_out, " Key encapsulation:\n");
list_kems();
}
@@ -1280,10 +1278,10 @@ static void list_store_loaders(void)
int i;
if (stores == NULL) {
- BIO_printf(bio_err, "ERROR: Memory allocation\n");
+ BIO_puts(bio_err, "ERROR: Memory allocation\n");
return;
}
- BIO_printf(bio_out, "Provided STORE LOADERs:\n");
+ BIO_puts(bio_out, "Provided STORE LOADERs:\n");
OSSL_STORE_LOADER_do_all_provided(app_get0_libctx(), collect_store_loaders,
stores);
sk_OSSL_STORE_LOADER_sort(stores);
@@ -1296,7 +1294,7 @@ static void list_store_loaders(void)
names = sk_OPENSSL_CSTRING_new(name_cmp);
if (names != NULL && OSSL_STORE_LOADER_names_do_all(l, collect_names, names)) {
- BIO_printf(bio_out, " ");
+ BIO_puts(bio_out, " ");
print_names(bio_out, names);
BIO_printf(bio_out, " @ %s\n",
@@ -1343,17 +1341,17 @@ static void list_provider_info(void)
int i;
if (providers == NULL) {
- BIO_printf(bio_err, "ERROR: Memory allocation\n");
+ BIO_puts(bio_err, "ERROR: Memory allocation\n");
return;
}
if (OSSL_PROVIDER_do_all(NULL, &collect_providers, providers) != 1) {
sk_OSSL_PROVIDER_free(providers);
- BIO_printf(bio_err, "ERROR: Memory allocation\n");
+ BIO_puts(bio_err, "ERROR: Memory allocation\n");
return;
}
- BIO_printf(bio_out, "Providers:\n");
+ BIO_puts(bio_out, "Providers:\n");
sk_OSSL_PROVIDER_sort(providers);
for (i = 0; i < sk_OSSL_PROVIDER_num(providers); i++) {
const OSSL_PROVIDER *prov = sk_OSSL_PROVIDER_value(providers, i);
@@ -1843,12 +1841,12 @@ int list_main(int argc, char **argv)
if (!opt_check_rest_arg(NULL))
goto opthelp;
-#define MAYBE_ADD_NL(cmd) \
- do { \
- if (print_newline++) { \
- BIO_printf(bio_out, "\n"); \
- } \
- cmd; \
+#define MAYBE_ADD_NL(cmd) \
+ do { \
+ if (print_newline++) { \
+ BIO_puts(bio_out, "\n"); \
+ } \
+ cmd; \
} while (0)
if (todo.commands)
@@ -1856,31 +1854,31 @@ int list_main(int argc, char **argv)
if (todo.all_algorithms) {
MAYBE_ADD_NL({});
- BIO_printf(bio_out, "Digests:\n");
+ BIO_puts(bio_out, "Digests:\n");
list_digests(" ");
- BIO_printf(bio_out, "\nSymmetric Ciphers:\n");
+ BIO_puts(bio_out, "\nSymmetric Ciphers:\n");
list_ciphers(" ");
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, "\n");
list_kdfs();
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, "\n");
list_macs();
- BIO_printf(bio_out, "\nProvided Asymmetric Encryption:\n");
+ BIO_puts(bio_out, "\nProvided Asymmetric Encryption:\n");
list_asymciphers();
- BIO_printf(bio_out, "\nProvided Key Exchange:\n");
+ BIO_puts(bio_out, "\nProvided Key Exchange:\n");
list_keyexchanges();
- BIO_printf(bio_out, "\nProvided Signatures:\n");
+ BIO_puts(bio_out, "\nProvided Signatures:\n");
list_signatures();
- BIO_printf(bio_out, "\nProvided Key encapsulation:\n");
+ BIO_puts(bio_out, "\nProvided Key encapsulation:\n");
list_kems();
- BIO_printf(bio_out, "\nProvided Key managers:\n");
+ BIO_puts(bio_out, "\nProvided Key managers:\n");
list_keymanagers();
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, "\n");
list_encoders();
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, "\n");
list_decoders();
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, "\n");
list_store_loaders();
}
if (todo.random_instances)
diff --git a/apps/mac.c b/apps/mac.c
index d67c573054..181a591735 100644
--- a/apps/mac.c
+++ b/apps/mac.c
@@ -172,7 +172,7 @@ int mac_main(int argc, char **argv)
goto err;
if (!EVP_MAC_CTX_set_params(ctx, params)) {
- BIO_printf(bio_err, "MAC parameter error\n");
+ BIO_puts(bio_err, "MAC parameter error\n");
ERR_print_errors(bio_err);
ok = 0;
}
@@ -190,7 +190,7 @@ int mac_main(int argc, char **argv)
goto err;
if (!EVP_MAC_init(ctx, NULL, 0, NULL)) {
- BIO_printf(bio_err, "EVP_MAC_Init failed\n");
+ BIO_puts(bio_err, "EVP_MAC_Init failed\n");
goto err;
}
@@ -204,22 +204,22 @@ int mac_main(int argc, char **argv)
if (i == 0)
break;
if (!EVP_MAC_update(ctx, buf, i)) {
- BIO_printf(bio_err, "EVP_MAC_update failed\n");
+ BIO_puts(bio_err, "EVP_MAC_update failed\n");
goto err;
}
}
if (!EVP_MAC_final(ctx, NULL, &len, 0)) {
- BIO_printf(bio_err, "EVP_MAC_final failed\n");
+ BIO_puts(bio_err, "EVP_MAC_final failed\n");
goto err;
}
if (len > BUFSIZE) {
- BIO_printf(bio_err, "output len is too large\n");
+ BIO_puts(bio_err, "output len is too large\n");
goto err;
}
if (!EVP_MAC_final(ctx, buf, &len, BUFSIZE)) {
- BIO_printf(bio_err, "EVP_MAC_final failed\n");
+ BIO_puts(bio_err, "EVP_MAC_final failed\n");
goto err;
}
@@ -229,7 +229,7 @@ int mac_main(int argc, char **argv)
for (i = 0; i < (int)len; ++i)
BIO_printf(out, "%02X", buf[i]);
if (outfile == NULL)
- BIO_printf(out, "\n");
+ BIO_puts(out, "\n");
}
ret = 0;
diff --git a/apps/ocsp.c b/apps/ocsp.c
index 084eb86b2a..02b0c19c6c 100644
--- a/apps/ocsp.c
+++ b/apps/ocsp.c
@@ -543,7 +543,7 @@ int ocsp_main(int argc, char **argv)
header = opt_arg();
value = strchr(header, '=');
if (value == NULL) {
- BIO_printf(bio_err, "Missing = in header key=value\n");
+ BIO_puts(bio_err, "Missing = in header key=value\n");
goto opthelp;
}
*value++ = '\0';
@@ -607,7 +607,7 @@ int ocsp_main(int argc, char **argv)
req = d2i_OCSP_REQUEST_bio(derbio, NULL);
BIO_free(derbio);
if (req == NULL) {
- BIO_printf(bio_err, "Error reading OCSP request\n");
+ BIO_puts(bio_err, "Error reading OCSP request\n");
goto end;
}
}
@@ -618,7 +618,7 @@ int ocsp_main(int argc, char **argv)
if (acbio == NULL)
goto end;
#else
- BIO_printf(bio_err, "Cannot act as server - sockets not supported\n");
+ BIO_puts(bio_err, "Cannot act as server - sockets not supported\n");
goto end;
#endif
}
@@ -628,7 +628,7 @@ int ocsp_main(int argc, char **argv)
rkeyfile = rsignfile;
rsigner = load_cert(rsignfile, FORMAT_UNDEF, "responder certificate");
if (rsigner == NULL) {
- BIO_printf(bio_err, "Error loading responder certificate\n");
+ BIO_puts(bio_err, "Error loading responder certificate\n");
goto end;
}
if (!load_certs(rca_filename, 0, &rca_certs, NULL, "CA certificates"))
@@ -639,7 +639,7 @@ int ocsp_main(int argc, char **argv)
goto end;
}
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
goto end;
}
rkey = load_key(rkeyfile, FORMAT_UNDEF, 0, passin,
@@ -650,7 +650,7 @@ int ocsp_main(int argc, char **argv)
if (ridx_filename != NULL
&& (rkey == NULL || rsigner == NULL || rca_certs == NULL)) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Responder mode requires certificate, key, and CA.\n");
goto end;
}
@@ -715,7 +715,7 @@ redo_accept:
if (req == NULL
&& (signfile != NULL || reqout != NULL
|| host != NULL || add_nonce || ridx_filename != NULL)) {
- BIO_printf(bio_err, "Need an OCSP request for this operation!\n");
+ BIO_puts(bio_err, "Need an OCSP request for this operation!\n");
goto end;
}
@@ -729,7 +729,7 @@ redo_accept:
keyfile = signfile;
signer = load_cert(signfile, FORMAT_UNDEF, "signer certificate");
if (signer == NULL) {
- BIO_printf(bio_err, "Error loading signer certificate\n");
+ BIO_puts(bio_err, "Error loading signer certificate\n");
goto end;
}
if (sign_certfile != NULL) {
@@ -744,7 +744,7 @@ redo_accept:
if (!OCSP_request_sign(req, signer, key, NULL,
sign_other, sign_flags)) {
- BIO_printf(bio_err, "Error signing OCSP request\n");
+ BIO_puts(bio_err, "Error signing OCSP request\n");
goto end;
}
}
@@ -779,7 +779,7 @@ redo_accept:
if (resp == NULL)
goto end;
#else
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error creating connect BIO - sockets not supported\n");
goto end;
#endif
@@ -790,7 +790,7 @@ redo_accept:
resp = d2i_OCSP_RESPONSE_bio(derbio, NULL);
BIO_free(derbio);
if (resp == NULL) {
- BIO_printf(bio_err, "Error reading OCSP response\n");
+ BIO_puts(bio_err, "Error reading OCSP response\n");
goto end;
}
} else {
@@ -857,7 +857,7 @@ done_resp:
bs = OCSP_response_get1_basic(resp);
if (bs == NULL) {
- BIO_printf(bio_err, "Error parsing response\n");
+ BIO_puts(bio_err, "Error parsing response\n");
goto end;
}
@@ -866,9 +866,9 @@ done_resp:
if (!noverify) {
if (req != NULL && ((i = OCSP_check_nonce(req, bs)) <= 0)) {
if (i == -1)
- BIO_printf(bio_err, "WARNING: no nonce in response\n");
+ BIO_puts(bio_err, "WARNING: no nonce in response\n");
else {
- BIO_printf(bio_err, "Nonce Verify error\n");
+ BIO_puts(bio_err, "Nonce Verify error\n");
ret = 1;
goto end;
}
@@ -881,11 +881,11 @@ done_resp:
ERR_clear_error();
}
if (i <= 0) {
- BIO_printf(bio_err, "Response Verify Failure\n");
+ BIO_puts(bio_err, "Response Verify Failure\n");
ERR_print_errors(bio_err);
ret = 1;
} else {
- BIO_printf(bio_err, "Response verify OK\n");
+ BIO_puts(bio_err, "Response verify OK\n");
}
}
@@ -953,7 +953,7 @@ static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert,
OCSP_CERTID *id = NULL;
if (issuer == NULL) {
- BIO_printf(bio_err, "No issuer certificate specified\n");
+ BIO_puts(bio_err, "No issuer certificate specified\n");
return 0;
}
if (*req == NULL)
@@ -971,7 +971,7 @@ static int add_ocsp_cert(OCSP_REQUEST **req, X509 *cert,
err:
OCSP_CERTID_free(id);
- BIO_printf(bio_err, "Error Creating OCSP request\n");
+ BIO_puts(bio_err, "Error Creating OCSP request\n");
return 0;
}
@@ -985,7 +985,7 @@ static int add_ocsp_serial(OCSP_REQUEST **req, char *serial,
ASN1_INTEGER *sno;
if (issuer == NULL) {
- BIO_printf(bio_err, "No issuer certificate specified\n");
+ BIO_puts(bio_err, "No issuer certificate specified\n");
return 0;
}
if (*req == NULL)
@@ -1011,7 +1011,7 @@ static int add_ocsp_serial(OCSP_REQUEST **req, char *serial,
err:
OCSP_CERTID_free(id);
- BIO_printf(bio_err, "Error Creating OCSP request\n");
+ BIO_puts(bio_err, "Error Creating OCSP request\n");
return 0;
}
@@ -1052,9 +1052,10 @@ static int print_ocsp_summary(BIO *out, OCSP_BASICRESP *bs, OCSP_REQUEST *req,
BIO_puts(out, "WARNING: Status times invalid.\n");
ERR_print_errors(out);
}
- BIO_printf(out, "%s\n", OCSP_cert_status_str(status));
+ BIO_printf(out, "%s\n"
+ "\tThis Update: ",
+ OCSP_cert_status_str(status));
- BIO_puts(out, "\tThis Update: ");
ASN1_GENERALIZEDTIME_print(out, thisupd);
BIO_puts(out, "\n");
@@ -1266,7 +1267,7 @@ static int do_responder(OCSP_REQUEST **preq, BIO **pcbio, BIO *acbio,
NULL /* found_keep_alive */,
prog, 1 /* accept_get */, timeout);
#else
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error getting OCSP request - sockets not supported\n");
*preq = NULL;
return 0;
@@ -1282,7 +1283,7 @@ static int send_ocsp_response(BIO *cbio, const OCSP_RESPONSE *resp)
ASN1_ITEM_rptr(OCSP_RESPONSE),
(const ASN1_VALUE *)resp);
#else
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error sending OCSP response - sockets not supported\n");
return 0;
#endif
@@ -1301,7 +1302,7 @@ OCSP_RESPONSE *process_responder(OCSP_REQUEST *req, const char *host,
if (use_ssl == 1) {
ctx = SSL_CTX_new(TLS_client_method());
if (ctx == NULL) {
- BIO_printf(bio_err, "Error creating SSL context.\n");
+ BIO_puts(bio_err, "Error creating SSL context.\n");
goto end;
}
}
@@ -1314,7 +1315,7 @@ OCSP_RESPONSE *process_responder(OCSP_REQUEST *req, const char *host,
req_timeout, ASN1_ITEM_rptr(OCSP_RESPONSE));
if (resp == NULL)
- BIO_printf(bio_err, "Error querying OCSP responder\n");
+ BIO_puts(bio_err, "Error querying OCSP responder\n");
end:
SSL_CTX_free(ctx);
diff --git a/apps/openssl.c b/apps/openssl.c
index e869910e82..526f3692cc 100644
--- a/apps/openssl.c
+++ b/apps/openssl.c
@@ -60,7 +60,7 @@ static void warn_deprecated(const FUNCTION *fp)
BIO_printf(bio_err, "The command %s is deprecated.", fp->name);
if (strcmp(fp->deprecated_alternative, DEPRECATED_NO_ALTERNATIVE) != 0)
BIO_printf(bio_err, " Use '%s' instead.", fp->deprecated_alternative);
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
}
static int apps_startup(void)
@@ -116,7 +116,7 @@ static size_t internal_trace_cb(const char *buf, size_t cnt,
switch (cmd) {
case OSSL_TRACE_CTRL_BEGIN:
if (trace_data->ingroup) {
- BIO_printf(bio_err, "ERROR: tracing already started\n");
+ BIO_puts(bio_err, "ERROR: tracing already started\n");
return 0;
}
trace_data->ingroup = 1;
@@ -131,7 +131,7 @@ static size_t internal_trace_cb(const char *buf, size_t cnt,
break;
case OSSL_TRACE_CTRL_WRITE:
if (!trace_data->ingroup) {
- BIO_printf(bio_err, "ERROR: writing when tracing not started\n");
+ BIO_puts(bio_err, "ERROR: writing when tracing not started\n");
return 0;
}
if (cnt > INT_MAX)
@@ -141,7 +141,7 @@ static size_t internal_trace_cb(const char *buf, size_t cnt,
break;
case OSSL_TRACE_CTRL_END:
if (!trace_data->ingroup) {
- BIO_printf(bio_err, "ERROR: finishing when tracing not started\n");
+ BIO_puts(bio_err, "ERROR: finishing when tracing not started\n");
return 0;
}
trace_data->ingroup = 0;
@@ -469,26 +469,26 @@ int help_main(int argc, char **argv)
for (fp = functions; fp->name != NULL; fp++) {
nl = 0;
if (i++ % dc.columns == 0) {
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
nl = 1;
}
if (fp->type != tp) {
tp = fp->type;
if (!nl)
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
if (tp == FT_md) {
i = 1;
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"\nMessage Digest commands (see the `dgst' command for more details)\n");
} else if (tp == FT_cipher) {
i = 1;
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"\nCipher commands (see the `enc' command for more details)\n");
}
}
BIO_printf(bio_err, "%-*s", dc.width, fp->name);
}
- BIO_printf(bio_err, "\n\n");
+ BIO_puts(bio_err, "\n\n");
return 0;
}
diff --git a/apps/passwd.c b/apps/passwd.c
index ebe1093207..b8cd8e4a48 100644
--- a/apps/passwd.c
+++ b/apps/passwd.c
@@ -256,7 +256,7 @@ int passwd_main(int argc, char **argv)
passwds[0] = passwd_malloc;
} else {
#endif
- BIO_printf(bio_err, "password required\n");
+ BIO_puts(bio_err, "password required\n");
goto end;
}
}
diff --git a/apps/pkcs12.c b/apps/pkcs12.c
index a9beaa0a3e..1fb4fb999d 100644
--- a/apps/pkcs12.c
+++ b/apps/pkcs12.c
@@ -513,7 +513,7 @@ int pkcs12_main(int argc, char **argv)
private = 1;
if (!app_passwd(passcertsarg, NULL, &passcerts, NULL)) {
- BIO_printf(bio_err, "Error getting certificate file password\n");
+ BIO_puts(bio_err, "Error getting certificate file password\n");
goto end;
}
@@ -525,7 +525,7 @@ int pkcs12_main(int argc, char **argv)
}
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {
- BIO_printf(bio_err, "Error getting passwords\n");
+ BIO_puts(bio_err, "Error getting passwords\n");
goto end;
}
@@ -541,9 +541,9 @@ int pkcs12_main(int argc, char **argv)
noprompt = 1;
if (twopass) {
if (export_pkcs12)
- BIO_printf(bio_err, "Option -twopass cannot be used with -passout or -password\n");
+ BIO_puts(bio_err, "Option -twopass cannot be used with -passout or -password\n");
else
- BIO_printf(bio_err, "Option -twopass cannot be used with -passin or -password\n");
+ BIO_puts(bio_err, "Option -twopass cannot be used with -passin or -password\n");
goto end;
}
} else {
@@ -557,12 +557,12 @@ int pkcs12_main(int argc, char **argv)
#ifndef OPENSSL_NO_UI_CONSOLE
if (EVP_read_pw_string(
macpass, sizeof(macpass), "Enter MAC Password:", export_pkcs12)) {
- BIO_printf(bio_err, "Can't read Password\n");
+ BIO_puts(bio_err, "Can't read Password\n");
goto end;
}
} else {
#endif
- BIO_printf(bio_err, "Unsupported option -twopass\n");
+ BIO_puts(bio_err, "Unsupported option -twopass\n");
goto end;
}
}
@@ -578,13 +578,13 @@ int pkcs12_main(int argc, char **argv)
ASN1_OBJECT *obj = NULL;
if ((options & (NOCERTS | NOKEYS)) == (NOCERTS | NOKEYS)) {
- BIO_printf(bio_err, "Nothing to export due to -noout or -nocerts and -nokeys\n");
+ BIO_puts(bio_err, "Nothing to export due to -noout or -nocerts and -nokeys\n");
goto export_end;
}
if ((options & NOCERTS) != 0) {
chain = 0;
- BIO_printf(bio_err, "Warning: -chain option ignored with -nocerts\n");
+ BIO_puts(bio_err, "Warning: -chain option ignored with -nocerts\n");
}
if (!(options & NOKEYS)) {
@@ -647,7 +647,7 @@ int pkcs12_main(int argc, char **argv)
ee_cert_tmp = sk_X509_value(certs, 0);
if (ee_cert_tmp == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"No end entity certificate to check with -chain\n");
goto export_end;
}
@@ -704,12 +704,12 @@ int pkcs12_main(int argc, char **argv)
#ifndef OPENSSL_NO_UI_CONSOLE
if (EVP_read_pw_string(pass, sizeof(pass),
"Enter Export Password:", 1)) {
- BIO_printf(bio_err, "Can't read Password\n");
+ BIO_puts(bio_err, "Can't read Password\n");
goto export_end;
}
} else {
#endif
- BIO_printf(bio_err, "Password required\n");
+ BIO_puts(bio_err, "Password required\n");
goto export_end;
}
}
@@ -742,14 +742,13 @@ int pkcs12_main(int argc, char **argv)
if (!PKCS12_set_pbmac1_pbkdf2(p12, mpass, -1, NULL,
macsaltlen, maciter,
macmd, pbmac1_pbkdf2_md)) {
- BIO_printf(bio_err, "Error creating PBMAC1\n");
+ BIO_puts(bio_err, "Error creating PBMAC1\n");
goto export_end;
}
} else {
if (!PKCS12_set_mac(p12, mpass, -1, NULL, macsaltlen, maciter, macmd)) {
- BIO_printf(bio_err, "Error creating PKCS12 MAC; no PKCS12KDF support?\n");
- BIO_printf(bio_err,
- "Use -nomac or -pbmac1_pbkdf2 if PKCS12KDF support not available\n");
+ BIO_puts(bio_err, "Error creating PKCS12 MAC; no PKCS12KDF support?\n"
+ "Use -nomac or -pbmac1_pbkdf2 if PKCS12KDF support not available\n");
goto export_end;
}
}
@@ -795,12 +794,12 @@ int pkcs12_main(int argc, char **argv)
#ifndef OPENSSL_NO_UI_CONSOLE
if (EVP_read_pw_string(pass, sizeof(pass), "Enter Import Password:",
0)) {
- BIO_printf(bio_err, "Can't read Password\n");
+ BIO_puts(bio_err, "Can't read Password\n");
goto end;
}
} else {
#endif
- BIO_printf(bio_err, "Password required\n");
+ BIO_puts(bio_err, "Password required\n");
goto end;
}
}
@@ -825,7 +824,7 @@ int pkcs12_main(int argc, char **argv)
PBKDF2PARAM *pbkdf2_param = PBMAC1_get1_pbkdf2_param(macalgid);
if (pbkdf2_param == NULL) {
- BIO_printf(bio_err, ", Unsupported KDF or params for PBMAC1\n");
+ BIO_puts(bio_err, ", Unsupported KDF or params for PBMAC1\n");
} else {
const ASN1_OBJECT *prfobj;
int prfnid;
@@ -860,7 +859,7 @@ int pkcs12_main(int argc, char **argv)
PKCS12_get0_mac(NULL, &macalgid, NULL, NULL, p12);
if (macalgid == NULL) {
- BIO_printf(bio_err, "Warning: MAC is absent!\n");
+ BIO_puts(bio_err, "Warning: MAC is absent!\n");
goto dump;
}
@@ -872,8 +871,8 @@ int pkcs12_main(int argc, char **argv)
pkcs12kdf = EVP_KDF_fetch(app_get0_libctx(), "PKCS12KDF",
app_get0_propq());
if (pkcs12kdf == NULL) {
- BIO_printf(bio_err, "Error verifying PKCS12 MAC; no PKCS12KDF support.\n");
- BIO_printf(bio_err, "Use -nomacver if MAC verification is not required.\n");
+ BIO_puts(bio_err, "Error verifying PKCS12 MAC; no PKCS12KDF support.\n");
+ BIO_puts(bio_err, "Use -nomacver if MAC verification is not required.\n");
goto end;
}
EVP_KDF_free(pkcs12kdf);
@@ -896,7 +895,7 @@ int pkcs12_main(int argc, char **argv)
if (ERR_GET_LIB(err) == ERR_LIB_PKCS12
&& ERR_GET_REASON(err) == PKCS12_R_MAC_ABSENT) {
- BIO_printf(bio_err, "Warning: MAC is absent!\n");
+ BIO_puts(bio_err, "Warning: MAC is absent!\n");
goto dump;
}
@@ -912,11 +911,11 @@ int pkcs12_main(int argc, char **argv)
}
OPENSSL_free(utmp);
if (!PKCS12_verify_mac(p12, badpass, -1)) {
- BIO_printf(bio_err, "Mac verify error: invalid password?\n");
+ BIO_puts(bio_err, "Mac verify error: invalid password?\n");
ERR_print_errors(bio_err);
goto end;
} else {
- BIO_printf(bio_err, "Warning: using broken algorithm\n");
+ BIO_puts(bio_err, "Warning: using broken algorithm\n");
if (!twopass)
cpass = badpass;
}
@@ -931,7 +930,7 @@ dump:
goto end;
if (!dump_certs_keys_p12(out, p12, cpass, -1, options, passout, enc)) {
- BIO_printf(bio_err, "Error outputting keys and certificates\n");
+ BIO_puts(bio_err, "Error outputting keys and certificates\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -992,12 +991,12 @@ int dump_certs_keys_p12(BIO *out, const PKCS12 *p12, const char *pass,
if (bagnid == NID_pkcs7_data) {
bags = PKCS12_unpack_p7data(p7);
if (options & INFO)
- BIO_printf(bio_err, "PKCS7 Data\n");
+ BIO_puts(bio_err, "PKCS7 Data\n");
} else if (bagnid == NID_pkcs7_encrypted) {
if (options & INFO) {
- BIO_printf(bio_err, "PKCS7 Encrypted data: ");
+ BIO_puts(bio_err, "PKCS7 Encrypted data: ");
if (p7->d.encrypted == NULL) {
- BIO_printf(bio_err, "<no data>\n");
+ BIO_puts(bio_err, "<no data>\n");
} else {
alg_print(p7->d.encrypted->enc_data->algorithm);
}
@@ -1052,7 +1051,7 @@ int dump_certs_pkeys_bag(BIO *out, const PKCS12_SAFEBAG *bag,
switch (PKCS12_SAFEBAG_get_nid(bag)) {
case NID_keyBag:
if (options & INFO)
- BIO_printf(bio_err, "Key bag\n");
+ BIO_puts(bio_err, "Key bag\n");
if (options & NOKEYS)
return 1;
print_attribs(out, attrs, "Bag Attributes");
@@ -1069,7 +1068,7 @@ int dump_certs_pkeys_bag(BIO *out, const PKCS12_SAFEBAG *bag,
const X509_SIG *tp8;
const X509_ALGOR *tp8alg;
- BIO_printf(bio_err, "Shrouded Keybag: ");
+ BIO_puts(bio_err, "Shrouded Keybag: ");
tp8 = PKCS12_SAFEBAG_get0_pkcs8(bag);
X509_SIG_get0(tp8, &tp8alg, NULL);
alg_print(tp8alg);
@@ -1091,7 +1090,7 @@ int dump_certs_pkeys_bag(BIO *out, const PKCS12_SAFEBAG *bag,
case NID_certBag:
if (options & INFO)
- BIO_printf(bio_err, "Certificate bag\n");
+ BIO_puts(bio_err, "Certificate bag\n");
if (options & NOCERTS)
return 1;
if (PKCS12_SAFEBAG_get0_attr(bag, NID_localKeyID)) {
@@ -1111,25 +1110,25 @@ int dump_certs_pkeys_bag(BIO *out, const PKCS12_SAFEBAG *bag,
case NID_secretBag:
if (options & INFO)
- BIO_printf(bio_err, "Secret bag\n");
+ BIO_puts(bio_err, "Secret bag\n");
print_attribs(out, attrs, "Bag Attributes");
- BIO_printf(bio_err, "Bag Type: ");
+ BIO_puts(bio_err, "Bag Type: ");
i2a_ASN1_OBJECT(bio_err, PKCS12_SAFEBAG_get0_bag_type(bag));
- BIO_printf(bio_err, "\nBag Value: ");
+ BIO_puts(bio_err, "\nBag Value: ");
print_attribute(out, PKCS12_SAFEBAG_get0_bag_obj(bag));
return 1;
case NID_safeContentsBag:
if (options & INFO)
- BIO_printf(bio_err, "Safe Contents bag\n");
+ BIO_puts(bio_err, "Safe Contents bag\n");
print_attribs(out, attrs, "Bag Attributes");
return dump_certs_pkeys_bags(out, PKCS12_SAFEBAG_get0_safes(bag),
pass, passlen, options, pempass, enc);
default:
- BIO_printf(bio_err, "Warning unsupported bag type: ");
+ BIO_puts(bio_err, "Warning unsupported bag type: ");
i2a_ASN1_OBJECT(bio_err, PKCS12_SAFEBAG_get0_type(bag));
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
return 1;
}
return ret;
@@ -1177,7 +1176,8 @@ static int alg_print(const X509_ALGOR *alg)
pbenid = OBJ_obj2nid(aoid);
- BIO_printf(bio_err, "%s", OBJ_nid2ln(pbenid));
+ const char *ln = OBJ_nid2ln(pbenid);
+ BIO_puts(bio_err, (ln != NULL) ? ln : "(null)");
/*
* If PBE algorithm is PBES2 decode algorithm parameters
@@ -1294,13 +1294,13 @@ void print_attribute(BIO *out, const ASN1_TYPE *av)
case V_ASN1_OCTET_STRING:
hex_print(out, av->value.octet_string->data,
av->value.octet_string->length);
- BIO_printf(out, "\n");
+ BIO_puts(out, "\n");
break;
case V_ASN1_BIT_STRING:
hex_print(out, av->value.bit_string->data,
av->value.bit_string->length);
- BIO_printf(out, "\n");
+ BIO_puts(out, "\n");
break;
case V_ASN1_OBJECT:
@@ -1308,8 +1308,7 @@ void print_attribute(BIO *out, const ASN1_TYPE *av)
if (!ln)
ln = "";
OBJ_obj2txt(objbuf, sizeof(objbuf), av->value.object, 1);
- BIO_printf(out, "%s (%s)", ln, objbuf);
- BIO_printf(out, "\n");
+ BIO_printf(out, "%s (%s)\n", ln, objbuf);
break;
default:
@@ -1340,10 +1339,10 @@ int print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst,
attr = sk_X509_ATTRIBUTE_value(attrlst, i);
attr_obj = X509_ATTRIBUTE_get0_object(attr);
attr_nid = OBJ_obj2nid(attr_obj);
- BIO_printf(out, " ");
+ BIO_puts(out, " ");
if (attr_nid == NID_undef) {
i2a_ASN1_OBJECT(out, attr_obj);
- BIO_printf(out, ": ");
+ BIO_puts(out, ": ");
} else {
BIO_printf(out, "%s: ", OBJ_nid2ln(attr_nid));
}
@@ -1354,7 +1353,7 @@ int print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst,
print_attribute(out, av);
}
} else {
- BIO_printf(out, "<No Values>\n");
+ BIO_puts(out, "<No Values>\n");
}
}
return 1;
diff --git a/apps/pkcs7.c b/apps/pkcs7.c
index 33d84098be..e317e0b00d 100644
--- a/apps/pkcs7.c
+++ b/apps/pkcs7.c
@@ -125,7 +125,7 @@ int pkcs7_main(int argc, char **argv)
p7 = PKCS7_new_ex(libctx, app_get0_propq());
if (p7 == NULL) {
- BIO_printf(bio_err, "unable to allocate PKCS7 object\n");
+ BIO_puts(bio_err, "unable to allocate PKCS7 object\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -135,7 +135,7 @@ int pkcs7_main(int argc, char **argv)
else
p7i = PEM_read_bio_PKCS7(in, &p7, NULL, NULL);
if (p7i == NULL) {
- BIO_printf(bio_err, "unable to load PKCS7 object\n");
+ BIO_puts(bio_err, "unable to load PKCS7 object\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -209,7 +209,7 @@ int pkcs7_main(int argc, char **argv)
i = PEM_write_bio_PKCS7(out, p7);
if (!i) {
- BIO_printf(bio_err, "unable to write pkcs7 object\n");
+ BIO_puts(bio_err, "unable to write pkcs7 object\n");
ERR_print_errors(bio_err);
goto end;
}
diff --git a/apps/pkcs8.c b/apps/pkcs8.c
index 4d73f30c2f..89965451fc 100644
--- a/apps/pkcs8.c
+++ b/apps/pkcs8.c
@@ -223,7 +223,7 @@ int pkcs8_main(int argc, char **argv)
}
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {
- BIO_printf(bio_err, "Error getting passwords\n");
+ BIO_puts(bio_err, "Error getting passwords\n");
goto end;
}
@@ -240,7 +240,7 @@ int pkcs8_main(int argc, char **argv)
if (pkey == NULL)
goto end;
if ((p8inf = EVP_PKEY2PKCS8(pkey)) == NULL) {
- BIO_printf(bio_err, "Error converting key\n");
+ BIO_puts(bio_err, "Error converting key\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -253,7 +253,7 @@ int pkcs8_main(int argc, char **argv)
} else if (outformat == FORMAT_ASN1) {
i2d_PKCS8_PRIV_KEY_INFO_bio(out, p8inf);
} else {
- BIO_printf(bio_err, "Bad format specified for key\n");
+ BIO_puts(bio_err, "Bad format specified for key\n");
goto end;
}
} else {
@@ -271,7 +271,7 @@ int pkcs8_main(int argc, char **argv)
pbe = PKCS5_pbe_set(pbe_nid, iter, NULL, saltlen);
}
if (pbe == NULL) {
- BIO_printf(bio_err, "Error setting PBE algorithm\n");
+ BIO_puts(bio_err, "Error setting PBE algorithm\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -287,13 +287,13 @@ int pkcs8_main(int argc, char **argv)
}
} else {
#endif
- BIO_printf(bio_err, "Password required\n");
+ BIO_puts(bio_err, "Password required\n");
goto end;
}
p8 = PKCS8_set0_pbe(p8pass, (int)strlen(p8pass), p8inf, pbe);
if (p8 == NULL) {
X509_ALGOR_free(pbe);
- BIO_printf(bio_err, "Error encrypting key\n");
+ BIO_puts(bio_err, "Error encrypting key\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -303,7 +303,7 @@ int pkcs8_main(int argc, char **argv)
else if (outformat == FORMAT_ASN1)
i2d_PKCS8_bio(out, p8);
else {
- BIO_printf(bio_err, "Bad format specified for key\n");
+ BIO_puts(bio_err, "Bad format specified for key\n");
goto end;
}
}
@@ -318,7 +318,7 @@ int pkcs8_main(int argc, char **argv)
} else if (informat == FORMAT_ASN1) {
p8inf = d2i_PKCS8_PRIV_KEY_INFO_bio(in, NULL);
} else {
- BIO_printf(bio_err, "Bad format specified for key\n");
+ BIO_puts(bio_err, "Bad format specified for key\n");
goto end;
}
} else {
@@ -327,12 +327,12 @@ int pkcs8_main(int argc, char **argv)
} else if (informat == FORMAT_ASN1) {
p8 = d2i_PKCS8_bio(in, NULL);
} else {
- BIO_printf(bio_err, "Bad format specified for key\n");
+ BIO_puts(bio_err, "Bad format specified for key\n");
goto end;
}
if (p8 == NULL) {
- BIO_printf(bio_err, "Error reading key\n");
+ BIO_puts(bio_err, "Error reading key\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -342,25 +342,25 @@ int pkcs8_main(int argc, char **argv)
#ifndef OPENSSL_NO_UI_CONSOLE
p8pass = pass;
if (EVP_read_pw_string(pass, sizeof(pass), "Enter Password:", 0)) {
- BIO_printf(bio_err, "Can't read Password\n");
+ BIO_puts(bio_err, "Can't read Password\n");
goto end;
}
} else {
#endif
- BIO_printf(bio_err, "Password required\n");
+ BIO_puts(bio_err, "Password required\n");
goto end;
}
p8inf = PKCS8_decrypt(p8, p8pass, (int)strlen(p8pass));
}
if (p8inf == NULL) {
- BIO_printf(bio_err, "Error decrypting key\n");
+ BIO_puts(bio_err, "Error decrypting key\n");
ERR_print_errors(bio_err);
goto end;
}
if ((pkey = EVP_PKCS82PKEY(p8inf)) == NULL) {
- BIO_printf(bio_err, "Error converting key\n");
+ BIO_puts(bio_err, "Error converting key\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -378,7 +378,7 @@ int pkcs8_main(int argc, char **argv)
} else if (outformat == FORMAT_ASN1) {
i2d_PrivateKey_bio(out, pkey);
} else {
- BIO_printf(bio_err, "Bad format specified for key\n");
+ BIO_puts(bio_err, "Bad format specified for key\n");
goto end;
}
ret = 0;
diff --git a/apps/pkey.c b/apps/pkey.c
index 0436332dec..b6da94d590 100644
--- a/apps/pkey.c
+++ b/apps/pkey.c
@@ -191,10 +191,10 @@ int pkey_main(int argc, char **argv)
goto opthelp;
if (text && text_pub)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: The -text option is ignored with -text_pub\n");
if (traditional && (noout || pubout))
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: -traditional is ignored with no private key output\n");
/* -pubout and -text is the same as -text_pub */
@@ -209,7 +209,7 @@ int pkey_main(int argc, char **argv)
goto opthelp;
if (cipher == NULL) {
if (passoutarg != NULL)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: The -passout option is ignored without a cipher option\n");
} else if (noout) {
EVP_CIPHER_free(cipher);
@@ -223,14 +223,14 @@ int pkey_main(int argc, char **argv)
break;
/* FALLTHROUGH */
default:
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error: Cipher options are supported only in PEM "
"and non-traditional DER output forms\n");
goto end;
}
}
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {
- BIO_printf(bio_err, "Error getting passwords\n");
+ BIO_puts(bio_err, "Error getting passwords\n");
goto end;
}
@@ -280,13 +280,13 @@ int pkey_main(int argc, char **argv)
r = EVP_PKEY_public_check(ctx);
if (r == 1) {
- BIO_printf(out, "Key is valid\n");
+ BIO_puts(out, "Key is valid\n");
} else {
/*
* Note: at least for RSA keys if this function returns
* -1, there will be no error reasons.
*/
- BIO_printf(bio_err, "Key is invalid\n");
+ BIO_puts(bio_err, "Key is invalid\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -311,7 +311,7 @@ int pkey_main(int argc, char **argv)
}
} else if (outformat == FORMAT_ASN1) {
if (text || text_pub) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error: Text output cannot be combined with DER output\n");
goto end;
}
@@ -329,7 +329,7 @@ int pkey_main(int argc, char **argv)
}
}
} else {
- BIO_printf(bio_err, "Bad format specified for key\n");
+ BIO_puts(bio_err, "Bad format specified for key\n");
goto end;
}
}
diff --git a/apps/pkeyparam.c b/apps/pkeyparam.c
index 624ab91cf0..cb4e92672b 100644
--- a/apps/pkeyparam.c
+++ b/apps/pkeyparam.c
@@ -96,7 +96,7 @@ int pkeyparam_main(int argc, char **argv)
pkey = PEM_read_bio_Parameters_ex(in, NULL, app_get0_libctx(),
app_get0_propq());
if (pkey == NULL) {
- BIO_printf(bio_err, "Error reading parameters\n");
+ BIO_puts(bio_err, "Error reading parameters\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -115,13 +115,13 @@ int pkeyparam_main(int argc, char **argv)
r = EVP_PKEY_param_check(ctx);
if (r == 1) {
- BIO_printf(out, "Parameters are valid\n");
+ BIO_puts(out, "Parameters are valid\n");
} else {
/*
* Note: at least for RSA keys if this function returns
* -1, there will be no error reasons.
*/
- BIO_printf(bio_err, "Parameters are invalid\n");
+ BIO_puts(bio_err, "Parameters are invalid\n");
ERR_print_errors(bio_err);
goto end;
}
diff --git a/apps/pkeyutl.c b/apps/pkeyutl.c
index 5f6406908f..14b7790221 100644
--- a/apps/pkeyutl.c
+++ b/apps/pkeyutl.c
@@ -357,7 +357,7 @@ int pkeyutl_main(int argc, char **argv)
if (rawin) {
if ((mctx = EVP_MD_CTX_new()) == NULL) {
- BIO_printf(bio_err, "Error: out of memory\n");
+ BIO_puts(bio_err, "Error: out of memory\n");
goto end;
}
}
@@ -479,8 +479,8 @@ int pkeyutl_main(int argc, char **argv)
if (pkey_op == EVP_PKEY_OP_ENCAPSULATE
|| pkey_op == EVP_PKEY_OP_DECAPSULATE) {
if (secoutfile == NULL && pkey_op == EVP_PKEY_OP_ENCAPSULATE) {
- BIO_printf(bio_err, "KEM-based shared-secret derivation requires "
- "the '-secret <file>' option\n");
+ BIO_puts(bio_err, "KEM-based shared-secret derivation requires "
+ "the '-secret <file>' option\n");
goto end;
}
/* For backwards compatibility, default decap secrets to the output */
@@ -499,7 +499,7 @@ int pkeyutl_main(int argc, char **argv)
}
if (!bio_to_mem(&sig, &siglen, maxsiglen, sigbio)) {
BIO_free(sigbio);
- BIO_printf(bio_err, "Error reading signature data\n");
+ BIO_puts(bio_err, "Error reading signature data\n");
goto end;
}
BIO_free(sigbio);
@@ -509,7 +509,7 @@ int pkeyutl_main(int argc, char **argv)
if (in != NULL && !rawin) {
/* Read the input data */
if (!bio_to_mem(&buf_in, &buf_inlen, 0, in)) {
- BIO_printf(bio_err, "Error reading input Data\n");
+ BIO_puts(bio_err, "Error reading input Data\n");
goto end;
}
if (rev) {
@@ -629,11 +629,11 @@ static EVP_PKEY *get_pkey(const char *kdfalg,
if (((pkey_op == EVP_PKEY_OP_SIGN) || (pkey_op == EVP_PKEY_OP_DECRYPT)
|| (pkey_op == EVP_PKEY_OP_DERIVE))
&& (key_type != KEY_PRIVKEY && kdfalg == NULL)) {
- BIO_printf(bio_err, "A private key is needed for this operation\n");
+ BIO_puts(bio_err, "A private key is needed for this operation\n");
return NULL;
}
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
return NULL;
}
switch (key_type) {
@@ -833,7 +833,7 @@ static int do_raw_keyop(int pkey_op, EVP_MD_CTX *mctx,
/* Some algorithms only support oneshot digests */
if (only_nomd(pkey)) {
if (filesize < 0) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Error: unable to determine file size for oneshot operation\n");
goto end;
}
@@ -843,7 +843,7 @@ static int do_raw_keyop(int pkey_op, EVP_MD_CTX *mctx,
case EVP_PKEY_OP_VERIFY:
buf_len = BIO_read(in, mbuf, filesize);
if (buf_len != filesize) {
- BIO_printf(bio_err, "Error reading raw input data\n");
+ BIO_puts(bio_err, "Error reading raw input data\n");
goto end;
}
rv = EVP_DigestVerify(mctx, sig, siglen, mbuf, buf_len);
@@ -851,7 +851,7 @@ static int do_raw_keyop(int pkey_op, EVP_MD_CTX *mctx,
case EVP_PKEY_OP_SIGN:
buf_len = BIO_read(in, mbuf, filesize);
if (buf_len != filesize) {
- BIO_printf(bio_err, "Error reading raw input data\n");
+ BIO_puts(bio_err, "Error reading raw input data\n");
goto end;
}
rv = EVP_DigestSign(mctx, NULL, poutlen, mbuf, buf_len);
@@ -871,12 +871,12 @@ static int do_raw_keyop(int pkey_op, EVP_MD_CTX *mctx,
if (buf_len == 0)
break;
if (buf_len < 0) {
- BIO_printf(bio_err, "Error reading raw input data\n");
+ BIO_puts(bio_err, "Error reading raw input data\n");
goto end;
}
rv = EVP_DigestVerifyUpdate(mctx, tbuf, (size_t)buf_len);
if (rv != 1) {
- BIO_printf(bio_err, "Error verifying raw input data\n");
+ BIO_puts(bio_err, "Error verifying raw input data\n");
goto end;
}
}
@@ -888,12 +888,12 @@ static int do_raw_keyop(int pkey_op, EVP_MD_CTX *mctx,
if (buf_len == 0)
break;
if (buf_len < 0) {
- BIO_printf(bio_err, "Error reading raw input data\n");
+ BIO_puts(bio_err, "Error reading raw input data\n");
goto end;
}
rv = EVP_DigestSignUpdate(mctx, tbuf, (size_t)buf_len);
if (rv != 1) {
- BIO_printf(bio_err, "Error signing raw input data\n");
+ BIO_puts(bio_err, "Error signing raw input data\n");
goto end;
}
}
diff --git a/apps/prime.c b/apps/prime.c
index ffb7648384..90c2e053c4 100644
--- a/apps/prime.c
+++ b/apps/prime.c
@@ -67,7 +67,7 @@ static void process_num(const char *s, const int is_hex)
r = BN_check_prime(bn, NULL, NULL);
BN_free(bn);
if (r < 0) {
- BIO_printf(bio_err, "Error checking prime\n");
+ BIO_puts(bio_err, "Error checking prime\n");
return;
}
@@ -150,7 +150,7 @@ int prime_main(int argc, char **argv)
argc = opt_num_rest();
argv = opt_rest();
if (!generate && argc == 0) {
- BIO_printf(bio_err, "Missing number (s) to check\n");
+ BIO_puts(bio_err, "Missing number (s) to check\n");
goto opthelp;
}
@@ -158,21 +158,21 @@ int prime_main(int argc, char **argv)
char *s;
if (!bits) {
- BIO_printf(bio_err, "Specify the number of bits.\n");
+ BIO_puts(bio_err, "Specify the number of bits.\n");
goto end;
}
bn = BN_new();
if (bn == NULL) {
- BIO_printf(bio_err, "Out of memory.\n");
+ BIO_puts(bio_err, "Out of memory.\n");
goto end;
}
if (!BN_generate_prime_ex(bn, bits, safe, NULL, NULL, NULL)) {
- BIO_printf(bio_err, "Failed to generate prime.\n");
+ BIO_puts(bio_err, "Failed to generate prime.\n");
goto end;
}
s = hex ? BN_bn2hex(bn) : BN_bn2dec(bn);
if (s == NULL) {
- BIO_printf(bio_err, "Out of memory.\n");
+ BIO_puts(bio_err, "Out of memory.\n");
goto end;
}
BIO_printf(bio_out, "%s\n", s);
diff --git a/apps/rand.c b/apps/rand.c
index a4fb7ecde0..668984369a 100644
--- a/apps/rand.c
+++ b/apps/rand.c
@@ -165,7 +165,7 @@ int rand_main(int argc, char **argv)
}
scaled_num = num << shift;
if (scaled_num > (UINT64_MAX >> 3)) {
- BIO_printf(bio_err, "Request exceeds max allowed output\n");
+ BIO_puts(bio_err, "Request exceeds max allowed output\n");
goto opthelp;
}
} else {
diff --git a/apps/rehash.c b/apps/rehash.c
index ab4737495b..c68015e082 100644
--- a/apps/rehash.c
+++ b/apps/rehash.c
@@ -168,7 +168,7 @@ static int add_entry(enum Type type, unsigned int hash, const char *filename,
if (ep->filename == NULL) {
OPENSSL_free(ep);
ep = NULL;
- BIO_printf(bio_err, "out of memory\n");
+ BIO_puts(bio_err, "out of memory\n");
return 1;
}
if (bp->last_entry)
@@ -278,7 +278,7 @@ static int do_file(const char *filename, const char *fullpath, enum Hash h)
type = TYPE_CERT;
name = X509_get_subject_name(x->x509);
if (!X509_digest(x->x509, evpmd, digest, NULL)) {
- BIO_printf(bio_err, "out of memory\n");
+ BIO_puts(bio_err, "out of memory\n");
++errs;
goto end;
}
@@ -286,7 +286,7 @@ static int do_file(const char *filename, const char *fullpath, enum Hash h)
type = TYPE_CRL;
name = X509_CRL_get_issuer(x->crl);
if (!X509_CRL_digest(x->crl, evpmd, digest, NULL)) {
- BIO_printf(bio_err, "out of memory\n");
+ BIO_puts(bio_err, "out of memory\n");
++errs;
goto end;
}
@@ -587,7 +587,7 @@ const OPTIONS rehash_options[] = {
int rehash_main(int argc, char **argv)
{
- BIO_printf(bio_err, "Not available\n");
+ BIO_puts(bio_err, "Not available\n");
return 1;
}
diff --git a/apps/req.c b/apps/req.c
index 3171342d85..258e489fb0 100644
--- a/apps/req.c
+++ b/apps/req.c
@@ -240,7 +240,7 @@ static int duplicated(LHASH_OF(OPENSSL_STRING) *addexts, char *kv)
while (isspace(_UC(*kv)))
kv++;
if ((p = strchr(kv, '=')) == NULL) {
- BIO_printf(bio_err, "Parse error on -addext: missing '='\n");
+ BIO_puts(bio_err, "Parse error on -addext: missing '='\n");
return -2;
}
off = p - kv;
@@ -252,7 +252,7 @@ static int duplicated(LHASH_OF(OPENSSL_STRING) *addexts, char *kv)
if (!isspace(_UC(p[-1])))
break;
if (p == kv) {
- BIO_printf(bio_err, "Parse error on -addext: missing key\n");
+ BIO_puts(bio_err, "Parse error on -addext: missing key\n");
OPENSSL_free(kv);
return -2;
}
@@ -463,7 +463,7 @@ int req_main(int argc, char **argv)
break;
case OPT_SET_SERIAL:
if (serial != NULL) {
- BIO_printf(bio_err, "Serial number supplied twice\n");
+ BIO_puts(bio_err, "Serial number supplied twice\n");
goto opthelp;
}
serial = s2i_ASN1_INTEGER(NULL, opt_arg());
@@ -531,24 +531,24 @@ int req_main(int argc, char **argv)
if (!gen_x509) {
if (days != UNSET_DAYS)
- BIO_printf(bio_err, "Warning: Ignoring -days without -x509; not generating a certificate\n");
+ BIO_puts(bio_err, "Warning: Ignoring -days without -x509; not generating a certificate\n");
if (not_before != NULL)
- BIO_printf(bio_err, "Warning: Ignoring -not_before without -x509; not generating a certificate\n");
+ BIO_puts(bio_err, "Warning: Ignoring -not_before without -x509; not generating a certificate\n");
if (not_after != NULL)
- BIO_printf(bio_err, "Warning: Ignoring -not_after without -x509; not generating a certificate\n");
+ BIO_puts(bio_err, "Warning: Ignoring -not_after without -x509; not generating a certificate\n");
if (ext_copy == EXT_COPY_NONE)
- BIO_printf(bio_err, "Warning: Ignoring -copy_extensions 'none' when -x509 is not given\n");
+ BIO_puts(bio_err, "Warning: Ignoring -copy_extensions 'none' when -x509 is not given\n");
}
if (infile == NULL) {
if (gen_x509)
newreq = 1;
else if (!newreq && isatty(fileno_stdin()))
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: Will read cert request from stdin since no -in option is given\n");
}
if (!app_passwd(passargin, passargout, &passin, &passout)) {
- BIO_printf(bio_err, "Error getting passwords\n");
+ BIO_puts(bio_err, "Error getting passwords\n");
goto end;
}
@@ -556,7 +556,7 @@ int req_main(int argc, char **argv)
goto end;
if (addext_bio != NULL) {
if (verbose)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Using additional configuration from -addext options\n");
if ((addext_conf = app_load_config_bio(addext_bio, NULL)) == NULL)
goto end;
@@ -616,7 +616,7 @@ int req_main(int argc, char **argv)
X509V3_set_ctx_test(&ctx);
X509V3_set_nconf(&ctx, req_conf);
if (!X509V3_EXT_add_nconf(addext_conf, &ctx, "default", NULL)) {
- BIO_printf(bio_err, "Error checking extensions defined using -addext\n");
+ BIO_puts(bio_err, "Error checking extensions defined using -addext\n");
goto end;
}
}
@@ -646,7 +646,7 @@ int req_main(int argc, char **argv)
app_RAND_load_conf(req_conf, section);
}
if (keyalg != NULL && pkey != NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: Not generating key via given -newkey option since -key is given\n");
/* Better throw an error in this case */
}
@@ -713,11 +713,11 @@ int req_main(int argc, char **argv)
if (pkey != NULL && (keyfile == NULL || keyout != NULL)) {
if (verbose) {
- BIO_printf(bio_err, "Writing private key to ");
+ BIO_puts(bio_out, "Writing private key to ");
if (keyout == NULL)
- BIO_printf(bio_err, "stdout\n");
+ BIO_puts(bio_out, "stdout\n");
else
- BIO_printf(bio_err, "'%s'\n", keyout);
+ BIO_printf(bio_out, "'%s'\n", keyout);
}
out = bio_open_owner(keyout, outformat, 1);
if (out == NULL)
@@ -744,7 +744,7 @@ int req_main(int argc, char **argv)
}
BIO_free_all(out);
out = NULL;
- BIO_printf(bio_err, "-----\n");
+ BIO_puts(bio_err, "-----\n");
}
/*
@@ -757,14 +757,14 @@ int req_main(int argc, char **argv)
if (!newreq) {
if (keyfile != NULL)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: Not placing -key in cert or request since request is used\n");
req = load_csr_autofmt(infile /* if NULL, reads from stdin */,
informat, vfyopts, "X509 request");
if (req == NULL)
goto end;
} else if (infile != NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: Ignoring -in option since -new or -newkey or -precert is given\n");
/* Better throw an error in this case, as done in the x509 app */
}
@@ -773,7 +773,7 @@ int req_main(int argc, char **argv)
CAkeyfile = CAfile;
if (CAkeyfile != NULL) {
if (CAfile == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: Ignoring -CAkey option since no -CA option is given\n");
} else {
if ((CAkey = load_key(CAkeyfile, FORMAT_UNDEF,
@@ -791,15 +791,15 @@ int req_main(int argc, char **argv)
== NULL)
goto end;
if (!X509_check_private_key(CAcert, CAkey)) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Issuer CA certificate and key do not match\n");
goto end;
}
}
if (newreq || gen_x509) {
if (CAcert == NULL && pkey == NULL) {
- BIO_printf(bio_err, "Must provide a signature key using -key or"
- " provide -CA / -CAkey\n");
+ BIO_puts(bio_err, "Must provide a signature key using -key or"
+ " provide -CA / -CAkey\n");
goto end;
}
@@ -810,7 +810,7 @@ int req_main(int argc, char **argv)
}
if (!make_REQ(req, pkey, fsubj, multirdn, !gen_x509, chtype)) {
- BIO_printf(bio_err, "Error making certificate request\n");
+ BIO_puts(bio_err, "Error making certificate request\n");
goto end;
}
/* Note that -x509 can take over -key and -subj option values. */
@@ -823,7 +823,7 @@ int req_main(int argc, char **argv)
X509_NAME *n_subj = fsubj != NULL ? fsubj : X509_REQ_get_subject_name(req);
if (CAcert != NULL && keyfile != NULL)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: Not using -key or -newkey for signing since -CA option is given\n");
if ((new_x509 = X509_new_ex(app_get0_libctx(),
@@ -844,7 +844,7 @@ int req_main(int argc, char **argv)
if (days == UNSET_DAYS)
days = DEFAULT_DAYS;
else if (not_after != NULL)
- BIO_printf(bio_err, "Warning: -not_after option overriding -days option\n");
+ BIO_puts(bio_err, "Warning: -not_after option overriding -days option\n");
if (!set_cert_times(new_x509, not_before, not_after, days, 1))
goto end;
if (!X509_set_subject_name(new_x509, n_subj))
@@ -853,9 +853,9 @@ int req_main(int argc, char **argv)
goto end;
if (ext_copy == EXT_COPY_UNSET) {
if (infile != NULL)
- BIO_printf(bio_err, "Warning: No -copy_extensions given; ignoring any extensions in the request\n");
+ BIO_puts(bio_err, "Warning: No -copy_extensions given; ignoring any extensions in the request\n");
} else if (!copy_extensions(new_x509, req, ext_copy)) {
- BIO_printf(bio_err, "Error copying extensions from request\n");
+ BIO_puts(bio_err, "Error copying extensions from request\n");
goto end;
}
@@ -867,7 +867,7 @@ int req_main(int argc, char **argv)
if (!X509V3_set_issuer_pkey(&ext_ctx, issuer_key))
goto end;
if (!cert_matches_key(new_x509, issuer_key))
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: Signature key and public key of cert do not match\n");
}
X509V3_set_nconf(&ext_ctx, req_conf);
@@ -882,7 +882,7 @@ int req_main(int argc, char **argv)
if (addext_conf != NULL
&& !X509V3_EXT_add_nconf(addext_conf, &ext_ctx, "default",
new_x509)) {
- BIO_printf(bio_err, "Error adding x509 extensions defined via -addext\n");
+ BIO_puts(bio_err, "Error adding x509 extensions defined via -addext\n");
goto end;
}
@@ -891,7 +891,7 @@ int req_main(int argc, char **argv)
if (X509_add1_ext_i2d(new_x509, NID_ct_precert_poison,
NULL, 1, 0)
!= 1) {
- BIO_printf(bio_err, "Error adding poison extension\n");
+ BIO_puts(bio_err, "Error adding poison extension\n");
goto end;
}
}
@@ -904,7 +904,7 @@ int req_main(int argc, char **argv)
X509V3_CTX ext_ctx;
if (precert) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: Ignoring -precert flag since no cert is produced\n");
}
/* Set up V3 context struct */
@@ -921,7 +921,7 @@ int req_main(int argc, char **argv)
if (addext_conf != NULL
&& !X509V3_EXT_REQ_add_nconf(addext_conf, &ext_ctx, "default",
req)) {
- BIO_printf(bio_err, "Error adding request extensions defined via -addext\n");
+ BIO_puts(bio_err, "Error adding request extensions defined via -addext\n");
goto end;
}
i = do_X509_REQ_sign(req, pkey, digest, sigopts);
@@ -932,12 +932,12 @@ int req_main(int argc, char **argv)
if (subj != NULL && !newreq && !gen_x509) {
if (verbose) {
- BIO_printf(out, "Modifying subject of certificate request\n");
+ BIO_puts(out, "Modifying subject of certificate request\n");
print_name(out, "Old subject=", X509_REQ_get_subject_name(req));
}
if (!X509_REQ_set_subject_name(req, fsubj)) {
- BIO_printf(bio_err, "Error modifying subject of certificate request\n");
+ BIO_puts(bio_err, "Error modifying subject of certificate request\n");
goto end;
}
@@ -960,10 +960,10 @@ int req_main(int argc, char **argv)
if (i < 0)
goto end;
if (i == 0) {
- BIO_printf(bio_err, "Certificate request self-signature verify failure\n");
+ BIO_puts(bio_err, "Certificate request self-signature verify failure\n");
goto end;
} else /* i > 0 */ {
- BIO_printf(bio_out, "Certificate request self-signature verify OK\n");
+ BIO_puts(bio_out, "Certificate request self-signature verify OK\n");
}
}
@@ -982,7 +982,7 @@ int req_main(int argc, char **argv)
EVP_PKEY *tpubkey = X509_REQ_get0_pubkey(req);
if (tpubkey == NULL) {
- BIO_printf(bio_err, "Error getting public key\n");
+ BIO_puts(bio_err, "Error getting public key\n");
goto end;
}
PEM_write_bio_PUBKEY(out, tpubkey);
@@ -996,9 +996,9 @@ int req_main(int argc, char **argv)
if (ret == 0) {
if (gen_x509)
- BIO_printf(bio_err, "Error printing certificate\n");
+ BIO_puts(bio_err, "Error printing certificate\n");
else
- BIO_printf(bio_err, "Error printing certificate request\n");
+ BIO_puts(bio_err, "Error printing certificate request\n");
goto end;
}
}
@@ -1040,7 +1040,7 @@ int req_main(int argc, char **argv)
else
i = PEM_write_bio_X509_REQ(out, req);
if (!i) {
- BIO_printf(bio_err, "Unable to write certificate request\n");
+ BIO_puts(bio_err, "Unable to write certificate request\n");
goto end;
}
}
@@ -1050,7 +1050,7 @@ int req_main(int argc, char **argv)
else
i = PEM_write_bio_X509(out, new_x509);
if (!i) {
- BIO_printf(bio_err, "Unable to write X509 certificate\n");
+ BIO_puts(bio_err, "Unable to write X509 certificate\n");
goto end;
}
}
@@ -1152,18 +1152,18 @@ static int prompt_info(X509_REQ *req,
X509_NAME *subj = X509_REQ_get_subject_name(req);
if (!batch) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"You are about to be asked to enter information that will be incorporated\n");
- BIO_printf(bio_err, "into your certificate request.\n");
- BIO_printf(bio_err,
+ BIO_puts(bio_err, "into your certificate request.\n");
+ BIO_puts(bio_err,
"What you are about to enter is what is called a Distinguished Name or a DN.\n");
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"There are quite a few fields but you can leave some blank\n");
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"For some fields there will be a default value,\n");
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"If you enter '.', the field will be left blank.\n");
- BIO_printf(bio_err, "-----\n");
+ BIO_puts(bio_err, "-----\n");
}
if (sk_CONF_VALUE_num(dn_sk)) {
@@ -1224,16 +1224,15 @@ static int prompt_info(X509_REQ *req,
return 0;
}
if (X509_NAME_entry_count(subj) == 0) {
- BIO_printf(bio_err, "Error: No objects specified in config file\n");
+ BIO_puts(bio_err, "Error: No objects specified in config file\n");
return 0;
}
if (attribs) {
if ((attr_sk != NULL) && (sk_CONF_VALUE_num(attr_sk) > 0)
&& (!batch)) {
- BIO_printf(bio_err,
- "\nPlease enter the following 'extra' attributes\n");
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
+ "\nPlease enter the following 'extra' attributes\n"
"to be sent with your certificate request\n");
}
@@ -1276,7 +1275,7 @@ static int prompt_info(X509_REQ *req,
}
}
} else {
- BIO_printf(bio_err, "No template, please set one up.\n");
+ BIO_puts(bio_err, "No template, please set one up.\n");
return 0;
}
@@ -1335,7 +1334,7 @@ static int auto_info(X509_REQ *req, STACK_OF(CONF_VALUE) *dn_sk,
}
if (!X509_NAME_entry_count(subj)) {
- BIO_printf(bio_err, "Error: No objects specified in config file\n");
+ BIO_puts(bio_err, "Error: No objects specified in config file\n");
return 0;
}
if (attribs) {
@@ -1384,7 +1383,7 @@ static int add_attribute_object(X509_REQ *req, char *text, const char *def,
if (!X509_REQ_add1_attr_by_NID(req, nid, chtype,
(unsigned char *)buf, -1)) {
- BIO_printf(bio_err, "Error adding attribute\n");
+ BIO_puts(bio_err, "Error adding attribute\n");
ret = 0;
}
@@ -1428,7 +1427,7 @@ start:
i = (int)strlen(buf);
if (buf[i - 1] != '\n') {
- BIO_printf(bio_err, "Missing newline at end of input\n");
+ BIO_puts(bio_err, "Missing newline at end of input\n");
return 0;
}
buf[--i] = '\0';
@@ -1592,7 +1591,7 @@ static EVP_PKEY_CTX *set_keygen_ctx(const char *gstr,
*pkeytype = OPENSSL_strdup(keytype);
if (*pkeytype == NULL) {
- BIO_printf(bio_err, "Out of memory\n");
+ BIO_puts(bio_err, "Out of memory\n");
EVP_PKEY_free(param);
return NULL;
}
@@ -1602,7 +1601,7 @@ static EVP_PKEY_CTX *set_keygen_ctx(const char *gstr,
if (param != NULL) {
if (!EVP_PKEY_is_a(param, *pkeytype)) {
- BIO_printf(bio_err, "Key type does not match parameters\n");
+ BIO_puts(bio_err, "Key type does not match parameters\n");
EVP_PKEY_free(param);
return NULL;
}
diff --git a/apps/rsa.c b/apps/rsa.c
index 6cdffd1eae..290176d0b9 100644
--- a/apps/rsa.c
+++ b/apps/rsa.c
@@ -233,11 +233,11 @@ int rsa_main(int argc, char **argv)
private = (text && !pubin) || (!pubout && !noout);
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {
- BIO_printf(bio_err, "Error getting passwords\n");
+ BIO_puts(bio_err, "Error getting passwords\n");
goto end;
}
if (check && pubin) {
- BIO_printf(bio_err, "Only private keys can be checked\n");
+ BIO_puts(bio_err, "Only private keys can be checked\n");
goto end;
}
@@ -263,7 +263,7 @@ int rsa_main(int argc, char **argv)
goto end;
}
if (!EVP_PKEY_is_a(pkey, "RSA") && !EVP_PKEY_is_a(pkey, "RSA-PSS")) {
- BIO_printf(bio_err, "Not an RSA key\n");
+ BIO_puts(bio_err, "Not an RSA key\n");
goto end;
}
@@ -286,9 +286,9 @@ int rsa_main(int argc, char **argv)
/* Every RSA key has an 'n' */
EVP_PKEY_get_bn_param(pkey, "n", &n);
- BIO_printf(out, "Modulus=");
+ BIO_puts(out, "Modulus=");
BN_print(out, n);
- BIO_printf(out, "\n");
+ BIO_puts(out, "\n");
BN_free(n);
}
@@ -297,7 +297,7 @@ int rsa_main(int argc, char **argv)
pctx = EVP_PKEY_CTX_new_from_pkey(NULL, pkey, NULL);
if (pctx == NULL) {
- BIO_printf(bio_err, "RSA unable to create PKEY context\n");
+ BIO_puts(bio_err, "RSA unable to create PKEY context\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -305,9 +305,9 @@ int rsa_main(int argc, char **argv)
EVP_PKEY_CTX_free(pctx);
if (r == 1) {
- BIO_printf(out, "RSA key ok\n");
+ BIO_puts(out, "RSA key ok\n");
} else if (r == 0) {
- BIO_printf(bio_err, "RSA key not ok\n");
+ BIO_puts(bio_err, "RSA key not ok\n");
ERR_print_errors(bio_err);
} else if (r < 0) {
ERR_print_errors(bio_err);
@@ -319,7 +319,7 @@ int rsa_main(int argc, char **argv)
ret = 0;
goto end;
}
- BIO_printf(bio_err, "writing RSA key\n");
+ BIO_puts(bio_err, "writing RSA key\n");
/* Choose output type for the format */
if (outformat == FORMAT_ASN1) {
@@ -330,12 +330,12 @@ int rsa_main(int argc, char **argv)
output_type = "MSBLOB";
} else if (outformat == FORMAT_PVK) {
if (pubin) {
- BIO_printf(bio_err, "PVK form impossible with public key input\n");
+ BIO_puts(bio_err, "PVK form impossible with public key input\n");
goto end;
}
output_type = "PVK";
} else {
- BIO_printf(bio_err, "bad output format specified for outfile\n");
+ BIO_puts(bio_err, "bad output format specified for outfile\n");
goto end;
}
@@ -397,13 +397,13 @@ int rsa_main(int argc, char **argv)
params[0] = OSSL_PARAM_construct_int("encrypt-level", &pvk_encr);
if (!OSSL_ENCODER_CTX_set_params(ectx, params)) {
- BIO_printf(bio_err, "invalid PVK encryption level\n");
+ BIO_puts(bio_err, "invalid PVK encryption level\n");
goto end;
}
}
if (!OSSL_ENCODER_to_bio(ectx, out)) {
- BIO_printf(bio_err, "unable to write key\n");
+ BIO_puts(bio_err, "unable to write key\n");
ERR_print_errors(bio_err);
goto end;
}
diff --git a/apps/rsautl.c b/apps/rsautl.c
index e54b1812f2..f14b80f587 100644
--- a/apps/rsautl.c
+++ b/apps/rsautl.c
@@ -184,12 +184,12 @@ int rsautl_main(int argc, char **argv)
goto end;
if (need_priv && (key_type != KEY_PRIVKEY)) {
- BIO_printf(bio_err, "A private key is needed for this operation\n");
+ BIO_puts(bio_err, "A private key is needed for this operation\n");
goto end;
}
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
goto end;
}
@@ -230,7 +230,7 @@ int rsautl_main(int argc, char **argv)
/* Read the input data */
rv = BIO_read(in, rsa_in, keysize * 2);
if (rv < 0) {
- BIO_printf(bio_err, "Error reading input Data\n");
+ BIO_puts(bio_err, "Error reading input Data\n");
goto end;
}
rsa_inlen = rv;
@@ -274,7 +274,7 @@ int rsautl_main(int argc, char **argv)
}
if (!rv) {
- BIO_printf(bio_err, "RSA operation error\n");
+ BIO_puts(bio_err, "RSA operation error\n");
ERR_print_errors(bio_err);
goto end;
}
diff --git a/apps/s_client.c b/apps/s_client.c
index f152fcef1a..860c63ec93 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -149,11 +149,11 @@ static unsigned int psk_client_cb(SSL *ssl, const char *hint, char *identity,
unsigned char *key;
if (c_debug)
- BIO_printf(bio_c_out, "psk_client_cb\n");
+ BIO_puts(bio_c_out, "psk_client_cb\n");
if (!hint) {
/* no ServerKeyExchange message */
if (c_debug)
- BIO_printf(bio_c_out,
+ BIO_puts(bio_c_out,
"NULL received PSK identity hint, continuing anyway\n");
} else if (c_debug) {
BIO_printf(bio_c_out, "Received PSK identity hint '%s'\n", hint);
@@ -193,7 +193,7 @@ static unsigned int psk_client_cb(SSL *ssl, const char *hint, char *identity,
return key_len;
out_err:
if (c_debug)
- BIO_printf(bio_err, "Error in PSK client callback\n");
+ BIO_puts(bio_err, "Error in PSK client callback\n");
return 0;
}
#endif
@@ -225,7 +225,7 @@ static int psk_use_session_cb(SSL *s, const EVP_MD *md,
/* We default to SHA-256 */
cipher = SSL_CIPHER_find(s, tls13_aes128gcmsha256_id);
if (cipher == NULL) {
- BIO_printf(bio_err, "Error finding suitable ciphersuite\n");
+ BIO_puts(bio_err, "Error finding suitable ciphersuite\n");
OPENSSL_free(key);
return 0;
}
@@ -277,7 +277,7 @@ static int ssl_servername_cb(SSL *s, int *ad, void *arg)
if (SSL_get_servername_type(s) != -1)
p->ack = !SSL_session_reused(s) && hn != NULL;
else
- BIO_printf(bio_err, "Can't use SSL_get_servername\n");
+ BIO_puts(bio_err, "Can't use SSL_get_servername\n");
return SSL_TLSEXT_ERR_OK;
}
@@ -301,7 +301,7 @@ static int next_proto_cb(SSL *s, unsigned char **out, unsigned char *outlen,
if (!c_quiet) {
/* We can assume that |in| is syntactically valid. */
unsigned i;
- BIO_printf(bio_c_out, "Protocols advertised by server: ");
+ BIO_puts(bio_c_out, "Protocols advertised by server: ");
for (i = 0; i < inlen;) {
if (i)
BIO_write(bio_c_out, ", ", 2);
@@ -921,10 +921,10 @@ static int new_session_cb(SSL *s, SSL_SESSION *sess)
* arrival of the NewSessionTicket for TLSv1.3.
*/
if (SSL_version(s) == TLS1_3_VERSION) {
- BIO_printf(bio_c_out,
+ BIO_puts(bio_c_out,
"---\nPost-Handshake New Session Ticket arrived:\n");
SSL_SESSION_print(bio_c_out, sess);
- BIO_printf(bio_c_out, "---\n");
+ BIO_puts(bio_c_out, "---\n");
}
/*
@@ -1098,13 +1098,13 @@ int s_client_main(int argc, char **argv)
}
if (IS_PROT_FLAG(o) && ++prot_opt > 1) {
- BIO_printf(bio_err, "Cannot supply multiple protocol flags\n");
+ BIO_puts(bio_err, "Cannot supply multiple protocol flags\n");
goto end;
}
if (IS_NO_PROT_FLAG(o))
no_prot_opt++;
if (prot_opt == 1 && no_prot_opt) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Cannot supply both a protocol flag and '-no_<prot>'\n");
goto end;
}
@@ -1697,7 +1697,7 @@ int s_client_main(int argc, char **argv)
#ifndef OPENSSL_NO_NEXTPROTONEG
if (min_version == TLS1_3_VERSION && next_proto_neg_in != NULL) {
- BIO_printf(bio_err, "Cannot supply -nextprotoneg with TLSv1.3\n");
+ BIO_puts(bio_err, "Cannot supply -nextprotoneg with TLSv1.3\n");
goto opthelp;
}
#endif
@@ -1776,7 +1776,7 @@ int s_client_main(int argc, char **argv)
#ifdef AF_UNIX
if (socket_family == AF_UNIX && socket_type != SOCK_STREAM) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Can't use unix sockets and datagrams together\n");
goto end;
}
@@ -1785,7 +1785,7 @@ int s_client_main(int argc, char **argv)
#ifndef OPENSSL_NO_SCTP
if (protocol == IPPROTO_SCTP) {
if (socket_type != SOCK_DGRAM) {
- BIO_printf(bio_err, "Can't use -sctp without DTLS\n");
+ BIO_puts(bio_err, "Can't use -sctp without DTLS\n");
goto end;
}
/* SCTP is unusual. It uses DTLS over a SOCK_STREAM protocol */
@@ -1798,7 +1798,7 @@ int s_client_main(int argc, char **argv)
if (next_proto_neg_in) {
next_proto.data = next_protos_parse(&next_proto.len, next_proto_neg_in);
if (next_proto.data == NULL) {
- BIO_printf(bio_err, "Error parsing -nextprotoneg argument\n");
+ BIO_puts(bio_err, "Error parsing -nextprotoneg argument\n");
goto end;
}
} else
@@ -1806,17 +1806,17 @@ int s_client_main(int argc, char **argv)
#endif
if (!app_passwd(passarg, NULL, &pass, NULL)) {
- BIO_printf(bio_err, "Error getting private key password\n");
+ BIO_puts(bio_err, "Error getting private key password\n");
goto end;
}
if (!app_passwd(proxypassarg, NULL, &proxypass, NULL)) {
- BIO_printf(bio_err, "Error getting proxy password\n");
+ BIO_puts(bio_err, "Error getting proxy password\n");
goto end;
}
if (proxypass != NULL && proxyuser == NULL) {
- BIO_printf(bio_err, "Error: Must specify proxy_user with proxy_pass\n");
+ BIO_puts(bio_err, "Error: Must specify proxy_user with proxy_pass\n");
goto end;
}
@@ -1864,7 +1864,7 @@ int s_client_main(int argc, char **argv)
if (c_msg && bio_c_msg == NULL) {
bio_c_msg = dup_bio_out(FORMAT_TEXT);
if (bio_c_msg == NULL) {
- BIO_printf(bio_err, "Out of memory\n");
+ BIO_puts(bio_err, "Out of memory\n");
goto end;
}
}
@@ -1873,13 +1873,13 @@ int s_client_main(int argc, char **argv)
}
if (bio_c_out == NULL) {
- BIO_printf(bio_err, "Unable to create BIO\n");
+ BIO_puts(bio_err, "Unable to create BIO\n");
goto end;
}
}
#ifndef OPENSSL_NO_SRP
if (!app_passwd(srppass, NULL, &srp_arg.srppassin, NULL)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
goto end;
}
#endif
@@ -1924,7 +1924,7 @@ int s_client_main(int argc, char **argv)
#endif
if (vpmtouched && !SSL_CTX_set1_param(ctx, vpm)) {
- BIO_printf(bio_err, "Error setting verify params\n");
+ BIO_puts(bio_err, "Error setting verify params\n");
goto end;
}
@@ -1970,7 +1970,7 @@ int s_client_main(int argc, char **argv)
vfyCApath, vfyCAfile, vfyCAstore,
chCApath, chCAfile, chCAstore,
crls, crl_download)) {
- BIO_printf(bio_err, "Error loading store locations\n");
+ BIO_puts(bio_err, "Error loading store locations\n");
goto end;
}
if (ReqCAfile != NULL) {
@@ -1978,7 +1978,7 @@ int s_client_main(int argc, char **argv)
if (nm == NULL || !SSL_add_file_cert_subjects_to_stack(nm, ReqCAfile)) {
sk_X509_NAME_pop_free(nm, X509_NAME_free);
- BIO_printf(bio_err, "Error loading CA names\n");
+ BIO_puts(bio_err, "Error loading CA names\n");
goto end;
}
SSL_CTX_set0_CA_list(ctx, nm);
@@ -1987,7 +1987,7 @@ int s_client_main(int argc, char **argv)
#ifndef OPENSSL_NO_PSK
if (psk_key != NULL) {
if (c_debug)
- BIO_printf(bio_c_out, "PSK key given, setting client callback\n");
+ BIO_puts(bio_c_out, "PSK key given, setting client callback\n");
SSL_CTX_set_psk_client_callback(ctx, psk_client_cb);
}
#endif
@@ -2012,7 +2012,7 @@ int s_client_main(int argc, char **argv)
if (srtp_profiles != NULL) {
/* Returns 0 on success! */
if (SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles) != 0) {
- BIO_printf(bio_err, "Error setting SRTP profile\n");
+ BIO_puts(bio_err, "Error setting SRTP profile\n");
goto end;
}
}
@@ -2030,12 +2030,12 @@ int s_client_main(int argc, char **argv)
unsigned char *alpn = next_protos_parse(&alpn_len, alpn_in);
if (alpn == NULL) {
- BIO_printf(bio_err, "Error parsing -alpn argument\n");
+ BIO_puts(bio_err, "Error parsing -alpn argument\n");
goto end;
}
/* Returns 0 on success! */
if (SSL_CTX_set_alpn_protos(ctx, alpn, (unsigned int)alpn_len) != 0) {
- BIO_printf(bio_err, "Error setting ALPN\n");
+ BIO_puts(bio_err, "Error setting ALPN\n");
goto end;
}
OPENSSL_free(alpn);
@@ -2126,12 +2126,12 @@ int s_client_main(int argc, char **argv)
if (enable_client_rpk)
if (!SSL_set1_client_cert_type(con, cert_type_rpk, sizeof(cert_type_rpk))) {
- BIO_printf(bio_err, "Error setting client certificate types\n");
+ BIO_puts(bio_err, "Error setting client certificate types\n");
goto end;
}
if (enable_server_rpk) {
if (!SSL_set1_server_cert_type(con, cert_type_rpk, sizeof(cert_type_rpk))) {
- BIO_printf(bio_err, "Error setting server certificate types\n");
+ BIO_puts(bio_err, "Error setting server certificate types\n");
goto end;
}
}
@@ -2150,7 +2150,7 @@ int s_client_main(int argc, char **argv)
goto end;
}
if (!SSL_set_session(con, sess)) {
- BIO_printf(bio_err, "Can't set session\n");
+ BIO_puts(bio_err, "Can't set session\n");
goto end;
}
@@ -2166,7 +2166,7 @@ int s_client_main(int argc, char **argv)
servername = (host == NULL) ? "localhost" : host;
}
if (servername != NULL && !SSL_set_tlsext_host_name(con, servername)) {
- BIO_printf(bio_err, "Unable to set TLS servername extension.\n");
+ BIO_puts(bio_err, "Unable to set TLS servername extension.\n");
goto end;
}
}
@@ -2216,7 +2216,7 @@ int s_client_main(int argc, char **argv)
#endif
if (tfo)
- BIO_printf(bio_c_out, "Connecting via TFO\n");
+ BIO_puts(bio_c_out, "Connecting via TFO\n");
re_start:
/* peer_addr might be set from previous connections */
BIO_ADDR_free(peer_addr);
@@ -2240,7 +2240,7 @@ re_start:
if (c_nbio) {
if (isquic && !SSL_set_blocking_mode(con, 0))
goto end;
- BIO_printf(bio_c_out, "Turned on non blocking io\n");
+ BIO_puts(bio_c_out, "Turned on non blocking io\n");
}
}
#ifndef OPENSSL_NO_DTLS
@@ -2255,7 +2255,7 @@ re_start:
sbio = BIO_new_dgram(sock, BIO_NOCLOSE);
if (sbio == NULL || (peer_info.addr = BIO_ADDR_new()) == NULL) {
- BIO_printf(bio_err, "memory allocation failure\n");
+ BIO_puts(bio_err, "memory allocation failure\n");
BIO_free(sbio);
BIO_closesocket(sock);
goto end;
@@ -2292,7 +2292,7 @@ re_start:
}
SSL_set_options(con, SSL_OP_NO_QUERY_MTU);
if (!DTLS_set_link_mtu(con, socket_mtu)) {
- BIO_printf(bio_err, "Failed to set MTU\n");
+ BIO_puts(bio_err, "Failed to set MTU\n");
BIO_free(sbio);
goto shut;
}
@@ -2306,7 +2306,7 @@ re_start:
if (isquic) {
sbio = BIO_new_dgram(sock, BIO_NOCLOSE);
if (!SSL_set1_initial_peer_addr(con, peer_addr)) {
- BIO_printf(bio_err, "Failed to set the initial peer address\n");
+ BIO_puts(bio_err, "Failed to set the initial peer address\n");
goto shut;
}
} else
@@ -2314,7 +2314,7 @@ re_start:
sbio = BIO_new_socket(sock, BIO_NOCLOSE);
if (sbio == NULL) {
- BIO_printf(bio_err, "Unable to create BIO\n");
+ BIO_puts(bio_err, "Unable to create BIO\n");
BIO_closesocket(sock);
goto end;
}
@@ -2330,7 +2330,7 @@ re_start:
test = BIO_new(BIO_f_nbio_test());
if (test == NULL) {
- BIO_printf(bio_err, "Unable to create BIO\n");
+ BIO_puts(bio_err, "Unable to create BIO\n");
BIO_free(sbio);
goto shut;
}
@@ -2410,7 +2410,7 @@ re_start:
BIO *fbio = BIO_new(BIO_f_buffer());
if (fbio == NULL) {
- BIO_printf(bio_err, "Unable to create BIO\n");
+ BIO_puts(bio_err, "Unable to create BIO\n");
goto shut;
}
BIO_push(fbio, sbio);
@@ -2438,18 +2438,18 @@ re_start:
BIO_pop(fbio);
BIO_free(fbio);
if (!foundit)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Didn't find STARTTLS in server response,"
" trying anyway...\n");
- BIO_printf(sbio, "STARTTLS\r\n");
+ BIO_puts(sbio, "STARTTLS\r\n");
BIO_read(sbio, sbuf, BUFSIZZ);
} break;
case PROTO_POP3: {
BIO_read(sbio, mbuf, BUFSIZZ);
- BIO_printf(sbio, "STLS\r\n");
+ BIO_puts(sbio, "STLS\r\n");
mbuf_len = BIO_read(sbio, sbuf, BUFSIZZ);
if (mbuf_len < 0) {
- BIO_printf(bio_err, "BIO_read failed\n");
+ BIO_puts(bio_err, "BIO_read failed\n");
goto end;
}
} break;
@@ -2458,7 +2458,7 @@ re_start:
BIO *fbio = BIO_new(BIO_f_buffer());
if (fbio == NULL) {
- BIO_printf(bio_err, "Unable to create BIO\n");
+ BIO_puts(bio_err, "Unable to create BIO\n");
goto shut;
}
BIO_push(fbio, sbio);
@@ -2486,7 +2486,7 @@ re_start:
BIO *fbio = BIO_new(BIO_f_buffer());
if (fbio == NULL) {
- BIO_printf(bio_err, "Unable to create BIO\n");
+ BIO_puts(bio_err, "Unable to create BIO\n");
goto shut;
}
BIO_push(fbio, sbio);
@@ -2524,11 +2524,11 @@ re_start:
mbuf[seen] = '\0';
}
- BIO_printf(sbio,
+ BIO_puts(sbio,
"<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
seen = BIO_read(sbio, sbuf, BUFSIZZ);
if (seen < 0) {
- BIO_printf(bio_err, "BIO_read failed\n");
+ BIO_puts(bio_err, "BIO_read failed\n");
goto shut;
}
sbuf[seen] = '\0';
@@ -2569,7 +2569,7 @@ re_start:
BIO *fbio = BIO_new(BIO_f_buffer());
if (fbio == NULL) {
- BIO_printf(bio_err, "Unable to create BIO\n");
+ BIO_puts(bio_err, "Unable to create BIO\n");
goto end;
}
BIO_push(fbio, sbio);
@@ -2682,21 +2682,21 @@ re_start:
/* make sure we have at least 15 bytes left in the packet */
if (pos + 15 > bytes) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"MySQL server handshake packet is broken.\n");
goto shut;
}
pos += 12; /* skip over conn id[4] + SALT[8] */
if (packet[pos++] != '\0') { /* verify filler */
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"MySQL packet is broken.\n");
goto shut;
}
/* capability flags[2] */
if (!((packet[pos] + (packet[pos + 1] << 8)) & ssl_flg)) {
- BIO_printf(bio_err, "MySQL server does not support SSL.\n");
+ BIO_puts(bio_err, "MySQL server does not support SSL.\n");
goto shut;
}
@@ -2725,13 +2725,13 @@ re_start:
BIO *fbio = BIO_new(BIO_f_buffer());
if (fbio == NULL) {
- BIO_printf(bio_err, "Unable to create BIO\n");
+ BIO_puts(bio_err, "Unable to create BIO\n");
goto end;
}
BIO_push(fbio, sbio);
BIO_gets(fbio, mbuf, BUFSIZZ);
/* STARTTLS command requires CAPABILITIES... */
- BIO_printf(fbio, "CAPABILITIES\r\n");
+ BIO_puts(fbio, "CAPABILITIES\r\n");
(void)BIO_flush(fbio);
BIO_gets(fbio, mbuf, BUFSIZZ);
/* no point in trying to parse the CAPABILITIES response if there is none */
@@ -2747,13 +2747,13 @@ re_start:
BIO_pop(fbio);
BIO_free(fbio);
if (!foundit)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Didn't find STARTTLS in server response,"
" trying anyway...\n");
- BIO_printf(sbio, "STARTTLS\r\n");
+ BIO_puts(sbio, "STARTTLS\r\n");
mbuf_len = BIO_read(sbio, mbuf, BUFSIZZ);
if (mbuf_len < 0) {
- BIO_printf(bio_err, "BIO_read failed\n");
+ BIO_puts(bio_err, "BIO_read failed\n");
goto end;
}
mbuf[mbuf_len] = '\0';
@@ -2767,7 +2767,7 @@ re_start:
BIO *fbio = BIO_new(BIO_f_buffer());
if (fbio == NULL) {
- BIO_printf(bio_err, "Unable to create BIO\n");
+ BIO_puts(bio_err, "Unable to create BIO\n");
goto end;
}
BIO_push(fbio, sbio);
@@ -2788,13 +2788,13 @@ re_start:
BIO_pop(fbio);
BIO_free(fbio);
if (!foundit)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Didn't find STARTTLS in server response,"
" trying anyway...\n");
- BIO_printf(sbio, "STARTTLS\r\n");
+ BIO_puts(sbio, "STARTTLS\r\n");
mbuf_len = BIO_read(sbio, mbuf, BUFSIZZ);
if (mbuf_len < 0) {
- BIO_printf(bio_err, "BIO_read failed\n");
+ BIO_puts(bio_err, "BIO_read failed\n");
goto end;
}
mbuf[mbuf_len] = '\0';
@@ -2837,7 +2837,7 @@ re_start:
BIO_free(ldapbio);
NCONF_free(cnf);
if (errline <= 0) {
- BIO_printf(bio_err, "NCONF_load_bio failed\n");
+ BIO_puts(bio_err, "NCONF_load_bio failed\n");
goto end;
} else {
BIO_printf(bio_err, "Error on line %ld\n", errline);
@@ -2848,14 +2848,14 @@ re_start:
genstr = NCONF_get_string(cnf, "default", "asn1");
if (genstr == NULL) {
NCONF_free(cnf);
- BIO_printf(bio_err, "NCONF_get_string failed\n");
+ BIO_puts(bio_err, "NCONF_get_string failed\n");
goto end;
}
atyp = ASN1_generate_nconf(genstr, cnf);
if (atyp == NULL || atyp->type != V_ASN1_SEQUENCE) {
NCONF_free(cnf);
ASN1_TYPE_free(atyp);
- BIO_printf(bio_err, "ASN1_generate_nconf failed\n");
+ BIO_puts(bio_err, "ASN1_generate_nconf failed\n");
goto end;
}
NCONF_free(cnf);
@@ -2868,12 +2868,12 @@ re_start:
mbuf_len = BIO_read(sbio, mbuf, BUFSIZZ);
if (mbuf_len < 0) {
- BIO_printf(bio_err, "BIO_read failed\n");
+ BIO_puts(bio_err, "BIO_read failed\n");
goto end;
}
result = ldap_ExtendedResponse_parse(mbuf, mbuf_len);
if (result < 0) {
- BIO_printf(bio_err, "ldap_ExtendedResponse_parse failed\n");
+ BIO_puts(bio_err, "ldap_ExtendedResponse_parse failed\n");
goto shut;
} else if (result > 0) {
BIO_printf(bio_err, "STARTTLS failed, LDAP Result Code: %i\n",
@@ -2894,7 +2894,7 @@ re_start:
int finish = 0;
if (edfile == NULL) {
- BIO_printf(bio_err, "Cannot open early data file\n");
+ BIO_puts(bio_err, "Cannot open early data file\n");
goto shut;
}
@@ -2910,7 +2910,7 @@ re_start:
/* Just keep trying - busy waiting */
continue;
default:
- BIO_printf(bio_err, "Error writing early data\n");
+ BIO_puts(bio_err, "Error writing early data\n");
BIO_free(edfile);
goto shut;
}
@@ -2958,7 +2958,7 @@ re_start:
if (reconnect) {
reconnect--;
- BIO_printf(bio_c_out,
+ BIO_puts(bio_c_out,
"drop connection and then reconnect\n");
do_ssl_shutdown(con);
SSL_set_connect_state(con);
@@ -2972,7 +2972,7 @@ re_start:
do {
switch (user_data_process(&user_data, &cbuf_len, &cbuf_off)) {
default:
- BIO_printf(bio_err, "ERROR\n");
+ BIO_puts(bio_err, "ERROR\n");
/* fall through */
case USER_DATA_PROCESS_SHUT:
ret = 0;
@@ -3085,7 +3085,7 @@ re_start:
if (isdtls
&& !FD_ISSET(SSL_get_fd(con), &readfds)
&& !FD_ISSET(SSL_get_fd(con), &writefds))
- BIO_printf(bio_err, "TIMEOUT occurred\n");
+ BIO_puts(bio_err, "TIMEOUT occurred\n");
}
if (!ssl_pending
@@ -3109,28 +3109,28 @@ re_start:
}
break;
case SSL_ERROR_WANT_WRITE:
- BIO_printf(bio_c_out, "write W BLOCK\n");
+ BIO_puts(bio_c_out, "write W BLOCK\n");
write_ssl = 1;
read_tty = 0;
break;
case SSL_ERROR_WANT_ASYNC:
- BIO_printf(bio_c_out, "write A BLOCK\n");
+ BIO_puts(bio_c_out, "write A BLOCK\n");
wait_for_async(con);
write_ssl = 1;
read_tty = 0;
break;
case SSL_ERROR_WANT_READ:
- BIO_printf(bio_c_out, "write R BLOCK\n");
+ BIO_puts(bio_c_out, "write R BLOCK\n");
write_tty = 0;
read_ssl = 1;
write_ssl = 0;
break;
case SSL_ERROR_WANT_X509_LOOKUP:
- BIO_printf(bio_c_out, "write X BLOCK\n");
+ BIO_puts(bio_c_out, "write X BLOCK\n");
break;
case SSL_ERROR_ZERO_RETURN:
if (cbuf_len != 0) {
- BIO_printf(bio_c_out, "shutdown\n");
+ BIO_puts(bio_c_out, "shutdown\n");
ret = 0;
goto shut;
} else {
@@ -3171,7 +3171,7 @@ re_start:
i = raw_write_stdout(&(sbuf[sbuf_off]), sbuf_len);
if (i <= 0) {
- BIO_printf(bio_c_out, "DONE\n");
+ BIO_puts(bio_c_out, "DONE\n");
ret = 0;
goto shut;
}
@@ -3197,7 +3197,7 @@ re_start:
write_tty = 1;
break;
case SSL_ERROR_WANT_ASYNC:
- BIO_printf(bio_c_out, "read A BLOCK\n");
+ BIO_puts(bio_c_out, "read A BLOCK\n");
wait_for_async(con);
write_tty = 0;
read_ssl = 1;
@@ -3205,19 +3205,19 @@ re_start:
write_ssl = 1;
break;
case SSL_ERROR_WANT_WRITE:
- BIO_printf(bio_c_out, "read W BLOCK\n");
+ BIO_puts(bio_c_out, "read W BLOCK\n");
write_ssl = 1;
read_tty = 0;
break;
case SSL_ERROR_WANT_READ:
- BIO_printf(bio_c_out, "read R BLOCK\n");
+ BIO_puts(bio_c_out, "read R BLOCK\n");
write_tty = 0;
read_ssl = 1;
if ((read_tty == 0) && (write_ssl == 0))
write_ssl = 1;
break;
case SSL_ERROR_WANT_X509_LOOKUP:
- BIO_printf(bio_c_out, "read X BLOCK\n");
+ BIO_puts(bio_c_out, "read X BLOCK\n");
break;
case SSL_ERROR_SYSCALL:
ret = get_last_socket_error();
@@ -3227,7 +3227,7 @@ re_start:
BIO_printf(bio_err, "read:errno=%d\n", ret);
goto shut;
case SSL_ERROR_ZERO_RETURN:
- BIO_printf(bio_c_out, "closed\n");
+ BIO_puts(bio_c_out, "closed\n");
ret = 0;
goto shut;
case SSL_ERROR_WANT_ASYNC_JOB:
@@ -3276,7 +3276,7 @@ re_start:
#endif
if (!c_ign_eof && i <= 0) {
- BIO_printf(bio_err, "DONE\n");
+ BIO_puts(bio_err, "DONE\n");
ret = 0;
goto shut;
}
@@ -3431,20 +3431,19 @@ static void print_stuff(BIO *bio, SSL *s, int full)
if (sk != NULL) {
got_a_chain = 1;
- BIO_printf(bio, "---\nCertificate chain\n");
+ BIO_puts(bio, "---\nCertificate chain\n");
for (i = 0; i < sk_X509_num(sk); i++) {
X509 *chain_cert = sk_X509_value(sk, i);
BIO_printf(bio, "%2d s:", i);
X509_NAME_print_ex(bio, X509_get_subject_name(chain_cert), 0, get_nameopt());
- BIO_puts(bio, "\n");
- BIO_printf(bio, " i:");
+ BIO_puts(bio, "\n i:");
X509_NAME_print_ex(bio, X509_get_issuer_name(chain_cert), 0, get_nameopt());
BIO_puts(bio, "\n");
print_cert_key_info(bio, chain_cert);
- BIO_printf(bio, " v:NotBefore: ");
+ BIO_puts(bio, " v:NotBefore: ");
ASN1_TIME_print(bio, X509_get0_notBefore(chain_cert));
- BIO_printf(bio, "; NotAfter: ");
+ BIO_puts(bio, "; NotAfter: ");
ASN1_TIME_print(bio, X509_get0_notAfter(chain_cert));
BIO_puts(bio, "\n");
if (c_showcerts)
@@ -3452,32 +3451,32 @@ static void print_stuff(BIO *bio, SSL *s, int full)
}
}
- BIO_printf(bio, "---\n");
+ BIO_puts(bio, "---\n");
peer = SSL_get0_peer_certificate(s);
if (peer != NULL) {
- BIO_printf(bio, "Server certificate\n");
+ BIO_puts(bio, "Server certificate\n");
/* Redundant if we showed the whole chain */
if (!(c_showcerts && got_a_chain))
PEM_write_bio_X509(bio, peer);
dump_cert_text(bio, peer);
} else {
- BIO_printf(bio, "no peer certificate available\n");
+ BIO_puts(bio, "no peer certificate available\n");
}
/* Only display RPK information if configured */
if (SSL_get_negotiated_client_cert_type(s) == TLSEXT_cert_type_rpk)
- BIO_printf(bio, "Client-to-server raw public key negotiated\n");
+ BIO_puts(bio, "Client-to-server raw public key negotiated\n");
if (SSL_get_negotiated_server_cert_type(s) == TLSEXT_cert_type_rpk)
- BIO_printf(bio, "Server-to-client raw public key negotiated\n");
+ BIO_puts(bio, "Server-to-client raw public key negotiated\n");
if (enable_server_rpk) {
EVP_PKEY *peer_rpk = SSL_get0_peer_rpk(s);
if (peer_rpk != NULL) {
- BIO_printf(bio, "Server raw public key\n");
+ BIO_puts(bio, "Server raw public key\n");
EVP_PKEY_print_public(bio, peer_rpk, 2, NULL);
} else {
- BIO_printf(bio, "no peer rpk available\n");
+ BIO_puts(bio, "no peer rpk available\n");
}
}
@@ -3504,7 +3503,7 @@ static void print_stuff(BIO *bio, SSL *s, int full)
if (sct_count > 0) {
const CTLOG_STORE *log_store = SSL_CTX_get0_ctlog_store(ctx);
- BIO_printf(bio, "---\n");
+ BIO_puts(bio, "---\n");
for (i = 0; i < sct_count; ++i) {
SCT *sct = sk_SCT_value(scts, i);
@@ -3512,9 +3511,9 @@ static void print_stuff(BIO *bio, SSL *s, int full)
SCT_validation_status_string(sct));
SCT_print(sct, bio, 0, log_store);
if (i < sct_count - 1)
- BIO_printf(bio, "\n---\n");
+ BIO_puts(bio, "\n---\n");
}
- BIO_printf(bio, "\n");
+ BIO_puts(bio, "\n");
}
}
#endif
@@ -3544,16 +3543,16 @@ static void print_stuff(BIO *bio, SSL *s, int full)
#ifndef OPENSSL_NO_COMP
comp = SSL_get_current_compression(s);
expansion = SSL_get_current_expansion(s);
- BIO_printf(bio, "Compression: %s\n",
- comp ? SSL_COMP_get_name(comp) : "NONE");
- BIO_printf(bio, "Expansion: %s\n",
+ BIO_printf(bio, "Compression: %s\n"
+ "Expansion: %s\n",
+ comp ? SSL_COMP_get_name(comp) : "NONE",
expansion ? SSL_COMP_get_name(expansion) : "NONE");
#endif
#ifndef OPENSSL_NO_KTLS
if (BIO_get_ktls_send(SSL_get_wbio(s)))
- BIO_printf(bio_err, "Using Kernel TLS for sending\n");
+ BIO_puts(bio_err, "Using Kernel TLS for sending\n");
if (BIO_get_ktls_recv(SSL_get_rbio(s)))
- BIO_printf(bio_err, "Using Kernel TLS for receiving\n");
+ BIO_puts(bio_err, "Using Kernel TLS for receiving\n");
#endif
if (OSSL_TRACE_ENABLED(TLS)) {
@@ -3585,11 +3584,11 @@ static void print_stuff(BIO *bio, SSL *s, int full)
unsigned int proto_len;
SSL_get0_alpn_selected(s, &proto, &proto_len);
if (proto_len > 0) {
- BIO_printf(bio, "ALPN protocol: ");
+ BIO_puts(bio, "ALPN protocol: ");
BIO_write(bio, proto, proto_len);
BIO_write(bio, "\n", 1);
} else
- BIO_printf(bio, "No ALPN negotiated\n");
+ BIO_puts(bio, "No ALPN negotiated\n");
}
#ifndef OPENSSL_NO_SRTP
@@ -3605,15 +3604,15 @@ static void print_stuff(BIO *bio, SSL *s, int full)
if (istls13) {
switch (SSL_get_early_data_status(s)) {
case SSL_EARLY_DATA_NOT_SENT:
- BIO_printf(bio, "Early data was not sent\n");
+ BIO_puts(bio, "Early data was not sent\n");
break;
case SSL_EARLY_DATA_REJECTED:
- BIO_printf(bio, "Early data was rejected\n");
+ BIO_puts(bio, "Early data was rejected\n");
break;
case SSL_EARLY_DATA_ACCEPTED:
- BIO_printf(bio, "Early data was accepted\n");
+ BIO_puts(bio, "Early data was accepted\n");
break;
}
@@ -3631,9 +3630,11 @@ static void print_stuff(BIO *bio, SSL *s, int full)
}
if (SSL_get_session(s) != NULL && keymatexportlabel != NULL) {
- BIO_printf(bio, "Keying material exporter:\n");
- BIO_printf(bio, " Label: '%s'\n", keymatexportlabel);
- BIO_printf(bio, " Length: %i bytes\n", keymatexportlen);
+ BIO_printf(bio, "Keying material exporter:\n"
+ " Label: '%s'\n"
+ " Length: %i bytes\n",
+ keymatexportlabel,
+ keymatexportlen);
exportedkeymat = app_malloc(keymatexportlen, "export key");
if (SSL_export_keying_material(s, exportedkeymat,
keymatexportlen,
@@ -3641,16 +3642,16 @@ static void print_stuff(BIO *bio, SSL *s, int full)
strlen(keymatexportlabel),
NULL, 0, 0)
<= 0) {
- BIO_printf(bio, " Error\n");
+ BIO_puts(bio, " Error\n");
} else {
- BIO_printf(bio, " Keying material: ");
+ BIO_puts(bio, " Keying material: ");
for (i = 0; i < keymatexportlen; i++)
BIO_printf(bio, "%02X", exportedkeymat[i]);
- BIO_printf(bio, "\n");
+ BIO_puts(bio, "\n");
}
OPENSSL_free(exportedkeymat);
}
- BIO_printf(bio, "---\n");
+ BIO_puts(bio, "---\n");
/* flush, or debugging output gets mixed with http response */
(void)BIO_flush(bio);
}
@@ -3751,7 +3752,7 @@ static int ldap_ExtendedResponse_parse(const char *buf, long rem)
/* pull SEQUENCE */
inf = ASN1_get_object(&cur, &len, &tag, &xclass, rem);
if (inf != V_ASN1_CONSTRUCTED || tag != V_ASN1_SEQUENCE || (rem = (long)(end - cur), len > rem)) {
- BIO_printf(bio_err, "Unexpected LDAP response\n");
+ BIO_puts(bio_err, "Unexpected LDAP response\n");
goto end;
}
@@ -3760,7 +3761,7 @@ static int ldap_ExtendedResponse_parse(const char *buf, long rem)
/* pull MessageID */
inf = ASN1_get_object(&cur, &len, &tag, &xclass, rem);
if (inf != V_ASN1_UNIVERSAL || tag != V_ASN1_INTEGER || (rem = (long)(end - cur), len > rem)) {
- BIO_printf(bio_err, "No MessageID\n");
+ BIO_puts(bio_err, "No MessageID\n");
goto end;
}
@@ -3770,7 +3771,7 @@ static int ldap_ExtendedResponse_parse(const char *buf, long rem)
rem = (long)(end - cur);
inf = ASN1_get_object(&cur, &len, &tag, &xclass, rem);
if (inf != V_ASN1_CONSTRUCTED || xclass != V_ASN1_APPLICATION || tag != 24) {
- BIO_printf(bio_err, "Not ExtendedResponse\n");
+ BIO_puts(bio_err, "Not ExtendedResponse\n");
goto end;
}
@@ -3778,7 +3779,7 @@ static int ldap_ExtendedResponse_parse(const char *buf, long rem)
rem = (long)(end - cur);
inf = ASN1_get_object(&cur, &len, &tag, &xclass, rem);
if (inf != V_ASN1_UNIVERSAL || tag != V_ASN1_ENUMERATED || len == 0 || (rem = (long)(end - cur), len > rem)) {
- BIO_printf(bio_err, "Not LDAPResult\n");
+ BIO_puts(bio_err, "Not LDAPResult\n");
goto end;
}
@@ -3893,39 +3894,39 @@ static int user_data_execute(struct user_data_st *user_data, int cmd, char *arg)
switch (cmd) {
case USER_COMMAND_HELP:
/* This only ever occurs in advanced mode, so just emit advanced help */
- BIO_printf(bio_err, "Enter text to send to the peer followed by <enter>\n");
- BIO_printf(bio_err, "To issue a command insert {cmd} or {cmd:arg} anywhere in the text\n");
- BIO_printf(bio_err, "Entering {{ will send { to the peer\n");
- BIO_printf(bio_err, "The following commands are available\n");
- BIO_printf(bio_err, " {help}: Get this help text\n");
- BIO_printf(bio_err, " {quit}: Close the connection to the peer\n");
- BIO_printf(bio_err, " {reconnect}: Reconnect to the peer\n");
+ BIO_puts(bio_err, "Enter text to send to the peer followed by <enter>\n"
+ "To issue a command insert {cmd} or {cmd:arg} anywhere in the text\n"
+ "Entering {{ will send { to the peer\n"
+ "The following commands are available\n"
+ " {help}: Get this help text\n"
+ " {quit}: Close the connection to the peer\n"
+ " {reconnect}: Reconnect to the peer\n");
if (SSL_is_quic(user_data->con)) {
- BIO_printf(bio_err, " {fin}: Send FIN on the stream. No further writing is possible\n");
+ BIO_puts(bio_err, " {fin}: Send FIN on the stream. No further writing is possible\n");
} else if (SSL_version(user_data->con) == TLS1_3_VERSION) {
- BIO_printf(bio_err, " {keyup:req|noreq}: Send a Key Update message\n");
- BIO_printf(bio_err, " Arguments:\n");
- BIO_printf(bio_err, " req = peer update requested (default)\n");
- BIO_printf(bio_err, " noreq = peer update not requested\n");
+ BIO_puts(bio_err, " {keyup:req|noreq}: Send a Key Update message\n"
+ " Arguments:\n"
+ " req = peer update requested (default)\n"
+ " noreq = peer update not requested\n");
} else {
- BIO_printf(bio_err, " {reneg}: Attempt to renegotiate\n");
+ BIO_puts(bio_err, " {reneg}: Attempt to renegotiate\n");
}
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
return USER_DATA_PROCESS_NO_DATA;
case USER_COMMAND_QUIT:
- BIO_printf(bio_err, "DONE\n");
+ BIO_puts(bio_err, "DONE\n");
return USER_DATA_PROCESS_SHUT;
case USER_COMMAND_RECONNECT:
- BIO_printf(bio_err, "RECONNECTING\n");
+ BIO_puts(bio_err, "RECONNECTING\n");
do_ssl_shutdown(user_data->con);
SSL_set_connect_state(user_data->con);
BIO_closesocket(SSL_get_fd(user_data->con));
return USER_DATA_PROCESS_RESTART;
case USER_COMMAND_RENEGOTIATE:
- BIO_printf(bio_err, "RENEGOTIATING\n");
+ BIO_puts(bio_err, "RENEGOTIATING\n");
if (!SSL_renegotiate(user_data->con))
break;
return USER_DATA_PROCESS_CONTINUE;
@@ -3939,7 +3940,7 @@ static int user_data_execute(struct user_data_st *user_data, int cmd, char *arg)
updatetype = SSL_KEY_UPDATE_NOT_REQUESTED;
else
return USER_DATA_PROCESS_BAD_ARGUMENT;
- BIO_printf(bio_err, "KEYUPDATE\n");
+ BIO_puts(bio_err, "KEYUPDATE\n");
if (!SSL_key_update(user_data->con, updatetype))
break;
return USER_DATA_PROCESS_CONTINUE;
@@ -3955,7 +3956,7 @@ static int user_data_execute(struct user_data_st *user_data, int cmd, char *arg)
break;
}
- BIO_printf(bio_err, "ERROR\n");
+ BIO_puts(bio_err, "ERROR\n");
return USER_DATA_PROCESS_SHUT;
}
diff --git a/apps/s_server.c b/apps/s_server.c
index 79a3014542..ab6635c24f 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -136,7 +136,7 @@ static unsigned int psk_server_cb(SSL *ssl, const char *identity,
unsigned char *key;
if (s_debug)
- BIO_printf(bio_s_out, "psk_server_cb\n");
+ BIO_puts(bio_s_out, "psk_server_cb\n");
if (!SSL_is_dtls(ssl) && SSL_version(ssl) >= TLS1_3_VERSION) {
/*
@@ -149,7 +149,7 @@ static unsigned int psk_server_cb(SSL *ssl, const char *identity,
}
if (identity == NULL) {
- BIO_printf(bio_err, "Error: client did not send PSK identity\n");
+ BIO_puts(bio_err, "Error: client did not send PSK identity\n");
goto out_err;
}
if (s_debug)
@@ -163,7 +163,7 @@ static unsigned int psk_server_cb(SSL *ssl, const char *identity,
identity, psk_identity);
} else {
if (s_debug)
- BIO_printf(bio_s_out, "PSK client identity found\n");
+ BIO_puts(bio_s_out, "PSK client identity found\n");
}
/* convert the PSK key to binary */
@@ -189,7 +189,7 @@ static unsigned int psk_server_cb(SSL *ssl, const char *identity,
return key_len;
out_err:
if (s_debug)
- BIO_printf(bio_err, "Error in PSK server callback\n");
+ BIO_puts(bio_err, "Error in PSK server callback\n");
(void)BIO_flush(bio_err);
(void)BIO_flush(bio_s_out);
return 0;
@@ -228,7 +228,7 @@ static int psk_find_session_cb(SSL *ssl, const unsigned char *identity,
/* We default to SHA256 */
cipher = SSL_CIPHER_find(ssl, tls13_aes128gcmsha256_id);
if (cipher == NULL) {
- BIO_printf(bio_err, "Error finding suitable ciphersuite\n");
+ BIO_puts(bio_err, "Error finding suitable ciphersuite\n");
OPENSSL_free(key);
return 0;
}
@@ -432,11 +432,11 @@ static int ssl_servername_cb(SSL *s, int *ad, void *arg)
const char *cp = servername;
unsigned char uc;
- BIO_printf(p->biodebug, "Hostname in TLS extension: \"");
+ BIO_puts(p->biodebug, "Hostname in TLS extension: \"");
while ((uc = *cp++) != 0)
BIO_printf(p->biodebug,
(((uc) & ~127) == 0) && isprint(uc) ? "%c" : "\\x%02x", uc);
- BIO_printf(p->biodebug, "\"\n");
+ BIO_puts(p->biodebug, "\"\n");
}
if (p->servername == NULL)
@@ -446,7 +446,7 @@ static int ssl_servername_cb(SSL *s, int *ad, void *arg)
if (OPENSSL_strcasecmp(servername, p->servername))
return p->extension_error;
if (ctx2 != NULL) {
- BIO_printf(p->biodebug, "Switching server context.\n");
+ BIO_puts(p->biodebug, "Switching server context.\n");
SSL_set_SSL_CTX(s, ctx2);
}
}
@@ -847,8 +847,8 @@ static int cert_status_cb(SSL *s, void *arg)
}
if (srctx->verbose) {
- BIO_puts(bio_err, "cert_status: ocsp response sent:\n");
- BIO_printf(bio_err, "cert_status: number of responses: %d\n",
+ BIO_printf(bio_err, "cert_status: ocsp response sent:\n"
+ "cert_status: number of responses: %d\n",
sk_OCSP_RESPONSE_num(sk_resp));
for (i = 0; i < sk_OCSP_RESPONSE_num(sk_resp); i++) {
resp = sk_OCSP_RESPONSE_value(sk_resp, i);
@@ -906,7 +906,7 @@ static int alpn_cb(SSL *s, const unsigned char **out, unsigned char *outlen,
/* We can assume that |in| is syntactically valid. */
unsigned int i;
- BIO_printf(bio_s_out, "ALPN protocols advertised by the client: ");
+ BIO_puts(bio_s_out, "ALPN protocols advertised by the client: ");
for (i = 0; i < inlen;) {
if (i)
BIO_write(bio_s_out, ", ", 2);
@@ -922,7 +922,7 @@ static int alpn_cb(SSL *s, const unsigned char **out, unsigned char *outlen,
return SSL_TLSEXT_ERR_ALERT_FATAL;
if (!s_quiet) {
- BIO_printf(bio_s_out, "ALPN protocols selected: ");
+ BIO_puts(bio_s_out, "ALPN protocols selected: ");
BIO_write(bio_s_out, *out, *outlen);
BIO_write(bio_s_out, "\n", 1);
}
@@ -1439,13 +1439,13 @@ int s_server_main(int argc, char *argv[])
prog = opt_init(argc, argv, s_server_options);
while ((o = opt_next()) != OPT_EOF) {
if (IS_PROT_FLAG(o) && ++prot_opt > 1) {
- BIO_printf(bio_err, "Cannot supply multiple protocol flags\n");
+ BIO_puts(bio_err, "Cannot supply multiple protocol flags\n");
goto end;
}
if (IS_NO_PROT_FLAG(o))
no_prot_opt++;
if (prot_opt == 1 && no_prot_opt) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Cannot supply both a protocol flag and '-no_<prot>'\n");
goto end;
}
@@ -1751,7 +1751,7 @@ int s_server_main(int argc, char *argv[])
if (!OSSL_HTTP_parse_url(opt_arg(), &tlscstatp.use_ssl, NULL,
&tlscstatp.host, &tlscstatp.port, NULL,
&tlscstatp.path, NULL, NULL)) {
- BIO_printf(bio_err, "Error parsing -status_url argument\n");
+ BIO_puts(bio_err, "Error parsing -status_url argument\n");
goto end;
}
#endif
@@ -1981,14 +1981,14 @@ int s_server_main(int argc, char *argv[])
case OPT_MAX_EARLY:
max_early_data = atoi(opt_arg());
if (max_early_data < 0) {
- BIO_printf(bio_err, "Invalid value for max_early_data\n");
+ BIO_puts(bio_err, "Invalid value for max_early_data\n");
goto end;
}
break;
case OPT_RECV_MAX_EARLY:
recv_max_early_data = atoi(opt_arg());
if (recv_max_early_data < 0) {
- BIO_printf(bio_err, "Invalid value for recv_max_early_data\n");
+ BIO_puts(bio_err, "Invalid value for recv_max_early_data\n");
goto end;
}
break;
@@ -2045,46 +2045,46 @@ int s_server_main(int argc, char *argv[])
#ifndef OPENSSL_NO_NEXTPROTONEG
if (min_version == TLS1_3_VERSION && next_proto_neg_in != NULL) {
- BIO_printf(bio_err, "Cannot supply -nextprotoneg with TLSv1.3\n");
+ BIO_puts(bio_err, "Cannot supply -nextprotoneg with TLSv1.3\n");
goto opthelp;
}
#endif
#ifndef OPENSSL_NO_DTLS
if (www && socket_type == SOCK_DGRAM) {
- BIO_printf(bio_err, "Can't use -HTTP, -www or -WWW with DTLS\n");
+ BIO_puts(bio_err, "Can't use -HTTP, -www or -WWW with DTLS\n");
goto end;
}
if (dtlslisten && socket_type != SOCK_DGRAM) {
- BIO_printf(bio_err, "Can only use -listen with DTLS\n");
+ BIO_puts(bio_err, "Can only use -listen with DTLS\n");
goto end;
}
if (rev && socket_type == SOCK_DGRAM) {
- BIO_printf(bio_err, "Can't use -rev with DTLS\n");
+ BIO_puts(bio_err, "Can't use -rev with DTLS\n");
goto end;
}
#endif
if (tfo && socket_type != SOCK_STREAM) {
- BIO_printf(bio_err, "Can only use -tfo with TLS\n");
+ BIO_puts(bio_err, "Can only use -tfo with TLS\n");
goto end;
}
if (stateless && socket_type != SOCK_STREAM) {
- BIO_printf(bio_err, "Can only use --stateless with TLS\n");
+ BIO_puts(bio_err, "Can only use --stateless with TLS\n");
goto end;
}
#ifdef AF_UNIX
if (socket_family == AF_UNIX && socket_type != SOCK_STREAM) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Can't use unix sockets and datagrams together\n");
goto end;
}
#endif
if (early_data && rev) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Can't use -early_data in combination with -rev\n");
goto end;
}
@@ -2092,7 +2092,7 @@ int s_server_main(int argc, char *argv[])
#ifndef OPENSSL_NO_SCTP
if (protocol == IPPROTO_SCTP) {
if (socket_type != SOCK_DGRAM) {
- BIO_printf(bio_err, "Can't use -sctp without DTLS\n");
+ BIO_puts(bio_err, "Can't use -sctp without DTLS\n");
goto end;
}
/* SCTP is unusual. It uses DTLS over a SOCK_STREAM protocol */
@@ -2102,23 +2102,23 @@ int s_server_main(int argc, char *argv[])
#ifndef OPENSSL_NO_KTLS
if (use_zc_sendfile && !use_sendfile) {
- BIO_printf(bio_out, "Warning: -zerocopy_sendfile depends on -sendfile, enabling -sendfile now.\n");
+ BIO_puts(bio_err, "Warning: -zerocopy_sendfile depends on -sendfile, enabling -sendfile now.\n");
use_sendfile = 1;
}
if (use_sendfile && enable_ktls == 0) {
- BIO_printf(bio_out, "Warning: -sendfile depends on -ktls, enabling -ktls now.\n");
+ BIO_puts(bio_err, "Warning: -sendfile depends on -ktls, enabling -ktls now.\n");
enable_ktls = 1;
}
if (use_sendfile && www <= 1) {
- BIO_printf(bio_err, "Can't use -sendfile without -WWW or -HTTP\n");
+ BIO_puts(bio_err, "Can't use -sendfile without -WWW or -HTTP\n");
goto end;
}
#endif
if (!app_passwd(passarg, dpassarg, &pass, &dpass)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
goto end;
}
@@ -2219,7 +2219,7 @@ int s_server_main(int argc, char *argv[])
if (s_msg && bio_s_msg == NULL) {
bio_s_msg = dup_bio_out(FORMAT_TEXT);
if (bio_s_msg == NULL) {
- BIO_printf(bio_err, "Out of memory\n");
+ BIO_puts(bio_err, "Out of memory\n");
goto end;
}
}
@@ -2276,10 +2276,10 @@ int s_server_main(int argc, char *argv[])
if (session_id_prefix) {
if (strlen(session_id_prefix) >= 32)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"warning: id_prefix is too long, only one new session will be possible\n");
if (!SSL_CTX_set_generate_session_id(ctx, generate_session_id)) {
- BIO_printf(bio_err, "error setting 'id_prefix'\n");
+ BIO_puts(bio_err, "error setting 'id_prefix'\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -2341,7 +2341,7 @@ int s_server_main(int argc, char *argv[])
if (srtp_profiles != NULL) {
/* Returns 0 on success! */
if (SSL_CTX_set_tlsext_use_srtp(ctx, srtp_profiles) != 0) {
- BIO_printf(bio_err, "Error setting SRTP profile\n");
+ BIO_puts(bio_err, "Error setting SRTP profile\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -2354,7 +2354,7 @@ int s_server_main(int argc, char *argv[])
goto end;
}
if (vpmtouched && !SSL_CTX_set1_param(ctx, vpm)) {
- BIO_printf(bio_err, "Error setting verify params\n");
+ BIO_puts(bio_err, "Error setting verify params\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -2365,7 +2365,7 @@ int s_server_main(int argc, char *argv[])
vfyCApath, vfyCAfile, vfyCAstore,
chCApath, chCAfile, chCAstore,
crls, crl_download)) {
- BIO_printf(bio_err, "Error loading store locations\n");
+ BIO_puts(bio_err, "Error loading store locations\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -2379,17 +2379,17 @@ int s_server_main(int argc, char *argv[])
}
if (ctx2 != NULL) {
- BIO_printf(bio_s_out, "Setting secondary ctx parameters\n");
+ BIO_puts(bio_s_out, "Setting secondary ctx parameters\n");
if (sdebug)
ssl_ctx_security_debug(ctx2, sdebug);
if (session_id_prefix) {
if (strlen(session_id_prefix) >= 32)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"warning: id_prefix is too long, only one new session will be possible\n");
if (!SSL_CTX_set_generate_session_id(ctx2, generate_session_id)) {
- BIO_printf(bio_err, "error setting 'id_prefix'\n");
+ BIO_puts(bio_err, "error setting 'id_prefix'\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -2417,7 +2417,7 @@ int s_server_main(int argc, char *argv[])
goto end;
}
if (vpmtouched && !SSL_CTX_set1_param(ctx2, vpm)) {
- BIO_printf(bio_err, "Error setting verify params\n");
+ BIO_puts(bio_err, "Error setting verify params\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -2444,9 +2444,9 @@ int s_server_main(int argc, char *argv[])
"DH parameters", 1);
if (dhpkey != NULL) {
- BIO_printf(bio_s_out, "Setting temp DH parameters\n");
+ BIO_puts(bio_s_out, "Setting temp DH parameters\n");
} else {
- BIO_printf(bio_s_out, "Using default temp DH parameters\n");
+ BIO_puts(bio_s_out, "Using default temp DH parameters\n");
}
(void)BIO_flush(bio_s_out);
@@ -2479,7 +2479,7 @@ int s_server_main(int argc, char *argv[])
"DH parameters", 1);
if (dhpkey2 != NULL) {
- BIO_printf(bio_s_out, "Setting temp DH parameters\n");
+ BIO_puts(bio_s_out, "Setting temp DH parameters\n");
(void)BIO_flush(bio_s_out);
EVP_PKEY_free(dhpkey);
@@ -2528,16 +2528,16 @@ int s_server_main(int argc, char *argv[])
#ifndef OPENSSL_NO_PSK
if (psk_key != NULL) {
if (s_debug)
- BIO_printf(bio_s_out, "PSK key given, setting server callback\n");
+ BIO_puts(bio_s_out, "PSK key given, setting server callback\n");
SSL_CTX_set_psk_server_callback(ctx, psk_server_cb);
}
if (psk_identity_hint != NULL) {
if (min_version == TLS1_3_VERSION) {
- BIO_printf(bio_s_out, "PSK warning: there is NO identity hint in TLSv1.3\n");
+ BIO_puts(bio_s_out, "PSK warning: there is NO identity hint in TLSv1.3\n");
} else {
if (!SSL_CTX_use_psk_identity_hint(ctx, psk_identity_hint)) {
- BIO_printf(bio_err, "error setting PSK identity hint to context\n");
+ BIO_puts(bio_err, "error setting PSK identity hint to context\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -2568,7 +2568,7 @@ int s_server_main(int argc, char *argv[])
if (!SSL_CTX_set_session_id_context(ctx,
(void *)&s_server_session_id_context,
sizeof(s_server_session_id_context))) {
- BIO_printf(bio_err, "error setting session id context\n");
+ BIO_puts(bio_err, "error setting session id context\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -2586,7 +2586,7 @@ int s_server_main(int argc, char *argv[])
if (!SSL_CTX_set_session_id_context(ctx2,
(void *)&s_server_session_id_context,
sizeof(s_server_session_id_context))) {
- BIO_printf(bio_err, "error setting session id context\n");
+ BIO_puts(bio_err, "error setting session id context\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -2629,20 +2629,20 @@ int s_server_main(int argc, char *argv[])
SSL_CTX_set_recv_max_early_data(ctx, recv_max_early_data);
if (cert_comp) {
- BIO_printf(bio_s_out, "Compressing certificates\n");
+ BIO_puts(bio_s_out, "Compressing certificates\n");
if (!SSL_CTX_compress_certs(ctx, 0))
- BIO_printf(bio_s_out, "Error compressing certs on ctx\n");
+ BIO_puts(bio_s_out, "Error compressing certs on ctx\n");
if (ctx2 != NULL && !SSL_CTX_compress_certs(ctx2, 0))
- BIO_printf(bio_s_out, "Error compressing certs on ctx2\n");
+ BIO_puts(bio_s_out, "Error compressing certs on ctx2\n");
}
if (enable_server_rpk)
if (!SSL_CTX_set1_server_cert_type(ctx, cert_type_rpk, sizeof(cert_type_rpk))) {
- BIO_printf(bio_s_out, "Error setting server certificate types\n");
+ BIO_puts(bio_s_out, "Error setting server certificate types\n");
goto end;
}
if (enable_client_rpk)
if (!SSL_CTX_set1_client_cert_type(ctx, cert_type_rpk, sizeof(cert_type_rpk))) {
- BIO_printf(bio_s_out, "Error setting server certificate types\n");
+ BIO_puts(bio_s_out, "Error setting server certificate types\n");
goto end;
}
@@ -2658,7 +2658,7 @@ int s_server_main(int argc, char *argv[])
unlink(host);
#endif
if (tfo)
- BIO_printf(bio_s_out, "Listening for TFO\n");
+ BIO_puts(bio_s_out, "Listening for TFO\n");
do_server(&accept_socket, host, port, socket_family, socket_type, protocol,
server_cb, context, naccept, bio_s_out, tfo);
print_stats(bio_s_out, ctx);
@@ -2706,28 +2706,29 @@ end:
static void print_stats(BIO *bio, SSL_CTX *ssl_ctx)
{
- BIO_printf(bio, "%4ld items in the session cache\n",
- SSL_CTX_sess_number(ssl_ctx));
- BIO_printf(bio, "%4ld client connects (SSL_connect())\n",
- SSL_CTX_sess_connect(ssl_ctx));
- BIO_printf(bio, "%4ld client renegotiates (SSL_connect())\n",
- SSL_CTX_sess_connect_renegotiate(ssl_ctx));
- BIO_printf(bio, "%4ld client connects that finished\n",
- SSL_CTX_sess_connect_good(ssl_ctx));
- BIO_printf(bio, "%4ld server accepts (SSL_accept())\n",
- SSL_CTX_sess_accept(ssl_ctx));
- BIO_printf(bio, "%4ld server renegotiates (SSL_accept())\n",
- SSL_CTX_sess_accept_renegotiate(ssl_ctx));
- BIO_printf(bio, "%4ld server accepts that finished\n",
- SSL_CTX_sess_accept_good(ssl_ctx));
- BIO_printf(bio, "%4ld session cache hits\n", SSL_CTX_sess_hits(ssl_ctx));
- BIO_printf(bio, "%4ld session cache misses\n",
- SSL_CTX_sess_misses(ssl_ctx));
- BIO_printf(bio, "%4ld session cache timeouts\n",
- SSL_CTX_sess_timeouts(ssl_ctx));
- BIO_printf(bio, "%4ld callback cache hits\n",
- SSL_CTX_sess_cb_hits(ssl_ctx));
- BIO_printf(bio, "%4ld cache full overflows (%ld allowed)\n",
+ BIO_printf(bio, "%4ld items in the session cache\n"
+ "%4ld client connects (SSL_connect())\n"
+ "%4ld client renegotiates (SSL_connect())\n"
+ "%4ld client connects that finished\n"
+ "%4ld server accepts (SSL_accept())\n"
+ "%4ld server renegotiates (SSL_accept())\n"
+ "%4ld server accepts that finished\n"
+ "%4ld session cache hits\n"
+ "%4ld session cache misses\n"
+ "%4ld session cache timeouts\n"
+ "%4ld callback cache hits\n"
+ "%4ld cache full overflows (%ld allowed)\n",
+ SSL_CTX_sess_number(ssl_ctx),
+ SSL_CTX_sess_connect(ssl_ctx),
+ SSL_CTX_sess_connect_renegotiate(ssl_ctx),
+ SSL_CTX_sess_connect_good(ssl_ctx),
+ SSL_CTX_sess_accept(ssl_ctx),
+ SSL_CTX_sess_accept_renegotiate(ssl_ctx),
+ SSL_CTX_sess_accept_good(ssl_ctx),
+ SSL_CTX_sess_hits(ssl_ctx),
+ SSL_CTX_sess_misses(ssl_ctx),
+ SSL_CTX_sess_timeouts(ssl_ctx),
+ SSL_CTX_sess_cb_hits(ssl_ctx),
SSL_CTX_sess_cache_full(ssl_ctx),
SSL_CTX_sess_get_cache_size(ssl_ctx));
}
@@ -2782,7 +2783,7 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
if (!BIO_socket_nbio(s, 1))
ERR_print_errors(bio_err);
else if (!s_quiet)
- BIO_printf(bio_err, "Turned on non blocking io\n");
+ BIO_puts(bio_err, "Turned on non blocking io\n");
}
con = SSL_new(ctx);
@@ -2799,13 +2800,13 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
if (context != NULL
&& !SSL_set_session_id_context(con, context,
(unsigned int)strlen((char *)context))) {
- BIO_printf(bio_err, "Error setting session id context\n");
+ BIO_puts(bio_err, "Error setting session id context\n");
ret = -1;
goto err;
}
if (!SSL_clear(con)) {
- BIO_printf(bio_err, "Error clearing SSL connection\n");
+ BIO_puts(bio_err, "Error clearing SSL connection\n");
ret = -1;
goto err;
}
@@ -2818,7 +2819,7 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
#endif
sbio = BIO_new_dgram(s, BIO_NOCLOSE);
if (sbio == NULL) {
- BIO_printf(bio_err, "Unable to create BIO\n");
+ BIO_puts(bio_err, "Unable to create BIO\n");
ERR_print_errors(bio_err);
goto err;
}
@@ -2843,7 +2844,7 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
}
SSL_set_options(con, SSL_OP_NO_QUERY_MTU);
if (!DTLS_set_link_mtu(con, socket_mtu)) {
- BIO_printf(bio_err, "Failed to set MTU\n");
+ BIO_puts(bio_err, "Failed to set MTU\n");
ret = -1;
BIO_free(sbio);
goto err;
@@ -2862,7 +2863,7 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
sbio = BIO_new_socket(s, BIO_NOCLOSE);
if (sbio == NULL) {
- BIO_printf(bio_err, "Unable to create BIO\n");
+ BIO_puts(bio_err, "Unable to create BIO\n");
ERR_print_errors(bio_err);
goto err;
}
@@ -2872,7 +2873,7 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
test = BIO_new(BIO_f_nbio_test());
if (test == NULL) {
- BIO_printf(bio_err, "Unable to create BIO\n");
+ BIO_puts(bio_err, "Unable to create BIO\n");
ret = -1;
BIO_free(sbio);
goto err;
@@ -2917,14 +2918,14 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
/* Just keep trying - busy waiting */
continue;
default:
- BIO_printf(bio_err, "Error reading early data\n");
+ BIO_puts(bio_err, "Error reading early data\n");
ERR_print_errors(bio_err);
goto err;
}
}
if (readbytes > 0) {
if (write_header) {
- BIO_printf(bio_s_out, "Early data received:\n");
+ BIO_puts(bio_s_out, "Early data received:\n");
write_header = 0;
}
raw_write_stdout(buf, (unsigned int)readbytes);
@@ -2933,11 +2934,11 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
}
if (write_header) {
if (SSL_get_early_data_status(con) == SSL_EARLY_DATA_NOT_SENT)
- BIO_printf(bio_s_out, "No early data received\n");
+ BIO_puts(bio_s_out, "No early data received\n");
else
- BIO_printf(bio_s_out, "Early data was rejected\n");
+ BIO_puts(bio_s_out, "Early data was rejected\n");
} else {
- BIO_printf(bio_s_out, "\nEnd of early data\n");
+ BIO_puts(bio_s_out, "\nEnd of early data\n");
}
if (SSL_is_init_finished(con))
print_connection_info(con);
@@ -2992,7 +2993,7 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
i = select(width, (void *)&readfds, NULL, NULL, timeoutp);
if ((SSL_is_dtls(con)) && DTLSv1_handle_timeout(con) > 0)
- BIO_printf(bio_err, "TIMEOUT occurred\n");
+ BIO_puts(bio_err, "TIMEOUT occurred\n");
if (i <= 0)
continue;
@@ -3027,7 +3028,7 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
if (!s_quiet && !s_brief) {
if ((i <= 0) || (buf[0] == 'Q')) {
- BIO_printf(bio_s_out, "DONE\n");
+ BIO_puts(bio_s_out, "DONE\n");
(void)BIO_flush(bio_s_out);
BIO_closesocket(s);
close_accept_socket();
@@ -3035,7 +3036,7 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
goto err;
}
if ((i <= 0) || (buf[0] == 'q')) {
- BIO_printf(bio_s_out, "DONE\n");
+ BIO_puts(bio_s_out, "DONE\n");
(void)BIO_flush(bio_s_out);
if (SSL_version(con) != DTLS1_VERSION)
BIO_closesocket(s);
@@ -3095,7 +3096,7 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
k = SSL_write(con, &(buf[l]), (unsigned int)i);
#ifndef OPENSSL_NO_SRP
while (SSL_get_error(con, k) == SSL_ERROR_WANT_X509_LOOKUP) {
- BIO_printf(bio_s_out, "LOOKUP renego during write\n");
+ BIO_puts(bio_s_out, "LOOKUP renego during write\n");
lookup_srp_user(&srp_callback_parm, bio_s_out);
@@ -3106,14 +3107,14 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
case SSL_ERROR_NONE:
break;
case SSL_ERROR_WANT_ASYNC:
- BIO_printf(bio_s_out, "Write BLOCK (Async)\n");
+ BIO_puts(bio_s_out, "Write BLOCK (Async)\n");
(void)BIO_flush(bio_s_out);
wait_for_async(con);
break;
case SSL_ERROR_WANT_WRITE:
case SSL_ERROR_WANT_READ:
case SSL_ERROR_WANT_X509_LOOKUP:
- BIO_printf(bio_s_out, "Write BLOCK\n");
+ BIO_puts(bio_s_out, "Write BLOCK\n");
(void)BIO_flush(bio_s_out);
break;
case SSL_ERROR_WANT_ASYNC_JOB:
@@ -3122,14 +3123,14 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
*/
case SSL_ERROR_SYSCALL:
case SSL_ERROR_SSL:
- BIO_printf(bio_s_out, "ERROR\n");
+ BIO_puts(bio_s_out, "ERROR\n");
(void)BIO_flush(bio_s_out);
ERR_print_errors(bio_err);
ret = 1;
goto err;
/* break; */
case SSL_ERROR_ZERO_RETURN:
- BIO_printf(bio_s_out, "DONE\n");
+ BIO_puts(bio_s_out, "DONE\n");
(void)BIO_flush(bio_s_out);
ret = 1;
goto err;
@@ -3181,7 +3182,7 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
i = SSL_read(con, (char *)buf, bufsize);
#ifndef OPENSSL_NO_SRP
while (SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP) {
- BIO_printf(bio_s_out, "LOOKUP renego during read\n");
+ BIO_puts(bio_s_out, "LOOKUP renego during read\n");
lookup_srp_user(&srp_callback_parm, bio_s_out);
@@ -3199,13 +3200,13 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
goto again;
break;
case SSL_ERROR_WANT_ASYNC:
- BIO_printf(bio_s_out, "Read BLOCK (Async)\n");
+ BIO_puts(bio_s_out, "Read BLOCK (Async)\n");
(void)BIO_flush(bio_s_out);
wait_for_async(con);
break;
case SSL_ERROR_WANT_WRITE:
case SSL_ERROR_WANT_READ:
- BIO_printf(bio_s_out, "Read BLOCK\n");
+ BIO_puts(bio_s_out, "Read BLOCK\n");
(void)BIO_flush(bio_s_out);
break;
case SSL_ERROR_WANT_ASYNC_JOB:
@@ -3214,13 +3215,13 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
*/
case SSL_ERROR_SYSCALL:
case SSL_ERROR_SSL:
- BIO_printf(bio_s_out, "ERROR\n");
+ BIO_puts(bio_s_out, "ERROR\n");
(void)BIO_flush(bio_s_out);
ERR_print_errors(bio_err);
ret = 1;
goto err;
case SSL_ERROR_ZERO_RETURN:
- BIO_printf(bio_s_out, "DONE\n");
+ BIO_puts(bio_s_out, "DONE\n");
(void)BIO_flush(bio_s_out);
ret = 1;
goto err;
@@ -3230,18 +3231,18 @@ static int sv_body(int s, int stype, int prot, unsigned char *context)
}
err:
if (con != NULL) {
- BIO_printf(bio_s_out, "shutting down SSL\n");
+ BIO_puts(bio_s_out, "shutting down SSL\n");
do_ssl_shutdown(con);
SSL_free(con);
}
- BIO_printf(bio_s_out, "CONNECTION CLOSED\n");
+ BIO_puts(bio_s_out, "CONNECTION CLOSED\n");
OPENSSL_clear_free(buf, bufsize);
return ret;
}
static void close_accept_socket(void)
{
- BIO_printf(bio_err, "shutdown accept socket\n");
+ BIO_puts(bio_err, "shutdown accept socket\n");
if (accept_socket >= 0) {
BIO_closesocket(accept_socket);
}
@@ -3268,7 +3269,7 @@ static int init_ssl_connection(SSL *con)
if (dtlslisten) {
if ((client = BIO_ADDR_new()) == NULL) {
- BIO_printf(bio_err, "ERROR - memory\n");
+ BIO_puts(bio_err, "ERROR - memory\n");
return 0;
}
i = DTLSv1_listen(con, client);
@@ -3286,7 +3287,7 @@ static int init_ssl_connection(SSL *con)
}
if (!wbio || BIO_connect(fd, client, 0) == 0) {
- BIO_printf(bio_err, "ERROR - unable to connect\n");
+ BIO_puts(bio_err, "ERROR - unable to connect\n");
BIO_ADDR_free(client);
return 0;
}
@@ -3312,7 +3313,7 @@ static int init_ssl_connection(SSL *con)
while (i <= 0
&& SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP
&& SSL_get_state(con) == TLS_ST_SR_CLNT_HELLO) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"LOOKUP from certificate callback during accept\n");
i = SSL_accept(con);
if (i <= 0)
@@ -3340,11 +3341,11 @@ static int init_ssl_connection(SSL *con)
if (i <= 0) {
if (((dtlslisten || stateless) && i == 0)
|| (!dtlslisten && !stateless && retry)) {
- BIO_printf(bio_s_out, "DELAY\n");
+ BIO_puts(bio_s_out, "DELAY\n");
return 1;
}
- BIO_printf(bio_err, "ERROR\n");
+ BIO_puts(bio_err, "ERROR\n");
verify_err = SSL_get_verify_result(con);
if (verify_err != X509_V_OK) {
@@ -3379,21 +3380,21 @@ static void print_connection_info(SSL *con)
peer = SSL_get0_peer_certificate(con);
if (peer != NULL) {
- BIO_printf(bio_s_out, "Client certificate\n");
+ BIO_puts(bio_s_out, "Client certificate\n");
PEM_write_bio_X509(bio_s_out, peer);
dump_cert_text(bio_s_out, peer);
peer = NULL;
}
/* Only display RPK information if configured */
if (SSL_get_negotiated_server_cert_type(con) == TLSEXT_cert_type_rpk)
- BIO_printf(bio_s_out, "Server-to-client raw public key negotiated\n");
+ BIO_puts(bio_s_out, "Server-to-client raw public key negotiated\n");
if (SSL_get_negotiated_client_cert_type(con) == TLSEXT_cert_type_rpk)
- BIO_printf(bio_s_out, "Client-to-server raw public key negotiated\n");
+ BIO_puts(bio_s_out, "Client-to-server raw public key negotiated\n");
if (enable_client_rpk) {
EVP_PKEY *client_rpk = SSL_get0_peer_rpk(con);
if (client_rpk != NULL) {
- BIO_printf(bio_s_out, "Client raw public key\n");
+ BIO_puts(bio_s_out, "Client raw public key\n");
EVP_PKEY_print_public(bio_s_out, client_rpk, 2, NULL);
}
}
@@ -3412,9 +3413,9 @@ static void print_connection_info(SSL *con)
#if !defined(OPENSSL_NO_NEXTPROTONEG)
SSL_get0_next_proto_negotiated(con, &next_proto_neg, &next_proto_neg_len);
if (next_proto_neg) {
- BIO_printf(bio_s_out, "NEXTPROTO is ");
+ BIO_puts(bio_s_out, "NEXTPROTO is ");
BIO_write(bio_s_out, next_proto_neg, next_proto_neg_len);
- BIO_printf(bio_s_out, "\n");
+ BIO_puts(bio_s_out, "\n");
}
#endif
#ifndef OPENSSL_NO_SRTP
@@ -3428,17 +3429,19 @@ static void print_connection_info(SSL *con)
}
#endif
if (SSL_session_reused(con))
- BIO_printf(bio_s_out, "Reused session-id\n");
+ BIO_puts(bio_s_out, "Reused session-id\n");
ssl_print_secure_renegotiation_notes(bio_s_out, con);
if ((SSL_get_options(con) & SSL_OP_NO_RENEGOTIATION))
- BIO_printf(bio_s_out, "Renegotiation is DISABLED\n");
+ BIO_puts(bio_s_out, "Renegotiation is DISABLED\n");
if (keymatexportlabel != NULL && keymatexportlen > 0) {
- BIO_printf(bio_s_out, "Keying material exporter:\n");
- BIO_printf(bio_s_out, " Label: '%s'\n", keymatexportlabel);
- BIO_printf(bio_s_out, " Length: %i bytes\n", keymatexportlen);
+ BIO_printf(bio_s_out, "Keying material exporter:\n"
+ " Label: '%s'\n"
+ " Length: %i bytes\n",
+ keymatexportlabel,
+ keymatexportlen);
exportedkeymat = app_malloc(keymatexportlen, "export key");
if (SSL_export_keying_material(con, exportedkeymat,
keymatexportlen,
@@ -3446,20 +3449,20 @@ static void print_connection_info(SSL *con)
strlen(keymatexportlabel),
NULL, 0, 0)
<= 0) {
- BIO_printf(bio_s_out, " Error\n");
+ BIO_puts(bio_s_out, " Error\n");
} else {
- BIO_printf(bio_s_out, " Keying material: ");
+ BIO_puts(bio_s_out, " Keying material: ");
for (i = 0; i < keymatexportlen; i++)
BIO_printf(bio_s_out, "%02X", exportedkeymat[i]);
- BIO_printf(bio_s_out, "\n");
+ BIO_puts(bio_s_out, "\n");
}
OPENSSL_free(exportedkeymat);
}
#ifndef OPENSSL_NO_KTLS
if (BIO_get_ktls_send(SSL_get_wbio(con)))
- BIO_printf(bio_err, "Using Kernel TLS for sending\n");
+ BIO_puts(bio_err, "Using Kernel TLS for sending\n");
if (BIO_get_ktls_recv(SSL_get_rbio(con)))
- BIO_printf(bio_err, "Using Kernel TLS for receiving\n");
+ BIO_puts(bio_err, "Using Kernel TLS for receiving\n");
#endif
(void)BIO_flush(bio_s_out);
@@ -3499,7 +3502,7 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
if (!BIO_socket_nbio(s, 1))
ERR_print_errors(bio_err);
else if (!s_quiet)
- BIO_printf(bio_err, "Turned on non blocking io\n");
+ BIO_puts(bio_err, "Turned on non blocking io\n");
}
/* lets make the output buffer a reasonable size */
@@ -3591,7 +3594,7 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
/* Just keep trying - busy waiting */
continue;
default:
- BIO_printf(bio_err, "Error reading early data\n");
+ BIO_puts(bio_err, "Error reading early data\n");
ERR_print_errors(bio_err);
goto err;
}
@@ -3609,11 +3612,11 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
ERR_print_errors(bio_err);
goto err;
} else {
- BIO_printf(bio_s_out, "read R BLOCK\n");
+ BIO_puts(bio_s_out, "read R BLOCK\n");
#ifndef OPENSSL_NO_SRP
if (BIO_should_io_special(io)
&& BIO_get_retry_reason(io) == BIO_RR_SSL_X509_LOOKUP) {
- BIO_printf(bio_s_out, "LOOKUP renego during read\n");
+ BIO_puts(bio_s_out, "LOOKUP renego during read\n");
lookup_srp_user(&srp_callback_parm, bio_s_out);
@@ -3655,7 +3658,7 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
openssl_fdset(s, &readfds);
i = select(width, (void *)&readfds, NULL, NULL, NULL);
if (i <= 0 || !FD_ISSET(s, &readfds)) {
- BIO_printf(bio_s_out,
+ BIO_puts(bio_s_out,
"Error waiting for client response\n");
ERR_print_errors(bio_err);
goto err;
@@ -3670,9 +3673,9 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
}
BIO_puts(io,
- "HTTP/1.0 200 ok\r\nContent-type: text/html\r\n\r\n");
- BIO_puts(io, "<HTML><BODY BGCOLOR=\"#ffffff\">\n");
- BIO_puts(io, "<pre>\n");
+ "HTTP/1.0 200 ok\r\nContent-type: text/html\r\n\r\n"
+ "<HTML><BODY BGCOLOR=\"#ffffff\">\n"
+ "<pre>\n");
/* BIO_puts(io, OpenSSL_version(OPENSSL_VERSION)); */
BIO_puts(io, "\n");
for (i = 0; i < local_argc; i++) {
@@ -3702,7 +3705,7 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
/*
* The following is evil and should not really be done
*/
- BIO_printf(io, "Ciphers supported in s_server binary\n");
+ BIO_puts(io, "Ciphers supported in s_server binary\n");
sk = SSL_get_ciphers(con);
j = sk_SSL_CIPHER_num(sk);
for (i = 0; i < j; i++) {
@@ -3715,7 +3718,7 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
BIO_puts(io, "\n");
p = SSL_get_shared_ciphers(con, buf, bufsize);
if (p != NULL) {
- BIO_printf(io,
+ BIO_puts(io,
"---\nCiphers common between both SSL end points:\n");
j = i = 0;
while (*p) {
@@ -3742,12 +3745,12 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
BIO_printf(io, "%s, Cipher is %s\n",
SSL_CIPHER_get_version(c), SSL_CIPHER_get_name(c));
SSL_SESSION_print(io, SSL_get_session(con));
- BIO_printf(io, "---\n");
+ BIO_puts(io, "---\n");
print_stats(io, SSL_get_SSL_CTX(con));
- BIO_printf(io, "---\n");
+ BIO_puts(io, "---\n");
peer = SSL_get0_peer_certificate(con);
if (peer != NULL) {
- BIO_printf(io, "Client certificate\n");
+ BIO_puts(io, "Client certificate\n");
X509_print(io, peer);
PEM_write_bio_X509(io, peer);
peer = NULL;
@@ -3790,35 +3793,30 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
* component */
if (*e == '\0') {
- BIO_puts(io, text);
- BIO_printf(io, "'%s' is an invalid file name\r\n", p);
+ BIO_printf(io, "%s'%s' is an invalid file name\r\n", text, p);
break;
}
*e = '\0';
if (dot) {
- BIO_puts(io, text);
- BIO_printf(io, "'%s' contains '..' or ':'\r\n", p);
+ BIO_printf(io, "%s'%s' contains '..' or ':'\r\n", text, p);
break;
}
if (*p == '/' || *p == '\\') {
- BIO_puts(io, text);
- BIO_printf(io, "'%s' is an invalid path\r\n", p);
+ BIO_printf(io, "%s'%s' is an invalid path\r\n", text, p);
break;
}
/* if a directory, do the index thang */
if (app_isdir(p) > 0) {
- BIO_puts(io, text);
- BIO_printf(io, "'%s' is a directory\r\n", p);
+ BIO_printf(io, "%s'%s' is a directory\r\n", text, p);
break;
}
opmode = (http_server_binmode == 1) ? "rb" : "r";
if ((file = BIO_new_file(p, opmode)) == NULL) {
- BIO_puts(io, text);
- BIO_printf(io, "Error opening '%s' mode='%s'\r\n", p, opmode);
+ BIO_printf(io, "%sError opening '%s' mode='%s'\r\n", text, p, opmode);
ERR_print_errors(io);
break;
}
@@ -3838,7 +3836,7 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
/* send the file */
#ifndef OPENSSL_NO_KTLS
if (use_sendfile_for_req && !BIO_get_ktls_send(SSL_get_wbio(con))) {
- BIO_printf(bio_err, "Warning: sendfile requested but KTLS is not available\n");
+ BIO_puts(bio_err, "Warning: sendfile requested but KTLS is not available\n");
use_sendfile_for_req = 0;
}
if (use_sendfile_for_req) {
@@ -3893,7 +3891,7 @@ static int www_body(int s, int stype, int prot, unsigned char *context)
&& !SSL_waiting_for_async(con)) {
goto write_error;
} else {
- BIO_printf(bio_s_out, "rwrite W BLOCK\n");
+ BIO_puts(bio_s_out, "rwrite W BLOCK\n");
}
} else {
j += k;
@@ -4013,7 +4011,7 @@ static int rev_body(int s, int stype, int prot, unsigned char *context)
#ifndef OPENSSL_NO_SRP
if (BIO_should_io_special(io)
&& BIO_get_retry_reason(io) == BIO_RR_SSL_X509_LOOKUP) {
- BIO_printf(bio_s_out, "LOOKUP renego during accept\n");
+ BIO_puts(bio_s_out, "LOOKUP renego during accept\n");
lookup_srp_user(&srp_callback_parm, bio_s_out);
@@ -4021,7 +4019,7 @@ static int rev_body(int s, int stype, int prot, unsigned char *context)
}
#endif
}
- BIO_printf(bio_err, "CONNECTION ESTABLISHED\n");
+ BIO_puts(bio_err, "CONNECTION ESTABLISHED\n");
print_ssl_summary(con);
for (;;) {
@@ -4032,11 +4030,11 @@ static int rev_body(int s, int stype, int prot, unsigned char *context)
ERR_print_errors(bio_err);
goto err;
} else {
- BIO_printf(bio_s_out, "read R BLOCK\n");
+ BIO_puts(bio_s_out, "read R BLOCK\n");
#ifndef OPENSSL_NO_SRP
if (BIO_should_io_special(io)
&& BIO_get_retry_reason(io) == BIO_RR_SSL_X509_LOOKUP) {
- BIO_printf(bio_s_out, "LOOKUP renego during read\n");
+ BIO_puts(bio_s_out, "LOOKUP renego during read\n");
lookup_srp_user(&srp_callback_parm, bio_s_out);
@@ -4048,7 +4046,7 @@ static int rev_body(int s, int stype, int prot, unsigned char *context)
}
} else if (i == 0) { /* end of input */
ret = 1;
- BIO_printf(bio_err, "CONNECTION CLOSED\n");
+ BIO_puts(bio_err, "CONNECTION CLOSED\n");
goto end;
} else {
char *p = buf + i - 1;
@@ -4058,7 +4056,7 @@ static int rev_body(int s, int stype, int prot, unsigned char *context)
}
if (!s_ign_eof && i == 5 && HAS_PREFIX(buf, "CLOSE")) {
ret = 1;
- BIO_printf(bio_err, "CONNECTION CLOSED\n");
+ BIO_puts(bio_err, "CONNECTION CLOSED\n");
goto end;
}
BUF_reverse((unsigned char *)buf, NULL, i);
@@ -4135,7 +4133,7 @@ static int add_session(SSL *ssl, SSL_SESSION *session)
SSL_SESSION_get_id(session, &sess->idlen);
sess->derlen = i2d_SSL_SESSION(session, NULL);
if (sess->derlen <= 0) {
- BIO_printf(bio_err, "Error encoding session\n");
+ BIO_puts(bio_err, "Error encoding session\n");
OPENSSL_free(sess);
return 0;
}
@@ -4143,7 +4141,7 @@ static int add_session(SSL *ssl, SSL_SESSION *session)
sess->id = OPENSSL_memdup(SSL_SESSION_get_id(session, NULL), sess->idlen);
sess->der = app_malloc(sess->derlen, "get session buffer");
if (!sess->id) {
- BIO_printf(bio_err, "Out of memory adding to external cache\n");
+ BIO_puts(bio_err, "Out of memory adding to external cache\n");
OPENSSL_free(sess->id);
OPENSSL_free(sess->der);
OPENSSL_free(sess);
@@ -4153,7 +4151,7 @@ static int add_session(SSL *ssl, SSL_SESSION *session)
/* Assume it still works. */
if (i2d_SSL_SESSION(session, &p) != sess->derlen) {
- BIO_printf(bio_err, "Unexpected session encoding length\n");
+ BIO_puts(bio_err, "Unexpected session encoding length\n");
OPENSSL_free(sess->id);
OPENSSL_free(sess->der);
OPENSSL_free(sess);
@@ -4162,7 +4160,7 @@ static int add_session(SSL *ssl, SSL_SESSION *session)
sess->next = first;
first = sess;
- BIO_printf(bio_err, "New session added to external cache\n");
+ BIO_puts(bio_err, "New session added to external cache\n");
return 0;
}
@@ -4174,12 +4172,12 @@ static SSL_SESSION *get_session(SSL *ssl, const unsigned char *id, int idlen,
for (sess = first; sess; sess = sess->next) {
if (idlen == (int)sess->idlen && !memcmp(sess->id, id, idlen)) {
const unsigned char *p = sess->der;
- BIO_printf(bio_err, "Lookup session: cache hit\n");
+ BIO_puts(bio_err, "Lookup session: cache hit\n");
return d2i_SSL_SESSION_ex(NULL, &p, sess->derlen, app_get0_libctx(),
app_get0_propq());
}
}
- BIO_printf(bio_err, "Lookup session: cache miss\n");
+ BIO_puts(bio_err, "Lookup session: cache miss\n");
return NULL;
}
diff --git a/apps/s_time.c b/apps/s_time.c
index 7e34f01045..96b3dc6d1f 100644
--- a/apps/s_time.c
+++ b/apps/s_time.c
@@ -348,7 +348,7 @@ next:
/* Get an SSL object so we can reuse the session id */
if ((scon = doConnection(NULL, host, ctx)) == NULL) {
- BIO_printf(bio_err, "Unable to get connection\n");
+ BIO_puts(bio_err, "Unable to get connection\n");
goto end;
}
@@ -466,7 +466,7 @@ static SSL *doConnection(SSL *scon, const char *host, SSL_CTX *ctx)
/* ok, lets connect */
i = SSL_connect(serverCon);
if (i <= 0) {
- BIO_printf(bio_err, "ERROR\n");
+ BIO_puts(bio_err, "ERROR\n");
if (verify_args.error != X509_V_OK)
BIO_printf(bio_err, "verify error:%s\n",
X509_verify_cert_error_string(verify_args.error));
diff --git a/apps/sess_id.c b/apps/sess_id.c
index 130670d1de..24c07c2dac 100644
--- a/apps/sess_id.c
+++ b/apps/sess_id.c
@@ -116,12 +116,12 @@ int sess_id_main(int argc, char **argv)
if (context != NULL) {
size_t ctx_len = strlen(context);
if (ctx_len > SSL_MAX_SID_CTX_LENGTH) {
- BIO_printf(bio_err, "Context too long\n");
+ BIO_puts(bio_err, "Context too long\n");
goto end;
}
if (!SSL_SESSION_set1_id_context(x, (unsigned char *)context,
(unsigned int)ctx_len)) {
- BIO_printf(bio_err, "Error setting id context\n");
+ BIO_puts(bio_err, "Error setting id context\n");
goto end;
}
}
@@ -151,11 +151,11 @@ int sess_id_main(int argc, char **argv)
} else if (outformat == FORMAT_NSS) {
i = SSL_SESSION_print_keylog(out, x);
} else {
- BIO_printf(bio_err, "bad output format specified for outfile\n");
+ BIO_puts(bio_err, "bad output format specified for outfile\n");
goto end;
}
if (!i) {
- BIO_printf(bio_err, "unable to write SSL_SESSION\n");
+ BIO_puts(bio_err, "unable to write SSL_SESSION\n");
goto end;
}
} else if (!noout && (peer != NULL)) { /* just print the certificate */
@@ -164,11 +164,11 @@ int sess_id_main(int argc, char **argv)
} else if (outformat == FORMAT_PEM) {
i = PEM_write_bio_X509(out, peer);
} else {
- BIO_printf(bio_err, "bad output format specified for outfile\n");
+ BIO_puts(bio_err, "bad output format specified for outfile\n");
goto end;
}
if (!i) {
- BIO_printf(bio_err, "unable to write X509\n");
+ BIO_puts(bio_err, "unable to write X509\n");
goto end;
}
}
@@ -192,7 +192,7 @@ static SSL_SESSION *load_sess_id(char *infile, int format)
else
x = PEM_read_bio_SSL_SESSION(in, NULL, NULL, NULL);
if (x == NULL) {
- BIO_printf(bio_err, "unable to load SSL_SESSION\n");
+ BIO_puts(bio_err, "unable to load SSL_SESSION\n");
ERR_print_errors(bio_err);
goto end;
}
diff --git a/apps/skeyutl.c b/apps/skeyutl.c
index 2404a8e8aa..cfc2cadc11 100644
--- a/apps/skeyutl.c
+++ b/apps/skeyutl.c
@@ -88,7 +88,7 @@ int skeyutl_main(int argc, char **argv)
goto opthelp;
if (cipher == NULL && skeymgmt == NULL) {
- BIO_printf(bio_err, "Either -skeymgmt -or -cipher option should be specified\n");
+ BIO_puts(bio_err, "Either -skeymgmt -or -cipher option should be specified\n");
goto end;
}
@@ -114,15 +114,17 @@ int skeyutl_main(int argc, char **argv)
} else {
const char *key_name = EVP_SKEY_get0_key_id(skey);
- BIO_printf(bio_out, "An opaque key identified by %s is created\n",
- key_name ? key_name : "<unknown>");
- BIO_printf(bio_out, "Provider: %s\n", EVP_SKEY_get0_provider_name(skey));
- BIO_printf(bio_out, "Key management: %s\n", EVP_SKEY_get0_skeymgmt_name(skey));
+ BIO_printf(bio_out, "An opaque key identified by %s is created\n"
+ "Provider: %s\n"
+ "Key management: %s\n",
+ key_name ? key_name : "<unknown>",
+ EVP_SKEY_get0_provider_name(skey),
+ EVP_SKEY_get0_skeymgmt_name(skey));
ret = 0;
}
goto end;
} else {
- BIO_printf(bio_err, "Key generation is the only supported operation as of now\n");
+ BIO_puts(bio_err, "Key generation is the only supported operation as of now\n");
}
end:
diff --git a/apps/smime.c b/apps/smime.c
index 458056c04d..b4f3f19f5d 100644
--- a/apps/smime.c
+++ b/apps/smime.c
@@ -463,26 +463,26 @@ int smime_main(int argc, char **argv)
goto end;
}
if (sksigners == NULL) {
- BIO_printf(bio_err, "No signer certificate specified\n");
+ BIO_puts(bio_err, "No signer certificate specified\n");
goto opthelp;
}
signerfile = NULL;
keyfile = NULL;
} else if (operation == SMIME_DECRYPT) {
if (recipfile == NULL && keyfile == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"No recipient certificate or key specified\n");
goto opthelp;
}
} else if (operation == SMIME_ENCRYPT) {
if (argc == 0) {
- BIO_printf(bio_err, "No recipient(s) certificate(s) specified\n");
+ BIO_puts(bio_err, "No recipient(s) certificate(s) specified\n");
goto opthelp;
}
}
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
goto end;
}
@@ -560,7 +560,7 @@ int smime_main(int argc, char **argv)
p7 = PKCS7_new_ex(libctx, app_get0_propq());
if (p7 == NULL) {
- BIO_printf(bio_err, "Error allocating PKCS7 object\n");
+ BIO_puts(bio_err, "Error allocating PKCS7 object\n");
goto end;
}
if (informat == FORMAT_SMIME) {
@@ -570,12 +570,12 @@ int smime_main(int argc, char **argv)
} else if (informat == FORMAT_ASN1) {
p7_in = d2i_PKCS7_bio(in, &p7);
} else {
- BIO_printf(bio_err, "Bad input format for PKCS#7 file\n");
+ BIO_puts(bio_err, "Bad input format for PKCS#7 file\n");
goto end;
}
if (p7_in == NULL) {
- BIO_printf(bio_err, "Error reading S/MIME message\n");
+ BIO_puts(bio_err, "Error reading S/MIME message\n");
goto end;
}
if (contfile != NULL) {
@@ -658,22 +658,22 @@ int smime_main(int argc, char **argv)
}
if (p7 == NULL) {
- BIO_printf(bio_err, "Error creating PKCS#7 structure\n");
+ BIO_puts(bio_err, "Error creating PKCS#7 structure\n");
goto end;
}
ret = 4;
if (operation == SMIME_DECRYPT) {
if (!PKCS7_decrypt(p7, key, recip, out, flags)) {
- BIO_printf(bio_err, "Error decrypting PKCS#7 structure\n");
+ BIO_puts(bio_err, "Error decrypting PKCS#7 structure\n");
goto end;
}
} else if (operation == SMIME_VERIFY) {
STACK_OF(X509) *signers;
if (PKCS7_verify(p7, other, store, indata, out, flags))
- BIO_printf(bio_err, "Verification successful\n");
+ BIO_puts(bio_err, "Verification successful\n");
else {
- BIO_printf(bio_err, "Verification failure\n");
+ BIO_puts(bio_err, "Verification failure\n");
goto end;
}
signers = PKCS7_get0_signers(p7, other, flags);
@@ -702,11 +702,11 @@ int smime_main(int argc, char **argv)
} else if (outformat == FORMAT_ASN1) {
rv = i2d_PKCS7_bio_stream(out, p7, in, flags);
} else {
- BIO_printf(bio_err, "Bad output format for PKCS#7 file\n");
+ BIO_puts(bio_err, "Bad output format for PKCS#7 file\n");
goto end;
}
if (rv == 0) {
- BIO_printf(bio_err, "Error writing output\n");
+ BIO_puts(bio_err, "Error writing output\n");
ret = 3;
goto end;
}
diff --git a/apps/speed.c b/apps/speed.c
index cda7e4cbfb..807257ffbf 100644
--- a/apps/speed.c
+++ b/apps/speed.c
@@ -980,7 +980,7 @@ static int EVP_Update_loop(void *args)
rc = EVP_EncryptFinal_ex(ctx, buf, &outl);
if (rc == 0)
- BIO_printf(bio_err, "Error finalizing cipher loop\n");
+ BIO_puts(bio_err, "Error finalizing cipher loop\n");
return count;
}
@@ -1005,7 +1005,7 @@ static int EVP_Update_loop_aead_enc(void *args)
if (mode_op != EVP_CIPH_SIV_MODE) {
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN,
sizeof(aead_iv), NULL)) {
- BIO_printf(bio_err, "\nFailed to set iv length\n");
+ BIO_puts(bio_err, "\nFailed to set iv length\n");
dofail();
exit(1);
}
@@ -1016,13 +1016,13 @@ static int EVP_Update_loop_aead_enc(void *args)
&& mode_op != EVP_CIPH_GCM_SIV_MODE) {
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG,
TAG_LEN, NULL)) {
- BIO_printf(bio_err, "\nFailed to set tag length\n");
+ BIO_puts(bio_err, "\nFailed to set tag length\n");
dofail();
exit(1);
}
}
if (!EVP_CipherInit_ex(ctx, NULL, NULL, key, aead_iv, -1)) {
- BIO_printf(bio_err, "\nFailed to set key and iv\n");
+ BIO_puts(bio_err, "\nFailed to set key and iv\n");
dofail();
exit(1);
}
@@ -1030,20 +1030,20 @@ static int EVP_Update_loop_aead_enc(void *args)
if (mode_op == EVP_CIPH_CCM_MODE) {
if (!EVP_EncryptUpdate(ctx, NULL, &outl,
NULL, lengths[testnum])) {
- BIO_printf(bio_err, "\nCouldn't set input text length\n");
+ BIO_puts(bio_err, "\nCouldn't set input text length\n");
dofail();
exit(1);
}
}
if (aead) {
if (!EVP_EncryptUpdate(ctx, NULL, &outl, aad, sizeof(aad))) {
- BIO_printf(bio_err, "\nCouldn't insert AAD when encrypting\n");
+ BIO_puts(bio_err, "\nCouldn't insert AAD when encrypting\n");
dofail();
exit(1);
}
}
if (!EVP_EncryptUpdate(ctx, buf, &outl, buf, lengths[testnum])) {
- BIO_printf(bio_err, "\nFailed to encrypt the data\n");
+ BIO_puts(bio_err, "\nFailed to encrypt the data\n");
dofail();
exit(1);
}
@@ -1077,7 +1077,7 @@ static int EVP_Update_loop_aead_dec(void *args)
if (mode_op != EVP_CIPH_SIV_MODE) {
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN,
sizeof(aead_iv), NULL)) {
- BIO_printf(bio_err, "\nFailed to set iv length\n");
+ BIO_puts(bio_err, "\nFailed to set iv length\n");
dofail();
exit(1);
}
@@ -1089,20 +1089,20 @@ static int EVP_Update_loop_aead_dec(void *args)
&& mode_op != EVP_CIPH_GCM_SIV_MODE) {
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG,
TAG_LEN, NULL)) {
- BIO_printf(bio_err, "\nFailed to set tag length\n");
+ BIO_puts(bio_err, "\nFailed to set tag length\n");
dofail();
exit(1);
}
}
if (!EVP_CipherInit_ex(ctx, NULL, NULL, key, aead_iv, -1)) {
- BIO_printf(bio_err, "\nFailed to set key and iv\n");
+ BIO_puts(bio_err, "\nFailed to set key and iv\n");
dofail();
exit(1);
}
/* Set iv before decryption (Doesn't apply to SIV mode) */
if (mode_op != EVP_CIPH_SIV_MODE) {
if (!EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, aead_iv)) {
- BIO_printf(bio_err, "\nFailed to set iv\n");
+ BIO_puts(bio_err, "\nFailed to set iv\n");
dofail();
exit(1);
}
@@ -1111,7 +1111,7 @@ static int EVP_Update_loop_aead_dec(void *args)
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG,
TAG_LEN, tag)) {
- BIO_printf(bio_err, "\nFailed to set tag\n");
+ BIO_puts(bio_err, "\nFailed to set tag\n");
dofail();
exit(1);
}
@@ -1119,20 +1119,20 @@ static int EVP_Update_loop_aead_dec(void *args)
if (mode_op == EVP_CIPH_CCM_MODE) {
if (!EVP_DecryptUpdate(ctx, NULL, &outl,
NULL, lengths[testnum])) {
- BIO_printf(bio_err, "\nCouldn't set cipher text length\n");
+ BIO_puts(bio_err, "\nCouldn't set cipher text length\n");
dofail();
exit(1);
}
}
if (aead) {
if (!EVP_DecryptUpdate(ctx, NULL, &outl, aad, sizeof(aad))) {
- BIO_printf(bio_err, "\nCouldn't insert AAD when decrypting\n");
+ BIO_puts(bio_err, "\nCouldn't insert AAD when decrypting\n");
dofail();
exit(1);
}
}
if (!EVP_DecryptUpdate(ctx, outbuf, &outl, buf, lengths[testnum])) {
- BIO_printf(bio_err, "\nFailed to decrypt the data\n");
+ BIO_puts(bio_err, "\nFailed to decrypt the data\n");
dofail();
exit(1);
}
@@ -1155,7 +1155,7 @@ static int RSA_sign_loop(void *args)
*rsa_num = tempargs->buflen;
ret = EVP_PKEY_sign(rsa_sign_ctx[testnum], buf2, rsa_num, buf, 36);
if (ret <= 0) {
- BIO_printf(bio_err, "RSA sign failure\n");
+ BIO_puts(bio_err, "RSA sign failure\n");
dofail();
count = -1;
break;
@@ -1176,7 +1176,7 @@ static int RSA_verify_loop(void *args)
for (count = 0; COND(rsa_c[testnum][1]); count++) {
ret = EVP_PKEY_verify(rsa_verify_ctx[testnum], buf2, rsa_num, buf, 36);
if (ret <= 0) {
- BIO_printf(bio_err, "RSA verify failure\n");
+ BIO_puts(bio_err, "RSA verify failure\n");
dofail();
count = -1;
break;
@@ -1198,7 +1198,7 @@ static int RSA_encrypt_loop(void *args)
*rsa_num = tempargs->buflen;
ret = EVP_PKEY_encrypt(rsa_encrypt_ctx[testnum], buf2, rsa_num, buf, 36);
if (ret <= 0) {
- BIO_printf(bio_err, "RSA encrypt failure\n");
+ BIO_puts(bio_err, "RSA encrypt failure\n");
dofail();
count = -1;
break;
@@ -1220,7 +1220,7 @@ static int RSA_decrypt_loop(void *args)
rsa_num = tempargs->buflen;
ret = EVP_PKEY_decrypt(rsa_decrypt_ctx[testnum], buf, &rsa_num, buf2, tempargs->encsize);
if (ret <= 0) {
- BIO_printf(bio_err, "RSA decrypt failure\n");
+ BIO_puts(bio_err, "RSA decrypt failure\n");
dofail();
count = -1;
break;
@@ -1262,7 +1262,7 @@ static int DSA_sign_loop(void *args)
*dsa_num = tempargs->buflen;
ret = EVP_PKEY_sign(dsa_sign_ctx[testnum], buf2, dsa_num, buf, 20);
if (ret <= 0) {
- BIO_printf(bio_err, "DSA sign failure\n");
+ BIO_puts(bio_err, "DSA sign failure\n");
dofail();
count = -1;
break;
@@ -1283,7 +1283,7 @@ static int DSA_verify_loop(void *args)
for (count = 0; COND(dsa_c[testnum][1]); count++) {
ret = EVP_PKEY_verify(dsa_verify_ctx[testnum], buf2, dsa_num, buf, 20);
if (ret <= 0) {
- BIO_printf(bio_err, "DSA verify failure\n");
+ BIO_puts(bio_err, "DSA verify failure\n");
dofail();
count = -1;
break;
@@ -1306,7 +1306,7 @@ static int ECDSA_sign_loop(void *args)
*ecdsa_num = tempargs->buflen;
ret = EVP_PKEY_sign(ecdsa_sign_ctx[testnum], buf2, ecdsa_num, buf, 20);
if (ret <= 0) {
- BIO_printf(bio_err, "ECDSA sign failure\n");
+ BIO_puts(bio_err, "ECDSA sign failure\n");
dofail();
count = -1;
break;
@@ -1328,7 +1328,7 @@ static int ECDSA_verify_loop(void *args)
ret = EVP_PKEY_verify(ecdsa_verify_ctx[testnum], buf2, ecdsa_num,
buf, 20);
if (ret <= 0) {
- BIO_printf(bio_err, "ECDSA verify failure\n");
+ BIO_puts(bio_err, "ECDSA verify failure\n");
dofail();
count = -1;
break;
@@ -1366,14 +1366,14 @@ static int EdDSA_sign_loop(void *args)
for (count = 0; COND(eddsa_c[testnum][0]); count++) {
ret = EVP_DigestSignInit(edctx[testnum], NULL, NULL, NULL, NULL);
if (ret == 0) {
- BIO_printf(bio_err, "EdDSA sign init failure\n");
+ BIO_puts(bio_err, "EdDSA sign init failure\n");
dofail();
count = -1;
break;
}
ret = EVP_DigestSign(edctx[testnum], eddsasig, eddsasigsize, buf, 20);
if (ret == 0) {
- BIO_printf(bio_err, "EdDSA sign failure\n");
+ BIO_puts(bio_err, "EdDSA sign failure\n");
dofail();
count = -1;
break;
@@ -1394,14 +1394,14 @@ static int EdDSA_verify_loop(void *args)
for (count = 0; COND(eddsa_c[testnum][1]); count++) {
ret = EVP_DigestVerifyInit(edctx[testnum], NULL, NULL, NULL, NULL);
if (ret == 0) {
- BIO_printf(bio_err, "EdDSA verify init failure\n");
+ BIO_puts(bio_err, "EdDSA verify init failure\n");
dofail();
count = -1;
break;
}
ret = EVP_DigestVerify(edctx[testnum], eddsasig, eddsasigsize, buf, 20);
if (ret != 1) {
- BIO_printf(bio_err, "EdDSA verify failure\n");
+ BIO_puts(bio_err, "EdDSA verify failure\n");
dofail();
count = -1;
break;
@@ -1428,7 +1428,7 @@ static int SM2_sign_loop(void *args)
if (!EVP_DigestSignInit(sm2ctx[testnum], NULL, EVP_sm3(),
NULL, sm2_pkey[testnum])) {
- BIO_printf(bio_err, "SM2 init sign failure\n");
+ BIO_puts(bio_err, "SM2 init sign failure\n");
dofail();
count = -1;
break;
@@ -1436,7 +1436,7 @@ static int SM2_sign_loop(void *args)
ret = EVP_DigestSign(sm2ctx[testnum], sm2sig, &sm2sigsize,
buf, 20);
if (ret == 0) {
- BIO_printf(bio_err, "SM2 sign failure\n");
+ BIO_puts(bio_err, "SM2 sign failure\n");
dofail();
count = -1;
break;
@@ -1461,7 +1461,7 @@ static int SM2_verify_loop(void *args)
for (count = 0; COND(sm2_c[testnum][1]); count++) {
if (!EVP_DigestVerifyInit(sm2ctx[testnum], NULL, EVP_sm3(),
NULL, sm2_pkey[testnum])) {
- BIO_printf(bio_err, "SM2 verify init failure\n");
+ BIO_puts(bio_err, "SM2 verify init failure\n");
dofail();
count = -1;
break;
@@ -1469,7 +1469,7 @@ static int SM2_verify_loop(void *args)
ret = EVP_DigestVerify(sm2ctx[testnum], sm2sig, sm2sigsize,
buf, 20);
if (ret != 1) {
- BIO_printf(bio_err, "SM2 verify failure\n");
+ BIO_puts(bio_err, "SM2 verify failure\n");
dofail();
count = -1;
break;
@@ -1607,7 +1607,7 @@ static int check_block_size(EVP_CIPHER_CTX *ctx, int length)
int blocksize = EVP_CIPHER_CTX_get_block_size(ctx);
if (ciph == NULL || blocksize <= 0) {
- BIO_printf(bio_err, "\nInvalid cipher!\n");
+ BIO_puts(bio_err, "\nInvalid cipher!\n");
return 0;
}
if (length % blocksize != 0) {
@@ -1653,7 +1653,7 @@ static int run_benchmark(int async_jobs,
break;
case ASYNC_NO_JOBS:
case ASYNC_ERR:
- BIO_printf(bio_err, "Failure in the job\n");
+ BIO_puts(bio_err, "Failure in the job\n");
dofail();
error = 1;
break;
@@ -1676,7 +1676,7 @@ static int run_benchmark(int async_jobs,
if (!ASYNC_WAIT_CTX_get_all_fds(loopargs[i].wait_ctx, NULL, &num_job_fds)
|| num_job_fds > 1) {
- BIO_printf(bio_err, "Too many fds in ASYNC_WAIT_CTX\n");
+ BIO_puts(bio_err, "Too many fds in ASYNC_WAIT_CTX\n");
dofail();
error = 1;
break;
@@ -1703,7 +1703,7 @@ static int run_benchmark(int async_jobs,
continue;
if (select_result == -1) {
- BIO_printf(bio_err, "Failure in the select\n");
+ BIO_puts(bio_err, "Failure in the select\n");
dofail();
error = 1;
break;
@@ -1719,7 +1719,7 @@ static int run_benchmark(int async_jobs,
if (!ASYNC_WAIT_CTX_get_all_fds(loopargs[i].wait_ctx, NULL, &num_job_fds)
|| num_job_fds > 1) {
- BIO_printf(bio_err, "Too many fds in ASYNC_WAIT_CTX\n");
+ BIO_puts(bio_err, "Too many fds in ASYNC_WAIT_CTX\n");
dofail();
error = 1;
break;
@@ -1757,7 +1757,7 @@ static int run_benchmark(int async_jobs,
case ASYNC_ERR:
--num_inprogress;
loopargs[i].inprogress_job = NULL;
- BIO_printf(bio_err, "Failure in the job\n");
+ BIO_puts(bio_err, "Failure in the job\n");
dofail();
error = 1;
break;
@@ -1782,7 +1782,7 @@ static EVP_PKEY *get_ecdsa(const EC_CURVE *curve)
/* Ensure that the error queue is empty */
if (ERR_peek_error()) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"WARNING: the error queue contains previous unhandled errors.\n");
dofail();
}
@@ -1814,7 +1814,7 @@ static EVP_PKEY *get_ecdsa(const EC_CURVE *curve)
|| ERR_GET_REASON(error) == ERR_R_UNSUPPORTED))
ERR_get_error(); /* pop error from queue */
if (ERR_peek_error()) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Unhandled error in the error queue during EC key setup.\n");
dofail();
return NULL;
@@ -1827,7 +1827,7 @@ static EVP_PKEY *get_ecdsa(const EC_CURVE *curve)
curve->nid)
<= 0
|| EVP_PKEY_paramgen(pctx, ¶ms) <= 0) {
- BIO_printf(bio_err, "EC params init failure.\n");
+ BIO_puts(bio_err, "EC params init failure.\n");
dofail();
EVP_PKEY_CTX_free(pctx);
return NULL;
@@ -1841,7 +1841,7 @@ static EVP_PKEY *get_ecdsa(const EC_CURVE *curve)
if (kctx == NULL
|| EVP_PKEY_keygen_init(kctx) <= 0
|| EVP_PKEY_keygen(kctx, &key) <= 0) {
- BIO_printf(bio_err, "EC key generation failure.\n");
+ BIO_puts(bio_err, "EC key generation failure.\n");
dofail();
key = NULL;
}
@@ -2303,7 +2303,7 @@ int speed_main(int argc, char **argv)
if (strcmp(EVP_KEM_get0_name(kem), "RSA") == 0) {
if (kems_algs_len + OSSL_NELEM(rsa_choices) >= MAX_KEM_NUM) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Too many KEMs registered. Change MAX_KEM_NUM.\n");
goto end;
}
@@ -2313,7 +2313,7 @@ int speed_main(int argc, char **argv)
}
} else if (strcmp(EVP_KEM_get0_name(kem), "EC") == 0) {
if (kems_algs_len + 3 >= MAX_KEM_NUM) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Too many KEMs registered. Change MAX_KEM_NUM.\n");
goto end;
}
@@ -2325,7 +2325,7 @@ int speed_main(int argc, char **argv)
kems_algname[kems_algs_len++] = OPENSSL_strdup("ECP-521");
} else {
if (kems_algs_len + 1 >= MAX_KEM_NUM) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Too many KEMs registered. Change MAX_KEM_NUM.\n");
goto end;
}
@@ -2348,7 +2348,7 @@ int speed_main(int argc, char **argv)
if (strcmp(sig_name, "RSA") == 0) {
if (sigs_algs_len + OSSL_NELEM(rsa_choices) >= MAX_SIG_NUM) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Too many signatures registered. Change MAX_SIG_NUM.\n");
goto end;
}
@@ -2360,7 +2360,7 @@ int speed_main(int argc, char **argv)
#ifndef OPENSSL_NO_DSA
else if (strcmp(sig_name, "DSA") == 0) {
if (sigs_algs_len + DSA_NUM >= MAX_SIG_NUM) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Too many signatures registered. Change MAX_SIG_NUM.\n");
goto end;
}
@@ -2373,7 +2373,7 @@ int speed_main(int argc, char **argv)
/* skipping these algs as tested elsewhere - and b/o setup is a pain */
else if (strncmp(sig_name, "RSA", 3) && strncmp(sig_name, "DSA", 3) && strncmp(sig_name, "ED25519", 7) && strncmp(sig_name, "ED448", 5) && strncmp(sig_name, "ECDSA", 5) && strcmp(sig_name, "HMAC") && strcmp(sig_name, "SIPHASH") && strcmp(sig_name, "POLY1305") && strcmp(sig_name, "CMAC") && strcmp(sig_name, "SM2")) { /* skip alg */
if (sigs_algs_len + 1 >= MAX_SIG_NUM) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Too many signatures registered. Change MAX_SIG_NUM.\n");
goto end;
}
@@ -2522,7 +2522,7 @@ int speed_main(int argc, char **argv)
/* Sanity checks */
if (aead) {
if (evp_cipher == NULL) {
- BIO_printf(bio_err, "-aead can be used only with an AEAD cipher\n");
+ BIO_puts(bio_err, "-aead can be used only with an AEAD cipher\n");
goto end;
} else if (!(EVP_CIPHER_get_flags(evp_cipher) & EVP_CIPH_FLAG_AEAD_CIPHER)) {
BIO_printf(bio_err, "%s is not an AEAD cipher\n",
@@ -2554,15 +2554,15 @@ int speed_main(int argc, char **argv)
}
if (multiblock) {
if (evp_cipher == NULL) {
- BIO_printf(bio_err, "-mb can be used only with a multi-block"
- " capable cipher\n");
+ BIO_puts(bio_err, "-mb can be used only with a multi-block"
+ " capable cipher\n");
goto end;
} else if (!(EVP_CIPHER_get_flags(evp_cipher) & EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)) {
BIO_printf(bio_err, "%s is not a multi-block capable\n",
EVP_CIPHER_get0_name(evp_cipher));
goto end;
} else if (async_jobs > 0) {
- BIO_printf(bio_err, "Async mode is not supported with -mb");
+ BIO_puts(bio_err, "Async mode is not supported with -mb");
goto end;
}
}
@@ -2571,7 +2571,7 @@ int speed_main(int argc, char **argv)
if (async_jobs > 0) {
async_init = ASYNC_init_thread(async_jobs, async_jobs);
if (!async_init) {
- BIO_printf(bio_err, "Error creating the ASYNC job pool\n");
+ BIO_puts(bio_err, "Error creating the ASYNC job pool\n");
goto end;
}
}
@@ -2584,7 +2584,7 @@ int speed_main(int argc, char **argv)
if (buflen < 36) /* size of random vector in RSA benchmark */
buflen = 36;
if (INT_MAX - (MAX_MISALIGNMENT + 1) < buflen) {
- BIO_printf(bio_err, "Error: buffer size too large\n");
+ BIO_puts(bio_err, "Error: buffer size too large\n");
goto end;
}
buflen += MAX_MISALIGNMENT + 1;
@@ -2592,7 +2592,7 @@ int speed_main(int argc, char **argv)
if (async_jobs > 0) {
loopargs[i].wait_ctx = ASYNC_WAIT_CTX_new();
if (loopargs[i].wait_ctx == NULL) {
- BIO_printf(bio_err, "Error creating the ASYNC_WAIT_CTX\n");
+ BIO_puts(bio_err, "Error creating the ASYNC_WAIT_CTX\n");
goto end;
}
}
@@ -2688,7 +2688,7 @@ int speed_main(int argc, char **argv)
pr_header++;
if (usertime == 0 && !mr)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"You have chosen to measure elapsed time "
"instead of user CPU time.\n");
@@ -3046,7 +3046,7 @@ int speed_main(int argc, char **argv)
for (k = 0; k < loopargs_len; k++) {
loopargs[k].ctx = EVP_CIPHER_CTX_new();
if (loopargs[k].ctx == NULL) {
- BIO_printf(bio_err, "\nEVP_CIPHER_CTX_new failure\n");
+ BIO_puts(bio_err, "\nEVP_CIPHER_CTX_new failure\n");
exit(1);
}
@@ -3058,7 +3058,7 @@ int speed_main(int argc, char **argv)
*/
if (!EVP_CipherInit_ex(loopargs[k].ctx, evp_cipher, NULL,
NULL, NULL, ae_mode ? 1 : !decrypt)) {
- BIO_printf(bio_err, "\nCouldn't init the context\n");
+ BIO_puts(bio_err, "\nCouldn't init the context\n");
dofail();
exit(1);
}
@@ -3073,7 +3073,7 @@ int speed_main(int argc, char **argv)
if (!ae_mode) {
if (!EVP_CipherInit_ex(loopargs[k].ctx, NULL, NULL,
loopargs[k].key, iv, -1)) {
- BIO_printf(bio_err, "\nFailed to set the key\n");
+ BIO_puts(bio_err, "\nFailed to set the key\n");
dofail();
exit(1);
}
@@ -3088,7 +3088,7 @@ int speed_main(int argc, char **argv)
if (!EVP_CIPHER_CTX_ctrl(loopargs[k].ctx,
EVP_CTRL_AEAD_SET_IVLEN,
sizeof(aead_iv), NULL)) {
- BIO_printf(bio_err, "\nFailed to set iv length\n");
+ BIO_puts(bio_err, "\nFailed to set iv length\n");
dofail();
exit(1);
}
@@ -3100,7 +3100,7 @@ int speed_main(int argc, char **argv)
if (!EVP_CIPHER_CTX_ctrl(loopargs[k].ctx,
EVP_CTRL_AEAD_SET_TAG,
TAG_LEN, NULL)) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"\nFailed to set tag length\n");
dofail();
exit(1);
@@ -3108,7 +3108,7 @@ int speed_main(int argc, char **argv)
}
if (!EVP_CipherInit_ex(loopargs[k].ctx, NULL, NULL,
loopargs[k].key, aead_iv, -1)) {
- BIO_printf(bio_err, "\nFailed to set the key\n");
+ BIO_puts(bio_err, "\nFailed to set the key\n");
dofail();
exit(1);
}
@@ -3117,7 +3117,7 @@ int speed_main(int argc, char **argv)
if (!EVP_EncryptUpdate(loopargs[k].ctx, NULL,
&outlen, NULL,
lengths[testnum])) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"\nCouldn't set input text length\n");
dofail();
exit(1);
@@ -3126,7 +3126,7 @@ int speed_main(int argc, char **argv)
if (aead) {
if (!EVP_EncryptUpdate(loopargs[k].ctx, NULL,
&outlen, aad, sizeof(aad))) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"\nCouldn't insert AAD when encrypting\n");
dofail();
exit(1);
@@ -3135,7 +3135,7 @@ int speed_main(int argc, char **argv)
if (!EVP_EncryptUpdate(loopargs[k].ctx, loopargs[k].buf,
&outlen, loopargs[k].buf,
lengths[testnum])) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"\nFailed to to encrypt the data\n");
dofail();
exit(1);
@@ -3143,7 +3143,7 @@ int speed_main(int argc, char **argv)
if (!EVP_EncryptFinal_ex(loopargs[k].ctx,
loopargs[k].buf, &outlen)) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"\nFailed finalize the encryption\n");
dofail();
exit(1);
@@ -3151,7 +3151,7 @@ int speed_main(int argc, char **argv)
if (!EVP_CIPHER_CTX_ctrl(loopargs[k].ctx, EVP_CTRL_AEAD_GET_TAG,
TAG_LEN, &loopargs[k].tag)) {
- BIO_printf(bio_err, "\nFailed to get the tag\n");
+ BIO_puts(bio_err, "\nFailed to get the tag\n");
dofail();
exit(1);
}
@@ -3159,7 +3159,7 @@ int speed_main(int argc, char **argv)
EVP_CIPHER_CTX_free(loopargs[k].ctx);
loopargs[k].ctx = EVP_CIPHER_CTX_new();
if (loopargs[k].ctx == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"\nEVP_CIPHER_CTX_new failure\n");
exit(1);
}
@@ -3216,7 +3216,7 @@ int speed_main(int argc, char **argv)
keylen = EVP_CIPHER_get_key_length(cipher);
EVP_CIPHER_free(cipher);
if (keylen <= 0 || keylen > (int)sizeof(key32)) {
- BIO_printf(bio_err, "\nRequested CMAC cipher with unsupported key length.\n");
+ BIO_puts(bio_err, "\nRequested CMAC cipher with unsupported key length.\n");
goto end;
}
evp_cmac_name = app_malloc(len, "CMAC name");
@@ -3331,7 +3331,7 @@ int speed_main(int argc, char **argv)
st = 0;
}
if (!st) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"RSA sign setup failure. No RSA sign will be done.\n");
dofail();
op_count = 1;
@@ -3363,7 +3363,7 @@ int speed_main(int argc, char **argv)
st = 0;
}
if (!st) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"RSA verify setup failure. No RSA verify will be done.\n");
dofail();
rsa_doit[testnum] = 0;
@@ -3393,7 +3393,7 @@ int speed_main(int argc, char **argv)
st = 0;
}
if (!st) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"RSA encrypt setup failure. No RSA encrypt will be done.\n");
dofail();
op_count = 1;
@@ -3426,7 +3426,7 @@ int speed_main(int argc, char **argv)
st = 0;
}
if (!st) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"RSA decrypt setup failure. No RSA decrypt will be done.\n");
dofail();
op_count = 1;
@@ -3476,7 +3476,7 @@ int speed_main(int argc, char **argv)
st = 0;
}
if (!st) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"DSA sign setup failure. No DSA sign will be done.\n");
dofail();
op_count = 1;
@@ -3507,7 +3507,7 @@ int speed_main(int argc, char **argv)
st = 0;
}
if (!st) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"DSA verify setup failure. No DSA verify will be done.\n");
dofail();
dsa_doit[testnum] = 0;
@@ -3555,7 +3555,7 @@ int speed_main(int argc, char **argv)
st = 0;
}
if (!st) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"ECDSA sign setup failure. No ECDSA sign will be done.\n");
dofail();
op_count = 1;
@@ -3586,7 +3586,7 @@ int speed_main(int argc, char **argv)
st = 0;
}
if (!st) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"ECDSA verify setup failure. No ECDSA verify will be done.\n");
dofail();
ecdsa_doit[testnum] = 0;
@@ -3633,7 +3633,7 @@ int speed_main(int argc, char **argv)
|| outlen == 0 /* ensure outlen is a valid size */
|| outlen > MAX_ECDH_SIZE /* avoid buffer overflow */) {
ecdh_checks = 0;
- BIO_printf(bio_err, "ECDH key generation failure.\n");
+ BIO_puts(bio_err, "ECDH key generation failure.\n");
dofail();
op_count = 1;
break;
@@ -3653,7 +3653,7 @@ int speed_main(int argc, char **argv)
|| EVP_PKEY_derive(test_ctx, loopargs[i].secret_b, &test_outlen) <= 0 /* compute b*A */
|| test_outlen != outlen /* compare output length */) {
ecdh_checks = 0;
- BIO_printf(bio_err, "ECDH computation failure.\n");
+ BIO_puts(bio_err, "ECDH computation failure.\n");
dofail();
op_count = 1;
break;
@@ -3663,7 +3663,7 @@ int speed_main(int argc, char **argv)
if (CRYPTO_memcmp(loopargs[i].secret_a,
loopargs[i].secret_b, outlen)) {
ecdh_checks = 0;
- BIO_printf(bio_err, "ECDH computations don't match.\n");
+ BIO_puts(bio_err, "ECDH computations don't match.\n");
dofail();
op_count = 1;
break;
@@ -3744,7 +3744,7 @@ int speed_main(int argc, char **argv)
ed_pkey = NULL;
}
if (st == 0) {
- BIO_printf(bio_err, "EdDSA failure.\n");
+ BIO_puts(bio_err, "EdDSA failure.\n");
dofail();
op_count = 1;
} else {
@@ -3758,7 +3758,7 @@ int speed_main(int argc, char **argv)
break;
}
if (st == 0) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"EdDSA sign failure. No EdDSA sign will be done.\n");
dofail();
op_count = 1;
@@ -3785,7 +3785,7 @@ int speed_main(int argc, char **argv)
break;
}
if (st != 1) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"EdDSA verify failure. No EdDSA verify will be done.\n");
dofail();
eddsa_doit[testnum] = 0;
@@ -3876,7 +3876,7 @@ int speed_main(int argc, char **argv)
st = 1; /* mark loop as succeeded */
}
if (st == 0) {
- BIO_printf(bio_err, "SM2 init failure.\n");
+ BIO_puts(bio_err, "SM2 init failure.\n");
dofail();
op_count = 1;
} else {
@@ -3889,7 +3889,7 @@ int speed_main(int argc, char **argv)
break;
}
if (st == 0) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"SM2 sign failure. No SM2 sign will be done.\n");
dofail();
op_count = 1;
@@ -3917,7 +3917,7 @@ int speed_main(int argc, char **argv)
break;
}
if (st != 1) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"SM2 verify failure. No SM2 verify will be done.\n");
dofail();
sm2_doit[testnum] = 0;
@@ -3961,14 +3961,14 @@ int speed_main(int argc, char **argv)
/* Ensure that the error queue is empty */
if (ERR_peek_error()) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"WARNING: the error queue contains previous unhandled errors.\n");
dofail();
}
pkey_A = EVP_PKEY_new();
if (!pkey_A) {
- BIO_printf(bio_err, "Error while initialising EVP_PKEY (out of memory?).\n");
+ BIO_puts(bio_err, "Error while initialising EVP_PKEY (out of memory?).\n");
dofail();
op_count = 1;
ffdh_checks = 0;
@@ -3976,7 +3976,7 @@ int speed_main(int argc, char **argv)
}
pkey_B = EVP_PKEY_new();
if (!pkey_B) {
- BIO_printf(bio_err, "Error while initialising EVP_PKEY (out of memory?).\n");
+ BIO_puts(bio_err, "Error while initialising EVP_PKEY (out of memory?).\n");
dofail();
op_count = 1;
ffdh_checks = 0;
@@ -3985,7 +3985,7 @@ int speed_main(int argc, char **argv)
ffdh_ctx = EVP_PKEY_CTX_new_id(EVP_PKEY_DH, NULL);
if (!ffdh_ctx) {
- BIO_printf(bio_err, "Error while allocating EVP_PKEY_CTX.\n");
+ BIO_puts(bio_err, "Error while allocating EVP_PKEY_CTX.\n");
dofail();
op_count = 1;
ffdh_checks = 0;
@@ -3993,14 +3993,14 @@ int speed_main(int argc, char **argv)
}
if (EVP_PKEY_keygen_init(ffdh_ctx) <= 0) {
- BIO_printf(bio_err, "Error while initialising EVP_PKEY_CTX.\n");
+ BIO_puts(bio_err, "Error while initialising EVP_PKEY_CTX.\n");
dofail();
op_count = 1;
ffdh_checks = 0;
break;
}
if (EVP_PKEY_CTX_set_dh_nid(ffdh_ctx, ffdh_params[testnum].nid) <= 0) {
- BIO_printf(bio_err, "Error setting DH key size for keygen.\n");
+ BIO_puts(bio_err, "Error setting DH key size for keygen.\n");
dofail();
op_count = 1;
ffdh_checks = 0;
@@ -4008,7 +4008,7 @@ int speed_main(int argc, char **argv)
}
if (EVP_PKEY_keygen(ffdh_ctx, &pkey_A) <= 0 || EVP_PKEY_keygen(ffdh_ctx, &pkey_B) <= 0) {
- BIO_printf(bio_err, "FFDH key generation failure.\n");
+ BIO_puts(bio_err, "FFDH key generation failure.\n");
dofail();
op_count = 1;
ffdh_checks = 0;
@@ -4024,35 +4024,35 @@ int speed_main(int argc, char **argv)
*/
ffdh_ctx = EVP_PKEY_CTX_new(pkey_A, NULL);
if (ffdh_ctx == NULL) {
- BIO_printf(bio_err, "Error while allocating EVP_PKEY_CTX.\n");
+ BIO_puts(bio_err, "Error while allocating EVP_PKEY_CTX.\n");
dofail();
op_count = 1;
ffdh_checks = 0;
break;
}
if (EVP_PKEY_derive_init(ffdh_ctx) <= 0) {
- BIO_printf(bio_err, "FFDH derivation context init failure.\n");
+ BIO_puts(bio_err, "FFDH derivation context init failure.\n");
dofail();
op_count = 1;
ffdh_checks = 0;
break;
}
if (EVP_PKEY_derive_set_peer(ffdh_ctx, pkey_B) <= 0) {
- BIO_printf(bio_err, "Assigning peer key for derivation failed.\n");
+ BIO_puts(bio_err, "Assigning peer key for derivation failed.\n");
dofail();
op_count = 1;
ffdh_checks = 0;
break;
}
if (EVP_PKEY_derive(ffdh_ctx, NULL, &secret_size) <= 0) {
- BIO_printf(bio_err, "Checking size of shared secret failed.\n");
+ BIO_puts(bio_err, "Checking size of shared secret failed.\n");
dofail();
op_count = 1;
ffdh_checks = 0;
break;
}
if (secret_size > MAX_FFDH_SIZE) {
- BIO_printf(bio_err, "Assertion failure: shared secret too large.\n");
+ BIO_puts(bio_err, "Assertion failure: shared secret too large.\n");
op_count = 1;
ffdh_checks = 0;
break;
@@ -4061,7 +4061,7 @@ int speed_main(int argc, char **argv)
loopargs[i].secret_ff_a,
&secret_size)
<= 0) {
- BIO_printf(bio_err, "Shared secret derive failure.\n");
+ BIO_puts(bio_err, "Shared secret derive failure.\n");
dofail();
op_count = 1;
ffdh_checks = 0;
@@ -4070,14 +4070,14 @@ int speed_main(int argc, char **argv)
/* Now check from side B */
test_ctx = EVP_PKEY_CTX_new(pkey_B, NULL);
if (!test_ctx) {
- BIO_printf(bio_err, "Error while allocating EVP_PKEY_CTX.\n");
+ BIO_puts(bio_err, "Error while allocating EVP_PKEY_CTX.\n");
dofail();
op_count = 1;
ffdh_checks = 0;
break;
}
if (EVP_PKEY_derive_init(test_ctx) <= 0 || EVP_PKEY_derive_set_peer(test_ctx, pkey_A) <= 0 || EVP_PKEY_derive(test_ctx, NULL, &test_out) <= 0 || EVP_PKEY_derive(test_ctx, loopargs[i].secret_ff_b, &test_out) <= 0 || test_out != secret_size) {
- BIO_printf(bio_err, "FFDH computation failure.\n");
+ BIO_puts(bio_err, "FFDH computation failure.\n");
op_count = 1;
ffdh_checks = 0;
break;
@@ -4086,7 +4086,7 @@ int speed_main(int argc, char **argv)
/* compare the computed secrets */
if (CRYPTO_memcmp(loopargs[i].secret_ff_a,
loopargs[i].secret_ff_b, secret_size)) {
- BIO_printf(bio_err, "FFDH computations don't match.\n");
+ BIO_puts(bio_err, "FFDH computations don't match.\n");
dofail();
op_count = 1;
ffdh_checks = 0;
@@ -4160,7 +4160,7 @@ int speed_main(int argc, char **argv)
kem_type = 0;
if (ERR_peek_error()) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"WARNING: the error queue contains previous unhandled errors.\n");
dofail();
}
@@ -4189,7 +4189,7 @@ int speed_main(int argc, char **argv)
goto kem_err_break;
}
if (EVP_PKEY_keygen(kem_gen_ctx, &pkey) <= 0) {
- BIO_printf(bio_err, "Error while generating KEM EVP_PKEY.\n");
+ BIO_puts(bio_err, "Error while generating KEM EVP_PKEY.\n");
goto kem_err_break;
}
/* Now prepare encaps data structs */
@@ -4340,7 +4340,7 @@ int speed_main(int argc, char **argv)
memset(md, 0, SHA256_DIGEST_LENGTH);
if (ERR_peek_error()) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"WARNING: the error queue contains previous unhandled errors.\n");
dofail();
}
@@ -4957,7 +4957,7 @@ static int do_multi(int multi, int size_num)
fds = app_malloc_array(multi, sizeof(*fds), "fd buffer for do_multi");
for (n = 0; n < multi; ++n) {
if (pipe(fd) == -1) {
- BIO_printf(bio_err, "pipe failure\n");
+ BIO_puts(bio_err, "pipe failure\n");
exit(1);
}
fflush(stdout);
@@ -4969,7 +4969,7 @@ static int do_multi(int multi, int size_num)
close(fd[0]);
close(1);
if (dup(fd[1]) == -1) {
- BIO_printf(bio_err, "dup failed\n");
+ BIO_puts(bio_err, "dup failed\n");
exit(1);
}
close(fd[1]);
@@ -5243,7 +5243,7 @@ static void multiblock_speed(const EVP_CIPHER *evp_cipher, int lengths_single,
d = Time_F(STOP);
BIO_printf(bio_err, mr ? "+R:%d:%s:%f\n" : "%d %s ops in %.2fs\n", count, "evp", d);
if ((ciph_success <= 0) && (mr == 0))
- BIO_printf(bio_err, "Error performing cipher op\n");
+ BIO_puts(bio_err, "Error performing cipher op\n");
results[D_EVP][j] = ((double)count) / d * mblengths[j];
}
diff --git a/apps/spkac.c b/apps/spkac.c
index d2cb68086a..65a9c05154 100644
--- a/apps/spkac.c
+++ b/apps/spkac.c
@@ -139,7 +139,7 @@ int spkac_main(int argc, char **argv)
goto opthelp;
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
goto end;
}
@@ -159,12 +159,12 @@ int spkac_main(int argc, char **argv)
challenge, (int)strlen(challenge)))
goto end;
if (!NETSCAPE_SPKI_set_pubkey(spki, pkey)) {
- BIO_printf(bio_err, "Error setting public key\n");
+ BIO_puts(bio_err, "Error setting public key\n");
goto end;
}
i = NETSCAPE_SPKI_sign(spki, pkey, md);
if (i <= 0) {
- BIO_printf(bio_err, "Error signing SPKAC\n");
+ BIO_puts(bio_err, "Error signing SPKAC\n");
goto end;
}
spkstr = NETSCAPE_SPKI_b64_encode(spki);
@@ -196,7 +196,7 @@ int spkac_main(int argc, char **argv)
spki = NETSCAPE_SPKI_b64_decode(spkstr, -1);
if (spki == NULL) {
- BIO_printf(bio_err, "Error loading SPKAC\n");
+ BIO_puts(bio_err, "Error loading SPKAC\n");
ERR_print_errors(bio_err);
goto end;
}
@@ -211,9 +211,9 @@ int spkac_main(int argc, char **argv)
if (verify) {
i = NETSCAPE_SPKI_verify(spki, pkey);
if (i > 0) {
- BIO_printf(bio_err, "Signature OK\n");
+ BIO_puts(bio_err, "Signature OK\n");
} else {
- BIO_printf(bio_err, "Signature Failure\n");
+ BIO_puts(bio_err, "Signature Failure\n");
ERR_print_errors(bio_err);
goto end;
}
diff --git a/apps/srp.c b/apps/srp.c
index 554f129ff7..97dad84eb0 100644
--- a/apps/srp.c
+++ b/apps/srp.c
@@ -101,7 +101,7 @@ static int update_index(CA_DB *db, char **row)
irow[DB_NUMBER] = NULL;
if (!TXT_DB_insert(db->db, irow)) {
- BIO_printf(bio_err, "failed to update srpvfile\n");
+ BIO_puts(bio_err, "failed to update srpvfile\n");
BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error);
OPENSSL_free(irow);
return 0;
@@ -144,7 +144,7 @@ static char *srp_verify_user(const char *user, const char *srp_verifier,
if ((gNid = SRP_create_verifier(user, password, &srp_usersalt,
&verifier, N, g))
== NULL) {
- BIO_printf(bio_err, "Internal error validating SRP verifier\n");
+ BIO_puts(bio_err, "Internal error validating SRP verifier\n");
} else {
if (strcmp(verifier, srp_verifier))
gNid = NULL;
@@ -176,7 +176,7 @@ static char *srp_create_user(char *user, char **srp_verifier,
if ((gNid = SRP_create_verifier(user, password, &salt,
srp_verifier, N, g))
== NULL) {
- BIO_printf(bio_err, "Internal error creating SRP verifier\n");
+ BIO_puts(bio_err, "Internal error creating SRP verifier\n");
} else {
*srp_usersalt = salt;
}
@@ -316,30 +316,30 @@ int srp_main(int argc, char **argv)
goto end;
if (srpvfile != NULL && configfile != NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"-srpvfile and -configfile cannot be specified together.\n");
goto end;
}
if (mode == OPT_ERR) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Exactly one of the options -add, -delete, -modify -list must be specified.\n");
goto opthelp;
}
if (mode == OPT_DELETE || mode == OPT_MODIFY || mode == OPT_ADD) {
if (argc == 0) {
- BIO_printf(bio_err, "Need at least one user.\n");
+ BIO_puts(bio_err, "Need at least one user.\n");
goto opthelp;
}
user = *argv++;
}
if ((passinarg != NULL || passoutarg != NULL) && argc != 1) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"-passin, -passout arguments only valid with one user.\n");
goto opthelp;
}
if (!app_passwd(passinarg, passoutarg, &passin, &passout)) {
- BIO_printf(bio_err, "Error getting passwords\n");
+ BIO_puts(bio_err, "Error getting passwords\n");
goto end;
}
@@ -401,7 +401,7 @@ int srp_main(int argc, char **argv)
}
if (verbose)
- BIO_printf(bio_err, "Database initialised\n");
+ BIO_puts(bio_err, "Database initialised\n");
if (gNindex >= 0) {
gNrow = sk_OPENSSL_PSTRING_value(db->db->data, gNindex);
@@ -411,12 +411,12 @@ int srp_main(int argc, char **argv)
goto end;
} else {
if (verbose)
- BIO_printf(bio_err, "Database has no g N information.\n");
+ BIO_puts(bio_err, "Database has no g N information.\n");
gNrow = NULL;
}
if (verbose > 1)
- BIO_printf(bio_err, "Starting user processing\n");
+ BIO_puts(bio_err, "Starting user processing\n");
while (mode == OPT_LIST || user != NULL) {
int userindex = -1;
@@ -428,7 +428,7 @@ int srp_main(int argc, char **argv)
if (mode == OPT_LIST) {
if (user == NULL) {
- BIO_printf(bio_err, "List all users\n");
+ BIO_puts(bio_err, "List all users\n");
for (i = 0; i < sk_OPENSSL_PSTRING_num(db->db->data); i++)
print_user(db, i, 1);
@@ -578,7 +578,7 @@ int srp_main(int argc, char **argv)
}
if (verbose)
- BIO_printf(bio_err, "User procession done.\n");
+ BIO_puts(bio_err, "User procession done.\n");
if (doupdatedb) {
/* Lets check some fields */
@@ -592,17 +592,17 @@ int srp_main(int argc, char **argv)
}
if (verbose)
- BIO_printf(bio_err, "Trying to update srpvfile.\n");
+ BIO_puts(bio_err, "Trying to update srpvfile.\n");
if (!save_index(srpvfile, "new", db))
goto end;
if (verbose)
- BIO_printf(bio_err, "Temporary srpvfile created.\n");
+ BIO_puts(bio_err, "Temporary srpvfile created.\n");
if (!rotate_index(srpvfile, "new", "old"))
goto end;
if (verbose)
- BIO_printf(bio_err, "srpvfile updated.\n");
+ BIO_puts(bio_err, "srpvfile updated.\n");
}
ret = (errors != 0);
diff --git a/apps/storeutl.c b/apps/storeutl.c
index 387cf54522..0293a7b595 100644
--- a/apps/storeutl.c
+++ b/apps/storeutl.c
@@ -310,7 +310,7 @@ int storeutl_main(int argc, char *argv[])
}
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
- BIO_printf(bio_err, "Error getting passwords\n");
+ BIO_puts(bio_err, "Error getting passwords\n");
goto end;
}
pw_cb_data.password = passin;
@@ -403,10 +403,10 @@ static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata,
if (OSSL_STORE_eof(store_ctx))
break;
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"ERROR: OSSL_STORE_load() returned NULL without "
"eof or error indications\n");
- BIO_printf(bio_err, " This is an error in the loader\n");
+ BIO_puts(bio_err, " This is an error in the loader\n");
ERR_print_errors(bio_err);
ret++;
break;
@@ -484,7 +484,7 @@ static int process(const char *uri, const UI_METHOD *uimeth, PW_CB_DATA *uidata,
/* Currently there is no universal API allowing to print smth, so no output */
break;
default:
- BIO_printf(bio_err, "!!! Unknown code\n");
+ BIO_puts(bio_err, "!!! Unknown code\n");
ret++;
break;
}
diff --git a/apps/ts.c b/apps/ts.c
index ef2c717966..3e7c9410ba 100644
--- a/apps/ts.c
+++ b/apps/ts.c
@@ -314,7 +314,7 @@ int ts_main(int argc, char **argv)
if (!opt_md(digestname, &md))
goto opthelp;
if (mode == OPT_REPLY && passin && !app_passwd(passin, NULL, &password, NULL)) {
- BIO_printf(bio_err, "Error getting password.\n");
+ BIO_puts(bio_err, "Error getting password.\n");
goto end;
}
@@ -503,7 +503,7 @@ err:
if (!ret) {
TS_REQ_free(ts_req);
ts_req = NULL;
- BIO_printf(bio_err, "could not create query\n");
+ BIO_puts(bio_err, "could not create query\n");
ERR_print_errors(bio_err);
}
TS_MSG_IMPRINT_free(msg_imprint);
@@ -588,7 +588,7 @@ static ASN1_INTEGER *create_nonce(int bits)
return nonce;
err:
- BIO_printf(bio_err, "could not create nonce\n");
+ BIO_puts(bio_err, "could not create nonce\n");
ASN1_INTEGER_free(nonce);
return NULL;
}
@@ -623,9 +623,9 @@ static int reply_command(CONF *conf, const char *section,
response = create_response(conf, section, queryfile,
passin, inkey, md, signer, chain, policy);
if (response != NULL)
- BIO_printf(bio_err, "Response has been generated.\n");
+ BIO_puts(bio_err, "Response has been generated.\n");
else
- BIO_printf(bio_err, "Response is not generated.\n");
+ BIO_puts(bio_err, "Response is not generated.\n");
}
if (response == NULL)
goto end;
@@ -936,7 +936,7 @@ static TS_VERIFY_CTX *create_verify_ctx(const char *data, const char *digest,
unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);
f |= TS_VFY_IMPRINT;
if (!TS_VERIFY_CTX_set0_imprint(ctx, hexstr, imprint_len)) {
- BIO_printf(bio_err, "invalid digest string\n");
+ BIO_puts(bio_err, "invalid digest string\n");
goto err;
}
}
@@ -988,14 +988,14 @@ static X509_STORE *create_cert_store(const char *CApath, const char *CAfile,
cert_ctx = X509_STORE_new();
if (cert_ctx == NULL) {
- BIO_printf(bio_err, "memory allocation failure\n");
+ BIO_puts(bio_err, "memory allocation failure\n");
return NULL;
}
X509_STORE_set_verify_cb(cert_ctx, verify_cb);
if (CApath != NULL) {
lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
if (lookup == NULL) {
- BIO_printf(bio_err, "memory allocation failure\n");
+ BIO_puts(bio_err, "memory allocation failure\n");
goto err;
}
if (X509_LOOKUP_add_dir(lookup, CApath, X509_FILETYPE_PEM) <= 0) {
@@ -1007,7 +1007,7 @@ static X509_STORE *create_cert_store(const char *CApath, const char *CAfile,
if (CAfile != NULL) {
lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
if (lookup == NULL) {
- BIO_printf(bio_err, "memory allocation failure\n");
+ BIO_puts(bio_err, "memory allocation failure\n");
goto err;
}
if (X509_LOOKUP_load_file_ex(lookup, CAfile, X509_FILETYPE_PEM, libctx,
@@ -1021,7 +1021,7 @@ static X509_STORE *create_cert_store(const char *CApath, const char *CAfile,
if (CAstore != NULL) {
lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_store());
if (lookup == NULL) {
- BIO_printf(bio_err, "memory allocation failure\n");
+ BIO_puts(bio_err, "memory allocation failure\n");
goto err;
}
if (X509_LOOKUP_add_store_ex(lookup, CAstore, libctx, propq) <= 0) {
diff --git a/apps/verify.c b/apps/verify.c
index c1d50ba4b7..1de7c830ca 100644
--- a/apps/verify.c
+++ b/apps/verify.c
@@ -108,7 +108,7 @@ int verify_main(int argc, char **argv)
goto end;
case OPT_HELP:
opt_help(verify_options);
- BIO_printf(bio_err, "\nRecognized certificate chain purposes:\n");
+ BIO_puts(bio_err, "\nRecognized certificate chain purposes:\n");
for (i = 0; i < X509_PURPOSE_get_count(); i++) {
X509_PURPOSE *ptmp = X509_PURPOSE_get0(i);
@@ -117,7 +117,7 @@ int verify_main(int argc, char **argv)
X509_PURPOSE_get0_name(ptmp));
}
- BIO_printf(bio_err, "Recognized certificate policy names:\n");
+ BIO_puts(bio_err, "Recognized certificate policy names:\n");
for (i = 0; i < X509_VERIFY_PARAM_get_count(); i++) {
const X509_VERIFY_PARAM *vptmp = X509_VERIFY_PARAM_get0(i);
@@ -299,7 +299,7 @@ static int check(X509_STORE *ctx, const char *file,
chain = X509_STORE_CTX_get1_chain(csc);
num_untrusted = X509_STORE_CTX_get_num_untrusted(csc);
- BIO_printf(bio_out, "Chain:\n");
+ BIO_puts(bio_out, "Chain:\n");
for (j = 0; j < sk_X509_num(chain); j++) {
X509 *cert = sk_X509_value(chain, j);
BIO_printf(bio_out, "depth=%d: ", j);
@@ -307,8 +307,8 @@ static int check(X509_STORE *ctx, const char *file,
X509_get_subject_name(cert),
0, get_nameopt());
if (j < num_untrusted)
- BIO_printf(bio_out, " (untrusted)");
- BIO_printf(bio_out, "\n");
+ BIO_puts(bio_out, " (untrusted)");
+ BIO_puts(bio_out, "\n");
}
OSSL_STACK_OF_X509_free(chain);
}
@@ -337,7 +337,7 @@ static int cb(int ok, X509_STORE_CTX *ctx)
X509_NAME_print_ex(bio_err,
X509_get_subject_name(current_cert),
0, get_nameopt());
- BIO_printf(bio_err, "\n");
+ BIO_puts(bio_err, "\n");
}
BIO_printf(bio_err, "%serror %d at %d depth lookup: %s\n",
X509_STORE_CTX_get0_parent_ctx(ctx) ? "[CRL path] " : "",
diff --git a/apps/x509.c b/apps/x509.c
index 85c87518e4..064843675c 100644
--- a/apps/x509.c
+++ b/apps/x509.c
@@ -284,7 +284,7 @@ static X509_REQ *x509_to_req(X509 *cert, int ext_copy, const char *names)
if (sk_X509_EXTENSION_num(exts) > 0) {
if (ext_copy != EXT_COPY_UNSET && ext_copy != EXT_COPY_NONE
&& !X509_REQ_add_extensions(req, exts)) {
- BIO_printf(bio_err, "Error copying extensions from certificate\n");
+ BIO_puts(bio_err, "Error copying extensions from certificate\n");
goto err;
}
}
@@ -303,7 +303,7 @@ static int self_signed(X509_STORE *ctx, X509 *cert)
int ret = 0;
if (xsc == NULL || !X509_STORE_CTX_init(xsc, ctx, cert, NULL)) {
- BIO_printf(bio_err, "Error initialising X509 store\n");
+ BIO_puts(bio_err, "Error initialising X509 store\n");
} else {
X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_CHECK_SS_SIGNATURE);
ret = X509_verify_cert(xsc) > 0;
@@ -497,7 +497,7 @@ int x509_main(int argc, char **argv)
break;
case OPT_SET_SERIAL:
if (sno != NULL) {
- BIO_printf(bio_err, "Serial number supplied twice\n");
+ BIO_puts(bio_err, "Serial number supplied twice\n");
goto opthelp;
}
if ((sno = s2i_ASN1_INTEGER(NULL, opt_arg())) == NULL)
@@ -680,24 +680,24 @@ int x509_main(int argc, char **argv)
goto opthelp;
if (preserve_dates && not_before != NULL) {
- BIO_printf(bio_err, "Cannot use -preserve_dates with -not_before option\n");
+ BIO_puts(bio_err, "Cannot use -preserve_dates with -not_before option\n");
goto err;
}
if (preserve_dates && not_after != NULL) {
- BIO_printf(bio_err, "Cannot use -preserve_dates with -not_after option\n");
+ BIO_puts(bio_err, "Cannot use -preserve_dates with -not_after option\n");
goto err;
}
if (preserve_dates && days != UNSET_DAYS) {
- BIO_printf(bio_err, "Cannot use -preserve_dates with -days option\n");
+ BIO_puts(bio_err, "Cannot use -preserve_dates with -days option\n");
goto err;
}
if (days == UNSET_DAYS)
days = DEFAULT_DAYS;
else if (not_after != NULL)
- BIO_printf(bio_err, "Warning: -not_after option overriding -days option\n");
+ BIO_puts(bio_err, "Warning: -not_after option overriding -days option\n");
if (!app_passwd(passinarg, NULL, &passin, NULL)) {
- BIO_printf(bio_err, "Error getting password\n");
+ BIO_puts(bio_err, "Error getting password\n");
goto err;
}
@@ -706,11 +706,11 @@ int x509_main(int argc, char **argv)
goto err;
if (newcert && infile != NULL) {
- BIO_printf(bio_err, "The -in option cannot be used with -new\n");
+ BIO_puts(bio_err, "The -in option cannot be used with -new\n");
goto err;
}
if (newcert && reqfile) {
- BIO_printf(bio_err, "The -req option cannot be used with -new\n");
+ BIO_puts(bio_err, "The -req option cannot be used with -new\n");
goto err;
}
if (privkeyfile != NULL) {
@@ -727,12 +727,12 @@ int x509_main(int argc, char **argv)
if (newcert) {
if (subj == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"The -new option requires a subject to be set using -subj\n");
goto err;
}
if (privkeyfile == NULL && pubkeyfile == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"The -new option requires using the -key or -force_pubkey option\n");
goto err;
}
@@ -748,11 +748,11 @@ int x509_main(int argc, char **argv)
CAkeyfile = CAfile;
if (CAfile != NULL) {
if (privkeyfile != NULL) {
- BIO_printf(bio_err, "Cannot use both -key/-signkey and -CA option\n");
+ BIO_puts(bio_err, "Cannot use both -key/-signkey and -CA option\n");
goto err;
}
} else {
-#define WARN_NO_CA(opt) BIO_printf(bio_err, \
+#define WARN_NO_CA(opt) BIO_puts(bio_err, \
"Warning: ignoring " opt " option since -CA option is not given\n");
if (CAkeyfile != NULL)
WARN_NO_CA("-CAkey");
@@ -768,7 +768,7 @@ int x509_main(int argc, char **argv)
if (extfile == NULL) {
if (extsect != NULL)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: ignoring -extensions option without -extfile\n");
} else {
X509V3_CTX ctx2;
@@ -790,13 +790,13 @@ int x509_main(int argc, char **argv)
}
if (multi && (reqfile || newcert)) {
- BIO_printf(bio_err, "Error: -multi cannot be used with -req or -new\n");
+ BIO_puts(bio_err, "Error: -multi cannot be used with -req or -new\n");
goto err;
}
if (reqfile) {
if (infile == NULL && isatty(fileno_stdin()))
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: Reading cert request from stdin since no -in option is given\n");
req = load_csr_autofmt(infile, informat, vfyopts,
"certificate request input");
@@ -804,28 +804,28 @@ int x509_main(int argc, char **argv)
goto err;
if ((pkey = X509_REQ_get0_pubkey(req)) == NULL) {
- BIO_printf(bio_err, "Error unpacking public key from CSR\n");
+ BIO_puts(bio_err, "Error unpacking public key from CSR\n");
goto err;
}
i = do_X509_REQ_verify(req, pkey, vfyopts);
if (i <= 0) {
- BIO_printf(bio_err, i < 0 ? "Error while verifying certificate request self-signature\n" : "Certificate request self-signature did not match the contents\n");
+ BIO_puts(bio_err, i < 0 ? "Error while verifying certificate request self-signature\n" : "Certificate request self-signature did not match the contents\n");
goto err;
}
- BIO_printf(bio_err, "Certificate request self-signature ok\n");
+ BIO_puts(bio_err, "Certificate request self-signature ok\n");
print_name(bio_err, "subject=", X509_REQ_get_subject_name(req));
} else if (!x509toreq && ext_copy != EXT_COPY_UNSET) {
- BIO_printf(bio_err, "Warning: ignoring -copy_extensions since neither -x509toreq nor -req is given\n");
+ BIO_puts(bio_err, "Warning: ignoring -copy_extensions since neither -x509toreq nor -req is given\n");
}
if (reqfile || newcert) {
if (preserve_dates)
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: ignoring -preserve_dates option with -req or -new\n");
preserve_dates = 0;
if (privkeyfile == NULL && CAkeyfile == NULL) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"We need a private key to sign with, use -key or -CAkey or -CA with private key\n");
goto err;
}
@@ -838,16 +838,16 @@ int x509_main(int argc, char **argv)
}
if (req != NULL && ext_copy != EXT_COPY_UNSET) {
if (clrext && ext_copy != EXT_COPY_NONE) {
- BIO_printf(bio_err, "Must not use -clrext together with -copy_extensions\n");
+ BIO_puts(bio_err, "Must not use -clrext together with -copy_extensions\n");
goto err;
} else if (!copy_extensions(x, req, ext_copy)) {
- BIO_printf(bio_err, "Error copying extensions from request\n");
+ BIO_puts(bio_err, "Error copying extensions from request\n");
goto err;
}
}
} else {
if (infile == NULL && isatty(fileno_stdin()))
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: Reading certificate(s) from stdin since no -in or -new option is given\n");
if (multi) {
certs = sk_X509_new_null();
@@ -905,7 +905,7 @@ cert_loop:
}
if (clrext && ext_names != NULL)
- BIO_printf(bio_err, "Warning: Ignoring -ext since -clrext is given\n");
+ BIO_puts(bio_err, "Warning: Ignoring -ext since -clrext is given\n");
for (i = X509_get_ext_count(x) - 1; i >= 0; i--) {
X509_EXTENSION *ex = X509_get_ext(x, i);
const char *sn = OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(ex)));
@@ -925,7 +925,7 @@ cert_loop:
goto err;
} else {
if (privkey != NULL && !cert_matches_key(x, privkey))
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Warning: Signature key and public key of cert do not match\n");
}
@@ -963,17 +963,17 @@ cert_loop:
pkey = X509_get0_pubkey(x);
if ((print_pubkey != 0 || modulus != 0) && pkey == NULL) {
- BIO_printf(bio_err, "Error getting public key\n");
+ BIO_puts(bio_err, "Error getting public key\n");
goto err;
}
if (x509toreq) { /* also works in conjunction with -req */
if (privkey == NULL) {
- BIO_printf(bio_err, "Must specify request signing key using -key\n");
+ BIO_puts(bio_err, "Must specify request signing key using -key\n");
goto err;
}
if (clrext && ext_copy != EXT_COPY_NONE) {
- BIO_printf(bio_err, "Must not use -clrext together with -copy_extensions\n");
+ BIO_puts(bio_err, "Must not use -clrext together with -copy_extensions\n");
goto err;
}
if ((rq = x509_to_req(x, ext_copy, ext_names)) == NULL)
@@ -996,7 +996,7 @@ cert_loop:
i = PEM_write_bio_X509_REQ(out, rq);
}
if (!i) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"Unable to write certificate request\n");
goto err;
}
@@ -1008,7 +1008,7 @@ cert_loop:
== NULL)
goto err;
if (!X509_check_private_key(xca, CAkey)) {
- BIO_printf(bio_err,
+ BIO_puts(bio_err,
"CA certificate and CA private key do not match\n");
goto err;
}
@@ -1033,9 +1033,9 @@ cert_loop:
} else if (i == subject) {
print_name(out, "subject=", X509_get_subject_name(x));
} else if (i == serial) {
- BIO_printf(out, "serial=");
+ BIO_puts(out, "serial=");
i2a_ASN1_INTEGER(out, X509_get0_serialNumber(x));
- BIO_printf(out, "\n");
+ BIO_puts(out, "\n");
} else if (i == next_serial) {
ASN1_INTEGER *ser;
BIGNUM *bnser = ASN1_INTEGER_to_BN(X509_get0_serialNumber(x), NULL);
@@ -1077,11 +1077,11 @@ cert_loop:
BIO_printf(out, "%08lx\n", X509_issuer_name_hash_old(x));
#endif
} else if (i == pprint) {
- BIO_printf(out, "Certificate purposes:\n");
+ BIO_puts(out, "Certificate purposes:\n");
for (j = 0; j < X509_PURPOSE_get_count(); j++)
purpose_print(out, x, X509_PURPOSE_get0(j));
} else if (i == modulus) {
- BIO_printf(out, "Modulus=");
+ BIO_puts(out, "Modulus=");
if (EVP_PKEY_is_a(pkey, "RSA") || EVP_PKEY_is_a(pkey, "RSA-PSS")) {
BIGNUM *n = NULL;
@@ -1097,9 +1097,9 @@ cert_loop:
BN_print(out, dsapub);
BN_free(dsapub);
} else {
- BIO_printf(out, "No modulus for this public key type");
+ BIO_puts(out, "No modulus for this public key type");
}
- BIO_printf(out, "\n");
+ BIO_puts(out, "\n");
} else if (i == print_pubkey) {
PEM_write_bio_PUBKEY(out, pkey);
} else if (i == text) {
@@ -1125,13 +1125,13 @@ cert_loop:
if ((fdig = EVP_MD_fetch(app_get0_libctx(), fdigname,
app_get0_propq()))
== NULL) {
- BIO_printf(bio_err, "Unknown digest\n");
+ BIO_puts(bio_err, "Unknown digest\n");
goto err;
}
digres = X509_digest(x, fdig, md, &n);
EVP_MD_free(fdig);
if (!digres) {
- BIO_printf(bio_err, "Out of memory\n");
+ BIO_puts(bio_err, "Out of memory\n");
goto err;
}
@@ -1152,7 +1152,7 @@ cert_loop:
int error, valid;
if ((vpm = X509_VERIFY_PARAM_new()) == NULL) {
- BIO_printf(out, "Malloc failed\n");
+ BIO_puts(out, "Malloc failed\n");
goto end_cert_loop;
}
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_USE_CHECK_TIME);
@@ -1166,10 +1166,10 @@ cert_loop:
BIO_printf(out, "%s\n", msg);
}
if (error == X509_V_ERR_CERT_HAS_EXPIRED) {
- BIO_printf(out, "Certificate will expire\n");
+ BIO_puts(out, "Certificate will expire\n");
expired = 1;
} else {
- BIO_printf(out, "Certificate will not expire\n");
+ BIO_puts(out, "Certificate will not expire\n");
}
if (multi && k > 0)
ret |= expired;
@@ -1199,11 +1199,11 @@ cert_loop:
else
i = PEM_write_bio_X509(out, x);
} else {
- BIO_printf(bio_err, "Bad output format specified for outfile\n");
+ BIO_puts(bio_err, "Bad output format specified for outfile\n");
goto err;
}
if (!i) {
- BIO_printf(bio_err, "Unable to write certificate\n");
+ BIO_puts(bio_err, "Unable to write certificate\n");
goto err;
}
@@ -1267,7 +1267,7 @@ static ASN1_INTEGER *x509_load_serial(const char *CAfile,
goto end;
if (!BN_add_word(serial, 1)) {
- BIO_printf(bio_err, "Serial number increment failure\n");
+ BIO_puts(bio_err, "Serial number increment failure\n");
goto end;
}
@@ -1318,9 +1318,9 @@ static int purpose_print(BIO *bio, X509 *cert, X509_PURPOSE *pt)
idret = X509_check_purpose(cert, id, i);
BIO_printf(bio, "%s%s : ", pname, i ? " CA" : "");
if (idret == 1)
- BIO_printf(bio, "Yes\n");
+ BIO_puts(bio, "Yes\n");
else if (idret == 0)
- BIO_printf(bio, "No\n");
+ BIO_puts(bio, "No\n");
else
BIO_printf(bio, "Yes (WARNING code=%d)\n", idret);
}
@@ -1366,7 +1366,7 @@ static int print_x509v3_exts(BIO *bio, X509 *x, const char *ext_names)
exts = X509_get0_extensions(x);
if ((num = sk_X509_EXTENSION_num(exts)) <= 0) {
- BIO_printf(bio_err, "No extensions in certificate\n");
+ BIO_puts(bio_err, "No extensions in certificate\n");
ret = 1;
goto end;
}