Browse Source

Merge remote-tracking branch 'sebastian/bug4672'

Roger Dingledine 12 years ago
parent
commit
97bd03661c
3 changed files with 12 additions and 11 deletions
  1. 2 3
      src/common/compat_libevent.c
  2. 8 6
      src/common/tortls.c
  3. 2 2
      src/common/util.c

+ 2 - 3
src/common/compat_libevent.c

@@ -243,8 +243,8 @@ tor_libevent_initialize(tor_libevent_cfg *torcfg)
        * again. */
 #if defined(MS_WINDOWS) && defined(USE_BUFFEREVENTS)
       if (torcfg->disable_iocp == 0) {
-        log_warn(LD_GENERAL, "Unable to initialize Libevent. Trying again with "
-                 "IOCP disabled.");
+        log_warn(LD_GENERAL, "Unable to initialize Libevent. Trying again "
+                 "with IOCP disabled.");
       } else
 #endif
       {
@@ -254,7 +254,6 @@ tor_libevent_initialize(tor_libevent_cfg *torcfg)
       torcfg->disable_iocp = 1;
       goto retry;
     }
-
   }
 #else
   the_event_base = event_init();

+ 8 - 6
src/common/tortls.c

@@ -580,6 +580,8 @@ tor_tls_create_certificate(crypto_pk_env_t *rsa,
                            const char *cname_sign,
                            unsigned int cert_lifetime)
 {
+  /* OpenSSL generates self-signed certificates with random 64-bit serial
+   * numbers, so let's do that too. */
 #define SERIAL_NUMBER_SIZE 8
 
   time_t start_time, end_time;
@@ -607,12 +609,12 @@ tor_tls_create_certificate(crypto_pk_env_t *rsa,
     goto error;
 
   { /* our serial number is 8 random bytes. */
-  if (crypto_rand((char *)serial_tmp, sizeof(serial_tmp)) < 0)
-    goto error;
-  if (!(serial_number = BN_bin2bn(serial_tmp, sizeof(serial_tmp), NULL)))
-    goto error;
-  if (!(BN_to_ASN1_INTEGER(serial_number, X509_get_serialNumber(x509))))
-    goto error;
+    if (crypto_rand((char *)serial_tmp, sizeof(serial_tmp)) < 0)
+      goto error;
+    if (!(serial_number = BN_bin2bn(serial_tmp, sizeof(serial_tmp), NULL)))
+      goto error;
+    if (!(BN_to_ASN1_INTEGER(serial_number, X509_get_serialNumber(x509))))
+      goto error;
   }
 
   if (!(name = tor_x509_name_new(cname)))

+ 2 - 2
src/common/util.c

@@ -3661,8 +3661,8 @@ tor_get_exit_code(const process_handle_t *process_handle,
     /* Process has not exited */
     return PROCESS_EXIT_RUNNING;
   } else if (retval != process_handle->pid) {
-    log_warn(LD_GENERAL, "waitpid() failed for PID %d: %s", process_handle->pid,
-             strerror(errno));
+    log_warn(LD_GENERAL, "waitpid() failed for PID %d: %s",
+             process_handle->pid, strerror(errno));
     return PROCESS_EXIT_ERROR;
   }