2 * Copyright (c) 2011-2012,2014 Apple Inc. All Rights Reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 * sslTypes.h - internal ssl types
28 /* This header should be kernel compatible */
31 #define _SSLTYPES_H_ 1
35 #include <sys/types.h>
37 #include <tls_types.h>
40 errSSLRecordInternal
= -10000,
41 errSSLRecordWouldBlock
= -10001,
42 errSSLRecordProtocol
= -10002,
43 errSSLRecordNegotiation
= -10003,
44 errSSLRecordClosedAbort
= -10004,
45 errSSLRecordConnectionRefused
= -10005, /* peer dropped connection before responding */
46 errSSLRecordDecryptionFail
= -10006, /* decryption failure */
47 errSSLRecordBadRecordMac
= -10007, /* bad MAC */
48 errSSLRecordRecordOverflow
= -10008, /* record overflow */
49 errSSLRecordUnexpectedRecord
= -10009, /* unexpected (skipped) record in DTLS */
54 /* This value never appears in the actual protocol */
55 SSL_Version_Undetermined
= 0,
56 /* actual protocol values */
57 SSL_Version_2_0
= 0x0002,
58 SSL_Version_3_0
= 0x0300,
59 TLS_Version_1_0
= 0x0301, /* TLS 1.0 == SSL 3.1 */
60 TLS_Version_1_1
= 0x0302,
61 TLS_Version_1_2
= 0x0303,
62 DTLS_Version_1_0
= 0xfeff,
65 /* FIXME: This enum and the SSLRecord are exposed because they
66 are used at the interface between the Record and Handshake layer.
67 This might not be the best idea */
71 SSL_RecordTypeV3_Smallest
= 20,
72 SSL_RecordTypeChangeCipher
= 20,
73 SSL_RecordTypeAlert
= 21,
74 SSL_RecordTypeHandshake
= 22,
75 SSL_RecordTypeAppData
= 23,
76 SSL_RecordTypeV3_Largest
= 23
81 kSSLRecordOptionSendOneByteRecord
= 0,
85 * This is the buffer type used internally.
87 typedef tls_buffer SSLBuffer
;
99 SSLProtocolVersion protocolVersion
;
105 * We should remove this and use uint64_t all over.
107 typedef uint64_t sslUint64
;
110 /* Opaque reference to a Record Context */
111 typedef void * SSLRecordContextRef
;
115 (*SSLRecordReadFunc
) (SSLRecordContextRef ref
,
119 (*SSLRecordWriteFunc
) (SSLRecordContextRef ref
,
123 (*SSLRecordInitPendingCiphersFunc
) (SSLRecordContextRef ref
,
124 uint16_t selectedCipher
,
129 (*SSLRecordAdvanceWriteCipherFunc
) (SSLRecordContextRef ref
);
132 (*SSLRecordRollbackWriteCipherFunc
) (SSLRecordContextRef ref
);
135 (*SSLRecordAdvanceReadCipherFunc
) (SSLRecordContextRef ref
);
138 (*SSLRecordSetProtocolVersionFunc
) (SSLRecordContextRef ref
,
139 SSLProtocolVersion protocolVersion
);
142 (*SSLRecordFreeFunc
) (SSLRecordContextRef ref
,
146 (*SSLRecordServiceWriteQueueFunc
) (SSLRecordContextRef ref
);
149 (*SSLRecordSetOptionFunc
) (SSLRecordContextRef ref
,
150 SSLRecordOption option
,
153 struct SSLRecordFuncs
155 SSLRecordReadFunc read
;
156 SSLRecordWriteFunc write
;
157 SSLRecordInitPendingCiphersFunc initPendingCiphers
;
158 SSLRecordAdvanceWriteCipherFunc advanceWriteCipher
;
159 SSLRecordRollbackWriteCipherFunc rollbackWriteCipher
;
160 SSLRecordAdvanceReadCipherFunc advanceReadCipher
;
161 SSLRecordSetProtocolVersionFunc setProtocolVersion
;
162 SSLRecordFreeFunc free
;
163 SSLRecordServiceWriteQueueFunc serviceWriteQueue
;
164 SSLRecordSetOptionFunc setOption
;
167 #endif /* _SSLTYPES_H_ */