Deleted Added
full compact
auth-rsa.c (162856) auth-rsa.c (164149)
1/* $OpenBSD: auth-rsa.c,v 1.71 2006/08/03 03:34:41 deraadt Exp $ */
1/* $OpenBSD: auth-rsa.c,v 1.72 2006/11/06 21:25:27 markus Exp $ */
2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 * All rights reserved
6 * RSA-based authentication. This code determines whether to admit a login
7 * based on RSA authentication. This file also contains functions to check
8 * validity of the host key.
9 *

--- 61 unchanged lines hidden (view full) ---

71auth_rsa_generate_challenge(Key *key)
72{
73 BIGNUM *challenge;
74 BN_CTX *ctx;
75
76 if ((challenge = BN_new()) == NULL)
77 fatal("auth_rsa_generate_challenge: BN_new() failed");
78 /* Generate a random challenge. */
2/*
3 * Author: Tatu Ylonen <ylo@cs.hut.fi>
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
5 * All rights reserved
6 * RSA-based authentication. This code determines whether to admit a login
7 * based on RSA authentication. This file also contains functions to check
8 * validity of the host key.
9 *

--- 61 unchanged lines hidden (view full) ---

71auth_rsa_generate_challenge(Key *key)
72{
73 BIGNUM *challenge;
74 BN_CTX *ctx;
75
76 if ((challenge = BN_new()) == NULL)
77 fatal("auth_rsa_generate_challenge: BN_new() failed");
78 /* Generate a random challenge. */
79 BN_rand(challenge, 256, 0, 0);
79 if (BN_rand(challenge, 256, 0, 0) == 0)
80 fatal("auth_rsa_generate_challenge: BN_rand failed");
80 if ((ctx = BN_CTX_new()) == NULL)
81 if ((ctx = BN_CTX_new()) == NULL)
81 fatal("auth_rsa_generate_challenge: BN_CTX_new() failed");
82 BN_mod(challenge, challenge, key->rsa->n, ctx);
82 fatal("auth_rsa_generate_challenge: BN_CTX_new failed");
83 if (BN_mod(challenge, challenge, key->rsa->n, ctx) == 0)
84 fatal("auth_rsa_generate_challenge: BN_mod failed");
83 BN_CTX_free(ctx);
84
85 return challenge;
86}
87
88int
89auth_rsa_verify_response(Key *key, BIGNUM *challenge, u_char response[16])
90{

--- 251 unchanged lines hidden ---
85 BN_CTX_free(ctx);
86
87 return challenge;
88}
89
90int
91auth_rsa_verify_response(Key *key, BIGNUM *challenge, u_char response[16])
92{

--- 251 unchanged lines hidden ---