diff --git a/src/common/compat_libevent.c b/src/common/compat_libevent.c index 7a28c9bc9b0dd59d035eb31fc5679407808a602a..0cedef8d5e581c0d48bf8837c7dc6b2a86016a61 100644 --- a/src/common/compat_libevent.c +++ b/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(); diff --git a/src/common/tortls.c b/src/common/tortls.c index e4992efc6d9f59e556069567364ab12d787430d6..231be8272650ee50294dc40d22c24fc54e033a98 100644 --- a/src/common/tortls.c +++ b/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))) diff --git a/src/common/util.c b/src/common/util.c index a59cab0bbe590bc27ea4c2f2bf47acab599188d3..6d488d9963b6437fae5d75a25ed35a6e4938a860 100644 --- a/src/common/util.c +++ b/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; }