diff options
author | Martin Thomson <martin.thomson@gmail.com> | 2015-09-15 14:10:41 -0700 |
---|---|---|
committer | Martin Thomson <martin.thomson@gmail.com> | 2015-09-15 14:10:41 -0700 |
commit | cfbb41b0534628a08a02ac3adb0f3258b967dc2b (patch) | |
tree | bcfd5b208230f42387d42624ffd227f6181b9999 | |
parent | 1f82bbdff43a8dc4cf888074849d52c4e6598eda (diff) | |
download | nss-hg-cfbb41b0534628a08a02ac3adb0f3258b967dc2b.tar.gz |
Bug 1204998 - Pre-clang-format tweaking, r=kaie
-rw-r--r-- | lib/ssl/ssl3ext.c | 24 | ||||
-rw-r--r-- | lib/ssl/sslimpl.h | 13 |
2 files changed, 23 insertions, 14 deletions
diff --git a/lib/ssl/ssl3ext.c b/lib/ssl/ssl3ext.c index cf04abaed..7931618e0 100644 --- a/lib/ssl/ssl3ext.c +++ b/lib/ssl/ssl3ext.c @@ -1077,7 +1077,7 @@ ssl3_SendNewSessionTicket(sslSocket *ss) SSL3KEAType effectiveExchKeyType = ssl_kea_null; PRUint32 padding_length; PRUint32 message_length; - PRUint32 cert_length; + PRUint32 cert_length = 0; PRUint8 length_buf[4]; PRUint32 now; PK11SymKey *aes_key_pkcs11; @@ -1113,8 +1113,9 @@ ssl3_SendNewSessionTicket(sslSocket *ss) PORT_Assert( ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss)); ticket.ticket_lifetime_hint = TLS_EX_SESS_TICKET_LIFETIME_HINT; - cert_length = (ss->opt.requestCertificate && ss->sec.ci.sid->peerCert) ? - 3 + ss->sec.ci.sid->peerCert->derCert.len : 0; + if (ss->opt.requestCertificate && ss->sec.ci.sid->peerCert) { + cert_length = 3 + ss->sec.ci.sid->peerCert->derCert.len; + } /* Get IV and encryption keys */ ivItem.data = iv; @@ -2010,8 +2011,11 @@ ssl3_CallHelloExtensionSenders(sslSocket *ss, PRBool append, PRUint32 maxBytes, int i; if (!sender) { - sender = ss->version > SSL_LIBRARY_VERSION_3_0 ? - &clientHelloSendersTLS[0] : &clientHelloSendersSSL3[0]; + if (ss->version > SSL_LIBRARY_VERSION_3_0) { + sender = &clientHelloSendersTLS[0]; + } else { + sender = &clientHelloSendersSSL3[0]; + } } for (i = 0; i < SSL_MAX_EXTENSIONS; ++i, ++sender) { @@ -2040,7 +2044,8 @@ ssl3_SendRenegotiationInfoXtn( PRBool append, PRUint32 maxBytes) { - PRInt32 len, needed; + PRInt32 len = 0; + PRInt32 needed; /* In draft-ietf-tls-renegotiation-03, it is NOT RECOMMENDED to send * both the SCSV and the empty RI, so when we send SCSV in @@ -2048,9 +2053,10 @@ ssl3_SendRenegotiationInfoXtn( */ if (!ss || ss->ssl3.hs.sendingSCSV) return 0; - len = !ss->firstHsDone ? 0 : - (ss->sec.isServer ? ss->ssl3.hs.finishedBytes * 2 - : ss->ssl3.hs.finishedBytes); + if (ss->firstHsDone) { + len = ss->sec.isServer ? ss->ssl3.hs.finishedBytes * 2 + : ss->ssl3.hs.finishedBytes; + } needed = 5 + len; if (maxBytes < (PRUint32)needed) { return 0; diff --git a/lib/ssl/sslimpl.h b/lib/ssl/sslimpl.h index ad31aaef7..6dad6a7e9 100644 --- a/lib/ssl/sslimpl.h +++ b/lib/ssl/sslimpl.h @@ -497,9 +497,9 @@ typedef PRUint16 DTLSEpoch; typedef void (*DTLSTimerCb)(sslSocket *); -#define MAX_MAC_CONTEXT_BYTES 400 /* 400 is large enough for MD5, SHA-1, and - * SHA-256. For SHA-384 support, increase - * it to 712. */ +/* 400 is large enough for MD5, SHA-1, and SHA-256. + * For SHA-384 support, increase it to 712. */ +#define MAX_MAC_CONTEXT_BYTES 400 #define MAX_MAC_CONTEXT_LLONGS (MAX_MAC_CONTEXT_BYTES / 8) #define MAX_CIPHER_CONTEXT_BYTES 2080 @@ -1011,8 +1011,9 @@ struct ssl3StateStr { unsigned int signatureAlgorithmCount; }; -#define DTLS_MAX_MTU 1500U /* Ethernet MTU but without subtracting the - * headers, so slightly larger than expected */ +/* Ethernet MTU but without subtracting the headers, + * so slightly larger than expected */ +#define DTLS_MAX_MTU 1500U #define IS_DTLS(ss) (ss->protocolVariant == ssl_variant_datagram) typedef struct { @@ -1648,11 +1649,13 @@ extern PRUint32 ssl3_GetSupportedECCurveMask(sslSocket *ss); /* Macro for finding a curve equivalent in strength to RSA key's */ +/* clang-format off */ #define SSL_RSASTRENGTH_TO_ECSTRENGTH(s) \ ((s <= 1024) ? 160 \ : ((s <= 2048) ? 224 \ : ((s <= 3072) ? 256 \ : ((s <= 7168) ? 384 : 521 ) ) ) ) +/* clang-format on */ /* Types and names of elliptic curves used in TLS */ typedef enum { ec_type_explicitPrime = 1, |