Rework dhtest to use accessors and link statically for now
authortb <tb@openbsd.org>
Wed, 12 Jan 2022 08:58:12 +0000 (08:58 +0000)
committertb <tb@openbsd.org>
Wed, 12 Jan 2022 08:58:12 +0000 (08:58 +0000)
For some reason CVS didn't want to commit this the first time around.

regress/lib/libcrypto/dh/dhtest.c

index 0b2cb74..ee06259 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: dhtest.c,v 1.6 2021/11/18 15:07:28 tb Exp $   */
+/*     $OpenBSD: dhtest.c,v 1.7 2022/01/12 08:58:12 tb Exp $   */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -129,23 +129,23 @@ main(int argc, char *argv[])
                BIO_puts(out, "the g value is not a generator\n");
 
        BIO_puts(out, "\np    =");
-       BN_print(out, a->p);
+       BN_print(out, DH_get0_p(a));
        BIO_puts(out, "\ng    =");
-       BN_print(out, a->g);
+       BN_print(out, DH_get0_g(a));
        BIO_puts(out, "\n");
 
        if (!DH_generate_key(a))
                goto err;
        BIO_puts(out, "pri 1=");
-       BN_print(out, a->priv_key);
+       BN_print(out, DH_get0_priv_key(a));
        BIO_puts(out, "\npub 1=");
-       BN_print(out, a->pub_key);
+       BN_print(out, DH_get0_pub_key(a));
        BIO_puts(out, "\n");
 
        alen = DH_size(a);
        if ((abuf = malloc(alen)) == NULL)
                err(1, "malloc");
-       aout = DH_compute_key(abuf, a->pub_key, a);
+       aout = DH_compute_key(abuf, DH_get0_pub_key(a), a);
 
        BIO_puts(out, "key1 =");
        for (i=0; i<aout; i++) {