diff options
Diffstat (limited to 'net/third_party/nss/ssl')
-rw-r--r-- | net/third_party/nss/ssl/ssl.h | 2 | ||||
-rw-r--r-- | net/third_party/nss/ssl/ssl3con.c | 108 | ||||
-rw-r--r-- | net/third_party/nss/ssl/ssl3ext.c | 148 | ||||
-rw-r--r-- | net/third_party/nss/ssl/sslimpl.h | 8 | ||||
-rw-r--r-- | net/third_party/nss/ssl/sslsock.c | 24 | ||||
-rw-r--r-- | net/third_party/nss/ssl/sslt.h | 6 |
6 files changed, 39 insertions, 257 deletions
diff --git a/net/third_party/nss/ssl/ssl.h b/net/third_party/nss/ssl/ssl.h index 8885575..1368e2f 100644 --- a/net/third_party/nss/ssl/ssl.h +++ b/net/third_party/nss/ssl/ssl.h @@ -191,8 +191,6 @@ SSL_IMPORT PRFileDesc *DTLS_ImportFD(PRFileDesc *model, PRFileDesc *fd); */ #define SSL_CBC_RANDOM_IV 23 #define SSL_ENABLE_OCSP_STAPLING 24 /* Request OCSP stapling (client) */ -#define SSL_ENABLE_OB_CERTS 25 /* Enable origin bound certs. */ -#define SSL_ENCRYPT_CLIENT_CERTS 26 /* Enable encrypted client certs. */ #ifdef SSL_DEPRECATED_FUNCTION /* Old deprecated function names */ diff --git a/net/third_party/nss/ssl/ssl3con.c b/net/third_party/nss/ssl/ssl3con.c index 55e4901..db9fad3 100644 --- a/net/third_party/nss/ssl/ssl3con.c +++ b/net/third_party/nss/ssl/ssl3con.c @@ -2991,14 +2991,7 @@ ssl3_HandleChangeCipherSpecs(sslSocket *ss, sslBuffer *buf) ss->ssl3.prSpec = ss->ssl3.crSpec; ss->ssl3.crSpec = prSpec; - - if (ss->sec.isServer && - ss->opt.requestCertificate && - ssl3_ExtensionNegotiated(ss, ssl_encrypted_client_certs)) { - ss->ssl3.hs.ws = wait_client_cert; - } else { - ss->ssl3.hs.ws = wait_finished; - } + ss->ssl3.hs.ws = wait_finished; SSL_TRC(3, ("%d: SSL3[%d] Set Current Read Cipher Suite to Pending", SSL_GETPID(), ss->fd )); @@ -5087,11 +5080,10 @@ loser: static SECStatus ssl3_SendCertificateVerify(sslSocket *ss) { - SECStatus rv = SECFailure; - PRBool isTLS; - SECItem buf = {siBuffer, NULL, 0}; - SSL3Hashes hashes; - ssl3CipherSpec *spec; + SECStatus rv = SECFailure; + PRBool isTLS; + SECItem buf = {siBuffer, NULL, 0}; + SSL3Hashes hashes; PORT_Assert( ss->opt.noLocks || ssl_HaveXmitBufLock(ss)); PORT_Assert( ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss)); @@ -5100,17 +5092,13 @@ ssl3_SendCertificateVerify(sslSocket *ss) SSL_GETPID(), ss->fd)); ssl_GetSpecReadLock(ss); - spec = ss->ssl3.pwSpec; - if (ssl3_ExtensionNegotiated(ss, ssl_encrypted_client_certs)) { - spec = ss->ssl3.cwSpec; - } - rv = ssl3_ComputeHandshakeHashes(ss, spec, &hashes, 0); + rv = ssl3_ComputeHandshakeHashes(ss, ss->ssl3.pwSpec, &hashes, 0); ssl_ReleaseSpecReadLock(ss); if (rv != SECSuccess) { goto done; /* err code was set by ssl3_ComputeHandshakeHashes */ } - isTLS = (PRBool)(spec->version > SSL_LIBRARY_VERSION_3_0); + isTLS = (PRBool)(ss->ssl3.pwSpec->version > SSL_LIBRARY_VERSION_3_0); if (ss->ssl3.platformClientKey) { #ifdef NSS_PLATFORM_CLIENT_AUTH rv = ssl3_PlatformSignHashes(&hashes, ss->ssl3.platformClientKey, @@ -6165,10 +6153,6 @@ ssl3_SendClientSecondRound(sslSocket *ss) { SECStatus rv; PRBool sendClientCert; - PRBool sendEmptyCert; - int n = 0, i; - typedef SECStatus (*SendFunction)(sslSocket*); - SendFunction send_funcs[5]; PORT_Assert( ss->opt.noLocks || ssl_HaveRecvBufLock(ss) ); PORT_Assert( ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss) ); @@ -6215,40 +6199,35 @@ ssl3_SendClientSecondRound(sslSocket *ss) ssl_GetXmitBufLock(ss); /*******************************/ - sendEmptyCert = ss->ssl3.sendEmptyCert; - ss->ssl3.sendEmptyCert = PR_FALSE; - - if (ssl3_ExtensionNegotiated(ss, ssl_encrypted_client_certs)) { - send_funcs[n++] = ssl3_SendClientKeyExchange; - send_funcs[n++] = ssl3_SendChangeCipherSpecs; - if (sendEmptyCert) { - send_funcs[n++] = ssl3_SendEmptyCertificate; - } - if (sendClientCert) { - send_funcs[n++] = ssl3_SendCertificate; - send_funcs[n++] = ssl3_SendCertificateVerify; - } - } else { - if (sendEmptyCert) { - send_funcs[n++] = ssl3_SendEmptyCertificate; - } - if (sendClientCert) { - send_funcs[n++] = ssl3_SendCertificate; - } - send_funcs[n++] = ssl3_SendClientKeyExchange; - if (sendClientCert) { - send_funcs[n++] = ssl3_SendCertificateVerify; - } - send_funcs[n++] = ssl3_SendChangeCipherSpecs; + if (ss->ssl3.sendEmptyCert) { + ss->ssl3.sendEmptyCert = PR_FALSE; + rv = ssl3_SendEmptyCertificate(ss); + /* Don't send verify */ + if (rv != SECSuccess) { + goto loser; /* error code is set. */ + } + } else if (sendClientCert) { + rv = ssl3_SendCertificate(ss); + if (rv != SECSuccess) { + goto loser; /* error code is set. */ + } } - PORT_Assert(n <= sizeof(send_funcs)/sizeof(send_funcs[0])); + rv = ssl3_SendClientKeyExchange(ss); + if (rv != SECSuccess) { + goto loser; /* err is set. */ + } - for (i = 0; i < n; i++) { - rv = send_funcs[i](ss); + if (sendClientCert) { + rv = ssl3_SendCertificateVerify(ss); if (rv != SECSuccess) { - goto loser; /* err code was set. */ - } + goto loser; /* err is set. */ + } + } + + rv = ssl3_SendChangeCipherSpecs(ss); + if (rv != SECSuccess) { + goto loser; /* err code was set. */ } /* XXX: If the server's certificate hasn't been authenticated by this @@ -6463,13 +6442,8 @@ ssl3_SendServerHelloSequence(sslSocket *ss) return rv; /* err code is set. */ } - if (ss->opt.requestCertificate && - !ssl3_ExtensionNegotiated(ss, ssl_encrypted_client_certs)) { - ss->ssl3.hs.ws = wait_client_cert; - } else { - ss->ssl3.hs.ws = wait_client_key; - } - + ss->ssl3.hs.ws = (ss->opt.requestCertificate) ? wait_client_cert + : wait_client_key; return SECSuccess; } @@ -7766,11 +7740,7 @@ ssl3_HandleCertificateVerify(sslSocket *ss, SSL3Opaque *b, PRUint32 length, desc = isTLS ? decode_error : illegal_parameter; goto alert_loser; /* malformed */ } - if (ssl3_ExtensionNegotiated(ss, ssl_encrypted_client_certs)) { - ss->ssl3.hs.ws = wait_finished; - } else { - ss->ssl3.hs.ws = wait_change_cipher; - } + ss->ssl3.hs.ws = wait_change_cipher; return SECSuccess; alert_loser: @@ -8683,11 +8653,7 @@ ssl3_HandleCertificate(sslSocket *ss, SSL3Opaque *b, PRUint32 length) } } else { server_no_cert: - if (ssl3_ExtensionNegotiated(ss, ssl_encrypted_client_certs)) { - ss->ssl3.hs.ws = wait_cert_verify; - } else { - ss->ssl3.hs.ws = wait_client_key; - } + ss->ssl3.hs.ws = wait_client_key; } PORT_Assert(rv == SECSuccess); @@ -9302,8 +9268,6 @@ ssl3_HandleHandshakeMessage(sslSocket *ss, SSL3Opaque *b, PRUint32 length) if (type == finished) { sender = ss->sec.isServer ? sender_client : sender_server; rSpec = ss->ssl3.crSpec; - } else if (ssl3_ExtensionNegotiated(ss, ssl_encrypted_client_certs)) { - rSpec = ss->ssl3.crSpec; } rv = ssl3_ComputeHandshakeHashes(ss, rSpec, &hashes, sender); } diff --git a/net/third_party/nss/ssl/ssl3ext.c b/net/third_party/nss/ssl/ssl3ext.c index 6d5866b..b9fd6e7 100644 --- a/net/third_party/nss/ssl/ssl3ext.c +++ b/net/third_party/nss/ssl/ssl3ext.c @@ -84,12 +84,6 @@ static SECStatus ssl3_ServerHandleNextProtoNegoXtn(sslSocket *ss, PRUint16 ex_type, SECItem *data); static PRInt32 ssl3_ClientSendNextProtoNegoXtn(sslSocket *ss, PRBool append, PRUint32 maxBytes); -static SECStatus ssl3_ServerHandleEncryptedClientCertsXtn(sslSocket *ss, - PRUint16 ex_type, SECItem *data); -static SECStatus ssl3_ClientHandleEncryptedClientCertsXtn(sslSocket *ss, - PRUint16 ex_type, SECItem *data); -static PRInt32 ssl3_SendEncryptedClientCertsXtn(sslSocket *ss, - PRBool append, PRUint32 maxBytes); /* * Write bytes. Using this function means the SECItem structure @@ -246,10 +240,8 @@ static const ssl3HelloExtensionHandler clientHelloHandlers[] = { { ssl_ec_point_formats_xtn, &ssl3_HandleSupportedPointFormatsXtn }, #endif { ssl_session_ticket_xtn, &ssl3_ServerHandleSessionTicketXtn }, - { ssl_encrypted_client_certs, &ssl3_ServerHandleEncryptedClientCertsXtn }, { ssl_renegotiation_info_xtn, &ssl3_HandleRenegotiationInfoXtn }, { ssl_next_proto_nego_xtn, &ssl3_ServerHandleNextProtoNegoXtn }, - { ssl_ob_cert_xtn, &ssl3_ServerHandleOBCertXtn }, { -1, NULL } }; @@ -259,11 +251,9 @@ static const ssl3HelloExtensionHandler serverHelloHandlersTLS[] = { { ssl_server_name_xtn, &ssl3_HandleServerNameXtn }, /* TODO: add a handler for ssl_ec_point_formats_xtn */ { ssl_session_ticket_xtn, &ssl3_ClientHandleSessionTicketXtn }, - { ssl_encrypted_client_certs, &ssl3_ClientHandleEncryptedClientCertsXtn }, { ssl_renegotiation_info_xtn, &ssl3_HandleRenegotiationInfoXtn }, { ssl_next_proto_nego_xtn, &ssl3_ClientHandleNextProtoNegoXtn }, { ssl_cert_status_xtn, &ssl3_ClientHandleStatusRequestXtn }, - { ssl_ob_cert_xtn, &ssl3_ClientHandleOBCertXtn }, { -1, NULL } }; @@ -287,10 +277,8 @@ ssl3HelloExtensionSender clientHelloSendersTLS[SSL_MAX_EXTENSIONS] = { { ssl_ec_point_formats_xtn, &ssl3_SendSupportedPointFormatsXtn }, #endif { ssl_session_ticket_xtn, &ssl3_SendSessionTicketXtn }, - { ssl_encrypted_client_certs, &ssl3_SendEncryptedClientCertsXtn }, { ssl_next_proto_nego_xtn, &ssl3_ClientSendNextProtoNegoXtn }, - { ssl_cert_status_xtn, &ssl3_ClientSendStatusRequestXtn }, - { ssl_ob_cert_xtn, &ssl3_SendOBCertXtn } + { ssl_cert_status_xtn, &ssl3_ClientSendStatusRequestXtn } /* any extra entries will appear as { 0, NULL } */ }; @@ -1099,18 +1087,6 @@ ssl3_ClientHandleSessionTicketXtn(sslSocket *ss, PRUint16 ex_type, return SECSuccess; } -static SECStatus -ssl3_ClientHandleEncryptedClientCertsXtn(sslSocket *ss, PRUint16 ex_type, - SECItem *data) -{ - if (data->len != 0) - return SECFailure; - - /* Keep track of negotiated extensions. */ - ss->xtnData.negotiated[ss->xtnData.numNegotiated++] = ex_type; - return SECSuccess; -} - SECStatus ssl3_ServerHandleSessionTicketXtn(sslSocket *ss, PRUint16 ex_type, SECItem *data) @@ -1524,24 +1500,6 @@ loser: return rv; } -static SECStatus -ssl3_ServerHandleEncryptedClientCertsXtn(sslSocket *ss, PRUint16 ex_type, - SECItem *data) -{ - SECStatus rv = SECSuccess; - - if (data->len != 0) - return SECFailure; - - if (ss->opt.encryptClientCerts) { - ss->xtnData.negotiated[ss->xtnData.numNegotiated++] = ex_type; - rv = ssl3_RegisterServerHelloExtensionSender( - ss, ex_type, ssl3_SendEncryptedClientCertsXtn); - } - - return rv; -} - /* * Read bytes. Using this function means the SECItem structure * cannot be freed. The caller is expected to call this function @@ -1741,33 +1699,6 @@ ssl3_SendRenegotiationInfoXtn( return needed; } -static PRInt32 -ssl3_SendEncryptedClientCertsXtn( - sslSocket * ss, - PRBool append, - PRUint32 maxBytes) -{ - PRInt32 needed; - - if (!ss->opt.encryptClientCerts) - return 0; - - needed = 4; /* two bytes of type and two of length. */ - if (append && maxBytes >= needed) { - SECStatus rv; - rv = ssl3_AppendHandshakeNumber(ss, ssl_encrypted_client_certs, 2); - if (rv != SECSuccess) - return -1; - rv = ssl3_AppendHandshakeNumber(ss, 0 /* length */, 2); - if (rv != SECSuccess) - return -1; - ss->xtnData.advertised[ss->xtnData.numAdvertised++] = - ssl_encrypted_client_certs; - } - - return needed; -} - /* This function runs in both the client and server. */ static SECStatus ssl3_HandleRenegotiationInfoXtn(sslSocket *ss, PRUint16 ex_type, SECItem *data) @@ -1799,80 +1730,3 @@ ssl3_HandleRenegotiationInfoXtn(sslSocket *ss, PRUint16 ex_type, SECItem *data) return rv; } -/* This sender is used by both the client and server. */ -PRInt32 -ssl3_SendOBCertXtn(sslSocket * ss, PRBool append, - PRUint32 maxBytes) -{ - SECStatus rv; - PRUint32 extension_length; - - if (!ss) - return 0; - - if (!ss->opt.enableOBCerts) - return 0; - - /* extension length = extension_type (2-bytes) + - * length(extension_data) (2-bytes) + - */ - - extension_length = 4; - - if (append && maxBytes >= extension_length) { - /* extension_type */ - rv = ssl3_AppendHandshakeNumber(ss, ssl_ob_cert_xtn, 2); - if (rv != SECSuccess) return -1; - /* length of extension_data */ - rv = ssl3_AppendHandshakeNumber(ss, extension_length - 4, 2); - if (rv != SECSuccess) return -1; - - if (!ss->sec.isServer) { - TLSExtensionData *xtnData = &ss->xtnData; - xtnData->advertised[xtnData->numAdvertised++] = ssl_ob_cert_xtn; - } - } - - return extension_length; -} - -SECStatus -ssl3_ServerHandleOBCertXtn(sslSocket *ss, PRUint16 ex_type, - SECItem *data) -{ - SECStatus rv; - - /* Ignore the OBCert extension if it is disabled. */ - if (!ss->opt.enableOBCerts) - return SECSuccess; - - /* The echoed extension must be empty. */ - if (data->len != 0) - return SECFailure; - - /* Keep track of negotiated extensions. */ - ss->xtnData.negotiated[ss->xtnData.numNegotiated++] = ex_type; - - rv = ssl3_RegisterServerHelloExtensionSender(ss, ex_type, - ssl3_SendOBCertXtn); - - return SECSuccess; -} - -SECStatus -ssl3_ClientHandleOBCertXtn(sslSocket *ss, PRUint16 ex_type, - SECItem *data) -{ - /* If we didn't request this extension, then the server may not echo it. */ - if (!ss->opt.enableOBCerts) - return SECFailure; - - /* The echoed extension must be empty. */ - if (data->len != 0) - return SECFailure; - - /* Keep track of negotiated extensions. */ - ss->xtnData.negotiated[ss->xtnData.numNegotiated++] = ex_type; - - return SECSuccess; -} diff --git a/net/third_party/nss/ssl/sslimpl.h b/net/third_party/nss/ssl/sslimpl.h index 4991aca..8ab865a 100644 --- a/net/third_party/nss/ssl/sslimpl.h +++ b/net/third_party/nss/ssl/sslimpl.h @@ -356,8 +356,6 @@ typedef struct sslOptionsStr { unsigned int enableFalseStart : 1; /* 23 */ unsigned int cbcRandomIV : 1; /* 24 */ unsigned int enableOCSPStapling : 1; /* 25 */ - unsigned int enableOBCerts : 1; /* 26 */ - unsigned int encryptClientCerts : 1; /* 27 */ } sslOptions; typedef enum { sslHandshakingUndetermined = 0, @@ -1702,12 +1700,8 @@ extern SECStatus ssl3_ClientHandleSessionTicketXtn(sslSocket *ss, PRUint16 ex_type, SECItem *data); extern SECStatus ssl3_ClientHandleStatusRequestXtn(sslSocket *ss, PRUint16 ex_type, SECItem *data); -extern SECStatus ssl3_ClientHandleOBCertXtn(sslSocket *ss, - PRUint16 ex_type, SECItem *data); extern SECStatus ssl3_ServerHandleSessionTicketXtn(sslSocket *ss, PRUint16 ex_type, SECItem *data); -extern SECStatus ssl3_ServerHandleOBCertXtn(sslSocket *ss, - PRUint16 ex_type, SECItem *data); /* ClientHello and ServerHello extension senders. * Note that not all extension senders are exposed here; only those that @@ -1723,8 +1717,6 @@ extern PRInt32 ssl3_ClientSendStatusRequestXtn(sslSocket *ss, PRBool append, */ extern PRInt32 ssl3_SendServerNameXtn(sslSocket *ss, PRBool append, PRUint32 maxBytes); -extern PRInt32 ssl3_SendOBCertXtn(sslSocket *ss, PRBool append, - PRUint32 maxBytes); /* Assigns new cert, cert chain and keys to ss->serverCerts * struct. If certChain is NULL, tries to find one. Aborts if diff --git a/net/third_party/nss/ssl/sslsock.c b/net/third_party/nss/ssl/sslsock.c index 3364902..ebc245a 100644 --- a/net/third_party/nss/ssl/sslsock.c +++ b/net/third_party/nss/ssl/sslsock.c @@ -187,8 +187,6 @@ static sslOptions ssl_defaults = { PR_FALSE, /* enableFalseStart */ PR_TRUE, /* cbcRandomIV */ PR_FALSE, /* enableOCSPStapling */ - PR_FALSE, /* enableOBCerts */ - PR_FALSE, /* encryptClientCerts */ }; /* @@ -866,14 +864,6 @@ SSL_OptionSet(PRFileDesc *fd, PRInt32 which, PRBool on) ss->opt.enableOCSPStapling = on; break; - case SSL_ENABLE_OB_CERTS: - ss->opt.enableOBCerts = on; - break; - - case SSL_ENCRYPT_CLIENT_CERTS: - ss->opt.encryptClientCerts = on; - break; - default: PORT_SetError(SEC_ERROR_INVALID_ARGS); rv = SECFailure; @@ -944,9 +934,6 @@ SSL_OptionGet(PRFileDesc *fd, PRInt32 which, PRBool *pOn) case SSL_ENABLE_FALSE_START: on = ss->opt.enableFalseStart; break; case SSL_CBC_RANDOM_IV: on = ss->opt.cbcRandomIV; break; case SSL_ENABLE_OCSP_STAPLING: on = ss->opt.enableOCSPStapling; break; - case SSL_ENABLE_OB_CERTS: on = ss->opt.enableOBCerts; break; - case SSL_ENCRYPT_CLIENT_CERTS: - on = ss->opt.encryptClientCerts; break; default: PORT_SetError(SEC_ERROR_INVALID_ARGS); @@ -1008,9 +995,6 @@ SSL_OptionGetDefault(PRInt32 which, PRBool *pOn) case SSL_ENABLE_OCSP_STAPLING: on = ssl_defaults.enableOCSPStapling; break; - case SSL_ENABLE_OB_CERTS: on = ssl_defaults.enableOBCerts; break; - case SSL_ENCRYPT_CLIENT_CERTS: - on = ssl_defaults.encryptClientCerts; break; default: PORT_SetError(SEC_ERROR_INVALID_ARGS); @@ -1174,14 +1158,6 @@ SSL_OptionSetDefault(PRInt32 which, PRBool on) ssl_defaults.enableOCSPStapling = on; break; - case SSL_ENABLE_OB_CERTS: - ssl_defaults.enableOBCerts = on; - break; - - case SSL_ENCRYPT_CLIENT_CERTS: - ssl_defaults.encryptClientCerts = on; - break; - default: PORT_SetError(SEC_ERROR_INVALID_ARGS); return SECFailure; diff --git a/net/third_party/nss/ssl/sslt.h b/net/third_party/nss/ssl/sslt.h index eddfffd..0636570 100644 --- a/net/third_party/nss/ssl/sslt.h +++ b/net/third_party/nss/ssl/sslt.h @@ -215,11 +215,9 @@ typedef enum { #endif ssl_session_ticket_xtn = 35, ssl_next_proto_nego_xtn = 13172, - ssl_encrypted_client_certs = 13180, /* not IANA assigned. */ - ssl_renegotiation_info_xtn = 0xff01, /* experimental number */ - ssl_ob_cert_xtn = 13175 /* experimental number */ + ssl_renegotiation_info_xtn = 0xff01 /* experimental number */ } SSLExtensionType; -#define SSL_MAX_EXTENSIONS 9 +#define SSL_MAX_EXTENSIONS 7 #endif /* __sslt_h_ */ |