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

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

Issue 11275240: Update net/third_party/nss/ssl to NSS 3.14. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Upload before commit Created 8 years, 1 month 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
« no previous file with comments | « net/third_party/nss/ssl/sslgathr.c ('k') | net/third_party/nss/ssl/sslinfo.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 * ***** BEGIN LICENSE BLOCK ***** 5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 * The contents of this file are subject to the Mozilla Public License Version 8 /* $Id: sslimpl.h,v 1.108 2012/09/28 01:46:45 wtc%google.com Exp $ */
9 * 1.1 (the "License"); you may not use this file except in compliance with
10 * the License. You may obtain a copy of the License at
11 * http://www.mozilla.org/MPL/
12 *
13 * Software distributed under the License is distributed on an "AS IS" basis,
14 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
15 * for the specific language governing rights and limitations under the
16 * License.
17 *
18 * The Original Code is the Netscape security libraries.
19 *
20 * The Initial Developer of the Original Code is
21 * Netscape Communications Corporation.
22 * Portions created by the Initial Developer are Copyright (C) 1994-2000
23 * the Initial Developer. All Rights Reserved.
24 *
25 * Contributor(s):
26 * Dr Stephen Henson <stephen.henson@gemplus.com>
27 * Dr Vipul Gupta <vipul.gupta@sun.com>, Sun Microsystems Laboratories
28 *
29 * Alternatively, the contents of this file may be used under the terms of
30 * either the GNU General Public License Version 2 or later (the "GPL"), or
31 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
32 * in which case the provisions of the GPL or the LGPL are applicable instead
33 * of those above. If you wish to allow use of your version of this file only
34 * under the terms of either the GPL or the LGPL, and not to allow others to
35 * use your version of this file under the terms of the MPL, indicate your
36 * decision by deleting the provisions above and replace them with the notice
37 * and other provisions required by the GPL or the LGPL. If you do not delete
38 * the provisions above, a recipient may use your version of this file under
39 * the terms of any one of the MPL, the GPL or the LGPL.
40 *
41 * ***** END LICENSE BLOCK ***** */
42 /* $Id: sslimpl.h,v 1.100 2012/03/18 00:31:20 wtc%google.com Exp $ */
43 9
44 #ifndef __sslimpl_h_ 10 #ifndef __sslimpl_h_
45 #define __sslimpl_h_ 11 #define __sslimpl_h_
46 12
47 #ifdef DEBUG 13 #ifdef DEBUG
48 #undef NDEBUG 14 #undef NDEBUG
49 #else 15 #else
50 #undef NDEBUG 16 #undef NDEBUG
51 #define NDEBUG 17 #define NDEBUG
52 #endif 18 #endif
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 cipher_aes_256, 485 cipher_aes_256,
520 cipher_camellia_128, 486 cipher_camellia_128,
521 cipher_camellia_256, 487 cipher_camellia_256,
522 cipher_seed, 488 cipher_seed,
523 cipher_missing /* reserved for no such supported cipher */ 489 cipher_missing /* reserved for no such supported cipher */
524 /* This enum must match ssl3_cipherName[] in ssl3con.c. */ 490 /* This enum must match ssl3_cipherName[] in ssl3con.c. */
525 } SSL3BulkCipher; 491 } SSL3BulkCipher;
526 492
527 typedef enum { type_stream, type_block } CipherType; 493 typedef enum { type_stream, type_block } CipherType;
528 494
529 /* This value matches the size of IVs in ssl3SidKeys. */
530 #define MAX_IV_LENGTH 24 495 #define MAX_IV_LENGTH 24
531 496
532 /* 497 /*
533 * Do not depend upon 64 bit arithmetic in the underlying machine. 498 * Do not depend upon 64 bit arithmetic in the underlying machine.
534 */ 499 */
535 typedef struct { 500 typedef struct {
536 PRUint32 high; 501 PRUint32 high;
537 PRUint32 low; 502 PRUint32 low;
538 } SSL3SequenceNumber; 503 } SSL3SequenceNumber;
539 504
540 typedef PRUint16 DTLSEpoch; 505 typedef PRUint16 DTLSEpoch;
541 506
542 typedef void (*DTLSTimerCb)(sslSocket *); 507 typedef void (*DTLSTimerCb)(sslSocket *);
543 508
544 #define MAX_MAC_CONTEXT_BYTES 400 509 #define MAX_MAC_CONTEXT_BYTES 400
545 #define MAX_MAC_CONTEXT_LLONGS (MAX_MAC_CONTEXT_BYTES / 8) 510 #define MAX_MAC_CONTEXT_LLONGS (MAX_MAC_CONTEXT_BYTES / 8)
546 511
547 #define MAX_CIPHER_CONTEXT_BYTES 2080 512 #define MAX_CIPHER_CONTEXT_BYTES 2080
548 #define MAX_CIPHER_CONTEXT_LLONGS (MAX_CIPHER_CONTEXT_BYTES / 8) 513 #define MAX_CIPHER_CONTEXT_LLONGS (MAX_CIPHER_CONTEXT_BYTES / 8)
549 514
550 typedef struct { 515 typedef struct {
551 SSL3Opaque client_write_iv [24]; 516 SSL3Opaque wrapped_master_secret[48];
552 SSL3Opaque server_write_iv [24];
553 SSL3Opaque wrapped_master_secret [48];
554 PRUint16 wrapped_master_secret_len; 517 PRUint16 wrapped_master_secret_len;
555 PRUint8 msIsWrapped; 518 PRUint8 msIsWrapped;
556 PRUint8 resumable; 519 PRUint8 resumable;
557 } ssl3SidKeys; /* 100 bytes */ 520 } ssl3SidKeys; /* 52 bytes */
558 521
559 typedef struct { 522 typedef struct {
560 PK11SymKey *write_key; 523 PK11SymKey *write_key;
561 PK11SymKey *write_mac_key; 524 PK11SymKey *write_mac_key;
562 PK11Context *write_mac_context; 525 PK11Context *write_mac_context;
563 SECItem write_key_item; 526 SECItem write_key_item;
564 SECItem write_iv_item; 527 SECItem write_iv_item;
565 SECItem write_mac_key_item; 528 SECItem write_mac_key_item;
566 SSL3Opaque write_iv[MAX_IV_LENGTH]; 529 SSL3Opaque write_iv[MAX_IV_LENGTH];
567 PRUint64 cipher_context[MAX_CIPHER_CONTEXT_LLONGS]; 530 PRUint64 cipher_context[MAX_CIPHER_CONTEXT_LLONGS];
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 /* Which function should SSL_RestartHandshake* call if we're blocked? 838 /* Which function should SSL_RestartHandshake* call if we're blocked?
876 * One of NULL, ssl3_SendClientSecondRound, ssl3_FinishHandshake, 839 * One of NULL, ssl3_SendClientSecondRound, ssl3_FinishHandshake,
877 * or ssl3_AlwaysFail */ 840 * or ssl3_AlwaysFail */
878 sslRestartTarget restartTarget; 841 sslRestartTarget restartTarget;
879 /* Shared state between ssl3_HandleFinished and ssl3_FinishHandshake */ 842 /* Shared state between ssl3_HandleFinished and ssl3_FinishHandshake */
880 PRBool cacheSID; 843 PRBool cacheSID;
881 844
882 /* This group of values is used for DTLS */ 845 /* This group of values is used for DTLS */
883 PRUint16 sendMessageSeq; /* The sending message sequence 846 PRUint16 sendMessageSeq; /* The sending message sequence
884 * number */ 847 * number */
885 PRCList * lastMessageFlight; /* The last message flight we sent. 848 PRCList lastMessageFlight; /* The last message flight we
886 » » » » » * This is a pointer because 849 » » » » » * sent */
887 » » » » » *»ssl_FreeSocket relocates the
888 » » » » » *»structure in DEBUG mode, which
889 » » » » » * messes up the list macros */
890 PRUint16 maxMessageSent; /* The largest message we sent */ 850 PRUint16 maxMessageSent; /* The largest message we sent */
891 PRUint16 recvMessageSeq; /* The receiving message sequence 851 PRUint16 recvMessageSeq; /* The receiving message sequence
892 * number */ 852 * number */
893 sslBuffer recvdFragments; /* The fragments we have received in 853 sslBuffer recvdFragments; /* The fragments we have received in
894 * a bitmask */ 854 * a bitmask */
895 PRInt32 recvdHighWater; /* The high water mark for fragments 855 PRInt32 recvdHighWater; /* The high water mark for fragments
896 * received. -1 means no reassembly 856 * received. -1 means no reassembly
897 * in progress. */ 857 * in progress. */
898 unsigned char cookie[32]; /* The cookie */ 858 unsigned char cookie[32]; /* The cookie */
899 unsigned char cookieLen; /* The length of the cookie */ 859 unsigned char cookieLen; /* The length of the cookie */
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 } SSL3Ciphertext; 937 } SSL3Ciphertext;
978 938
979 struct ssl3KeyPairStr { 939 struct ssl3KeyPairStr {
980 SECKEYPrivateKey * privKey; 940 SECKEYPrivateKey * privKey;
981 SECKEYPublicKey * pubKey; 941 SECKEYPublicKey * pubKey;
982 PRInt32 refCount; /* use PR_Atomic calls for this. */ 942 PRInt32 refCount; /* use PR_Atomic calls for this. */
983 }; 943 };
984 944
985 typedef struct SSLWrappedSymWrappingKeyStr { 945 typedef struct SSLWrappedSymWrappingKeyStr {
986 SSL3Opaque wrappedSymmetricWrappingkey[512]; 946 SSL3Opaque wrappedSymmetricWrappingkey[512];
987 SSL3Opaque wrapIV[24];
988 CK_MECHANISM_TYPE symWrapMechanism; 947 CK_MECHANISM_TYPE symWrapMechanism;
989 /* unwrapped symmetric wrapping key uses this mechanism */ 948 /* unwrapped symmetric wrapping key uses this mechanism */
990 CK_MECHANISM_TYPE asymWrapMechanism; 949 CK_MECHANISM_TYPE asymWrapMechanism;
991 /* mechanism used to wrap the SymmetricWrappingKey using 950 /* mechanism used to wrap the SymmetricWrappingKey using
992 * server's public and/or private keys. */ 951 * server's public and/or private keys. */
993 SSL3KEAType exchKeyType; /* type of keys used to wrap SymWrapKey*/ 952 SSL3KEAType exchKeyType; /* type of keys used to wrap SymWrapKey*/
994 PRInt32 symWrapMechIndex; 953 PRInt32 symWrapMechIndex;
995 PRUint16 wrappedSymKeyLen; 954 PRUint16 wrappedSymKeyLen;
996 PRUint16 wrapIVLen;
997 } SSLWrappedSymWrappingKey; 955 } SSLWrappedSymWrappingKey;
998 956
999 typedef struct SessionTicketStr { 957 typedef struct SessionTicketStr {
1000 uint16 ticket_version; 958 uint16 ticket_version;
1001 SSL3ProtocolVersion ssl_version; 959 SSL3ProtocolVersion ssl_version;
1002 ssl3CipherSuite cipher_suite; 960 ssl3CipherSuite cipher_suite;
1003 SSLCompressionMethod compression_method; 961 SSLCompressionMethod compression_method;
1004 SSLSignType authAlgorithm; 962 SSLSignType authAlgorithm;
1005 uint32 authKeyBits; 963 uint32 authKeyBits;
1006 SSLKEAType keaType; 964 SSLKEAType keaType;
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 extern SECStatus ssl2_HandleClientHelloMessage(sslSocket *ss); 1327 extern SECStatus ssl2_HandleClientHelloMessage(sslSocket *ss);
1370 extern SECStatus ssl2_HandleServerHelloMessage(sslSocket *ss); 1328 extern SECStatus ssl2_HandleServerHelloMessage(sslSocket *ss);
1371 extern int ssl2_StartGatherBytes(sslSocket *ss, sslGather *gs, 1329 extern int ssl2_StartGatherBytes(sslSocket *ss, sslGather *gs,
1372 unsigned int count); 1330 unsigned int count);
1373 1331
1374 extern SECStatus ssl_CreateSecurityInfo(sslSocket *ss); 1332 extern SECStatus ssl_CreateSecurityInfo(sslSocket *ss);
1375 extern SECStatus ssl_CopySecurityInfo(sslSocket *ss, sslSocket *os); 1333 extern SECStatus ssl_CopySecurityInfo(sslSocket *ss, sslSocket *os);
1376 extern void ssl_ResetSecurityInfo(sslSecurityInfo *sec, PRBool doMemset); 1334 extern void ssl_ResetSecurityInfo(sslSecurityInfo *sec, PRBool doMemset);
1377 extern void ssl_DestroySecurityInfo(sslSecurityInfo *sec); 1335 extern void ssl_DestroySecurityInfo(sslSecurityInfo *sec);
1378 1336
1379 extern sslSocket * ssl_DupSocket(sslSocket *old);
1380
1381 extern void ssl_PrintBuf(sslSocket *ss, const char *msg, const void *cp, int len); 1337 extern void ssl_PrintBuf(sslSocket *ss, const char *msg, const void *cp, int len);
1382 extern void ssl_DumpMsg(sslSocket *ss, unsigned char *bp, unsigned len); 1338 extern void ssl_DumpMsg(sslSocket *ss, unsigned char *bp, unsigned len);
1383 1339
1384 extern int ssl_SendSavedWriteData(sslSocket *ss); 1340 extern int ssl_SendSavedWriteData(sslSocket *ss);
1385 extern SECStatus ssl_SaveWriteData(sslSocket *ss, 1341 extern SECStatus ssl_SaveWriteData(sslSocket *ss,
1386 const void* p, unsigned int l); 1342 const void* p, unsigned int l);
1387 extern SECStatus ssl2_BeginClientHandshake(sslSocket *ss); 1343 extern SECStatus ssl2_BeginClientHandshake(sslSocket *ss);
1388 extern SECStatus ssl2_BeginServerHandshake(sslSocket *ss); 1344 extern SECStatus ssl2_BeginServerHandshake(sslSocket *ss);
1389 extern int ssl_Do1stHandshake(sslSocket *ss); 1345 extern int ssl_Do1stHandshake(sslSocket *ss);
1390 1346
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1738 extern PRInt32 ssl3_SendServerNameXtn(sslSocket *ss, PRBool append, 1694 extern PRInt32 ssl3_SendServerNameXtn(sslSocket *ss, PRBool append,
1739 PRUint32 maxBytes); 1695 PRUint32 maxBytes);
1740 1696
1741 /* Assigns new cert, cert chain and keys to ss->serverCerts 1697 /* Assigns new cert, cert chain and keys to ss->serverCerts
1742 * struct. If certChain is NULL, tries to find one. Aborts if 1698 * struct. If certChain is NULL, tries to find one. Aborts if
1743 * fails to do so. If cert and keyPair are NULL - unconfigures 1699 * fails to do so. If cert and keyPair are NULL - unconfigures
1744 * sslSocket of kea type.*/ 1700 * sslSocket of kea type.*/
1745 extern SECStatus ssl_ConfigSecureServer(sslSocket *ss, CERTCertificate *cert, 1701 extern SECStatus ssl_ConfigSecureServer(sslSocket *ss, CERTCertificate *cert,
1746 const CERTCertificateList *certChain, 1702 const CERTCertificateList *certChain,
1747 ssl3KeyPair *keyPair, SSLKEAType kea); 1703 ssl3KeyPair *keyPair, SSLKEAType kea);
1748 /* Return key type for the cert */
1749 extern SSLKEAType ssl_FindCertKEAType(CERTCertificate * cert);
1750 1704
1751 #ifdef NSS_ENABLE_ECC 1705 #ifdef NSS_ENABLE_ECC
1752 extern PRInt32 ssl3_SendSupportedCurvesXtn(sslSocket *ss, 1706 extern PRInt32 ssl3_SendSupportedCurvesXtn(sslSocket *ss,
1753 PRBool append, PRUint32 maxBytes); 1707 PRBool append, PRUint32 maxBytes);
1754 extern PRInt32 ssl3_SendSupportedPointFormatsXtn(sslSocket *ss, 1708 extern PRInt32 ssl3_SendSupportedPointFormatsXtn(sslSocket *ss,
1755 PRBool append, PRUint32 maxBytes); 1709 PRBool append, PRUint32 maxBytes);
1756 #endif 1710 #endif
1757 1711
1758 /* call the registered extension handlers. */ 1712 /* call the registered extension handlers. */
1759 extern SECStatus ssl3_HandleHelloExtensions(sslSocket *ss, 1713 extern SECStatus ssl3_HandleHelloExtensions(sslSocket *ss,
(...skipping 24 matching lines...) Expand all
1784 unsigned int outLenMax); 1738 unsigned int outLenMax);
1785 1739
1786 /* Construct a new NSPR socket for the app to use */ 1740 /* Construct a new NSPR socket for the app to use */
1787 extern PRFileDesc *ssl_NewPRSocket(sslSocket *ss, PRFileDesc *fd); 1741 extern PRFileDesc *ssl_NewPRSocket(sslSocket *ss, PRFileDesc *fd);
1788 extern void ssl_FreePRSocket(PRFileDesc *fd); 1742 extern void ssl_FreePRSocket(PRFileDesc *fd);
1789 1743
1790 /* Internal config function so SSL2 can initialize the present state of 1744 /* Internal config function so SSL2 can initialize the present state of
1791 * various ciphers */ 1745 * various ciphers */
1792 extern int ssl3_config_match_init(sslSocket *); 1746 extern int ssl3_config_match_init(sslSocket *);
1793 1747
1794
1795 /* Create a new ref counted key pair object from two keys. */ 1748 /* Create a new ref counted key pair object from two keys. */
1796 extern ssl3KeyPair * ssl3_NewKeyPair( SECKEYPrivateKey * privKey, 1749 extern ssl3KeyPair * ssl3_NewKeyPair( SECKEYPrivateKey * privKey,
1797 SECKEYPublicKey * pubKey); 1750 SECKEYPublicKey * pubKey);
1798 1751
1799 /* get a new reference (bump ref count) to an ssl3KeyPair. */ 1752 /* get a new reference (bump ref count) to an ssl3KeyPair. */
1800 extern ssl3KeyPair * ssl3_GetKeyPairRef(ssl3KeyPair * keyPair); 1753 extern ssl3KeyPair * ssl3_GetKeyPairRef(ssl3KeyPair * keyPair);
1801 1754
1802 /* Decrement keypair's ref count and free if zero. */ 1755 /* Decrement keypair's ref count and free if zero. */
1803 extern void ssl3_FreeKeyPair(ssl3KeyPair * keyPair); 1756 extern void ssl3_FreeKeyPair(ssl3KeyPair * keyPair);
1804 1757
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 #elif defined(_WIN32_WCE) 1874 #elif defined(_WIN32_WCE)
1922 #define SSL_GETPID GetCurrentProcessId 1875 #define SSL_GETPID GetCurrentProcessId
1923 #elif defined(WIN32) 1876 #elif defined(WIN32)
1924 extern int __cdecl _getpid(void); 1877 extern int __cdecl _getpid(void);
1925 #define SSL_GETPID _getpid 1878 #define SSL_GETPID _getpid
1926 #else 1879 #else
1927 #define SSL_GETPID() 0 1880 #define SSL_GETPID() 0
1928 #endif 1881 #endif
1929 1882
1930 #endif /* __sslimpl_h_ */ 1883 #endif /* __sslimpl_h_ */
OLDNEW
« no previous file with comments | « net/third_party/nss/ssl/sslgathr.c ('k') | net/third_party/nss/ssl/sslinfo.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698