Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(557)

Side by Side Diff: net/third_party/nss/ssl/sslimpl.h

Issue 14522022: Update NSS libSSL to NSS_3_15_BETA2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Adjust secitemarray.patch, remove handlecertloser.patch Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * This file is PRIVATE to SSL and should be the first thing included by 2 * This file is PRIVATE to SSL and should be the first thing included by
3 * any SSL implementation file. 3 * any SSL implementation file.
4 * 4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public 5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this 6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 /* $Id: sslimpl.h,v 1.108 2012/09/28 01:46:45 wtc%google.com Exp $ */ 8 /* $Id$ */
9 9
10 #ifndef __sslimpl_h_ 10 #ifndef __sslimpl_h_
11 #define __sslimpl_h_ 11 #define __sslimpl_h_
12 12
13 #ifdef DEBUG 13 #ifdef DEBUG
14 #undef NDEBUG 14 #undef NDEBUG
15 #else 15 #else
16 #undef NDEBUG 16 #undef NDEBUG
17 #define NDEBUG 17 #define NDEBUG
18 #endif 18 #endif
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 /* number of wrap mechanisms potentially used to wrap master secrets. */ 145 /* number of wrap mechanisms potentially used to wrap master secrets. */
146 #define SSL_NUM_WRAP_MECHS 16 146 #define SSL_NUM_WRAP_MECHS 16
147 147
148 /* This makes the cert cache entry exactly 4k. */ 148 /* This makes the cert cache entry exactly 4k. */
149 #define SSL_MAX_CACHED_CERT_LEN 4060 149 #define SSL_MAX_CACHED_CERT_LEN 4060
150 150
151 #define NUM_MIXERS 9 151 #define NUM_MIXERS 9
152 152
153 /* Mask of the 25 named curves we support. */ 153 /* Mask of the 25 named curves we support. */
154 #ifndef NSS_ECC_MORE_THAN_SUITE_B 154 #define SSL3_ALL_SUPPORTED_CURVES_MASK 0x3fffffe
155 #define SSL3_SUPPORTED_CURVES_MASK 0x3800000» /* only 3 curves, suite B*/ 155 /* only 3 curves, suite B*/
156 #else 156 #define SSL3_SUITE_B_SUPPORTED_CURVES_MASK 0x3800000
157 #define SSL3_SUPPORTED_CURVES_MASK 0x3fffffe
158 #endif
159 157
160 #ifndef BPB 158 #ifndef BPB
161 #define BPB 8 /* Bits Per Byte */ 159 #define BPB 8 /* Bits Per Byte */
162 #endif 160 #endif
163 161
164 #define EXPORT_RSA_KEY_LENGTH 64 /* bytes */ 162 #define EXPORT_RSA_KEY_LENGTH 64 /* bytes */
165 163
166 #define INITIAL_DTLS_TIMEOUT_MS 1000 /* Default value from RFC 4347 = 1s*/ 164 #define INITIAL_DTLS_TIMEOUT_MS 1000 /* Default value from RFC 4347 = 1s*/
167 #define MAX_DTLS_TIMEOUT_MS 60000 /* 1 minute */ 165 #define MAX_DTLS_TIMEOUT_MS 60000 /* 1 minute */
168 #define DTLS_FINISHED_TIMER_MS 120000 /* Time to wait in FINISHED state */ 166 #define DTLS_FINISHED_TIMER_MS 120000 /* Time to wait in FINISHED state */
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 invalid_cache /* no longer in any cache. */ 588 invalid_cache /* no longer in any cache. */
591 } Cached; 589 } Cached;
592 590
593 #define MAX_PEER_CERT_CHAIN_SIZE 8 591 #define MAX_PEER_CERT_CHAIN_SIZE 8
594 592
595 struct sslSessionIDStr { 593 struct sslSessionIDStr {
596 sslSessionID * next; /* chain used for client sockets, only */ 594 sslSessionID * next; /* chain used for client sockets, only */
597 595
598 CERTCertificate * peerCert; 596 CERTCertificate * peerCert;
599 CERTCertificate * peerCertChain[MAX_PEER_CERT_CHAIN_SIZE]; 597 CERTCertificate * peerCertChain[MAX_PEER_CERT_CHAIN_SIZE];
598 SECItemArray peerCertStatus; /* client only */
600 const char * peerID; /* client only */ 599 const char * peerID; /* client only */
601 const char * urlSvrName; /* client only */ 600 const char * urlSvrName; /* client only */
602 CERTCertificate * localCert; 601 CERTCertificate * localCert;
603 602
604 PRIPv6Addr addr; 603 PRIPv6Addr addr;
605 PRUint16 port; 604 PRUint16 port;
606 605
607 SSL3ProtocolVersion version; 606 SSL3ProtocolVersion version;
608 607
609 PRUint32 creationTime; /* seconds since Jan 1, 1970 */ 608 PRUint32 creationTime; /* seconds since Jan 1, 1970 */
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 }; 731 };
733 732
734 typedef enum { 733 typedef enum {
735 wait_client_hello, 734 wait_client_hello,
736 wait_client_cert, 735 wait_client_cert,
737 wait_client_key, 736 wait_client_key,
738 wait_cert_verify, 737 wait_cert_verify,
739 wait_change_cipher, 738 wait_change_cipher,
740 wait_finished, 739 wait_finished,
741 wait_server_hello, 740 wait_server_hello,
741 wait_certificate_status,
742 wait_server_cert, 742 wait_server_cert,
743 wait_server_key, 743 wait_server_key,
744 wait_cert_request, 744 wait_cert_request,
745 wait_hello_done, 745 wait_hello_done,
746 wait_new_session_ticket, 746 wait_new_session_ticket,
747 idle_handshake 747 idle_handshake
748 } SSL3WaitState; 748 } SSL3WaitState;
749 749
750 /* 750 /*
751 * TLS extension related constants and data structures. 751 * TLS extension related constants and data structures.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
807 /* partial handshake message from record layer */ 807 /* partial handshake message from record layer */
808 unsigned int header_bytes; 808 unsigned int header_bytes;
809 /* number of bytes consumed from handshake */ 809 /* number of bytes consumed from handshake */
810 /* message for message type and header length */ 810 /* message for message type and header length */
811 SSL3HandshakeType msg_type; 811 SSL3HandshakeType msg_type;
812 unsigned long msg_len; 812 unsigned long msg_len;
813 SECItem ca_list; /* used only by client */ 813 SECItem ca_list; /* used only by client */
814 PRBool isResuming; /* are we resuming a session */ 814 PRBool isResuming; /* are we resuming a session */
815 PRBool usedStepDownKey; /* we did a server key exchange. */ 815 PRBool usedStepDownKey; /* we did a server key exchange. */
816 PRBool sendingSCSV; /* instead of empty RI */ 816 PRBool sendingSCSV; /* instead of empty RI */
817 PRBool may_get_cert_status; /* the server echoed a
818 * status_request extension so
819 * may send a CertificateStatus
820 * handshake message. */
821 SECItem pending_cert_msg; /* a Certificate message which we
822 * save temporarily if we may get
823 * a CertificateStatus message */
824 SECItem cert_status; /* an OCSP response */
825 sslBuffer msgState; /* current state for handshake messages*/ 817 sslBuffer msgState; /* current state for handshake messages*/
826 /* protected by recvBufLock */ 818 /* protected by recvBufLock */
827 sslBuffer messages; /* Accumulated handshake messages */ 819 sslBuffer messages; /* Accumulated handshake messages */
828 PRUint16 finishedBytes; /* size of single finished below */ 820 PRUint16 finishedBytes; /* size of single finished below */
829 union { 821 union {
830 TLSFinished tFinished[2]; /* client, then server */ 822 TLSFinished tFinished[2]; /* client, then server */
831 SSL3Hashes sFinished[2]; 823 SSL3Hashes sFinished[2];
832 SSL3Opaque data[72]; 824 SSL3Opaque data[72];
833 } finishedMsgs; 825 } finishedMsgs;
834 #ifdef NSS_ENABLE_ECC 826 #ifdef NSS_ENABLE_ECC
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 1207
1216 /* Gather object used for gathering data */ 1208 /* Gather object used for gathering data */
1217 sslGather gs; /*recvBufLock*/ 1209 sslGather gs; /*recvBufLock*/
1218 1210
1219 sslBuffer saveBuf; /*xmitBufLock*/ 1211 sslBuffer saveBuf; /*xmitBufLock*/
1220 sslBuffer pendingBuf; /*xmitBufLock*/ 1212 sslBuffer pendingBuf; /*xmitBufLock*/
1221 1213
1222 /* Configuration state for server sockets */ 1214 /* Configuration state for server sockets */
1223 /* server cert and key for each KEA type */ 1215 /* server cert and key for each KEA type */
1224 sslServerCerts serverCerts[kt_kea_size]; 1216 sslServerCerts serverCerts[kt_kea_size];
1217 SECItemArray * certStatusArray;
1225 1218
1226 ssl3CipherSuiteCfg cipherSuites[ssl_V3_SUITES_IMPLEMENTED]; 1219 ssl3CipherSuiteCfg cipherSuites[ssl_V3_SUITES_IMPLEMENTED];
1227 ssl3KeyPair * ephemeralECDHKeyPair; /* for ECDHE-* handshake */ 1220 ssl3KeyPair * ephemeralECDHKeyPair; /* for ECDHE-* handshake */
1228 1221
1229 /* SSL3 state info. Formerly was a pointer */ 1222 /* SSL3 state info. Formerly was a pointer */
1230 ssl3State ssl3; 1223 ssl3State ssl3;
1231 1224
1232 /* 1225 /*
1233 * TLS extension related data. 1226 * TLS extension related data.
1234 */ 1227 */
(...skipping 23 matching lines...) Expand all
1258 extern const char * const ssl3_cipherName[]; 1251 extern const char * const ssl3_cipherName[];
1259 1252
1260 extern sslSessionIDLookupFunc ssl_sid_lookup; 1253 extern sslSessionIDLookupFunc ssl_sid_lookup;
1261 extern sslSessionIDCacheFunc ssl_sid_cache; 1254 extern sslSessionIDCacheFunc ssl_sid_cache;
1262 extern sslSessionIDUncacheFunc ssl_sid_uncache; 1255 extern sslSessionIDUncacheFunc ssl_sid_uncache;
1263 1256
1264 /************************************************************************/ 1257 /************************************************************************/
1265 1258
1266 SEC_BEGIN_PROTOS 1259 SEC_BEGIN_PROTOS
1267 1260
1261 /* Functions for handling SECItemArrays, added in NSS 3.15 */
1262 extern SECItemArray *SECITEM_AllocArray(PLArenaPool *arena,
1263 SECItemArray *array,
1264 unsigned int len);
1265 extern SECItemArray *SECITEM_DupArray(PLArenaPool *arena,
1266 const SECItemArray *from);
1267 extern void SECITEM_FreeArray(SECItemArray *array, PRBool freeit);
1268 extern void SECITEM_ZfreeArray(SECItemArray *array, PRBool freeit);
1269
1268 /* Internal initialization and installation of the SSL error tables */ 1270 /* Internal initialization and installation of the SSL error tables */
1269 extern SECStatus ssl_Init(void); 1271 extern SECStatus ssl_Init(void);
1270 extern SECStatus ssl_InitializePRErrorTable(void); 1272 extern SECStatus ssl_InitializePRErrorTable(void);
1271 1273
1272 /* Implementation of ops for default (non socks, non secure) case */ 1274 /* Implementation of ops for default (non socks, non secure) case */
1273 extern int ssl_DefConnect(sslSocket *ss, const PRNetAddr *addr); 1275 extern int ssl_DefConnect(sslSocket *ss, const PRNetAddr *addr);
1274 extern PRFileDesc *ssl_DefAccept(sslSocket *ss, PRNetAddr *addr); 1276 extern PRFileDesc *ssl_DefAccept(sslSocket *ss, PRNetAddr *addr);
1275 extern int ssl_DefBind(sslSocket *ss, const PRNetAddr *addr); 1277 extern int ssl_DefBind(sslSocket *ss, const PRNetAddr *addr);
1276 extern int ssl_DefListen(sslSocket *ss, int backlog); 1278 extern int ssl_DefListen(sslSocket *ss, int backlog);
1277 extern int ssl_DefShutdown(sslSocket *ss, int how); 1279 extern int ssl_DefShutdown(sslSocket *ss, int how);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 * key, signed by the larger key. The smaller key is a "step down" key. 1537 * key, signed by the larger key. The smaller key is a "step down" key.
1536 * Generate that key pair and keep it around. 1538 * Generate that key pair and keep it around.
1537 */ 1539 */
1538 extern SECStatus ssl3_CreateRSAStepDownKeys(sslSocket *ss); 1540 extern SECStatus ssl3_CreateRSAStepDownKeys(sslSocket *ss);
1539 1541
1540 #ifdef NSS_ENABLE_ECC 1542 #ifdef NSS_ENABLE_ECC
1541 extern void ssl3_FilterECCipherSuitesByServerCerts(sslSocket *ss); 1543 extern void ssl3_FilterECCipherSuitesByServerCerts(sslSocket *ss);
1542 extern PRBool ssl3_IsECCEnabled(sslSocket *ss); 1544 extern PRBool ssl3_IsECCEnabled(sslSocket *ss);
1543 extern SECStatus ssl3_DisableECCSuites(sslSocket * ss, 1545 extern SECStatus ssl3_DisableECCSuites(sslSocket * ss,
1544 const ssl3CipherSuite * suite); 1546 const ssl3CipherSuite * suite);
1547 extern PRInt32 ssl3_GetSupportedECCCurveMask(sslSocket *ss);
1548
1545 1549
1546 /* Macro for finding a curve equivalent in strength to RSA key's */ 1550 /* Macro for finding a curve equivalent in strength to RSA key's */
1547 #define SSL_RSASTRENGTH_TO_ECSTRENGTH(s) \ 1551 #define SSL_RSASTRENGTH_TO_ECSTRENGTH(s) \
1548 ((s <= 1024) ? 160 \ 1552 ((s <= 1024) ? 160 \
1549 : ((s <= 2048) ? 224 \ 1553 : ((s <= 2048) ? 224 \
1550 : ((s <= 3072) ? 256 \ 1554 : ((s <= 3072) ? 256 \
1551 : ((s <= 7168) ? 384 : 521 ) ) ) ) 1555 : ((s <= 7168) ? 384 : 521 ) ) ) )
1552 1556
1553 /* Types and names of elliptic curves used in TLS */ 1557 /* Types and names of elliptic curves used in TLS */
1554 typedef enum { ec_type_explicitPrime = 1, 1558 typedef enum { ec_type_explicitPrime = 1,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 1672
1669 /* Functions that handle ClientHello and ServerHello extensions. */ 1673 /* Functions that handle ClientHello and ServerHello extensions. */
1670 extern SECStatus ssl3_HandleServerNameXtn(sslSocket * ss, 1674 extern SECStatus ssl3_HandleServerNameXtn(sslSocket * ss,
1671 PRUint16 ex_type, SECItem *data); 1675 PRUint16 ex_type, SECItem *data);
1672 extern SECStatus ssl3_HandleSupportedCurvesXtn(sslSocket * ss, 1676 extern SECStatus ssl3_HandleSupportedCurvesXtn(sslSocket * ss,
1673 PRUint16 ex_type, SECItem *data); 1677 PRUint16 ex_type, SECItem *data);
1674 extern SECStatus ssl3_HandleSupportedPointFormatsXtn(sslSocket * ss, 1678 extern SECStatus ssl3_HandleSupportedPointFormatsXtn(sslSocket * ss,
1675 PRUint16 ex_type, SECItem *data); 1679 PRUint16 ex_type, SECItem *data);
1676 extern SECStatus ssl3_ClientHandleSessionTicketXtn(sslSocket *ss, 1680 extern SECStatus ssl3_ClientHandleSessionTicketXtn(sslSocket *ss,
1677 PRUint16 ex_type, SECItem *data); 1681 PRUint16 ex_type, SECItem *data);
1678 extern SECStatus ssl3_ClientHandleStatusRequestXtn(sslSocket *ss,
1679 PRUint16 ex_type, SECItem *data);
1680 extern SECStatus ssl3_ServerHandleSessionTicketXtn(sslSocket *ss, 1682 extern SECStatus ssl3_ServerHandleSessionTicketXtn(sslSocket *ss,
1681 PRUint16 ex_type, SECItem *data); 1683 PRUint16 ex_type, SECItem *data);
1682 1684
1683 /* ClientHello and ServerHello extension senders. 1685 /* ClientHello and ServerHello extension senders.
1684 * Note that not all extension senders are exposed here; only those that 1686 * Note that not all extension senders are exposed here; only those that
1685 * that need exposure. 1687 * that need exposure.
1686 */ 1688 */
1687 extern PRInt32 ssl3_SendSessionTicketXtn(sslSocket *ss, PRBool append, 1689 extern PRInt32 ssl3_SendSessionTicketXtn(sslSocket *ss, PRBool append,
1688 PRUint32 maxBytes); 1690 PRUint32 maxBytes);
1689 extern PRInt32 ssl3_ClientSendStatusRequestXtn(sslSocket *ss, PRBool append,
1690 PRUint32 maxBytes);
wtc 2013/04/29 18:09:59 This function and ssl3_ClientHandleStatusRequestXt
1691 1691
1692 /* ClientHello and ServerHello extension senders. 1692 /* ClientHello and ServerHello extension senders.
1693 * The code is in ssl3ext.c. 1693 * The code is in ssl3ext.c.
1694 */ 1694 */
1695 extern PRInt32 ssl3_SendServerNameXtn(sslSocket *ss, PRBool append, 1695 extern PRInt32 ssl3_SendServerNameXtn(sslSocket *ss, PRBool append,
1696 PRUint32 maxBytes); 1696 PRUint32 maxBytes);
1697 1697
1698 /* Assigns new cert, cert chain and keys to ss->serverCerts 1698 /* Assigns new cert, cert chain and keys to ss->serverCerts
1699 * struct. If certChain is NULL, tries to find one. Aborts if 1699 * struct. If certChain is NULL, tries to find one. Aborts if
1700 * fails to do so. If cert and keyPair are NULL - unconfigures 1700 * fails to do so. If cert and keyPair are NULL - unconfigures
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 #else 1865 #else
1866 #define SSL_TRACE(msg) 1866 #define SSL_TRACE(msg)
1867 #endif 1867 #endif
1868 1868
1869 void ssl_Trace(const char *format, ...); 1869 void ssl_Trace(const char *format, ...);
1870 1870
1871 SEC_END_PROTOS 1871 SEC_END_PROTOS
1872 1872
1873 #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS) 1873 #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS)
1874 #define SSL_GETPID getpid 1874 #define SSL_GETPID getpid
1875 #elif defined(_WIN32_WCE)
1876 #define SSL_GETPID GetCurrentProcessId
1877 #elif defined(WIN32) 1875 #elif defined(WIN32)
1878 extern int __cdecl _getpid(void); 1876 extern int __cdecl _getpid(void);
1879 #define SSL_GETPID _getpid 1877 #define SSL_GETPID _getpid
1880 #else 1878 #else
1881 #define SSL_GETPID() 0 1879 #define SSL_GETPID() 0
1882 #endif 1880 #endif
1883 1881
1884 #endif /* __sslimpl_h_ */ 1882 #endif /* __sslimpl_h_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698