Revert "Merged all Chromoting Host code into remoting_core.dll (Windows)."
[chromium-blink-merge.git] / net / third_party / nss / ssl / ssl.h
blob8a669d1086561fe0b83ffaff195142fbca233184
1 /*
2 * This file contains prototypes for the public SSL functions.
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
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 /* $Id: ssl.h,v 1.59 2012/09/21 21:58:43 wtc%google.com Exp $ */
9 #ifndef __ssl_h_
10 #define __ssl_h_
12 #include "prtypes.h"
13 #include "prerror.h"
14 #include "prio.h"
15 #include "seccomon.h"
16 #include "cert.h"
17 #include "keyt.h"
19 #include "sslt.h" /* public ssl data types */
21 #if defined(_WIN32) && !defined(IN_LIBSSL) && !defined(NSS_USE_STATIC_LIBS)
22 #define SSL_IMPORT extern __declspec(dllimport)
23 #else
24 #define SSL_IMPORT extern
25 #endif
27 SEC_BEGIN_PROTOS
29 /* constant table enumerating all implemented SSL 2 and 3 cipher suites. */
30 SSL_IMPORT const PRUint16 SSL_ImplementedCiphers[];
32 /* the same as the above, but is a function */
33 SSL_IMPORT const PRUint16 *SSL_GetImplementedCiphers(void);
35 /* number of entries in the above table. */
36 SSL_IMPORT const PRUint16 SSL_NumImplementedCiphers;
38 /* the same as the above, but is a function */
39 SSL_IMPORT PRUint16 SSL_GetNumImplementedCiphers(void);
41 /* Macro to tell which ciphers in table are SSL2 vs SSL3/TLS. */
42 #define SSL_IS_SSL2_CIPHER(which) (((which) & 0xfff0) == 0xff00)
45 ** Imports fd into SSL, returning a new socket. Copies SSL configuration
46 ** from model.
48 SSL_IMPORT PRFileDesc *SSL_ImportFD(PRFileDesc *model, PRFileDesc *fd);
51 ** Imports fd into DTLS, returning a new socket. Copies DTLS configuration
52 ** from model.
54 SSL_IMPORT PRFileDesc *DTLS_ImportFD(PRFileDesc *model, PRFileDesc *fd);
57 ** Enable/disable an ssl mode
59 ** SSL_SECURITY:
60 ** enable/disable use of SSL security protocol before connect
62 ** SSL_SOCKS:
63 ** enable/disable use of socks before connect
64 ** (No longer supported).
66 ** SSL_REQUEST_CERTIFICATE:
67 ** require a certificate during secure connect
69 /* options */
70 #define SSL_SECURITY 1 /* (on by default) */
71 #define SSL_SOCKS 2 /* (off by default) */
72 #define SSL_REQUEST_CERTIFICATE 3 /* (off by default) */
73 #define SSL_HANDSHAKE_AS_CLIENT 5 /* force accept to hs as client */
74 /* (off by default) */
75 #define SSL_HANDSHAKE_AS_SERVER 6 /* force connect to hs as server */
76 /* (off by default) */
78 /* OBSOLETE: SSL v2 is obsolete and may be removed soon. */
79 #define SSL_ENABLE_SSL2 7 /* enable ssl v2 (off by default) */
81 /* OBSOLETE: See "SSL Version Range API" below for the replacement and a
82 ** description of the non-obvious semantics of using SSL_ENABLE_SSL3.
84 #define SSL_ENABLE_SSL3 8 /* enable ssl v3 (on by default) */
86 #define SSL_NO_CACHE 9 /* don't use the session cache */
87 /* (off by default) */
88 #define SSL_REQUIRE_CERTIFICATE 10 /* (SSL_REQUIRE_FIRST_HANDSHAKE */
89 /* by default) */
90 #define SSL_ENABLE_FDX 11 /* permit simultaneous read/write */
91 /* (off by default) */
93 /* OBSOLETE: SSL v2 compatible hellos are not accepted by some TLS servers
94 ** and cannot negotiate extensions. SSL v2 is obsolete. This option may be
95 ** removed soon.
97 #define SSL_V2_COMPATIBLE_HELLO 12 /* send v3 client hello in v2 fmt */
98 /* (off by default) */
100 /* OBSOLETE: See "SSL Version Range API" below for the replacement and a
101 ** description of the non-obvious semantics of using SSL_ENABLE_TLS.
103 #define SSL_ENABLE_TLS 13 /* enable TLS (on by default) */
105 #define SSL_ROLLBACK_DETECTION 14 /* for compatibility, default: on */
106 #define SSL_NO_STEP_DOWN 15 /* Disable export cipher suites */
107 /* if step-down keys are needed. */
108 /* default: off, generate */
109 /* step-down keys if needed. */
110 #define SSL_BYPASS_PKCS11 16 /* use PKCS#11 for pub key only */
111 #define SSL_NO_LOCKS 17 /* Don't use locks for protection */
112 #define SSL_ENABLE_SESSION_TICKETS 18 /* Enable TLS SessionTicket */
113 /* extension (off by default) */
114 #define SSL_ENABLE_DEFLATE 19 /* Enable TLS compression with */
115 /* DEFLATE (off by default) */
116 #define SSL_ENABLE_RENEGOTIATION 20 /* Values below (default: never) */
117 #define SSL_REQUIRE_SAFE_NEGOTIATION 21 /* Peer must send Signaling */
118 /* Cipher Suite Value (SCSV) or */
119 /* Renegotiation Info (RI) */
120 /* extension in ALL handshakes. */
121 /* default: off */
122 #define SSL_ENABLE_FALSE_START 22 /* Enable SSL false start (off by */
123 /* default, applies only to */
124 /* clients). False start is a */
125 /* mode where an SSL client will start sending application data before */
126 /* verifying the server's Finished message. This means that we could end up */
127 /* sending data to an imposter. However, the data will be encrypted and */
128 /* only the true server can derive the session key. Thus, so long as the */
129 /* cipher isn't broken this is safe. Because of this, False Start will only */
130 /* occur on RSA or DH ciphersuites where the cipher's key length is >= 80 */
131 /* bits. The advantage of False Start is that it saves a round trip for */
132 /* client-speaks-first protocols when performing a full handshake. */
134 /* For SSL 3.0 and TLS 1.0, by default we prevent chosen plaintext attacks
135 * on SSL CBC mode cipher suites (see RFC 4346 Section F.3) by splitting
136 * non-empty application_data records into two records; the first record has
137 * only the first byte of plaintext, and the second has the rest.
139 * This only prevents the attack in the sending direction; the connection may
140 * still be vulnerable to such attacks if the peer does not implement a similar
141 * countermeasure.
143 * This protection mechanism is on by default; the default can be overridden by
144 * setting NSS_SSL_CBC_RANDOM_IV=0 in the environment prior to execution,
145 * and/or by the application setting the option SSL_CBC_RANDOM_IV to PR_FALSE.
147 * The per-record IV in TLS 1.1 and later adds one block of overhead per
148 * record, whereas this hack will add at least two blocks of overhead per
149 * record, so TLS 1.1+ will always be more efficient.
151 * Other implementations (e.g. some versions of OpenSSL, in some
152 * configurations) prevent the same attack by prepending an empty
153 * application_data record to every application_data record they send; we do
154 * not do that because some implementations cannot handle empty
155 * application_data records. Also, we only split application_data records and
156 * not other types of records, because some implementations will not accept
157 * fragmented records of some other types (e.g. some versions of NSS do not
158 * accept fragmented alerts).
160 #define SSL_CBC_RANDOM_IV 23
161 #define SSL_ENABLE_OCSP_STAPLING 24 /* Request OCSP stapling (client) */
163 #ifdef SSL_DEPRECATED_FUNCTION
164 /* Old deprecated function names */
165 SSL_IMPORT SECStatus SSL_Enable(PRFileDesc *fd, int option, PRBool on);
166 SSL_IMPORT SECStatus SSL_EnableDefault(int option, PRBool on);
167 #endif
169 /* New function names */
170 SSL_IMPORT SECStatus SSL_OptionSet(PRFileDesc *fd, PRInt32 option, PRBool on);
171 SSL_IMPORT SECStatus SSL_OptionGet(PRFileDesc *fd, PRInt32 option, PRBool *on);
172 SSL_IMPORT SECStatus SSL_OptionSetDefault(PRInt32 option, PRBool on);
173 SSL_IMPORT SECStatus SSL_OptionGetDefault(PRInt32 option, PRBool *on);
174 SSL_IMPORT SECStatus SSL_CertDBHandleSet(PRFileDesc *fd, CERTCertDBHandle *dbHandle);
176 /* SSLNextProtoCallback is called during the handshake for the client, when a
177 * Next Protocol Negotiation (NPN) extension has been received from the server.
178 * |protos| and |protosLen| define a buffer which contains the server's
179 * advertisement. This data is guaranteed to be well formed per the NPN spec.
180 * |protoOut| is a buffer provided by the caller, of length 255 (the maximum
181 * allowed by the protocol). On successful return, the protocol to be announced
182 * to the server will be in |protoOut| and its length in |*protoOutLen|.
184 * The callback must return SECFailure or SECSuccess (not SECWouldBlock).
186 typedef SECStatus (PR_CALLBACK *SSLNextProtoCallback)(
187 void *arg,
188 PRFileDesc *fd,
189 const unsigned char* protos,
190 unsigned int protosLen,
191 unsigned char* protoOut,
192 unsigned int* protoOutLen,
193 unsigned int protoMaxOut);
195 /* SSL_SetNextProtoCallback sets a callback function to handle Next Protocol
196 * Negotiation. It causes a client to advertise NPN. */
197 SSL_IMPORT SECStatus SSL_SetNextProtoCallback(PRFileDesc *fd,
198 SSLNextProtoCallback callback,
199 void *arg);
201 /* SSL_SetNextProtoNego can be used as an alternative to
202 * SSL_SetNextProtoCallback. It also causes a client to advertise NPN and
203 * installs a default callback function which selects the first supported
204 * protocol in server-preference order. If no matching protocol is found it
205 * selects the first supported protocol.
207 * The supported protocols are specified in |data| in wire-format (8-bit
208 * length-prefixed). For example: "\010http/1.1\006spdy/2". */
209 SSL_IMPORT SECStatus SSL_SetNextProtoNego(PRFileDesc *fd,
210 const unsigned char *data,
211 unsigned int length);
213 typedef enum SSLNextProtoState {
214 SSL_NEXT_PROTO_NO_SUPPORT = 0, /* No peer support */
215 SSL_NEXT_PROTO_NEGOTIATED = 1, /* Mutual agreement */
216 SSL_NEXT_PROTO_NO_OVERLAP = 2 /* No protocol overlap found */
217 } SSLNextProtoState;
219 /* SSL_GetNextProto can be used in the HandshakeCallback or any time after
220 * a handshake to retrieve the result of the Next Protocol negotiation.
222 * The length of the negotiated protocol, if any, is written into *bufLen.
223 * If the negotiated protocol is longer than bufLenMax, then SECFailure is
224 * returned. Otherwise, the negotiated protocol, if any, is written into buf,
225 * and SECSuccess is returned. */
226 SSL_IMPORT SECStatus SSL_GetNextProto(PRFileDesc *fd,
227 SSLNextProtoState *state,
228 unsigned char *buf,
229 unsigned int *bufLen,
230 unsigned int bufLenMax);
233 ** Control ciphers that SSL uses. If on is non-zero then the named cipher
234 ** is enabled, otherwise it is disabled.
235 ** The "cipher" values are defined in sslproto.h (the SSL_EN_* values).
236 ** EnableCipher records user preferences.
237 ** SetPolicy sets the policy according to the policy module.
239 #ifdef SSL_DEPRECATED_FUNCTION
240 /* Old deprecated function names */
241 SSL_IMPORT SECStatus SSL_EnableCipher(long which, PRBool enabled);
242 SSL_IMPORT SECStatus SSL_SetPolicy(long which, int policy);
243 #endif
245 /* New function names */
246 SSL_IMPORT SECStatus SSL_CipherPrefSet(PRFileDesc *fd, PRInt32 cipher, PRBool enabled);
247 SSL_IMPORT SECStatus SSL_CipherPrefGet(PRFileDesc *fd, PRInt32 cipher, PRBool *enabled);
248 SSL_IMPORT SECStatus SSL_CipherPrefSetDefault(PRInt32 cipher, PRBool enabled);
249 SSL_IMPORT SECStatus SSL_CipherPrefGetDefault(PRInt32 cipher, PRBool *enabled);
250 SSL_IMPORT SECStatus SSL_CipherPolicySet(PRInt32 cipher, PRInt32 policy);
251 SSL_IMPORT SECStatus SSL_CipherPolicyGet(PRInt32 cipher, PRInt32 *policy);
253 /* SSLChannelBindingType enumerates the types of supported channel binding
254 * values. See RFC 5929. */
255 typedef enum SSLChannelBindingType {
256 SSL_CHANNEL_BINDING_TLS_UNIQUE = 1,
257 } SSLChannelBindingType;
259 /* SSL_GetChannelBinding copies the requested channel binding value, as defined
260 * in RFC 5929, into |out|. The full length of the binding value is written
261 * into |*outLen|.
263 * At most |outLenMax| bytes of data are copied. If |outLenMax| is
264 * insufficient then the function returns SECFailure and sets the error to
265 * SEC_ERROR_OUTPUT_LEN, but |*outLen| is still set.
267 * This call will fail if made during a renegotiation. */
268 SSL_IMPORT SECStatus SSL_GetChannelBinding(PRFileDesc *fd,
269 SSLChannelBindingType binding_type,
270 unsigned char *out,
271 unsigned int *outLen,
272 unsigned int outLenMax);
274 /* SSL Version Range API
276 ** This API should be used to control SSL 3.0 & TLS support instead of the
277 ** older SSL_Option* API; however, the SSL_Option* API MUST still be used to
278 ** control SSL 2.0 support. In this version of libssl, SSL 3.0 and TLS 1.0 are
279 ** enabled by default. Future versions of libssl may change which versions of
280 ** the protocol are enabled by default.
282 ** The SSLProtocolVariant enum indicates whether the protocol is of type
283 ** stream or datagram. This must be provided to the functions that do not
284 ** take an fd. Functions which take an fd will get the variant from the fd,
285 ** which is typed.
287 ** Using the new version range API in conjunction with the older
288 ** SSL_OptionSet-based API for controlling the enabled protocol versions may
289 ** cause unexpected results. Going forward, we guarantee only the following:
291 ** SSL_OptionGet(SSL_ENABLE_TLS) will return PR_TRUE if *ANY* versions of TLS
292 ** are enabled.
294 ** SSL_OptionSet(SSL_ENABLE_TLS, PR_FALSE) will disable *ALL* versions of TLS,
295 ** including TLS 1.0 and later.
297 ** The above two properties provide compatibility for applications that use
298 ** SSL_OptionSet to implement the insecure fallback from TLS 1.x to SSL 3.0.
300 ** SSL_OptionSet(SSL_ENABLE_TLS, PR_TRUE) will enable TLS 1.0, and may also
301 ** enable some later versions of TLS, if it is necessary to do so in order to
302 ** keep the set of enabled versions contiguous. For example, if TLS 1.2 is
303 ** enabled, then after SSL_OptionSet(SSL_ENABLE_TLS, PR_TRUE), TLS 1.0,
304 ** TLS 1.1, and TLS 1.2 will be enabled, and the call will have no effect on
305 ** whether SSL 3.0 is enabled. If no later versions of TLS are enabled at the
306 ** time SSL_OptionSet(SSL_ENABLE_TLS, PR_TRUE) is called, then no later
307 ** versions of TLS will be enabled by the call.
309 ** SSL_OptionSet(SSL_ENABLE_SSL3, PR_FALSE) will disable SSL 3.0, and will not
310 ** change the set of TLS versions that are enabled.
312 ** SSL_OptionSet(SSL_ENABLE_SSL3, PR_TRUE) will enable SSL 3.0, and may also
313 ** enable some versions of TLS if TLS 1.1 or later is enabled at the time of
314 ** the call, the same way SSL_OptionSet(SSL_ENABLE_TLS, PR_TRUE) works, in
315 ** order to keep the set of enabled versions contiguous.
318 /* Returns, in |*vrange|, the range of SSL3/TLS versions supported for the
319 ** given protocol variant by the version of libssl linked-to at runtime.
321 SSL_IMPORT SECStatus SSL_VersionRangeGetSupported(
322 SSLProtocolVariant protocolVariant, SSLVersionRange *vrange);
324 /* Returns, in |*vrange|, the range of SSL3/TLS versions enabled by default
325 ** for the given protocol variant.
327 SSL_IMPORT SECStatus SSL_VersionRangeGetDefault(
328 SSLProtocolVariant protocolVariant, SSLVersionRange *vrange);
330 /* Sets the range of enabled-by-default SSL3/TLS versions for the given
331 ** protocol variant to |*vrange|.
333 SSL_IMPORT SECStatus SSL_VersionRangeSetDefault(
334 SSLProtocolVariant protocolVariant, const SSLVersionRange *vrange);
336 /* Returns, in |*vrange|, the range of enabled SSL3/TLS versions for |fd|. */
337 SSL_IMPORT SECStatus SSL_VersionRangeGet(PRFileDesc *fd,
338 SSLVersionRange *vrange);
340 /* Sets the range of enabled SSL3/TLS versions for |fd| to |*vrange|. */
341 SSL_IMPORT SECStatus SSL_VersionRangeSet(PRFileDesc *fd,
342 const SSLVersionRange *vrange);
345 /* Values for "policy" argument to SSL_PolicySet */
346 /* Values returned by SSL_CipherPolicyGet. */
347 #define SSL_NOT_ALLOWED 0 /* or invalid or unimplemented */
348 #define SSL_ALLOWED 1
349 #define SSL_RESTRICTED 2 /* only with "Step-Up" certs. */
351 /* Values for "on" with SSL_REQUIRE_CERTIFICATE. */
352 #define SSL_REQUIRE_NEVER ((PRBool)0)
353 #define SSL_REQUIRE_ALWAYS ((PRBool)1)
354 #define SSL_REQUIRE_FIRST_HANDSHAKE ((PRBool)2)
355 #define SSL_REQUIRE_NO_ERROR ((PRBool)3)
357 /* Values for "on" with SSL_ENABLE_RENEGOTIATION */
358 /* Never renegotiate at all. */
359 #define SSL_RENEGOTIATE_NEVER ((PRBool)0)
360 /* Renegotiate without restriction, whether or not the peer's client hello */
361 /* bears the renegotiation info extension. Vulnerable, as in the past. */
362 #define SSL_RENEGOTIATE_UNRESTRICTED ((PRBool)1)
363 /* Only renegotiate if the peer's hello bears the TLS renegotiation_info */
364 /* extension. This is safe renegotiation. */
365 #define SSL_RENEGOTIATE_REQUIRES_XTN ((PRBool)2)
366 /* Disallow unsafe renegotiation in server sockets only, but allow clients */
367 /* to continue to renegotiate with vulnerable servers. */
368 /* This value should only be used during the transition period when few */
369 /* servers have been upgraded. */
370 #define SSL_RENEGOTIATE_TRANSITIONAL ((PRBool)3)
373 ** Reset the handshake state for fd. This will make the complete SSL
374 ** handshake protocol execute from the ground up on the next i/o
375 ** operation.
377 SSL_IMPORT SECStatus SSL_ResetHandshake(PRFileDesc *fd, PRBool asServer);
380 ** Force the handshake for fd to complete immediately. This blocks until
381 ** the complete SSL handshake protocol is finished.
383 SSL_IMPORT SECStatus SSL_ForceHandshake(PRFileDesc *fd);
386 ** Same as above, but with an I/O timeout.
388 SSL_IMPORT SECStatus SSL_ForceHandshakeWithTimeout(PRFileDesc *fd,
389 PRIntervalTime timeout);
391 SSL_IMPORT SECStatus SSL_RestartHandshakeAfterCertReq(PRFileDesc *fd,
392 CERTCertificate *cert,
393 SECKEYPrivateKey *key,
394 CERTCertificateList *certChain);
397 ** Query security status of socket. *on is set to one if security is
398 ** enabled. *keySize will contain the stream key size used. *issuer will
399 ** contain the RFC1485 verison of the name of the issuer of the
400 ** certificate at the other end of the connection. For a client, this is
401 ** the issuer of the server's certificate; for a server, this is the
402 ** issuer of the client's certificate (if any). Subject is the subject of
403 ** the other end's certificate. The pointers can be zero if the desired
404 ** data is not needed. All strings returned by this function are owned
405 ** by the caller, and need to be freed with PORT_Free.
407 SSL_IMPORT SECStatus SSL_SecurityStatus(PRFileDesc *fd, int *on, char **cipher,
408 int *keySize, int *secretKeySize,
409 char **issuer, char **subject);
411 /* Values for "on" */
412 #define SSL_SECURITY_STATUS_NOOPT -1
413 #define SSL_SECURITY_STATUS_OFF 0
414 #define SSL_SECURITY_STATUS_ON_HIGH 1
415 #define SSL_SECURITY_STATUS_ON_LOW 2
416 #define SSL_SECURITY_STATUS_FORTEZZA 3 /* NO LONGER SUPPORTED */
419 ** Return the certificate for our SSL peer. If the client calls this
420 ** it will always return the server's certificate. If the server calls
421 ** this, it may return NULL if client authentication is not enabled or
422 ** if the client had no certificate when asked.
423 ** "fd" the socket "file" descriptor
425 SSL_IMPORT CERTCertificate *SSL_PeerCertificate(PRFileDesc *fd);
428 ** Return references to the certificates presented by the SSL peer.
429 ** |maxNumCerts| must contain the size of the |certs| array. On successful
430 ** return, |*numCerts| contains the number of certificates available and
431 ** |certs| will contain references to as many certificates as would fit.
432 ** Therefore if |*numCerts| contains a value less than or equal to
433 ** |maxNumCerts|, then all certificates were returned.
435 SSL_IMPORT SECStatus SSL_PeerCertificateChain(
436 PRFileDesc *fd, CERTCertificate **certs,
437 unsigned int *numCerts, unsigned int maxNumCerts);
439 /* SSL_GetStapledOCSPResponse returns the OCSP response that was provided by
440 * the TLS server. The resulting data is copied to |out_data|. On entry, |*len|
441 * must contain the size of |out_data|. On exit, |*len| will contain the size
442 * of the OCSP stapled response. If the stapled response is too large to fit in
443 * |out_data| then it will be truncated. If no OCSP response was given by the
444 * server then it has zero length.
446 * You must set the SSL_ENABLE_OCSP_STAPLING option in order for OCSP responses
447 * to be provided by a server.
449 * You can call this function during the certificate verification callback or
450 * any time afterwards.
452 SSL_IMPORT SECStatus SSL_GetStapledOCSPResponse(PRFileDesc *fd,
453 unsigned char *out_data,
454 unsigned int *len);
457 ** Authenticate certificate hook. Called when a certificate comes in
458 ** (because of SSL_REQUIRE_CERTIFICATE in SSL_Enable) to authenticate the
459 ** certificate.
461 ** The authenticate certificate hook must return SECSuccess to indicate the
462 ** certificate is valid, SECFailure to indicate the certificate is invalid,
463 ** or SECWouldBlock if the application will authenticate the certificate
464 ** asynchronously. SECWouldBlock is only supported for non-blocking sockets.
466 ** If the authenticate certificate hook returns SECFailure, then the bad cert
467 ** hook will be called. The bad cert handler is NEVER called if the
468 ** authenticate certificate hook returns SECWouldBlock. If the application
469 ** needs to handle and/or override a bad cert, it should do so before it
470 ** calls SSL_AuthCertificateComplete (modifying the error it passes to
471 ** SSL_AuthCertificateComplete as needed).
473 ** See the documentation for SSL_AuthCertificateComplete for more information
474 ** about the asynchronous behavior that occurs when the authenticate
475 ** certificate hook returns SECWouldBlock.
477 typedef SECStatus (PR_CALLBACK *SSLAuthCertificate)(void *arg, PRFileDesc *fd,
478 PRBool checkSig,
479 PRBool isServer);
481 SSL_IMPORT SECStatus SSL_AuthCertificateHook(PRFileDesc *fd,
482 SSLAuthCertificate f,
483 void *arg);
485 /* An implementation of the certificate authentication hook */
486 SSL_IMPORT SECStatus SSL_AuthCertificate(void *arg, PRFileDesc *fd,
487 PRBool checkSig, PRBool isServer);
490 * Prototype for SSL callback to get client auth data from the application.
491 * arg - application passed argument
492 * caNames - pointer to distinguished names of CAs that the server likes
493 * pRetCert - pointer to pointer to cert, for return of cert
494 * pRetKey - pointer to key pointer, for return of key
496 typedef SECStatus (PR_CALLBACK *SSLGetClientAuthData)(void *arg,
497 PRFileDesc *fd,
498 CERTDistNames *caNames,
499 CERTCertificate **pRetCert,/*return */
500 SECKEYPrivateKey **pRetKey);/* return */
503 * Set the client side callback for SSL to retrieve user's private key
504 * and certificate.
505 * fd - the file descriptor for the connection in question
506 * f - the application's callback that delivers the key and cert
507 * a - application specific data
509 SSL_IMPORT SECStatus SSL_GetClientAuthDataHook(PRFileDesc *fd,
510 SSLGetClientAuthData f, void *a);
513 * Prototype for SSL callback to get client auth data from the application,
514 * optionally using the underlying platform's cryptographic primitives.
515 * To use the platform cryptographic primitives, caNames and pRetCerts
516 * should be set. To use NSS, pRetNSSCert and pRetNSSKey should be set.
517 * Returning SECFailure will cause the socket to send no client certificate.
518 * arg - application passed argument
519 * caNames - pointer to distinguished names of CAs that the server likes
520 * pRetCerts - pointer to pointer to list of certs, with the first being
521 * the client cert, and any following being used for chain
522 * building
523 * pRetKey - pointer to native key pointer, for return of key
524 * - Windows: A pointer to a PCERT_KEY_CONTEXT that was allocated
525 * via PORT_Alloc(). Ownership of the PCERT_KEY_CONTEXT
526 * is transferred to NSS, which will free via
527 * PORT_Free().
528 * - Mac OS X: A pointer to a SecKeyRef. Ownership is
529 * transferred to NSS, which will free via CFRelease().
530 * pRetNSSCert - pointer to pointer to NSS cert, for return of cert.
531 * pRetNSSKey - pointer to NSS key pointer, for return of key.
533 typedef SECStatus (PR_CALLBACK *SSLGetPlatformClientAuthData)(void *arg,
534 PRFileDesc *fd,
535 CERTDistNames *caNames,
536 CERTCertList **pRetCerts,/*return */
537 void **pRetKey,/* return */
538 CERTCertificate **pRetNSSCert,/*return */
539 SECKEYPrivateKey **pRetNSSKey);/* return */
542 * Set the client side callback for SSL to retrieve user's private key
543 * and certificate.
544 * Note: If a platform client auth callback is set, the callback configured by
545 * SSL_GetClientAuthDataHook, if any, will not be called.
547 * fd - the file descriptor for the connection in question
548 * f - the application's callback that delivers the key and cert
549 * a - application specific data
551 SSL_IMPORT SECStatus
552 SSL_GetPlatformClientAuthDataHook(PRFileDesc *fd,
553 SSLGetPlatformClientAuthData f, void *a);
556 ** SNI extension processing callback function.
557 ** It is called when SSL socket receives SNI extension in ClientHello message.
558 ** Upon this callback invocation, application is responsible to reconfigure the
559 ** socket with the data for a particular server name.
560 ** There are three potential outcomes of this function invocation:
561 ** * application does not recognize the name or the type and wants the
562 ** "unrecognized_name" alert be sent to the client. In this case the callback
563 ** function must return SSL_SNI_SEND_ALERT status.
564 ** * application does not recognize the name, but wants to continue with
565 ** the handshake using the current socket configuration. In this case,
566 ** no socket reconfiguration is needed and the function should return
567 ** SSL_SNI_CURRENT_CONFIG_IS_USED.
568 ** * application recognizes the name and reconfigures the socket with
569 ** appropriate certs, key, etc. There are many ways to reconfigure. NSS
570 ** provides SSL_ReconfigFD function that can be used to update the socket
571 ** data from model socket. To continue with the rest of the handshake, the
572 ** implementation function should return an index of a name it has chosen.
573 ** LibSSL will ignore any SNI extension received in a ClientHello message
574 ** if application does not register a SSLSNISocketConfig callback.
575 ** Each type field of SECItem indicates the name type.
576 ** NOTE: currently RFC3546 defines only one name type: sni_host_name.
577 ** Client is allowed to send only one name per known type. LibSSL will
578 ** send an "unrecognized_name" alert if SNI extension name list contains more
579 ** then one name of a type.
581 typedef PRInt32 (PR_CALLBACK *SSLSNISocketConfig)(PRFileDesc *fd,
582 const SECItem *srvNameArr,
583 PRUint32 srvNameArrSize,
584 void *arg);
587 ** SSLSNISocketConfig should return an index within 0 and srvNameArrSize-1
588 ** when it has reconfigured the socket fd to use certs and keys, etc
589 ** for a specific name. There are two other allowed return values. One
590 ** tells libSSL to use the default cert and key. The other tells libSSL
591 ** to send the "unrecognized_name" alert. These values are:
593 #define SSL_SNI_CURRENT_CONFIG_IS_USED -1
594 #define SSL_SNI_SEND_ALERT -2
597 ** Set application implemented SNISocketConfig callback.
599 SSL_IMPORT SECStatus SSL_SNISocketConfigHook(PRFileDesc *fd,
600 SSLSNISocketConfig f,
601 void *arg);
604 ** Reconfigure fd SSL socket with model socket parameters. Sets
605 ** server certs and keys, list of trust anchor, socket options
606 ** and all SSL socket call backs and parameters.
608 SSL_IMPORT PRFileDesc *SSL_ReconfigFD(PRFileDesc *model, PRFileDesc *fd);
611 * Set the client side argument for SSL to retrieve PKCS #11 pin.
612 * fd - the file descriptor for the connection in question
613 * a - pkcs11 application specific data
615 SSL_IMPORT SECStatus SSL_SetPKCS11PinArg(PRFileDesc *fd, void *a);
618 ** This is a callback for dealing with server certs that are not authenticated
619 ** by the client. The client app can decide that it actually likes the
620 ** cert by some external means and restart the connection.
622 ** The bad cert hook must return SECSuccess to override the result of the
623 ** authenticate certificate hook, SECFailure if the certificate should still be
624 ** considered invalid, or SECWouldBlock if the application will authenticate
625 ** the certificate asynchronously. SECWouldBlock is only supported for
626 ** non-blocking sockets.
628 ** See the documentation for SSL_AuthCertificateComplete for more information
629 ** about the asynchronous behavior that occurs when the bad cert hook returns
630 ** SECWouldBlock.
632 typedef SECStatus (PR_CALLBACK *SSLBadCertHandler)(void *arg, PRFileDesc *fd);
633 SSL_IMPORT SECStatus SSL_BadCertHook(PRFileDesc *fd, SSLBadCertHandler f,
634 void *arg);
637 ** Configure SSL socket for running a secure server. Needs the
638 ** certificate for the server and the servers private key. The arguments
639 ** are copied.
641 SSL_IMPORT SECStatus SSL_ConfigSecureServer(
642 PRFileDesc *fd, CERTCertificate *cert,
643 SECKEYPrivateKey *key, SSLKEAType kea);
646 ** Allows SSL socket configuration with caller-supplied certificate chain.
647 ** If certChainOpt is NULL, tries to find one.
649 SSL_IMPORT SECStatus
650 SSL_ConfigSecureServerWithCertChain(PRFileDesc *fd, CERTCertificate *cert,
651 const CERTCertificateList *certChainOpt,
652 SECKEYPrivateKey *key, SSLKEAType kea);
655 ** Configure a secure server's session-id cache. Define the maximum number
656 ** of entries in the cache, the longevity of the entires, and the directory
657 ** where the cache files will be placed. These values can be zero, and
658 ** if so, the implementation will choose defaults.
659 ** This version of the function is for use in applications that have only one
660 ** process that uses the cache (even if that process has multiple threads).
662 SSL_IMPORT SECStatus SSL_ConfigServerSessionIDCache(int maxCacheEntries,
663 PRUint32 timeout,
664 PRUint32 ssl3_timeout,
665 const char * directory);
667 /* Configure a secure server's session-id cache. Depends on value of
668 * enableMPCache, configures malti-proc or single proc cache. */
669 SSL_IMPORT SECStatus SSL_ConfigServerSessionIDCacheWithOpt(
670 PRUint32 timeout,
671 PRUint32 ssl3_timeout,
672 const char * directory,
673 int maxCacheEntries,
674 int maxCertCacheEntries,
675 int maxSrvNameCacheEntries,
676 PRBool enableMPCache);
679 ** Like SSL_ConfigServerSessionIDCache, with one important difference.
680 ** If the application will run multiple processes (as opposed to, or in
681 ** addition to multiple threads), then it must call this function, instead
682 ** of calling SSL_ConfigServerSessionIDCache().
683 ** This has nothing to do with the number of processORs, only processEs.
684 ** This function sets up a Server Session ID (SID) cache that is safe for
685 ** access by multiple processes on the same system.
687 SSL_IMPORT SECStatus SSL_ConfigMPServerSIDCache(int maxCacheEntries,
688 PRUint32 timeout,
689 PRUint32 ssl3_timeout,
690 const char * directory);
692 /* Get and set the configured maximum number of mutexes used for the
693 ** server's store of SSL sessions. This value is used by the server
694 ** session ID cache initialization functions shown above. Note that on
695 ** some platforms, these mutexes are actually implemented with POSIX
696 ** semaphores, or with unnamed pipes. The default value varies by platform.
697 ** An attempt to set a too-low maximum will return an error and the
698 ** configured value will not be changed.
700 SSL_IMPORT PRUint32 SSL_GetMaxServerCacheLocks(void);
701 SSL_IMPORT SECStatus SSL_SetMaxServerCacheLocks(PRUint32 maxLocks);
703 /* environment variable set by SSL_ConfigMPServerSIDCache, and queried by
704 * SSL_InheritMPServerSIDCache when envString is NULL.
706 #define SSL_ENV_VAR_NAME "SSL_INHERITANCE"
708 /* called in child to inherit SID Cache variables.
709 * If envString is NULL, this function will use the value of the environment
710 * variable "SSL_INHERITANCE", otherwise the string value passed in will be
711 * used.
713 SSL_IMPORT SECStatus SSL_InheritMPServerSIDCache(const char * envString);
716 ** Set the callback on a particular socket that gets called when we finish
717 ** performing a handshake.
719 typedef void (PR_CALLBACK *SSLHandshakeCallback)(PRFileDesc *fd,
720 void *client_data);
721 SSL_IMPORT SECStatus SSL_HandshakeCallback(PRFileDesc *fd,
722 SSLHandshakeCallback cb, void *client_data);
725 ** For the server, request a new handshake. For the client, begin a new
726 ** handshake. If flushCache is non-zero, the SSL3 cache entry will be
727 ** flushed first, ensuring that a full SSL handshake will be done.
728 ** If flushCache is zero, and an SSL connection is established, it will
729 ** do the much faster session restart handshake. This will change the
730 ** session keys without doing another private key operation.
732 SSL_IMPORT SECStatus SSL_ReHandshake(PRFileDesc *fd, PRBool flushCache);
735 ** Same as above, but with an I/O timeout.
737 SSL_IMPORT SECStatus SSL_ReHandshakeWithTimeout(PRFileDesc *fd,
738 PRBool flushCache,
739 PRIntervalTime timeout);
741 /* Returns a SECItem containing the certificate_types field of the
742 ** CertificateRequest message. Each byte of the data is a TLS
743 ** ClientCertificateType value, and they are ordered from most preferred to
744 ** least. This function should only be called from the
745 ** SSL_GetClientAuthDataHook callback, and will return NULL if called at any
746 ** other time. The returned value is valid only until the callback returns, and
747 ** should not be freed.
749 SSL_IMPORT const SECItem *
750 SSL_GetRequestedClientCertificateTypes(PRFileDesc *fd);
752 #ifdef SSL_DEPRECATED_FUNCTION
753 /* deprecated!
754 ** For the server, request a new handshake. For the client, begin a new
755 ** handshake. Flushes SSL3 session cache entry first, ensuring that a
756 ** full handshake will be done.
757 ** This call is equivalent to SSL_ReHandshake(fd, PR_TRUE)
759 SSL_IMPORT SECStatus SSL_RedoHandshake(PRFileDesc *fd);
760 #endif
763 * Allow the application to pass a URL or hostname into the SSL library.
765 SSL_IMPORT SECStatus SSL_SetURL(PRFileDesc *fd, const char *url);
768 * Allow an application to define a set of trust anchors for peer
769 * cert validation.
771 SSL_IMPORT SECStatus SSL_SetTrustAnchors(PRFileDesc *fd, CERTCertList *list);
774 ** Return the number of bytes that SSL has waiting in internal buffers.
775 ** Return 0 if security is not enabled.
777 SSL_IMPORT int SSL_DataPending(PRFileDesc *fd);
780 ** Invalidate the SSL session associated with fd.
782 SSL_IMPORT SECStatus SSL_InvalidateSession(PRFileDesc *fd);
785 ** Return a SECItem containing the SSL session ID associated with the fd.
787 SSL_IMPORT SECItem *SSL_GetSessionID(PRFileDesc *fd);
790 ** Clear out the client's SSL session cache, not the server's session cache.
792 SSL_IMPORT void SSL_ClearSessionCache(void);
795 ** Close the server's SSL session cache.
797 SSL_IMPORT SECStatus SSL_ShutdownServerSessionIDCache(void);
800 ** Set peer information so we can correctly look up SSL session later.
801 ** You only have to do this if you're tunneling through a proxy.
803 SSL_IMPORT SECStatus SSL_SetSockPeerID(PRFileDesc *fd, const char *peerID);
806 ** Reveal the security information for the peer.
808 SSL_IMPORT CERTCertificate * SSL_RevealCert(PRFileDesc * socket);
809 SSL_IMPORT void * SSL_RevealPinArg(PRFileDesc * socket);
810 SSL_IMPORT char * SSL_RevealURL(PRFileDesc * socket);
812 /* This callback may be passed to the SSL library via a call to
813 * SSL_GetClientAuthDataHook() for each SSL client socket.
814 * It will be invoked when SSL needs to know what certificate and private key
815 * (if any) to use to respond to a request for client authentication.
816 * If arg is non-NULL, it is a pointer to a NULL-terminated string containing
817 * the nickname of the cert/key pair to use.
818 * If arg is NULL, this function will search the cert and key databases for
819 * a suitable match and send it if one is found.
821 SSL_IMPORT SECStatus
822 NSS_GetClientAuthData(void * arg,
823 PRFileDesc * socket,
824 struct CERTDistNamesStr * caNames,
825 struct CERTCertificateStr ** pRetCert,
826 struct SECKEYPrivateKeyStr **pRetKey);
829 ** Configure DTLS-SRTP (RFC 5764) cipher suite preferences.
830 ** Input is a list of ciphers in descending preference order and a length
831 ** of the list. As a side effect, this causes the use_srtp extension to be
832 ** negotiated.
834 ** Invalid or unimplemented cipher suites in |ciphers| are ignored. If at
835 ** least one cipher suite in |ciphers| is implemented, returns SECSuccess.
836 ** Otherwise returns SECFailure.
838 SSL_IMPORT SECStatus SSL_SetSRTPCiphers(PRFileDesc *fd,
839 const PRUint16 *ciphers,
840 unsigned int numCiphers);
843 ** Get the selected DTLS-SRTP cipher suite (if any).
844 ** To be called after the handshake completes.
845 ** Returns SECFailure if not negotiated.
847 SSL_IMPORT SECStatus SSL_GetSRTPCipher(PRFileDesc *fd,
848 PRUint16 *cipher);
851 * Look to see if any of the signers in the cert chain for "cert" are found
852 * in the list of caNames.
853 * Returns SECSuccess if so, SECFailure if not.
854 * Used by NSS_GetClientAuthData. May be used by other callback functions.
856 SSL_IMPORT SECStatus NSS_CmpCertChainWCANames(CERTCertificate *cert,
857 CERTDistNames *caNames);
860 * Returns key exchange type of the keys in an SSL server certificate.
862 SSL_IMPORT SSLKEAType NSS_FindCertKEAType(CERTCertificate * cert);
864 /* Set cipher policies to a predefined Domestic (U.S.A.) policy.
865 * This essentially enables all supported ciphers.
867 SSL_IMPORT SECStatus NSS_SetDomesticPolicy(void);
869 /* Set cipher policies to a predefined Policy that is exportable from the USA
870 * according to present U.S. policies as we understand them.
871 * See documentation for the list.
872 * Note that your particular application program may be able to obtain
873 * an export license with more or fewer capabilities than those allowed
874 * by this function. In that case, you should use SSL_SetPolicy()
875 * to explicitly allow those ciphers you may legally export.
877 SSL_IMPORT SECStatus NSS_SetExportPolicy(void);
879 /* Set cipher policies to a predefined Policy that is exportable from the USA
880 * according to present U.S. policies as we understand them, and that the
881 * nation of France will permit to be imported into their country.
882 * See documentation for the list.
884 SSL_IMPORT SECStatus NSS_SetFrancePolicy(void);
886 SSL_IMPORT SSL3Statistics * SSL_GetStatistics(void);
888 /* Report more information than SSL_SecurityStatus.
889 ** Caller supplies the info struct. Function fills it in.
891 SSL_IMPORT SECStatus SSL_GetChannelInfo(PRFileDesc *fd, SSLChannelInfo *info,
892 PRUintn len);
893 SSL_IMPORT SECStatus SSL_GetCipherSuiteInfo(PRUint16 cipherSuite,
894 SSLCipherSuiteInfo *info, PRUintn len);
896 /* Returnes negotiated through SNI host info. */
897 SSL_IMPORT SECItem *SSL_GetNegotiatedHostInfo(PRFileDesc *fd);
899 /* Export keying material according to RFC 5705.
900 ** fd must correspond to a TLS 1.0 or higher socket and out must
901 ** already be allocated. If hasContext is false, it uses the no-context
902 ** construction from the RFC and ignores the context and contextLen
903 ** arguments.
905 SSL_IMPORT SECStatus SSL_ExportKeyingMaterial(PRFileDesc *fd,
906 const char *label,
907 unsigned int labelLen,
908 PRBool hasContext,
909 const unsigned char *context,
910 unsigned int contextLen,
911 unsigned char *out,
912 unsigned int outLen);
915 ** Return a new reference to the certificate that was most recently sent
916 ** to the peer on this SSL/TLS connection, or NULL if none has been sent.
918 SSL_IMPORT CERTCertificate * SSL_LocalCertificate(PRFileDesc *fd);
920 /* Test an SSL configuration to see if SSL_BYPASS_PKCS11 can be turned on.
921 ** Check the key exchange algorithm for each cipher in the list to see if
922 ** a master secret key can be extracted after being derived with the mechanism
923 ** required by the protocolmask argument. If the KEA will use keys from the
924 ** specified cert make sure the extract operation is attempted from the slot
925 ** where the private key resides.
926 ** If MS can be extracted for all ciphers, (*pcanbypass) is set to TRUE and
927 ** SECSuccess is returned. In all other cases but one (*pcanbypass) is
928 ** set to FALSE and SECFailure is returned.
929 ** In that last case Derive() has been called successfully but the MS is null,
930 ** CanBypass sets (*pcanbypass) to FALSE and returns SECSuccess indicating the
931 ** arguments were all valid but the slot cannot be bypassed.
933 ** Note: A TRUE return code from CanBypass means "Your configuration will perform
934 ** NO WORSE with the bypass enabled than without"; it does NOT mean that every
935 ** cipher suite listed will work properly with the selected protocols.
937 ** Caveat: If export cipher suites are included in the argument list Canbypass
938 ** will return FALSE.
941 /* protocol mask bits */
942 #define SSL_CBP_SSL3 0x0001 /* test SSL v3 mechanisms */
943 #define SSL_CBP_TLS1_0 0x0002 /* test TLS v1.0 mechanisms */
945 SSL_IMPORT SECStatus SSL_CanBypass(CERTCertificate *cert,
946 SECKEYPrivateKey *privKey,
947 PRUint32 protocolmask,
948 PRUint16 *ciphers, int nciphers,
949 PRBool *pcanbypass, void *pwArg);
952 ** Did the handshake with the peer negotiate the given extension?
953 ** Output parameter valid only if function returns SECSuccess
955 SSL_IMPORT SECStatus SSL_HandshakeNegotiatedExtension(PRFileDesc * socket,
956 SSLExtensionType extId,
957 PRBool *yes);
959 SSL_IMPORT SECStatus SSL_HandshakeResumedSession(PRFileDesc *fd,
960 PRBool *last_handshake_resumed);
962 /* See SSL_SetClientChannelIDCallback for usage. If the callback returns
963 * SECWouldBlock then SSL_RestartHandshakeAfterChannelIDReq should be called in
964 * the future to restart the handshake. On SECSuccess, the callback must have
965 * written a P-256, EC key pair to |*out_public_key| and |*out_private_key|. */
966 typedef SECStatus (PR_CALLBACK *SSLClientChannelIDCallback)(
967 void *arg,
968 PRFileDesc *fd,
969 SECKEYPublicKey **out_public_key,
970 SECKEYPrivateKey **out_private_key);
972 /* SSL_RestartHandshakeAfterChannelIDReq attempts to restart the handshake
973 * after a ChannelID callback returned SECWouldBlock.
975 * This function takes ownership of |channelIDPub| and |channelID|. */
976 SSL_IMPORT SECStatus SSL_RestartHandshakeAfterChannelIDReq(
977 PRFileDesc *fd,
978 SECKEYPublicKey *channelIDPub,
979 SECKEYPrivateKey *channelID);
981 /* SSL_SetClientChannelIDCallback sets a callback function that will be called
982 * once the server's ServerHello has been processed. This is only applicable to
983 * a client socket and setting this callback causes the TLS Channel ID
984 * extension to be advertised. */
985 SSL_IMPORT SECStatus SSL_SetClientChannelIDCallback(
986 PRFileDesc *fd,
987 SSLClientChannelIDCallback callback,
988 void *arg);
991 ** How long should we wait before retransmitting the next flight of
992 ** the DTLS handshake? Returns SECFailure if not DTLS or not in a
993 ** handshake.
995 SSL_IMPORT SECStatus DTLS_GetHandshakeTimeout(PRFileDesc *socket,
996 PRIntervalTime *timeout);
999 * Return a boolean that indicates whether the underlying library
1000 * will perform as the caller expects.
1002 * The only argument is a string, which should be the version
1003 * identifier of the NSS library. That string will be compared
1004 * against a string that represents the actual build version of
1005 * the SSL library.
1007 extern PRBool NSSSSL_VersionCheck(const char *importedVersion);
1010 * Returns a const string of the SSL library version.
1012 extern const char *NSSSSL_GetVersion(void);
1014 /* Restart an SSL connection that was paused to do asynchronous certificate
1015 * chain validation (when the auth certificate hook or bad cert handler
1016 * returned SECWouldBlock).
1018 * This function only works for non-blocking sockets; Do not use it for
1019 * blocking sockets. Currently, this function works only for the client role of
1020 * a connection; it does not work for the server role.
1022 * The application must call SSL_AuthCertificateComplete with 0 as the value of
1023 * the error parameter after it has successfully validated the peer's
1024 * certificate, in order to continue the SSL handshake.
1026 * The application may call SSL_AuthCertificateComplete with a non-zero value
1027 * for error (e.g. SEC_ERROR_REVOKED_CERTIFICATE) when certificate validation
1028 * fails, before it closes the connection. If the application does so, an
1029 * alert corresponding to the error (e.g. certificate_revoked) will be sent to
1030 * the peer. See the source code of the internal function
1031 * ssl3_SendAlertForCertError for the current mapping of error to alert. This
1032 * mapping may change in future versions of libssl.
1034 * This function will not complete the entire handshake. The application must
1035 * call SSL_ForceHandshake, PR_Recv, PR_Send, etc. after calling this function
1036 * to force the handshake to complete.
1038 * On the first handshake of a connection, libssl will wait for the peer's
1039 * certificate to be authenticated before calling the handshake callback,
1040 * sending a client certificate, sending any application data, or returning
1041 * any application data to the application. On subsequent (renegotiation)
1042 * handshakes, libssl will block the handshake unconditionally while the
1043 * certificate is being validated.
1045 * libssl may send and receive handshake messages while waiting for the
1046 * application to call SSL_AuthCertificateComplete, and it may call other
1047 * callbacks (e.g, the client auth data hook) before
1048 * SSL_AuthCertificateComplete has been called.
1050 * An application that uses this asynchronous mechanism will usually have lower
1051 * handshake latency if it has to do public key operations on the certificate
1052 * chain and/or CRL/OCSP/cert fetching during the authentication, especially if
1053 * it does so in parallel on another thread. However, if the application can
1054 * authenticate the peer's certificate quickly then it may be more efficient
1055 * to use the synchronous mechanism (i.e. returning SECFailure/SECSuccess
1056 * instead of SECWouldBlock from the authenticate certificate hook).
1058 * Be careful about converting an application from synchronous cert validation
1059 * to asynchronous certificate validation. A naive conversion is likely to
1060 * result in deadlocks; e.g. the application will wait in PR_Poll for network
1061 * I/O on the connection while all network I/O on the connection is blocked
1062 * waiting for this function to be called.
1064 * Returns SECFailure on failure, SECSuccess on success. Never returns
1065 * SECWouldBlock. Note that SSL_AuthCertificateComplete will (usually) return
1066 * SECSuccess; do not interpret the return value of SSL_AuthCertificateComplete
1067 * as an indicator of whether it is OK to continue using the connection. For
1068 * example, SSL_AuthCertificateComplete(fd, SEC_ERROR_REVOKED_CERTIFICATE) will
1069 * return SECSuccess (normally), but that does not mean that the application
1070 * should continue using the connection. If the application passes a non-zero
1071 * value for second argument (error), or if SSL_AuthCertificateComplete returns
1072 * anything other than SECSuccess, then the application should close the
1073 * connection.
1075 SSL_IMPORT SECStatus SSL_AuthCertificateComplete(PRFileDesc *fd,
1076 PRErrorCode error);
1077 SEC_END_PROTOS
1079 #endif /* __ssl_h_ */