1 /* Private header file of libSSL.
2 * Various and sundry protocol constants. DON'T CHANGE THESE. These
3 * values are defined by the SSL 3.0 protocol specification.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 /* $Id: ssl3prot.h,v 1.22 2012/04/25 14:50:12 gerv%gerv.net Exp $ */
10 #ifndef __ssl3proto_h_
11 #define __ssl3proto_h_
13 typedef uint8 SSL3Opaque
;
15 typedef uint16 SSL3ProtocolVersion
;
16 /* version numbers are defined in sslproto.h */
18 typedef uint16 ssl3CipherSuite
;
19 /* The cipher suites are defined in sslproto.h */
21 #define MAX_CERT_TYPES 10
22 #define MAX_COMPRESSION_METHODS 10
23 #define MAX_MAC_LENGTH 64
24 #define MAX_PADDING_LENGTH 64
25 #define MAX_KEY_LENGTH 64
26 #define EXPORT_KEY_LENGTH 5
27 #define SSL3_RANDOM_LENGTH 32
29 #define SSL3_RECORD_HEADER_LENGTH 5
31 /* SSL3_RECORD_HEADER_LENGTH + epoch/sequence_number */
32 #define DTLS_RECORD_HEADER_LENGTH 13
34 #define MAX_FRAGMENT_LENGTH 16384
37 content_change_cipher_spec
= 20,
39 content_handshake
= 22,
40 content_application_data
= 23
45 SSL3ProtocolVersion version
;
52 SSL3ProtocolVersion version
;
59 SSL3Opaque MAC
[MAX_MAC_LENGTH
];
60 } SSL3GenericStreamCipher
;
64 SSL3Opaque MAC
[MAX_MAC_LENGTH
];
65 uint8 padding
[MAX_PADDING_LENGTH
];
67 } SSL3GenericBlockCipher
;
69 typedef enum { change_cipher_spec_choice
= 1 } SSL3ChangeCipherSpecChoice
;
72 SSL3ChangeCipherSpecChoice choice
;
73 } SSL3ChangeCipherSpec
;
75 typedef enum { alert_warning
= 1, alert_fatal
= 2 } SSL3AlertLevel
;
79 unexpected_message
= 10,
81 decryption_failed_RESERVED
= 21, /* do not send; see RFC 5246 */
82 record_overflow
= 22, /* TLS only */
83 decompression_failure
= 30,
84 handshake_failure
= 40,
85 no_certificate
= 41, /* SSL3 only, NOT TLS */
87 unsupported_certificate
= 43,
88 certificate_revoked
= 44,
89 certificate_expired
= 45,
90 certificate_unknown
= 46,
91 illegal_parameter
= 47,
93 /* All alerts below are TLS only. */
98 export_restriction
= 60,
99 protocol_version
= 70,
100 insufficient_security
= 71,
103 no_renegotiation
= 100,
105 /* Alerts for client hello extensions */
106 unsupported_extension
= 110,
107 certificate_unobtainable
= 111,
108 unrecognized_name
= 112,
109 bad_certificate_status_response
= 113,
110 bad_certificate_hash_value
= 114
112 } SSL3AlertDescription
;
115 SSL3AlertLevel level
;
116 SSL3AlertDescription description
;
123 hello_verify_request
= 3,
124 new_session_ticket
= 4,
126 server_key_exchange
= 12,
127 certificate_request
= 13,
128 server_hello_done
= 14,
129 certificate_verify
= 15,
130 client_key_exchange
= 16,
132 certificate_status
= 22,
134 encrypted_extensions
= 203
142 SSL3Opaque rand
[SSL3_RANDOM_LENGTH
];
151 SSL3ProtocolVersion client_version
;
153 SSL3SessionID session_id
;
154 SECItem cipher_suites
;
156 SSLCompressionMethod compression_methods
[MAX_COMPRESSION_METHODS
];
160 SSL3ProtocolVersion server_version
;
162 SSL3SessionID session_id
;
163 ssl3CipherSuite cipher_suite
;
164 SSLCompressionMethod compression_method
;
171 /* SSL3SignType moved to ssl.h */
173 /* The SSL key exchange method used */
195 } SSL3KeyExchangeAlgorithm
;
200 } SSL3ServerRSAParams
;
206 } SSL3ServerDHParams
;
210 SSL3ServerDHParams dh
;
211 SSL3ServerRSAParams rsa
;
222 SSL3Opaque anonymous
;
223 SSL3Hashes certified
;
225 } SSL3ServerKeyExchange
;
232 ct_RSA_ephemeral_DH
= 5,
233 ct_DSS_ephemeral_DH
= 6,
235 ct_RSA_fixed_ECDH
= 65,
236 ct_ECDSA_fixed_ECDH
= 66
238 } SSL3ClientCertificateType
;
240 typedef SECItem
*SSL3DistinquishedName
;
243 SSL3Opaque client_version
[2];
244 SSL3Opaque random
[46];
245 } SSL3RSAPreMasterSecret
;
247 typedef SECItem SSL3EncryptedPreMasterSecret
;
250 typedef SSL3Opaque SSL3MasterSecret
[48];
252 typedef enum { implicit
, explicit } SSL3PublicValueEncoding
;
259 } SSL3ClientDiffieHellmanPublic
;
263 SSL3EncryptedPreMasterSecret rsa
;
264 SSL3ClientDiffieHellmanPublic diffie_helman
;
266 } SSL3ClientKeyExchange
;
268 typedef SSL3Hashes SSL3PreSignedCertificateVerify
;
270 typedef SECItem SSL3CertificateVerify
;
273 sender_client
= 0x434c4e54,
274 sender_server
= 0x53525652
277 typedef SSL3Hashes SSL3Finished
;
280 SSL3Opaque verify_data
[12];
284 * TLS extension related data structures and constants.
287 /* SessionTicket extension related data structures. */
289 /* NewSessionTicket handshake message. */
291 uint32 received_timestamp
;
292 uint32 ticket_lifetime_hint
;
297 CLIENT_AUTH_ANONYMOUS
= 0,
298 CLIENT_AUTH_CERTIFICATE
= 1
299 } ClientAuthenticationType
;
302 ClientAuthenticationType client_auth_type
;
304 SSL3Opaque
*certificate_list
;
308 #define SESS_TICKET_KEY_NAME_LEN 16
309 #define SESS_TICKET_KEY_NAME_PREFIX "NSS!"
310 #define SESS_TICKET_KEY_NAME_PREFIX_LEN 4
311 #define SESS_TICKET_KEY_VAR_NAME_LEN 12
314 unsigned char *key_name
;
316 SECItem encrypted_state
;
318 } EncryptedSessionTicket
;
320 #define TLS_EX_SESS_TICKET_MAC_LENGTH 32
322 #define TLS_STE_NO_SERVER_NAME -1
324 #endif /* __ssl3proto_h_ */