Branch data Line data Source code
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/extensions/s2n_supported_versions.h" 17 : : 18 : : #include <stdint.h> 19 : : 20 : : #include "tls/s2n_security_policies.h" 21 : : #include "utils/s2n_safety.h" 22 : : 23 : : S2N_RESULT s2n_connection_get_minimum_supported_version(struct s2n_connection *conn, uint8_t *min_version) 24 : 16155 : { 25 [ - + ][ # # ]: 16155 : RESULT_ENSURE_REF(min_version); 26 : : 27 : 16155 : const struct s2n_security_policy *security_policy = NULL; 28 [ - + ]: 16155 : RESULT_GUARD_POSIX(s2n_connection_get_security_policy(conn, &security_policy)); 29 [ - + ][ # # ]: 16155 : RESULT_ENSURE_REF(security_policy); 30 : 16155 : *min_version = security_policy->minimum_protocol_version; 31 : : 32 : : /* QUIC requires >= TLS1.3 */ 33 [ + + ]: 16155 : if (s2n_connection_is_quic_enabled(conn)) { 34 [ - + ]: 34 : *min_version = S2N_MAX(*min_version, S2N_TLS13); 35 : 34 : } 36 : : 37 : 16155 : return S2N_RESULT_OK; 38 : 16155 : }