diff options
Diffstat (limited to 'cipher.c')
-rw-r--r-- | cipher.c | 21 |
1 files changed, 4 insertions, 17 deletions
@@ -54,25 +54,18 @@ | |||
54 | extern const EVP_CIPHER *evp_ssh1_bf(void); | 54 | extern const EVP_CIPHER *evp_ssh1_bf(void); |
55 | extern const EVP_CIPHER *evp_ssh1_3des(void); | 55 | extern const EVP_CIPHER *evp_ssh1_3des(void); |
56 | extern void ssh1_3des_iv(EVP_CIPHER_CTX *, int, u_char *, int); | 56 | extern void ssh1_3des_iv(EVP_CIPHER_CTX *, int, u_char *, int); |
57 | #ifndef OPENSSL_HAVE_EVPCTR | ||
58 | #define EVP_aes_128_ctr evp_aes_128_ctr | ||
59 | #define EVP_aes_192_ctr evp_aes_128_ctr | ||
60 | #define EVP_aes_256_ctr evp_aes_128_ctr | ||
61 | extern const EVP_CIPHER *evp_aes_128_ctr(void); | ||
62 | extern void ssh_aes_ctr_iv(EVP_CIPHER_CTX *, int, u_char *, u_int); | ||
63 | #endif | ||
64 | 57 | ||
65 | struct Cipher { | 58 | struct Cipher { |
66 | char *name; | 59 | char *name; |
67 | int number; /* for ssh1 only */ | 60 | int number; /* for ssh1 only */ |
68 | u_int block_size; | 61 | u_int block_size; |
69 | u_int key_len; | 62 | u_int key_len; |
63 | u_int iv_len; /* defaults to block_size */ | ||
64 | u_int auth_len; | ||
70 | u_int discard_len; | 65 | u_int discard_len; |
71 | u_int cbc_mode; | 66 | u_int cbc_mode; |
72 | const EVP_CIPHER *(*evptype)(void); | 67 | const EVP_CIPHER *(*evptype)(void); |
73 | } ciphers[] = { | 68 | } ciphers[] = { |
74 | { NULL, SSH_CIPHER_INVALID, 0, 0, 0, 0, NULL } | ||
75 | |||
76 | { "none", SSH_CIPHER_NONE, 8, 0, 0, 0, 0, 0, EVP_enc_null }, | 69 | { "none", SSH_CIPHER_NONE, 8, 0, 0, 0, 0, 0, EVP_enc_null }, |
77 | { "des", SSH_CIPHER_DES, 8, 8, 0, 0, 0, 1, EVP_des_cbc }, | 70 | { "des", SSH_CIPHER_DES, 8, 8, 0, 0, 0, 1, EVP_des_cbc }, |
78 | { "3des", SSH_CIPHER_3DES, 8, 16, 0, 0, 0, 1, evp_ssh1_3des }, | 71 | { "3des", SSH_CIPHER_3DES, 8, 16, 0, 0, 0, 1, evp_ssh1_3des }, |
@@ -94,10 +87,12 @@ struct Cipher { | |||
94 | { "aes128-ctr", SSH_CIPHER_SSH2, 16, 16, 0, 0, 0, 0, EVP_aes_128_ctr }, | 87 | { "aes128-ctr", SSH_CIPHER_SSH2, 16, 16, 0, 0, 0, 0, EVP_aes_128_ctr }, |
95 | { "aes192-ctr", SSH_CIPHER_SSH2, 16, 24, 0, 0, 0, 0, EVP_aes_192_ctr }, | 88 | { "aes192-ctr", SSH_CIPHER_SSH2, 16, 24, 0, 0, 0, 0, EVP_aes_192_ctr }, |
96 | { "aes256-ctr", SSH_CIPHER_SSH2, 16, 32, 0, 0, 0, 0, EVP_aes_256_ctr }, | 89 | { "aes256-ctr", SSH_CIPHER_SSH2, 16, 32, 0, 0, 0, 0, EVP_aes_256_ctr }, |
90 | #ifdef OPENSSL_HAVE_EVPGCM | ||
97 | { "aes128-gcm@openssh.com", | 91 | { "aes128-gcm@openssh.com", |
98 | SSH_CIPHER_SSH2, 16, 16, 12, 16, 0, 0, EVP_aes_128_gcm }, | 92 | SSH_CIPHER_SSH2, 16, 16, 12, 16, 0, 0, EVP_aes_128_gcm }, |
99 | { "aes256-gcm@openssh.com", | 93 | { "aes256-gcm@openssh.com", |
100 | SSH_CIPHER_SSH2, 16, 32, 12, 16, 0, 0, EVP_aes_256_gcm }, | 94 | SSH_CIPHER_SSH2, 16, 32, 12, 16, 0, 0, EVP_aes_256_gcm }, |
95 | #endif | ||
101 | #ifdef USE_CIPHER_ACSS | 96 | #ifdef USE_CIPHER_ACSS |
102 | { "acss@openssh.org", | 97 | { "acss@openssh.org", |
103 | SSH_CIPHER_SSH2, 16, 5, 0, 0, 0, 0, EVP_acss }, | 98 | SSH_CIPHER_SSH2, 16, 5, 0, 0, 0, 0, EVP_acss }, |
@@ -473,14 +468,6 @@ cipher_set_keyiv(CipherContext *cc, u_char *iv) | |||
473 | } | 468 | } |
474 | } | 469 | } |
475 | 470 | ||
476 | #if OPENSSL_VERSION_NUMBER < 0x00907000L | ||
477 | #define EVP_X_STATE(evp) &(evp).c | ||
478 | #define EVP_X_STATE_LEN(evp) sizeof((evp).c) | ||
479 | #else | ||
480 | #define EVP_X_STATE(evp) (evp).cipher_data | ||
481 | #define EVP_X_STATE_LEN(evp) (evp).cipher->ctx_size | ||
482 | #endif | ||
483 | |||
484 | int | 471 | int |
485 | cipher_get_keycontext(const CipherContext *cc, u_char *dat) | 472 | cipher_get_keycontext(const CipherContext *cc, u_char *dat) |
486 | { | 473 | { |