summaryrefslogtreecommitdiff
path: root/dh.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2002-01-22 23:09:22 +1100
committerDamien Miller <djm@mindrot.org>2002-01-22 23:09:22 +1100
commitda7551677b301c6fd063eb162c7d32b37723a360 (patch)
treeee731b658802d003930540958f0b7ffc5a4a12bf /dh.c
parent154dda73a858a5924c2f5684dfec3e377cc3ab5d (diff)
downloadopenssh-git-da7551677b301c6fd063eb162c7d32b37723a360.tar.gz
- markus@cvs.openbsd.org 2001/12/27 18:22:16
[auth1.c authfile.c auth-rsa.c dh.c kexdh.c kexgex.c key.c rsa.c scard.c ssh-agent.c sshconnect1.c sshd.c ssh-dss.c] call fatal() for openssl allocation failures
Diffstat (limited to 'dh.c')
-rw-r--r--dh.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/dh.c b/dh.c
index fa2508af..a5d6f379 100644
--- a/dh.c
+++ b/dh.c
@@ -23,7 +23,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: dh.c,v 1.17 2001/06/23 15:12:18 itojun Exp $");
+RCSID("$OpenBSD: dh.c,v 1.18 2001/12/27 18:22:16 markus Exp $");
#include "xmalloc.h"
@@ -78,8 +78,10 @@ parse_prime(int linenum, char *line, struct dhgroup *dhg)
if (cp != NULL || *prime == '\0')
goto fail;
- dhg->g = BN_new();
- dhg->p = BN_new();
+ if ((dhg->g = BN_new()) == NULL)
+ fatal("parse_prime: BN_new failed");
+ if ((dhg->p = BN_new()) == NULL)
+ fatal("parse_prime: BN_new failed");
if (BN_hex2bn(&dhg->g, gen) == 0)
goto failclean;
@@ -202,8 +204,7 @@ dh_gen_key(DH *dh, int need)
do {
if (dh->priv_key != NULL)
BN_free(dh->priv_key);
- dh->priv_key = BN_new();
- if (dh->priv_key == NULL)
+ if ((dh->priv_key = BN_new()) == NULL)
fatal("dh_gen_key: BN_new failed");
/* generate a 2*need bits random private exponent */
if (!BN_rand(dh->priv_key, 2*need, 0, 0))
@@ -225,9 +226,8 @@ dh_new_group_asc(const char *gen, const char *modulus)
{
DH *dh;
- dh = DH_new();
- if (dh == NULL)
- fatal("DH_new");
+ if ((dh = DH_new()) == NULL)
+ fatal("dh_new_group_asc: DH_new");
if (BN_hex2bn(&dh->p, modulus) == 0)
fatal("BN_hex2bn p");
@@ -247,9 +247,8 @@ dh_new_group(BIGNUM *gen, BIGNUM *modulus)
{
DH *dh;
- dh = DH_new();
- if (dh == NULL)
- fatal("DH_new");
+ if ((dh = DH_new()) == NULL)
+ fatal("dh_new_group: DH_new");
dh->p = modulus;
dh->g = gen;