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