diff options
Diffstat (limited to 'src/libgcrypt.c')
-rw-r--r-- | src/libgcrypt.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/libgcrypt.c b/src/libgcrypt.c index 70ce828..bc10bd8 100644 --- a/src/libgcrypt.c +++ b/src/libgcrypt.c @@ -262,6 +262,17 @@ static void aes_decrypt(struct ssh_cipher_struct *cipher, void *in, void *out, gcry_cipher_decrypt(cipher->key[0], out, len, in, len); } +static int des1_set_key(struct ssh_cipher_struct *cipher, void *key){ + if(!cipher->key){ + if (alloc_key(cipher) < 0) { + return -1; + } + DES_set_odd_parity(key); + DES_set_key_unchecked(key,cipher->key); + } + return 0; +} + static int des3_set_key(struct ssh_cipher_struct *cipher, void *key, void *IV) { if (cipher->key == NULL) { if (alloc_key(cipher) < 0) { @@ -285,6 +296,19 @@ static int des3_set_key(struct ssh_cipher_struct *cipher, void *key, void *IV) { return 0; } + +static void des1_1_encrypt(struct ssh_cipher_struct *cipher, void *in, void *out, + unsigned long len, void *IV){ + + DES_ncbc_encrypt(in, out, len, cipher->key, IV, 1); +} + +static void des1_1_decrypt(struct ssh_cipher_struct *cipher, void *in, void *out, + unsigned long len, void *IV){ + + DES_ncbc_encrypt(in,out,len, cipher->key, IV, 0); +} + static void des3_encrypt(struct ssh_cipher_struct *cipher, void *in, void *out, unsigned long len) { gcry_cipher_encrypt(cipher->key[0], out, len, in, len); @@ -462,6 +486,17 @@ static struct ssh_cipher_struct ssh_ciphertab[] = { .cbc_decrypt = des3_1_decrypt }, { + .name = "des-cbc-ssh1", + .blocksize = 8, + .keylen = sizeof(DES_key_schedule), + .key = NULL, + .keysize = 64, + .set_encrypt_key = des1_set_key, + .set_decrypt_key = des1_set_key, + .cbc_encrypt = des1_1_encrypt, + .cbc_decrypt = des1_1_decrypt + }, + { .name = NULL, .blocksize = 0, .keylen = 0, |