libsec: add scrypt password based key derivation function

This commit is contained in:
cinap_lenrek 2016-07-10 21:41:57 +02:00
parent 677dd90b02
commit 1492f46f87
6 changed files with 210 additions and 84 deletions

View file

@ -146,6 +146,8 @@ void salsa_setblock(Salsastate*, u64int);
void salsa_encrypt(uchar*, ulong, Salsastate*);
void salsa_encrypt2(uchar*, uchar*, ulong, Salsastate*);
void salsa_core(u32int in[16], u32int out[16], int rounds);
void hsalsa(uchar h[32], uchar *key, ulong keylen, uchar nonce[16], int rounds);
/*
@ -567,6 +569,11 @@ void curve25519_dh_finish(uchar x[32], uchar y[32], uchar z[32]);
void pbkdf2_x(uchar *p, ulong plen, uchar *s, ulong slen, ulong rounds, uchar *d, ulong dlen,
DigestState* (*x)(uchar*, ulong, uchar*, ulong, uchar*, DigestState*), int xlen);
/* scrypt password-based key derivation function */
char* scrypt(uchar *p, ulong plen, uchar *s, ulong slen,
ulong N, ulong R, ulong P,
uchar *d, ulong dlen);
/* hmac-based key derivation function (rfc5869) */
void hkdf_x(uchar *salt, ulong nsalt, uchar *info, ulong ninfo, uchar *key, ulong nkey, uchar *d, ulong dlen,
DigestState* (*x)(uchar*, ulong, uchar*, ulong, uchar*, DigestState*), int xlen);