s2n_tls.c 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  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. #include "tls/s2n_tls.h"
  16. #include <stdint.h>
  17. #include "tls/s2n_tls_parameters.h"
  18. uint8_t s2n_highest_protocol_version = S2N_TLS13;
  19. uint8_t s2n_unknown_protocol_version = S2N_UNKNOWN_PROTOCOL_VERSION;
  20. /*
  21. * Convert max_fragment_length codes to length.
  22. * RFC 6066 says:
  23. * enum{
  24. * 2^9(1), 2^10(2), 2^11(3), 2^12(4), (255)
  25. * } MaxFragmentLength;
  26. * and we add 0 -> extension unused
  27. */
  28. uint16_t mfl_code_to_length[5] = {
  29. S2N_DEFAULT_FRAGMENT_LENGTH, /* S2N_TLS_MAX_FRAG_LEN_EXT_NONE */
  30. 512, /* S2N_TLS_MAX_FRAG_LEN_512 */
  31. 1024, /* S2N_TLS_MAX_FRAG_LEN_1024 */
  32. 2048, /* S2N_TLS_MAX_FRAG_LEN_2048 */
  33. 4096, /* S2N_TLS_MAX_FRAG_LEN_4096 */
  34. };