tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: [PATCH] argon2 key generation method for cgdconfig(8)



On 2021/11/06 18:42, Taylor R Campbell wrote:
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ sbin/cgdconfig/argon2_utils.c	6 Nov 2021 00:17:48 -0000
[...]
+	mem = usermem / 100000;

What units are these in?  Maybe add a comment explaining so the number
100000 is a little more obvious?


We have a similar code in libcrypt:

https://nxr.netbsd.org/xref/src/lib/libcrypt/crypt-argon2.c#180

But denominator is 10^5 here, and 10^6 there. Can you add a comment
also for libcrypt?

+static uint64_t
+get_usermem(void)
+{
(snip)
+	if (sysctl(mib, __arraycount(mib),
+	    &usermem64, &usermem64_len, NULL, 0) < 0) {
+		return 1;
+	}

I think this 1 is misleading. 0 is better?

+void
+argon2id_calibrate(size_t keylen, size_t saltlen,
+    size_t *iterations, size_t *memory, size_t *parallelism)
(snip)
+	if (mem < ARGON2_MIN_MEMORY)
+		mem = 256;

What is relation b/w ARGON2_MIN_MEMORY and magic number 256?

Thanks,
rin


Home | Main Index | Thread Index | Old Index