Source-Changes-HG archive

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

[src/trunk]: src/sbin/cgdconfig cgdconfig(8): add some console feedback when ...



details:   https://anonhg.NetBSD.org/src/rev/cbceec576b7e
branches:  trunk
changeset: 1026407:cbceec576b7e
user:      nia <nia%NetBSD.org@localhost>
date:      Mon Nov 22 16:04:03 2021 +0000

description:
cgdconfig(8): add some console feedback when calculating the number
of pkcs5_pbkdf2 iterations

diffstat:

 sbin/cgdconfig/pkcs5_pbkdf2.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (52 lines):

diff -r 03cf5c10d9ec -r cbceec576b7e sbin/cgdconfig/pkcs5_pbkdf2.c
--- a/sbin/cgdconfig/pkcs5_pbkdf2.c     Mon Nov 22 15:09:16 2021 +0000
+++ b/sbin/cgdconfig/pkcs5_pbkdf2.c     Mon Nov 22 16:04:03 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pkcs5_pbkdf2.c,v 1.16 2016/07/01 22:50:09 christos Exp $ */
+/* $NetBSD: pkcs5_pbkdf2.c,v 1.17 2021/11/22 16:04:03 nia Exp $ */
 
 /*-
  * Copyright (c) 2002, 2003 The NetBSD Foundation, Inc.
@@ -46,13 +46,14 @@
 
 #include <sys/cdefs.h>
 #ifndef lint
-__RCSID("$NetBSD: pkcs5_pbkdf2.c,v 1.16 2016/07/01 22:50:09 christos Exp $");
+__RCSID("$NetBSD: pkcs5_pbkdf2.c,v 1.17 2021/11/22 16:04:03 nia Exp $");
 #endif
 
 #include <sys/resource.h>
 #include <sys/endian.h>
 
 #include <assert.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <err.h>
@@ -189,6 +190,8 @@
        int     t = 0;
        size_t  ret, i;
 
+       fprintf(stderr, "pkcs5_pbkdf2: calibrating iterations...");
+
        for (i = 0; i < 5; i++) {
                /*
                 * First we get a meaningfully long time by doubling the
@@ -197,6 +200,7 @@
                 */
                for (c = 1;; c *= 2) {
                        t = pkcs5_pbkdf2_time(dkLen, c);
+                       fprintf(stderr, ".");
                        if (t > CAL_TIME)
                                break;
                }
@@ -214,7 +218,9 @@
                /* if we are over 5% off, return an error */
                if (abs(microseconds - t) > (microseconds / 20))
                        continue;
+               fprintf(stderr, " done\n");
                return ret;
        }
+       fprintf(stderr, " failed\n");
        return -1;
 }



Home | Main Index | Thread Index | Old Index