summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2022-12-02 18:31:41 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2022-12-02 18:31:41 +0000
commit6f578676a632294cbbe4b7f31bc9f60b436c2d6c (patch)
tree9a07749b9a042600d1344bd962ac859df436d0da /regress
parent594ddd5ca4e2875e65d584d94b2772e0dd5f93c2 (diff)
bn_mod_exp.c: printing to stdout needs no BIO
Diffstat (limited to 'regress')
-rw-r--r--regress/lib/libcrypto/bn/bn_mod_exp.c26
1 files changed, 9 insertions, 17 deletions
diff --git a/regress/lib/libcrypto/bn/bn_mod_exp.c b/regress/lib/libcrypto/bn/bn_mod_exp.c
index 591d6031823..236851bc759 100644
--- a/regress/lib/libcrypto/bn/bn_mod_exp.c
+++ b/regress/lib/libcrypto/bn/bn_mod_exp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bn_mod_exp.c,v 1.4 2022/12/02 18:24:01 tb Exp $ */
+/* $OpenBSD: bn_mod_exp.c,v 1.5 2022/12/02 18:31:40 tb Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -60,7 +60,6 @@
#include <stdlib.h>
#include <string.h>
-#include <openssl/bio.h>
#include <openssl/bn.h>
#include <openssl/err.h>
@@ -74,7 +73,6 @@ main(int argc, char *argv[])
BIGNUM *r_mont, *r_mont_const, *r_recp, *r_simple;
BIGNUM *r_mont_ct, *r_mont_nonct, *a, *b, *m;
BN_CTX *ctx;
- BIO *out = NULL;
unsigned char c;
int i, ret;
@@ -104,10 +102,6 @@ main(int argc, char *argv[])
if ((m = BN_CTX_get(ctx)) == NULL)
goto err;
- if ((out = BIO_new(BIO_s_file())) == NULL)
- exit(1);
- BIO_set_fp(out, stdout, BIO_NOCLOSE);
-
for (i = 0; i < 200; i++) {
arc4random_buf(&c, 1);
c = (c % BN_BITS) - BN_BITS2;
@@ -180,19 +174,19 @@ main(int argc, char *argv[])
printf("\nmont_ct and mont_nonct results differ\n");
printf("a (%3d) = ", BN_num_bits(a));
- BN_print(out, a);
+ BN_print_fp(stdout, a);
printf("\nb (%3d) = ", BN_num_bits(b));
- BN_print(out, b);
+ BN_print_fp(stdout, b);
printf("\nm (%3d) = ", BN_num_bits(m));
- BN_print(out, m);
+ BN_print_fp(stdout, m);
printf("\nsimple =");
- BN_print(out, r_simple);
+ BN_print_fp(stdout, r_simple);
printf("\nrecp =");
- BN_print(out, r_recp);
+ BN_print_fp(stdout, r_recp);
printf("\nmont =");
- BN_print(out, r_mont);
+ BN_print_fp(stdout, r_mont);
printf("\nmont_ct =");
- BN_print(out, r_mont_const);
+ BN_print_fp(stdout, r_mont_const);
printf("\n");
exit(1);
}
@@ -201,13 +195,11 @@ main(int argc, char *argv[])
BN_CTX_end(ctx);
BN_CTX_free(ctx);
ERR_remove_thread_state(NULL);
- CRYPTO_mem_leaks(out);
- BIO_free(out);
return (0);
err:
ERR_load_crypto_strings();
- ERR_print_errors(out);
+ ERR_print_errors_fp(stdout);
return (1);
}