1 #include "ssh.h" 2 3 struct CipherState 4 { 5 DESstate enc; 6 DESstate dec; 7 }; 8 9 static CipherState* 10 initdes(Conn *c, int) 11 { 12 CipherState *cs; 13 14 cs = emalloc(sizeof(CipherState)); 15 setupDESstate(&cs->enc, c->sesskey, nil); 16 setupDESstate(&cs->dec, c->sesskey, nil); 17 return cs; 18 } 19 20 static void 21 encryptdes(CipherState *cs, uchar *buf, int nbuf) 22 { 23 desCBCencrypt(buf, nbuf, &cs->enc); 24 } 25 26 static void 27 decryptdes(CipherState *cs, uchar *buf, int nbuf) 28 { 29 desCBCdecrypt(buf, nbuf, &cs->dec); 30 } 31 32 Cipher cipherdes = 33 { 34 SSH_CIPHER_DES, 35 "des", 36 initdes, 37 encryptdes, 38 decryptdes, 39 }; 40 41