summaryrefslogtreecommitdiff
path: root/sys/include/libsec.h
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2016-01-19 12:50:33 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2016-01-19 12:50:33 +0100
commit7cf11db685832db42b6cbb33f9eca99db6ff4fcf (patch)
tree0d7049c6fdaf251c83a020877fcd10e4b6469a3b /sys/include/libsec.h
parent7b31d5e494815d76fa04c3631992d6eb5ea0b372 (diff)
libsec: add salsa20 stream cipher
Diffstat (limited to 'sys/include/libsec.h')
-rw-r--r--sys/include/libsec.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/sys/include/libsec.h b/sys/include/libsec.h
index 86cb342e5..204ca4d26 100644
--- a/sys/include/libsec.h
+++ b/sys/include/libsec.h
@@ -107,6 +107,34 @@ void ccpoly_encrypt(uchar *dat, ulong ndat, uchar *aad, ulong naad, uchar tag[16
int ccpoly_decrypt(uchar *dat, ulong ndat, uchar *aad, ulong naad, uchar tag[16], Chachastate *cs);
/*
+ * Salsa definitions
+ */
+enum
+{
+ SalsaBsize= 64,
+ SalsaKeylen= 256/8,
+ SalsaIVlen= 64/8,
+ XSalsaIVlen= 192/8,
+};
+
+typedef struct Salsastate Salsastate;
+struct Salsastate
+{
+ u32int input[16];
+ u32int key[8];
+ int rounds;
+ int ivwords;
+};
+
+void setupSalsastate(Salsastate*, uchar*, ulong, uchar*, ulong, int);
+void salsa_setiv(Salsastate*, uchar*);
+void salsa_setblock(Salsastate*, u64int);
+void salsa_encrypt(uchar*, ulong, Salsastate*);
+void salsa_encrypt2(uchar*, uchar*, ulong, Salsastate*);
+
+void hsalsa(uchar h[32], uchar *key, ulong keylen, uchar nonce[16], int rounds);
+
+/*
* DES definitions
*/