mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 03:52:49 -05:00
Single-DES encryption, patch courtesy of Murphy Lam
[originally from svn r253]
This commit is contained in:
21
sshdes.c
21
sshdes.c
@ -673,6 +673,27 @@ struct ssh_cipher ssh_3des = {
|
||||
des3_decrypt_blk
|
||||
};
|
||||
|
||||
static void des_sesskey(unsigned char *key) {
|
||||
des_set_key(key, &ekey1);
|
||||
memset(eiv1, 0, sizeof(eiv1));
|
||||
des_set_key(key, &dkey1);
|
||||
memset(div1, 0, sizeof(div1));
|
||||
}
|
||||
|
||||
static void des_encrypt_blk(unsigned char *blk, int len) {
|
||||
des_cbc_encrypt(&ekey1, eiv1, blk, blk, len);
|
||||
}
|
||||
|
||||
static void des_decrypt_blk(unsigned char *blk, int len) {
|
||||
des_cbc_decrypt(&dkey1, div1, blk, blk, len);
|
||||
}
|
||||
|
||||
struct ssh_cipher ssh_des = {
|
||||
des_sesskey,
|
||||
des_encrypt_blk,
|
||||
des_decrypt_blk
|
||||
};
|
||||
|
||||
#ifdef DES_TEST
|
||||
|
||||
void des_encrypt_buf(DESContext *ks, unsigned char *out,
|
||||
|
Reference in New Issue
Block a user