diff options
author | Theo Buehler <tb@cvs.openbsd.org> | 2021-11-30 18:12:45 +0000 |
---|---|---|
committer | Theo Buehler <tb@cvs.openbsd.org> | 2021-11-30 18:12:45 +0000 |
commit | bd34e0c7c0e56c9aaebe6315e2e306baf65f86d4 (patch) | |
tree | b62a52b91935ec6f4061195306919b67a85c671b /sbin/isakmpd | |
parent | 91a1dde30e87ebbe3fd943076765cbee2b109da9 (diff) |
isakmpd: convert modp_init() for opaque DH.
ok jsing
Diffstat (limited to 'sbin/isakmpd')
-rw-r--r-- | sbin/isakmpd/dh.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/sbin/isakmpd/dh.c b/sbin/isakmpd/dh.c index ca5f45b632b..9ec422dd9c7 100644 --- a/sbin/isakmpd/dh.c +++ b/sbin/isakmpd/dh.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh.c,v 1.23 2021/11/29 06:42:13 deraadt Exp $ */ +/* $OpenBSD: dh.c,v 1.24 2021/11/30 18:12:44 tb Exp $ */ /* * Copyright (c) 2010-2014 Reyk Floeter <reyk@openbsd.org> @@ -335,14 +335,24 @@ int modp_init(struct group *group) { DH *dh; + BIGNUM *p = NULL, *g = NULL; if ((dh = DH_new()) == NULL) return (-1); group->dh = dh; - if (!BN_hex2bn(&dh->p, group->spec->prime) || - !BN_hex2bn(&dh->g, group->spec->generator)) + if (!BN_hex2bn(&p, group->spec->prime) || + !BN_hex2bn(&g, group->spec->generator)) { + BN_free(p); + BN_free(g); return (-1); + } + + if (!DH_set0_pqg(dh, p, NULL, g)) { + BN_free(p); + BN_free(g); + return (-1); + } return (0); } |