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,
101 inappropriate_fallback = 86, /* could also be sent for SSLv3 */
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,
111 no_application_protocol = 120
113 } SSL3AlertDescription;
116 SSL3AlertLevel level;
117 SSL3AlertDescription description;
124 hello_verify_request = 3,
125 new_session_ticket = 4,
127 server_key_exchange = 12,
128 certificate_request = 13,
129 server_hello_done = 14,
130 certificate_verify = 15,
131 client_key_exchange = 16,
133 certificate_status = 22,
135 encrypted_extensions= 203
143 SSL3Opaque rand[SSL3_RANDOM_LENGTH];
152 SSL3ProtocolVersion client_version;
154 SSL3SessionID session_id;
155 SECItem cipher_suites;
157 SSLCompressionMethod compression_methods[MAX_COMPRESSION_METHODS];
161 SSL3ProtocolVersion server_version;
163 SSL3SessionID session_id;
164 ssl3CipherSuite cipher_suite;
165 SSLCompressionMethod compression_method;
172 /* SSL3SignType moved to ssl.h */
174 /* The SSL key exchange method used */
196 } SSL3KeyExchangeAlgorithm;
201 } SSL3ServerRSAParams;
207 } SSL3ServerDHParams;
211 SSL3ServerDHParams dh;
212 SSL3ServerRSAParams rsa;
216 /* This enum reflects HashAlgorithm enum from
217 * https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1
219 * When updating, be sure to also update ssl3_TLSHashAlgorithmToOID. */
229 /* This enum reflects SignatureAlgorithm enum from
230 * https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1 */
235 } TLSSignatureAlgorithm;
239 TLSSignatureAlgorithm sigAlg;
240 } SSL3SignatureAndHashAlgorithm;
242 /* SSL3HashesIndividually contains a combination MD5/SHA1 hash, as used in TLS
247 } SSL3HashesIndividually;
249 /* SSL3Hashes contains an SSL hash value. The digest is contained in |u.raw|
250 * which, if |hashAlg==SEC_OID_UNKNOWN| is also a SSL3HashesIndividually
257 SSL3HashesIndividually s;
263 SSL3Opaque anonymous;
264 SSL3Hashes certified;
266 } SSL3ServerKeyExchange;
273 ct_RSA_ephemeral_DH = 5,
274 ct_DSS_ephemeral_DH = 6,
276 ct_RSA_fixed_ECDH = 65,
277 ct_ECDSA_fixed_ECDH = 66
279 } SSL3ClientCertificateType;
281 typedef SECItem *SSL3DistinquishedName;
284 SSL3Opaque client_version[2];
285 SSL3Opaque random[46];
286 } SSL3RSAPreMasterSecret;
288 typedef SECItem SSL3EncryptedPreMasterSecret;
291 typedef SSL3Opaque SSL3MasterSecret[48];
293 typedef enum { implicit, explicit } SSL3PublicValueEncoding;
300 } SSL3ClientDiffieHellmanPublic;
304 SSL3EncryptedPreMasterSecret rsa;
305 SSL3ClientDiffieHellmanPublic diffie_helman;
307 } SSL3ClientKeyExchange;
309 typedef SSL3Hashes SSL3PreSignedCertificateVerify;
311 typedef SECItem SSL3CertificateVerify;
314 sender_client = 0x434c4e54,
315 sender_server = 0x53525652
318 typedef SSL3HashesIndividually SSL3Finished;
321 SSL3Opaque verify_data[12];
325 * TLS extension related data structures and constants.
328 /* SessionTicket extension related data structures. */
330 /* NewSessionTicket handshake message. */
332 PRUint32 received_timestamp;
333 PRUint32 ticket_lifetime_hint;
338 CLIENT_AUTH_ANONYMOUS = 0,
339 CLIENT_AUTH_CERTIFICATE = 1
340 } ClientAuthenticationType;
343 ClientAuthenticationType client_auth_type;
345 SSL3Opaque *certificate_list;
349 #define SESS_TICKET_KEY_NAME_LEN 16
350 #define SESS_TICKET_KEY_NAME_PREFIX "NSS!"
351 #define SESS_TICKET_KEY_NAME_PREFIX_LEN 4
352 #define SESS_TICKET_KEY_VAR_NAME_LEN 12
355 unsigned char *key_name;
357 SECItem encrypted_state;
359 } EncryptedSessionTicket;
361 #define TLS_EX_SESS_TICKET_MAC_LENGTH 32
363 #define TLS_STE_NO_SERVER_NAME -1
365 #endif /* __ssl3proto_h_ */