Ver Fonte

corosync-keygen: Display number of needed bits

Instead of currently read bits, number of already read bits is
displayed to let the user know how long it's needed to "press keys"

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Christine Caulfield <ccaulfie@redhat.com>
Jan Friesse há 8 anos atrás
pai
commit
84b37ef1ef
2 ficheiros alterados com 9 adições e 8 exclusões
  1. 7 7
      man/corosync-keygen.8
  2. 2 1
      tools/corosync-keygen.c

+ 7 - 7
man/corosync-keygen.8

@@ -1,5 +1,5 @@
 .\"/*
-.\" * Copyright (C) 2010 Red Hat, Inc.
+.\" * Copyright (C) 2010-2017 Red Hat, Inc.
 .\" *
 .\" * All rights reserved.
 .\" *
@@ -31,7 +31,7 @@
 .\" * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 .\" * THE POSSIBILITY OF SUCH DAMAGE.
 .\" */
-.TH COROSYNC-KEYGEN 8 2017-06-23
+.TH COROSYNC-KEYGEN 8 2017-07-03
 .SH NAME
 corosync-keygen \- Generate an authentication key for Corosync.
 .SH SYNOPSIS
@@ -104,12 +104,12 @@ Generate superb key using /dev/random
 Corosync Cluster Engine Authentication key generator.
 Gathering 8192 bits for key from /dev/random.
 Press keys on your keyboard to generate entropy.
-Press keys on your keyboard to generate entropy (bits = 96).
-Press keys on your keyboard to generate entropy (bits = 144).
-Press keys on your keyboard to generate entropy (bits = 192).
+Press keys on your keyboard to generate entropy (7928 bits still needed).
+Press keys on your keyboard to generate entropy (7880 bits still needed).
  ...
-Press keys on your keyboard to generate entropy (bits = 8112).
-Press keys on your keyboard to generate entropy (bits = 8160).
+Press keys on your keyboard to generate entropy (104 bits still needed).
+Press keys on your keyboard to generate entropy (56 bits still needed).
+Press keys on your keyboard to generate entropy (8 bits still needed).
 Writing corosync key to /etc/corosync/authkey.
 .fi
 

+ 2 - 1
tools/corosync-keygen.c

@@ -156,7 +156,8 @@ retry_read:
 	}
 	bytes_read += res;
 	if (bytes_read != key_len) {
-		printf ("Press keys on your keyboard to generate entropy (bits = %d).\n", (int)(bytes_read * 8));
+		printf ("Press keys on your keyboard to generate entropy (%d bits still needed).\n",
+		    (int)((key_len - bytes_read) * 8));
 		goto retry_read;
 	}
 	close (random_fd);