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/. */
10 #define __ssl3proto_h_
12 typedef PRUint8 SSL3Opaque;
14 typedef PRUint16 SSL3ProtocolVersion;
15 /* version numbers are defined in sslproto.h */
17 typedef PRUint16 ssl3CipherSuite;
18 /* The cipher suites are defined in sslproto.h */
20 #define MAX_CERT_TYPES 10
21 #define MAX_COMPRESSION_METHODS 10
22 #define MAX_MAC_LENGTH 64
23 #define MAX_PADDING_LENGTH 64
24 #define MAX_KEY_LENGTH 64
25 #define EXPORT_KEY_LENGTH 5
26 #define SSL3_RANDOM_LENGTH 32
28 #define SSL3_RECORD_HEADER_LENGTH 5
30 /* SSL3_RECORD_HEADER_LENGTH + epoch/sequence_number */
31 #define DTLS_RECORD_HEADER_LENGTH 13
33 #define MAX_FRAGMENT_LENGTH 16384
36 content_change_cipher_spec = 20,
38 content_handshake = 22,
39 content_application_data = 23
44 SSL3ProtocolVersion version;
51 SSL3ProtocolVersion version;
58 SSL3Opaque MAC[MAX_MAC_LENGTH];
59 } SSL3GenericStreamCipher;
63 SSL3Opaque MAC[MAX_MAC_LENGTH];
64 PRUint8 padding[MAX_PADDING_LENGTH];
65 PRUint8 padding_length;
66 } SSL3GenericBlockCipher;
68 typedef enum { change_cipher_spec_choice = 1 } SSL3ChangeCipherSpecChoice;
71 SSL3ChangeCipherSpecChoice choice;
72 } SSL3ChangeCipherSpec;
74 typedef enum { alert_warning = 1, alert_fatal = 2 } SSL3AlertLevel;
78 unexpected_message = 10,
80 decryption_failed_RESERVED = 21, /* do not send; see RFC 5246 */
81 record_overflow = 22, /* TLS only */
82 decompression_failure = 30,
83 handshake_failure = 40,
84 no_certificate = 41, /* SSL3 only, NOT TLS */
86 unsupported_certificate = 43,
87 certificate_revoked = 44,
88 certificate_expired = 45,
89 certificate_unknown = 46,
90 illegal_parameter = 47,
92 /* All alerts below are TLS only. */
97 export_restriction = 60,
98 protocol_version = 70,
99 insufficient_security = 71,
102 no_renegotiation = 100,
104 /* Alerts for client hello extensions */
105 unsupported_extension = 110,
106 certificate_unobtainable = 111,
107 unrecognized_name = 112,
108 bad_certificate_status_response = 113,
109 bad_certificate_hash_value = 114
111 } SSL3AlertDescription;
114 SSL3AlertLevel level;
115 SSL3AlertDescription description;
122 hello_verify_request = 3,
123 new_session_ticket = 4,
125 server_key_exchange = 12,
126 certificate_request = 13,
127 server_hello_done = 14,
128 certificate_verify = 15,
129 client_key_exchange = 16,
131 certificate_status = 22,
133 encrypted_extensions= 203
141 SSL3Opaque rand[SSL3_RANDOM_LENGTH];
150 SSL3ProtocolVersion client_version;
152 SSL3SessionID session_id;
153 SECItem cipher_suites;
155 SSLCompressionMethod compression_methods[MAX_COMPRESSION_METHODS];
159 SSL3ProtocolVersion server_version;
161 SSL3SessionID session_id;
162 ssl3CipherSuite cipher_suite;
163 SSLCompressionMethod compression_method;
170 /* SSL3SignType moved to ssl.h */
172 /* The SSL key exchange method used */
194 } SSL3KeyExchangeAlgorithm;
199 } SSL3ServerRSAParams;
205 } SSL3ServerDHParams;
209 SSL3ServerDHParams dh;
210 SSL3ServerRSAParams rsa;
214 /* This enum reflects HashAlgorithm enum from
215 * https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1
217 * When updating, be sure to also update ssl3_TLSHashAlgorithmToOID. */
227 /* This enum reflects SignatureAlgorithm enum from
228 * https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1 */
233 } TLSSignatureAlgorithm;
237 TLSSignatureAlgorithm sigAlg;
238 } SSL3SignatureAndHashAlgorithm;
240 /* SSL3HashesIndividually contains a combination MD5/SHA1 hash, as used in TLS
245 } SSL3HashesIndividually;
247 /* SSL3Hashes contains an SSL hash value. The digest is contained in |u.raw|
248 * which, if |hashAlg==SEC_OID_UNKNOWN| is also a SSL3HashesIndividually
255 SSL3HashesIndividually s;
261 SSL3Opaque anonymous;
262 SSL3Hashes certified;
264 } SSL3ServerKeyExchange;
271 ct_RSA_ephemeral_DH = 5,
272 ct_DSS_ephemeral_DH = 6,
274 ct_RSA_fixed_ECDH = 65,
275 ct_ECDSA_fixed_ECDH = 66
277 } SSL3ClientCertificateType;
279 typedef SECItem *SSL3DistinquishedName;
282 SSL3Opaque client_version[2];
283 SSL3Opaque random[46];
284 } SSL3RSAPreMasterSecret;
286 typedef SECItem SSL3EncryptedPreMasterSecret;
289 typedef SSL3Opaque SSL3MasterSecret[48];
291 typedef enum { implicit, explicit } SSL3PublicValueEncoding;
298 } SSL3ClientDiffieHellmanPublic;
302 SSL3EncryptedPreMasterSecret rsa;
303 SSL3ClientDiffieHellmanPublic diffie_helman;
305 } SSL3ClientKeyExchange;
307 typedef SSL3Hashes SSL3PreSignedCertificateVerify;
309 typedef SECItem SSL3CertificateVerify;
312 sender_client = 0x434c4e54,
313 sender_server = 0x53525652
316 typedef SSL3HashesIndividually SSL3Finished;
319 SSL3Opaque verify_data[12];
323 * TLS extension related data structures and constants.
326 /* SessionTicket extension related data structures. */
328 /* NewSessionTicket handshake message. */
330 PRUint32 received_timestamp;
331 PRUint32 ticket_lifetime_hint;
336 CLIENT_AUTH_ANONYMOUS = 0,
337 CLIENT_AUTH_CERTIFICATE = 1
338 } ClientAuthenticationType;
341 ClientAuthenticationType client_auth_type;
343 SSL3Opaque *certificate_list;
347 #define SESS_TICKET_KEY_NAME_LEN 16
348 #define SESS_TICKET_KEY_NAME_PREFIX "NSS!"
349 #define SESS_TICKET_KEY_NAME_PREFIX_LEN 4
350 #define SESS_TICKET_KEY_VAR_NAME_LEN 12
353 unsigned char *key_name;
355 SECItem encrypted_state;
357 } EncryptedSessionTicket;
359 #define TLS_EX_SESS_TICKET_MAC_LENGTH 32
361 #define TLS_STE_NO_SERVER_NAME -1
363 #endif /* __ssl3proto_h_ */