Except for VMS startup code.
Reviewed-by: Richard Levitte <levitte@openssl.org>
err:
if (errstr) {
- /* we cannot use bio_err here */
- fprintf(stderr,
- "openssl (lock_dbg_cb): %s (mode=%d, type=%d) at %s:%d\n",
- errstr, mode, type, file, line);
+ BIO_printf(bio_err,
+ "openssl (lock_dbg_cb): %s (mode=%d, type=%d) at %s:%d\n",
+ errstr, mode, type, file, line);
}
}
arg.argv = NULL;
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)
copied_argv = argv = copy_argv(&argc, argv);
#endif
#ifdef OPENSSL_FIPS
if (!FIPS_mode_set(1)) {
ERR_load_crypto_strings();
- ERR_print_errors(BIO_new_fp(stderr, BIO_NOCLOSE));
- EXIT(1);
+ ERR_print_errors(bio_err);
+ return 1;
}
#else
- fprintf(stderr, "FIPS mode not supported.\n");
- EXIT(1);
+ BIO_printf(bio_err, "FIPS mode not supported.\n");
+ return 1;
#endif
}
prog = prog_init();
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 */
f.name = pname;
fp = lh_FUNCTION_retrieve(prog, &f);
int passwd_main(int argc, char **argv)
{
- fputs("Program not available.\n", stderr)
- return (1);
+ BIO_printf(bio_err, "Program not available.\n");
+ return (1);
}
#endif
static int retry_cnt;
if (retry_cnt < 5) {
retry_cnt++;
- fprintf(stderr, "Certificate callback retry test: count %d\n",
- retry_cnt);
+ BIO_printf(bio_err,
+ "Certificate callback retry test: count %d\n",
+ retry_cnt);
return -1;
}
#endif
{
while (i <= 0 && SSL_get_error(con, i) == SSL_ERROR_WANT_X509_LOOKUP
&& SSL_state(con) == SSL3_ST_SR_CLNT_HELLO_C) {
- fprintf(stderr,
- "LOOKUP from certificate callback during accept\n");
+ BIO_printf(bio_err,
+ "LOOKUP from certificate callback during accept\n");
i = SSL_accept(con);
}
}
#ifdef RENEG
total_bytes += i;
- fprintf(stderr, "%d\n", i);
+ BIO_printf(bio_err, "%d\n", i);
if (total_bytes > 3 * 1024) {
total_bytes = 0;
- fprintf(stderr, "RENEGOTIATE\n");
+ BIO_printf(bio_err, "RENEGOTIATE\n");
SSL_renegotiate(con);
}
#endif
*/
goto redoit;
}
- fprintf(stderr, "errno=%d ", errno);
- perror("accept");
+ BIO_printf(bio_err, "accept errno=%d, %s\n", errno, strerror(errno));
# endif
return (0);
}
*/
goto redoit;
}
- fprintf(stderr, "errno=%d ", errno);
- perror("accept");
+ BIO_printf(bio_err, "accept errno=%d, %s\n", errno, strerror(errno));
return (0);
}
if (cipher == NULL)
cipher = getenv("SSL_CIPHER");
if (cipher == NULL) {
- fprintf(stderr, "No CIPHER specified\n");
+ BIO_printf(bio_err, "No CIPHER specified\n");
goto end;
}
/* Get an SSL object so we can reuse the session id */
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;
}
if (!
(EVP_CIPHER_flags(evp_cipher) &
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));
goto end;
}
fds = malloc(sizeof(*fds) * multi);
for (n = 0; n < multi; ++n) {
if (pipe(fd) == -1) {
- fprintf(stderr, "pipe failure\n");
+ BIO_printf(bio_err, "pipe failure\n");
exit(1);
}
fflush(stdout);
- fflush(stderr);
+ (void)BIO_flush(bio_err);
if (fork()) {
close(fd[1]);
fds[n] = fd[0];
close(fd[0]);
close(1);
if (dup(fd[1]) == -1) {
- fprintf(stderr, "dup failed\n");
+ BIO_printf(bio_err, "dup failed\n");
exit(1);
}
close(fd[1]);
if (p)
*p = '\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);
continue;
}
else if (strncmp(buf, "+H:", 3) == 0) {
;
} 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);