1 #include "ssh.h" 2 3 struct CipherState 4 { 5 BFstate enc; 6 BFstate dec; 7 }; 8 9 static CipherState* 10 initblowfish(Conn *c, int) 11 { 12 CipherState *cs; 13 14 cs = emalloc(sizeof(CipherState)); 15 setupBFstate(&cs->enc, c->sesskey, SESSKEYLEN, nil); 16 setupBFstate(&cs->dec, c->sesskey, SESSKEYLEN, nil); 17 return cs; 18 } 19 20 static void 21 encryptblowfish(CipherState *cs, uchar *buf, int nbuf) 22 { 23 bfCBCencrypt(buf, nbuf, &cs->enc); 24 } 25 26 static void 27 decryptblowfish(CipherState *cs, uchar *buf, int nbuf) 28 { 29 bfCBCdecrypt(buf, nbuf, &cs->dec); 30 } 31 32 Cipher cipherblowfish = 33 { 34 SSH_CIPHER_BLOWFISH, 35 "blowfish", 36 initblowfish, 37 encryptblowfish, 38 decryptblowfish, 39 }; 40 41