예제 #1
0
static CipherState*
initrc4(Conn *c, int dir)
{
	CipherState *cs;

	cs = emalloc9p(sizeof(CipherState));
	if(dir)
		setupRC4state(&cs->state, c->s2cek, 16);
	else
		setupRC4state(&cs->state, c->c2sek, 16);
	return cs;
}
예제 #2
0
파일: esp.c 프로젝트: 8l/inferno
static void
rc4espinit(Espcb *ecb, char *name, uchar *k, int n)
{	
	Esprc4 *esprc4;

	// bits to bytes
	n = (n+7)>>3;
	esprc4 = smalloc(sizeof(Esprc4));
	memset(esprc4, 0, sizeof(Esprc4));
	setupRC4state(&esprc4->current, k, n);
	ecb->espalg = name;
	ecb->espblklen = 4;
	ecb->espivlen = 4;
	ecb->cipher = rc4cipher;
	ecb->espstate = esprc4;
}