code: plan9front

Download patch

ref: e25eabc46f31363d8a55a4cae195ef572424b003
parent: 3625532d2d10aaf7e8d1b685b86d08a0a4cf6c89
author: Jacob Moody <moody@posixcafe.org>
date: Sat Jul 22 22:34:37 EDT 2023

libsec: ansi-ify hkdf, pbkdf2 and scrypt

--- a/sys/src/libsec/port/hkdf.c
+++ b/sys/src/libsec/port/hkdf.c
@@ -3,11 +3,9 @@
 
 /* rfc5869 */
 void
-hkdf_x(salt, nsalt, info, ninfo, key, nkey, d, dlen, x, xlen)
-	uchar *salt, *info, *key, *d;
-	ulong nsalt, ninfo, nkey, dlen;
-	DigestState* (*x)(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
-	int xlen;
+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)
 {
 	uchar prk[256], tmp[256], cnt;
 	DigestState *ds;
--- a/sys/src/libsec/port/pbkdf2.c
+++ b/sys/src/libsec/port/pbkdf2.c
@@ -3,11 +3,9 @@
 
 /* rfc2898 */
 void
-pbkdf2_x(p, plen, s, slen, rounds, d, dlen, x, xlen)
-	uchar *p, *s, *d;
-	ulong plen, slen, dlen, rounds;
-	DigestState* (*x)(uchar*, ulong, uchar*, ulong, uchar*, DigestState*);
-	int xlen;
+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)
 {
 	uchar block[256], tmp[256];
 	ulong i, j, k, n;
--- a/sys/src/libsec/port/scrypt.c
+++ b/sys/src/libsec/port/scrypt.c
@@ -69,9 +69,8 @@
 }
 
 char*
-scrypt(p, plen, s, slen, N, R, P, d, dlen)
-	ulong plen, slen, dlen, N, R, P;
-	uchar *p, *s, *d;
+scrypt(uchar *p, ulong plen, uchar *s, ulong slen,
+	ulong N, ulong R, ulong P, uchar *d, ulong dlen)
 {
 	static char oom[] = "out of memory";