libsec: implement extended 192-bit nonce xchacha variant and hchacha function

This commit is contained in:
cinap_lenrek 2017-01-12 20:16:38 +01:00
parent 47f07b2669
commit 2e23780d2f
6 changed files with 183 additions and 40 deletions

View file

@ -101,6 +101,7 @@ enum
ChachaBsize= 64,
ChachaKeylen= 256/8,
ChachaIVlen= 96/8,
XChachaIVlen= 192/8,
};
typedef struct Chachastate Chachastate;
@ -115,6 +116,7 @@ struct Chachastate
u32int iv[3];
};
};
u32int xkey[8];
int rounds;
int ivwords;
};
@ -125,6 +127,8 @@ void chacha_setblock(Chachastate*, u64int);
void chacha_encrypt(uchar*, ulong, Chachastate*);
void chacha_encrypt2(uchar*, uchar*, ulong, Chachastate*);
void hchacha(uchar h[32], uchar *key, ulong keylen, uchar nonce[16], int rounds);
void ccpoly_encrypt(uchar *dat, ulong ndat, uchar *aad, ulong naad, uchar tag[16], Chachastate *cs);
int ccpoly_decrypt(uchar *dat, ulong ndat, uchar *aad, ulong naad, uchar tag[16], Chachastate *cs);
@ -143,7 +147,7 @@ typedef struct Salsastate Salsastate;
struct Salsastate
{
u32int input[16];
u32int key[8];
u32int xkey[8];
int rounds;
int ivwords;
};