OLD | NEW |
| 1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
1 /* | 2 /* |
2 * This file is PRIVATE to SSL and should be the first thing included by | 3 * This file is PRIVATE to SSL and should be the first thing included by |
3 * any SSL implementation file. | 4 * any SSL implementation file. |
4 * | 5 * |
5 * This Source Code Form is subject to the terms of the Mozilla Public | 6 * 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 | 7 * 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/. */ | 8 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
8 | 9 |
9 #ifndef __sslimpl_h_ | 10 #ifndef __sslimpl_h_ |
10 #define __sslimpl_h_ | 11 #define __sslimpl_h_ |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 typedef struct sslSecurityInfoStr sslSecurityInfo; | 175 typedef struct sslSecurityInfoStr sslSecurityInfo; |
175 typedef struct sslSessionIDStr sslSessionID; | 176 typedef struct sslSessionIDStr sslSessionID; |
176 typedef struct sslSocketStr sslSocket; | 177 typedef struct sslSocketStr sslSocket; |
177 typedef struct sslSocketOpsStr sslSocketOps; | 178 typedef struct sslSocketOpsStr sslSocketOps; |
178 | 179 |
179 typedef struct ssl3StateStr ssl3State; | 180 typedef struct ssl3StateStr ssl3State; |
180 typedef struct ssl3CertNodeStr ssl3CertNode; | 181 typedef struct ssl3CertNodeStr ssl3CertNode; |
181 typedef struct ssl3BulkCipherDefStr ssl3BulkCipherDef; | 182 typedef struct ssl3BulkCipherDefStr ssl3BulkCipherDef; |
182 typedef struct ssl3MACDefStr ssl3MACDef; | 183 typedef struct ssl3MACDefStr ssl3MACDef; |
183 typedef struct ssl3KeyPairStr ssl3KeyPair; | 184 typedef struct ssl3KeyPairStr ssl3KeyPair; |
| 185 typedef struct ssl3DHParamsStr ssl3DHParams; |
184 | 186 |
185 struct ssl3CertNodeStr { | 187 struct ssl3CertNodeStr { |
186 struct ssl3CertNodeStr *next; | 188 struct ssl3CertNodeStr *next; |
187 CERTCertificate * cert; | 189 CERTCertificate * cert; |
188 }; | 190 }; |
189 | 191 |
190 typedef SECStatus (*sslHandshakeFunc)(sslSocket *ss); | 192 typedef SECStatus (*sslHandshakeFunc)(sslSocket *ss); |
191 | 193 |
192 /* This type points to the low layer send func, | 194 /* This type points to the low layer send func, |
193 ** e.g. ssl2_SendStream or ssl3_SendPlainText. | 195 ** e.g. ssl2_SendStream or ssl3_SendPlainText. |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 unsigned int isPresent : 1; | 295 unsigned int isPresent : 1; |
294 #else | 296 #else |
295 ssl3CipherSuite cipher_suite; | 297 ssl3CipherSuite cipher_suite; |
296 PRUint8 policy; | 298 PRUint8 policy; |
297 unsigned char enabled : 1; | 299 unsigned char enabled : 1; |
298 unsigned char isPresent : 1; | 300 unsigned char isPresent : 1; |
299 #endif | 301 #endif |
300 } ssl3CipherSuiteCfg; | 302 } ssl3CipherSuiteCfg; |
301 | 303 |
302 #ifndef NSS_DISABLE_ECC | 304 #ifndef NSS_DISABLE_ECC |
303 #define ssl_V3_SUITES_IMPLEMENTED 63 | 305 #define ssl_V3_SUITES_IMPLEMENTED 66 |
304 #else | 306 #else |
305 #define ssl_V3_SUITES_IMPLEMENTED 37 | 307 #define ssl_V3_SUITES_IMPLEMENTED 40 |
306 #endif /* NSS_DISABLE_ECC */ | 308 #endif /* NSS_DISABLE_ECC */ |
307 | 309 |
308 #define MAX_DTLS_SRTP_CIPHER_SUITES 4 | 310 #define MAX_DTLS_SRTP_CIPHER_SUITES 4 |
309 | 311 |
| 312 /* MAX_SIGNATURE_ALGORITHMS allows for a large number of combinations of |
| 313 * SSLSignType and SSLHashType, but not all combinations (specifically, this |
| 314 * doesn't allow space for combinations with MD5). */ |
| 315 #define MAX_SIGNATURE_ALGORITHMS 15 |
| 316 |
| 317 |
310 typedef struct sslOptionsStr { | 318 typedef struct sslOptionsStr { |
311 /* If SSL_SetNextProtoNego has been called, then this contains the | 319 /* If SSL_SetNextProtoNego has been called, then this contains the |
312 * list of supported protocols. */ | 320 * list of supported protocols. */ |
313 SECItem nextProtoNego; | 321 SECItem nextProtoNego; |
314 | 322 |
315 unsigned int useSecurity : 1; /* 1 */ | 323 unsigned int useSecurity : 1; /* 1 */ |
316 unsigned int useSocks : 1; /* 2 */ | 324 unsigned int useSocks : 1; /* 2 */ |
317 unsigned int requestCertificate : 1; /* 3 */ | 325 unsigned int requestCertificate : 1; /* 3 */ |
318 unsigned int requireCertificate : 2; /* 4-5 */ | 326 unsigned int requireCertificate : 2; /* 4-5 */ |
319 unsigned int handshakeAsClient : 1; /* 6 */ | 327 unsigned int handshakeAsClient : 1; /* 6 */ |
(...skipping 12 matching lines...) Expand all Loading... |
332 unsigned int enableDeflate : 1; /* 19 */ | 340 unsigned int enableDeflate : 1; /* 19 */ |
333 unsigned int enableRenegotiation : 2; /* 20-21 */ | 341 unsigned int enableRenegotiation : 2; /* 20-21 */ |
334 unsigned int requireSafeNegotiation : 1; /* 22 */ | 342 unsigned int requireSafeNegotiation : 1; /* 22 */ |
335 unsigned int enableFalseStart : 1; /* 23 */ | 343 unsigned int enableFalseStart : 1; /* 23 */ |
336 unsigned int cbcRandomIV : 1; /* 24 */ | 344 unsigned int cbcRandomIV : 1; /* 24 */ |
337 unsigned int enableOCSPStapling : 1; /* 25 */ | 345 unsigned int enableOCSPStapling : 1; /* 25 */ |
338 unsigned int enableNPN : 1; /* 26 */ | 346 unsigned int enableNPN : 1; /* 26 */ |
339 unsigned int enableALPN : 1; /* 27 */ | 347 unsigned int enableALPN : 1; /* 27 */ |
340 unsigned int reuseServerECDHEKey : 1; /* 28 */ | 348 unsigned int reuseServerECDHEKey : 1; /* 28 */ |
341 unsigned int enableFallbackSCSV : 1; /* 29 */ | 349 unsigned int enableFallbackSCSV : 1; /* 29 */ |
342 unsigned int enableSignedCertTimestamps : 1; /* 30 */ | 350 unsigned int enableServerDhe : 1; /* 30 */ |
| 351 unsigned int enableExtendedMS : 1; /* 31 */ |
| 352 unsigned int enableSignedCertTimestamps : 1; /* 32 */ |
343 } sslOptions; | 353 } sslOptions; |
344 | 354 |
345 typedef enum { sslHandshakingUndetermined = 0, | 355 typedef enum { sslHandshakingUndetermined = 0, |
346 sslHandshakingAsClient, | 356 sslHandshakingAsClient, |
347 sslHandshakingAsServer | 357 sslHandshakingAsServer |
348 } sslHandshakingType; | 358 } sslHandshakingType; |
349 | 359 |
350 typedef struct sslServerCertsStr { | 360 typedef struct sslServerCertsStr { |
351 /* Configuration state for server sockets */ | 361 /* Configuration state for server sockets */ |
352 CERTCertificate * serverCert; | 362 CERTCertificate * serverCert; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 #define MAX_MAC_CONTEXT_LLONGS (MAX_MAC_CONTEXT_BYTES / 8) | 524 #define MAX_MAC_CONTEXT_LLONGS (MAX_MAC_CONTEXT_BYTES / 8) |
515 | 525 |
516 #define MAX_CIPHER_CONTEXT_BYTES 2080 | 526 #define MAX_CIPHER_CONTEXT_BYTES 2080 |
517 #define MAX_CIPHER_CONTEXT_LLONGS (MAX_CIPHER_CONTEXT_BYTES / 8) | 527 #define MAX_CIPHER_CONTEXT_LLONGS (MAX_CIPHER_CONTEXT_BYTES / 8) |
518 | 528 |
519 typedef struct { | 529 typedef struct { |
520 SSL3Opaque wrapped_master_secret[48]; | 530 SSL3Opaque wrapped_master_secret[48]; |
521 PRUint16 wrapped_master_secret_len; | 531 PRUint16 wrapped_master_secret_len; |
522 PRUint8 msIsWrapped; | 532 PRUint8 msIsWrapped; |
523 PRUint8 resumable; | 533 PRUint8 resumable; |
| 534 PRUint8 extendedMasterSecretUsed; |
524 } ssl3SidKeys; /* 52 bytes */ | 535 } ssl3SidKeys; /* 52 bytes */ |
525 | 536 |
526 typedef struct { | 537 typedef struct { |
527 PK11SymKey *write_key; | 538 PK11SymKey *write_key; |
528 PK11SymKey *write_mac_key; | 539 PK11SymKey *write_mac_key; |
529 PK11Context *write_mac_context; | 540 PK11Context *write_mac_context; |
530 SECItem write_key_item; | 541 SECItem write_key_item; |
531 SECItem write_iv_item; | 542 SECItem write_iv_item; |
532 SECItem write_mac_key_item; | 543 SECItem write_mac_key_item; |
533 SSL3Opaque write_iv[MAX_IV_LENGTH]; | 544 SSL3Opaque write_iv[MAX_IV_LENGTH]; |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 ** There are tables of these, all const. | 770 ** There are tables of these, all const. |
760 */ | 771 */ |
761 typedef struct { | 772 typedef struct { |
762 SSL3KeyExchangeAlgorithm kea; | 773 SSL3KeyExchangeAlgorithm kea; |
763 SSL3KEAType exchKeyType; | 774 SSL3KEAType exchKeyType; |
764 SSL3SignType signKeyType; | 775 SSL3SignType signKeyType; |
765 /* For export cipher suites: | 776 /* For export cipher suites: |
766 * is_limited identifies a suite as having a limit on the key size. | 777 * is_limited identifies a suite as having a limit on the key size. |
767 * key_size_limit provides the corresponding limit. */ | 778 * key_size_limit provides the corresponding limit. */ |
768 PRBool is_limited; | 779 PRBool is_limited; |
769 int key_size_limit; | 780 unsigned int key_size_limit; |
770 PRBool tls_keygen; | 781 PRBool tls_keygen; |
771 /* True if the key exchange for the suite can be ephemeral. Or to be more | 782 /* True if the key exchange for the suite is ephemeral. Or to be more |
772 * precise: true if the ServerKeyExchange message is required. */ | 783 * precise: true if the ServerKeyExchange message is always required. */ |
773 PRBool ephemeral; | 784 PRBool ephemeral; |
774 } ssl3KEADef; | 785 } ssl3KEADef; |
775 | 786 |
776 /* | 787 /* |
777 ** There are tables of these, all const. | 788 ** There are tables of these, all const. |
778 */ | 789 */ |
779 struct ssl3BulkCipherDefStr { | 790 struct ssl3BulkCipherDefStr { |
780 SSL3BulkCipher cipher; | 791 SSL3BulkCipher cipher; |
781 SSLCipherAlgorithm calg; | 792 SSLCipherAlgorithm calg; |
782 int key_size; | 793 int key_size; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
948 | 959 |
949 PRBool authCertificatePending; | 960 PRBool authCertificatePending; |
950 /* Which function should SSL_RestartHandshake* call if we're blocked? | 961 /* Which function should SSL_RestartHandshake* call if we're blocked? |
951 * One of NULL, ssl3_SendClientSecondRound, ssl3_FinishHandshake, | 962 * One of NULL, ssl3_SendClientSecondRound, ssl3_FinishHandshake, |
952 * or ssl3_AlwaysFail */ | 963 * or ssl3_AlwaysFail */ |
953 sslRestartTarget restartTarget; | 964 sslRestartTarget restartTarget; |
954 /* Shared state between ssl3_HandleFinished and ssl3_FinishHandshake */ | 965 /* Shared state between ssl3_HandleFinished and ssl3_FinishHandshake */ |
955 PRBool cacheSID; | 966 PRBool cacheSID; |
956 | 967 |
957 PRBool canFalseStart; /* Can/did we False Start */ | 968 PRBool canFalseStart; /* Can/did we False Start */ |
| 969 /* Which preliminaryinfo values have been set. */ |
| 970 PRUint32 preliminaryInfo; |
958 | 971 |
959 /* clientSigAndHash contains the contents of the signature_algorithms | 972 /* clientSigAndHash contains the contents of the signature_algorithms |
960 * extension (if any) from the client. This is only valid for TLS 1.2 | 973 * extension (if any) from the client. This is only valid for TLS 1.2 |
961 * or later. */ | 974 * or later. */ |
962 SSL3SignatureAndHashAlgorithm *clientSigAndHash; | 975 SSLSignatureAndHashAlg *clientSigAndHash; |
963 unsigned int numClientSigAndHash; | 976 unsigned int numClientSigAndHash; |
964 | 977 |
965 /* This group of values is used for DTLS */ | 978 /* This group of values is used for DTLS */ |
966 PRUint16 sendMessageSeq; /* The sending message sequence | 979 PRUint16 sendMessageSeq; /* The sending message sequence |
967 * number */ | 980 * number */ |
968 PRCList lastMessageFlight; /* The last message flight we | 981 PRCList lastMessageFlight; /* The last message flight we |
969 * sent */ | 982 * sent */ |
970 PRUint16 maxMessageSent; /* The largest message we sent */ | 983 PRUint16 maxMessageSent; /* The largest message we sent */ |
971 PRUint16 recvMessageSeq; /* The receiving message sequence | 984 PRUint16 recvMessageSeq; /* The receiving message sequence |
972 * number */ | 985 * number */ |
973 sslBuffer recvdFragments; /* The fragments we have received in | 986 sslBuffer recvdFragments; /* The fragments we have received in |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 SECItem nextProto; | 1050 SECItem nextProto; |
1038 SSLNextProtoState nextProtoState; | 1051 SSLNextProtoState nextProtoState; |
1039 | 1052 |
1040 PRUint16 mtu; /* Our estimate of the MTU */ | 1053 PRUint16 mtu; /* Our estimate of the MTU */ |
1041 | 1054 |
1042 /* DTLS-SRTP cipher suite preferences (if any) */ | 1055 /* DTLS-SRTP cipher suite preferences (if any) */ |
1043 PRUint16 dtlsSRTPCiphers[MAX_DTLS_SRTP_CIPHER_SUITES]; | 1056 PRUint16 dtlsSRTPCiphers[MAX_DTLS_SRTP_CIPHER_SUITES]; |
1044 PRUint16 dtlsSRTPCipherCount; | 1057 PRUint16 dtlsSRTPCipherCount; |
1045 PRUint16 dtlsSRTPCipherSuite; /* 0 if not selected */ | 1058 PRUint16 dtlsSRTPCipherSuite; /* 0 if not selected */ |
1046 PRBool fatalAlertSent; | 1059 PRBool fatalAlertSent; |
| 1060 PRUint16 numDHEGroups; /* used by server */ |
| 1061 SSLDHEGroupType * dheGroups; /* used by server */ |
| 1062 PRBool dheWeakGroupEnabled; /* used by server */ |
| 1063 |
| 1064 /* TLS 1.2 introduces separate signature algorithm negotiation. |
| 1065 * This is our preference order. */ |
| 1066 SSLSignatureAndHashAlg signatureAlgorithms[MAX_SIGNATURE_ALGORITHMS]; |
| 1067 unsigned int signatureAlgorithmCount; |
1047 }; | 1068 }; |
1048 | 1069 |
1049 #define DTLS_MAX_MTU 1500 /* Ethernet MTU but without subtracting the | 1070 #define DTLS_MAX_MTU 1500U /* Ethernet MTU but without subtracting the |
1050 * headers, so slightly larger than expected */ | 1071 * headers, so slightly larger than expected */ |
1051 #define IS_DTLS(ss) (ss->protocolVariant == ssl_variant_datagram) | 1072 #define IS_DTLS(ss) (ss->protocolVariant == ssl_variant_datagram) |
1052 | 1073 |
1053 typedef struct { | 1074 typedef struct { |
1054 SSL3ContentType type; | 1075 SSL3ContentType type; |
1055 SSL3ProtocolVersion version; | 1076 SSL3ProtocolVersion version; |
1056 SSL3SequenceNumber seq_num; /* DTLS only */ | 1077 SSL3SequenceNumber seq_num; /* DTLS only */ |
1057 sslBuffer * buf; | 1078 sslBuffer * buf; |
1058 } SSL3Ciphertext; | 1079 } SSL3Ciphertext; |
1059 | 1080 |
1060 struct ssl3KeyPairStr { | 1081 struct ssl3KeyPairStr { |
1061 SECKEYPrivateKey * privKey; | 1082 SECKEYPrivateKey * privKey; |
1062 SECKEYPublicKey * pubKey; | 1083 SECKEYPublicKey * pubKey; |
1063 PRInt32 refCount; /* use PR_Atomic calls for this. */ | 1084 PRInt32 refCount; /* use PR_Atomic calls for this. */ |
1064 }; | 1085 }; |
1065 | 1086 |
| 1087 struct ssl3DHParamsStr { |
| 1088 SECItem prime; /* p */ |
| 1089 SECItem base; /* g */ |
| 1090 }; |
| 1091 |
1066 typedef struct SSLWrappedSymWrappingKeyStr { | 1092 typedef struct SSLWrappedSymWrappingKeyStr { |
1067 SSL3Opaque wrappedSymmetricWrappingkey[512]; | 1093 SSL3Opaque wrappedSymmetricWrappingkey[512]; |
1068 CK_MECHANISM_TYPE symWrapMechanism; | 1094 CK_MECHANISM_TYPE symWrapMechanism; |
1069 /* unwrapped symmetric wrapping key uses this mechanism */ | 1095 /* unwrapped symmetric wrapping key uses this mechanism */ |
1070 CK_MECHANISM_TYPE asymWrapMechanism; | 1096 CK_MECHANISM_TYPE asymWrapMechanism; |
1071 /* mechanism used to wrap the SymmetricWrappingKey using | 1097 /* mechanism used to wrap the SymmetricWrappingKey using |
1072 * server's public and/or private keys. */ | 1098 * server's public and/or private keys. */ |
1073 SSL3KEAType exchKeyType; /* type of keys used to wrap SymWrapKey*/ | 1099 SSL3KEAType exchKeyType; /* type of keys used to wrap SymWrapKey*/ |
1074 PRInt32 symWrapMechIndex; | 1100 PRInt32 symWrapMechIndex; |
1075 PRUint16 wrappedSymKeyLen; | 1101 PRUint16 wrappedSymKeyLen; |
(...skipping 10 matching lines...) Expand all Loading... |
1086 PRUint32 keaKeyBits; | 1112 PRUint32 keaKeyBits; |
1087 /* | 1113 /* |
1088 * exchKeyType and msWrapMech contain meaningful values only if | 1114 * exchKeyType and msWrapMech contain meaningful values only if |
1089 * ms_is_wrapped is true. | 1115 * ms_is_wrapped is true. |
1090 */ | 1116 */ |
1091 PRUint8 ms_is_wrapped; | 1117 PRUint8 ms_is_wrapped; |
1092 SSLKEAType exchKeyType; /* XXX(wtc): same as keaType above? */ | 1118 SSLKEAType exchKeyType; /* XXX(wtc): same as keaType above? */ |
1093 CK_MECHANISM_TYPE msWrapMech; | 1119 CK_MECHANISM_TYPE msWrapMech; |
1094 PRUint16 ms_length; | 1120 PRUint16 ms_length; |
1095 SSL3Opaque master_secret[48]; | 1121 SSL3Opaque master_secret[48]; |
| 1122 PRBool extendedMasterSecretUsed; |
1096 ClientIdentity client_identity; | 1123 ClientIdentity client_identity; |
1097 SECItem peer_cert; | 1124 SECItem peer_cert; |
1098 PRUint32 timestamp; | 1125 PRUint32 timestamp; |
1099 SECItem srvName; /* negotiated server name */ | 1126 SECItem srvName; /* negotiated server name */ |
1100 } SessionTicket; | 1127 } SessionTicket; |
1101 | 1128 |
1102 /* | 1129 /* |
1103 * SSL2 buffers used in SSL3. | 1130 * SSL2 buffers used in SSL3. |
1104 * writeBuf in the SecurityInfo maintained by sslsecur.c is used | 1131 * writeBuf in the SecurityInfo maintained by sslsecur.c is used |
1105 * to hold the data just about to be passed to the kernel | 1132 * to hold the data just about to be passed to the kernel |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1268 unsigned char * cipherSpecs; | 1295 unsigned char * cipherSpecs; |
1269 unsigned int sizeCipherSpecs; | 1296 unsigned int sizeCipherSpecs; |
1270 const unsigned char * preferredCipher; | 1297 const unsigned char * preferredCipher; |
1271 | 1298 |
1272 /* TLS ClientCertificateTypes requested during HandleCertificateRequest. */ | 1299 /* TLS ClientCertificateTypes requested during HandleCertificateRequest. */ |
1273 /* Will be NULL at all other times. */ | 1300 /* Will be NULL at all other times. */ |
1274 const SECItem *requestedCertTypes; | 1301 const SECItem *requestedCertTypes; |
1275 | 1302 |
1276 ssl3KeyPair * stepDownKeyPair; /* RSA step down keys */ | 1303 ssl3KeyPair * stepDownKeyPair; /* RSA step down keys */ |
1277 | 1304 |
| 1305 const ssl3DHParams *dheParams; /* DHE param */ |
| 1306 ssl3KeyPair * dheKeyPair; /* DHE keys */ |
| 1307 |
1278 /* Callbacks */ | 1308 /* Callbacks */ |
1279 SSLAuthCertificate authCertificate; | 1309 SSLAuthCertificate authCertificate; |
1280 void *authCertificateArg; | 1310 void *authCertificateArg; |
1281 SSLGetClientAuthData getClientAuthData; | 1311 SSLGetClientAuthData getClientAuthData; |
1282 void *getClientAuthDataArg; | 1312 void *getClientAuthDataArg; |
1283 #ifdef NSS_PLATFORM_CLIENT_AUTH | 1313 #ifdef NSS_PLATFORM_CLIENT_AUTH |
1284 SSLGetPlatformClientAuthData getPlatformClientAuthData; | 1314 SSLGetPlatformClientAuthData getPlatformClientAuthData; |
1285 void *getPlatformClientAuthDataArg; | 1315 void *getPlatformClientAuthDataArg; |
1286 #endif /* NSS_PLATFORM_CLIENT_AUTH */ | 1316 #endif /* NSS_PLATFORM_CLIENT_AUTH */ |
1287 SSLSNISocketConfig sniSocketConfig; | 1317 SSLSNISocketConfig sniSocketConfig; |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1627 /* Rename this macro SSL_ALL_VERSIONS_DISABLED when SSL 2.0 is removed. */ | 1657 /* Rename this macro SSL_ALL_VERSIONS_DISABLED when SSL 2.0 is removed. */ |
1628 #define SSL3_ALL_VERSIONS_DISABLED(vrange) \ | 1658 #define SSL3_ALL_VERSIONS_DISABLED(vrange) \ |
1629 ((vrange)->min == SSL_LIBRARY_VERSION_NONE) | 1659 ((vrange)->min == SSL_LIBRARY_VERSION_NONE) |
1630 | 1660 |
1631 extern PRBool ssl3_VersionIsSupported(SSLProtocolVariant protocolVariant, | 1661 extern PRBool ssl3_VersionIsSupported(SSLProtocolVariant protocolVariant, |
1632 SSL3ProtocolVersion version); | 1662 SSL3ProtocolVersion version); |
1633 | 1663 |
1634 extern SECStatus ssl3_KeyAndMacDeriveBypass(ssl3CipherSpec * pwSpec, | 1664 extern SECStatus ssl3_KeyAndMacDeriveBypass(ssl3CipherSpec * pwSpec, |
1635 const unsigned char * cr, const unsigned char * sr, | 1665 const unsigned char * cr, const unsigned char * sr, |
1636 PRBool isTLS, PRBool isExport); | 1666 PRBool isTLS, PRBool isExport); |
1637 extern SECStatus ssl3_MasterKeyDeriveBypass( ssl3CipherSpec * pwSpec, | 1667 extern SECStatus ssl3_MasterSecretDeriveBypass( ssl3CipherSpec * pwSpec, |
1638 const unsigned char * cr, const unsigned char * sr, | 1668 const unsigned char * cr, const unsigned char * sr, |
1639 const SECItem * pms, PRBool isTLS, PRBool isRSA); | 1669 const SECItem * pms, PRBool isTLS, PRBool isRSA); |
1640 | 1670 |
1641 /* These functions are called from secnav, even though they're "private". */ | 1671 /* These functions are called from secnav, even though they're "private". */ |
1642 | 1672 |
1643 extern int ssl2_SendErrorMessage(struct sslSocketStr *ss, int error); | 1673 extern int ssl2_SendErrorMessage(struct sslSocketStr *ss, int error); |
1644 extern sslSocket *ssl_FindSocket(PRFileDesc *fd); | 1674 extern sslSocket *ssl_FindSocket(PRFileDesc *fd); |
1645 extern void ssl_FreeSocket(struct sslSocketStr *ssl); | 1675 extern void ssl_FreeSocket(struct sslSocketStr *ssl); |
1646 extern SECStatus SSL3_SendAlert(sslSocket *ss, SSL3AlertLevel level, | 1676 extern SECStatus SSL3_SendAlert(sslSocket *ss, SSL3AlertLevel level, |
1647 SSL3AlertDescription desc); | 1677 SSL3AlertDescription desc); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1681 int ssl3_GatherAppDataRecord(sslSocket *ss, int flags); | 1711 int ssl3_GatherAppDataRecord(sslSocket *ss, int flags); |
1682 int ssl3_GatherCompleteHandshake(sslSocket *ss, int flags); | 1712 int ssl3_GatherCompleteHandshake(sslSocket *ss, int flags); |
1683 /* | 1713 /* |
1684 * When talking to export clients or using export cipher suites, servers | 1714 * When talking to export clients or using export cipher suites, servers |
1685 * with public RSA keys larger than 512 bits need to use a 512-bit public | 1715 * with public RSA keys larger than 512 bits need to use a 512-bit public |
1686 * key, signed by the larger key. The smaller key is a "step down" key. | 1716 * key, signed by the larger key. The smaller key is a "step down" key. |
1687 * Generate that key pair and keep it around. | 1717 * Generate that key pair and keep it around. |
1688 */ | 1718 */ |
1689 extern SECStatus ssl3_CreateRSAStepDownKeys(sslSocket *ss); | 1719 extern SECStatus ssl3_CreateRSAStepDownKeys(sslSocket *ss); |
1690 | 1720 |
| 1721 extern SECStatus ssl3_SelectDHParams(sslSocket *ss); |
| 1722 |
1691 #ifndef NSS_DISABLE_ECC | 1723 #ifndef NSS_DISABLE_ECC |
1692 extern void ssl3_FilterECCipherSuitesByServerCerts(sslSocket *ss); | 1724 extern void ssl3_FilterECCipherSuitesByServerCerts(sslSocket *ss); |
1693 extern PRBool ssl3_IsECCEnabled(sslSocket *ss); | 1725 extern PRBool ssl3_IsECCEnabled(sslSocket *ss); |
1694 extern SECStatus ssl3_DisableECCSuites(sslSocket * ss, | 1726 extern SECStatus ssl3_DisableECCSuites(sslSocket * ss, |
1695 const ssl3CipherSuite * suite); | 1727 const ssl3CipherSuite * suite); |
1696 extern PRUint32 ssl3_GetSupportedECCurveMask(sslSocket *ss); | 1728 extern PRUint32 ssl3_GetSupportedECCurveMask(sslSocket *ss); |
1697 | 1729 |
1698 | 1730 |
1699 /* Macro for finding a curve equivalent in strength to RSA key's */ | 1731 /* Macro for finding a curve equivalent in strength to RSA key's */ |
1700 #define SSL_RSASTRENGTH_TO_ECSTRENGTH(s) \ | 1732 #define SSL_RSASTRENGTH_TO_ECSTRENGTH(s) \ |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1783 #ifndef NSS_DISABLE_ECC | 1815 #ifndef NSS_DISABLE_ECC |
1784 /* ECDH functions */ | 1816 /* ECDH functions */ |
1785 extern SECStatus ssl3_SendECDHClientKeyExchange(sslSocket * ss, | 1817 extern SECStatus ssl3_SendECDHClientKeyExchange(sslSocket * ss, |
1786 SECKEYPublicKey * svrPubKey); | 1818 SECKEYPublicKey * svrPubKey); |
1787 extern SECStatus ssl3_HandleECDHServerKeyExchange(sslSocket *ss, | 1819 extern SECStatus ssl3_HandleECDHServerKeyExchange(sslSocket *ss, |
1788 SSL3Opaque *b, PRUint32 length); | 1820 SSL3Opaque *b, PRUint32 length); |
1789 extern SECStatus ssl3_HandleECDHClientKeyExchange(sslSocket *ss, | 1821 extern SECStatus ssl3_HandleECDHClientKeyExchange(sslSocket *ss, |
1790 SSL3Opaque *b, PRUint32 length, | 1822 SSL3Opaque *b, PRUint32 length, |
1791 SECKEYPublicKey *srvrPubKey, | 1823 SECKEYPublicKey *srvrPubKey, |
1792 SECKEYPrivateKey *srvrPrivKey); | 1824 SECKEYPrivateKey *srvrPrivKey); |
1793 extern SECStatus ssl3_SendECDHServerKeyExchange(sslSocket *ss, | 1825 extern SECStatus ssl3_SendECDHServerKeyExchange( |
1794 » » » const SSL3SignatureAndHashAlgorithm *sigAndHash); | 1826 sslSocket *ss, const SSLSignatureAndHashAlg *sigAndHash); |
1795 #endif | 1827 #endif |
1796 | 1828 |
1797 extern SECStatus ssl3_ComputeCommonKeyHash(SECOidTag hashAlg, | 1829 extern SECStatus ssl3_ComputeCommonKeyHash(SSLHashType hashAlg, |
1798 PRUint8 * hashBuf, | 1830 PRUint8 * hashBuf, |
1799 unsigned int bufLen, SSL3Hashes *hashes, | 1831 unsigned int bufLen, SSL3Hashes *hashes, |
1800 PRBool bypassPKCS11); | 1832 PRBool bypassPKCS11); |
1801 extern void ssl3_DestroyCipherSpec(ssl3CipherSpec *spec, PRBool freeSrvName); | 1833 extern void ssl3_DestroyCipherSpec(ssl3CipherSpec *spec, PRBool freeSrvName); |
1802 extern SECStatus ssl3_InitPendingCipherSpec(sslSocket *ss, PK11SymKey *pms); | 1834 extern SECStatus ssl3_InitPendingCipherSpec(sslSocket *ss, PK11SymKey *pms); |
1803 extern SECStatus ssl3_AppendHandshake(sslSocket *ss, const void *void_src, | 1835 extern SECStatus ssl3_AppendHandshake(sslSocket *ss, const void *void_src, |
1804 PRInt32 bytes); | 1836 PRInt32 bytes); |
1805 extern SECStatus ssl3_AppendHandshakeHeader(sslSocket *ss, | 1837 extern SECStatus ssl3_AppendHandshakeHeader(sslSocket *ss, |
1806 SSL3HandshakeType t, PRUint32 length); | 1838 SSL3HandshakeType t, PRUint32 length); |
1807 extern SECStatus ssl3_AppendHandshakeNumber(sslSocket *ss, PRInt32 num, | 1839 extern SECStatus ssl3_AppendHandshakeNumber(sslSocket *ss, PRInt32 num, |
1808 PRInt32 lenSize); | 1840 PRInt32 lenSize); |
1809 extern SECStatus ssl3_AppendHandshakeVariable( sslSocket *ss, | 1841 extern SECStatus ssl3_AppendHandshakeVariable( sslSocket *ss, |
1810 const SSL3Opaque *src, PRInt32 bytes, PRInt32 lenSize); | 1842 const SSL3Opaque *src, PRInt32 bytes, PRInt32 lenSize); |
1811 extern SECStatus ssl3_AppendSignatureAndHashAlgorithm(sslSocket *ss, | 1843 extern SECStatus ssl3_AppendSignatureAndHashAlgorithm( |
1812 » » » const SSL3SignatureAndHashAlgorithm* sigAndHash); | 1844 sslSocket *ss, const SSLSignatureAndHashAlg* sigAndHash); |
1813 extern SECStatus ssl3_ConsumeHandshake(sslSocket *ss, void *v, PRInt32 bytes, | 1845 extern SECStatus ssl3_ConsumeHandshake(sslSocket *ss, void *v, PRInt32 bytes, |
1814 SSL3Opaque **b, PRUint32 *length); | 1846 SSL3Opaque **b, PRUint32 *length); |
1815 extern PRInt32 ssl3_ConsumeHandshakeNumber(sslSocket *ss, PRInt32 bytes, | 1847 extern PRInt32 ssl3_ConsumeHandshakeNumber(sslSocket *ss, PRInt32 bytes, |
1816 SSL3Opaque **b, PRUint32 *length); | 1848 SSL3Opaque **b, PRUint32 *length); |
1817 extern SECStatus ssl3_ConsumeHandshakeVariable(sslSocket *ss, SECItem *i, | 1849 extern SECStatus ssl3_ConsumeHandshakeVariable(sslSocket *ss, SECItem *i, |
1818 PRInt32 bytes, SSL3Opaque **b, PRUint32 *length); | 1850 PRInt32 bytes, SSL3Opaque **b, PRUint32 *length); |
1819 extern SECOidTag ssl3_TLSHashAlgorithmToOID(int hashFunc); | 1851 extern PRBool ssl3_IsSupportedSignatureAlgorithm( |
| 1852 const SSLSignatureAndHashAlg *alg); |
1820 extern SECStatus ssl3_CheckSignatureAndHashAlgorithmConsistency( | 1853 extern SECStatus ssl3_CheckSignatureAndHashAlgorithmConsistency( |
1821 » » » const SSL3SignatureAndHashAlgorithm *sigAndHash, | 1854 sslSocket *ss, const SSLSignatureAndHashAlg *sigAndHash, |
1822 » » » CERTCertificate* cert); | 1855 CERTCertificate* cert); |
1823 extern SECStatus ssl3_ConsumeSignatureAndHashAlgorithm(sslSocket *ss, | 1856 extern SECStatus ssl3_ConsumeSignatureAndHashAlgorithm( |
1824 » » » SSL3Opaque **b, PRUint32 *length, | 1857 sslSocket *ss, SSL3Opaque **b, PRUint32 *length, |
1825 » » » SSL3SignatureAndHashAlgorithm *out); | 1858 SSLSignatureAndHashAlg *out); |
1826 extern SECStatus ssl3_SignHashes(SSL3Hashes *hash, SECKEYPrivateKey *key, | 1859 extern SECStatus ssl3_SignHashes(SSL3Hashes *hash, SECKEYPrivateKey *key, |
1827 SECItem *buf, PRBool isTLS); | 1860 SECItem *buf, PRBool isTLS); |
1828 extern SECStatus ssl3_VerifySignedHashes(SSL3Hashes *hash, | 1861 extern SECStatus ssl3_VerifySignedHashes(SSL3Hashes *hash, |
1829 CERTCertificate *cert, SECItem *buf, PRBool isTLS, | 1862 CERTCertificate *cert, SECItem *buf, PRBool isTLS, |
1830 void *pwArg); | 1863 void *pwArg); |
1831 extern SECStatus ssl3_CacheWrappedMasterSecret(sslSocket *ss, | 1864 extern SECStatus ssl3_CacheWrappedMasterSecret(sslSocket *ss, |
1832 sslSessionID *sid, ssl3CipherSpec *spec, | 1865 sslSessionID *sid, ssl3CipherSpec *spec, |
1833 SSL3KEAType effectiveExchKeyType); | 1866 SSL3KEAType effectiveExchKeyType); |
1834 | 1867 |
1835 /* Functions that handle ClientHello and ServerHello extensions. */ | 1868 /* Functions that handle ClientHello and ServerHello extensions. */ |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1883 extern SECStatus ssl3_SendNewSessionTicket(sslSocket *ss); | 1916 extern SECStatus ssl3_SendNewSessionTicket(sslSocket *ss); |
1884 extern PRBool ssl_GetSessionTicketKeys(unsigned char *keyName, | 1917 extern PRBool ssl_GetSessionTicketKeys(unsigned char *keyName, |
1885 unsigned char *encKey, unsigned char *macKey); | 1918 unsigned char *encKey, unsigned char *macKey); |
1886 extern PRBool ssl_GetSessionTicketKeysPKCS11(SECKEYPrivateKey *svrPrivKey, | 1919 extern PRBool ssl_GetSessionTicketKeysPKCS11(SECKEYPrivateKey *svrPrivKey, |
1887 SECKEYPublicKey *svrPubKey, void *pwArg, | 1920 SECKEYPublicKey *svrPubKey, void *pwArg, |
1888 unsigned char *keyName, PK11SymKey **aesKey, | 1921 unsigned char *keyName, PK11SymKey **aesKey, |
1889 PK11SymKey **macKey); | 1922 PK11SymKey **macKey); |
1890 | 1923 |
1891 /* Tell clients to consider tickets valid for this long. */ | 1924 /* Tell clients to consider tickets valid for this long. */ |
1892 #define TLS_EX_SESS_TICKET_LIFETIME_HINT (2 * 24 * 60 * 60) /* 2 days */ | 1925 #define TLS_EX_SESS_TICKET_LIFETIME_HINT (2 * 24 * 60 * 60) /* 2 days */ |
1893 #define TLS_EX_SESS_TICKET_VERSION (0x0100) | 1926 #define TLS_EX_SESS_TICKET_VERSION (0x0101) |
1894 | 1927 |
1895 extern SECStatus ssl3_ValidateNextProtoNego(const unsigned char* data, | 1928 extern SECStatus ssl3_ValidateNextProtoNego(const unsigned char* data, |
1896 unsigned int length); | 1929 unsigned int length); |
1897 | 1930 |
1898 extern SECStatus ssl3_GetTLSUniqueChannelBinding(sslSocket *ss, | 1931 extern SECStatus ssl3_GetTLSUniqueChannelBinding(sslSocket *ss, |
1899 unsigned char *out, | 1932 unsigned char *out, |
1900 unsigned int *outLen, | 1933 unsigned int *outLen, |
1901 unsigned int outLenMax); | 1934 unsigned int outLenMax); |
1902 | 1935 |
1903 /* Construct a new NSPR socket for the app to use */ | 1936 /* Construct a new NSPR socket for the app to use */ |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2017 | 2050 |
2018 SECStatus SSL_DisableDefaultExportCipherSuites(void); | 2051 SECStatus SSL_DisableDefaultExportCipherSuites(void); |
2019 SECStatus SSL_DisableExportCipherSuites(PRFileDesc * fd); | 2052 SECStatus SSL_DisableExportCipherSuites(PRFileDesc * fd); |
2020 PRBool SSL_IsExportCipherSuite(PRUint16 cipherSuite); | 2053 PRBool SSL_IsExportCipherSuite(PRUint16 cipherSuite); |
2021 | 2054 |
2022 extern SECStatus | 2055 extern SECStatus |
2023 ssl3_TLSPRFWithMasterSecret(ssl3CipherSpec *spec, | 2056 ssl3_TLSPRFWithMasterSecret(ssl3CipherSpec *spec, |
2024 const char *label, unsigned int labelLen, | 2057 const char *label, unsigned int labelLen, |
2025 const unsigned char *val, unsigned int valLen, | 2058 const unsigned char *val, unsigned int valLen, |
2026 unsigned char *out, unsigned int outLen); | 2059 unsigned char *out, unsigned int outLen); |
| 2060 extern SECOidTag |
| 2061 ssl3_TLSHashAlgorithmToOID(SSLHashType hashFunc); |
2027 | 2062 |
2028 #ifdef TRACE | 2063 #ifdef TRACE |
2029 #define SSL_TRACE(msg) ssl_Trace msg | 2064 #define SSL_TRACE(msg) ssl_Trace msg |
2030 #else | 2065 #else |
2031 #define SSL_TRACE(msg) | 2066 #define SSL_TRACE(msg) |
2032 #endif | 2067 #endif |
2033 | 2068 |
2034 void ssl_Trace(const char *format, ...); | 2069 void ssl_Trace(const char *format, ...); |
2035 | 2070 |
2036 SEC_END_PROTOS | 2071 SEC_END_PROTOS |
2037 | 2072 |
2038 #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS) | 2073 #if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_BEOS) |
2039 #define SSL_GETPID getpid | 2074 #define SSL_GETPID getpid |
2040 #elif defined(WIN32) | 2075 #elif defined(WIN32) |
2041 extern int __cdecl _getpid(void); | 2076 extern int __cdecl _getpid(void); |
2042 #define SSL_GETPID _getpid | 2077 #define SSL_GETPID _getpid |
2043 #else | 2078 #else |
2044 #define SSL_GETPID() 0 | 2079 #define SSL_GETPID() 0 |
2045 #endif | 2080 #endif |
2046 | 2081 |
2047 #endif /* __sslimpl_h_ */ | 2082 #endif /* __sslimpl_h_ */ |
OLD | NEW |