2 * Copyright (c) 2002 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
22 Contains: Declarations of callout struct to provide indirect calls to
23 SSLv3 and TLS routines.
25 Written by: Doug Mitchell
37 #include "sslContext.h"
38 #include "sslRecord.h"
39 #include "cryptType.h"
42 *** Each of {TLS, SSLv3} implements each of these functions.
45 /* unpack, decrypt, validate one record */
46 typedef OSStatus (*decryptRecordFcn
) (
51 /* pack, encrypt, mac, queue one outgoing record */
52 typedef OSStatus (*writeRecordFcn
) (
56 /* initialize a per-CipherContext HashHmacContext for use in MACing each record */
57 typedef OSStatus (*initMacFcn
) (
58 CipherContext
*cipherCtx
, // macRef, macSecret valid on entry
59 // macCtx valid on return
62 /* free per-CipherContext HashHmacContext */
63 typedef OSStatus (*freeMacFcn
) (
64 CipherContext
*cipherCtx
);
66 /* compute MAC on one record */
67 typedef OSStatus (*computeMacFcn
) (
70 SSLBuffer mac
, // caller mallocs data
71 CipherContext
*cipherCtx
, // assumes macCtx, macRef
75 typedef OSStatus (*generateKeyMaterialFcn
) (
76 SSLBuffer key
, // caller mallocs and specifies length of
77 // required key material here
80 typedef OSStatus (*generateExportKeyAndIvFcn
) (
81 SSLContext
*ctx
, // clientRandom, serverRandom valid
82 const SSLBuffer clientWriteKey
,
83 const SSLBuffer serverWriteKey
,
84 SSLBuffer finalClientWriteKey
, // RETURNED, mallocd by caller
85 SSLBuffer finalServerWriteKey
, // RETURNED, mallocd by caller
86 SSLBuffer finalClientIV
, // RETURNED, mallocd by caller
87 SSLBuffer finalServerIV
); // RETURNED, mallocd by caller
90 * On entry: clientRandom, serverRandom, preMasterSecret valid
91 * On return: masterSecret valid
93 typedef OSStatus (*generateMasterSecretFcn
) (
96 typedef OSStatus (*computeFinishedMacFcn
) (
98 SSLBuffer finished
, // output - mallocd by caller
99 SSLBuffer shaMsgState
, // clone of running digest of all handshake msgs
100 SSLBuffer md5MsgState
, // ditto
103 typedef OSStatus (*computeCertVfyMacFcn
) (
105 SSLBuffer finished
, // output - mallocd by caller
106 SSLBuffer shaMsgState
, // clone of running digest of all handshake msgs
107 SSLBuffer md5MsgState
); // ditto
109 typedef struct _SslTlsCallouts
{
110 decryptRecordFcn decryptRecord
;
111 writeRecordFcn writeRecord
;
114 computeMacFcn computeMac
;
115 generateKeyMaterialFcn generateKeyMaterial
;
116 generateExportKeyAndIvFcn generateExportKeyAndIv
;
117 generateMasterSecretFcn generateMasterSecret
;
118 computeFinishedMacFcn computeFinishedMac
;
119 computeCertVfyMacFcn computeCertVfyMac
;
122 /* From ssl3Callouts.c and tls1Callouts.c */
123 extern const SslTlsCallouts Ssl3Callouts
;
124 extern const SslTlsCallouts Tls1Callouts
;
126 /* one callout routine used in common (for now) */
127 OSStatus
ssl3WriteRecord(
135 #endif /* _TLS_SSL_H_ */