libsec: add chacha cipher (from charles forsyth)
This commit is contained in:
parent
7effba9d98
commit
847f3a0cf5
5 changed files with 370 additions and 0 deletions
|
@ -70,6 +70,37 @@ void bfCBCdecrypt(uchar*, int, BFstate*);
|
|||
void bfECBencrypt(uchar*, int, BFstate*);
|
||||
void bfECBdecrypt(uchar*, int, BFstate*);
|
||||
|
||||
/*
|
||||
* Chacha definitions
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
ChachaBsize= 64,
|
||||
ChachaKeylen= 256/8,
|
||||
ChachaIVlen= 96/8,
|
||||
};
|
||||
|
||||
typedef struct Chachastate Chachastate;
|
||||
struct Chachastate
|
||||
{
|
||||
union{
|
||||
u32int input[16];
|
||||
struct {
|
||||
u32int constant[4];
|
||||
u32int key[8];
|
||||
u32int counter;
|
||||
u32int iv[3];
|
||||
};
|
||||
};
|
||||
int rounds;
|
||||
};
|
||||
|
||||
void setupChachastate(Chachastate*, uchar*, ulong, uchar*, int);
|
||||
void chacha_setblock(Chachastate*, u32int);
|
||||
void chacha_encrypt(uchar*, ulong, Chachastate*);
|
||||
void chacha_encrypt2(uchar*, uchar*, ulong, Chachastate*);
|
||||
|
||||
/*
|
||||
* DES definitions
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue