aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/dsa/dsatest.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2014-10-28 22:56:18 +0000
committerMatt Caswell <matt@openssl.org>2014-12-08 21:40:41 +0000
commitc0d439019460def565bb115ecef749833eb4c299 (patch)
tree21f17f74c59d2da829b7a07f257ae6e7729cec1c /crypto/dsa/dsatest.c
parent829ccf6ab6aab03a3f60f644027b43a5d2035bf8 (diff)
downloadopenssl-c0d439019460def565bb115ecef749833eb4c299.tar.gz
Implement internally opaque bn access from dsa
Reviewed-by: Tim Hudson <tjh@openssl.org>
Diffstat (limited to 'crypto/dsa/dsatest.c')
-rw-r--r--crypto/dsa/dsatest.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/crypto/dsa/dsatest.c b/crypto/dsa/dsatest.c
index edffd24e6b..271a8e0d0f 100644
--- a/crypto/dsa/dsatest.c
+++ b/crypto/dsa/dsatest.c
@@ -136,7 +136,7 @@ static BIO *bio_err=NULL;
int main(int argc, char **argv)
{
- BN_GENCB cb;
+ BN_GENCB *cb;
DSA *dsa=NULL;
int counter,ret=0,i,j;
unsigned char buf[256];
@@ -156,9 +156,12 @@ int main(int argc, char **argv)
BIO_printf(bio_err,"test generation of DSA parameters\n");
- BN_GENCB_set(&cb, dsa_cb, bio_err);
+ cb = BN_GENCB_new();
+ if(!cb) goto end;
+
+ BN_GENCB_set(cb, dsa_cb, bio_err);
if(((dsa = DSA_new()) == NULL) || !DSA_generate_parameters_ex(dsa, 512,
- seed, 20, &counter, &h, &cb))
+ seed, 20, &counter, &h, cb))
goto end;
BIO_printf(bio_err,"seed\n");
@@ -221,6 +224,7 @@ end:
if (!ret)
ERR_print_errors(bio_err);
if (dsa != NULL) DSA_free(dsa);
+ if (cb != NULL) BN_GENCB_free(cb);
CRYPTO_cleanup_all_ex_data();
ERR_remove_thread_state(NULL);
ERR_free_strings();
@@ -246,8 +250,8 @@ static int MS_CALLBACK dsa_cb(int p, int n, BN_GENCB *arg)
if (p == 1) c='+';
if (p == 2) { c='*'; ok++; }
if (p == 3) c='\n';
- BIO_write(arg->arg,&c,1);
- (void)BIO_flush(arg->arg);
+ BIO_write(BN_GENCB_get_arg(arg),&c,1);
+ (void)BIO_flush(BN_GENCB_get_arg(arg));
if (!ok && (p == 0) && (num > 1))
{