s2n_cert_status_response.c 1.6 KB

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