]> git.saurik.com Git - apple/security.git/blob - SecureTransport/privateInc/ssl2.h
Security-164.1.tar.gz
[apple/security.git] / SecureTransport / privateInc / ssl2.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: ssl2.h
21
22 Written by: Doug Mitchell
23
24 Copyright: (c) 1999 by Apple Computer, Inc., all rights reserved.
25
26 */
27
28 #ifndef _SSL2_H_
29 #define _SSL2_H_
30
31 #include "SecureTransport.h"
32 #include "sslPriv.h"
33 #include "sslRecord.h"
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 typedef enum {
40 SSL2_MsgError = 0,
41 SSL2_MsgClientHello = 1,
42 SSL2_MsgClientMasterKey = 2,
43 SSL2_MsgClientFinished = 3,
44 SSL2_MsgServerHello = 4,
45 SSL2_MsgServerVerify = 5,
46 SSL2_MsgServerFinished = 6,
47 SSL2_MsgRequestCert = 7,
48 SSL2_MsgClientCert = 8,
49 SSL2_MsgKickstart = 99
50 } SSL2MessageType;
51
52 typedef enum {
53 SSL2_ErrNoCipher = 1,
54 SSL2_ErrNoCert = 2,
55 SSL2_ErrBadCert = 4,
56 SSL2_ErrUnsupportedCert = 6
57 } SSL2ErrorCode;
58
59 typedef enum{
60 SSL2_CertTypeX509 = 1
61 } SSL2CertTypeCode;
62
63 #define SSL2_CONNECTION_ID_LENGTH 16
64
65 typedef OSStatus (*EncodeSSL2MessageFunc)(SSLBuffer &msg, SSLContext *ctx);
66 OSStatus SSL2ReadRecord(SSLRecord &rec, SSLContext *ctx);
67 OSStatus SSL2WriteRecord(SSLRecord &rec, SSLContext *ctx);
68 OSStatus SSL2ProcessMessage(SSLRecord &rec, SSLContext *ctx);
69 OSStatus SSL2SendError(SSL2ErrorCode error, SSLContext *ctx);
70 OSStatus SSL2AdvanceHandshake(SSL2MessageType msg, SSLContext *ctx);
71 OSStatus SSL2PrepareAndQueueMessage(EncodeSSL2MessageFunc encodeFunc, SSLContext *ctx);
72 OSStatus SSL2CompareSessionIDs(SSLContext *ctx);
73 OSStatus SSL2InstallSessionKey(SSLContext *ctx);
74 OSStatus SSL2GenerateSessionID(SSLContext *ctx);
75 OSStatus SSL2InitCiphers(SSLContext *ctx);
76
77 OSStatus SSL2ProcessClientHello(SSLBuffer msgContents, SSLContext *ctx);
78 OSStatus SSL2EncodeClientHello(SSLBuffer &msg, SSLContext *ctx);
79 OSStatus SSL2ProcessClientMasterKey(SSLBuffer msgContents, SSLContext *ctx);
80 OSStatus SSL2EncodeClientMasterKey(SSLBuffer &msg, SSLContext *ctx);
81 OSStatus SSL2ProcessClientFinished(SSLBuffer msgContents, SSLContext *ctx);
82 OSStatus SSL2EncodeClientFinished(SSLBuffer &msg, SSLContext *ctx);
83 OSStatus SSL2ProcessServerHello(SSLBuffer msgContents, SSLContext *ctx);
84 OSStatus SSL2EncodeServerHello(SSLBuffer &msg, SSLContext *ctx);
85 OSStatus SSL2ProcessServerVerify(SSLBuffer msgContents, SSLContext *ctx);
86 OSStatus SSL2EncodeServerVerify(SSLBuffer &msg, SSLContext *ctx);
87 OSStatus SSL2ProcessServerFinished(SSLBuffer msgContents, SSLContext *ctx);
88 OSStatus SSL2EncodeServerFinished(SSLBuffer &msg, SSLContext *ctx);
89
90 #ifdef __cplusplus
91 }
92 #endif
93
94 #endif