2 * Copyright (c) 2011 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>
38 errSSLRecordInternal
= -10000,
39 errSSLRecordWouldBlock
= -10001,
40 errSSLRecordProtocol
= -10002,
41 errSSLRecordNegotiation
= -10003,
42 errSSLRecordClosedAbort
= -10004,
43 errSSLRecordConnectionRefused
= -10005, /* peer dropped connection before responding */
44 errSSLRecordDecryptionFail
= -10006, /* decryption failure */
45 errSSLRecordBadRecordMac
= -10007, /* bad MAC */
46 errSSLRecordRecordOverflow
= -10008, /* record overflow */
47 errSSLRecordUnexpectedRecord
= -10009, /* unexpected (skipped) record in DTLS */
52 /* This value never appears in the actual protocol */
53 SSL_Version_Undetermined
= 0,
54 /* actual protocol values */
55 SSL_Version_2_0
= 0x0002,
56 SSL_Version_3_0
= 0x0300,
57 TLS_Version_1_0
= 0x0301, /* TLS 1.0 == SSL 3.1 */
58 TLS_Version_1_1
= 0x0302,
59 TLS_Version_1_2
= 0x0303,
60 DTLS_Version_1_0
= 0xfeff,
63 /* FIXME: This enum and the SSLRecord are exposed because they
64 are used at the interface between the Record and Handshake layer.
65 This might not be the best idea */
69 SSL_RecordTypeV3_Smallest
= 20,
70 SSL_RecordTypeChangeCipher
= 20,
71 SSL_RecordTypeAlert
= 21,
72 SSL_RecordTypeHandshake
= 22,
73 SSL_RecordTypeAppData
= 23,
74 SSL_RecordTypeV3_Largest
= 23
79 * This is the buffer type used internally.
90 SSLProtocolVersion protocolVersion
;
96 * We should remove this and use uint64_t all over.
98 typedef uint64_t sslUint64
;
101 /* Opaque reference to a Record Context */
102 typedef void * SSLRecordContextRef
;
106 (*SSLRecordReadFunc
) (SSLRecordContextRef ref
,
110 (*SSLRecordWriteFunc
) (SSLRecordContextRef ref
,
114 (*SSLRecordInitPendingCiphersFunc
) (SSLRecordContextRef ref
,
115 uint16_t selectedCipher
,
120 (*SSLRecordAdvanceWriteCipherFunc
) (SSLRecordContextRef ref
);
123 (*SSLRecordRollbackWriteCipherFunc
) (SSLRecordContextRef ref
);
126 (*SSLRecordAdvanceReadCipherFunc
) (SSLRecordContextRef ref
);
129 (*SSLRecordSetProtocolVersionFunc
) (SSLRecordContextRef ref
,
130 SSLProtocolVersion protocolVersion
);
133 (*SSLRecordFreeFunc
) (SSLRecordContextRef ref
,
137 (*SSLRecordServiceWriteQueueFunc
) (SSLRecordContextRef ref
);
140 struct SSLRecordFuncs
141 { SSLRecordReadFunc read
;
142 SSLRecordWriteFunc write
;
143 SSLRecordInitPendingCiphersFunc initPendingCiphers
;
144 SSLRecordAdvanceWriteCipherFunc advanceWriteCipher
;
145 SSLRecordRollbackWriteCipherFunc rollbackWriteCipher
;
146 SSLRecordAdvanceReadCipherFunc advanceReadCipher
;
147 SSLRecordSetProtocolVersionFunc setProtocolVersion
;
148 SSLRecordFreeFunc free
;
149 SSLRecordServiceWriteQueueFunc serviceWriteQueue
;
152 #endif /* _SSLTYPES_H_ */