Source-Changes-HG archive

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

[src/trunk]: src/lib/libcrypt crypt(3): document some of the memory units we'...



details:   https://anonhg.NetBSD.org/src/rev/a7f4d6140bc4
branches:  trunk
changeset: 1026404:a7f4d6140bc4
user:      nia <nia%NetBSD.org@localhost>
date:      Mon Nov 22 14:30:24 2021 +0000

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

diffstat:

 lib/libcrypt/crypt-argon2.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (25 lines):

diff -r 9c620d943838 -r a7f4d6140bc4 lib/libcrypt/crypt-argon2.c
--- a/lib/libcrypt/crypt-argon2.c       Mon Nov 22 12:30:34 2021 +0000
+++ b/lib/libcrypt/crypt-argon2.c       Mon Nov 22 14:30:24 2021 +0000
@@ -152,10 +152,10 @@
        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 @@
                 * 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) {



Home | Main Index | Thread Index | Old Index