diff options
author | Damien Miller <djm@mindrot.org> | 2000-04-06 12:32:37 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2000-04-06 12:32:37 +1000 |
commit | 1383bd8eb91a8ec9c8d283679faec5925b0ccc42 (patch) | |
tree | f71278df6c50983ea3dad850ae79c45c340d9362 /cipher.c | |
parent | 74a333bbe11f67c59c559e0f424d5945eb438577 (diff) |
- OpenBSD CVS update:
- [channels.c]
close efd on eof
- [clientloop.c compat.c ssh.c sshconnect.c myproposal.h]
ssh2 client implementation, interops w/ ssh.com and lsh servers.
- [sshconnect.c]
missing free.
- [authfile.c cipher.c cipher.h packet.c sshconnect.c sshd.c]
remove unused argument, split cipher_mask()
- [clientloop.c]
re-order: group ssh1 vs. ssh2
- Make Redhat spec require openssl >= 0.9.5a
Diffstat (limited to 'cipher.c')
-rw-r--r-- | cipher.c | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -12,7 +12,7 @@ | |||
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "includes.h" | 14 | #include "includes.h" |
15 | RCSID("$Id: cipher.c,v 1.15 2000/04/01 01:09:23 damien Exp $"); | 15 | RCSID("$Id: cipher.c,v 1.16 2000/04/06 02:32:39 damien Exp $"); |
16 | 16 | ||
17 | #include "ssh.h" | 17 | #include "ssh.h" |
18 | #include "cipher.h" | 18 | #include "cipher.h" |
@@ -137,17 +137,28 @@ static char *cipher_names[] = | |||
137 | */ | 137 | */ |
138 | 138 | ||
139 | unsigned int | 139 | unsigned int |
140 | cipher_mask() | 140 | cipher_mask1() |
141 | { | 141 | { |
142 | unsigned int mask = 0; | 142 | unsigned int mask = 0; |
143 | mask |= 1 << SSH_CIPHER_3DES; /* Mandatory */ | 143 | mask |= 1 << SSH_CIPHER_3DES; /* Mandatory */ |
144 | mask |= 1 << SSH_CIPHER_BLOWFISH; | 144 | mask |= 1 << SSH_CIPHER_BLOWFISH; |
145 | return mask; | ||
146 | } | ||
147 | unsigned int | ||
148 | cipher_mask2() | ||
149 | { | ||
150 | unsigned int mask = 0; | ||
145 | mask |= 1 << SSH_CIPHER_BLOWFISH_CBC; | 151 | mask |= 1 << SSH_CIPHER_BLOWFISH_CBC; |
146 | mask |= 1 << SSH_CIPHER_3DES_CBC; | 152 | mask |= 1 << SSH_CIPHER_3DES_CBC; |
147 | mask |= 1 << SSH_CIPHER_ARCFOUR; | 153 | mask |= 1 << SSH_CIPHER_ARCFOUR; |
148 | mask |= 1 << SSH_CIPHER_CAST128_CBC; | 154 | mask |= 1 << SSH_CIPHER_CAST128_CBC; |
149 | return mask; | 155 | return mask; |
150 | } | 156 | } |
157 | unsigned int | ||
158 | cipher_mask() | ||
159 | { | ||
160 | return cipher_mask1() | cipher_mask2(); | ||
161 | } | ||
151 | 162 | ||
152 | /* Returns the name of the cipher. */ | 163 | /* Returns the name of the cipher. */ |
153 | 164 | ||
@@ -182,8 +193,7 @@ cipher_number(const char *name) | |||
182 | */ | 193 | */ |
183 | 194 | ||
184 | void | 195 | void |
185 | cipher_set_key_string(CipherContext *context, int cipher, | 196 | cipher_set_key_string(CipherContext *context, int cipher, const char *passphrase) |
186 | const char *passphrase, int for_encryption) | ||
187 | { | 197 | { |
188 | MD5_CTX md; | 198 | MD5_CTX md; |
189 | unsigned char digest[16]; | 199 | unsigned char digest[16]; |
@@ -192,7 +202,7 @@ cipher_set_key_string(CipherContext *context, int cipher, | |||
192 | MD5_Update(&md, (const unsigned char *) passphrase, strlen(passphrase)); | 202 | MD5_Update(&md, (const unsigned char *) passphrase, strlen(passphrase)); |
193 | MD5_Final(digest, &md); | 203 | MD5_Final(digest, &md); |
194 | 204 | ||
195 | cipher_set_key(context, cipher, digest, 16, for_encryption); | 205 | cipher_set_key(context, cipher, digest, 16); |
196 | 206 | ||
197 | memset(digest, 0, sizeof(digest)); | 207 | memset(digest, 0, sizeof(digest)); |
198 | memset(&md, 0, sizeof(md)); | 208 | memset(&md, 0, sizeof(md)); |
@@ -201,8 +211,8 @@ cipher_set_key_string(CipherContext *context, int cipher, | |||
201 | /* Selects the cipher to use and sets the key. */ | 211 | /* Selects the cipher to use and sets the key. */ |
202 | 212 | ||
203 | void | 213 | void |
204 | cipher_set_key(CipherContext *context, int cipher, | 214 | cipher_set_key(CipherContext *context, int cipher, const unsigned char *key, |
205 | const unsigned char *key, int keylen, int for_encryption) | 215 | int keylen) |
206 | { | 216 | { |
207 | unsigned char padded[32]; | 217 | unsigned char padded[32]; |
208 | 218 | ||