Module Name:    src
Committed By:   nia
Date:           Mon Nov 22 16:04:03 UTC 2021

Modified Files:
        src/sbin/cgdconfig: pkcs5_pbkdf2.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sbin/cgdconfig/pkcs5_pbkdf2.c

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

Modified files:

Index: src/sbin/cgdconfig/pkcs5_pbkdf2.c
diff -u src/sbin/cgdconfig/pkcs5_pbkdf2.c:1.16 src/sbin/cgdconfig/pkcs5_pbkdf2.c:1.17
--- src/sbin/cgdconfig/pkcs5_pbkdf2.c:1.16	Fri Jul  1 22:50:09 2016
+++ src/sbin/cgdconfig/pkcs5_pbkdf2.c	Mon Nov 22 16:04:03 2021
@@ -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 @@ pkcs5_pbkdf2_calibrate(size_t dkLen, int
 	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 @@ pkcs5_pbkdf2_calibrate(size_t dkLen, int
 		 */
 		for (c = 1;; c *= 2) {
 			t = pkcs5_pbkdf2_time(dkLen, c);
+			fprintf(stderr, ".");
 			if (t > CAL_TIME)
 				break;
 		}
@@ -214,7 +218,9 @@ pkcs5_pbkdf2_calibrate(size_t dkLen, int
 		/* 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;
 }

Reply via email to