Debian Codegraph @

crt/s2n/tests/unit/s2n_server_signature_algorithms_extension_test.c

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 #include <stdint.h>
17
18 #include "s2n_test.h"
19 #include "stuffer/s2n_stuffer.h"
20 #include "testlib/s2n_testlib.h"
21 #include "tls/extensions/s2n_server_signature_algorithms.h"
22 #include "tls/s2n_config.h"
23 #include "tls/s2n_connection.h"
24 #include "tls/s2n_tls.h"
25 #include "tls/s2n_tls13.h"
26 #include "utils/s2n_safety.h"
27
28 int main(int argc, char **argv)
29 {
30 BEGIN_TEST();
31
32 s2n_enable_tls13_in_test();
33
34 {
35 struct s2n_connection *client_conn = NULL;
36 struct s2n_connection *server_conn = NULL;
37 EXPECT_NOT_NULL(client_conn = s2n_connection_new(S2N_CLIENT));
38 EXPECT_NOT_NULL(server_conn = s2n_connection_new(S2N_SERVER));
39
40 struct s2n_stuffer io = { 0 };
41 EXPECT_SUCCESS(s2n_stuffer_growable_alloc(&io, 0));
42
43 EXPECT_SUCCESS(s2n_server_signature_algorithms_extension.send(server_conn, &io));
44 EXPECT_SUCCESS(s2n_server_signature_algorithms_extension.recv(client_conn, &io));
45 EXPECT_EQUAL(s2n_stuffer_data_available(&io), 0);
46
47 EXPECT_TRUE(client_conn->handshake_params.peer_sig_scheme_list.len > 0);
48
49 s2n_stuffer_free(&io);
50 EXPECT_SUCCESS(s2n_connection_free(server_conn));
51 EXPECT_SUCCESS(s2n_connection_free(client_conn));
52 };
53
54 s2n_disable_tls13_in_test();
55
56 END_TEST();
57
58 return 0;
59 }