Use bio_err not stderr in apps.
Except for VMS startup code. Reviewed-by: Richard Levitte <levitte@openssl.org>
This commit is contained in:
@@ -264,10 +264,9 @@ static void lock_dbg_cb(int mode, int type, const char *file, int line)
|
|||||||
|
|
||||||
err:
|
err:
|
||||||
if (errstr) {
|
if (errstr) {
|
||||||
/* we cannot use bio_err here */
|
BIO_printf(bio_err,
|
||||||
fprintf(stderr,
|
"openssl (lock_dbg_cb): %s (mode=%d, type=%d) at %s:%d\n",
|
||||||
"openssl (lock_dbg_cb): %s (mode=%d, type=%d) at %s:%d\n",
|
errstr, mode, type, file, line);
|
||||||
errstr, mode, type, file, line);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,6 +347,12 @@ int main(int argc, char *argv[])
|
|||||||
arg.argv = NULL;
|
arg.argv = NULL;
|
||||||
arg.size = 0;
|
arg.size = 0;
|
||||||
|
|
||||||
|
/* Set up some of the environment. */
|
||||||
|
default_config_file = make_config_name();
|
||||||
|
bio_in = dup_bio_in();
|
||||||
|
bio_out = dup_bio_out();
|
||||||
|
bio_err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);
|
||||||
|
|
||||||
#if defined( OPENSSL_SYS_VMS)
|
#if defined( OPENSSL_SYS_VMS)
|
||||||
copied_argv = argv = copy_argv(&argc, argv);
|
copied_argv = argv = copy_argv(&argc, argv);
|
||||||
#endif
|
#endif
|
||||||
@@ -369,12 +374,12 @@ int main(int argc, char *argv[])
|
|||||||
#ifdef OPENSSL_FIPS
|
#ifdef OPENSSL_FIPS
|
||||||
if (!FIPS_mode_set(1)) {
|
if (!FIPS_mode_set(1)) {
|
||||||
ERR_load_crypto_strings();
|
ERR_load_crypto_strings();
|
||||||
ERR_print_errors(BIO_new_fp(stderr, BIO_NOCLOSE));
|
ERR_print_errors(bio_err);
|
||||||
EXIT(1);
|
return 1;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
fprintf(stderr, "FIPS mode not supported.\n");
|
BIO_printf(bio_err, "FIPS mode not supported.\n");
|
||||||
EXIT(1);
|
return 1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,12 +398,6 @@ int main(int argc, char *argv[])
|
|||||||
prog = prog_init();
|
prog = prog_init();
|
||||||
pname = opt_progname(argv[0]);
|
pname = opt_progname(argv[0]);
|
||||||
|
|
||||||
/* Lets load up our environment a little */
|
|
||||||
default_config_file = make_config_name();
|
|
||||||
bio_in = dup_bio_in();
|
|
||||||
bio_out = dup_bio_out();
|
|
||||||
bio_err = BIO_new_fp(stderr, BIO_NOCLOSE | BIO_FP_TEXT);
|
|
||||||
|
|
||||||
/* first check the program name */
|
/* first check the program name */
|
||||||
f.name = pname;
|
f.name = pname;
|
||||||
fp = lh_FUNCTION_retrieve(prog, &f);
|
fp = lh_FUNCTION_retrieve(prog, &f);
|
||||||
|
@@ -496,7 +496,7 @@ static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p,
|
|||||||
|
|
||||||
int passwd_main(int argc, char **argv)
|
int passwd_main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
fputs("Program not available.\n", stderr)
|
BIO_printf(bio_err, "Program not available.\n");
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -931,8 +931,9 @@ static int set_cert_cb(SSL *ssl, void *arg)
|
|||||||
static int retry_cnt;
|
static int retry_cnt;
|
||||||
if (retry_cnt < 5) {
|
if (retry_cnt < 5) {
|
||||||
retry_cnt++;
|
retry_cnt++;
|
||||||
fprintf(stderr, "Certificate callback retry test: count %d\n",
|
BIO_printf(bio_err,
|
||||||
retry_cnt);
|
"Certificate callback retry test: count %d\n",
|
||||||
|
retry_cnt);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -2376,8 +2376,8 @@ static int init_ssl_connection(SSL *con)
|
|||||||
{
|
{
|
||||||
while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP
|
while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP
|
||||||
&& SSL_state(con) == SSL3_ST_SR_CLNT_HELLO_C) {
|
&& SSL_state(con) == SSL3_ST_SR_CLNT_HELLO_C) {
|
||||||
fprintf(stderr,
|
BIO_printf(bio_err,
|
||||||
"LOOKUP from certificate callback during accept\n");
|
"LOOKUP from certificate callback during accept\n");
|
||||||
i = SSL_accept(con);
|
i = SSL_accept(con);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2811,10 +2811,10 @@ static int www_body(char *hostname, int s, int stype, unsigned char *context)
|
|||||||
|
|
||||||
#ifdef RENEG
|
#ifdef RENEG
|
||||||
total_bytes += i;
|
total_bytes += i;
|
||||||
fprintf(stderr, "%d\n", i);
|
BIO_printf(bio_err, "%d\n", i);
|
||||||
if (total_bytes > 3 * 1024) {
|
if (total_bytes > 3 * 1024) {
|
||||||
total_bytes = 0;
|
total_bytes = 0;
|
||||||
fprintf(stderr, "RENEGOTIATE\n");
|
BIO_printf(bio_err, "RENEGOTIATE\n");
|
||||||
SSL_renegotiate(con);
|
SSL_renegotiate(con);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@@ -539,8 +539,7 @@ static int do_accept(int acc_sock, int *sock, char **host)
|
|||||||
*/
|
*/
|
||||||
goto redoit;
|
goto redoit;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "errno=%d ", errno);
|
BIO_printf(bio_err, "accept errno=%d, %s\n", errno, strerror(errno));
|
||||||
perror("accept");
|
|
||||||
# endif
|
# endif
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@@ -597,8 +596,7 @@ static int do_accept_unix(int acc_sock, int *sock)
|
|||||||
*/
|
*/
|
||||||
goto redoit;
|
goto redoit;
|
||||||
}
|
}
|
||||||
fprintf(stderr, "errno=%d ", errno);
|
BIO_printf(bio_err, "accept errno=%d, %s\n", errno, strerror(errno));
|
||||||
perror("accept");
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -238,7 +238,7 @@ int s_time_main(int argc, char **argv)
|
|||||||
if (cipher == NULL)
|
if (cipher == NULL)
|
||||||
cipher = getenv("SSL_CIPHER");
|
cipher = getenv("SSL_CIPHER");
|
||||||
if (cipher == NULL) {
|
if (cipher == NULL) {
|
||||||
fprintf(stderr, "No CIPHER specified\n");
|
BIO_printf(bio_err, "No CIPHER specified\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ int s_time_main(int argc, char **argv)
|
|||||||
|
|
||||||
/* Get an SSL object so we can reuse the session id */
|
/* Get an SSL object so we can reuse the session id */
|
||||||
if ((scon = doConnection(NULL, host, ctx)) == NULL) {
|
if ((scon = doConnection(NULL, host, ctx)) == NULL) {
|
||||||
fprintf(stderr, "Unable to get connection\n");
|
BIO_printf(bio_err, "Unable to get connection\n");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
12
apps/speed.c
12
apps/speed.c
@@ -1649,7 +1649,7 @@ int speed_main(int argc, char **argv)
|
|||||||
if (!
|
if (!
|
||||||
(EVP_CIPHER_flags(evp_cipher) &
|
(EVP_CIPHER_flags(evp_cipher) &
|
||||||
EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)) {
|
EVP_CIPH_FLAG_TLS1_1_MULTIBLOCK)) {
|
||||||
fprintf(stderr, "%s is not multi-block capable\n",
|
BIO_printf(bio_err, "%s is not multi-block capable\n",
|
||||||
OBJ_nid2ln(evp_cipher->nid));
|
OBJ_nid2ln(evp_cipher->nid));
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@@ -2290,11 +2290,11 @@ static int do_multi(int multi)
|
|||||||
fds = malloc(sizeof(*fds) * multi);
|
fds = malloc(sizeof(*fds) * multi);
|
||||||
for (n = 0; n < multi; ++n) {
|
for (n = 0; n < multi; ++n) {
|
||||||
if (pipe(fd) == -1) {
|
if (pipe(fd) == -1) {
|
||||||
fprintf(stderr, "pipe failure\n");
|
BIO_printf(bio_err, "pipe failure\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
fflush(stderr);
|
(void)BIO_flush(bio_err);
|
||||||
if (fork()) {
|
if (fork()) {
|
||||||
close(fd[1]);
|
close(fd[1]);
|
||||||
fds[n] = fd[0];
|
fds[n] = fd[0];
|
||||||
@@ -2302,7 +2302,7 @@ static int do_multi(int multi)
|
|||||||
close(fd[0]);
|
close(fd[0]);
|
||||||
close(1);
|
close(1);
|
||||||
if (dup(fd[1]) == -1) {
|
if (dup(fd[1]) == -1) {
|
||||||
fprintf(stderr, "dup failed\n");
|
BIO_printf(bio_err, "dup failed\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
close(fd[1]);
|
close(fd[1]);
|
||||||
@@ -2326,7 +2326,7 @@ static int do_multi(int multi)
|
|||||||
if (p)
|
if (p)
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
if (buf[0] != '+') {
|
if (buf[0] != '+') {
|
||||||
fprintf(stderr, "Don't understand line '%s' from child %d\n",
|
BIO_printf(bio_err, "Don't understand line '%s' from child %d\n",
|
||||||
buf, n);
|
buf, n);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -2428,7 +2428,7 @@ static int do_multi(int multi)
|
|||||||
else if (strncmp(buf, "+H:", 3) == 0) {
|
else if (strncmp(buf, "+H:", 3) == 0) {
|
||||||
;
|
;
|
||||||
} else
|
} else
|
||||||
fprintf(stderr, "Unknown type '%s' from child %d\n", buf, n);
|
BIO_printf(bio_err, "Unknown type '%s' from child %d\n", buf, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
Reference in New Issue
Block a user