diff options
Diffstat (limited to 'kexdh.c')
-rw-r--r-- | kexdh.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | RCSID("$OpenBSD: kexdh.c,v 1.7 2001/09/17 19:27:15 stevesk Exp $"); | 26 | RCSID("$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); |