|
Lines 54-79
struct Cipher {
Link Here
|
| 54 |
int number; /* for ssh1 only */ |
54 |
int number; /* for ssh1 only */ |
| 55 |
u_int block_size; |
55 |
u_int block_size; |
| 56 |
u_int key_len; |
56 |
u_int key_len; |
|
|
57 |
u_int discard_len; |
| 57 |
const EVP_CIPHER *(*evptype)(void); |
58 |
const EVP_CIPHER *(*evptype)(void); |
| 58 |
} ciphers[] = { |
59 |
} ciphers[] = { |
| 59 |
{ "none", SSH_CIPHER_NONE, 8, 0, EVP_enc_null }, |
60 |
{ "none", SSH_CIPHER_NONE, 8, 0, 0, EVP_enc_null }, |
| 60 |
{ "des", SSH_CIPHER_DES, 8, 8, EVP_des_cbc }, |
61 |
{ "des", SSH_CIPHER_DES, 8, 8, 0, EVP_des_cbc }, |
| 61 |
{ "3des", SSH_CIPHER_3DES, 8, 16, evp_ssh1_3des }, |
62 |
{ "3des", SSH_CIPHER_3DES, 8, 16, 0, evp_ssh1_3des }, |
| 62 |
{ "blowfish", SSH_CIPHER_BLOWFISH, 8, 32, evp_ssh1_bf }, |
63 |
{ "blowfish", SSH_CIPHER_BLOWFISH, 8, 32, 0, evp_ssh1_bf }, |
| 63 |
|
64 |
|
| 64 |
{ "3des-cbc", SSH_CIPHER_SSH2, 8, 24, EVP_des_ede3_cbc }, |
65 |
{ "3des-cbc", SSH_CIPHER_SSH2, 8, 24, 0, EVP_des_ede3_cbc }, |
| 65 |
{ "blowfish-cbc", SSH_CIPHER_SSH2, 8, 16, EVP_bf_cbc }, |
66 |
{ "blowfish-cbc", SSH_CIPHER_SSH2, 8, 16, 0, EVP_bf_cbc }, |
| 66 |
{ "cast128-cbc", SSH_CIPHER_SSH2, 8, 16, EVP_cast5_cbc }, |
67 |
{ "cast128-cbc", SSH_CIPHER_SSH2, 8, 16, 0, EVP_cast5_cbc }, |
| 67 |
{ "arcfour", SSH_CIPHER_SSH2, 8, 16, EVP_rc4 }, |
68 |
{ "arcfour", SSH_CIPHER_SSH2, 8, 16, 0, EVP_rc4 }, |
| 68 |
{ "aes128-cbc", SSH_CIPHER_SSH2, 16, 16, EVP_aes_128_cbc }, |
69 |
{ "arcfour128", SSH_CIPHER_SSH2, 8, 16, 1536, EVP_rc4 }, |
| 69 |
{ "aes192-cbc", SSH_CIPHER_SSH2, 16, 24, EVP_aes_192_cbc }, |
70 |
{ "arcfour256", SSH_CIPHER_SSH2, 8, 32, 1536, EVP_rc4 }, |
| 70 |
{ "aes256-cbc", SSH_CIPHER_SSH2, 16, 32, EVP_aes_256_cbc }, |
71 |
{ "aes128-cbc", SSH_CIPHER_SSH2, 16, 16, 0, EVP_aes_128_cbc }, |
|
|
72 |
{ "aes192-cbc", SSH_CIPHER_SSH2, 16, 24, 0, EVP_aes_192_cbc }, |
| 73 |
{ "aes256-cbc", SSH_CIPHER_SSH2, 16, 32, 0, EVP_aes_256_cbc }, |
| 71 |
{ "rijndael-cbc@lysator.liu.se", |
74 |
{ "rijndael-cbc@lysator.liu.se", |
| 72 |
SSH_CIPHER_SSH2, 16, 32, EVP_aes_256_cbc }, |
75 |
SSH_CIPHER_SSH2, 16, 32, 0, EVP_aes_256_cbc }, |
| 73 |
{ "aes128-ctr", SSH_CIPHER_SSH2, 16, 16, evp_aes_128_ctr }, |
76 |
{ "aes128-ctr", SSH_CIPHER_SSH2, 16, 16, 0, evp_aes_128_ctr }, |
| 74 |
{ "aes192-ctr", SSH_CIPHER_SSH2, 16, 24, evp_aes_128_ctr }, |
77 |
{ "aes192-ctr", SSH_CIPHER_SSH2, 16, 24, 0, evp_aes_128_ctr }, |
| 75 |
{ "aes256-ctr", SSH_CIPHER_SSH2, 16, 32, evp_aes_128_ctr }, |
78 |
{ "aes256-ctr", SSH_CIPHER_SSH2, 16, 32, 0, evp_aes_128_ctr }, |
| 76 |
{ "acss@openssh.org", SSH_CIPHER_SSH2, 16, 5, EVP_acss }, |
79 |
{ "acss@openssh.org", SSH_CIPHER_SSH2, 16, 5, 0, EVP_acss }, |
| 77 |
|
80 |
|
| 78 |
{ NULL, SSH_CIPHER_INVALID, 0, 0, NULL } |
81 |
{ NULL, SSH_CIPHER_INVALID, 0, 0, NULL } |
| 79 |
}; |
82 |
}; |
|
Lines 189-194
cipher_init(CipherContext *cc, Cipher *c
Link Here
|
| 189 |
static int dowarn = 1; |
192 |
static int dowarn = 1; |
| 190 |
const EVP_CIPHER *type; |
193 |
const EVP_CIPHER *type; |
| 191 |
int klen; |
194 |
int klen; |
|
|
195 |
u_char *junk, *discard; |
| 192 |
|
196 |
|
| 193 |
if (cipher->number == SSH_CIPHER_DES) { |
197 |
if (cipher->number == SSH_CIPHER_DES) { |
| 194 |
if (dowarn) { |
198 |
if (dowarn) { |
|
Lines 226-231
cipher_init(CipherContext *cc, Cipher *c
Link Here
|
| 226 |
if (EVP_CipherInit(&cc->evp, NULL, (u_char *)key, NULL, -1) == 0) |
230 |
if (EVP_CipherInit(&cc->evp, NULL, (u_char *)key, NULL, -1) == 0) |
| 227 |
fatal("cipher_init: EVP_CipherInit: set key failed for %s", |
231 |
fatal("cipher_init: EVP_CipherInit: set key failed for %s", |
| 228 |
cipher->name); |
232 |
cipher->name); |
|
|
233 |
|
| 234 |
if (cipher->discard_len > 0) { |
| 235 |
junk = xmalloc(cipher->discard_len); |
| 236 |
discard = xmalloc(cipher->discard_len); |
| 237 |
if (EVP_Cipher(&cc->evp, discard, junk, |
| 238 |
cipher->discard_len) == 0) |
| 239 |
fatal("evp_crypt: EVP_Cipher failed during discard"); |
| 240 |
memset(discard, 0, cipher->discard_len); |
| 241 |
xfree(junk); |
| 242 |
xfree(discard); |
| 243 |
} |
| 229 |
} |
244 |
} |
| 230 |
|
245 |
|
| 231 |
void |
246 |
void |