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_server_cert_status_request.h" 17 : : 18 : : #include "tls/s2n_connection.h" 19 : : 20 : : static bool s2n_server_cert_status_request_should_send(struct s2n_connection *conn); 21 : : static int s2n_server_cert_status_request_send(struct s2n_connection *conn, struct s2n_stuffer *out); 22 : : 23 : : const s2n_extension_type s2n_server_cert_status_request_extension = { 24 : : .iana_value = TLS_EXTENSION_STATUS_REQUEST, 25 : : .is_response = false, 26 : : .send = s2n_server_cert_status_request_send, 27 : : .recv = s2n_extension_recv_noop, 28 : : .should_send = s2n_server_cert_status_request_should_send, 29 : : .if_missing = s2n_extension_noop_if_missing, 30 : : }; 31 : : 32 : : static int s2n_server_cert_status_request_send(struct s2n_connection *conn, struct s2n_stuffer *out) 33 : 3 : { 34 : : /** 35 : : *= https://www.rfc-editor.org/rfc/rfc8446#4.4.2.1 36 : : *# A server MAY request that a client present an OCSP response with its 37 : : *# certificate by sending an empty "status_request" extension in its 38 : : *# CertificateRequest message. 39 : : */ 40 : 3 : return S2N_SUCCESS; 41 : 3 : } 42 : : 43 : : static bool s2n_server_cert_status_request_should_send(struct s2n_connection *conn) 44 : 60 : { 45 : 60 : return conn->request_ocsp_status; 46 : 60 : }