Debian Codegraph @

crt/s2n/api/unstable/custom_x509_extensions.h

raw symbols SCIP
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 #pragma once
17
18 #include <s2n.h>
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 /**
25 * @file custom_x509_extensions.h
26 *
27 * The following API enables applications to configure custom x509 critical extensions unknown to s2n-tls.
28 * s2n-tls will ignore these extensions during certificate validation. Applications MUST validate their
29 * custom critical extensions in the cert validation callback or after the handshake.
30 */
31
32 /**
33 * Specify a custom critical extension to be ignored during certificate validation.
34 *
35 * By default, s2n-tls will reject received certificates with unknown critical extensions. Calling
36 * s2n_config_add_custom_x509_extension will mark the given extension_oid as known and handled.
37 * This allows applications to provide their own validation for certificate extensions unknown to s2n-tls.
38 *
39 * This API adds a single custom critical extension to the config at a time.
40 *
41 * Libcrypto Requirement: AWS-LC >= 1.51.0
42 *
43 * # Safety
44 *
45 * RFC 5280 indicates that certificate extensions are to be marked critical when validators MUST
46 * understand the extension in order to safely determine the certificate's validity. As such, s2n-tls
47 * assumes that this validation is performed by the application. Applications MUST implement this
48 * validation for all provided certificate extensions outside of s2n-tls. The `s2n_cert_validation_callback`
49 * can be used for this purpose. An alternative is to wait until after the handshake completes,
50 * but before any application data is sent or accepted.
51 *
52 * @param config The configuration object being updated
53 * @param extension_oid The pointer to a custom critical extension OID
54 * @param extension_oid_len The length of the extension OID
55 * @returns S2N_SUCCESS on success. S2N_FAILURE on failure
56 */
57 S2N_API extern int s2n_config_add_custom_x509_extension(struct s2n_config *config, uint8_t *extension_oid, uint32_t extension_oid_len);
58
59 #ifdef __cplusplus
60 }
61 #endif