Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 1204998 - Pre-clang-format tweaking, r=kaie
  • Loading branch information
martinthomson committed Sep 15, 2015
1 parent f529e47 commit 178a5a3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
24 changes: 15 additions & 9 deletions lib/ssl/ssl3ext.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -2040,17 +2044,19 @@ 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
* the initial handshake, we don't also send RI.
*/
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;
Expand Down
13 changes: 8 additions & 5 deletions lib/ssl/sslimpl.h
Expand Up @@ -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
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 178a5a3

Please sign in to comment.