diff options
author | 2001-12-27 18:22:16 +0000 | |
---|---|---|
committer | 2001-12-27 18:22:16 +0000 | |
commit | 8f44bd53e2101ef6105a3fc353079aaaebdefc48 (patch) | |
tree | 9391d4b87ee62a37352bd63416dddad9e4535086 /usr.bin/ssh/dh.c | |
parent | -t is only needed for key generation (unbreaks -i, -e, etc). (diff) | |
download | wireguard-openbsd-8f44bd53e2101ef6105a3fc353079aaaebdefc48.tar.xz wireguard-openbsd-8f44bd53e2101ef6105a3fc353079aaaebdefc48.zip |
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; |