summaryrefslogtreecommitdiff
path: root/auth1.c
diff options
context:
space:
mode:
Diffstat (limited to 'auth1.c')
-rw-r--r--auth1.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/auth1.c b/auth1.c
index 41628cedc..921a1757a 100644
--- a/auth1.c
+++ b/auth1.c
@@ -10,7 +10,7 @@
10 */ 10 */
11 11
12#include "includes.h" 12#include "includes.h"
13RCSID("$OpenBSD: auth1.c,v 1.28 2001/12/25 18:53:00 markus Exp $"); 13RCSID("$OpenBSD: auth1.c,v 1.29 2001/12/27 18:22:16 markus Exp $");
14 14
15#include "xmalloc.h" 15#include "xmalloc.h"
16#include "rsa.h" 16#include "rsa.h"
@@ -66,7 +66,7 @@ do_authloop(Authctxt *authctxt)
66{ 66{
67 int authenticated = 0; 67 int authenticated = 0;
68 u_int bits; 68 u_int bits;
69 RSA *client_host_key; 69 Key *client_host_key;
70 BIGNUM *n; 70 BIGNUM *n;
71 char *client_user, *password; 71 char *client_user, *password;
72 char info[1024]; 72 char info[1024];
@@ -202,24 +202,20 @@ do_authloop(Authctxt *authctxt)
202 client_user = packet_get_string(&ulen); 202 client_user = packet_get_string(&ulen);
203 203
204 /* Get the client host key. */ 204 /* Get the client host key. */
205 client_host_key = RSA_new(); 205 client_host_key = key_new(KEY_RSA1);
206 if (client_host_key == NULL)
207 fatal("RSA_new failed");
208 client_host_key->e = BN_new();
209 client_host_key->n = BN_new();
210 if (client_host_key->e == NULL || client_host_key->n == NULL)
211 fatal("BN_new failed");
212 bits = packet_get_int(); 206 bits = packet_get_int();
213 packet_get_bignum(client_host_key->e, &elen); 207 packet_get_bignum(client_host_key->rsa->e, &elen);
214 packet_get_bignum(client_host_key->n, &nlen); 208 packet_get_bignum(client_host_key->rsa->n, &nlen);
215 209
216 if (bits != BN_num_bits(client_host_key->n)) 210 if (bits != BN_num_bits(client_host_key->rsa->n))
217 verbose("Warning: keysize mismatch for client_host_key: " 211 verbose("Warning: keysize mismatch for client_host_key: "
218 "actual %d, announced %d", BN_num_bits(client_host_key->n), bits); 212 "actual %d, announced %d",
213 BN_num_bits(client_host_key->rsa->n), bits);
219 packet_integrity_check(plen, (4 + ulen) + 4 + elen + nlen, type); 214 packet_integrity_check(plen, (4 + ulen) + 4 + elen + nlen, type);
220 215
221 authenticated = auth_rhosts_rsa(pw, client_user, client_host_key); 216 authenticated = auth_rhosts_rsa(pw, client_user,
222 RSA_free(client_host_key); 217 client_host_key->rsa);
218 key_free(client_host_key);
223 219
224 snprintf(info, sizeof info, " ruser %.100s", client_user); 220 snprintf(info, sizeof info, " ruser %.100s", client_user);
225 break; 221 break;
@@ -230,9 +226,8 @@ do_authloop(Authctxt *authctxt)
230 break; 226 break;
231 } 227 }
232 /* RSA authentication requested. */ 228 /* RSA authentication requested. */
233 n = BN_new(); 229 if ((n = BN_new()) == NULL)
234 if (n == NULL) 230 fatal("do_authloop: BN_new failed");
235 fatal("BN_new failed");
236 packet_get_bignum(n, &nlen); 231 packet_get_bignum(n, &nlen);
237 packet_integrity_check(plen, nlen, type); 232 packet_integrity_check(plen, nlen, type);
238 authenticated = auth_rsa(pw, n); 233 authenticated = auth_rsa(pw, n);