AWS s2n-tls v1.7.3-021f5a5d
s2n-tls is a C99 implementation of the TLS/SSL protocols that is designed to be simple, small, fast, and with security as a priority.
Loading...
Searching...
No Matches
s2n.h
Go to the documentation of this file.
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
23#pragma once
24
25#ifndef S2N_API
29 #define S2N_API
30#endif
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36#include <stdbool.h>
37#include <stdint.h>
38#include <stdio.h>
39#include <sys/types.h>
40#ifndef _WIN32
41 #include <sys/uio.h>
42#else
43/* struct iovec equivalent for Windows */
44struct iovec {
45 void *iov_base;
46 size_t iov_len;
47};
48#endif
49
53#define S2N_SUCCESS 0
57#define S2N_FAILURE -1
58
62#define S2N_CALLBACK_BLOCKED -2
63
67#define S2N_MINIMUM_SUPPORTED_TLS_RECORD_MAJOR_VERSION 2
68
72#define S2N_MAXIMUM_SUPPORTED_TLS_RECORD_MAJOR_VERSION 3
73
77#define S2N_SSLv2 20
78
82#define S2N_SSLv3 30
83
87#define S2N_TLS10 31
88
92#define S2N_TLS11 32
93
97#define S2N_TLS12 33
98
102#define S2N_TLS13 34
103
107#define S2N_UNKNOWN_PROTOCOL_VERSION 0
108
126S2N_API extern __thread int s2n_errno;
127
134S2N_API extern int *s2n_errno_location(void);
135
150typedef enum {
168
179S2N_API extern int s2n_error_get_type(int error);
180
184struct s2n_config;
185
189struct s2n_connection;
190
206
220
227S2N_API extern unsigned long s2n_get_openssl_version(void);
228
237S2N_API extern int s2n_init(void);
238
246S2N_API extern int s2n_cleanup(void);
247
248/*
249 * Performs a complete deinitialization and cleanup of the s2n-tls library.
250 *
251 * @returns S2N_SUCCESS on success. S2N_FAILURE on failure
252 */
253S2N_API extern int s2n_cleanup_final(void);
254
255typedef enum {
256 S2N_FIPS_MODE_DISABLED = 0,
257 S2N_FIPS_MODE_ENABLED,
258} s2n_fips_mode;
259
274S2N_API extern int s2n_get_fips_mode(s2n_fips_mode *fips_mode);
275
288S2N_API extern struct s2n_config *s2n_config_new(void);
289
303S2N_API extern struct s2n_config *s2n_config_new_minimal(void);
304
311S2N_API extern int s2n_config_free(struct s2n_config *config);
312
319S2N_API extern int s2n_config_free_dhparams(struct s2n_config *config);
320
327S2N_API extern int s2n_config_free_cert_chain_and_key(struct s2n_config *config);
328
336typedef int (*s2n_clock_time_nanoseconds)(void *, uint64_t *);
337
358typedef int (*s2n_cache_retrieve_callback)(struct s2n_connection *conn, void *, const void *key, uint64_t key_size, void *value, uint64_t *value_size);
359
373typedef int (*s2n_cache_store_callback)(struct s2n_connection *conn, void *, uint64_t ttl_in_seconds, const void *key, uint64_t key_size, const void *value, uint64_t value_size);
374
385typedef int (*s2n_cache_delete_callback)(struct s2n_connection *conn, void *, const void *key, uint64_t key_size);
386
399S2N_API extern int s2n_config_set_wall_clock(struct s2n_config *config, s2n_clock_time_nanoseconds clock_fn, void *ctx);
400
413S2N_API extern int s2n_config_set_monotonic_clock(struct s2n_config *config, s2n_clock_time_nanoseconds clock_fn, void *ctx);
414
422S2N_API extern const char *s2n_strerror(int error, const char *lang);
423
433S2N_API extern const char *s2n_strerror_debug(int error, const char *lang);
434
441S2N_API extern const char *s2n_strerror_name(int error);
442
449S2N_API extern const char *s2n_strerror_source(int error);
450
454struct s2n_stacktrace;
455
462
469S2N_API extern int s2n_stack_traces_enabled_set(bool newval);
470
477
485S2N_API extern int s2n_print_stacktrace(FILE *fptr);
486
493
500S2N_API extern int s2n_get_stacktrace(struct s2n_stacktrace *trace);
501
511S2N_API extern int s2n_config_set_cache_store_callback(struct s2n_config *config, s2n_cache_store_callback cache_store_callback, void *data);
512
522S2N_API extern int s2n_config_set_cache_retrieve_callback(struct s2n_config *config, s2n_cache_retrieve_callback cache_retrieve_callback, void *data);
523
533S2N_API extern int s2n_config_set_cache_delete_callback(struct s2n_config *config, s2n_cache_delete_callback cache_delete_callback, void *data);
534
538typedef int (*s2n_mem_init_callback)(void);
539
543typedef int (*s2n_mem_cleanup_callback)(void);
544
553typedef int (*s2n_mem_malloc_callback)(void **ptr, uint32_t requested, uint32_t *allocated);
554
558typedef int (*s2n_mem_free_callback)(void *ptr, uint32_t size);
559
571S2N_API extern int s2n_mem_set_callbacks(s2n_mem_init_callback mem_init_callback, s2n_mem_cleanup_callback mem_cleanup_callback,
572 s2n_mem_malloc_callback mem_malloc_callback, s2n_mem_free_callback mem_free_callback);
573
577typedef int (*s2n_rand_init_callback)(void);
578
582typedef int (*s2n_rand_cleanup_callback)(void);
583
587typedef int (*s2n_rand_seed_callback)(void *data, uint32_t size);
588
592typedef int (*s2n_rand_mix_callback)(void *data, uint32_t size);
593
607S2N_API extern int s2n_rand_set_callbacks(s2n_rand_init_callback rand_init_callback, s2n_rand_cleanup_callback rand_cleanup_callback,
608 s2n_rand_seed_callback rand_seed_callback, s2n_rand_mix_callback rand_mix_callback);
609
613typedef enum {
614 S2N_EXTENSION_SERVER_NAME = 0,
615 S2N_EXTENSION_MAX_FRAG_LEN = 1,
616 S2N_EXTENSION_OCSP_STAPLING = 5,
617 S2N_EXTENSION_SUPPORTED_GROUPS = 10,
618 S2N_EXTENSION_EC_POINT_FORMATS = 11,
619 S2N_EXTENSION_SIGNATURE_ALGORITHMS = 13,
620 S2N_EXTENSION_ALPN = 16,
621 S2N_EXTENSION_CERTIFICATE_TRANSPARENCY = 18,
622 S2N_EXTENSION_SUPPORTED_VERSIONS = 43,
623 S2N_EXTENSION_RENEGOTIATION_INFO = 65281,
625
629typedef enum {
630 S2N_TLS_MAX_FRAG_LEN_512 = 1,
631 S2N_TLS_MAX_FRAG_LEN_1024 = 2,
632 S2N_TLS_MAX_FRAG_LEN_2048 = 3,
633 S2N_TLS_MAX_FRAG_LEN_4096 = 4,
635
639struct s2n_cert;
640
644struct s2n_cert_chain_and_key;
645
649struct s2n_pkey;
650
654typedef struct s2n_pkey s2n_cert_public_key;
655
659typedef struct s2n_pkey s2n_cert_private_key;
660
667S2N_API extern struct s2n_cert_chain_and_key *s2n_cert_chain_and_key_new(void);
668
684S2N_API extern int s2n_cert_chain_and_key_load_pem(struct s2n_cert_chain_and_key *chain_and_key, const char *chain_pem, const char *private_key_pem);
685
701S2N_API extern int s2n_cert_chain_and_key_load_pem_bytes(struct s2n_cert_chain_and_key *chain_and_key, uint8_t *chain_pem, uint32_t chain_pem_len, uint8_t *private_key_pem, uint32_t private_key_pem_len);
702
714S2N_API extern int s2n_cert_chain_and_key_load_public_pem_bytes(struct s2n_cert_chain_and_key *chain_and_key, uint8_t *chain_pem, uint32_t chain_pem_len);
715
722S2N_API extern int s2n_cert_chain_and_key_free(struct s2n_cert_chain_and_key *cert_and_key);
723
731S2N_API extern int s2n_cert_chain_and_key_set_ctx(struct s2n_cert_chain_and_key *cert_and_key, void *ctx);
732
739S2N_API extern void *s2n_cert_chain_and_key_get_ctx(struct s2n_cert_chain_and_key *cert_and_key);
740
747S2N_API extern s2n_cert_private_key *s2n_cert_chain_and_key_get_private_key(struct s2n_cert_chain_and_key *cert_and_key);
748
757S2N_API extern int s2n_cert_chain_and_key_set_ocsp_data(struct s2n_cert_chain_and_key *chain_and_key, const uint8_t *data, uint32_t length);
758
768S2N_API extern int s2n_cert_chain_and_key_set_sct_list(struct s2n_cert_chain_and_key *chain_and_key, const uint8_t *data, uint32_t length);
769
782typedef struct s2n_cert_chain_and_key *(*s2n_cert_tiebreak_callback)(struct s2n_cert_chain_and_key *cert1, struct s2n_cert_chain_and_key *cert2, uint8_t *name, uint32_t name_len);
783
793S2N_API extern int s2n_config_set_cert_tiebreak_callback(struct s2n_config *config, s2n_cert_tiebreak_callback cert_tiebreak_cb);
794
809S2N_API extern int s2n_config_add_cert_chain_and_key(struct s2n_config *config, const char *cert_chain_pem, const char *private_key_pem);
810
828S2N_API extern int s2n_config_add_cert_chain_and_key_to_store(struct s2n_config *config, struct s2n_cert_chain_and_key *cert_key_pair);
829
849S2N_API extern int s2n_config_set_cert_chain_and_key_defaults(struct s2n_config *config,
850 struct s2n_cert_chain_and_key **cert_key_pairs, uint32_t num_cert_key_pairs);
851
876S2N_API extern int s2n_config_set_verification_ca_location(struct s2n_config *config, const char *ca_pem_filename, const char *ca_dir);
877
897S2N_API extern int s2n_config_add_pem_to_trust_store(struct s2n_config *config, const char *pem);
898
910S2N_API extern int s2n_config_wipe_trust_store(struct s2n_config *config);
911
925S2N_API extern int s2n_config_load_system_certs(struct s2n_config *config);
926
927typedef enum {
928 S2N_VERIFY_AFTER_SIGN_DISABLED,
929 S2N_VERIFY_AFTER_SIGN_ENABLED
930} s2n_verify_after_sign;
931
944S2N_API extern int s2n_config_set_verify_after_sign(struct s2n_config *config, s2n_verify_after_sign mode);
945
968S2N_API extern int s2n_config_set_send_buffer_size(struct s2n_config *config, uint32_t size);
969
987S2N_API extern int s2n_config_set_recv_multi_record(struct s2n_config *config, bool enabled);
988
1003typedef uint8_t (*s2n_verify_host_fn)(const char *host_name, size_t host_name_len, void *data);
1004
1019S2N_API extern int s2n_config_set_verify_host_callback(struct s2n_config *config, s2n_verify_host_fn, void *data);
1020
1033S2N_API extern int s2n_config_set_check_stapled_ocsp_response(struct s2n_config *config, uint8_t check_ocsp);
1034
1057S2N_API extern int s2n_config_disable_x509_time_verification(struct s2n_config *config);
1058
1059/* Disable TLS intent verification for received certificates.
1060 *
1061 * By default, s2n-tls will verify that received certificates set Key Usage / Extended Key Usage
1062 * fields that are consistent with the current TLS context (e.g. checking that serverAuth is set
1063 * when verifying server certificates as a client, or checking that clientAuth is set when
1064 * verifying client certificates as a server). This verification ensures that received certificates
1065 * are being used for their intended purpose as specified by the issuer.
1066 *
1067 * This verification may be incompatible with some PKIs where intent is improperly specified.
1068 * `s2n_config_disable_x509_intent_verification()` may be called in this case to disable the
1069 * verification. This verification should only be disabled if it is known that all received
1070 * certificates will be issued from a CA that intended for the certificates to be used in the given
1071 * TLS context, despite what's indicated in the Key Usage / Extended Key Usage extensions.
1072 *
1073 * @note If a received certificate doesn't contain a Key Usage / Extended Key Usage extension, it's
1074 * assumed that the issuer permits the certificate to be used for any purpose. s2n-tls will
1075 * only reject a certificate due to invalid intent if the issuer explicitly indicates a
1076 * purpose that is invalid for the TLS context in which it is received.
1077 *
1078 * @param config The associated connection config.
1079 * @returns S2N_SUCCESS on success, S2N_FAILURE on failure.
1080 */
1081S2N_API extern int s2n_config_disable_x509_intent_verification(struct s2n_config *config);
1082
1090S2N_API extern int s2n_config_disable_x509_verification(struct s2n_config *config);
1091
1102S2N_API extern int s2n_config_set_max_cert_chain_depth(struct s2n_config *config, uint16_t max_depth);
1103
1112S2N_API extern int s2n_config_add_dhparams(struct s2n_config *config, const char *dhparams_pem);
1113
1120S2N_API extern int s2n_config_set_cipher_preferences(struct s2n_config *config, const char *version);
1121
1131S2N_API extern int s2n_config_append_protocol_preference(struct s2n_config *config, const uint8_t *protocol, uint8_t protocol_len);
1132
1150S2N_API extern int s2n_config_set_protocol_preferences(struct s2n_config *config, const char *const *protocols, int protocol_count);
1151
1157typedef enum {
1158 S2N_STATUS_REQUEST_NONE = 0,
1159 S2N_STATUS_REQUEST_OCSP = 1
1161
1177S2N_API extern int s2n_config_set_status_request_type(struct s2n_config *config, s2n_status_request_type type);
1178
1182typedef enum {
1183 S2N_CT_SUPPORT_NONE = 0,
1184 S2N_CT_SUPPORT_REQUEST = 1
1186
1194S2N_API extern int s2n_config_set_ct_support_level(struct s2n_config *config, s2n_ct_support_level level);
1195
1206typedef enum {
1207 S2N_ALERT_FAIL_ON_WARNINGS = 0,
1208 S2N_ALERT_IGNORE_WARNINGS = 1
1210
1218S2N_API extern int s2n_config_set_alert_behavior(struct s2n_config *config, s2n_alert_behavior alert_behavior);
1219
1233S2N_API extern int s2n_config_set_extension_data(struct s2n_config *config, s2n_tls_extension_type type, const uint8_t *data, uint32_t length);
1234
1248S2N_API extern int s2n_config_send_max_fragment_length(struct s2n_config *config, s2n_max_frag_len mfl_code);
1249
1260S2N_API extern int s2n_config_accept_max_fragment_length(struct s2n_config *config);
1261
1269S2N_API extern int s2n_config_set_session_state_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs);
1270
1278S2N_API extern int s2n_config_set_session_tickets_onoff(struct s2n_config *config, uint8_t enabled);
1279
1290S2N_API extern int s2n_config_set_session_cache_onoff(struct s2n_config *config, uint8_t enabled);
1291
1301S2N_API extern int s2n_config_set_ticket_encrypt_decrypt_key_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs);
1302
1313S2N_API extern int s2n_config_set_ticket_decrypt_key_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs);
1314
1328S2N_API extern int s2n_config_add_ticket_crypto_key(struct s2n_config *config, const uint8_t *name, uint32_t name_len,
1329 uint8_t *key, uint32_t key_len, uint64_t intro_time_in_seconds_from_epoch);
1330
1344S2N_API extern int s2n_config_require_ticket_forward_secrecy(struct s2n_config *config, bool enabled);
1345
1353S2N_API extern int s2n_config_set_ctx(struct s2n_config *config, void *ctx);
1354
1363S2N_API extern int s2n_config_get_ctx(struct s2n_config *config, void **ctx);
1364
1368typedef enum {
1369 S2N_SERVER,
1370 S2N_CLIENT
1371} s2n_mode;
1372
1389S2N_API extern struct s2n_connection *s2n_connection_new(s2n_mode mode);
1390
1398S2N_API extern int s2n_connection_set_config(struct s2n_connection *conn, struct s2n_config *config);
1399
1407S2N_API extern int s2n_connection_set_ctx(struct s2n_connection *conn, void *ctx);
1408
1414S2N_API extern void *s2n_connection_get_ctx(struct s2n_connection *conn);
1415
1422typedef int s2n_client_hello_fn(struct s2n_connection *conn, void *ctx);
1423
1431typedef enum {
1432 S2N_CLIENT_HELLO_CB_BLOCKING,
1433 S2N_CLIENT_HELLO_CB_NONBLOCKING
1435
1444S2N_API extern int s2n_config_set_client_hello_cb(struct s2n_config *config, s2n_client_hello_fn client_hello_callback, void *ctx);
1445
1455S2N_API extern int s2n_config_set_client_hello_cb_mode(struct s2n_config *config, s2n_client_hello_cb_mode cb_mode);
1456
1464S2N_API extern int s2n_client_hello_cb_done(struct s2n_connection *conn);
1465
1473S2N_API extern int s2n_connection_server_name_extension_used(struct s2n_connection *conn);
1474
1478struct s2n_client_hello;
1479
1489S2N_API extern struct s2n_client_hello *s2n_connection_get_client_hello(struct s2n_connection *conn);
1490
1506S2N_API extern struct s2n_client_hello *s2n_client_hello_parse_message(const uint8_t *bytes, uint32_t size);
1507
1518S2N_API extern int s2n_client_hello_free(struct s2n_client_hello **ch);
1519
1529S2N_API extern ssize_t s2n_client_hello_get_raw_message_length(struct s2n_client_hello *ch);
1530
1550S2N_API extern ssize_t s2n_client_hello_get_raw_message(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length);
1551
1559S2N_API extern ssize_t s2n_client_hello_get_cipher_suites_length(struct s2n_client_hello *ch);
1560
1574S2N_API extern ssize_t s2n_client_hello_get_cipher_suites(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length);
1575
1583S2N_API extern ssize_t s2n_client_hello_get_extensions_length(struct s2n_client_hello *ch);
1584
1593S2N_API extern ssize_t s2n_client_hello_get_extensions(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length);
1594
1603S2N_API extern ssize_t s2n_client_hello_get_extension_length(struct s2n_client_hello *ch, s2n_tls_extension_type extension_type);
1604
1616S2N_API extern ssize_t s2n_client_hello_get_extension_by_id(struct s2n_client_hello *ch, s2n_tls_extension_type extension_type, uint8_t *out, uint32_t max_length);
1617
1627S2N_API extern int s2n_client_hello_has_extension(struct s2n_client_hello *ch, uint16_t extension_iana, bool *exists);
1628
1638S2N_API extern int s2n_client_hello_get_session_id_length(struct s2n_client_hello *ch, uint32_t *out_length);
1639
1655S2N_API extern int s2n_client_hello_get_session_id(struct s2n_client_hello *ch, uint8_t *out, uint32_t *out_length, uint32_t max_length);
1656
1664S2N_API extern int s2n_client_hello_get_compression_methods_length(struct s2n_client_hello *ch, uint32_t *out_length);
1665
1684S2N_API extern int s2n_client_hello_get_compression_methods(struct s2n_client_hello *ch, uint8_t *list, uint32_t list_length, uint32_t *out_length);
1685
1696S2N_API extern int s2n_client_hello_get_legacy_protocol_version(struct s2n_client_hello *ch, uint8_t *out);
1697
1712S2N_API extern int s2n_client_hello_get_random(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length);
1713
1736S2N_API extern int s2n_client_hello_get_supported_groups(struct s2n_client_hello *ch, uint16_t *groups,
1737 uint16_t groups_count_max, uint16_t *groups_count);
1738
1745S2N_API extern int s2n_client_hello_get_server_name_length(struct s2n_client_hello *ch, uint16_t *length);
1746
1757S2N_API extern int s2n_client_hello_get_server_name(struct s2n_client_hello *ch, uint8_t *server_name, uint16_t length, uint16_t *out_length);
1758
1770S2N_API extern int s2n_connection_set_fd(struct s2n_connection *conn, int fd);
1771
1783S2N_API extern int s2n_connection_set_read_fd(struct s2n_connection *conn, int readfd);
1784
1793S2N_API extern int s2n_connection_set_write_fd(struct s2n_connection *conn, int writefd);
1794
1802S2N_API extern int s2n_connection_get_read_fd(struct s2n_connection *conn, int *readfd);
1803
1811S2N_API extern int s2n_connection_get_write_fd(struct s2n_connection *conn, int *writefd);
1812
1821S2N_API extern int s2n_connection_use_corked_io(struct s2n_connection *conn);
1822
1826typedef int s2n_recv_fn(void *io_context, uint8_t *buf, uint32_t len);
1827
1831typedef int s2n_send_fn(void *io_context, const uint8_t *buf, uint32_t len);
1832
1843S2N_API extern int s2n_connection_set_recv_ctx(struct s2n_connection *conn, void *ctx);
1844
1855S2N_API extern int s2n_connection_set_send_ctx(struct s2n_connection *conn, void *ctx);
1856
1868S2N_API extern int s2n_connection_set_recv_cb(struct s2n_connection *conn, s2n_recv_fn recv);
1869
1881S2N_API extern int s2n_connection_set_send_cb(struct s2n_connection *conn, s2n_send_fn send);
1882
1892S2N_API extern int s2n_connection_prefer_throughput(struct s2n_connection *conn);
1893
1903S2N_API extern int s2n_connection_prefer_low_latency(struct s2n_connection *conn);
1904
1964S2N_API extern int s2n_connection_set_recv_buffering(struct s2n_connection *conn, bool enabled);
1965
2009S2N_API extern uint32_t s2n_peek_buffered(struct s2n_connection *conn);
2010
2022S2N_API extern int s2n_connection_set_dynamic_buffers(struct s2n_connection *conn, bool enabled);
2023
2040S2N_API extern int s2n_connection_set_dynamic_record_threshold(struct s2n_connection *conn, uint32_t resize_threshold, uint16_t timeout_threshold);
2041
2055S2N_API extern int s2n_connection_set_verify_host_callback(struct s2n_connection *conn, s2n_verify_host_fn host_fn, void *data);
2056
2070typedef enum {
2071 S2N_BUILT_IN_BLINDING,
2072 S2N_SELF_SERVICE_BLINDING
2073} s2n_blinding;
2074
2083S2N_API extern int s2n_connection_set_blinding(struct s2n_connection *conn, s2n_blinding blinding);
2084
2090S2N_API extern uint64_t s2n_connection_get_delay(struct s2n_connection *conn);
2091
2118S2N_API extern int s2n_config_set_max_blinding_delay(struct s2n_config *config, uint32_t seconds);
2119
2128S2N_API extern int s2n_connection_set_cipher_preferences(struct s2n_connection *conn, const char *version);
2129
2134typedef enum {
2135 S2N_KEY_UPDATE_NOT_REQUESTED = 0,
2136 S2N_KEY_UPDATE_REQUESTED
2138
2153S2N_API extern int s2n_connection_request_key_update(struct s2n_connection *conn, s2n_peer_key_update peer_request);
2164S2N_API extern int s2n_connection_append_protocol_preference(struct s2n_connection *conn, const uint8_t *protocol, uint8_t protocol_len);
2165
2175S2N_API extern int s2n_connection_set_protocol_preferences(struct s2n_connection *conn, const char *const *protocols, int protocol_count);
2176
2196S2N_API extern int s2n_set_server_name(struct s2n_connection *conn, const char *server_name);
2197
2207S2N_API extern const char *s2n_get_server_name(struct s2n_connection *conn);
2208
2215S2N_API extern const char *s2n_get_application_protocol(struct s2n_connection *conn);
2216
2224S2N_API extern const uint8_t *s2n_connection_get_ocsp_response(struct s2n_connection *conn, uint32_t *length);
2225
2233S2N_API extern const uint8_t *s2n_connection_get_sct_list(struct s2n_connection *conn, uint32_t *length);
2234
2240typedef enum {
2241 S2N_NOT_BLOCKED = 0,
2242 S2N_BLOCKED_ON_READ,
2243 S2N_BLOCKED_ON_WRITE,
2244 S2N_BLOCKED_ON_APPLICATION_INPUT,
2245 S2N_BLOCKED_ON_EARLY_DATA,
2247
2263S2N_API extern int s2n_negotiate(struct s2n_connection *conn, s2n_blocked_status *blocked);
2264
2282S2N_API extern ssize_t s2n_send(struct s2n_connection *conn, const void *buf, ssize_t size, s2n_blocked_status *blocked);
2283
2284#ifndef _WIN32
2296S2N_API extern ssize_t s2n_sendv(struct s2n_connection *conn, const struct iovec *bufs, ssize_t count, s2n_blocked_status *blocked);
2297
2315S2N_API extern ssize_t s2n_sendv_with_offset(struct s2n_connection *conn, const struct iovec *bufs, ssize_t count, ssize_t offs, s2n_blocked_status *blocked);
2316#endif
2317
2333S2N_API extern ssize_t s2n_recv(struct s2n_connection *conn, void *buf, ssize_t size, s2n_blocked_status *blocked);
2334
2346S2N_API extern uint32_t s2n_peek(struct s2n_connection *conn);
2347
2356S2N_API extern int s2n_connection_free_handshake(struct s2n_connection *conn);
2357
2367S2N_API extern int s2n_connection_release_buffers(struct s2n_connection *conn);
2368
2379S2N_API extern int s2n_connection_wipe(struct s2n_connection *conn);
2380
2390S2N_API extern int s2n_connection_free(struct s2n_connection *conn);
2391
2407S2N_API extern int s2n_shutdown(struct s2n_connection *conn, s2n_blocked_status *blocked);
2408
2435S2N_API extern int s2n_shutdown_send(struct s2n_connection *conn, s2n_blocked_status *blocked);
2436
2457typedef enum {
2458 S2N_CERT_AUTH_NONE,
2459 S2N_CERT_AUTH_REQUIRED,
2460 S2N_CERT_AUTH_OPTIONAL
2462
2470S2N_API extern int s2n_config_get_client_auth_type(struct s2n_config *config, s2n_cert_auth_type *client_auth_type);
2471
2482S2N_API extern int s2n_config_set_client_auth_type(struct s2n_config *config, s2n_cert_auth_type client_auth_type);
2483
2491S2N_API extern int s2n_connection_get_client_auth_type(struct s2n_connection *conn, s2n_cert_auth_type *client_auth_type);
2492
2503S2N_API extern int s2n_connection_set_client_auth_type(struct s2n_connection *conn, s2n_cert_auth_type client_auth_type);
2504
2520S2N_API extern int s2n_connection_get_client_cert_chain(struct s2n_connection *conn, uint8_t **der_cert_chain_out, uint32_t *cert_chain_len);
2521
2529S2N_API extern int s2n_config_set_initial_ticket_count(struct s2n_config *config, uint8_t num);
2530
2538S2N_API extern int s2n_connection_add_new_tickets_to_send(struct s2n_connection *conn, uint8_t num);
2539
2552S2N_API extern int s2n_connection_get_tickets_sent(struct s2n_connection *conn, uint16_t *num);
2553
2562S2N_API extern int s2n_connection_set_server_keying_material_lifetime(struct s2n_connection *conn, uint32_t lifetime_in_secs);
2563
2564struct s2n_session_ticket;
2565
2580typedef int (*s2n_session_ticket_fn)(struct s2n_connection *conn, void *ctx, struct s2n_session_ticket *ticket);
2581
2594S2N_API extern int s2n_config_set_session_ticket_cb(struct s2n_config *config, s2n_session_ticket_fn callback, void *ctx);
2595
2602S2N_API extern int s2n_session_ticket_get_data_len(struct s2n_session_ticket *ticket, size_t *data_len);
2603
2615S2N_API extern int s2n_session_ticket_get_data(struct s2n_session_ticket *ticket, size_t max_data_len, uint8_t *data);
2616
2623S2N_API extern int s2n_session_ticket_get_lifetime(struct s2n_session_ticket *ticket, uint32_t *session_lifetime);
2624
2637S2N_API extern int s2n_connection_set_session(struct s2n_connection *conn, const uint8_t *session, size_t length);
2638
2652S2N_API extern int s2n_connection_get_session(struct s2n_connection *conn, uint8_t *session, size_t max_length);
2653
2665S2N_API extern int s2n_connection_get_session_ticket_lifetime_hint(struct s2n_connection *conn);
2666
2674S2N_API extern int s2n_connection_get_session_length(struct s2n_connection *conn);
2675
2685S2N_API extern int s2n_connection_get_session_id_length(struct s2n_connection *conn);
2686
2700S2N_API extern int s2n_connection_get_session_id(struct s2n_connection *conn, uint8_t *session_id, size_t max_length);
2701
2709S2N_API extern int s2n_connection_is_session_resumed(struct s2n_connection *conn);
2710
2718S2N_API extern int s2n_connection_is_ocsp_stapled(struct s2n_connection *conn);
2719
2724typedef enum {
2725 S2N_TLS_SIGNATURE_ANONYMOUS = 0,
2726 S2N_TLS_SIGNATURE_RSA = 1,
2727 S2N_TLS_SIGNATURE_ECDSA = 3,
2728 S2N_TLS_SIGNATURE_MLDSA = 9,
2729
2730 /* Use Private Range for RSA PSS since it's not defined there */
2731 S2N_TLS_SIGNATURE_RSA_PSS_RSAE = 224,
2732 S2N_TLS_SIGNATURE_RSA_PSS_PSS
2734
2738typedef enum {
2739 S2N_TLS_HASH_NONE = 0,
2740 S2N_TLS_HASH_MD5 = 1,
2741 S2N_TLS_HASH_SHA1 = 2,
2742 S2N_TLS_HASH_SHA224 = 3,
2743 S2N_TLS_HASH_SHA256 = 4,
2744 S2N_TLS_HASH_SHA384 = 5,
2745 S2N_TLS_HASH_SHA512 = 6,
2746
2747 /* Use Private Range for MD5_SHA1 */
2748 S2N_TLS_HASH_MD5_SHA1 = 224
2750
2760
2769S2N_API extern int s2n_connection_get_selected_digest_algorithm(struct s2n_connection *conn, s2n_tls_hash_algorithm *chosen_alg);
2770
2780
2790
2827S2N_API extern int s2n_connection_get_signature_scheme(struct s2n_connection *conn, const char **scheme_name);
2828
2842S2N_API extern struct s2n_cert_chain_and_key *s2n_connection_get_selected_cert(struct s2n_connection *conn);
2843
2849S2N_API extern int s2n_cert_chain_get_length(const struct s2n_cert_chain_and_key *chain_and_key, uint32_t *cert_length);
2850
2869S2N_API extern int s2n_cert_chain_get_cert(const struct s2n_cert_chain_and_key *chain_and_key, struct s2n_cert **out_cert, const uint32_t cert_idx);
2870
2896S2N_API extern int s2n_cert_get_der(const struct s2n_cert *cert, const uint8_t **out_cert_der, uint32_t *cert_length);
2897
2908S2N_API extern int s2n_connection_get_peer_cert_chain(const struct s2n_connection *conn, struct s2n_cert_chain_and_key *cert_chain);
2909
2917S2N_API extern int s2n_cert_get_x509_extension_value_length(struct s2n_cert *cert, const uint8_t *oid, uint32_t *ext_value_len);
2918
2930S2N_API extern int s2n_cert_get_x509_extension_value(struct s2n_cert *cert, const uint8_t *oid, uint8_t *ext_value, uint32_t *ext_value_len, bool *critical);
2931
2939S2N_API extern int s2n_cert_get_utf8_string_from_extension_data_length(const uint8_t *extension_data, uint32_t extension_len, uint32_t *utf8_str_len);
2940
2952S2N_API extern int s2n_cert_get_utf8_string_from_extension_data(const uint8_t *extension_data, uint32_t extension_len, uint8_t *out_data, uint32_t *out_len);
2953
2957typedef enum {
2958 S2N_PSK_HMAC_SHA256,
2959 S2N_PSK_HMAC_SHA384,
2960} s2n_psk_hmac;
2961
2965struct s2n_psk;
2966
2975S2N_API struct s2n_psk *s2n_external_psk_new(void);
2976
2982S2N_API int s2n_psk_free(struct s2n_psk **psk);
2983
3001S2N_API int s2n_psk_set_identity(struct s2n_psk *psk, const uint8_t *identity, uint16_t identity_size);
3002
3019S2N_API int s2n_psk_set_secret(struct s2n_psk *psk, const uint8_t *secret, uint16_t secret_size);
3020
3028S2N_API int s2n_psk_set_hmac(struct s2n_psk *psk, s2n_psk_hmac hmac);
3029
3039S2N_API int s2n_connection_append_psk(struct s2n_connection *conn, struct s2n_psk *psk);
3040
3047typedef enum {
3048 S2N_PSK_MODE_RESUMPTION,
3049 S2N_PSK_MODE_EXTERNAL
3050} s2n_psk_mode;
3051
3059S2N_API int s2n_config_set_psk_mode(struct s2n_config *config, s2n_psk_mode mode);
3060
3069S2N_API int s2n_connection_set_psk_mode(struct s2n_connection *conn, s2n_psk_mode mode);
3070
3082S2N_API int s2n_connection_get_negotiated_psk_identity_length(struct s2n_connection *conn, uint16_t *identity_length);
3083
3100S2N_API int s2n_connection_get_negotiated_psk_identity(struct s2n_connection *conn, uint8_t *identity, uint16_t max_identity_length);
3101
3102struct s2n_offered_psk;
3103
3114S2N_API struct s2n_offered_psk *s2n_offered_psk_new(void);
3115
3121S2N_API int s2n_offered_psk_free(struct s2n_offered_psk **psk);
3122
3130S2N_API int s2n_offered_psk_get_identity(struct s2n_offered_psk *psk, uint8_t **identity, uint16_t *size);
3131
3132struct s2n_offered_psk_list;
3133
3146S2N_API bool s2n_offered_psk_list_has_next(struct s2n_offered_psk_list *psk_list);
3147
3155S2N_API int s2n_offered_psk_list_next(struct s2n_offered_psk_list *psk_list, struct s2n_offered_psk *psk);
3156
3165S2N_API int s2n_offered_psk_list_reread(struct s2n_offered_psk_list *psk_list);
3166
3178S2N_API int s2n_offered_psk_list_choose_psk(struct s2n_offered_psk_list *psk_list, struct s2n_offered_psk *psk);
3179
3194typedef int (*s2n_psk_selection_callback)(struct s2n_connection *conn, void *context,
3195 struct s2n_offered_psk_list *psk_list);
3196
3206S2N_API int s2n_config_set_psk_selection_callback(struct s2n_config *config, s2n_psk_selection_callback cb, void *context);
3207
3214S2N_API extern uint64_t s2n_connection_get_wire_bytes_in(struct s2n_connection *conn);
3215
3222S2N_API extern uint64_t s2n_connection_get_wire_bytes_out(struct s2n_connection *conn);
3223
3233S2N_API extern int s2n_connection_get_client_protocol_version(struct s2n_connection *conn);
3234
3244S2N_API extern int s2n_connection_get_server_protocol_version(struct s2n_connection *conn);
3245
3255S2N_API extern int s2n_connection_get_actual_protocol_version(struct s2n_connection *conn);
3256
3266S2N_API extern int s2n_connection_get_client_hello_version(struct s2n_connection *conn);
3267
3279S2N_API extern int s2n_client_hello_get_legacy_record_version(struct s2n_client_hello *ch, uint8_t *out);
3280
3288S2N_API extern int s2n_connection_client_cert_used(struct s2n_connection *conn);
3289
3303S2N_API extern const char *s2n_connection_get_cipher(struct s2n_connection *conn);
3304
3316typedef enum {
3317 S2N_SNI_NONE = 1,
3318 S2N_SNI_EXACT_MATCH,
3319 S2N_SNI_WILDCARD_MATCH,
3320 S2N_SNI_NO_MATCH,
3322
3335S2N_API extern int s2n_connection_get_certificate_match(struct s2n_connection *conn, s2n_cert_sni_match *match_status);
3336
3366S2N_API extern int s2n_connection_get_master_secret(const struct s2n_connection *conn,
3367 uint8_t *secret_bytes, size_t max_size);
3368
3379S2N_API extern int s2n_connection_tls_exporter(struct s2n_connection *conn,
3380 const uint8_t *label, uint32_t label_length, const uint8_t *context, uint32_t context_length,
3381 uint8_t *output, uint32_t output_length);
3382
3398S2N_API extern int s2n_connection_get_cipher_iana_value(struct s2n_connection *conn, uint8_t *first, uint8_t *second);
3399
3407S2N_API extern int s2n_connection_is_valid_for_cipher_preferences(struct s2n_connection *conn, const char *version);
3408
3417S2N_API extern const char *s2n_connection_get_curve(struct s2n_connection *conn);
3418
3429S2N_API extern const char *s2n_connection_get_kem_name(struct s2n_connection *conn);
3430
3441S2N_API extern const char *s2n_connection_get_kem_group_name(struct s2n_connection *conn);
3442
3455S2N_API extern int s2n_connection_get_key_exchange_group(struct s2n_connection *conn, const char **group_name);
3456
3464S2N_API extern int s2n_connection_get_alert(struct s2n_connection *conn);
3465
3472S2N_API extern const char *s2n_connection_get_handshake_type_name(struct s2n_connection *conn);
3473
3479S2N_API extern const char *s2n_connection_get_last_message_name(struct s2n_connection *conn);
3480
3484struct s2n_async_pkey_op;
3485
3494typedef enum {
3495 S2N_ASYNC_PKEY_VALIDATION_FAST,
3496 S2N_ASYNC_PKEY_VALIDATION_STRICT
3498
3502typedef enum {
3503 S2N_ASYNC_DECRYPT,
3504 S2N_ASYNC_SIGN
3506
3519typedef int (*s2n_async_pkey_fn)(struct s2n_connection *conn, struct s2n_async_pkey_op *op);
3520
3527S2N_API extern int s2n_config_set_async_pkey_callback(struct s2n_config *config, s2n_async_pkey_fn fn);
3528
3541S2N_API extern int s2n_async_pkey_op_perform(struct s2n_async_pkey_op *op, s2n_cert_private_key *key);
3542
3556S2N_API extern int s2n_async_pkey_op_apply(struct s2n_async_pkey_op *op, struct s2n_connection *conn);
3557
3567S2N_API extern int s2n_async_pkey_op_free(struct s2n_async_pkey_op *op);
3568
3577
3584S2N_API extern int s2n_async_pkey_op_get_op_type(struct s2n_async_pkey_op *op, s2n_async_pkey_op_type *type);
3585
3592S2N_API extern int s2n_async_pkey_op_get_input_size(struct s2n_async_pkey_op *op, uint32_t *data_len);
3593
3613S2N_API extern int s2n_async_pkey_op_get_input(struct s2n_async_pkey_op *op, uint8_t *data, uint32_t data_len);
3614
3626S2N_API extern int s2n_async_pkey_op_set_output(struct s2n_async_pkey_op *op, const uint8_t *data, uint32_t data_len);
3627
3647typedef int (*s2n_key_log_fn)(void *ctx, struct s2n_connection *conn, uint8_t *logline, size_t len);
3648
3666S2N_API extern int s2n_config_set_key_log_cb(struct s2n_config *config, s2n_key_log_fn callback, void *ctx);
3667
3674S2N_API extern int s2n_config_enable_cert_req_dss_legacy_compat(struct s2n_config *config);
3675
3686S2N_API int s2n_config_set_server_max_early_data_size(struct s2n_config *config, uint32_t max_early_data_size);
3687
3698S2N_API int s2n_connection_set_server_max_early_data_size(struct s2n_connection *conn, uint32_t max_early_data_size);
3699
3715S2N_API int s2n_connection_set_server_early_data_context(struct s2n_connection *conn, const uint8_t *context, uint16_t context_size);
3716
3732S2N_API int s2n_psk_configure_early_data(struct s2n_psk *psk, uint32_t max_early_data_size,
3733 uint8_t cipher_suite_first_byte, uint8_t cipher_suite_second_byte);
3734
3746S2N_API int s2n_psk_set_application_protocol(struct s2n_psk *psk, const uint8_t *application_protocol, uint8_t size);
3747
3759S2N_API int s2n_psk_set_early_data_context(struct s2n_psk *psk, const uint8_t *context, uint16_t size);
3760
3770typedef enum {
3771 S2N_EARLY_DATA_STATUS_OK,
3772 S2N_EARLY_DATA_STATUS_NOT_REQUESTED,
3773 S2N_EARLY_DATA_STATUS_REJECTED,
3774 S2N_EARLY_DATA_STATUS_END,
3776
3787
3799S2N_API int s2n_connection_get_remaining_early_data_size(struct s2n_connection *conn, uint32_t *allowed_early_data_size);
3800
3812S2N_API int s2n_connection_get_max_early_data_size(struct s2n_connection *conn, uint32_t *max_early_data_size);
3813
3828S2N_API int s2n_send_early_data(struct s2n_connection *conn, const uint8_t *data, ssize_t data_len,
3829 ssize_t *data_sent, s2n_blocked_status *blocked);
3830
3845S2N_API int s2n_recv_early_data(struct s2n_connection *conn, uint8_t *data, ssize_t max_data_len,
3846 ssize_t *data_received, s2n_blocked_status *blocked);
3847
3848struct s2n_offered_early_data;
3849
3867typedef int (*s2n_early_data_cb)(struct s2n_connection *conn, struct s2n_offered_early_data *early_data);
3868
3876S2N_API int s2n_config_set_early_data_cb(struct s2n_config *config, s2n_early_data_cb cb);
3877
3885S2N_API int s2n_offered_early_data_get_context_length(struct s2n_offered_early_data *early_data, uint16_t *context_len);
3886
3895S2N_API int s2n_offered_early_data_get_context(struct s2n_offered_early_data *early_data, uint8_t *context, uint16_t max_len);
3896
3903S2N_API int s2n_offered_early_data_reject(struct s2n_offered_early_data *early_data);
3904
3911S2N_API int s2n_offered_early_data_accept(struct s2n_offered_early_data *early_data);
3912
3938S2N_API int s2n_config_get_supported_groups(struct s2n_config *config, uint16_t *groups, uint16_t groups_count_max,
3939 uint16_t *groups_count);
3940
3941/* Indicates which serialized connection version will be provided. The default value is
3942 * S2N_SERIALIZED_CONN_NONE, which indicates the feature is off.
3943 */
3944typedef enum {
3945 S2N_SERIALIZED_CONN_NONE = 0,
3946 S2N_SERIALIZED_CONN_V1 = 1
3947} s2n_serialization_version;
3948
3961S2N_API int s2n_config_set_serialization_version(struct s2n_config *config, s2n_serialization_version version);
3962
3974S2N_API int s2n_connection_serialization_length(struct s2n_connection *conn, uint32_t *length);
3975
4012S2N_API int s2n_connection_serialize(struct s2n_connection *conn, uint8_t *buffer, uint32_t buffer_length);
4013
4037S2N_API int s2n_connection_deserialize(struct s2n_connection *conn, uint8_t *buffer, uint32_t buffer_length);
4038
4039/* Load all acceptable certificate authorities from the currently configured trust store.
4040 *
4041 * The loaded certificate authorities will be advertised during the handshake.
4042 * This can help your peer select a certificate if they have multiple certificate
4043 * chains available.
4044 *
4045 * For now, s2n-tls only supports advertising certificate authorities to support
4046 * client auth, so only servers will send the list of certificate authorities.
4047 *
4048 * To avoid configuration mistakes, certificate authorities cannot be loaded from
4049 * a trust store that includes the default system certificates. That means that
4050 * s2n_config_new_minimal or s2n_config_wipe_trust_store should be used.
4051 *
4052 * s2n-tls currently limits the total certificate authorities size to 10k bytes.
4053 * This method will fail if the certificate authorities retrieved from the trust
4054 * store exceed that limit.
4055 *
4056 * @param config A pointer to the s2n_config object.
4057 * @returns S2N_SUCCESS on success. S2N_FAILURE on failure.
4058 */
4059S2N_API int s2n_config_set_cert_authorities_from_trust_store(struct s2n_config *config);
4060
4061#ifdef __cplusplus
4062}
4063#endif
S2N_API int s2n_config_set_session_state_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs)
S2N_API int s2n_connection_append_psk(struct s2n_connection *conn, struct s2n_psk *psk)
S2N_API int s2n_async_pkey_op_get_input(struct s2n_async_pkey_op *op, uint8_t *data, uint32_t data_len)
struct s2n_cert_chain_and_key *(* s2n_cert_tiebreak_callback)(struct s2n_cert_chain_and_key *cert1, struct s2n_cert_chain_and_key *cert2, uint8_t *name, uint32_t name_len)
Definition: s2n.h:782
int s2n_client_hello_fn(struct s2n_connection *conn, void *ctx)
Definition: s2n.h:1422
S2N_API int s2n_psk_set_early_data_context(struct s2n_psk *psk, const uint8_t *context, uint16_t size)
S2N_API int s2n_offered_early_data_get_context(struct s2n_offered_early_data *early_data, uint8_t *context, uint16_t max_len)
S2N_API int s2n_config_set_verify_host_callback(struct s2n_config *config, s2n_verify_host_fn, void *data)
s2n_tls_hash_algorithm
Definition: s2n.h:2738
S2N_API int s2n_config_set_cert_tiebreak_callback(struct s2n_config *config, s2n_cert_tiebreak_callback cert_tiebreak_cb)
S2N_API int s2n_config_set_cache_retrieve_callback(struct s2n_config *config, s2n_cache_retrieve_callback cache_retrieve_callback, void *data)
S2N_API int s2n_connection_get_negotiated_psk_identity(struct s2n_connection *conn, uint8_t *identity, uint16_t max_identity_length)
int s2n_recv_fn(void *io_context, uint8_t *buf, uint32_t len)
Definition: s2n.h:1826
S2N_API int s2n_connection_add_new_tickets_to_send(struct s2n_connection *conn, uint8_t num)
int(* s2n_clock_time_nanoseconds)(void *, uint64_t *)
Definition: s2n.h:336
S2N_API int s2n_config_set_key_log_cb(struct s2n_config *config, s2n_key_log_fn callback, void *ctx)
S2N_API int s2n_connection_free_handshake(struct s2n_connection *conn)
S2N_API int s2n_config_set_client_hello_cb_mode(struct s2n_config *config, s2n_client_hello_cb_mode cb_mode)
S2N_API int s2n_cert_chain_and_key_load_public_pem_bytes(struct s2n_cert_chain_and_key *chain_and_key, uint8_t *chain_pem, uint32_t chain_pem_len)
S2N_API int s2n_config_send_max_fragment_length(struct s2n_config *config, s2n_max_frag_len mfl_code)
S2N_API int s2n_offered_psk_get_identity(struct s2n_offered_psk *psk, uint8_t **identity, uint16_t *size)
S2N_API int s2n_recv_early_data(struct s2n_connection *conn, uint8_t *data, ssize_t max_data_len, ssize_t *data_received, s2n_blocked_status *blocked)
S2N_API const char * s2n_strerror_name(int error)
S2N_API int s2n_connection_prefer_throughput(struct s2n_connection *conn)
S2N_API uint64_t s2n_connection_get_wire_bytes_out(struct s2n_connection *conn)
S2N_API int s2n_client_hello_get_server_name(struct s2n_client_hello *ch, uint8_t *server_name, uint16_t length, uint16_t *out_length)
S2N_API int s2n_connection_get_selected_digest_algorithm(struct s2n_connection *conn, s2n_tls_hash_algorithm *chosen_alg)
S2N_API int s2n_connection_get_read_fd(struct s2n_connection *conn, int *readfd)
s2n_max_frag_len
Definition: s2n.h:629
S2N_API struct s2n_offered_psk * s2n_offered_psk_new(void)
S2N_API ssize_t s2n_sendv_with_offset(struct s2n_connection *conn, const struct iovec *bufs, ssize_t count, ssize_t offs, s2n_blocked_status *blocked)
S2N_API uint32_t s2n_peek(struct s2n_connection *conn)
S2N_API int s2n_client_hello_has_extension(struct s2n_client_hello *ch, uint16_t extension_iana, bool *exists)
S2N_API const char * s2n_connection_get_kem_group_name(struct s2n_connection *conn)
S2N_API int s2n_connection_append_protocol_preference(struct s2n_connection *conn, const uint8_t *protocol, uint8_t protocol_len)
S2N_API int s2n_config_accept_max_fragment_length(struct s2n_config *config)
S2N_API int s2n_send_early_data(struct s2n_connection *conn, const uint8_t *data, ssize_t data_len, ssize_t *data_sent, s2n_blocked_status *blocked)
S2N_API int s2n_config_add_pem_to_trust_store(struct s2n_config *config, const char *pem)
S2N_API int s2n_connection_set_protocol_preferences(struct s2n_connection *conn, const char *const *protocols, int protocol_count)
S2N_API bool s2n_offered_psk_list_has_next(struct s2n_offered_psk_list *psk_list)
S2N_API int s2n_config_set_psk_mode(struct s2n_config *config, s2n_psk_mode mode)
S2N_API int s2n_psk_configure_early_data(struct s2n_psk *psk, uint32_t max_early_data_size, uint8_t cipher_suite_first_byte, uint8_t cipher_suite_second_byte)
S2N_API int s2n_config_enable_cert_req_dss_legacy_compat(struct s2n_config *config)
S2N_API int s2n_config_get_client_auth_type(struct s2n_config *config, s2n_cert_auth_type *client_auth_type)
S2N_API int s2n_config_set_extension_data(struct s2n_config *config, s2n_tls_extension_type type, const uint8_t *data, uint32_t length)
S2N_API const char * s2n_get_server_name(struct s2n_connection *conn)
S2N_API int s2n_offered_early_data_reject(struct s2n_offered_early_data *early_data)
S2N_API int s2n_connection_get_session_id(struct s2n_connection *conn, uint8_t *session_id, size_t max_length)
S2N_API int s2n_connection_client_cert_used(struct s2n_connection *conn)
S2N_API __thread int s2n_errno
S2N_API int s2n_config_set_async_pkey_callback(struct s2n_config *config, s2n_async_pkey_fn fn)
S2N_API int s2n_config_append_protocol_preference(struct s2n_config *config, const uint8_t *protocol, uint8_t protocol_len)
int(* s2n_async_pkey_fn)(struct s2n_connection *conn, struct s2n_async_pkey_op *op)
Definition: s2n.h:3519
S2N_API int s2n_config_set_cert_chain_and_key_defaults(struct s2n_config *config, struct s2n_cert_chain_and_key **cert_key_pairs, uint32_t num_cert_key_pairs)
S2N_API int s2n_connection_get_selected_client_cert_digest_algorithm(struct s2n_connection *conn, s2n_tls_hash_algorithm *chosen_alg)
S2N_API int s2n_cert_chain_get_length(const struct s2n_cert_chain_and_key *chain_and_key, uint32_t *cert_length)
s2n_blinding
Definition: s2n.h:2070
S2N_API int s2n_connection_get_selected_signature_algorithm(struct s2n_connection *conn, s2n_tls_signature_algorithm *chosen_alg)
S2N_API int s2n_print_stacktrace(FILE *fptr)
S2N_API int s2n_connection_set_server_keying_material_lifetime(struct s2n_connection *conn, uint32_t lifetime_in_secs)
int(* s2n_psk_selection_callback)(struct s2n_connection *conn, void *context, struct s2n_offered_psk_list *psk_list)
Definition: s2n.h:3194
S2N_API int s2n_config_set_status_request_type(struct s2n_config *config, s2n_status_request_type type)
S2N_API uint64_t s2n_connection_get_wire_bytes_in(struct s2n_connection *conn)
s2n_cert_sni_match
Definition: s2n.h:3316
S2N_API int s2n_psk_set_application_protocol(struct s2n_psk *psk, const uint8_t *application_protocol, uint8_t size)
S2N_API int s2n_config_set_cipher_preferences(struct s2n_config *config, const char *version)
s2n_async_pkey_validation_mode
Definition: s2n.h:3494
S2N_API ssize_t s2n_recv(struct s2n_connection *conn, void *buf, ssize_t size, s2n_blocked_status *blocked)
S2N_API struct s2n_cert_chain_and_key * s2n_cert_chain_and_key_new(void)
s2n_psk_mode
Definition: s2n.h:3047
S2N_API int s2n_config_load_system_certs(struct s2n_config *config)
S2N_API int s2n_async_pkey_op_apply(struct s2n_async_pkey_op *op, struct s2n_connection *conn)
S2N_API int s2n_config_free(struct s2n_config *config)
S2N_API int s2n_connection_get_negotiated_psk_identity_length(struct s2n_connection *conn, uint16_t *identity_length)
S2N_API int s2n_init(void)
s2n_error_type
Definition: s2n.h:150
@ S2N_ERR_T_OK
Definition: s2n.h:152
@ S2N_ERR_T_CLOSED
Definition: s2n.h:156
@ S2N_ERR_T_USAGE
Definition: s2n.h:166
@ S2N_ERR_T_ALERT
Definition: s2n.h:160
@ S2N_ERR_T_INTERNAL
Definition: s2n.h:164
@ S2N_ERR_T_IO
Definition: s2n.h:154
@ S2N_ERR_T_BLOCKED
Definition: s2n.h:158
@ S2N_ERR_T_PROTO
Definition: s2n.h:162
S2N_API int s2n_connection_get_selected_client_cert_signature_algorithm(struct s2n_connection *conn, s2n_tls_signature_algorithm *chosen_alg)
S2N_API int s2n_client_hello_get_server_name_length(struct s2n_client_hello *ch, uint16_t *length)
S2N_API int s2n_config_set_wall_clock(struct s2n_config *config, s2n_clock_time_nanoseconds clock_fn, void *ctx)
S2N_API int s2n_connection_set_send_ctx(struct s2n_connection *conn, void *ctx)
S2N_API int s2n_psk_set_hmac(struct s2n_psk *psk, s2n_psk_hmac hmac)
int(* s2n_key_log_fn)(void *ctx, struct s2n_connection *conn, uint8_t *logline, size_t len)
Definition: s2n.h:3647
S2N_API int s2n_cert_chain_and_key_set_ctx(struct s2n_cert_chain_and_key *cert_and_key, void *ctx)
int(* s2n_rand_mix_callback)(void *data, uint32_t size)
Definition: s2n.h:592
S2N_API int s2n_connection_set_send_cb(struct s2n_connection *conn, s2n_send_fn send)
S2N_API ssize_t s2n_client_hello_get_raw_message_length(struct s2n_client_hello *ch)
S2N_API int s2n_config_set_initial_ticket_count(struct s2n_config *config, uint8_t num)
S2N_API s2n_cert_private_key * s2n_cert_chain_and_key_get_private_key(struct s2n_cert_chain_and_key *cert_and_key)
S2N_API int s2n_connection_set_dynamic_buffers(struct s2n_connection *conn, bool enabled)
S2N_API int s2n_cert_chain_and_key_load_pem_bytes(struct s2n_cert_chain_and_key *chain_and_key, uint8_t *chain_pem, uint32_t chain_pem_len, uint8_t *private_key_pem, uint32_t private_key_pem_len)
S2N_API int s2n_config_set_ticket_encrypt_decrypt_key_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs)
S2N_API int s2n_connection_get_alert(struct s2n_connection *conn)
S2N_API void * s2n_cert_chain_and_key_get_ctx(struct s2n_cert_chain_and_key *cert_and_key)
S2N_API int s2n_connection_get_tickets_sent(struct s2n_connection *conn, uint16_t *num)
int(* s2n_cache_retrieve_callback)(struct s2n_connection *conn, void *, const void *key, uint64_t key_size, void *value, uint64_t *value_size)
Definition: s2n.h:358
S2N_API const char * s2n_strerror(int error, const char *lang)
S2N_API struct s2n_connection * s2n_connection_new(s2n_mode mode)
S2N_API int s2n_config_set_alert_behavior(struct s2n_config *config, s2n_alert_behavior alert_behavior)
S2N_API int s2n_config_set_ticket_decrypt_key_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs)
S2N_API int s2n_config_free_dhparams(struct s2n_config *config)
S2N_API int s2n_session_ticket_get_lifetime(struct s2n_session_ticket *ticket, uint32_t *session_lifetime)
S2N_API ssize_t s2n_client_hello_get_extension_by_id(struct s2n_client_hello *ch, s2n_tls_extension_type extension_type, uint8_t *out, uint32_t max_length)
S2N_API int s2n_offered_psk_list_choose_psk(struct s2n_offered_psk_list *psk_list, struct s2n_offered_psk *psk)
S2N_API const char * s2n_connection_get_kem_name(struct s2n_connection *conn)
S2N_API int s2n_connection_serialize(struct s2n_connection *conn, uint8_t *buffer, uint32_t buffer_length)
S2N_API const uint8_t * s2n_connection_get_sct_list(struct s2n_connection *conn, uint32_t *length)
S2N_API int s2n_connection_get_client_cert_chain(struct s2n_connection *conn, uint8_t **der_cert_chain_out, uint32_t *cert_chain_len)
S2N_API int s2n_config_add_cert_chain_and_key(struct s2n_config *config, const char *cert_chain_pem, const char *private_key_pem)
S2N_API int s2n_config_set_ct_support_level(struct s2n_config *config, s2n_ct_support_level level)
S2N_API int s2n_config_set_serialization_version(struct s2n_config *config, s2n_serialization_version version)
S2N_API int s2n_connection_set_server_max_early_data_size(struct s2n_connection *conn, uint32_t max_early_data_size)
S2N_API int s2n_psk_set_identity(struct s2n_psk *psk, const uint8_t *identity, uint16_t identity_size)
S2N_API int s2n_mem_set_callbacks(s2n_mem_init_callback mem_init_callback, s2n_mem_cleanup_callback mem_cleanup_callback, s2n_mem_malloc_callback mem_malloc_callback, s2n_mem_free_callback mem_free_callback)
S2N_API int s2n_offered_early_data_accept(struct s2n_offered_early_data *early_data)
S2N_API int s2n_connection_set_fd(struct s2n_connection *conn, int fd)
S2N_API int s2n_connection_set_recv_ctx(struct s2n_connection *conn, void *ctx)
S2N_API int s2n_connection_get_actual_protocol_version(struct s2n_connection *conn)
S2N_API int s2n_connection_set_blinding(struct s2n_connection *conn, s2n_blinding blinding)
S2N_API int s2n_client_hello_get_supported_groups(struct s2n_client_hello *ch, uint16_t *groups, uint16_t groups_count_max, uint16_t *groups_count)
S2N_API int s2n_connection_set_recv_cb(struct s2n_connection *conn, s2n_recv_fn recv)
struct s2n_pkey s2n_cert_public_key
Definition: s2n.h:654
S2N_API int s2n_cleanup(void)
S2N_API int s2n_config_set_send_buffer_size(struct s2n_config *config, uint32_t size)
int(* s2n_mem_free_callback)(void *ptr, uint32_t size)
Definition: s2n.h:558
int(* s2n_rand_cleanup_callback)(void)
Definition: s2n.h:582
int(* s2n_mem_init_callback)(void)
Definition: s2n.h:538
S2N_API int s2n_connection_server_name_extension_used(struct s2n_connection *conn)
S2N_API ssize_t s2n_sendv(struct s2n_connection *conn, const struct iovec *bufs, ssize_t count, s2n_blocked_status *blocked)
S2N_API int s2n_config_set_session_cache_onoff(struct s2n_config *config, uint8_t enabled)
S2N_API int s2n_connection_get_certificate_match(struct s2n_connection *conn, s2n_cert_sni_match *match_status)
S2N_API int s2n_async_pkey_op_set_output(struct s2n_async_pkey_op *op, const uint8_t *data, uint32_t data_len)
S2N_API int s2n_client_hello_get_compression_methods_length(struct s2n_client_hello *ch, uint32_t *out_length)
S2N_API int s2n_connection_set_server_early_data_context(struct s2n_connection *conn, const uint8_t *context, uint16_t context_size)
S2N_API int s2n_free_stacktrace(void)
s2n_mode
Definition: s2n.h:1368
S2N_API int s2n_connection_deserialize(struct s2n_connection *conn, uint8_t *buffer, uint32_t buffer_length)
s2n_client_hello_cb_mode
Definition: s2n.h:1431
S2N_API int s2n_config_set_monotonic_clock(struct s2n_config *config, s2n_clock_time_nanoseconds clock_fn, void *ctx)
S2N_API int s2n_get_stacktrace(struct s2n_stacktrace *trace)
S2N_API int s2n_config_set_async_pkey_validation_mode(struct s2n_config *config, s2n_async_pkey_validation_mode mode)
S2N_API int s2n_cert_chain_and_key_free(struct s2n_cert_chain_and_key *cert_and_key)
s2n_status_request_type
Definition: s2n.h:1157
S2N_API int s2n_psk_free(struct s2n_psk **psk)
S2N_API int s2n_connection_get_server_protocol_version(struct s2n_connection *conn)
S2N_API int s2n_connection_get_remaining_early_data_size(struct s2n_connection *conn, uint32_t *allowed_early_data_size)
S2N_API int s2n_client_hello_get_session_id_length(struct s2n_client_hello *ch, uint32_t *out_length)
S2N_API int s2n_connection_set_write_fd(struct s2n_connection *conn, int writefd)
S2N_API int s2n_connection_request_key_update(struct s2n_connection *conn, s2n_peer_key_update peer_request)
S2N_API int s2n_config_set_cache_delete_callback(struct s2n_config *config, s2n_cache_delete_callback cache_delete_callback, void *data)
S2N_API ssize_t s2n_client_hello_get_cipher_suites_length(struct s2n_client_hello *ch)
S2N_API int s2n_config_require_ticket_forward_secrecy(struct s2n_config *config, bool enabled)
S2N_API int s2n_cert_get_utf8_string_from_extension_data_length(const uint8_t *extension_data, uint32_t extension_len, uint32_t *utf8_str_len)
S2N_API int s2n_config_set_verification_ca_location(struct s2n_config *config, const char *ca_pem_filename, const char *ca_dir)
s2n_psk_hmac
Definition: s2n.h:2957
S2N_API const char * s2n_connection_get_handshake_type_name(struct s2n_connection *conn)
S2N_API int s2n_config_free_cert_chain_and_key(struct s2n_config *config)
S2N_API int s2n_config_set_recv_multi_record(struct s2n_config *config, bool enabled)
s2n_cert_auth_type
Definition: s2n.h:2457
int(* s2n_session_ticket_fn)(struct s2n_connection *conn, void *ctx, struct s2n_session_ticket *ticket)
Definition: s2n.h:2580
S2N_API const char * s2n_strerror_source(int error)
S2N_API int s2n_connection_get_session_ticket_lifetime_hint(struct s2n_connection *conn)
uint8_t(* s2n_verify_host_fn)(const char *host_name, size_t host_name_len, void *data)
Definition: s2n.h:1003
S2N_API const uint8_t * s2n_connection_get_ocsp_response(struct s2n_connection *conn, uint32_t *length)
S2N_API int s2n_offered_psk_list_next(struct s2n_offered_psk_list *psk_list, struct s2n_offered_psk *psk)
S2N_API int s2n_config_set_cache_store_callback(struct s2n_config *config, s2n_cache_store_callback cache_store_callback, void *data)
S2N_API int s2n_offered_early_data_get_context_length(struct s2n_offered_early_data *early_data, uint16_t *context_len)
S2N_API int s2n_connection_get_max_early_data_size(struct s2n_connection *conn, uint32_t *max_early_data_size)
S2N_API int s2n_offered_psk_free(struct s2n_offered_psk **psk)
S2N_API int s2n_config_add_dhparams(struct s2n_config *config, const char *dhparams_pem)
int(* s2n_mem_malloc_callback)(void **ptr, uint32_t requested, uint32_t *allocated)
Definition: s2n.h:553
S2N_API int s2n_connection_get_write_fd(struct s2n_connection *conn, int *writefd)
S2N_API int s2n_connection_use_corked_io(struct s2n_connection *conn)
S2N_API int s2n_config_set_client_auth_type(struct s2n_config *config, s2n_cert_auth_type client_auth_type)
S2N_API int s2n_async_pkey_op_free(struct s2n_async_pkey_op *op)
S2N_API int s2n_connection_serialization_length(struct s2n_connection *conn, uint32_t *length)
s2n_tls_signature_algorithm
Definition: s2n.h:2724
S2N_API int s2n_config_set_protocol_preferences(struct s2n_config *config, const char *const *protocols, int protocol_count)
S2N_API int s2n_config_set_ctx(struct s2n_config *config, void *ctx)
S2N_API int s2n_stack_traces_enabled_set(bool newval)
struct s2n_pkey s2n_cert_private_key
Definition: s2n.h:659
S2N_API ssize_t s2n_send(struct s2n_connection *conn, const void *buf, ssize_t size, s2n_blocked_status *blocked)
S2N_API int s2n_connection_prefer_low_latency(struct s2n_connection *conn)
S2N_API int s2n_cert_chain_and_key_set_ocsp_data(struct s2n_cert_chain_and_key *chain_and_key, const uint8_t *data, uint32_t length)
S2N_API ssize_t s2n_client_hello_get_extensions_length(struct s2n_client_hello *ch)
S2N_API int s2n_connection_free(struct s2n_connection *conn)
S2N_API uint32_t s2n_peek_buffered(struct s2n_connection *conn)
S2N_API int s2n_config_set_verify_after_sign(struct s2n_config *config, s2n_verify_after_sign mode)
S2N_API struct s2n_cert_chain_and_key * s2n_connection_get_selected_cert(struct s2n_connection *conn)
S2N_API int s2n_async_pkey_op_get_op_type(struct s2n_async_pkey_op *op, s2n_async_pkey_op_type *type)
S2N_API int s2n_config_set_max_blinding_delay(struct s2n_config *config, uint32_t seconds)
S2N_API int s2n_connection_get_client_auth_type(struct s2n_connection *conn, s2n_cert_auth_type *client_auth_type)
S2N_API int s2n_connection_set_read_fd(struct s2n_connection *conn, int readfd)
S2N_API int s2n_config_set_session_ticket_cb(struct s2n_config *config, s2n_session_ticket_fn callback, void *ctx)
s2n_peer_key_update
Definition: s2n.h:2134
S2N_API int s2n_config_disable_x509_verification(struct s2n_config *config)
S2N_API int s2n_config_set_client_hello_cb(struct s2n_config *config, s2n_client_hello_fn client_hello_callback, void *ctx)
S2N_API struct s2n_client_hello * s2n_client_hello_parse_message(const uint8_t *bytes, uint32_t size)
S2N_API struct s2n_config * s2n_config_new(void)
S2N_API int s2n_connection_set_session(struct s2n_connection *conn, const uint8_t *session, size_t length)
S2N_API int s2n_connection_get_client_protocol_version(struct s2n_connection *conn)
S2N_API int s2n_connection_get_session_length(struct s2n_connection *conn)
s2n_early_data_status_t
Definition: s2n.h:3770
S2N_API struct s2n_psk * s2n_external_psk_new(void)
s2n_tls_extension_type
Definition: s2n.h:613
S2N_API int s2n_config_get_ctx(struct s2n_config *config, void **ctx)
S2N_API int s2n_connection_set_cipher_preferences(struct s2n_connection *conn, const char *version)
S2N_API struct s2n_config * s2n_config_new_minimal(void)
S2N_API int s2n_cert_get_x509_extension_value(struct s2n_cert *cert, const uint8_t *oid, uint8_t *ext_value, uint32_t *ext_value_len, bool *critical)
S2N_API ssize_t s2n_client_hello_get_cipher_suites(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length)
S2N_API uint64_t s2n_connection_get_delay(struct s2n_connection *conn)
s2n_alert_behavior
Definition: s2n.h:1206
S2N_API ssize_t s2n_client_hello_get_extension_length(struct s2n_client_hello *ch, s2n_tls_extension_type extension_type)
S2N_API int s2n_connection_set_psk_mode(struct s2n_connection *conn, s2n_psk_mode mode)
S2N_API int s2n_config_disable_x509_time_verification(struct s2n_config *config)
S2N_API int s2n_connection_get_cipher_iana_value(struct s2n_connection *conn, uint8_t *first, uint8_t *second)
S2N_API int s2n_connection_set_ctx(struct s2n_connection *conn, void *ctx)
S2N_API int s2n_connection_set_config(struct s2n_connection *conn, struct s2n_config *config)
S2N_API const char * s2n_strerror_debug(int error, const char *lang)
S2N_API int s2n_connection_get_early_data_status(struct s2n_connection *conn, s2n_early_data_status_t *status)
S2N_API int s2n_config_set_server_max_early_data_size(struct s2n_config *config, uint32_t max_early_data_size)
S2N_API int s2n_config_add_cert_chain_and_key_to_store(struct s2n_config *config, struct s2n_cert_chain_and_key *cert_key_pair)
S2N_API struct s2n_client_hello * s2n_connection_get_client_hello(struct s2n_connection *conn)
S2N_API ssize_t s2n_client_hello_get_raw_message(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length)
S2N_API int s2n_offered_psk_list_reread(struct s2n_offered_psk_list *psk_list)
S2N_API int s2n_config_set_early_data_cb(struct s2n_config *config, s2n_early_data_cb cb)
S2N_API int s2n_connection_is_valid_for_cipher_preferences(struct s2n_connection *conn, const char *version)
S2N_API int s2n_crypto_disable_init(void)
S2N_API int s2n_cert_get_x509_extension_value_length(struct s2n_cert *cert, const uint8_t *oid, uint32_t *ext_value_len)
int(* s2n_cache_delete_callback)(struct s2n_connection *conn, void *, const void *key, uint64_t key_size)
Definition: s2n.h:385
S2N_API int s2n_connection_get_session_id_length(struct s2n_connection *conn)
S2N_API int s2n_config_get_supported_groups(struct s2n_config *config, uint16_t *groups, uint16_t groups_count_max, uint16_t *groups_count)
S2N_API bool s2n_stack_traces_enabled(void)
S2N_API int s2n_connection_set_client_auth_type(struct s2n_connection *conn, s2n_cert_auth_type client_auth_type)
S2N_API void * s2n_connection_get_ctx(struct s2n_connection *conn)
S2N_API int s2n_connection_get_client_hello_version(struct s2n_connection *conn)
S2N_API int s2n_client_hello_get_legacy_record_version(struct s2n_client_hello *ch, uint8_t *out)
S2N_API int s2n_negotiate(struct s2n_connection *conn, s2n_blocked_status *blocked)
S2N_API int s2n_connection_get_master_secret(const struct s2n_connection *conn, uint8_t *secret_bytes, size_t max_size)
S2N_API int s2n_connection_set_verify_host_callback(struct s2n_connection *conn, s2n_verify_host_fn host_fn, void *data)
S2N_API int s2n_cert_chain_and_key_set_sct_list(struct s2n_cert_chain_and_key *chain_and_key, const uint8_t *data, uint32_t length)
S2N_API int s2n_client_hello_free(struct s2n_client_hello **ch)
S2N_API int s2n_connection_get_key_exchange_group(struct s2n_connection *conn, const char **group_name)
int s2n_send_fn(void *io_context, const uint8_t *buf, uint32_t len)
Definition: s2n.h:1831
S2N_API int s2n_psk_set_secret(struct s2n_psk *psk, const uint8_t *secret, uint16_t secret_size)
int(* s2n_cache_store_callback)(struct s2n_connection *conn, void *, uint64_t ttl_in_seconds, const void *key, uint64_t key_size, const void *value, uint64_t value_size)
Definition: s2n.h:373
int(* s2n_rand_init_callback)(void)
Definition: s2n.h:577
S2N_API int s2n_async_pkey_op_get_input_size(struct s2n_async_pkey_op *op, uint32_t *data_len)
S2N_API int s2n_client_hello_get_compression_methods(struct s2n_client_hello *ch, uint8_t *list, uint32_t list_length, uint32_t *out_length)
S2N_API int s2n_config_set_max_cert_chain_depth(struct s2n_config *config, uint16_t max_depth)
S2N_API int s2n_calculate_stacktrace(void)
S2N_API int s2n_client_hello_get_random(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length)
S2N_API int s2n_connection_set_dynamic_record_threshold(struct s2n_connection *conn, uint32_t resize_threshold, uint16_t timeout_threshold)
S2N_API int s2n_connection_is_ocsp_stapled(struct s2n_connection *conn)
int(* s2n_early_data_cb)(struct s2n_connection *conn, struct s2n_offered_early_data *early_data)
Definition: s2n.h:3867
S2N_API int s2n_connection_get_session(struct s2n_connection *conn, uint8_t *session, size_t max_length)
S2N_API int s2n_get_fips_mode(s2n_fips_mode *fips_mode)
S2N_API int s2n_connection_set_recv_buffering(struct s2n_connection *conn, bool enabled)
S2N_API int s2n_connection_is_session_resumed(struct s2n_connection *conn)
S2N_API int s2n_connection_wipe(struct s2n_connection *conn)
S2N_API const char * s2n_get_application_protocol(struct s2n_connection *conn)
int(* s2n_mem_cleanup_callback)(void)
Definition: s2n.h:543
S2N_API int s2n_config_add_ticket_crypto_key(struct s2n_config *config, const uint8_t *name, uint32_t name_len, uint8_t *key, uint32_t key_len, uint64_t intro_time_in_seconds_from_epoch)
int(* s2n_rand_seed_callback)(void *data, uint32_t size)
Definition: s2n.h:587
S2N_API int s2n_client_hello_get_session_id(struct s2n_client_hello *ch, uint8_t *out, uint32_t *out_length, uint32_t max_length)
S2N_API ssize_t s2n_client_hello_get_extensions(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length)
S2N_API int s2n_connection_tls_exporter(struct s2n_connection *conn, const uint8_t *label, uint32_t label_length, const uint8_t *context, uint32_t context_length, uint8_t *output, uint32_t output_length)
s2n_ct_support_level
Definition: s2n.h:1182
S2N_API int s2n_async_pkey_op_perform(struct s2n_async_pkey_op *op, s2n_cert_private_key *key)
S2N_API int s2n_connection_get_peer_cert_chain(const struct s2n_connection *conn, struct s2n_cert_chain_and_key *cert_chain)
S2N_API int s2n_disable_atexit(void)
S2N_API int s2n_config_set_psk_selection_callback(struct s2n_config *config, s2n_psk_selection_callback cb, void *context)
S2N_API int s2n_error_get_type(int error)
S2N_API int s2n_shutdown_send(struct s2n_connection *conn, s2n_blocked_status *blocked)
S2N_API const char * s2n_connection_get_cipher(struct s2n_connection *conn)
s2n_async_pkey_op_type
Definition: s2n.h:3502
S2N_API int s2n_cert_chain_and_key_load_pem(struct s2n_cert_chain_and_key *chain_and_key, const char *chain_pem, const char *private_key_pem)
S2N_API int s2n_client_hello_get_legacy_protocol_version(struct s2n_client_hello *ch, uint8_t *out)
S2N_API unsigned long s2n_get_openssl_version(void)
#define S2N_API
Definition: s2n.h:29
S2N_API const char * s2n_connection_get_last_message_name(struct s2n_connection *conn)
S2N_API int s2n_rand_set_callbacks(s2n_rand_init_callback rand_init_callback, s2n_rand_cleanup_callback rand_cleanup_callback, s2n_rand_seed_callback rand_seed_callback, s2n_rand_mix_callback rand_mix_callback)
S2N_API int s2n_connection_get_signature_scheme(struct s2n_connection *conn, const char **scheme_name)
S2N_API int s2n_set_server_name(struct s2n_connection *conn, const char *server_name)
S2N_API int s2n_client_hello_cb_done(struct s2n_connection *conn)
S2N_API const char * s2n_connection_get_curve(struct s2n_connection *conn)
s2n_blocked_status
Definition: s2n.h:2240
S2N_API int s2n_config_wipe_trust_store(struct s2n_config *config)
S2N_API int s2n_cert_get_utf8_string_from_extension_data(const uint8_t *extension_data, uint32_t extension_len, uint8_t *out_data, uint32_t *out_len)
S2N_API int s2n_connection_release_buffers(struct s2n_connection *conn)
S2N_API int s2n_session_ticket_get_data(struct s2n_session_ticket *ticket, size_t max_data_len, uint8_t *data)
S2N_API int s2n_config_set_session_tickets_onoff(struct s2n_config *config, uint8_t enabled)
S2N_API int * s2n_errno_location(void)
S2N_API int s2n_session_ticket_get_data_len(struct s2n_session_ticket *ticket, size_t *data_len)
S2N_API int s2n_cert_chain_get_cert(const struct s2n_cert_chain_and_key *chain_and_key, struct s2n_cert **out_cert, const uint32_t cert_idx)
S2N_API int s2n_shutdown(struct s2n_connection *conn, s2n_blocked_status *blocked)
S2N_API int s2n_cert_get_der(const struct s2n_cert *cert, const uint8_t **out_cert_der, uint32_t *cert_length)
S2N_API int s2n_config_set_check_stapled_ocsp_response(struct s2n_config *config, uint8_t check_ocsp)