1%%
2%% %CopyrightBegin%
3%%
4%% Copyright Ericsson AB 2018-2018. All Rights Reserved.
5%%
6%% Licensed under the Apache License, Version 2.0 (the "License");
7%% you may not use this file except in compliance with the License.
8%% You may obtain a copy of the License at
9%%
10%%     http://www.apache.org/licenses/LICENSE-2.0
11%%
12%% Unless required by applicable law or agreed to in writing, software
13%% distributed under the License is distributed on an "AS IS" BASIS,
14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15%% See the License for the specific language governing permissions and
16%% limitations under the License.
17%%
18%% %CopyrightEnd%
19%%
20
21%%
22%%----------------------------------------------------------------------
23%% Purpose: Record and constant defenitions for the TLS-1.3-record protocol
24%% see RFC 8446 not present in earlier versions
25%%----------------------------------------------------------------------
26
27-ifndef(tls_record_1_3).
28-define(tls_record_1_3, true).
29
30%% enum {
31%%         invalid(0),
32%%         %% defined in ssl_record.hrl
33%%         change_cipher_spec(20),
34%%         alert(21),
35%%         handshake(22),
36%%         application_data(23),
37%%         heartbeat(24),  /* RFC 6520 */
38%%         (255)
39%%     } ContentType;
40
41-define(INVALID, 0).
42-define(LEGACY_VERSION, {3,3}).
43-define(OPAQUE_TYPE, 23).
44
45-record(inner_plaintext, {
46                          content, %% data
47                          type, %% Contentype
48                          zeros %% padding "uint8 zeros[length_of_padding]"
49                         }).
50-record(tls_cipher_text, {  %% Equivalent of encrypted version of #ssl_tls from previous versions
51                            %% decrypted version will still use #ssl_tls for code reuse purposes
52                            %% with real values for content type and version
53                            opaque_type = ?OPAQUE_TYPE,
54                            legacy_version = ?LEGACY_VERSION,
55                            encoded_record
56                         }).
57
58-endif. % -ifdef(tls_record_1_3).
59