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 /* The TLS 1.3 draft version. Used to avoid negotiating
18 * between incompatible pre-standard TLS 1.3 drafts.
19 * TODO(ekr@rtfm.com): Remove when TLS 1.3 is published. */
20 #define TLS_1_3_DRAFT_VERSION 3
22 typedef PRUint16 ssl3CipherSuite
;
23 /* The cipher suites are defined in sslproto.h */
25 #define MAX_CERT_TYPES 10
26 #define MAX_COMPRESSION_METHODS 10
27 #define MAX_MAC_LENGTH 64
28 #define MAX_PADDING_LENGTH 64
29 #define MAX_KEY_LENGTH 64
30 #define EXPORT_KEY_LENGTH 5
31 #define SSL3_RANDOM_LENGTH 32
33 #define SSL3_RECORD_HEADER_LENGTH 5
35 /* SSL3_RECORD_HEADER_LENGTH + epoch/sequence_number */
36 #define DTLS_RECORD_HEADER_LENGTH 13
38 #define MAX_FRAGMENT_LENGTH 16384
41 content_change_cipher_spec
= 20,
43 content_handshake
= 22,
44 content_application_data
= 23
49 SSL3ProtocolVersion version
;
56 SSL3ProtocolVersion version
;
63 SSL3Opaque MAC
[MAX_MAC_LENGTH
];
64 } SSL3GenericStreamCipher
;
68 SSL3Opaque MAC
[MAX_MAC_LENGTH
];
69 PRUint8 padding
[MAX_PADDING_LENGTH
];
70 PRUint8 padding_length
;
71 } SSL3GenericBlockCipher
;
73 typedef enum { change_cipher_spec_choice
= 1 } SSL3ChangeCipherSpecChoice
;
76 SSL3ChangeCipherSpecChoice choice
;
77 } SSL3ChangeCipherSpec
;
79 typedef enum { alert_warning
= 1, alert_fatal
= 2 } SSL3AlertLevel
;
83 unexpected_message
= 10,
85 decryption_failed_RESERVED
= 21, /* do not send; see RFC 5246 */
86 record_overflow
= 22, /* TLS only */
87 decompression_failure
= 30,
88 handshake_failure
= 40,
89 no_certificate
= 41, /* SSL3 only, NOT TLS */
91 unsupported_certificate
= 43,
92 certificate_revoked
= 44,
93 certificate_expired
= 45,
94 certificate_unknown
= 46,
95 illegal_parameter
= 47,
97 /* All alerts below are TLS only. */
102 export_restriction
= 60,
103 protocol_version
= 70,
104 insufficient_security
= 71,
106 inappropriate_fallback
= 86, /* could also be sent for SSLv3 */
108 no_renegotiation
= 100,
110 /* Alerts for client hello extensions */
111 unsupported_extension
= 110,
112 certificate_unobtainable
= 111,
113 unrecognized_name
= 112,
114 bad_certificate_status_response
= 113,
115 bad_certificate_hash_value
= 114,
116 no_application_protocol
= 120
118 } SSL3AlertDescription
;
121 SSL3AlertLevel level
;
122 SSL3AlertDescription description
;
129 hello_verify_request
= 3,
130 new_session_ticket
= 4,
132 server_key_exchange
= 12,
133 certificate_request
= 13,
134 server_hello_done
= 14,
135 certificate_verify
= 15,
136 client_key_exchange
= 16,
138 certificate_status
= 22,
140 encrypted_extensions
= 203,
148 SSL3Opaque rand
[SSL3_RANDOM_LENGTH
];
157 SSL3ProtocolVersion client_version
;
159 SSL3SessionID session_id
;
160 SECItem cipher_suites
;
162 SSLCompressionMethod compression_methods
[MAX_COMPRESSION_METHODS
];
166 SSL3ProtocolVersion server_version
;
168 SSL3SessionID session_id
;
169 ssl3CipherSuite cipher_suite
;
170 SSLCompressionMethod compression_method
;
177 /* SSL3SignType moved to ssl.h */
179 /* The SSL key exchange method used */
201 } SSL3KeyExchangeAlgorithm
;
206 } SSL3ServerRSAParams
;
212 } SSL3ServerDHParams
;
216 SSL3ServerDHParams dh
;
217 SSL3ServerRSAParams rsa
;
221 /* This enum reflects HashAlgorithm enum from
222 * https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1
224 * When updating, be sure to also update ssl3_TLSHashAlgorithmToOID. */
234 /* This enum reflects SignatureAlgorithm enum from
235 * https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1 */
240 } TLSSignatureAlgorithm
;
244 TLSSignatureAlgorithm sigAlg
;
245 } SSL3SignatureAndHashAlgorithm
;
247 /* SSL3HashesIndividually contains a combination MD5/SHA1 hash, as used in TLS
252 } SSL3HashesIndividually
;
254 /* SSL3Hashes contains an SSL hash value. The digest is contained in |u.raw|
255 * which, if |hashAlg==SEC_OID_UNKNOWN| is also a SSL3HashesIndividually
262 SSL3HashesIndividually s
;
268 SSL3Opaque anonymous
;
269 SSL3Hashes certified
;
271 } SSL3ServerKeyExchange
;
278 ct_RSA_ephemeral_DH
= 5,
279 ct_DSS_ephemeral_DH
= 6,
281 ct_RSA_fixed_ECDH
= 65,
282 ct_ECDSA_fixed_ECDH
= 66
284 } SSL3ClientCertificateType
;
286 typedef SECItem
*SSL3DistinquishedName
;
289 SSL3Opaque client_version
[2];
290 SSL3Opaque random
[46];
291 } SSL3RSAPreMasterSecret
;
293 typedef SECItem SSL3EncryptedPreMasterSecret
;
296 typedef SSL3Opaque SSL3MasterSecret
[48];
298 typedef enum { implicit
, explicit } SSL3PublicValueEncoding
;
305 } SSL3ClientDiffieHellmanPublic
;
309 SSL3EncryptedPreMasterSecret rsa
;
310 SSL3ClientDiffieHellmanPublic diffie_helman
;
312 } SSL3ClientKeyExchange
;
314 typedef SSL3Hashes SSL3PreSignedCertificateVerify
;
316 typedef SECItem SSL3CertificateVerify
;
319 sender_client
= 0x434c4e54,
320 sender_server
= 0x53525652
323 typedef SSL3HashesIndividually SSL3Finished
;
326 SSL3Opaque verify_data
[12];
330 * TLS extension related data structures and constants.
333 /* SessionTicket extension related data structures. */
335 /* NewSessionTicket handshake message. */
337 PRUint32 received_timestamp
;
338 PRUint32 ticket_lifetime_hint
;
343 CLIENT_AUTH_ANONYMOUS
= 0,
344 CLIENT_AUTH_CERTIFICATE
= 1
345 } ClientAuthenticationType
;
348 ClientAuthenticationType client_auth_type
;
350 SSL3Opaque
*certificate_list
;
354 #define SESS_TICKET_KEY_NAME_LEN 16
355 #define SESS_TICKET_KEY_NAME_PREFIX "NSS!"
356 #define SESS_TICKET_KEY_NAME_PREFIX_LEN 4
357 #define SESS_TICKET_KEY_VAR_NAME_LEN 12
360 unsigned char *key_name
;
362 SECItem encrypted_state
;
364 } EncryptedSessionTicket
;
366 #define TLS_EX_SESS_TICKET_MAC_LENGTH 32
368 #define TLS_STE_NO_SERVER_NAME -1
370 #endif /* __ssl3proto_h_ */