OLD | NEW |
1 /* | 1 /* |
2 * This file contains prototypes for the public SSL functions. | 2 * This file contains prototypes for the public SSL functions. |
3 * | 3 * |
4 * This Source Code Form is subject to the terms of the Mozilla Public | 4 * This Source Code Form is subject to the terms of the Mozilla Public |
5 * License, v. 2.0. If a copy of the MPL was not distributed with this | 5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | 6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
7 | 7 |
8 #ifndef __ssl_h_ | 8 #ifndef __ssl_h_ |
9 #define __ssl_h_ | 9 #define __ssl_h_ |
10 | 10 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 /* DEFLATE (off by default) */ | 114 /* DEFLATE (off by default) */ |
115 #define SSL_ENABLE_RENEGOTIATION 20 /* Values below (default: never) */ | 115 #define SSL_ENABLE_RENEGOTIATION 20 /* Values below (default: never) */ |
116 #define SSL_REQUIRE_SAFE_NEGOTIATION 21 /* Peer must send Signaling */ | 116 #define SSL_REQUIRE_SAFE_NEGOTIATION 21 /* Peer must send Signaling */ |
117 /* Cipher Suite Value (SCSV) or */ | 117 /* Cipher Suite Value (SCSV) or */ |
118 /* Renegotiation Info (RI) */ | 118 /* Renegotiation Info (RI) */ |
119 /* extension in ALL handshakes. */ | 119 /* extension in ALL handshakes. */ |
120 /* default: off */ | 120 /* default: off */ |
121 #define SSL_ENABLE_FALSE_START 22 /* Enable SSL false start (off by */ | 121 #define SSL_ENABLE_FALSE_START 22 /* Enable SSL false start (off by */ |
122 /* default, applies only to */ | 122 /* default, applies only to */ |
123 /* clients). False start is a */ | 123 /* clients). False start is a */ |
124 /* mode where an SSL client will start sending application data before */ | 124 /* mode where an SSL client will start sending application data before |
125 /* verifying the server's Finished message. This means that we could end up */ | 125 * verifying the server's Finished message. This means that we could end up |
126 /* sending data to an imposter. However, the data will be encrypted and */ | 126 * sending data to an imposter. However, the data will be encrypted and |
127 /* only the true server can derive the session key. Thus, so long as the */ | 127 * only the true server can derive the session key. Thus, so long as the |
128 /* cipher isn't broken this is safe. Because of this, False Start will only */ | 128 * cipher isn't broken this is safe. The advantage of false start is that |
129 /* occur on RSA or DH ciphersuites where the cipher's key length is >= 80 */ | 129 * it saves a round trip for client-speaks-first protocols when performing a |
130 /* bits. The advantage of False Start is that it saves a round trip for */ | 130 * full handshake. |
131 /* client-speaks-first protocols when performing a full handshake. */ | 131 * |
| 132 * See SSL_DefaultCanFalseStart for the default criteria that NSS uses to |
| 133 * determine whether to false start or not. See SSL_SetCanFalseStartCallback |
| 134 * for how to change that criteria. In addition to those criteria, false start |
| 135 * will only be done when the server selects a cipher suite with an effective |
| 136 * key length of 80 bits or more (including RC4-128). Also, see |
| 137 * SSL_HandshakeCallback for a description on how false start affects when the |
| 138 * handshake callback gets called. |
| 139 */ |
132 | 140 |
133 /* For SSL 3.0 and TLS 1.0, by default we prevent chosen plaintext attacks | 141 /* For SSL 3.0 and TLS 1.0, by default we prevent chosen plaintext attacks |
134 * on SSL CBC mode cipher suites (see RFC 4346 Section F.3) by splitting | 142 * on SSL CBC mode cipher suites (see RFC 4346 Section F.3) by splitting |
135 * non-empty application_data records into two records; the first record has | 143 * non-empty application_data records into two records; the first record has |
136 * only the first byte of plaintext, and the second has the rest. | 144 * only the first byte of plaintext, and the second has the rest. |
137 * | 145 * |
138 * This only prevents the attack in the sending direction; the connection may | 146 * This only prevents the attack in the sending direction; the connection may |
139 * still be vulnerable to such attacks if the peer does not implement a similar | 147 * still be vulnerable to such attacks if the peer does not implement a similar |
140 * countermeasure. | 148 * countermeasure. |
141 * | 149 * |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
734 #define SSL_ENV_VAR_NAME "SSL_INHERITANCE" | 742 #define SSL_ENV_VAR_NAME "SSL_INHERITANCE" |
735 | 743 |
736 /* called in child to inherit SID Cache variables. | 744 /* called in child to inherit SID Cache variables. |
737 * If envString is NULL, this function will use the value of the environment | 745 * If envString is NULL, this function will use the value of the environment |
738 * variable "SSL_INHERITANCE", otherwise the string value passed in will be | 746 * variable "SSL_INHERITANCE", otherwise the string value passed in will be |
739 * used. | 747 * used. |
740 */ | 748 */ |
741 SSL_IMPORT SECStatus SSL_InheritMPServerSIDCache(const char * envString); | 749 SSL_IMPORT SECStatus SSL_InheritMPServerSIDCache(const char * envString); |
742 | 750 |
743 /* | 751 /* |
744 ** Set the callback on a particular socket that gets called when we finish | 752 ** Set the callback that normally gets called when the TLS handshake |
745 ** performing a handshake. | 753 ** is complete. If false start is not enabled, then the handshake callback is |
| 754 ** called after verifying the peer's Finished message and before sending |
| 755 ** outgoing application data and before processing incoming application data. |
| 756 ** |
| 757 ** If false start is enabled and there is a custom CanFalseStartCallback |
| 758 ** callback set, then the handshake callback gets called after the peer's |
| 759 ** Finished message has been verified, which may be after application data is |
| 760 ** sent. |
| 761 ** |
| 762 ** If false start is enabled and there is not a custom CanFalseStartCallback |
| 763 ** callback established with SSL_SetCanFalseStartCallback then the handshake |
| 764 ** callback gets called before any application data is sent, which may be |
| 765 ** before the peer's Finished message has been verified. |
746 */ | 766 */ |
747 typedef void (PR_CALLBACK *SSLHandshakeCallback)(PRFileDesc *fd, | 767 typedef void (PR_CALLBACK *SSLHandshakeCallback)(PRFileDesc *fd, |
748 void *client_data); | 768 void *client_data); |
749 SSL_IMPORT SECStatus SSL_HandshakeCallback(PRFileDesc *fd, | 769 SSL_IMPORT SECStatus SSL_HandshakeCallback(PRFileDesc *fd, |
750 SSLHandshakeCallback cb, void *client_data); | 770 SSLHandshakeCallback cb, void *client_data); |
751 | 771 |
| 772 /* Applications that wish to customize TLS false start should set this callback |
| 773 ** function. NSS will invoke the functon to determine if a particular |
| 774 ** connection should use false start or not. SECSuccess indicates that the |
| 775 ** callback completed successfully, and if so *canFalseStart indicates if false |
| 776 ** start can be used. If the callback does not return SECSuccess then the |
| 777 ** handshake will be canceled. |
| 778 ** |
| 779 ** Applications that do not set the callback will use an internal set of |
| 780 ** criteria to determine if the connection should false start. If |
| 781 ** the callback is set false start will never be used without invoking the |
| 782 ** callback function, but some connections (e.g. resumed connections) will |
| 783 ** never use false start and therefore will not invoke the callback. |
| 784 ** |
| 785 ** NSS's internal criteria for this connection can be evaluated by calling |
| 786 ** SSL_DefaultCanFalseStart() from the custom callback. |
| 787 ** |
| 788 ** See the description of SSL_HandshakeCallback for important information on |
| 789 ** how registering a custom false start callback affects when the handshake |
| 790 ** callback gets called. |
| 791 **/ |
| 792 typedef SECStatus (PR_CALLBACK *SSLCanFalseStartCallback)( |
| 793 PRFileDesc *fd, void *arg, PRBool *canFalseStart); |
| 794 |
| 795 SSL_IMPORT SECStatus SSL_SetCanFalseStartCallback( |
| 796 PRFileDesc *fd, SSLCanFalseStartCallback callback, void *arg); |
| 797 |
| 798 /* A utility function that can be called from a custom CanFalseStartCallback |
| 799 ** function to determine what NSS would have done for this connection if the |
| 800 ** custom callback was not implemented. |
| 801 **/ |
| 802 SSL_IMPORT SECStatus SSL_DefaultCanFalseStart(PRFileDesc *fd, |
| 803 PRBool *canFalseStart); |
| 804 |
752 /* | 805 /* |
753 ** For the server, request a new handshake. For the client, begin a new | 806 ** For the server, request a new handshake. For the client, begin a new |
754 ** handshake. If flushCache is non-zero, the SSL3 cache entry will be | 807 ** handshake. If flushCache is non-zero, the SSL3 cache entry will be |
755 ** flushed first, ensuring that a full SSL handshake will be done. | 808 ** flushed first, ensuring that a full SSL handshake will be done. |
756 ** If flushCache is zero, and an SSL connection is established, it will | 809 ** If flushCache is zero, and an SSL connection is established, it will |
757 ** do the much faster session restart handshake. This will change the | 810 ** do the much faster session restart handshake. This will change the |
758 ** session keys without doing another private key operation. | 811 ** session keys without doing another private key operation. |
759 */ | 812 */ |
760 SSL_IMPORT SECStatus SSL_ReHandshake(PRFileDesc *fd, PRBool flushCache); | 813 SSL_IMPORT SECStatus SSL_ReHandshake(PRFileDesc *fd, PRBool flushCache); |
761 | 814 |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 * should continue using the connection. If the application passes a non-zero | 1151 * should continue using the connection. If the application passes a non-zero |
1099 * value for second argument (error), or if SSL_AuthCertificateComplete returns | 1152 * value for second argument (error), or if SSL_AuthCertificateComplete returns |
1100 * anything other than SECSuccess, then the application should close the | 1153 * anything other than SECSuccess, then the application should close the |
1101 * connection. | 1154 * connection. |
1102 */ | 1155 */ |
1103 SSL_IMPORT SECStatus SSL_AuthCertificateComplete(PRFileDesc *fd, | 1156 SSL_IMPORT SECStatus SSL_AuthCertificateComplete(PRFileDesc *fd, |
1104 PRErrorCode error); | 1157 PRErrorCode error); |
1105 SEC_END_PROTOS | 1158 SEC_END_PROTOS |
1106 | 1159 |
1107 #endif /* __ssl_h_ */ | 1160 #endif /* __ssl_h_ */ |
OLD | NEW |