2 * Copyright (c) 2000-2001 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.
19 /* *********************************************************************
22 SSLRef 3.0 Final -- 11/19/96
24 Copyright (c)1996 by Netscape Communications Corp.
26 By retrieving this software you are bound by the licensing terms
27 disclosed in the file "LICENSE.txt". Please read it, and if you don't
28 accept the terms, delete this software.
30 SSLRef 3.0 was developed by Netscape Communications Corp. of Mountain
31 View, California <http://home.netscape.com/> and Consensus Development
32 Corporation of Berkeley, California <http://www.consensus.com/>.
34 *********************************************************************
36 File: sslhdshk.h SSL Handshake Layer
38 Prototypes, values, and types for the SSL handshake state machine and
39 handshake decoding routines.
41 ****************************************************************** */
44 #define _SSLHDSHK_H_ 72
51 #include "cryptType.h"
59 { SSL_hello_request
= 0,
63 SSL_server_key_exchange
= 12,
64 SSL_certificate_request
= 13,
65 SSL_server_hello_done
= 14,
66 SSL_certificate_verify
= 15,
67 SSL_client_key_exchange
= 16,
69 SSL_MAGIC_no_certificate_alert
= 100
79 SSLUninitialized
= 0, /* only valid within SSLContextAlloc */
80 HandshakeServerUninit
, /* no handshake yet */
81 HandshakeClientUninit
, /* no handshake yet */
84 SSLNoNotifyClose
, /* server disconnected with no
86 /* remainder must be consecutive */
87 HandshakeServerHello
, /* must get server hello; client hello sent */
88 HandshakeServerHelloUnknownVersion
, /* Could get SSL 2 or SSL 3 server hello back */
89 HandshakeKeyExchange
, /* must get key exchange; cipher spec requires it */
90 HandshakeCertificate
, /* may get certificate or certificate request (if no cert request received yet) */
91 HandshakeHelloDone
, /* must get server hello done; after key exchange or fixed DH parameters */
92 HandshakeClientCertificate
, /* must get certificate or no cert alert from client */
93 HandshakeClientKeyExchange
, /* must get client key exchange */
94 HandshakeClientCertVerify
, /* must get certificate verify from client */
95 HandshakeChangeCipherSpec
, /* time to change the cipher spec */
96 HandshakeFinished
, /* must get a finished message in the new cipher spec */
97 HandshakeSSL2ClientMasterKey
,
98 HandshakeSSL2ClientFinished
,
99 HandshakeSSL2ServerHello
,
100 HandshakeSSL2ServerVerify
,
101 HandshakeSSL2ServerFinished
,
102 HandshakeServerReady
, /* ready for I/O; server side */
103 HandshakeClientReady
/* ready for I/O; client side */
107 { SSLHandshakeType type
;
111 #define SSL_Finished_Sender_Server 0x53525652
112 #define SSL_Finished_Sender_Client 0x434C4E54
115 typedef SSLErr (*EncodeMessageFunc
)(SSLRecord
*rec
, SSLContext
*ctx
);
116 SSLErr
SSLProcessHandshakeRecord(SSLRecord rec
, SSLContext
*ctx
);
117 SSLErr
SSLPrepareAndQueueMessage(EncodeMessageFunc msgFunc
, SSLContext
*ctx
);
118 SSLErr
SSLAdvanceHandshake(SSLHandshakeType processed
, SSLContext
*ctx
);
119 SSLErr
SSL3ReceiveSSL2ClientHello(SSLRecord rec
, SSLContext
*ctx
);
122 SSLErr
SSLEncodeChangeCipherSpec(SSLRecord
*rec
, SSLContext
*ctx
);
123 SSLErr
SSLProcessChangeCipherSpec(SSLRecord rec
, SSLContext
*ctx
);
124 SSLErr
SSLDisposeCipherSuite(CipherContext
*cipher
, SSLContext
*ctx
);
127 SSLErr
SSLEncodeCertificate(SSLRecord
*certificate
, SSLContext
*ctx
);
128 SSLErr
SSLProcessCertificate(SSLBuffer message
, SSLContext
*ctx
);
129 SSLErr
SSLEncodeCertificateRequest(SSLRecord
*request
, SSLContext
*ctx
);
130 SSLErr
SSLProcessCertificateRequest(SSLBuffer message
, SSLContext
*ctx
);
131 SSLErr
SSLEncodeCertificateVerify(SSLRecord
*verify
, SSLContext
*ctx
);
132 SSLErr
SSLProcessCertificateVerify(SSLBuffer message
, SSLContext
*ctx
);
135 SSLErr
SSLEncodeServerHello(SSLRecord
*serverHello
, SSLContext
*ctx
);
136 SSLErr
SSLProcessServerHello(SSLBuffer message
, SSLContext
*ctx
);
137 SSLErr
SSLEncodeClientHello(SSLRecord
*clientHello
, SSLContext
*ctx
);
138 SSLErr
SSLProcessClientHello(SSLBuffer message
, SSLContext
*ctx
);
139 SSLErr
SSLInitMessageHashes(SSLContext
*ctx
);
142 SSLErr
SSLEncodeServerKeyExchange(SSLRecord
*keyExch
, SSLContext
*ctx
);
143 SSLErr
SSLProcessServerKeyExchange(SSLBuffer message
, SSLContext
*ctx
);
144 SSLErr
SSLEncodeKeyExchange(SSLRecord
*keyExchange
, SSLContext
*ctx
);
145 SSLErr
SSLProcessKeyExchange(SSLBuffer keyExchange
, SSLContext
*ctx
);
148 SSLErr
SSLEncodeFinishedMessage(SSLRecord
*finished
, SSLContext
*ctx
);
149 SSLErr
SSLProcessFinished(SSLBuffer message
, SSLContext
*ctx
);
150 SSLErr
SSLEncodeServerHelloDone(SSLRecord
*helloDone
, SSLContext
*ctx
);
151 SSLErr
SSLProcessServerHelloDone(SSLBuffer message
, SSLContext
*ctx
);
152 SSLErr
SSLCalculateFinishedMessage(SSLBuffer finished
, SSLBuffer shaMsgState
, SSLBuffer md5MsgState
, UInt32 senderID
, SSLContext
*ctx
);
155 SSLErr
SSLEncodeRSAPremasterSecret(SSLContext
*ctx
);
156 SSLErr
SSLEncodeDHPremasterSecret(SSLContext
*ctx
);
157 SSLErr
SSLCalculateMasterSecret(SSLContext
*ctx
);
158 SSLErr
SSLInitPendingCiphers(SSLContext
*ctx
);
161 SSLErr
ReadyRandom(void *randCtx
, SSLContext
*ctx
);
163 SSLErr
ReadyRandom(SSLRandomCtx
*rsaRandom
, SSLContext
*ctx
);
166 #endif /* _SSLHDSHK_H_ */