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

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

Issue 1844813002: Uprev NSS to 3.23 on iOS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more GN fix Created 4 years, 8 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
« no previous file with comments | « net/third_party/nss/ssl/prelib.c ('k') | net/third_party/nss/ssl/ssl3con.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 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
11 #include "prtypes.h" 11 #include "prtypes.h"
12 #include "prerror.h" 12 #include "prerror.h"
13 #include "prio.h" 13 #include "prio.h"
14 #include "seccomon.h" 14 #include "seccomon.h"
15 #include "cert.h" 15 #include "cert.h"
16 #include "keyt.h" 16 #include "keyt.h"
17 17
18 #include "sslt.h" /* public ssl data types */ 18 #include "sslt.h" /* public ssl data types */
19 19
20 #if defined(_WIN32) && !defined(IN_LIBSSL) && !defined(NSS_USE_STATIC_LIBS) 20 #if defined(_WIN32) && !defined(IN_LIBSSL) && !defined(NSS_USE_STATIC_LIBS)
21 #define SSL_IMPORT extern __declspec(dllimport) 21 #define SSL_IMPORT extern __declspec(dllimport)
22 #else 22 #else
23 #define SSL_IMPORT extern 23 #define SSL_IMPORT extern
24 #endif 24 #endif
25 25
26 SEC_BEGIN_PROTOS 26 SEC_BEGIN_PROTOS
27 27
28 /* constant table enumerating all implemented SSL 2 and 3 cipher suites. */ 28 /* constant table enumerating all implemented SSL 2 and 3 cipher suites. */
29 SSL_IMPORT const PRUint16 SSL_ImplementedCiphers[]; 29 SSL_IMPORT const PRUint16 SSL_ImplementedCiphers[];
30 30
31 /* the same as the above, but is a function */ 31 /* the same as the above, but is a function */
32 SSL_IMPORT const PRUint16 *SSL_GetImplementedCiphers(void); 32 SSL_IMPORT const PRUint16 *SSL_GetImplementedCiphers(void);
33 33
34 /* number of entries in the above table. */ 34 /* number of entries in the above table. */
35 SSL_IMPORT const PRUint16 SSL_NumImplementedCiphers; 35 SSL_IMPORT const PRUint16 SSL_NumImplementedCiphers;
36 36
37 /* the same as the above, but is a function */ 37 /* the same as the above, but is a function */
38 SSL_IMPORT PRUint16 SSL_GetNumImplementedCiphers(void); 38 SSL_IMPORT PRUint16 SSL_GetNumImplementedCiphers(void);
39 39
40 /* Macro to tell which ciphers in table are SSL2 vs SSL3/TLS. */ 40 /* Macro to tell which ciphers in table are SSL2 vs SSL3/TLS. */
41 #define SSL_IS_SSL2_CIPHER(which) (((which) & 0xfff0) == 0xff00) 41 #define SSL_IS_SSL2_CIPHER(which) (((which)&0xfff0) == 0xff00)
42 42
43 /* 43 /*
44 ** Imports fd into SSL, returning a new socket. Copies SSL configuration 44 ** Imports fd into SSL, returning a new socket. Copies SSL configuration
45 ** from model. 45 ** from model.
46 */ 46 */
47 SSL_IMPORT PRFileDesc *SSL_ImportFD(PRFileDesc *model, PRFileDesc *fd); 47 SSL_IMPORT PRFileDesc *SSL_ImportFD(PRFileDesc *model, PRFileDesc *fd);
48 48
49 /* 49 /*
50 ** Imports fd into DTLS, returning a new socket. Copies DTLS configuration 50 ** Imports fd into DTLS, returning a new socket. Copies DTLS configuration
51 ** from model. 51 ** from model.
52 */ 52 */
53 SSL_IMPORT PRFileDesc *DTLS_ImportFD(PRFileDesc *model, PRFileDesc *fd); 53 SSL_IMPORT PRFileDesc *DTLS_ImportFD(PRFileDesc *model, PRFileDesc *fd);
54 54
55 /* 55 /*
56 ** Enable/disable an ssl mode 56 ** Enable/disable an ssl mode
57 ** 57 **
58 ** » SSL_SECURITY: 58 ** SSL_SECURITY:
59 ** » » enable/disable use of SSL security protocol before connect 59 ** enable/disable use of SSL security protocol before connect
60 ** 60 **
61 ** » SSL_SOCKS: 61 ** SSL_SOCKS:
62 ** » » enable/disable use of socks before connect 62 ** enable/disable use of socks before connect
63 **» » (No longer supported). 63 ** (No longer supported).
64 ** 64 **
65 ** » SSL_REQUEST_CERTIFICATE: 65 ** SSL_REQUEST_CERTIFICATE:
66 ** » » require a certificate during secure connect 66 ** require a certificate during secure connect
67 */ 67 */
68 /* options */ 68 /* options */
69 #define SSL_SECURITY» » » 1 /* (on by default) */ 69 #define SSL_SECURITY 1 /* (on by default) */
70 #define SSL_SOCKS» » » 2 /* (off by default) */ 70 #define SSL_SOCKS 2 /* (off by default) */
71 #define SSL_REQUEST_CERTIFICATE»» 3 /* (off by default) */ 71 #define SSL_REQUEST_CERTIFICATE 3 /* (off by default) */
72 #define SSL_HANDSHAKE_AS_CLIENT»» 5 /* force accept to hs as client */ 72 #define SSL_HANDSHAKE_AS_CLIENT 5 /* force accept to hs as client */
73 »» /* (off by default) */ 73 /* (off by default) */
74 #define SSL_HANDSHAKE_AS_SERVER»» 6 /* force connect to hs as server */ 74 #define SSL_HANDSHAKE_AS_SERVER 6 /* force connect to hs as server */
75 »» /* (off by default) */ 75 /* (off by default) */
76 76
77 /* OBSOLETE: SSL v2 is obsolete and may be removed soon. */ 77 /* OBSOLETE: SSL v2 is obsolete and may be removed soon. */
78 #define SSL_ENABLE_SSL2»» » 7 /* enable ssl v2 (off by default) */ 78 #define SSL_ENABLE_SSL2 7 /* enable ssl v2 (off by default) */
79 79
80 /* OBSOLETE: See "SSL Version Range API" below for the replacement and a 80 /* OBSOLETE: See "SSL Version Range API" below for the replacement and a
81 ** description of the non-obvious semantics of using SSL_ENABLE_SSL3. 81 ** description of the non-obvious semantics of using SSL_ENABLE_SSL3.
82 */ 82 */
83 #define SSL_ENABLE_SSL3»» 8 /* enable ssl v3 (on by default) */ 83 #define SSL_ENABLE_SSL3 8 /* enable ssl v3 (on by default) */
84 84
85 #define SSL_NO_CACHE» » 9 /* don't use the session cache */ 85 #define SSL_NO_CACHE 9 /* don't use the session cache */
86 » » /* (off by default) */ 86 /* (off by default) */
87 #define SSL_REQUIRE_CERTIFICATE 10 /* (SSL_REQUIRE_FIRST_HANDSHAKE */ 87 #define SSL_REQUIRE_CERTIFICATE 10 /* (SSL_REQUIRE_FIRST_HANDSHAKE */
88 /* by default) */ 88 /* by default) */
89 #define SSL_ENABLE_FDX 11 /* permit simultaneous read/write */ 89 #define SSL_ENABLE_FDX 11 /* permit simultaneous read/write */
90 /* (off by default) */ 90 /* (off by default) */
91 91
92 /* OBSOLETE: SSL v2 compatible hellos are not accepted by some TLS servers 92 /* OBSOLETE: SSL v2 compatible hellos are not accepted by some TLS servers
93 ** and cannot negotiate extensions. SSL v2 is obsolete. This option may be 93 ** and cannot negotiate extensions. SSL v2 is obsolete. This option may be
94 ** removed soon. 94 ** removed soon.
95 */ 95 */
96 #define SSL_V2_COMPATIBLE_HELLO 12 /* send v3 client hello in v2 fmt */ 96 #define SSL_V2_COMPATIBLE_HELLO 12 /* send v3 client hello in v2 fmt */
97 /* (off by default) */ 97 /* (off by default) */
98 98
99 /* OBSOLETE: See "SSL Version Range API" below for the replacement and a 99 /* OBSOLETE: See "SSL Version Range API" below for the replacement and a
100 ** description of the non-obvious semantics of using SSL_ENABLE_TLS. 100 ** description of the non-obvious semantics of using SSL_ENABLE_TLS.
101 */ 101 */
102 #define SSL_ENABLE_TLS» » 13 /* enable TLS (on by default) */ 102 #define SSL_ENABLE_TLS 13 /* enable TLS (on by default) */
103 103
104 #define SSL_ROLLBACK_DETECTION 14 /* for compatibility, default: on */ 104 #define SSL_ROLLBACK_DETECTION 14 /* for compatibility, default: on */
105 #define SSL_NO_STEP_DOWN 15 /* Disable export cipher suites */ 105 #define SSL_NO_STEP_DOWN 15 /* Disable export cipher suites */
106 /* if step-down keys are needed. */ 106 /* if step-down keys are needed. */
107 » » » » » /* default: off, generate */ 107 /* default: off, generate */
108 » » » » » /* step-down keys if needed. */ 108 /* step-down keys if needed. */
109 #define SSL_BYPASS_PKCS11 16 /* use PKCS#11 for pub key only */ 109 #define SSL_BYPASS_PKCS11 16 /* use PKCS#11 for pub key only */
110 #define SSL_NO_LOCKS 17 /* Don't use locks for protection */ 110 #define SSL_NO_LOCKS 17 /* Don't use locks for protection */
111 #define SSL_ENABLE_SESSION_TICKETS 18 /* Enable TLS SessionTicket */ 111 #define SSL_ENABLE_SESSION_TICKETS 18 /* Enable TLS SessionTicket */
112 /* extension (off by default) */ 112 /* extension (off by default) */
113 #define SSL_ENABLE_DEFLATE 19 /* Enable TLS compression with */ 113 #define SSL_ENABLE_DEFLATE 19 /* Enable TLS compression with */
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. The advantage of false start is that 128 * cipher isn't broken this is safe. The advantage of false start is that
129 * it saves a round trip for client-speaks-first protocols when performing a 129 * it saves a round trip for client-speaks-first protocols when performing a
130 * full handshake. 130 * full handshake.
131 * 131 *
132 * In addition to enabling this option, the application must register a 132 * In addition to enabling this option, the application must register a
133 * callback using the SSL_SetCanFalseStartCallback function. 133 * callback using the SSL_SetCanFalseStartCallback function.
(...skipping 19 matching lines...) Expand all
153 * Other implementations (e.g. some versions of OpenSSL, in some 153 * Other implementations (e.g. some versions of OpenSSL, in some
154 * configurations) prevent the same attack by prepending an empty 154 * configurations) prevent the same attack by prepending an empty
155 * application_data record to every application_data record they send; we do 155 * application_data record to every application_data record they send; we do
156 * not do that because some implementations cannot handle empty 156 * not do that because some implementations cannot handle empty
157 * application_data records. Also, we only split application_data records and 157 * application_data records. Also, we only split application_data records and
158 * not other types of records, because some implementations will not accept 158 * not other types of records, because some implementations will not accept
159 * fragmented records of some other types (e.g. some versions of NSS do not 159 * fragmented records of some other types (e.g. some versions of NSS do not
160 * accept fragmented alerts). 160 * accept fragmented alerts).
161 */ 161 */
162 #define SSL_CBC_RANDOM_IV 23 162 #define SSL_CBC_RANDOM_IV 23
163 #define SSL_ENABLE_OCSP_STAPLING 24 /* Request OCSP stapling (client) */ 163 #define SSL_ENABLE_OCSP_STAPLING 24 /* Request OCSP stapling (client) */
164 164
165 /* SSL_ENABLE_NPN controls whether the NPN extension is enabled for the initial 165 /* SSL_ENABLE_NPN controls whether the NPN extension is enabled for the initial
166 * handshake when application layer protocol negotiation is used. 166 * handshake when application layer protocol negotiation is used.
167 * SSL_SetNextProtoCallback or SSL_SetNextProtoNego must be used to control the 167 * SSL_SetNextProtoCallback or SSL_SetNextProtoNego must be used to control the
168 * application layer protocol negotiation; otherwise, the NPN extension will 168 * application layer protocol negotiation; otherwise, the NPN extension will
169 * not be negotiated. SSL_ENABLE_NPN is currently enabled by default but this 169 * not be negotiated. SSL_ENABLE_NPN is currently enabled by default but this
170 * may change in future versions. 170 * may change in future versions.
171 */ 171 */
172 #define SSL_ENABLE_NPN 25 172 #define SSL_ENABLE_NPN 25
173 173
174 /* SSL_ENABLE_ALPN controls whether the ALPN extension is enabled for the 174 /* SSL_ENABLE_ALPN controls whether the ALPN extension is enabled for the
175 * initial handshake when application layer protocol negotiation is used. 175 * initial handshake when application layer protocol negotiation is used.
176 * SSL_SetNextProtoNego (not SSL_SetNextProtoCallback) must be used to control 176 * SSL_SetNextProtoNego (not SSL_SetNextProtoCallback) must be used to control
177 * the application layer protocol negotiation; otherwise, the ALPN extension 177 * the application layer protocol negotiation; otherwise, the ALPN extension
178 * will not be negotiated. ALPN is not negotiated for renegotiation handshakes, 178 * will not be negotiated. ALPN is not negotiated for renegotiation handshakes,
179 * even though the ALPN specification defines a way to use ALPN during 179 * even though the ALPN specification defines a way to use ALPN during
180 * renegotiations. SSL_ENABLE_ALPN is currently disabled by default, but this 180 * renegotiations. SSL_ENABLE_ALPN is currently disabled by default, but this
181 * may change in future versions. 181 * may change in future versions.
182 */ 182 */
183 #define SSL_ENABLE_ALPN 26 183 #define SSL_ENABLE_ALPN 26
184 184
185 /* SSL_REUSE_SERVER_ECDHE_KEY controls whether the ECDHE server key is 185 /* SSL_REUSE_SERVER_ECDHE_KEY controls whether the ECDHE server key is
186 * reused for multiple handshakes or generated each time. 186 * reused for multiple handshakes or generated each time.
187 * SSL_REUSE_SERVER_ECDHE_KEY is currently enabled by default. 187 * SSL_REUSE_SERVER_ECDHE_KEY is currently enabled by default.
188 * This socket option is for ECDHE, only. It is unrelated to DHE. 188 * This socket option is for ECDHE, only. It is unrelated to DHE.
189 */ 189 */
190 #define SSL_REUSE_SERVER_ECDHE_KEY 27 190 #define SSL_REUSE_SERVER_ECDHE_KEY 27
191 191
192 #define SSL_ENABLE_FALLBACK_SCSV 28 /* Send fallback SCSV in 192 #define SSL_ENABLE_FALLBACK_SCSV 28 /* Send fallback SCSV in \
193 * handshakes. */ 193 * handshakes. */
194 194
195 /* SSL_ENABLE_SERVER_DHE controls whether DHE is enabled for the server socket. 195 /* SSL_ENABLE_SERVER_DHE controls whether DHE is enabled for the server socket.
196 */ 196 */
197 #define SSL_ENABLE_SERVER_DHE 29 197 #define SSL_ENABLE_SERVER_DHE 29
198 198
199 /* Use draft-ietf-tls-session-hash. Controls whether we offer the 199 /* Use draft-ietf-tls-session-hash. Controls whether we offer the
200 * extended_master_secret extension which, when accepted, hashes 200 * extended_master_secret extension which, when accepted, hashes
201 * the handshake transcript into the master secret. This option is 201 * the handshake transcript into the master secret. This option is
202 * disabled by default. 202 * disabled by default.
203 */ 203 */
204 #define SSL_ENABLE_EXTENDED_MASTER_SECRET 30 204 #define SSL_ENABLE_EXTENDED_MASTER_SECRET 30
205 205
206 /* Request Signed Certificate Timestamps via TLS extension (client) */ 206 /* Request Signed Certificate Timestamps via TLS extension (client) */
207 #define SSL_ENABLE_SIGNED_CERT_TIMESTAMPS 31 207 #define SSL_ENABLE_SIGNED_CERT_TIMESTAMPS 31
208 208
209 #ifdef SSL_DEPRECATED_FUNCTION 209 #ifdef SSL_DEPRECATED_FUNCTION
210 /* Old deprecated function names */ 210 /* Old deprecated function names */
211 SSL_IMPORT SECStatus SSL_Enable(PRFileDesc *fd, int option, PRBool on); 211 SSL_IMPORT SECStatus SSL_Enable(PRFileDesc *fd, int option, PRBool on);
212 SSL_IMPORT SECStatus SSL_EnableDefault(int option, PRBool on); 212 SSL_IMPORT SECStatus SSL_EnableDefault(int option, PRBool on);
213 #endif 213 #endif
214 214
215 /* New function names */ 215 /* New function names */
216 SSL_IMPORT SECStatus SSL_OptionSet(PRFileDesc *fd, PRInt32 option, PRBool on); 216 SSL_IMPORT SECStatus SSL_OptionSet(PRFileDesc *fd, PRInt32 option, PRBool on);
217 SSL_IMPORT SECStatus SSL_OptionGet(PRFileDesc *fd, PRInt32 option, PRBool *on); 217 SSL_IMPORT SECStatus SSL_OptionGet(PRFileDesc *fd, PRInt32 option, PRBool *on);
218 SSL_IMPORT SECStatus SSL_OptionSetDefault(PRInt32 option, PRBool on); 218 SSL_IMPORT SECStatus SSL_OptionSetDefault(PRInt32 option, PRBool on);
219 SSL_IMPORT SECStatus SSL_OptionGetDefault(PRInt32 option, PRBool *on); 219 SSL_IMPORT SECStatus SSL_OptionGetDefault(PRInt32 option, PRBool *on);
220 SSL_IMPORT SECStatus SSL_CertDBHandleSet(PRFileDesc *fd, CERTCertDBHandle *dbHan dle); 220 SSL_IMPORT SECStatus SSL_CertDBHandleSet(PRFileDesc *fd, CERTCertDBHandle *dbHan dle);
221 221
222 /* SSLNextProtoCallback is called during the handshake for the client, when a 222 /* SSLNextProtoCallback is called during the handshake for the client, when a
223 * Next Protocol Negotiation (NPN) extension has been received from the server. 223 * Next Protocol Negotiation (NPN) extension has been received from the server.
224 * |protos| and |protosLen| define a buffer which contains the server's 224 * |protos| and |protosLen| define a buffer which contains the server's
225 * advertisement. This data is guaranteed to be well formed per the NPN spec. 225 * advertisement. This data is guaranteed to be well formed per the NPN spec.
226 * |protoOut| is a buffer provided by the caller, of length 255 (the maximum 226 * |protoOut| is a buffer provided by the caller, of length 255 (the maximum
227 * allowed by the protocol). On successful return, the protocol to be announced 227 * allowed by the protocol). On successful return, the protocol to be announced
228 * to the server will be in |protoOut| and its length in |*protoOutLen|. 228 * to the server will be in |protoOut| and its length in |*protoOutLen|.
229 * 229 *
230 * The callback must return SECFailure or SECSuccess (not SECWouldBlock). 230 * The callback must return SECFailure or SECSuccess (not SECWouldBlock).
231 */ 231 */
232 typedef SECStatus (PR_CALLBACK *SSLNextProtoCallback)( 232 typedef SECStatus(PR_CALLBACK *SSLNextProtoCallback)(
233 void *arg, 233 void *arg,
234 PRFileDesc *fd, 234 PRFileDesc *fd,
235 const unsigned char* protos, 235 const unsigned char *protos,
236 unsigned int protosLen, 236 unsigned int protosLen,
237 unsigned char* protoOut, 237 unsigned char *protoOut,
238 unsigned int* protoOutLen, 238 unsigned int *protoOutLen,
239 unsigned int protoMaxOut); 239 unsigned int protoMaxOut);
240 240
241 /* SSL_SetNextProtoCallback sets a callback function to handle Next Protocol 241 /* SSL_SetNextProtoCallback sets a callback function to handle Next Protocol
242 * Negotiation. It causes a client to advertise NPN. */ 242 * Negotiation. It causes a client to advertise NPN. */
243 SSL_IMPORT SECStatus SSL_SetNextProtoCallback(PRFileDesc *fd, 243 SSL_IMPORT SECStatus SSL_SetNextProtoCallback(PRFileDesc *fd,
244 SSLNextProtoCallback callback, 244 SSLNextProtoCallback callback,
245 void *arg); 245 void *arg);
246 246
247 /* SSL_SetNextProtoNego can be used as an alternative to 247 /* SSL_SetNextProtoNego can be used as an alternative to
248 * SSL_SetNextProtoCallback. It also causes a client to advertise NPN and 248 * SSL_SetNextProtoCallback. It also causes a client to advertise NPN and
249 * installs a default callback function which selects the first supported 249 * installs a default callback function which selects the first supported
250 * protocol in server-preference order. If no matching protocol is found it 250 * protocol in server-preference order. If no matching protocol is found it
251 * selects the first supported protocol. 251 * selects the first supported protocol.
252 * 252 *
253 * Using this function also allows the client to transparently support ALPN. 253 * Using this function also allows the client to transparently support ALPN.
254 * The same set of protocols will be advertised via ALPN and, if the server 254 * The same set of protocols will be advertised via ALPN and, if the server
255 * uses ALPN to select a protocol, SSL_GetNextProto will return 255 * uses ALPN to select a protocol, SSL_GetNextProto will return
256 * SSL_NEXT_PROTO_SELECTED as the state. 256 * SSL_NEXT_PROTO_SELECTED as the state.
257 * 257 *
258 * Since NPN uses the first protocol as the fallback protocol, when sending an 258 * Since NPN uses the first protocol as the fallback protocol, when sending an
259 * ALPN extension, the first protocol is moved to the end of the list. This 259 * ALPN extension, the first protocol is moved to the end of the list. This
260 * indicates that the fallback protocol is the least preferred. The other 260 * indicates that the fallback protocol is the least preferred. The other
261 * protocols should be in preference order. 261 * protocols should be in preference order.
262 * 262 *
263 * The supported protocols are specified in |data| in wire-format (8-bit 263 * The supported protocols are specified in |data| in wire-format (8-bit
264 * length-prefixed). For example: "\010http/1.1\006spdy/2". */ 264 * length-prefixed). For example: "\010http/1.1\006spdy/2". */
265 SSL_IMPORT SECStatus SSL_SetNextProtoNego(PRFileDesc *fd, 265 SSL_IMPORT SECStatus SSL_SetNextProtoNego(PRFileDesc *fd,
266 » » » » » const unsigned char *data, 266 const unsigned char *data,
267 » » » » » unsigned int length); 267 unsigned int length);
268 268
269 typedef enum SSLNextProtoState { 269 typedef enum SSLNextProtoState {
270 SSL_NEXT_PROTO_NO_SUPPORT = 0, /* No peer support */ 270 SSL_NEXT_PROTO_NO_SUPPORT = 0, /* No peer support */
271 SSL_NEXT_PROTO_NEGOTIATED = 1, /* Mutual agreement */ 271 SSL_NEXT_PROTO_NEGOTIATED = 1, /* Mutual agreement */
272 SSL_NEXT_PROTO_NO_OVERLAP = 2, /* No protocol overlap found */ 272 SSL_NEXT_PROTO_NO_OVERLAP = 2, /* No protocol overlap found */
273 SSL_NEXT_PROTO_SELECTED = 3 /* Server selected proto (ALPN) */ 273 SSL_NEXT_PROTO_SELECTED = 3 /* Server selected proto (ALPN) */
274 } SSLNextProtoState; 274 } SSLNextProtoState;
275 275
276 /* SSL_GetNextProto can be used in the HandshakeCallback or any time after 276 /* SSL_GetNextProto can be used in the HandshakeCallback or any time after
277 * a handshake to retrieve the result of the Next Protocol negotiation. 277 * a handshake to retrieve the result of the Next Protocol negotiation.
278 * 278 *
279 * The length of the negotiated protocol, if any, is written into *bufLen. 279 * The length of the negotiated protocol, if any, is written into *bufLen.
280 * If the negotiated protocol is longer than bufLenMax, then SECFailure is 280 * If the negotiated protocol is longer than bufLenMax, then SECFailure is
281 * returned. Otherwise, the negotiated protocol, if any, is written into buf, 281 * returned. Otherwise, the negotiated protocol, if any, is written into buf,
282 * and SECSuccess is returned. */ 282 * and SECSuccess is returned. */
283 SSL_IMPORT SECStatus SSL_GetNextProto(PRFileDesc *fd, 283 SSL_IMPORT SECStatus SSL_GetNextProto(PRFileDesc *fd,
284 » » » » SSLNextProtoState *state, 284 SSLNextProtoState *state,
285 » » » » unsigned char *buf, 285 unsigned char *buf,
286 » » » » unsigned int *bufLen, 286 unsigned int *bufLen,
287 » » » » unsigned int bufLenMax); 287 unsigned int bufLenMax);
288 288
289 /* 289 /*
290 ** Control ciphers that SSL uses. If on is non-zero then the named cipher 290 ** Control ciphers that SSL uses. If on is non-zero then the named cipher
291 ** is enabled, otherwise it is disabled. 291 ** is enabled, otherwise it is disabled.
292 ** The "cipher" values are defined in sslproto.h (the SSL_EN_* values). 292 ** The "cipher" values are defined in sslproto.h (the SSL_EN_* values).
293 ** EnableCipher records user preferences. 293 ** EnableCipher records user preferences.
294 ** SetPolicy sets the policy according to the policy module. 294 ** SetPolicy sets the policy according to the policy module.
295 */ 295 */
296 #ifdef SSL_DEPRECATED_FUNCTION 296 #ifdef SSL_DEPRECATED_FUNCTION
297 /* Old deprecated function names */ 297 /* Old deprecated function names */
298 SSL_IMPORT SECStatus SSL_EnableCipher(long which, PRBool enabled); 298 SSL_IMPORT SECStatus SSL_EnableCipher(long which, PRBool enabled);
299 SSL_IMPORT SECStatus SSL_SetPolicy(long which, int policy); 299 SSL_IMPORT SECStatus SSL_SetPolicy(long which, int policy);
300 #endif 300 #endif
301 301
302 /* New function names */ 302 /* New function names */
303 SSL_IMPORT SECStatus SSL_CipherPrefSet(PRFileDesc *fd, PRInt32 cipher, PRBool en abled); 303 SSL_IMPORT SECStatus SSL_CipherPrefSet(PRFileDesc *fd, PRInt32 cipher, PRBool en abled);
304 SSL_IMPORT SECStatus SSL_CipherPrefGet(PRFileDesc *fd, PRInt32 cipher, PRBool *e nabled); 304 SSL_IMPORT SECStatus SSL_CipherPrefGet(PRFileDesc *fd, PRInt32 cipher, PRBool *e nabled);
305 SSL_IMPORT SECStatus SSL_CipherPrefSetDefault(PRInt32 cipher, PRBool enabled); 305 SSL_IMPORT SECStatus SSL_CipherPrefSetDefault(PRInt32 cipher, PRBool enabled);
306 SSL_IMPORT SECStatus SSL_CipherPrefGetDefault(PRInt32 cipher, PRBool *enabled); 306 SSL_IMPORT SECStatus SSL_CipherPrefGetDefault(PRInt32 cipher, PRBool *enabled);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 /* SSL_GetChannelBinding copies the requested channel binding value, as defined 403 /* SSL_GetChannelBinding copies the requested channel binding value, as defined
404 * in RFC 5929, into |out|. The full length of the binding value is written 404 * in RFC 5929, into |out|. The full length of the binding value is written
405 * into |*outLen|. 405 * into |*outLen|.
406 * 406 *
407 * At most |outLenMax| bytes of data are copied. If |outLenMax| is 407 * At most |outLenMax| bytes of data are copied. If |outLenMax| is
408 * insufficient then the function returns SECFailure and sets the error to 408 * insufficient then the function returns SECFailure and sets the error to
409 * SEC_ERROR_OUTPUT_LEN, but |*outLen| is still set. 409 * SEC_ERROR_OUTPUT_LEN, but |*outLen| is still set.
410 * 410 *
411 * This call will fail if made during a renegotiation. */ 411 * This call will fail if made during a renegotiation. */
412 SSL_IMPORT SECStatus SSL_GetChannelBinding(PRFileDesc *fd, 412 SSL_IMPORT SECStatus SSL_GetChannelBinding(PRFileDesc *fd,
413 » » » » » SSLChannelBindingType binding_type, 413 SSLChannelBindingType binding_type,
414 » » » » » unsigned char *out, 414 unsigned char *out,
415 » » » » » unsigned int *outLen, 415 unsigned int *outLen,
416 » » » » » unsigned int outLenMax); 416 unsigned int outLenMax);
417 417
418 /* SSL Version Range API 418 /* SSL Version Range API
419 ** 419 **
420 ** This API should be used to control SSL 3.0 & TLS support instead of the 420 ** This API should be used to control SSL 3.0 & TLS support instead of the
421 ** older SSL_Option* API; however, the SSL_Option* API MUST still be used to 421 ** older SSL_Option* API; however, the SSL_Option* API MUST still be used to
422 ** control SSL 2.0 support. In this version of libssl, SSL 3.0 and TLS 1.0 are 422 ** control SSL 2.0 support. In this version of libssl, SSL 3.0 and TLS 1.0 are
423 ** enabled by default. Future versions of libssl may change which versions of 423 ** enabled by default. Future versions of libssl may change which versions of
424 ** the protocol are enabled by default. 424 ** the protocol are enabled by default.
425 ** 425 **
426 ** The SSLProtocolVariant enum indicates whether the protocol is of type 426 ** The SSLProtocolVariant enum indicates whether the protocol is of type
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 SSLProtocolVariant protocolVariant, SSLVersionRange *vrange); 472 SSLProtocolVariant protocolVariant, SSLVersionRange *vrange);
473 473
474 /* Sets the range of enabled-by-default SSL3/TLS versions for the given 474 /* Sets the range of enabled-by-default SSL3/TLS versions for the given
475 ** protocol variant to |*vrange|. 475 ** protocol variant to |*vrange|.
476 */ 476 */
477 SSL_IMPORT SECStatus SSL_VersionRangeSetDefault( 477 SSL_IMPORT SECStatus SSL_VersionRangeSetDefault(
478 SSLProtocolVariant protocolVariant, const SSLVersionRange *vrange); 478 SSLProtocolVariant protocolVariant, const SSLVersionRange *vrange);
479 479
480 /* Returns, in |*vrange|, the range of enabled SSL3/TLS versions for |fd|. */ 480 /* Returns, in |*vrange|, the range of enabled SSL3/TLS versions for |fd|. */
481 SSL_IMPORT SECStatus SSL_VersionRangeGet(PRFileDesc *fd, 481 SSL_IMPORT SECStatus SSL_VersionRangeGet(PRFileDesc *fd,
482 » » » » » SSLVersionRange *vrange); 482 SSLVersionRange *vrange);
483 483
484 /* Sets the range of enabled SSL3/TLS versions for |fd| to |*vrange|. */ 484 /* Sets the range of enabled SSL3/TLS versions for |fd| to |*vrange|. */
485 SSL_IMPORT SECStatus SSL_VersionRangeSet(PRFileDesc *fd, 485 SSL_IMPORT SECStatus SSL_VersionRangeSet(PRFileDesc *fd,
486 » » » » » const SSLVersionRange *vrange); 486 const SSLVersionRange *vrange);
487 487
488 /* Sets the version to check the server random against for the
489 * fallback check defined in [draft-ietf-tls-tls13-11 Section 6.3.1.1].
490 * This function is provided to allow for detection of forced downgrade
491 * attacks against client-side reconnect-and-fallback outside of TLS
492 * by setting |version| to be that of the original connection, rather
493 * than that of the new connection.
494 *
495 * The default, which can also be enabled by setting |version| to
496 * zero, is just to check against the max version in the
497 * version range (see SSL_VersionRangeSet). */
498 SSL_IMPORT SECStatus SSL_SetDowngradeCheckVersion(PRFileDesc *fd,
499 PRUint16 version);
488 500
489 /* Values for "policy" argument to SSL_CipherPolicySet */ 501 /* Values for "policy" argument to SSL_CipherPolicySet */
490 /* Values returned by SSL_CipherPolicyGet. */ 502 /* Values returned by SSL_CipherPolicyGet. */
491 #define SSL_NOT_ALLOWED»» 0» /* or invalid or unimplemented */ 503 #define SSL_NOT_ALLOWED 0 /* or invalid or unimplemented */
492 #define SSL_ALLOWED» » 1 504 #define SSL_ALLOWED 1
493 #define SSL_RESTRICTED» » 2» /* only with "Step-Up" certs. */ 505 #define SSL_RESTRICTED 2 /* only with "Step-Up" certs. */
494 506
495 /* Values for "on" with SSL_REQUIRE_CERTIFICATE. */ 507 /* Values for "on" with SSL_REQUIRE_CERTIFICATE. */
496 #define SSL_REQUIRE_NEVER ((PRBool)0) 508 #define SSL_REQUIRE_NEVER ((PRBool)0)
497 #define SSL_REQUIRE_ALWAYS ((PRBool)1) 509 #define SSL_REQUIRE_ALWAYS ((PRBool)1)
498 #define SSL_REQUIRE_FIRST_HANDSHAKE ((PRBool)2) 510 #define SSL_REQUIRE_FIRST_HANDSHAKE ((PRBool)2)
499 #define SSL_REQUIRE_NO_ERROR ((PRBool)3) 511 #define SSL_REQUIRE_NO_ERROR ((PRBool)3)
500 512
501 /* Values for "on" with SSL_ENABLE_RENEGOTIATION */ 513 /* Values for "on" with SSL_ENABLE_RENEGOTIATION */
502 /* Never renegotiate at all. */ 514 /* Never renegotiate at all. */
503 #define SSL_RENEGOTIATE_NEVER ((PRBool)0) 515 #define SSL_RENEGOTIATE_NEVER ((PRBool)0)
504 /* Renegotiate without restriction, whether or not the peer's client hello */ 516 /* Renegotiate without restriction, whether or not the peer's client hello */
505 /* bears the renegotiation info extension. Vulnerable, as in the past. */ 517 /* bears the renegotiation info extension. Vulnerable, as in the past. */
506 #define SSL_RENEGOTIATE_UNRESTRICTED ((PRBool)1) 518 #define SSL_RENEGOTIATE_UNRESTRICTED ((PRBool)1)
507 /* Only renegotiate if the peer's hello bears the TLS renegotiation_info */ 519 /* Only renegotiate if the peer's hello bears the TLS renegotiation_info */
508 /* extension. This is safe renegotiation. */ 520 /* extension. This is safe renegotiation. */
509 #define SSL_RENEGOTIATE_REQUIRES_XTN ((PRBool)2) 521 #define SSL_RENEGOTIATE_REQUIRES_XTN ((PRBool)2)
510 /* Disallow unsafe renegotiation in server sockets only, but allow clients */ 522 /* Disallow unsafe renegotiation in server sockets only, but allow clients */
511 /* to continue to renegotiate with vulnerable servers. */ 523 /* to continue to renegotiate with vulnerable servers. */
512 /* This value should only be used during the transition period when few */ 524 /* This value should only be used during the transition period when few */
513 /* servers have been upgraded. */ 525 /* servers have been upgraded. */
514 #define SSL_RENEGOTIATE_TRANSITIONAL ((PRBool)3) 526 #define SSL_RENEGOTIATE_TRANSITIONAL ((PRBool)3)
515 527
516 /* 528 /*
517 ** Reset the handshake state for fd. This will make the complete SSL 529 ** Reset the handshake state for fd. This will make the complete SSL
518 ** handshake protocol execute from the ground up on the next i/o 530 ** handshake protocol execute from the ground up on the next i/o
519 ** operation. 531 ** operation.
520 */ 532 */
521 SSL_IMPORT SECStatus SSL_ResetHandshake(PRFileDesc *fd, PRBool asServer); 533 SSL_IMPORT SECStatus SSL_ResetHandshake(PRFileDesc *fd, PRBool asServer);
522 534
523 /* 535 /*
524 ** Force the handshake for fd to complete immediately. This blocks until 536 ** Force the handshake for fd to complete immediately. This blocks until
525 ** the complete SSL handshake protocol is finished. 537 ** the complete SSL handshake protocol is finished.
526 */ 538 */
527 SSL_IMPORT SECStatus SSL_ForceHandshake(PRFileDesc *fd); 539 SSL_IMPORT SECStatus SSL_ForceHandshake(PRFileDesc *fd);
528 540
529 /* 541 /*
530 ** Same as above, but with an I/O timeout. 542 ** Same as above, but with an I/O timeout.
531 */ 543 */
532 SSL_IMPORT SECStatus SSL_ForceHandshakeWithTimeout(PRFileDesc *fd, 544 SSL_IMPORT SECStatus SSL_ForceHandshakeWithTimeout(PRFileDesc *fd,
533 PRIntervalTime timeout); 545 PRIntervalTime timeout);
534 546
535 SSL_IMPORT SECStatus SSL_RestartHandshakeAfterCertReq(PRFileDesc *fd, 547 SSL_IMPORT SECStatus SSL_RestartHandshakeAfterCertReq(PRFileDesc *fd,
536 » » » » » CERTCertificate *cert, 548 CERTCertificate *cert,
537 » » » » » SECKEYPrivateKey *key, 549 SECKEYPrivateKey *key,
538 » » » » » CERTCertificateList *certChain); 550 CERTCertificateList *certC hain);
539 551
540 /* 552 /*
541 ** Query security status of socket. *on is set to one if security is 553 ** Query security status of socket. *on is set to one if security is
542 ** enabled. *keySize will contain the stream key size used. *issuer will 554 ** enabled. *keySize will contain the stream key size used. *issuer will
543 ** contain the RFC1485 verison of the name of the issuer of the 555 ** contain the RFC1485 verison of the name of the issuer of the
544 ** certificate at the other end of the connection. For a client, this is 556 ** certificate at the other end of the connection. For a client, this is
545 ** the issuer of the server's certificate; for a server, this is the 557 ** the issuer of the server's certificate; for a server, this is the
546 ** issuer of the client's certificate (if any). Subject is the subject of 558 ** issuer of the client's certificate (if any). Subject is the subject of
547 ** the other end's certificate. The pointers can be zero if the desired 559 ** the other end's certificate. The pointers can be zero if the desired
548 ** data is not needed. All strings returned by this function are owned 560 ** data is not needed. All strings returned by this function are owned
549 ** by the caller, and need to be freed with PORT_Free. 561 ** by the caller, and need to be freed with PORT_Free.
550 */ 562 */
551 SSL_IMPORT SECStatus SSL_SecurityStatus(PRFileDesc *fd, int *on, char **cipher, 563 SSL_IMPORT SECStatus SSL_SecurityStatus(PRFileDesc *fd, int *on, char **cipher,
552 » » » int *keySize, int *secretKeySize, 564 int *keySize, int *secretKeySize,
553 » » » char **issuer, char **subject); 565 char **issuer, char **subject);
554 566
555 /* Values for "on" */ 567 /* Values for "on" */
556 #define SSL_SECURITY_STATUS_NOOPT» -1 568 #define SSL_SECURITY_STATUS_NOOPT -1
557 #define SSL_SECURITY_STATUS_OFF»» 0 569 #define SSL_SECURITY_STATUS_OFF 0
558 #define SSL_SECURITY_STATUS_ON_HIGH» 1 570 #define SSL_SECURITY_STATUS_ON_HIGH 1
559 #define SSL_SECURITY_STATUS_ON_LOW» 2 571 #define SSL_SECURITY_STATUS_ON_LOW 2
560 #define SSL_SECURITY_STATUS_FORTEZZA» 3 /* NO LONGER SUPPORTED */ 572 #define SSL_SECURITY_STATUS_FORTEZZA 3 /* NO LONGER SUPPORTED */
561 573
562 /* 574 /*
563 ** Return the certificate for our SSL peer. If the client calls this 575 ** Return the certificate for our SSL peer. If the client calls this
564 ** it will always return the server's certificate. If the server calls 576 ** it will always return the server's certificate. If the server calls
565 ** this, it may return NULL if client authentication is not enabled or 577 ** this, it may return NULL if client authentication is not enabled or
566 ** if the client had no certificate when asked. 578 ** if the client had no certificate when asked.
567 **» "fd" the socket "file" descriptor 579 ** "fd" the socket "file" descriptor
568 */ 580 */
569 SSL_IMPORT CERTCertificate *SSL_PeerCertificate(PRFileDesc *fd); 581 SSL_IMPORT CERTCertificate *SSL_PeerCertificate(PRFileDesc *fd);
570 582
571 /* 583 /*
572 ** Return the certificates presented by the SSL peer. If the SSL peer 584 ** Return the certificates presented by the SSL peer. If the SSL peer
573 ** did not present certificates, return NULL with the 585 ** did not present certificates, return NULL with the
574 ** SSL_ERROR_NO_CERTIFICATE error. On failure, return NULL with an error 586 ** SSL_ERROR_NO_CERTIFICATE error. On failure, return NULL with an error
575 ** code other than SSL_ERROR_NO_CERTIFICATE. 587 ** code other than SSL_ERROR_NO_CERTIFICATE.
576 **» "fd" the socket "file" descriptor 588 ** "fd" the socket "file" descriptor
577 */ 589 */
578 SSL_IMPORT CERTCertList *SSL_PeerCertificateChain(PRFileDesc *fd); 590 SSL_IMPORT CERTCertList *SSL_PeerCertificateChain(PRFileDesc *fd);
579 591
580 /* SSL_PeerStapledOCSPResponses returns the OCSP responses that were provided 592 /* SSL_PeerStapledOCSPResponses returns the OCSP responses that were provided
581 * by the TLS server. The return value is a pointer to an internal SECItemArray 593 * by the TLS server. The return value is a pointer to an internal SECItemArray
582 * that contains the returned OCSP responses; it is only valid until the 594 * that contains the returned OCSP responses; it is only valid until the
583 * callback function that calls SSL_PeerStapledOCSPResponses returns. 595 * callback function that calls SSL_PeerStapledOCSPResponses returns.
584 * 596 *
585 * If no OCSP responses were given by the server then the result will be empty. 597 * If no OCSP responses were given by the server then the result will be empty.
586 * If there was an error, then the result will be NULL. 598 * If there was an error, then the result will be NULL.
587 * 599 *
588 * You must set the SSL_ENABLE_OCSP_STAPLING option to enable OCSP stapling. 600 * You must set the SSL_ENABLE_OCSP_STAPLING option to enable OCSP stapling.
589 * to be provided by a server. 601 * to be provided by a server.
590 * 602 *
591 * libssl does not do any validation of the OCSP response itself; the 603 * libssl does not do any validation of the OCSP response itself; the
592 * authenticate certificate hook is responsible for doing so. The default 604 * authenticate certificate hook is responsible for doing so. The default
593 * authenticate certificate hook, SSL_AuthCertificate, does not implement 605 * authenticate certificate hook, SSL_AuthCertificate, does not implement
594 * any OCSP stapling funtionality, but this may change in future versions. 606 * any OCSP stapling funtionality, but this may change in future versions.
595 */ 607 */
596 SSL_IMPORT const SECItemArray * SSL_PeerStapledOCSPResponses(PRFileDesc *fd); 608 SSL_IMPORT const SECItemArray *SSL_PeerStapledOCSPResponses(PRFileDesc *fd);
597 609
598 /* SSL_PeerSignedCertTimestamps returns the signed_certificate_timestamp 610 /* SSL_PeerSignedCertTimestamps returns the signed_certificate_timestamp
599 * extension data provided by the TLS server. The return value is a pointer 611 * extension data provided by the TLS server. The return value is a pointer
600 * to an internal SECItem that contains the returned response (as a serialized 612 * to an internal SECItem that contains the returned response (as a serialized
601 * SignedCertificateTimestampList, see RFC 6962). The returned pointer is only 613 * SignedCertificateTimestampList, see RFC 6962). The returned pointer is only
602 * valid until the callback function that calls SSL_PeerSignedCertTimestamps 614 * valid until the callback function that calls SSL_PeerSignedCertTimestamps
603 * (e.g. the authenticate certificate hook, or the handshake callback) returns. 615 * (e.g. the authenticate certificate hook, or the handshake callback) returns.
604 * 616 *
605 * If no Signed Certificate Timestamps were given by the server then the result 617 * If no Signed Certificate Timestamps were given by the server then the result
606 * will be empty. If there was an error, then the result will be NULL. 618 * will be empty. If there was an error, then the result will be NULL.
607 * 619 *
608 * You must set the SSL_ENABLE_SIGNED_CERT_TIMESTAMPS option to indicate support 620 * You must set the SSL_ENABLE_SIGNED_CERT_TIMESTAMPS option to indicate support
609 * for Signed Certificate Timestamps to a server. 621 * for Signed Certificate Timestamps to a server.
610 * 622 *
611 * libssl does not do any parsing or validation of the response itself. 623 * libssl does not do any parsing or validation of the response itself.
612 */ 624 */
613 SSL_IMPORT const SECItem * SSL_PeerSignedCertTimestamps(PRFileDesc *fd); 625 SSL_IMPORT const SECItem *SSL_PeerSignedCertTimestamps(PRFileDesc *fd);
614 626
615 /* SSL_SetStapledOCSPResponses stores an array of one or multiple OCSP responses 627 /* SSL_SetStapledOCSPResponses stores an array of one or multiple OCSP responses
616 * in the fd's data, which may be sent as part of a server side cert_status 628 * in the fd's data, which may be sent as part of a server side cert_status
617 * handshake message. Parameter |responses| is for the server certificate of 629 * handshake message. Parameter |responses| is for the server certificate of
618 * the key exchange type |kea|. 630 * the key exchange type |kea|.
619 * The function will duplicate the responses array. 631 * The function will duplicate the responses array.
620 */ 632 */
621 SSL_IMPORT SECStatus 633 SSL_IMPORT SECStatus
622 SSL_SetStapledOCSPResponses(PRFileDesc *fd, const SECItemArray *responses, 634 SSL_SetStapledOCSPResponses(PRFileDesc *fd, const SECItemArray *responses,
623 » » » SSLKEAType kea); 635 SSLKEAType kea);
636
637 /*
638 * SSL_SetSignedCertTimestamps stores serialized signed_certificate_timestamp
639 * extension data in the fd. The signed_certificate_timestamp data is sent
640 * during the handshake (if requested by the client). Parameter |scts|
641 * is for the server certificate of the key exchange type |kea|.
642 * The function will duplicate the provided data item. To clear previously
643 * set data for a given key exchange type |kea|, pass NULL to |scts|.
644 */
645 SSL_IMPORT SECStatus
646 SSL_SetSignedCertTimestamps(PRFileDesc *fd, const SECItem *scts,
647 SSLKEAType kea);
624 648
625 /* 649 /*
626 ** Authenticate certificate hook. Called when a certificate comes in 650 ** Authenticate certificate hook. Called when a certificate comes in
627 ** (because of SSL_REQUIRE_CERTIFICATE in SSL_Enable) to authenticate the 651 ** (because of SSL_REQUIRE_CERTIFICATE in SSL_Enable) to authenticate the
628 ** certificate. 652 ** certificate.
629 ** 653 **
630 ** The authenticate certificate hook must return SECSuccess to indicate the 654 ** The authenticate certificate hook must return SECSuccess to indicate the
631 ** certificate is valid, SECFailure to indicate the certificate is invalid, 655 ** certificate is valid, SECFailure to indicate the certificate is invalid,
632 ** or SECWouldBlock if the application will authenticate the certificate 656 ** or SECWouldBlock if the application will authenticate the certificate
633 ** asynchronously. SECWouldBlock is only supported for non-blocking sockets. 657 ** asynchronously. SECWouldBlock is only supported for non-blocking sockets.
(...skipping 12 matching lines...) Expand all
646 ** RFC 6066 says that clients should send the bad_certificate_status_response 670 ** RFC 6066 says that clients should send the bad_certificate_status_response
647 ** alert when they encounter an error processing the stapled OCSP response. 671 ** alert when they encounter an error processing the stapled OCSP response.
648 ** libssl does not provide a way for the authenticate certificate hook to 672 ** libssl does not provide a way for the authenticate certificate hook to
649 ** indicate that an OCSP error (SEC_ERROR_OCSP_*) that it returns is an error 673 ** indicate that an OCSP error (SEC_ERROR_OCSP_*) that it returns is an error
650 ** in the stapled OCSP response or an error in some other OCSP response. 674 ** in the stapled OCSP response or an error in some other OCSP response.
651 ** Further, NSS does not provide a convenient way to control or determine 675 ** Further, NSS does not provide a convenient way to control or determine
652 ** which OCSP response(s) were used to validate a certificate chain. 676 ** which OCSP response(s) were used to validate a certificate chain.
653 ** Consequently, the current version of libssl does not ever send the 677 ** Consequently, the current version of libssl does not ever send the
654 ** bad_certificate_status_response alert. This may change in future releases. 678 ** bad_certificate_status_response alert. This may change in future releases.
655 */ 679 */
656 typedef SECStatus (PR_CALLBACK *SSLAuthCertificate)(void *arg, PRFileDesc *fd, 680 typedef SECStatus(PR_CALLBACK *SSLAuthCertificate)(void *arg, PRFileDesc *fd,
657 PRBool checkSig, 681 PRBool checkSig,
658 PRBool isServer); 682 PRBool isServer);
659 683
660 SSL_IMPORT SECStatus SSL_AuthCertificateHook(PRFileDesc *fd, 684 SSL_IMPORT SECStatus SSL_AuthCertificateHook(PRFileDesc *fd,
661 » » » » » SSLAuthCertificate f, 685 SSLAuthCertificate f,
662 » » » » void *arg); 686 void *arg);
663 687
664 /* An implementation of the certificate authentication hook */ 688 /* An implementation of the certificate authentication hook */
665 SSL_IMPORT SECStatus SSL_AuthCertificate(void *arg, PRFileDesc *fd, 689 SSL_IMPORT SECStatus SSL_AuthCertificate(void *arg, PRFileDesc *fd,
666 » » » » » PRBool checkSig, PRBool isServer); 690 PRBool checkSig, PRBool isServer);
667 691
668 /* 692 /*
669 * Prototype for SSL callback to get client auth data from the application. 693 * Prototype for SSL callback to get client auth data from the application.
670 *» arg - application passed argument 694 * arg - application passed argument
671 *» caNames - pointer to distinguished names of CAs that the server likes 695 * caNames - pointer to distinguished names of CAs that the server likes
672 *» pRetCert - pointer to pointer to cert, for return of cert 696 * pRetCert - pointer to pointer to cert, for return of cert
673 *» pRetKey - pointer to key pointer, for return of key 697 * pRetKey - pointer to key pointer, for return of key
674 */ 698 */
675 typedef SECStatus (PR_CALLBACK *SSLGetClientAuthData)(void *arg, 699 typedef SECStatus(PR_CALLBACK *SSLGetClientAuthData)(void *arg,
676 PRFileDesc *fd, 700 PRFileDesc *fd,
677 CERTDistNames *caNames, 701 CERTDistNames *caNames,
678 CERTCertificate **pRetCert,/*return */ 702 CERTCertificate **pRetCert, /*return */
679 SECKEYPrivateKey **pRetKey);/* return */ 703 SECKEYPrivateKey **pRetKey) ; /* return */
680 704
681 /* 705 /*
682 * Set the client side callback for SSL to retrieve user's private key 706 * Set the client side callback for SSL to retrieve user's private key
683 * and certificate. 707 * and certificate.
684 *» fd - the file descriptor for the connection in question 708 * fd - the file descriptor for the connection in question
685 *» f - the application's callback that delivers the key and cert 709 * f - the application's callback that delivers the key and cert
686 *» a - application specific data 710 * a - application specific data
687 */ 711 */
688 SSL_IMPORT SECStatus SSL_GetClientAuthDataHook(PRFileDesc *fd, 712 SSL_IMPORT SECStatus SSL_GetClientAuthDataHook(PRFileDesc *fd,
689 » » » SSLGetClientAuthData f, void *a); 713 SSLGetClientAuthData f, void *a);
690
691 /*
692 * Prototype for SSL callback to get client auth data from the application,
693 * optionally using the underlying platform's cryptographic primitives.
694 * To use the platform cryptographic primitives, caNames and pRetCerts
695 * should be set. To use NSS, pRetNSSCert and pRetNSSKey should be set.
696 * Returning SECFailure will cause the socket to send no client certificate.
697 *» arg - application passed argument
698 *» caNames - pointer to distinguished names of CAs that the server likes
699 *» pRetCerts - pointer to pointer to list of certs, with the first being
700 *» » the client cert, and any following being used for chain
701 *» » building
702 *» pRetKey - pointer to native key pointer, for return of key
703 * - Windows: A pointer to a PCERT_KEY_CONTEXT that was allocated
704 * via PORT_Alloc(). Ownership of the PCERT_KEY_CONTEXT
705 * is transferred to NSS, which will free via
706 * PORT_Free().
707 * - Mac OS X: A pointer to a SecKeyRef. Ownership is
708 * transferred to NSS, which will free via CFRelease().
709 *» pRetNSSCert - pointer to pointer to NSS cert, for return of cert.
710 *» pRetNSSKey - pointer to NSS key pointer, for return of key.
711 */
712 typedef SECStatus (PR_CALLBACK *SSLGetPlatformClientAuthData)(void *arg,
713 PRFileDesc *fd,
714 CERTDistNames *caNames,
715 CERTCertList **pRetCerts,/*return */
716 void **pRetKey,/* return */
717 CERTCertificate **pRetNSSCert,/*return */
718 SECKEYPrivateKey **pRetNSSKey);/* return */
719
720 /*
721 * Set the client side callback for SSL to retrieve user's private key
722 * and certificate.
723 * Note: If a platform client auth callback is set, the callback configured by
724 * SSL_GetClientAuthDataHook, if any, will not be called.
725 *
726 *» fd - the file descriptor for the connection in question
727 *» f - the application's callback that delivers the key and cert
728 *» a - application specific data
729 */
730 SSL_IMPORT SECStatus
731 SSL_GetPlatformClientAuthDataHook(PRFileDesc *fd,
732 SSLGetPlatformClientAuthData f, void *a);
733 714
734 /* 715 /*
735 ** SNI extension processing callback function. 716 ** SNI extension processing callback function.
736 ** It is called when SSL socket receives SNI extension in ClientHello message. 717 ** It is called when SSL socket receives SNI extension in ClientHello message.
737 ** Upon this callback invocation, application is responsible to reconfigure the 718 ** Upon this callback invocation, application is responsible to reconfigure the
738 ** socket with the data for a particular server name. 719 ** socket with the data for a particular server name.
739 ** There are three potential outcomes of this function invocation: 720 ** There are three potential outcomes of this function invocation:
740 ** * application does not recognize the name or the type and wants the 721 ** * application does not recognize the name or the type and wants the
741 ** "unrecognized_name" alert be sent to the client. In this case the callback 722 ** "unrecognized_name" alert be sent to the client. In this case the callback
742 ** function must return SSL_SNI_SEND_ALERT status. 723 ** function must return SSL_SNI_SEND_ALERT status.
743 ** * application does not recognize the name, but wants to continue with 724 ** * application does not recognize the name, but wants to continue with
744 ** the handshake using the current socket configuration. In this case, 725 ** the handshake using the current socket configuration. In this case,
745 ** no socket reconfiguration is needed and the function should return 726 ** no socket reconfiguration is needed and the function should return
746 ** SSL_SNI_CURRENT_CONFIG_IS_USED. 727 ** SSL_SNI_CURRENT_CONFIG_IS_USED.
747 ** * application recognizes the name and reconfigures the socket with 728 ** * application recognizes the name and reconfigures the socket with
748 ** appropriate certs, key, etc. There are many ways to reconfigure. NSS 729 ** appropriate certs, key, etc. There are many ways to reconfigure. NSS
749 ** provides SSL_ReconfigFD function that can be used to update the socket 730 ** provides SSL_ReconfigFD function that can be used to update the socket
750 ** data from model socket. To continue with the rest of the handshake, the 731 ** data from model socket. To continue with the rest of the handshake, the
751 ** implementation function should return an index of a name it has chosen. 732 ** implementation function should return an index of a name it has chosen.
752 ** LibSSL will ignore any SNI extension received in a ClientHello message 733 ** LibSSL will ignore any SNI extension received in a ClientHello message
753 ** if application does not register a SSLSNISocketConfig callback. 734 ** if application does not register a SSLSNISocketConfig callback.
754 ** Each type field of SECItem indicates the name type. 735 ** Each type field of SECItem indicates the name type.
755 ** NOTE: currently RFC3546 defines only one name type: sni_host_name. 736 ** NOTE: currently RFC3546 defines only one name type: sni_host_name.
756 ** Client is allowed to send only one name per known type. LibSSL will 737 ** Client is allowed to send only one name per known type. LibSSL will
757 ** send an "unrecognized_name" alert if SNI extension name list contains more 738 ** send an "unrecognized_name" alert if SNI extension name list contains more
758 ** then one name of a type. 739 ** then one name of a type.
759 */ 740 */
760 typedef PRInt32 (PR_CALLBACK *SSLSNISocketConfig)(PRFileDesc *fd, 741 typedef PRInt32(PR_CALLBACK *SSLSNISocketConfig)(PRFileDesc *fd,
761 const SECItem *srvNameArr, 742 const SECItem *srvNameArr,
762 PRUint32 srvNameArrSize, 743 PRUint32 srvNameArrSize,
763 void *arg); 744 void *arg);
764 745
765 /* 746 /*
766 ** SSLSNISocketConfig should return an index within 0 and srvNameArrSize-1 747 ** SSLSNISocketConfig should return an index within 0 and srvNameArrSize-1
767 ** when it has reconfigured the socket fd to use certs and keys, etc 748 ** when it has reconfigured the socket fd to use certs and keys, etc
768 ** for a specific name. There are two other allowed return values. One 749 ** for a specific name. There are two other allowed return values. One
769 ** tells libSSL to use the default cert and key. The other tells libSSL 750 ** tells libSSL to use the default cert and key. The other tells libSSL
770 ** to send the "unrecognized_name" alert. These values are: 751 ** to send the "unrecognized_name" alert. These values are:
771 **/ 752 **/
772 #define SSL_SNI_CURRENT_CONFIG_IS_USED -1 753 #define SSL_SNI_CURRENT_CONFIG_IS_USED -1
773 #define SSL_SNI_SEND_ALERT -2 754 #define SSL_SNI_SEND_ALERT -2
774 755
775 /* 756 /*
776 ** Set application implemented SNISocketConfig callback. 757 ** Set application implemented SNISocketConfig callback.
777 */ 758 */
778 SSL_IMPORT SECStatus SSL_SNISocketConfigHook(PRFileDesc *fd, 759 SSL_IMPORT SECStatus SSL_SNISocketConfigHook(PRFileDesc *fd,
779 SSLSNISocketConfig f, 760 SSLSNISocketConfig f,
780 void *arg); 761 void *arg);
781 762
782 /* 763 /*
783 ** Reconfigure fd SSL socket with model socket parameters. Sets 764 ** Reconfigure fd SSL socket with model socket parameters. Sets
784 ** server certs and keys, list of trust anchor, socket options 765 ** server certs and keys, list of trust anchor, socket options
785 ** and all SSL socket call backs and parameters. 766 ** and all SSL socket call backs and parameters.
786 */ 767 */
787 SSL_IMPORT PRFileDesc *SSL_ReconfigFD(PRFileDesc *model, PRFileDesc *fd); 768 SSL_IMPORT PRFileDesc *SSL_ReconfigFD(PRFileDesc *model, PRFileDesc *fd);
788 769
789 /* 770 /*
790 * Set the client side argument for SSL to retrieve PKCS #11 pin. 771 * Set the client side argument for SSL to retrieve PKCS #11 pin.
791 *» fd - the file descriptor for the connection in question 772 * fd - the file descriptor for the connection in question
792 *» a - pkcs11 application specific data 773 * a - pkcs11 application specific data
793 */ 774 */
794 SSL_IMPORT SECStatus SSL_SetPKCS11PinArg(PRFileDesc *fd, void *a); 775 SSL_IMPORT SECStatus SSL_SetPKCS11PinArg(PRFileDesc *fd, void *a);
795 776
796 /* 777 /*
797 ** This is a callback for dealing with server certs that are not authenticated 778 ** This is a callback for dealing with server certs that are not authenticated
798 ** by the client. The client app can decide that it actually likes the 779 ** by the client. The client app can decide that it actually likes the
799 ** cert by some external means and restart the connection. 780 ** cert by some external means and restart the connection.
800 ** 781 **
801 ** The bad cert hook must return SECSuccess to override the result of the 782 ** The bad cert hook must return SECSuccess to override the result of the
802 ** authenticate certificate hook, SECFailure if the certificate should still be 783 ** authenticate certificate hook, SECFailure if the certificate should still be
803 ** considered invalid, or SECWouldBlock if the application will authenticate 784 ** considered invalid, or SECWouldBlock if the application will authenticate
804 ** the certificate asynchronously. SECWouldBlock is only supported for 785 ** the certificate asynchronously. SECWouldBlock is only supported for
805 ** non-blocking sockets. 786 ** non-blocking sockets.
806 ** 787 **
807 ** See the documentation for SSL_AuthCertificateComplete for more information 788 ** See the documentation for SSL_AuthCertificateComplete for more information
808 ** about the asynchronous behavior that occurs when the bad cert hook returns 789 ** about the asynchronous behavior that occurs when the bad cert hook returns
809 ** SECWouldBlock. 790 ** SECWouldBlock.
810 */ 791 */
811 typedef SECStatus (PR_CALLBACK *SSLBadCertHandler)(void *arg, PRFileDesc *fd); 792 typedef SECStatus(PR_CALLBACK *SSLBadCertHandler)(void *arg, PRFileDesc *fd);
812 SSL_IMPORT SECStatus SSL_BadCertHook(PRFileDesc *fd, SSLBadCertHandler f, 793 SSL_IMPORT SECStatus SSL_BadCertHook(PRFileDesc *fd, SSLBadCertHandler f,
813 » » » » void *arg); 794 void *arg);
814 795
815 /* 796 /*
816 ** Configure SSL socket for running a secure server. Needs the 797 ** Configure SSL socket for running a secure server. Needs the
817 ** certificate for the server and the servers private key. The arguments 798 ** certificate for the server and the servers private key. The arguments
818 ** are copied. 799 ** are copied.
819 */ 800 */
820 SSL_IMPORT SECStatus SSL_ConfigSecureServer( 801 SSL_IMPORT SECStatus SSL_ConfigSecureServer(
821 » » » » PRFileDesc *fd, CERTCertificate *cert, 802 PRFileDesc *fd, CERTCertificate *cert,
822 » » » » SECKEYPrivateKey *key, SSLKEAType kea); 803 SECKEYPrivateKey *key, SSLKEAType kea);
823 804
824 /* 805 /*
825 ** Allows SSL socket configuration with caller-supplied certificate chain. 806 ** Allows SSL socket configuration with caller-supplied certificate chain.
826 ** If certChainOpt is NULL, tries to find one. 807 ** If certChainOpt is NULL, tries to find one.
827 */ 808 */
828 SSL_IMPORT SECStatus 809 SSL_IMPORT SECStatus
829 SSL_ConfigSecureServerWithCertChain(PRFileDesc *fd, CERTCertificate *cert, 810 SSL_ConfigSecureServerWithCertChain(PRFileDesc *fd, CERTCertificate *cert,
830 const CERTCertificateList *certChainOpt, 811 const CERTCertificateList *certChainOpt,
831 SECKEYPrivateKey *key, SSLKEAType kea); 812 SECKEYPrivateKey *key, SSLKEAType kea);
832 813
833 /* 814 /*
834 ** Configure a secure server's session-id cache. Define the maximum number 815 ** Configure a secure server's session-id cache. Define the maximum number
835 ** of entries in the cache, the longevity of the entires, and the directory 816 ** of entries in the cache, the longevity of the entires, and the directory
836 ** where the cache files will be placed. These values can be zero, and 817 ** where the cache files will be placed. These values can be zero, and
837 ** if so, the implementation will choose defaults. 818 ** if so, the implementation will choose defaults.
838 ** This version of the function is for use in applications that have only one 819 ** This version of the function is for use in applications that have only one
839 ** process that uses the cache (even if that process has multiple threads). 820 ** process that uses the cache (even if that process has multiple threads).
840 */ 821 */
841 SSL_IMPORT SECStatus SSL_ConfigServerSessionIDCache(int maxCacheEntries, 822 SSL_IMPORT SECStatus SSL_ConfigServerSessionIDCache(int maxCacheEntries,
842 » » » » » PRUint32 timeout, 823 PRUint32 timeout,
843 » » » » » PRUint32 ssl3_timeout, 824 PRUint32 ssl3_timeout,
844 » » » » const char * directory); 825 const char *directory);
845 826
846 /* Configure a secure server's session-id cache. Depends on value of 827 /* Configure a secure server's session-id cache. Depends on value of
847 * enableMPCache, configures malti-proc or single proc cache. */ 828 * enableMPCache, configures malti-proc or single proc cache. */
848 SSL_IMPORT SECStatus SSL_ConfigServerSessionIDCacheWithOpt( 829 SSL_IMPORT SECStatus SSL_ConfigServerSessionIDCacheWithOpt(
849 PRUint32 timeout, 830 PRUint32 timeout,
850 PRUint32 ssl3_timeout, 831 PRUint32 ssl3_timeout,
851 const char * directory, 832 const char *directory,
852 int maxCacheEntries, 833 int maxCacheEntries,
853 int maxCertCacheEntries, 834 int maxCertCacheEntries,
854 int maxSrvNameCacheEntries, 835 int maxSrvNameCacheEntries,
855 PRBool enableMPCache) ; 836 PRBool enableMPCache);
856 837
857 /* 838 /*
858 ** Like SSL_ConfigServerSessionIDCache, with one important difference. 839 ** Like SSL_ConfigServerSessionIDCache, with one important difference.
859 ** If the application will run multiple processes (as opposed to, or in 840 ** If the application will run multiple processes (as opposed to, or in
860 ** addition to multiple threads), then it must call this function, instead 841 ** addition to multiple threads), then it must call this function, instead
861 ** of calling SSL_ConfigServerSessionIDCache(). 842 ** of calling SSL_ConfigServerSessionIDCache().
862 ** This has nothing to do with the number of processORs, only processEs. 843 ** This has nothing to do with the number of processORs, only processEs.
863 ** This function sets up a Server Session ID (SID) cache that is safe for 844 ** This function sets up a Server Session ID (SID) cache that is safe for
864 ** access by multiple processes on the same system. 845 ** access by multiple processes on the same system.
865 */ 846 */
866 SSL_IMPORT SECStatus SSL_ConfigMPServerSIDCache(int maxCacheEntries, 847 SSL_IMPORT SECStatus SSL_ConfigMPServerSIDCache(int maxCacheEntries,
867 » » » » PRUint32 timeout, 848 PRUint32 timeout,
868 » » » » PRUint32 ssl3_timeout, 849 PRUint32 ssl3_timeout,
869 » » const char * directory); 850 const char *directory);
870 851
871 /* Get and set the configured maximum number of mutexes used for the 852 /* Get and set the configured maximum number of mutexes used for the
872 ** server's store of SSL sessions. This value is used by the server 853 ** server's store of SSL sessions. This value is used by the server
873 ** session ID cache initialization functions shown above. Note that on 854 ** session ID cache initialization functions shown above. Note that on
874 ** some platforms, these mutexes are actually implemented with POSIX 855 ** some platforms, these mutexes are actually implemented with POSIX
875 ** semaphores, or with unnamed pipes. The default value varies by platform. 856 ** semaphores, or with unnamed pipes. The default value varies by platform.
876 ** An attempt to set a too-low maximum will return an error and the 857 ** An attempt to set a too-low maximum will return an error and the
877 ** configured value will not be changed. 858 ** configured value will not be changed.
878 */ 859 */
879 SSL_IMPORT PRUint32 SSL_GetMaxServerCacheLocks(void); 860 SSL_IMPORT PRUint32 SSL_GetMaxServerCacheLocks(void);
880 SSL_IMPORT SECStatus SSL_SetMaxServerCacheLocks(PRUint32 maxLocks); 861 SSL_IMPORT SECStatus SSL_SetMaxServerCacheLocks(PRUint32 maxLocks);
881 862
882 /* environment variable set by SSL_ConfigMPServerSIDCache, and queried by 863 /* environment variable set by SSL_ConfigMPServerSIDCache, and queried by
883 * SSL_InheritMPServerSIDCache when envString is NULL. 864 * SSL_InheritMPServerSIDCache when envString is NULL.
884 */ 865 */
885 #define SSL_ENV_VAR_NAME "SSL_INHERITANCE" 866 #define SSL_ENV_VAR_NAME "SSL_INHERITANCE"
886 867
887 /* called in child to inherit SID Cache variables. 868 /* called in child to inherit SID Cache variables.
888 * If envString is NULL, this function will use the value of the environment 869 * If envString is NULL, this function will use the value of the environment
889 * variable "SSL_INHERITANCE", otherwise the string value passed in will be 870 * variable "SSL_INHERITANCE", otherwise the string value passed in will be
890 * used. 871 * used.
891 */ 872 */
892 SSL_IMPORT SECStatus SSL_InheritMPServerSIDCache(const char * envString); 873 SSL_IMPORT SECStatus SSL_InheritMPServerSIDCache(const char *envString);
893 874
894 /* 875 /*
895 ** Set the callback that gets called when a TLS handshake is complete. The 876 ** Set the callback that gets called when a TLS handshake is complete. The
896 ** handshake callback is called after verifying the peer's Finished message and 877 ** handshake callback is called after verifying the peer's Finished message and
897 ** before processing incoming application data. 878 ** before processing incoming application data.
898 ** 879 **
899 ** For the initial handshake: If the handshake false started (see 880 ** For the initial handshake: If the handshake false started (see
900 ** SSL_ENABLE_FALSE_START), then application data may already have been sent 881 ** SSL_ENABLE_FALSE_START), then application data may already have been sent
901 ** before the handshake callback is called. If we did not false start then the 882 ** before the handshake callback is called. If we did not false start then the
902 ** callback will get called before any application data is sent. 883 ** callback will get called before any application data is sent.
903 */ 884 */
904 typedef void (PR_CALLBACK *SSLHandshakeCallback)(PRFileDesc *fd, 885 typedef void(PR_CALLBACK *SSLHandshakeCallback)(PRFileDesc *fd,
905 void *client_data); 886 void *client_data);
906 SSL_IMPORT SECStatus SSL_HandshakeCallback(PRFileDesc *fd, 887 SSL_IMPORT SECStatus SSL_HandshakeCallback(PRFileDesc *fd,
907 » » » SSLHandshakeCallback cb, void *client_data); 888 SSLHandshakeCallback cb, void *client _data);
908 889
909 /* Applications that wish to enable TLS false start must set this callback 890 /* Applications that wish to enable TLS false start must set this callback
910 ** function. NSS will invoke the functon to determine if a particular 891 ** function. NSS will invoke the functon to determine if a particular
911 ** connection should use false start or not. SECSuccess indicates that the 892 ** connection should use false start or not. SECSuccess indicates that the
912 ** callback completed successfully, and if so *canFalseStart indicates if false 893 ** callback completed successfully, and if so *canFalseStart indicates if false
913 ** start can be used. If the callback does not return SECSuccess then the 894 ** start can be used. If the callback does not return SECSuccess then the
914 ** handshake will be canceled. NSS's recommended criteria can be evaluated by 895 ** handshake will be canceled. NSS's recommended criteria can be evaluated by
915 ** calling SSL_RecommendedCanFalseStart. 896 ** calling SSL_RecommendedCanFalseStart.
916 ** 897 **
917 ** If no false start callback is registered then false start will never be 898 ** If no false start callback is registered then false start will never be
918 ** done, even if the SSL_ENABLE_FALSE_START option is enabled. 899 ** done, even if the SSL_ENABLE_FALSE_START option is enabled.
919 **/ 900 **/
920 typedef SECStatus (PR_CALLBACK *SSLCanFalseStartCallback)( 901 typedef SECStatus(PR_CALLBACK *SSLCanFalseStartCallback)(
921 PRFileDesc *fd, void *arg, PRBool *canFalseStart); 902 PRFileDesc *fd, void *arg, PRBool *canFalseStart);
922 903
923 SSL_IMPORT SECStatus SSL_SetCanFalseStartCallback( 904 SSL_IMPORT SECStatus SSL_SetCanFalseStartCallback(
924 PRFileDesc *fd, SSLCanFalseStartCallback callback, void *arg); 905 PRFileDesc *fd, SSLCanFalseStartCallback callback, void *arg);
925 906
926 /* This function sets *canFalseStart according to the recommended criteria for 907 /* This function sets *canFalseStart according to the recommended criteria for
927 ** false start. These criteria may change from release to release and may depend 908 ** false start. These criteria may change from release to release and may depend
928 ** on which handshake features have been negotiated and/or properties of the 909 ** on which handshake features have been negotiated and/or properties of the
929 ** certifciates/keys used on the connection. 910 ** certifciates/keys used on the connection.
930 */ 911 */
931 SSL_IMPORT SECStatus SSL_RecommendedCanFalseStart(PRFileDesc *fd, 912 SSL_IMPORT SECStatus SSL_RecommendedCanFalseStart(PRFileDesc *fd,
932 PRBool *canFalseStart); 913 PRBool *canFalseStart);
933 914
934 /* 915 /*
935 ** For the server, request a new handshake. For the client, begin a new 916 ** For the server, request a new handshake. For the client, begin a new
936 ** handshake. If flushCache is non-zero, the SSL3 cache entry will be 917 ** handshake. If flushCache is non-zero, the SSL3 cache entry will be
937 ** flushed first, ensuring that a full SSL handshake will be done. 918 ** flushed first, ensuring that a full SSL handshake will be done.
938 ** If flushCache is zero, and an SSL connection is established, it will 919 ** If flushCache is zero, and an SSL connection is established, it will
939 ** do the much faster session restart handshake. This will change the 920 ** do the much faster session restart handshake. This will change the
940 ** session keys without doing another private key operation. 921 ** session keys without doing another private key operation.
941 */ 922 */
942 SSL_IMPORT SECStatus SSL_ReHandshake(PRFileDesc *fd, PRBool flushCache); 923 SSL_IMPORT SECStatus SSL_ReHandshake(PRFileDesc *fd, PRBool flushCache);
943 924
944 /* 925 /*
945 ** Same as above, but with an I/O timeout. 926 ** Same as above, but with an I/O timeout.
946 */ 927 */
947 SSL_IMPORT SECStatus SSL_ReHandshakeWithTimeout(PRFileDesc *fd, 928 SSL_IMPORT SECStatus SSL_ReHandshakeWithTimeout(PRFileDesc *fd,
948 PRBool flushCache, 929 PRBool flushCache,
949 PRIntervalTime timeout); 930 PRIntervalTime timeout);
950 931
951 /* Returns a SECItem containing the certificate_types field of the 932 /* Returns a SECItem containing the certificate_types field of the
952 ** CertificateRequest message. Each byte of the data is a TLS 933 ** CertificateRequest message. Each byte of the data is a TLS
953 ** ClientCertificateType value, and they are ordered from most preferred to 934 ** ClientCertificateType value, and they are ordered from most preferred to
954 ** least. This function should only be called from the 935 ** least. This function should only be called from the
955 ** SSL_GetClientAuthDataHook callback, and will return NULL if called at any 936 ** SSL_GetClientAuthDataHook callback, and will return NULL if called at any
956 ** other time. The returned value is valid only until the callback returns, and 937 ** other time. The returned value is valid only until the callback returns, and
957 ** should not be freed. 938 ** should not be freed.
958 */ 939 */
959 SSL_IMPORT const SECItem * 940 SSL_IMPORT const SECItem *
960 SSL_GetRequestedClientCertificateTypes(PRFileDesc *fd); 941 SSL_GetRequestedClientCertificateTypes(PRFileDesc *fd);
961 942
962 #ifdef SSL_DEPRECATED_FUNCTION 943 #ifdef SSL_DEPRECATED_FUNCTION
963 /* deprecated! 944 /* deprecated!
964 ** For the server, request a new handshake. For the client, begin a new 945 ** For the server, request a new handshake. For the client, begin a new
965 ** handshake. Flushes SSL3 session cache entry first, ensuring that a 946 ** handshake. Flushes SSL3 session cache entry first, ensuring that a
966 ** full handshake will be done. 947 ** full handshake will be done.
967 ** This call is equivalent to SSL_ReHandshake(fd, PR_TRUE) 948 ** This call is equivalent to SSL_ReHandshake(fd, PR_TRUE)
968 */ 949 */
969 SSL_IMPORT SECStatus SSL_RedoHandshake(PRFileDesc *fd); 950 SSL_IMPORT SECStatus SSL_RedoHandshake(PRFileDesc *fd);
970 #endif 951 #endif
971 952
972 /* 953 /*
973 * Allow the application to pass a URL or hostname into the SSL library. 954 * Allow the application to pass a URL or hostname into the SSL library.
974 */ 955 */
975 SSL_IMPORT SECStatus SSL_SetURL(PRFileDesc *fd, const char *url); 956 SSL_IMPORT SECStatus SSL_SetURL(PRFileDesc *fd, const char *url);
976 957
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 */ 999 */
1019 SSL_IMPORT SECStatus SSL_ShutdownServerSessionIDCache(void); 1000 SSL_IMPORT SECStatus SSL_ShutdownServerSessionIDCache(void);
1020 1001
1021 /* 1002 /*
1022 ** Set peer information so we can correctly look up SSL session later. 1003 ** Set peer information so we can correctly look up SSL session later.
1023 ** You only have to do this if you're tunneling through a proxy. 1004 ** You only have to do this if you're tunneling through a proxy.
1024 */ 1005 */
1025 SSL_IMPORT SECStatus SSL_SetSockPeerID(PRFileDesc *fd, const char *peerID); 1006 SSL_IMPORT SECStatus SSL_SetSockPeerID(PRFileDesc *fd, const char *peerID);
1026 1007
1027 /* 1008 /*
1028 ** Reveal the security information for the peer. 1009 ** Reveal the security information for the peer.
1029 */ 1010 */
1030 SSL_IMPORT CERTCertificate * SSL_RevealCert(PRFileDesc * socket); 1011 SSL_IMPORT CERTCertificate *SSL_RevealCert(PRFileDesc *socket);
1031 SSL_IMPORT void * SSL_RevealPinArg(PRFileDesc * socket); 1012 SSL_IMPORT void *SSL_RevealPinArg(PRFileDesc *socket);
1032 SSL_IMPORT char * SSL_RevealURL(PRFileDesc * socket); 1013 SSL_IMPORT char *SSL_RevealURL(PRFileDesc *socket);
1033 1014
1034 /* This callback may be passed to the SSL library via a call to 1015 /* This callback may be passed to the SSL library via a call to
1035 * SSL_GetClientAuthDataHook() for each SSL client socket. 1016 * SSL_GetClientAuthDataHook() for each SSL client socket.
1036 * It will be invoked when SSL needs to know what certificate and private key 1017 * It will be invoked when SSL needs to know what certificate and private key
1037 * (if any) to use to respond to a request for client authentication. 1018 * (if any) to use to respond to a request for client authentication.
1038 * If arg is non-NULL, it is a pointer to a NULL-terminated string containing 1019 * If arg is non-NULL, it is a pointer to a NULL-terminated string containing
1039 * the nickname of the cert/key pair to use. 1020 * the nickname of the cert/key pair to use.
1040 * If arg is NULL, this function will search the cert and key databases for 1021 * If arg is NULL, this function will search the cert and key databases for
1041 * a suitable match and send it if one is found. 1022 * a suitable match and send it if one is found.
1042 */ 1023 */
1043 SSL_IMPORT SECStatus 1024 SSL_IMPORT SECStatus
1044 NSS_GetClientAuthData(void * arg, 1025 NSS_GetClientAuthData(void *arg,
1045 PRFileDesc * socket, 1026 PRFileDesc *socket,
1046 struct CERTDistNamesStr * caNames, 1027 struct CERTDistNamesStr *caNames,
1047 struct CERTCertificateStr ** pRetCert, 1028 struct CERTCertificateStr **pRetCert,
1048 struct SECKEYPrivateKeyStr **pRetKey); 1029 struct SECKEYPrivateKeyStr **pRetKey);
1049 1030
1050 /* 1031 /*
1051 ** Configure DTLS-SRTP (RFC 5764) cipher suite preferences. 1032 ** Configure DTLS-SRTP (RFC 5764) cipher suite preferences.
1052 ** Input is a list of ciphers in descending preference order and a length 1033 ** Input is a list of ciphers in descending preference order and a length
1053 ** of the list. As a side effect, this causes the use_srtp extension to be 1034 ** of the list. As a side effect, this causes the use_srtp extension to be
1054 ** negotiated. 1035 ** negotiated.
1055 ** 1036 **
1056 ** Invalid or unimplemented cipher suites in |ciphers| are ignored. If at 1037 ** Invalid or unimplemented cipher suites in |ciphers| are ignored. If at
1057 ** least one cipher suite in |ciphers| is implemented, returns SECSuccess. 1038 ** least one cipher suite in |ciphers| is implemented, returns SECSuccess.
1058 ** Otherwise returns SECFailure. 1039 ** Otherwise returns SECFailure.
1059 */ 1040 */
1060 SSL_IMPORT SECStatus SSL_SetSRTPCiphers(PRFileDesc *fd, 1041 SSL_IMPORT SECStatus SSL_SetSRTPCiphers(PRFileDesc *fd,
1061 » » » » » const PRUint16 *ciphers, 1042 const PRUint16 *ciphers,
1062 » » » » » unsigned int numCiphers); 1043 unsigned int numCiphers);
1063 1044
1064 /* 1045 /*
1065 ** Get the selected DTLS-SRTP cipher suite (if any). 1046 ** Get the selected DTLS-SRTP cipher suite (if any).
1066 ** To be called after the handshake completes. 1047 ** To be called after the handshake completes.
1067 ** Returns SECFailure if not negotiated. 1048 ** Returns SECFailure if not negotiated.
1068 */ 1049 */
1069 SSL_IMPORT SECStatus SSL_GetSRTPCipher(PRFileDesc *fd, 1050 SSL_IMPORT SECStatus SSL_GetSRTPCipher(PRFileDesc *fd,
1070 » » » » PRUint16 *cipher); 1051 PRUint16 *cipher);
1071 1052
1072 /* 1053 /*
1073 * Look to see if any of the signers in the cert chain for "cert" are found 1054 * Look to see if any of the signers in the cert chain for "cert" are found
1074 * in the list of caNames. 1055 * in the list of caNames.
1075 * Returns SECSuccess if so, SECFailure if not. 1056 * Returns SECSuccess if so, SECFailure if not.
1076 * Used by NSS_GetClientAuthData. May be used by other callback functions. 1057 * Used by NSS_GetClientAuthData. May be used by other callback functions.
1077 */ 1058 */
1078 SSL_IMPORT SECStatus NSS_CmpCertChainWCANames(CERTCertificate *cert, 1059 SSL_IMPORT SECStatus NSS_CmpCertChainWCANames(CERTCertificate *cert,
1079 CERTDistNames *caNames); 1060 CERTDistNames *caNames);
1080 1061
1081 /* 1062 /*
1082 * Returns key exchange type of the keys in an SSL server certificate. 1063 * Returns key exchange type of the keys in an SSL server certificate.
1083 */ 1064 */
1084 SSL_IMPORT SSLKEAType NSS_FindCertKEAType(CERTCertificate * cert); 1065 SSL_IMPORT SSLKEAType NSS_FindCertKEAType(CERTCertificate *cert);
1085 1066
1086 /* Set cipher policies to a predefined Domestic (U.S.A.) policy. 1067 /* Set cipher policies to a predefined Domestic (U.S.A.) policy.
1087 * This essentially allows all supported ciphers. 1068 * This essentially allows all supported ciphers.
1088 */ 1069 */
1089 SSL_IMPORT SECStatus NSS_SetDomesticPolicy(void); 1070 SSL_IMPORT SECStatus NSS_SetDomesticPolicy(void);
1090 1071
1091 /* Set cipher policies to a predefined Policy that is exportable from the USA 1072 /* Set cipher policies to a predefined Policy that is exportable from the USA
1092 * according to present U.S. policies as we understand them. 1073 * according to present U.S. policies as we understand them.
1093 * It is the same as NSS_SetDomesticPolicy now. 1074 * It is the same as NSS_SetDomesticPolicy now.
1094 */ 1075 */
1095 SSL_IMPORT SECStatus NSS_SetExportPolicy(void); 1076 SSL_IMPORT SECStatus NSS_SetExportPolicy(void);
1096 1077
1097 /* Set cipher policies to a predefined Policy that is exportable from the USA 1078 /* Set cipher policies to a predefined Policy that is exportable from the USA
1098 * according to present U.S. policies as we understand them, and that the 1079 * according to present U.S. policies as we understand them, and that the
1099 * nation of France will permit to be imported into their country. 1080 * nation of France will permit to be imported into their country.
1100 * It is the same as NSS_SetDomesticPolicy now. 1081 * It is the same as NSS_SetDomesticPolicy now.
1101 */ 1082 */
1102 SSL_IMPORT SECStatus NSS_SetFrancePolicy(void); 1083 SSL_IMPORT SECStatus NSS_SetFrancePolicy(void);
1103 1084
1104 SSL_IMPORT SSL3Statistics * SSL_GetStatistics(void); 1085 SSL_IMPORT SSL3Statistics *SSL_GetStatistics(void);
1105 1086
1106 /* Report more information than SSL_SecurityStatus. 1087 /* Report more information than SSL_SecurityStatus.
1107 * Caller supplies the info struct. This function fills it in. 1088 * Caller supplies the info struct. This function fills it in. Caller should
1089 * pass sizeof(SSLChannelInfo) as the |len| argument.
1090 *
1108 * The information here will be zeroed prior to details being confirmed. The 1091 * The information here will be zeroed prior to details being confirmed. The
1109 * details are confirmed either when a Finished message is received, or - for a 1092 * details are confirmed either when a Finished message is received, or - for a
1110 * client - when the second flight of messages have been sent. This function 1093 * client - when the second flight of messages have been sent. This function
1111 * therefore produces unreliable results prior to receiving the 1094 * therefore produces unreliable results prior to receiving the
1112 * SSLHandshakeCallback or the SSLCanFalseStartCallback. 1095 * SSLHandshakeCallback or the SSLCanFalseStartCallback.
1113 */ 1096 */
1114 SSL_IMPORT SECStatus SSL_GetChannelInfo(PRFileDesc *fd, SSLChannelInfo *info, 1097 SSL_IMPORT SECStatus SSL_GetChannelInfo(PRFileDesc *fd, SSLChannelInfo *info,
1115 PRUintn len); 1098 PRUintn len);
1116 /* Get preliminary information about a channel. 1099 /* Get preliminary information about a channel.
1117 * This function can be called prior to handshake details being confirmed (see 1100 * Caller supplies the info struct. This function fills it in. Caller should
1118 * SSL_GetChannelInfo above for what that means). Thus, information provided by 1101 * pass sizeof(SSLPreliminaryChannelInfo) as the |len| argument.
1102 *
1119 * this function is available to SSLAuthCertificate, SSLGetClientAuthData, 1103 * this function is available to SSLAuthCertificate, SSLGetClientAuthData,
1120 * SSLSNISocketConfig, and other callbacks that might be called during the 1104 * SSLSNISocketConfig, and other callbacks that might be called during the
1121 * processing of the first flight of client of server handshake messages. 1105 * processing of the first flight of client of server handshake messages.
1122 * Values are marked as being unavailable when renegotiation is initiated. 1106 * Values are marked as being unavailable when renegotiation is initiated.
1123 */ 1107 */
1124 SSL_IMPORT SECStatus 1108 SSL_IMPORT SECStatus
1125 SSL_GetPreliminaryChannelInfo(PRFileDesc *fd, 1109 SSL_GetPreliminaryChannelInfo(PRFileDesc *fd,
1126 SSLPreliminaryChannelInfo *info, 1110 SSLPreliminaryChannelInfo *info,
1127 PRUintn len); 1111 PRUintn len);
1128 SSL_IMPORT SECStatus SSL_GetCipherSuiteInfo(PRUint16 cipherSuite, 1112 /* Get information about cipher suite with id of |cipherSuite|.
1129 SSLCipherSuiteInfo *info, PRUintn len); 1113 * Caller supplies the info struct. This function fills it in. Caller should
1114 * pass sizeof(SSLCipherSuiteInfo) as the |len| argument.
1115 */
1116 SSL_IMPORT SECStatus SSL_GetCipherSuiteInfo(PRUint16 cipherSuite,
1117 SSLCipherSuiteInfo *info, PRUintn le n);
1130 1118
1131 /* Returnes negotiated through SNI host info. */ 1119 /* Returnes negotiated through SNI host info. */
1132 SSL_IMPORT SECItem *SSL_GetNegotiatedHostInfo(PRFileDesc *fd); 1120 SSL_IMPORT SECItem *SSL_GetNegotiatedHostInfo(PRFileDesc *fd);
1133 1121
1134 /* Export keying material according to RFC 5705. 1122 /* Export keying material according to RFC 5705.
1135 ** fd must correspond to a TLS 1.0 or higher socket and out must 1123 ** fd must correspond to a TLS 1.0 or higher socket and out must
1136 ** already be allocated. If hasContext is false, it uses the no-context 1124 ** already be allocated. If hasContext is false, it uses the no-context
1137 ** construction from the RFC and ignores the context and contextLen 1125 ** construction from the RFC and ignores the context and contextLen
1138 ** arguments. 1126 ** arguments.
1139 */ 1127 */
1140 SSL_IMPORT SECStatus SSL_ExportKeyingMaterial(PRFileDesc *fd, 1128 SSL_IMPORT SECStatus SSL_ExportKeyingMaterial(PRFileDesc *fd,
1141 const char *label, 1129 const char *label,
1142 unsigned int labelLen, 1130 unsigned int labelLen,
1143 PRBool hasContext, 1131 PRBool hasContext,
1144 const unsigned char *context, 1132 const unsigned char *context,
1145 unsigned int contextLen, 1133 unsigned int contextLen,
1146 unsigned char *out, 1134 unsigned char *out,
1147 unsigned int outLen); 1135 unsigned int outLen);
1148 1136
1149 /* 1137 /*
1150 ** Return a new reference to the certificate that was most recently sent 1138 ** Return a new reference to the certificate that was most recently sent
1151 ** to the peer on this SSL/TLS connection, or NULL if none has been sent. 1139 ** to the peer on this SSL/TLS connection, or NULL if none has been sent.
1152 */ 1140 */
1153 SSL_IMPORT CERTCertificate * SSL_LocalCertificate(PRFileDesc *fd); 1141 SSL_IMPORT CERTCertificate *SSL_LocalCertificate(PRFileDesc *fd);
1154 1142
1155 /* Test an SSL configuration to see if SSL_BYPASS_PKCS11 can be turned on. 1143 /* Test an SSL configuration to see if SSL_BYPASS_PKCS11 can be turned on.
1156 ** Check the key exchange algorithm for each cipher in the list to see if 1144 ** Check the key exchange algorithm for each cipher in the list to see if
1157 ** a master secret key can be extracted after being derived with the mechanism 1145 ** a master secret key can be extracted after being derived with the mechanism
1158 ** required by the protocolmask argument. If the KEA will use keys from the 1146 ** required by the protocolmask argument. If the KEA will use keys from the
1159 ** specified cert make sure the extract operation is attempted from the slot 1147 ** specified cert make sure the extract operation is attempted from the slot
1160 ** where the private key resides. 1148 ** where the private key resides.
1161 ** If MS can be extracted for all ciphers, (*pcanbypass) is set to TRUE and 1149 ** If MS can be extracted for all ciphers, (*pcanbypass) is set to TRUE and
1162 ** SECSuccess is returned. In all other cases but one (*pcanbypass) is 1150 ** SECSuccess is returned. In all other cases but one (*pcanbypass) is
1163 ** set to FALSE and SECFailure is returned. 1151 ** set to FALSE and SECFailure is returned.
1164 ** In that last case Derive() has been called successfully but the MS is null, 1152 ** In that last case Derive() has been called successfully but the MS is null,
1165 ** CanBypass sets (*pcanbypass) to FALSE and returns SECSuccess indicating the 1153 ** CanBypass sets (*pcanbypass) to FALSE and returns SECSuccess indicating the
1166 ** arguments were all valid but the slot cannot be bypassed. 1154 ** arguments were all valid but the slot cannot be bypassed.
1167 ** 1155 **
1168 ** Note: A TRUE return code from CanBypass means "Your configuration will perfor m 1156 ** Note: A TRUE return code from CanBypass means "Your configuration will perfor m
1169 ** NO WORSE with the bypass enabled than without"; it does NOT mean that every 1157 ** NO WORSE with the bypass enabled than without"; it does NOT mean that every
1170 ** cipher suite listed will work properly with the selected protocols. 1158 ** cipher suite listed will work properly with the selected protocols.
1171 ** 1159 **
1172 ** Caveat: If export cipher suites are included in the argument list Canbypass 1160 ** Caveat: If export cipher suites are included in the argument list Canbypass
1173 ** will return FALSE. 1161 ** will return FALSE.
1174 **/ 1162 **/
1175 1163
1176 /* protocol mask bits */ 1164 /* protocol mask bits */
1177 #define SSL_CBP_SSL3» 0x0001» /* test SSL v3 mechanisms */ 1165 #define SSL_CBP_SSL3 0x0001 /* test SSL v3 mechanisms */
1178 #define SSL_CBP_TLS1_0» 0x0002» » /* test TLS v1.0 mechanisms */ 1166 #define SSL_CBP_TLS1_0 0x0002 /* test TLS v1.0 mechanisms */
1179 1167
1180 SSL_IMPORT SECStatus SSL_CanBypass(CERTCertificate *cert, 1168 SSL_IMPORT SECStatus SSL_CanBypass(CERTCertificate *cert,
1181 SECKEYPrivateKey *privKey, 1169 SECKEYPrivateKey *privKey,
1182 » » » » PRUint32 protocolmask, 1170 PRUint32 protocolmask,
1183 » » » » PRUint16 *ciphers, int nciphers, 1171 PRUint16 *ciphers, int nciphers,
1184 PRBool *pcanbypass, void *pwArg); 1172 PRBool *pcanbypass, void *pwArg);
1185 1173
1186 /* 1174 /*
1187 ** Did the handshake with the peer negotiate the given extension? 1175 ** Did the handshake with the peer negotiate the given extension?
1188 ** Output parameter valid only if function returns SECSuccess 1176 ** Output parameter valid only if function returns SECSuccess
1189 */ 1177 */
1190 SSL_IMPORT SECStatus SSL_HandshakeNegotiatedExtension(PRFileDesc * socket, 1178 SSL_IMPORT SECStatus SSL_HandshakeNegotiatedExtension(PRFileDesc *socket,
1191 SSLExtensionType extId, 1179 SSLExtensionType extId,
1192 PRBool *yes); 1180 PRBool *yes);
1193 1181
1194 SSL_IMPORT SECStatus SSL_HandshakeResumedSession(PRFileDesc *fd, 1182 SSL_IMPORT SECStatus SSL_HandshakeResumedSession(PRFileDesc *fd,
1195 PRBool *last_handshake_resumed) ; 1183 PRBool *last_handshake_resumed) ;
1196 1184
1197 /* See SSL_SetClientChannelIDCallback for usage. If the callback returns 1185 /* See SSL_SetClientChannelIDCallback for usage. If the callback returns
1198 * SECWouldBlock then SSL_RestartHandshakeAfterChannelIDReq should be called in 1186 * SECWouldBlock then SSL_RestartHandshakeAfterChannelIDReq should be called in
1199 * the future to restart the handshake. On SECSuccess, the callback must have 1187 * the future to restart the handshake. On SECSuccess, the callback must have
1200 * written a P-256, EC key pair to |*out_public_key| and |*out_private_key|. */ 1188 * written a P-256, EC key pair to |*out_public_key| and |*out_private_key|. */
1201 typedef SECStatus (PR_CALLBACK *SSLClientChannelIDCallback)( 1189 typedef SECStatus(PR_CALLBACK *SSLClientChannelIDCallback)(
1202 void *arg, 1190 void *arg,
1203 PRFileDesc *fd, 1191 PRFileDesc *fd,
1204 SECKEYPublicKey **out_public_key, 1192 SECKEYPublicKey **out_public_key,
1205 SECKEYPrivateKey **out_private_key); 1193 SECKEYPrivateKey **out_private_key);
1206 1194
1207 /* SSL_RestartHandshakeAfterChannelIDReq attempts to restart the handshake 1195 /* SSL_RestartHandshakeAfterChannelIDReq attempts to restart the handshake
1208 * after a ChannelID callback returned SECWouldBlock. 1196 * after a ChannelID callback returned SECWouldBlock.
1209 * 1197 *
1210 * This function takes ownership of |channelIDPub| and |channelID|. */ 1198 * This function takes ownership of |channelIDPub| and |channelID|. */
1211 SSL_IMPORT SECStatus SSL_RestartHandshakeAfterChannelIDReq( 1199 SSL_IMPORT SECStatus SSL_RestartHandshakeAfterChannelIDReq(
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1301 * SECSuccess; do not interpret the return value of SSL_AuthCertificateComplete 1289 * SECSuccess; do not interpret the return value of SSL_AuthCertificateComplete
1302 * as an indicator of whether it is OK to continue using the connection. For 1290 * as an indicator of whether it is OK to continue using the connection. For
1303 * example, SSL_AuthCertificateComplete(fd, SEC_ERROR_REVOKED_CERTIFICATE) will 1291 * example, SSL_AuthCertificateComplete(fd, SEC_ERROR_REVOKED_CERTIFICATE) will
1304 * return SECSuccess (normally), but that does not mean that the application 1292 * return SECSuccess (normally), but that does not mean that the application
1305 * should continue using the connection. If the application passes a non-zero 1293 * should continue using the connection. If the application passes a non-zero
1306 * value for second argument (error), or if SSL_AuthCertificateComplete returns 1294 * value for second argument (error), or if SSL_AuthCertificateComplete returns
1307 * anything other than SECSuccess, then the application should close the 1295 * anything other than SECSuccess, then the application should close the
1308 * connection. 1296 * connection.
1309 */ 1297 */
1310 SSL_IMPORT SECStatus SSL_AuthCertificateComplete(PRFileDesc *fd, 1298 SSL_IMPORT SECStatus SSL_AuthCertificateComplete(PRFileDesc *fd,
1311 » » » » » » PRErrorCode error); 1299 PRErrorCode error);
1312 SEC_END_PROTOS 1300 SEC_END_PROTOS
1313 1301
1314 #endif /* __ssl_h_ */ 1302 #endif /* __ssl_h_ */
OLDNEW
« no previous file with comments | « net/third_party/nss/ssl/prelib.c ('k') | net/third_party/nss/ssl/ssl3con.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698