Module Name:    src
Committed By:   nia
Date:           Mon Nov 22 14:30:25 UTC 2021

Modified Files:
        src/lib/libcrypt: crypt-argon2.c

Log Message:
crypt(3): document some of the memory units we're dealing with


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/lib/libcrypt/crypt-argon2.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/lib/libcrypt/crypt-argon2.c
diff -u src/lib/libcrypt/crypt-argon2.c:1.14 src/lib/libcrypt/crypt-argon2.c:1.15
--- src/lib/libcrypt/crypt-argon2.c:1.14	Wed Oct 20 20:21:44 2021
+++ src/lib/libcrypt/crypt-argon2.c	Mon Nov 22 14:30:24 2021
@@ -152,10 +152,10 @@ estimate_argon2_params(argon2_type atype
 	uint32_t tmp_hash[32];
 	char tmp_encoded[256];
 	struct rlimit rlim;
-	uint64_t max_mem;
+	uint64_t max_mem; /* usermem64 returns bytes */
 	size_t max_mem_sz = sizeof(max_mem);
 	/* low values from argon2 test suite... */
-	uint32_t memory = 256;
+	uint32_t memory = 256; /* 256k; argon2 wants kilobytes */
 	uint32_t time = 3;
 	uint32_t threads = 1;
 
@@ -177,7 +177,7 @@ estimate_argon2_params(argon2_type atype
 		 * Do we need to be concerned about memory usage during
 		 * concurrent connections?
 		 */
-		max_mem /= 1000000;
+		max_mem /= 1000000; /* bytes down to mb */
 		if (max_mem > 30000) {
 			memory = 32768;
 		} else if (max_mem > 15000) {

Reply via email to