1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5  * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 
7 #ifndef libssl_internals_h_
8 #define libssl_internals_h_
9 
10 #include <stdint.h>
11 
12 #include "prio.h"
13 #include "seccomon.h"
14 #include "ssl.h"
15 #include "sslimpl.h"
16 #include "sslt.h"
17 
18 SECStatus SSLInt_IncrementClientHandshakeVersion(PRFileDesc *fd);
19 
20 SECStatus SSLInt_UpdateSSLv2ClientRandom(PRFileDesc *fd, uint8_t *rnd,
21                                          size_t rnd_len, uint8_t *msg,
22                                          size_t msg_len);
23 
24 PRBool SSLInt_ExtensionNegotiated(PRFileDesc *fd, PRUint16 ext);
25 void SSLInt_ClearSelfEncryptKey();
26 void SSLInt_SetSelfEncryptMacKey(PK11SymKey *key);
27 PRInt32 SSLInt_CountCipherSpecs(PRFileDesc *fd);
28 void SSLInt_PrintCipherSpecs(const char *label, PRFileDesc *fd);
29 SECStatus SSLInt_ShiftDtlsTimers(PRFileDesc *fd, PRIntervalTime shift);
30 SECStatus SSLInt_SetMTU(PRFileDesc *fd, PRUint16 mtu);
31 PRBool SSLInt_CheckSecretsDestroyed(PRFileDesc *fd);
32 PRBool SSLInt_DamageClientHsTrafficSecret(PRFileDesc *fd);
33 PRBool SSLInt_DamageServerHsTrafficSecret(PRFileDesc *fd);
34 PRBool SSLInt_DamageEarlyTrafficSecret(PRFileDesc *fd);
35 SECStatus SSLInt_Set0RttAlpn(PRFileDesc *fd, PRUint8 *data, unsigned int len);
36 PRBool SSLInt_HasCertWithAuthType(PRFileDesc *fd, SSLAuthType authType);
37 PRBool SSLInt_SendAlert(PRFileDesc *fd, uint8_t level, uint8_t type);
38 SECStatus SSLInt_AdvanceWriteSeqNum(PRFileDesc *fd, PRUint64 to);
39 SECStatus SSLInt_AdvanceReadSeqNum(PRFileDesc *fd, PRUint64 to);
40 SECStatus SSLInt_AdvanceWriteSeqByAWindow(PRFileDesc *fd, PRInt32 extra);
41 SSLKEAType SSLInt_GetKEAType(SSLNamedGroup group);
42 SECStatus SSLInt_GetEpochs(PRFileDesc *fd, PRUint16 *readEpoch,
43                            PRUint16 *writeEpoch);
44 
45 SECStatus SSLInt_SetCipherSpecChangeFunc(PRFileDesc *fd,
46                                          sslCipherSpecChangedFunc func,
47                                          void *arg);
48 PRUint16 SSLInt_CipherSpecToEpoch(const ssl3CipherSpec *spec);
49 PK11SymKey *SSLInt_CipherSpecToKey(const ssl3CipherSpec *spec);
50 SSLCipherAlgorithm SSLInt_CipherSpecToAlgorithm(const ssl3CipherSpec *spec);
51 const PRUint8 *SSLInt_CipherSpecToIv(const ssl3CipherSpec *spec);
52 void SSLInt_SetTicketLifetime(uint32_t lifetime);
53 SECStatus SSLInt_SetSocketMaxEarlyDataSize(PRFileDesc *fd, uint32_t size);
54 void SSLInt_RolloverAntiReplay(void);
55 
56 #endif  // ndef libssl_internals_h_
57