OLD | NEW |
---|---|
1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ | 1 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
2 /* | 2 /* |
3 * SSL3 Protocol | 3 * SSL3 Protocol |
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 | 8 |
9 /* TODO(ekr): Implement HelloVerifyRequest on server side. OK for now. */ | 9 /* TODO(ekr): Implement HelloVerifyRequest on server side. OK for now. */ |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 | 42 |
43 #include <stdio.h> | 43 #include <stdio.h> |
44 #ifdef NSS_ENABLE_ZLIB | 44 #ifdef NSS_ENABLE_ZLIB |
45 #include "zlib.h" | 45 #include "zlib.h" |
46 #endif | 46 #endif |
47 | 47 |
48 #ifndef PK11_SETATTRS | 48 #ifndef PK11_SETATTRS |
49 #define PK11_SETATTRS(x,id,v,l) (x)->type = (id); \ | 49 #define PK11_SETATTRS(x,id,v,l) (x)->type = (id); \ |
50 (x)->pValue=(v); (x)->ulValueLen = (l); | 50 (x)->pValue=(v); (x)->ulValueLen = (l); |
51 #endif | 51 #endif |
52 #ifndef PR_ARRAY_SIZE | |
James Cook
2013/08/09 20:11:39
Did you mean to change this?
| |
53 #define PR_ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) | |
54 #endif | |
55 #ifndef PR_ARRAY_SIZE | |
56 #define PR_ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0])) | |
57 #endif | |
52 | 58 |
53 static SECStatus ssl3_AuthCertificate(sslSocket *ss); | 59 static SECStatus ssl3_AuthCertificate(sslSocket *ss); |
54 static void ssl3_CleanupPeerCerts(sslSocket *ss); | 60 static void ssl3_CleanupPeerCerts(sslSocket *ss); |
55 static void ssl3_CopyPeerCertsFromSID(sslSocket *ss, sslSessionID *sid); | 61 static void ssl3_CopyPeerCertsFromSID(sslSocket *ss, sslSessionID *sid); |
56 static PK11SymKey *ssl3_GenerateRSAPMS(sslSocket *ss, ssl3CipherSpec *spec, | 62 static PK11SymKey *ssl3_GenerateRSAPMS(sslSocket *ss, ssl3CipherSpec *spec, |
57 PK11SlotInfo * serverKeySlot); | 63 PK11SlotInfo * serverKeySlot); |
58 static SECStatus ssl3_DeriveMasterSecret(sslSocket *ss, PK11SymKey *pms); | 64 static SECStatus ssl3_DeriveMasterSecret(sslSocket *ss, PK11SymKey *pms); |
59 static SECStatus ssl3_DeriveConnectionKeysPKCS11(sslSocket *ss); | 65 static SECStatus ssl3_DeriveConnectionKeysPKCS11(sslSocket *ss); |
60 static SECStatus ssl3_HandshakeFailure( sslSocket *ss); | 66 static SECStatus ssl3_HandshakeFailure( sslSocket *ss); |
61 static SECStatus ssl3_InitState( sslSocket *ss); | 67 static SECStatus ssl3_InitState( sslSocket *ss); |
(...skipping 4006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4068 } | 4074 } |
4069 | 4075 |
4070 /* tlsHashOIDMap contains the mapping between TLS hash identifiers and the | 4076 /* tlsHashOIDMap contains the mapping between TLS hash identifiers and the |
4071 * SECOidTag used internally by NSS. */ | 4077 * SECOidTag used internally by NSS. */ |
4072 static const struct { | 4078 static const struct { |
4073 int tlsHash; | 4079 int tlsHash; |
4074 SECOidTag oid; | 4080 SECOidTag oid; |
4075 } tlsHashOIDMap[] = { | 4081 } tlsHashOIDMap[] = { |
4076 { tls_hash_md5, SEC_OID_MD5 }, | 4082 { tls_hash_md5, SEC_OID_MD5 }, |
4077 { tls_hash_sha1, SEC_OID_SHA1 }, | 4083 { tls_hash_sha1, SEC_OID_SHA1 }, |
4084 #if defined(SEC_OID_SHA224) | |
4078 { tls_hash_sha224, SEC_OID_SHA224 }, | 4085 { tls_hash_sha224, SEC_OID_SHA224 }, |
4086 #endif | |
4079 { tls_hash_sha256, SEC_OID_SHA256 }, | 4087 { tls_hash_sha256, SEC_OID_SHA256 }, |
4080 { tls_hash_sha384, SEC_OID_SHA384 }, | 4088 { tls_hash_sha384, SEC_OID_SHA384 }, |
4081 { tls_hash_sha512, SEC_OID_SHA512 } | 4089 { tls_hash_sha512, SEC_OID_SHA512 } |
4082 }; | 4090 }; |
4083 | 4091 |
4084 /* ssl3_TLSHashAlgorithmToOID converts a TLS hash identifier into an OID value. | 4092 /* ssl3_TLSHashAlgorithmToOID converts a TLS hash identifier into an OID value. |
4085 * If the hash is not recognised, SEC_OID_UNKNOWN is returned. | 4093 * If the hash is not recognised, SEC_OID_UNKNOWN is returned. |
4086 * | 4094 * |
4087 * See https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1 */ | 4095 * See https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1 */ |
4088 SECOidTag | 4096 SECOidTag |
(...skipping 7881 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
11970 PORT_Free(ss->ssl3.hs.recvdFragments.buf); | 11978 PORT_Free(ss->ssl3.hs.recvdFragments.buf); |
11971 } | 11979 } |
11972 } | 11980 } |
11973 | 11981 |
11974 ss->ssl3.initialized = PR_FALSE; | 11982 ss->ssl3.initialized = PR_FALSE; |
11975 | 11983 |
11976 SECITEM_FreeItem(&ss->ssl3.nextProto, PR_FALSE); | 11984 SECITEM_FreeItem(&ss->ssl3.nextProto, PR_FALSE); |
11977 } | 11985 } |
11978 | 11986 |
11979 /* End of ssl3con.c */ | 11987 /* End of ssl3con.c */ |
OLD | NEW |