version 1.102, 2016/08/03 05:41:57 |
version 1.103, 2017/04/30 23:10:43 |
|
|
#include "ssherr.h" |
#include "ssherr.h" |
#include "digest.h" |
#include "digest.h" |
|
|
#ifdef WITH_SSH1 |
|
extern const EVP_CIPHER *evp_ssh1_bf(void); |
|
extern const EVP_CIPHER *evp_ssh1_3des(void); |
|
extern int ssh1_3des_iv(EVP_CIPHER_CTX *, int, u_char *, int); |
|
#endif |
|
|
|
struct sshcipher_ctx { |
struct sshcipher_ctx { |
int plaintext; |
int plaintext; |
|
|
}; |
}; |
|
|
static const struct sshcipher ciphers[] = { |
static const struct sshcipher ciphers[] = { |
#ifdef WITH_SSH1 |
|
{ "des", SSH_CIPHER_DES, 8, 8, 0, 0, 0, 1, EVP_des_cbc }, |
|
{ "3des", SSH_CIPHER_3DES, 8, 16, 0, 0, 0, 1, evp_ssh1_3des }, |
|
{ "blowfish", SSH_CIPHER_BLOWFISH, 8, 32, 0, 0, 0, 1, evp_ssh1_bf }, |
|
#endif |
|
#ifdef WITH_OPENSSL |
#ifdef WITH_OPENSSL |
{ "none", SSH_CIPHER_NONE, 8, 0, 0, 0, 0, 0, EVP_enc_null }, |
{ "none", SSH_CIPHER_NONE, 8, 0, 0, 0, 0, 0, EVP_enc_null }, |
{ "3des-cbc", SSH_CIPHER_SSH2, 8, 24, 0, 0, 0, 1, EVP_des_ede3_cbc }, |
{ "3des-cbc", SSH_CIPHER_SSH2, 8, 24, 0, 0, 0, 1, EVP_des_ede3_cbc }, |
|
|
memcpy(iv, cc->evp->iv, len); |
memcpy(iv, cc->evp->iv, len); |
break; |
break; |
#endif |
#endif |
#ifdef WITH_SSH1 |
|
case SSH_CIPHER_3DES: |
|
return ssh1_3des_iv(cc->evp, 0, iv, 24); |
|
#endif |
|
default: |
default: |
return SSH_ERR_INVALID_ARGUMENT; |
return SSH_ERR_INVALID_ARGUMENT; |
} |
} |
|
|
} else |
} else |
memcpy(cc->evp->iv, iv, evplen); |
memcpy(cc->evp->iv, iv, evplen); |
break; |
break; |
#endif |
|
#ifdef WITH_SSH1 |
|
case SSH_CIPHER_3DES: |
|
return ssh1_3des_iv(cc->evp, 1, (u_char *)iv, 24); |
|
#endif |
#endif |
default: |
default: |
return SSH_ERR_INVALID_ARGUMENT; |
return SSH_ERR_INVALID_ARGUMENT; |