summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2013-10-26 10:05:46 +1100
committerDamien Miller <djm@mindrot.org>2013-10-26 10:05:46 +1100
commit26506ad29350c5681815745cc90b3952a84cf118 (patch)
tree797fb5763b2569bb1e15f86a5d3afe707ed88680
parentbd43e8872325e9bbb3319c89da593614709f317c (diff)
- (djm) [ssh-keygen.c ssh-keysign.c sshconnect1.c sshd.c] Remove
unnecessary arc4random_stir() calls. The only ones left are to ensure that the PRNG gets a different state after fork() for platforms that have broken the API.
-rw-r--r--ChangeLog6
-rw-r--r--ssh-keygen.c5
-rw-r--r--ssh-keysign.c1
-rw-r--r--sshconnect1.c3
-rw-r--r--sshd.c4
5 files changed, 6 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index e396e470e..d32065913 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
120131025
2 - (djm) [ssh-keygen.c ssh-keysign.c sshconnect1.c sshd.c] Remove
3 unnecessary arc4random_stir() calls. The only ones left are to ensure
4 that the PRNG gets a different state after fork() for platforms that
5 have broken the API.
6
120131024 720131024
2 - (djm) [auth-krb5.c] bz#2032 - use local username in krb5_kuserok check 8 - (djm) [auth-krb5.c] bz#2032 - use local username in krb5_kuserok check
3 rather than full client name which may be of form user@REALM; 9 rather than full client name which may be of form user@REALM;
diff --git a/ssh-keygen.c b/ssh-keygen.c
index b664a5f1f..678dafe87 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -910,7 +910,6 @@ do_gen_all_hostkeys(struct passwd *pw)
910 } 910 }
911 printf("%s ", key_types[i].key_type_display); 911 printf("%s ", key_types[i].key_type_display);
912 fflush(stdout); 912 fflush(stdout);
913 arc4random_stir();
914 type = key_type_from_name(key_types[i].key_type); 913 type = key_type_from_name(key_types[i].key_type);
915 strlcpy(identity_file, key_types[i].path, sizeof(identity_file)); 914 strlcpy(identity_file, key_types[i].path, sizeof(identity_file));
916 bits = 0; 915 bits = 0;
@@ -932,7 +931,6 @@ do_gen_all_hostkeys(struct passwd *pw)
932 continue; 931 continue;
933 } 932 }
934 key_free(private); 933 key_free(private);
935 arc4random_stir();
936 strlcat(identity_file, ".pub", sizeof(identity_file)); 934 strlcat(identity_file, ".pub", sizeof(identity_file));
937 fd = open(identity_file, O_WRONLY | O_CREAT | O_TRUNC, 0644); 935 fd = open(identity_file, O_WRONLY | O_CREAT | O_TRUNC, 0644);
938 if (fd == -1) { 936 if (fd == -1) {
@@ -2543,8 +2541,6 @@ main(int argc, char **argv)
2543 return (0); 2541 return (0);
2544 } 2542 }
2545 2543
2546 arc4random_stir();
2547
2548 if (key_type_name == NULL) 2544 if (key_type_name == NULL)
2549 key_type_name = "rsa"; 2545 key_type_name = "rsa";
2550 2546
@@ -2638,7 +2634,6 @@ passphrase_again:
2638 2634
2639 /* Clear the private key and the random number generator. */ 2635 /* Clear the private key and the random number generator. */
2640 key_free(private); 2636 key_free(private);
2641 arc4random_stir();
2642 2637
2643 if (!quiet) 2638 if (!quiet)
2644 printf("Your identification has been saved in %s.\n", identity_file); 2639 printf("Your identification has been saved in %s.\n", identity_file);
diff --git a/ssh-keysign.c b/ssh-keysign.c
index b67ed1ead..518373bf8 100644
--- a/ssh-keysign.c
+++ b/ssh-keysign.c
@@ -179,7 +179,6 @@ main(int argc, char **argv)
179 permanently_set_uid(pw); 179 permanently_set_uid(pw);
180 180
181 seed_rng(); 181 seed_rng();
182 arc4random_stir();
183 182
184#ifdef DEBUG_SSH_KEYSIGN 183#ifdef DEBUG_SSH_KEYSIGN
185 log_init("ssh-keysign", SYSLOG_LEVEL_DEBUG3, SYSLOG_FACILITY_AUTH, 0); 184 log_init("ssh-keysign", SYSLOG_LEVEL_DEBUG3, SYSLOG_FACILITY_AUTH, 0);
diff --git a/sshconnect1.c b/sshconnect1.c
index f4b890773..7bd6cb018 100644
--- a/sshconnect1.c
+++ b/sshconnect1.c
@@ -542,9 +542,6 @@ ssh_kex(char *host, struct sockaddr *hostaddr)
542 542
543 derive_ssh1_session_id(host_key->rsa->n, server_key->rsa->n, cookie, session_id); 543 derive_ssh1_session_id(host_key->rsa->n, server_key->rsa->n, cookie, session_id);
544 544
545 /* Generate a session key. */
546 arc4random_stir();
547
548 /* 545 /*
549 * Generate an encryption key for the session. The key is a 256 bit 546 * Generate an encryption key for the session. The key is a 256 bit
550 * random number, interpreted as a 32-byte key, with the least 547 * random number, interpreted as a 32-byte key, with the least
diff --git a/sshd.c b/sshd.c
index c9ead2e7f..d4349f618 100644
--- a/sshd.c
+++ b/sshd.c
@@ -398,7 +398,6 @@ generate_ephemeral_server_key(void)
398 verbose("RSA key generation complete."); 398 verbose("RSA key generation complete.");
399 399
400 arc4random_buf(sensitive_data.ssh1_cookie, SSH_SESSION_KEY_LENGTH); 400 arc4random_buf(sensitive_data.ssh1_cookie, SSH_SESSION_KEY_LENGTH);
401 arc4random_stir();
402} 401}
403 402
404/*ARGSUSED*/ 403/*ARGSUSED*/
@@ -1867,9 +1866,6 @@ main(int ac, char **av)
1867 /* Reinitialize the log (because of the fork above). */ 1866 /* Reinitialize the log (because of the fork above). */
1868 log_init(__progname, options.log_level, options.log_facility, log_stderr); 1867 log_init(__progname, options.log_level, options.log_facility, log_stderr);
1869 1868
1870 /* Initialize the random number generator. */
1871 arc4random_stir();
1872
1873 /* Chdir to the root directory so that the current disk can be 1869 /* Chdir to the root directory so that the current disk can be
1874 unmounted if desired. */ 1870 unmounted if desired. */
1875 if (chdir("/") == -1) 1871 if (chdir("/") == -1)