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_cert_status_response.h" 17 : : 18 : : #include "stuffer/s2n_stuffer.h" 19 : : #include "tls/s2n_connection.h" 20 : : #include "tls/s2n_tls.h" 21 : : #include "tls/s2n_tls_parameters.h" 22 : : 23 : : static bool s2n_cert_status_response_should_send(struct s2n_connection *conn); 24 : : static int s2n_cert_status_response_recv(struct s2n_connection *conn, struct s2n_stuffer *extension); 25 : : 26 : : const s2n_extension_type s2n_cert_status_response_extension = { 27 : : .iana_value = TLS_EXTENSION_STATUS_REQUEST, 28 : : .is_response = true, 29 : : .send = s2n_extension_send_noop, 30 : : .recv = s2n_cert_status_response_recv, 31 : : .should_send = s2n_cert_status_response_should_send, 32 : : .if_missing = s2n_extension_noop_if_missing, 33 : : }; 34 : : 35 : : static bool s2n_cert_status_response_should_send(struct s2n_connection *conn) 36 : 235 : { 37 [ + + ][ + + ]: 235 : return s2n_server_can_send_ocsp(conn); [ + + ][ + + ] 38 : 235 : } 39 : : 40 : : int s2n_cert_status_response_recv(struct s2n_connection *conn, struct s2n_stuffer *extension) 41 : 4 : { 42 : : /* Read nothing. The extension just needs to exist. */ 43 [ - + ][ # # ]: 4 : POSIX_ENSURE_REF(conn); 44 : 4 : conn->status_type = S2N_STATUS_REQUEST_OCSP; 45 : 4 : return S2N_SUCCESS; 46 : 4 : }