diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2001-12-27 18:22:17 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2001-12-27 18:22:17 +0000 |
commit | 2ec000d5480d557632594199897f58e3cfb6aa79 (patch) | |
tree | 9e3ec502a9b19860e5d5a6e123c0b1967fd9192c /usr.bin/ssh/dh.c | |
parent | fb712980169edaed215ac2c11bb2a86a029f6037 (diff) |
call fatal() for openssl allocation failures
Diffstat (limited to 'usr.bin/ssh/dh.c')
-rw-r--r-- | usr.bin/ssh/dh.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/usr.bin/ssh/dh.c b/usr.bin/ssh/dh.c index fa2508af7a2..a5d6f379c6b 100644 --- a/usr.bin/ssh/dh.c +++ b/usr.bin/ssh/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; |