| 1 | /* |
| 2 | * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"). |
| 5 | * You may not use this file except in compliance with the License. |
| 6 | * A copy of the License is located at |
| 7 | * |
| 8 | * http://aws.amazon.com/apache2.0 |
| 9 | * |
| 10 | * or in the "license" file accompanying this file. This file is distributed |
| 11 | * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either |
| 12 | * express or implied. See the License for the specific language governing |
| 13 | * permissions and limitations under the License. |
| 14 | */ |
| 15 | |
| 16 | #include "tls/s2n_tls.h" |
| 17 | |
| 18 | #include <stdint.h> |
| 19 | |
| 20 | #include "tls/s2n_tls_parameters.h" |
| 21 | |
| 22 | uint8_t s2n_highest_protocol_version = S2N_TLS13; |
| 23 | uint8_t s2n_unknown_protocol_version = S2N_UNKNOWN_PROTOCOL_VERSION; |
| 24 | |
| 25 | /* |
| 26 | * Convert max_fragment_length codes to length. |
| 27 | * RFC 6066 says: |
| 28 | * enum{ |
| 29 | * 2^9(1), 2^10(2), 2^11(3), 2^12(4), (255) |
| 30 | * } MaxFragmentLength; |
| 31 | * and we add 0 -> extension unused |
| 32 | */ |
| 33 | uint16_t mfl_code_to_length[5] = { |
| 34 | S2N_DEFAULT_FRAGMENT_LENGTH, /* S2N_TLS_MAX_FRAG_LEN_EXT_NONE */ |
| 35 | 512, /* S2N_TLS_MAX_FRAG_LEN_512 */ |
| 36 | 1024, /* S2N_TLS_MAX_FRAG_LEN_1024 */ |
| 37 | 2048, /* S2N_TLS_MAX_FRAG_LEN_2048 */ |
| 38 | 4096, /* S2N_TLS_MAX_FRAG_LEN_4096 */ |
| 39 | }; |