diff options
author | Damien Miller <djm@mindrot.org> | 1999-11-25 00:26:21 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 1999-11-25 00:26:21 +1100 |
commit | 95def09838fc61b37b6ea7cd5c234a465b4b129b (patch) | |
tree | 042744f76f40a326b873cb1c3690a6d7d966bc3e /mpaux.c | |
parent | 4d2f15f895f4c795afc008aeff3fd2ceffbc44f4 (diff) |
- Merged very large OpenBSD source code reformat
- OpenBSD CVS updates
- [channels.c cipher.c compat.c log-client.c scp.c serverloop.c]
[ssh.h sshd.8 sshd.c]
syslog changes:
* Unified Logmessage for all auth-types, for success and for failed
* Standard connections get only ONE line in the LOG when level==LOG:
Auth-attempts are logged only, if authentication is:
a) successfull or
b) with passwd or
c) we had more than AUTH_FAIL_LOG failues
* many log() became verbose()
* old behaviour with level=VERBOSE
- [readconf.c readconf.h ssh.1 ssh.h sshconnect.c sshd.c]
tranfer s/key challenge/response data in SSH_SMSG_AUTH_TIS_CHALLENGE
messages. allows use of s/key in windows (ttssh, securecrt) and
ssh-1.2.27 clients without 'ssh -v', ok: niels@
- [sshd.8]
-V, for fallback to openssh in SSH2 compatibility mode
- [sshd.c]
fix sigchld race; cjc5@po.cwru.edu
Diffstat (limited to 'mpaux.c')
-rw-r--r-- | mpaux.c | 68 |
1 files changed, 33 insertions, 35 deletions
@@ -1,21 +1,24 @@ | |||
1 | /* | 1 | /* |
2 | 2 | * | |
3 | mpaux.c | 3 | * mpaux.c |
4 | 4 | * | |
5 | Author: Tatu Ylonen <ylo@cs.hut.fi> | 5 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
6 | 6 | * | |
7 | Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 7 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
8 | All rights reserved | 8 | * All rights reserved |
9 | 9 | * | |
10 | Created: Sun Jul 16 04:29:30 1995 ylo | 10 | * Created: Sun Jul 16 04:29:30 1995 ylo |
11 | 11 | * | |
12 | This file contains various auxiliary functions related to multiple | 12 | * This file contains various auxiliary functions related to multiple |
13 | precision integers. | 13 | * precision integers. |
14 | 14 | * | |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #include "includes.h" | 17 | #include "includes.h" |
18 | RCSID("$Id: mpaux.c,v 1.6 1999/11/16 02:37:16 damien Exp $"); | 18 | RCSID("$Id: mpaux.c,v 1.7 1999/11/24 13:26:22 damien Exp $"); |
19 | |||
20 | #include "getput.h" | ||
21 | #include "xmalloc.h" | ||
19 | 22 | ||
20 | #ifdef HAVE_OPENSSL | 23 | #ifdef HAVE_OPENSSL |
21 | #include <openssl/bn.h> | 24 | #include <openssl/bn.h> |
@@ -26,29 +29,24 @@ RCSID("$Id: mpaux.c,v 1.6 1999/11/16 02:37:16 damien Exp $"); | |||
26 | #include <ssl/md5.h> | 29 | #include <ssl/md5.h> |
27 | #endif | 30 | #endif |
28 | 31 | ||
29 | #include "getput.h" | ||
30 | #include "xmalloc.h" | ||
31 | |||
32 | |||
33 | void | 32 | void |
34 | compute_session_id(unsigned char session_id[16], | 33 | compute_session_id(unsigned char session_id[16], |
35 | unsigned char cookie[8], | 34 | unsigned char cookie[8], |
36 | BIGNUM *host_key_n, | 35 | BIGNUM* host_key_n, |
37 | BIGNUM *session_key_n) | 36 | BIGNUM* session_key_n) |
38 | { | 37 | { |
39 | unsigned int host_key_bits = BN_num_bits(host_key_n); | 38 | unsigned int host_key_bits = BN_num_bits(host_key_n); |
40 | unsigned int session_key_bits = BN_num_bits(session_key_n); | 39 | unsigned int session_key_bits = BN_num_bits(session_key_n); |
41 | unsigned int bytes = (host_key_bits + 7) / 8 + (session_key_bits + 7) / 8 + 8; | 40 | unsigned int bytes = (host_key_bits + 7) / 8 + (session_key_bits + 7) / 8 + 8; |
42 | unsigned char *buf = xmalloc(bytes); | 41 | unsigned char *buf = xmalloc(bytes); |
43 | MD5_CTX md; | 42 | MD5_CTX md; |
44 | 43 | ||
45 | BN_bn2bin(host_key_n, buf); | 44 | BN_bn2bin(host_key_n, buf); |
46 | BN_bn2bin(session_key_n, buf + (host_key_bits + 7 ) / 8); | 45 | BN_bn2bin(session_key_n, buf + (host_key_bits + 7) / 8); |
47 | memcpy(buf + (host_key_bits + 7) / 8 + (session_key_bits + 7) / 8, | 46 | memcpy(buf + (host_key_bits + 7) / 8 + (session_key_bits + 7) / 8, cookie, 8); |
48 | cookie, 8); | 47 | MD5_Init(&md); |
49 | MD5_Init(&md); | 48 | MD5_Update(&md, buf, bytes); |
50 | MD5_Update(&md, buf, bytes); | 49 | MD5_Final(session_id, &md); |
51 | MD5_Final(session_id, &md); | 50 | memset(buf, 0, bytes); |
52 | memset(buf, 0, bytes); | 51 | xfree(buf); |
53 | xfree(buf); | ||
54 | } | 52 | } |