Subversion Repositories planix.SVN

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include "ssh.h"
2
 
3
struct CipherState
4
{
5
	RC4state enc;
6
	RC4state dec;
7
};
8
 
9
static CipherState*
10
initrc4(Conn *c, int isserver)
11
{
12
	CipherState *cs;
13
 
14
	cs = emalloc(sizeof(CipherState));
15
	if(isserver){
16
		setupRC4state(&cs->enc, c->sesskey, 16);
17
		setupRC4state(&cs->dec, c->sesskey+16, 16);
18
	}else{
19
		setupRC4state(&cs->dec, c->sesskey, 16);
20
		setupRC4state(&cs->enc, c->sesskey+16, 16);
21
	}
22
	return cs;
23
}
24
 
25
static void
26
encryptrc4(CipherState *cs, uchar *buf, int nbuf)
27
{
28
	rc4(&cs->enc, buf, nbuf);
29
}
30
 
31
static void
32
decryptrc4(CipherState *cs, uchar *buf, int nbuf)
33
{
34
	rc4(&cs->dec, buf, nbuf);
35
}
36
 
37
Cipher cipherrc4 =
38
{
39
	SSH_CIPHER_RC4,
40
	"rc4",
41
	initrc4,
42
	encryptrc4,
43
	decryptrc4,
44
};
45