]> git.saurik.com Git - apple/security.git/blob - libsecurity_ssl/lib/tls_ssl.h
Security-55471.14.tar.gz
[apple/security.git] / libsecurity_ssl / lib / tls_ssl.h
1 /*
2 * Copyright (c) 2002,2005-2007,2010-2012 Apple Inc. All Rights Reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
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
11 * file.
12 *
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.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24 /*
25 * tls_ssl.h - Declarations of handshake layer callout struct to provide indirect calls to
26 * SSLv3 and TLS routines.
27 */
28
29 #ifndef _TLS_SSL_H_
30 #define _TLS_SSL_H_
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 #include "ssl.h"
37 #include "sslPriv.h"
38 #include "sslContext.h"
39 #include "sslRecord.h"
40
41 /***
42 *** Each of {TLS, SSLv3} implements each of these functions.
43 ***/
44
45 typedef OSStatus (*generateKeyMaterialFcn) (
46 SSLBuffer key, // caller mallocs and specifies length of
47 // required key material here
48 SSLContext *ctx);
49
50 typedef OSStatus (*generateExportKeyAndIvFcn) (
51 SSLContext *ctx, // clientRandom, serverRandom valid
52 const SSLBuffer clientWriteKey,
53 const SSLBuffer serverWriteKey,
54 SSLBuffer finalClientWriteKey, // RETURNED, mallocd by caller
55 SSLBuffer finalServerWriteKey, // RETURNED, mallocd by caller
56 SSLBuffer finalClientIV, // RETURNED, mallocd by caller
57 SSLBuffer finalServerIV); // RETURNED, mallocd by caller
58
59 /*
60 * On entry: clientRandom, serverRandom, preMasterSecret valid
61 * On return: masterSecret valid
62 */
63 typedef OSStatus (*generateMasterSecretFcn) (
64 SSLContext *ctx);
65
66 typedef OSStatus (*computeFinishedMacFcn) (
67 SSLContext *ctx,
68 SSLBuffer finished, // output - mallocd by caller
69 Boolean isServer);
70
71 typedef OSStatus (*computeCertVfyMacFcn) (
72 SSLContext *ctx,
73 SSLBuffer *finished, // output - mallocd by caller
74 SSL_HashAlgorithm hash); //only used in TLS 1.2
75
76
77 typedef struct _SslTlsCallouts {
78 generateKeyMaterialFcn generateKeyMaterial;
79 generateMasterSecretFcn generateMasterSecret;
80 computeFinishedMacFcn computeFinishedMac;
81 computeCertVfyMacFcn computeCertVfyMac;
82 } SslTlsCallouts;
83
84
85 /* From ssl3Callouts.c and tls1Callouts.c */
86 extern const SslTlsCallouts Ssl3Callouts;
87 extern const SslTlsCallouts Tls1Callouts;
88 extern const SslTlsCallouts Tls12Callouts;
89
90 #ifdef __cplusplus
91 }
92 #endif
93
94 #endif /* _TLS_SSL_H_ */