summaryrefslogtreecommitdiff
path: root/kexdh.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 /kexdh.c
parent154dda73a858a5924c2f5684dfec3e377cc3ab5d (diff)
- 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 'kexdh.c')
-rw-r--r--kexdh.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/kexdh.c b/kexdh.c
index b850a1a22..1e9f35835 100644
--- a/kexdh.c
+++ b/kexdh.c
@@ -23,7 +23,7 @@
23 */ 23 */
24 24
25#include "includes.h" 25#include "includes.h"
26RCSID("$OpenBSD: kexdh.c,v 1.7 2001/09/17 19:27:15 stevesk Exp $"); 26RCSID("$OpenBSD: kexdh.c,v 1.8 2001/12/27 18:22:16 markus Exp $");
27 27
28#include <openssl/crypto.h> 28#include <openssl/crypto.h>
29#include <openssl/bn.h> 29#include <openssl/bn.h>
@@ -129,8 +129,7 @@ kexdh_client(Kex *kex)
129 fatal("server_host_key verification failed"); 129 fatal("server_host_key verification failed");
130 130
131 /* DH paramter f, server public DH key */ 131 /* DH paramter f, server public DH key */
132 dh_server_pub = BN_new(); 132 if ((dh_server_pub = BN_new()) == NULL)
133 if (dh_server_pub == NULL)
134 fatal("dh_server_pub == NULL"); 133 fatal("dh_server_pub == NULL");
135 packet_get_bignum2(dh_server_pub, &dlen); 134 packet_get_bignum2(dh_server_pub, &dlen);
136 135
@@ -154,7 +153,8 @@ kexdh_client(Kex *kex)
154#ifdef DEBUG_KEXDH 153#ifdef DEBUG_KEXDH
155 dump_digest("shared secret", kbuf, kout); 154 dump_digest("shared secret", kbuf, kout);
156#endif 155#endif
157 shared_secret = BN_new(); 156 if ((shared_secret = BN_new()) == NULL)
157 fatal("kexdh_client: BN_new failed");
158 BN_bin2bn(kbuf, kout, shared_secret); 158 BN_bin2bn(kbuf, kout, shared_secret);
159 memset(kbuf, 0, klen); 159 memset(kbuf, 0, klen);
160 xfree(kbuf); 160 xfree(kbuf);
@@ -217,8 +217,7 @@ kexdh_server(Kex *kex)
217 fatal("Unsupported hostkey type %d", kex->hostkey_type); 217 fatal("Unsupported hostkey type %d", kex->hostkey_type);
218 218
219 /* key, cert */ 219 /* key, cert */
220 dh_client_pub = BN_new(); 220 if ((dh_client_pub = BN_new()) == NULL)
221 if (dh_client_pub == NULL)
222 fatal("dh_client_pub == NULL"); 221 fatal("dh_client_pub == NULL");
223 packet_get_bignum2(dh_client_pub, &dlen); 222 packet_get_bignum2(dh_client_pub, &dlen);
224 223
@@ -244,7 +243,8 @@ kexdh_server(Kex *kex)
244#ifdef DEBUG_KEXDH 243#ifdef DEBUG_KEXDH
245 dump_digest("shared secret", kbuf, kout); 244 dump_digest("shared secret", kbuf, kout);
246#endif 245#endif
247 shared_secret = BN_new(); 246 if ((shared_secret = BN_new()) == NULL)
247 fatal("kexdh_server: BN_new failed");
248 BN_bin2bn(kbuf, kout, shared_secret); 248 BN_bin2bn(kbuf, kout, shared_secret);
249 memset(kbuf, 0, klen); 249 memset(kbuf, 0, klen);
250 xfree(kbuf); 250 xfree(kbuf);