]> git.saurik.com Git - apple/security.git/blob - SecureTransport/privateInc/SecureTransportPriv.h
Security-163.tar.gz
[apple/security.git] / SecureTransport / privateInc / SecureTransportPriv.h
1 /*
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
3 *
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
8 * using this file.
9 *
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.
16 */
17
18
19 /*
20 File: SecureTransportPriv.h
21
22 Contains: Apple-private exported routines
23
24 Copyright: (c) 1999 by Apple Computer, Inc., all rights reserved.
25
26 */
27
28 #ifndef _SECURE_TRANSPORT_PRIV_H_
29 #define _SECURE_TRANSPORT_PRIV_H_ 1
30
31 #include <Security/SecureTransport.h>
32
33 #include <Security/Security.h>
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /* The size of of client- and server-generated random numbers in hello messages. */
40 #define SSL_CLIENT_SRVR_RAND_SIZE 32
41
42 /* The size of the pre-master and master secrets. */
43 #define SSL_RSA_PREMASTER_SECRET_SIZE 48
44 #define SSL_MASTER_SECRET_SIZE 48
45
46 /*
47 * For the following three functions, *size is the available
48 * buffer size on entry and the actual size of the data returned
49 * on return. The above consts are for convenience.
50 */
51 OSStatus SSLInternalMasterSecret(
52 SSLContextRef context,
53 void *secret, // mallocd by caller, SSL_MASTER_SECRET_SIZE
54 size_t *secretSize); // in/out
55
56 OSStatus SSLInternalServerRandom(
57 SSLContextRef context,
58 void *rand, // mallocd by caller, SSL_CLIENT_SRVR_RAND_SIZE
59 size_t *randSize); // in/out
60
61 OSStatus SSLInternalClientRandom(
62 SSLContextRef context,
63 void *rand, // mallocd by caller, SSL_CLIENT_SRVR_RAND_SIZE
64 size_t *randSize); // in/out
65
66 OSStatus SSLInternal_PRF(
67 SSLContextRef context,
68 const void *secret,
69 size_t secretLen,
70 const void *label,
71 size_t labelLen,
72 const void *seed,
73 size_t seedLen,
74 void *out, // mallocd by caller, length >= outLen
75 size_t outLen);
76
77 /*
78 * Obtain a SecTrustRef representing peer certificates. Valid anytime,
79 * subsequent to a handshake attempt. The returned SecTrustRef is valid
80 * only as long as the SSLContextRef is.
81 */
82 OSStatus
83 SSLGetPeerSecTrust (SSLContextRef context,
84 SecTrustRef *secTrust); /* RETURNED */
85
86 /*
87 * Obtain resumable session info. Can be called anytime subsequent to
88 * handshake attempt.
89 *
90 * if sessionWasResumed is True on return, the session is indeed a
91 * resumed session; the sessionID (an opaque blob generated by the
92 * server) is returned in *sessionID. The length of the sessionID
93 * is returned in *sessionIDLength. Caller must allocate the
94 * sessionID buffer; it max size is MAX_SESSION_ID_LENGTH bytes.
95 */
96 #define MAX_SESSION_ID_LENGTH 32
97
98 OSStatus
99 SSLGetResumableSessionInfo (
100 SSLContextRef context,
101 Boolean *sessionWasResumed, // RETURNED
102 void *sessionID, // RETURNED, mallocd by caller
103 size_t *sessionIDLength); // IN/OUT
104
105 #ifdef __cplusplus
106 }
107 #endif
108
109 #endif /* _SECURE_TRANSPORT_PRIV_H_ */