aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-11-27 09:24:41 -0500
committerSebastian Hahn <sebastian@torproject.org>2011-12-08 08:45:24 +0100
commit71ecfaa52ff4cd0d71171fea1b68f663114580a8 (patch)
tree5e7529545caf9102142341500d91b1cb34166538
parentee8b4b4e6e5cebee97678325f80de374a5a33ccc (diff)
downloadtor-71ecfaa52ff4cd0d71171fea1b68f663114580a8.tar
tor-71ecfaa52ff4cd0d71171fea1b68f663114580a8.tar.gz
indent; add comment
This re-applies 40a87c4c08be0cdd87a3df283f285b3c2a0c8445 which got accidentally reverted in 75134c6c86e54c10fd9e11c4345aadcdabc0f8fb. Thanks asn for spotting this.
-rw-r--r--src/common/tortls.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c
index e4992efc6..231be8272 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)))