AWS s2n-tls  PROJECT_NUMBER_PLACEHOLDER
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.
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
26 
29  #define S2N_API
30 #endif
31 
32 #ifdef __cplusplus
33 extern "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 */
44 struct iovec {
45  void *iov_base;
46  size_t iov_len;
47 };
48 #endif
49 
53 #define S2N_SUCCESS 0
54 
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 
126 S2N_API extern __thread int s2n_errno;
127 
134 S2N_API extern int *s2n_errno_location(void);
135 
150 typedef enum {
168 
179 S2N_API extern int s2n_error_get_type(int error);
180 
184 struct s2n_config;
185 
189 struct s2n_connection;
190 
205 S2N_API extern int s2n_crypto_disable_init(void);
206 
219 S2N_API extern int s2n_disable_atexit(void);
220 
227 S2N_API extern unsigned long s2n_get_openssl_version(void);
228 
237 S2N_API extern int s2n_init(void);
238 
246 S2N_API extern int s2n_cleanup(void);
247 
253 S2N_API extern int s2n_cleanup_final(void);
254 
258 typedef enum {
259  S2N_FIPS_MODE_DISABLED = 0,
260  S2N_FIPS_MODE_ENABLED,
261 } s2n_fips_mode;
262 
277 S2N_API extern int s2n_get_fips_mode(s2n_fips_mode *fips_mode);
278 
291 S2N_API extern struct s2n_config *s2n_config_new(void);
292 
306 S2N_API extern struct s2n_config *s2n_config_new_minimal(void);
307 
314 S2N_API extern int s2n_config_free(struct s2n_config *config);
315 
322 S2N_API extern int s2n_config_free_dhparams(struct s2n_config *config);
323 
330 S2N_API extern int s2n_config_free_cert_chain_and_key(struct s2n_config *config);
331 
337 typedef int (*s2n_clock_time_nanoseconds)(void *, uint64_t *);
338 
359 typedef int (*s2n_cache_retrieve_callback)(struct s2n_connection *conn, void *, const void *key, uint64_t key_size, void *value, uint64_t *value_size);
360 
374 typedef 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);
375 
386 typedef int (*s2n_cache_delete_callback)(struct s2n_connection *conn, void *, const void *key, uint64_t key_size);
387 
400 S2N_API extern int s2n_config_set_wall_clock(struct s2n_config *config, s2n_clock_time_nanoseconds clock_fn, void *ctx);
401 
414 S2N_API extern int s2n_config_set_monotonic_clock(struct s2n_config *config, s2n_clock_time_nanoseconds clock_fn, void *ctx);
415 
423 S2N_API extern const char *s2n_strerror(int error, const char *lang);
424 
434 S2N_API extern const char *s2n_strerror_debug(int error, const char *lang);
435 
442 S2N_API extern const char *s2n_strerror_name(int error);
443 
450 S2N_API extern const char *s2n_strerror_source(int error);
451 
455 struct s2n_stacktrace;
456 
462 S2N_API extern bool s2n_stack_traces_enabled(void);
463 
470 S2N_API extern int s2n_stack_traces_enabled_set(bool newval);
471 
477 S2N_API extern int s2n_calculate_stacktrace(void);
478 
486 S2N_API extern int s2n_print_stacktrace(FILE *fptr);
487 
493 S2N_API extern int s2n_free_stacktrace(void);
494 
501 S2N_API extern int s2n_get_stacktrace(struct s2n_stacktrace *trace);
502 
512 S2N_API extern int s2n_config_set_cache_store_callback(struct s2n_config *config, s2n_cache_store_callback cache_store_callback, void *data);
513 
523 S2N_API extern int s2n_config_set_cache_retrieve_callback(struct s2n_config *config, s2n_cache_retrieve_callback cache_retrieve_callback, void *data);
524 
534 S2N_API extern int s2n_config_set_cache_delete_callback(struct s2n_config *config, s2n_cache_delete_callback cache_delete_callback, void *data);
535 
539 typedef int (*s2n_mem_init_callback)(void);
540 
544 typedef int (*s2n_mem_cleanup_callback)(void);
545 
554 typedef int (*s2n_mem_malloc_callback)(void **ptr, uint32_t requested, uint32_t *allocated);
555 
559 typedef int (*s2n_mem_free_callback)(void *ptr, uint32_t size);
560 
572 S2N_API extern int s2n_mem_set_callbacks(s2n_mem_init_callback mem_init_callback, s2n_mem_cleanup_callback mem_cleanup_callback,
573  s2n_mem_malloc_callback mem_malloc_callback, s2n_mem_free_callback mem_free_callback);
574 
578 typedef int (*s2n_rand_init_callback)(void);
579 
583 typedef int (*s2n_rand_cleanup_callback)(void);
584 
588 typedef int (*s2n_rand_seed_callback)(void *data, uint32_t size);
589 
593 typedef int (*s2n_rand_mix_callback)(void *data, uint32_t size);
594 
608 S2N_API extern int s2n_rand_set_callbacks(s2n_rand_init_callback rand_init_callback, s2n_rand_cleanup_callback rand_cleanup_callback,
609  s2n_rand_seed_callback rand_seed_callback, s2n_rand_mix_callback rand_mix_callback);
610 
614 typedef enum {
615  S2N_EXTENSION_SERVER_NAME = 0,
616  S2N_EXTENSION_MAX_FRAG_LEN = 1,
617  S2N_EXTENSION_OCSP_STAPLING = 5,
618  S2N_EXTENSION_SUPPORTED_GROUPS = 10,
619  S2N_EXTENSION_EC_POINT_FORMATS = 11,
620  S2N_EXTENSION_SIGNATURE_ALGORITHMS = 13,
621  S2N_EXTENSION_ALPN = 16,
622  S2N_EXTENSION_CERTIFICATE_TRANSPARENCY = 18,
623  S2N_EXTENSION_SUPPORTED_VERSIONS = 43,
624  S2N_EXTENSION_RENEGOTIATION_INFO = 65281,
626 
630 typedef enum {
631  S2N_TLS_MAX_FRAG_LEN_512 = 1,
632  S2N_TLS_MAX_FRAG_LEN_1024 = 2,
633  S2N_TLS_MAX_FRAG_LEN_2048 = 3,
634  S2N_TLS_MAX_FRAG_LEN_4096 = 4,
636 
640 struct s2n_cert;
641 
645 struct s2n_cert_chain_and_key;
646 
650 struct s2n_pkey;
651 
655 typedef struct s2n_pkey s2n_cert_public_key;
656 
660 typedef struct s2n_pkey s2n_cert_private_key;
661 
668 S2N_API extern struct s2n_cert_chain_and_key *s2n_cert_chain_and_key_new(void);
669 
685 S2N_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);
686 
702 S2N_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);
703 
715 S2N_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);
716 
723 S2N_API extern int s2n_cert_chain_and_key_free(struct s2n_cert_chain_and_key *cert_and_key);
724 
732 S2N_API extern int s2n_cert_chain_and_key_set_ctx(struct s2n_cert_chain_and_key *cert_and_key, void *ctx);
733 
740 S2N_API extern void *s2n_cert_chain_and_key_get_ctx(struct s2n_cert_chain_and_key *cert_and_key);
741 
748 S2N_API extern s2n_cert_private_key *s2n_cert_chain_and_key_get_private_key(struct s2n_cert_chain_and_key *cert_and_key);
749 
758 S2N_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);
759 
769 S2N_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);
770 
783 typedef 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);
784 
794 S2N_API extern int s2n_config_set_cert_tiebreak_callback(struct s2n_config *config, s2n_cert_tiebreak_callback cert_tiebreak_cb);
795 
810 S2N_API extern int s2n_config_add_cert_chain_and_key(struct s2n_config *config, const char *cert_chain_pem, const char *private_key_pem);
811 
829 S2N_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);
830 
850 S2N_API extern int s2n_config_set_cert_chain_and_key_defaults(struct s2n_config *config,
851  struct s2n_cert_chain_and_key **cert_key_pairs, uint32_t num_cert_key_pairs);
852 
877 S2N_API extern int s2n_config_set_verification_ca_location(struct s2n_config *config, const char *ca_pem_filename, const char *ca_dir);
878 
898 S2N_API extern int s2n_config_add_pem_to_trust_store(struct s2n_config *config, const char *pem);
899 
911 S2N_API extern int s2n_config_wipe_trust_store(struct s2n_config *config);
912 
926 S2N_API extern int s2n_config_load_system_certs(struct s2n_config *config);
927 
931 typedef enum {
932  S2N_VERIFY_AFTER_SIGN_DISABLED,
933  S2N_VERIFY_AFTER_SIGN_ENABLED
935 
948 S2N_API extern int s2n_config_set_verify_after_sign(struct s2n_config *config, s2n_verify_after_sign mode);
949 
972 S2N_API extern int s2n_config_set_send_buffer_size(struct s2n_config *config, uint32_t size);
973 
991 S2N_API extern int s2n_config_set_recv_multi_record(struct s2n_config *config, bool enabled);
992 
1007 typedef uint8_t (*s2n_verify_host_fn)(const char *host_name, size_t host_name_len, void *data);
1008 
1023 S2N_API extern int s2n_config_set_verify_host_callback(struct s2n_config *config, s2n_verify_host_fn, void *data);
1024 
1037 S2N_API extern int s2n_config_set_check_stapled_ocsp_response(struct s2n_config *config, uint8_t check_ocsp);
1038 
1061 S2N_API extern int s2n_config_disable_x509_time_verification(struct s2n_config *config);
1062 
1085 S2N_API extern int s2n_config_disable_x509_intent_verification(struct s2n_config *config);
1086 
1094 S2N_API extern int s2n_config_disable_x509_verification(struct s2n_config *config);
1095 
1106 S2N_API extern int s2n_config_set_max_cert_chain_depth(struct s2n_config *config, uint16_t max_depth);
1107 
1116 S2N_API extern int s2n_config_add_dhparams(struct s2n_config *config, const char *dhparams_pem);
1117 
1124 S2N_API extern int s2n_config_set_cipher_preferences(struct s2n_config *config, const char *version);
1125 
1135 S2N_API extern int s2n_config_append_protocol_preference(struct s2n_config *config, const uint8_t *protocol, uint8_t protocol_len);
1136 
1154 S2N_API extern int s2n_config_set_protocol_preferences(struct s2n_config *config, const char *const *protocols, int protocol_count);
1155 
1161 typedef enum {
1162  S2N_STATUS_REQUEST_NONE = 0,
1163  S2N_STATUS_REQUEST_OCSP = 1
1165 
1181 S2N_API extern int s2n_config_set_status_request_type(struct s2n_config *config, s2n_status_request_type type);
1182 
1186 typedef enum {
1187  S2N_CT_SUPPORT_NONE = 0,
1188  S2N_CT_SUPPORT_REQUEST = 1
1190 
1198 S2N_API extern int s2n_config_set_ct_support_level(struct s2n_config *config, s2n_ct_support_level level);
1199 
1210 typedef enum {
1211  S2N_ALERT_FAIL_ON_WARNINGS = 0,
1212  S2N_ALERT_IGNORE_WARNINGS = 1
1214 
1222 S2N_API extern int s2n_config_set_alert_behavior(struct s2n_config *config, s2n_alert_behavior alert_behavior);
1223 
1237 S2N_API extern int s2n_config_set_extension_data(struct s2n_config *config, s2n_tls_extension_type type, const uint8_t *data, uint32_t length);
1238 
1252 S2N_API extern int s2n_config_send_max_fragment_length(struct s2n_config *config, s2n_max_frag_len mfl_code);
1253 
1264 S2N_API extern int s2n_config_accept_max_fragment_length(struct s2n_config *config);
1265 
1273 S2N_API extern int s2n_config_set_session_state_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs);
1274 
1282 S2N_API extern int s2n_config_set_session_tickets_onoff(struct s2n_config *config, uint8_t enabled);
1283 
1294 S2N_API extern int s2n_config_set_session_cache_onoff(struct s2n_config *config, uint8_t enabled);
1295 
1305 S2N_API extern int s2n_config_set_ticket_encrypt_decrypt_key_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs);
1306 
1317 S2N_API extern int s2n_config_set_ticket_decrypt_key_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs);
1318 
1332 S2N_API extern int s2n_config_add_ticket_crypto_key(struct s2n_config *config, const uint8_t *name, uint32_t name_len,
1333  uint8_t *key, uint32_t key_len, uint64_t intro_time_in_seconds_from_epoch);
1334 
1348 S2N_API extern int s2n_config_require_ticket_forward_secrecy(struct s2n_config *config, bool enabled);
1349 
1357 S2N_API extern int s2n_config_set_ctx(struct s2n_config *config, void *ctx);
1358 
1367 S2N_API extern int s2n_config_get_ctx(struct s2n_config *config, void **ctx);
1368 
1372 typedef enum {
1373  S2N_SERVER,
1374  S2N_CLIENT
1375 } s2n_mode;
1376 
1393 S2N_API extern struct s2n_connection *s2n_connection_new(s2n_mode mode);
1394 
1402 S2N_API extern int s2n_connection_set_config(struct s2n_connection *conn, struct s2n_config *config);
1403 
1411 S2N_API extern int s2n_connection_set_ctx(struct s2n_connection *conn, void *ctx);
1412 
1418 S2N_API extern void *s2n_connection_get_ctx(struct s2n_connection *conn);
1419 
1426 typedef int s2n_client_hello_fn(struct s2n_connection *conn, void *ctx);
1427 
1435 typedef enum {
1436  S2N_CLIENT_HELLO_CB_BLOCKING,
1437  S2N_CLIENT_HELLO_CB_NONBLOCKING
1439 
1448 S2N_API extern int s2n_config_set_client_hello_cb(struct s2n_config *config, s2n_client_hello_fn client_hello_callback, void *ctx);
1449 
1459 S2N_API extern int s2n_config_set_client_hello_cb_mode(struct s2n_config *config, s2n_client_hello_cb_mode cb_mode);
1460 
1468 S2N_API extern int s2n_client_hello_cb_done(struct s2n_connection *conn);
1469 
1477 S2N_API extern int s2n_connection_server_name_extension_used(struct s2n_connection *conn);
1478 
1482 struct s2n_client_hello;
1483 
1493 S2N_API extern struct s2n_client_hello *s2n_connection_get_client_hello(struct s2n_connection *conn);
1494 
1510 S2N_API extern struct s2n_client_hello *s2n_client_hello_parse_message(const uint8_t *bytes, uint32_t size);
1511 
1522 S2N_API extern int s2n_client_hello_free(struct s2n_client_hello **ch);
1523 
1533 S2N_API extern ssize_t s2n_client_hello_get_raw_message_length(struct s2n_client_hello *ch);
1534 
1554 S2N_API extern ssize_t s2n_client_hello_get_raw_message(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length);
1555 
1563 S2N_API extern ssize_t s2n_client_hello_get_cipher_suites_length(struct s2n_client_hello *ch);
1564 
1578 S2N_API extern ssize_t s2n_client_hello_get_cipher_suites(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length);
1579 
1587 S2N_API extern ssize_t s2n_client_hello_get_extensions_length(struct s2n_client_hello *ch);
1588 
1597 S2N_API extern ssize_t s2n_client_hello_get_extensions(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length);
1598 
1607 S2N_API extern ssize_t s2n_client_hello_get_extension_length(struct s2n_client_hello *ch, s2n_tls_extension_type extension_type);
1608 
1620 S2N_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);
1621 
1631 S2N_API extern int s2n_client_hello_has_extension(struct s2n_client_hello *ch, uint16_t extension_iana, bool *exists);
1632 
1642 S2N_API extern int s2n_client_hello_get_session_id_length(struct s2n_client_hello *ch, uint32_t *out_length);
1643 
1659 S2N_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);
1660 
1668 S2N_API extern int s2n_client_hello_get_compression_methods_length(struct s2n_client_hello *ch, uint32_t *out_length);
1669 
1688 S2N_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);
1689 
1700 S2N_API extern int s2n_client_hello_get_legacy_protocol_version(struct s2n_client_hello *ch, uint8_t *out);
1701 
1716 S2N_API extern int s2n_client_hello_get_random(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length);
1717 
1740 S2N_API extern int s2n_client_hello_get_supported_groups(struct s2n_client_hello *ch, uint16_t *groups,
1741  uint16_t groups_count_max, uint16_t *groups_count);
1742 
1749 S2N_API extern int s2n_client_hello_get_server_name_length(struct s2n_client_hello *ch, uint16_t *length);
1750 
1761 S2N_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);
1762 
1774 S2N_API extern int s2n_connection_set_fd(struct s2n_connection *conn, int fd);
1775 
1787 S2N_API extern int s2n_connection_set_read_fd(struct s2n_connection *conn, int readfd);
1788 
1797 S2N_API extern int s2n_connection_set_write_fd(struct s2n_connection *conn, int writefd);
1798 
1806 S2N_API extern int s2n_connection_get_read_fd(struct s2n_connection *conn, int *readfd);
1807 
1815 S2N_API extern int s2n_connection_get_write_fd(struct s2n_connection *conn, int *writefd);
1816 
1825 S2N_API extern int s2n_connection_use_corked_io(struct s2n_connection *conn);
1826 
1830 typedef int s2n_recv_fn(void *io_context, uint8_t *buf, uint32_t len);
1831 
1835 typedef int s2n_send_fn(void *io_context, const uint8_t *buf, uint32_t len);
1836 
1847 S2N_API extern int s2n_connection_set_recv_ctx(struct s2n_connection *conn, void *ctx);
1848 
1859 S2N_API extern int s2n_connection_set_send_ctx(struct s2n_connection *conn, void *ctx);
1860 
1872 S2N_API extern int s2n_connection_set_recv_cb(struct s2n_connection *conn, s2n_recv_fn recv);
1873 
1885 S2N_API extern int s2n_connection_set_send_cb(struct s2n_connection *conn, s2n_send_fn send);
1886 
1896 S2N_API extern int s2n_connection_prefer_throughput(struct s2n_connection *conn);
1897 
1907 S2N_API extern int s2n_connection_prefer_low_latency(struct s2n_connection *conn);
1908 
1968 S2N_API extern int s2n_connection_set_recv_buffering(struct s2n_connection *conn, bool enabled);
1969 
2013 S2N_API extern uint32_t s2n_peek_buffered(struct s2n_connection *conn);
2014 
2026 S2N_API extern int s2n_connection_set_dynamic_buffers(struct s2n_connection *conn, bool enabled);
2027 
2044 S2N_API extern int s2n_connection_set_dynamic_record_threshold(struct s2n_connection *conn, uint32_t resize_threshold, uint16_t timeout_threshold);
2045 
2059 S2N_API extern int s2n_connection_set_verify_host_callback(struct s2n_connection *conn, s2n_verify_host_fn host_fn, void *data);
2060 
2074 typedef enum {
2075  S2N_BUILT_IN_BLINDING,
2076  S2N_SELF_SERVICE_BLINDING
2077 } s2n_blinding;
2078 
2087 S2N_API extern int s2n_connection_set_blinding(struct s2n_connection *conn, s2n_blinding blinding);
2088 
2094 S2N_API extern uint64_t s2n_connection_get_delay(struct s2n_connection *conn);
2095 
2122 S2N_API extern int s2n_config_set_max_blinding_delay(struct s2n_config *config, uint32_t seconds);
2123 
2132 S2N_API extern int s2n_connection_set_cipher_preferences(struct s2n_connection *conn, const char *version);
2133 
2138 typedef enum {
2139  S2N_KEY_UPDATE_NOT_REQUESTED = 0,
2140  S2N_KEY_UPDATE_REQUESTED
2142 
2157 S2N_API extern int s2n_connection_request_key_update(struct s2n_connection *conn, s2n_peer_key_update peer_request);
2168 S2N_API extern int s2n_connection_append_protocol_preference(struct s2n_connection *conn, const uint8_t *protocol, uint8_t protocol_len);
2169 
2179 S2N_API extern int s2n_connection_set_protocol_preferences(struct s2n_connection *conn, const char *const *protocols, int protocol_count);
2180 
2200 S2N_API extern int s2n_set_server_name(struct s2n_connection *conn, const char *server_name);
2201 
2211 S2N_API extern const char *s2n_get_server_name(struct s2n_connection *conn);
2212 
2219 S2N_API extern const char *s2n_get_application_protocol(struct s2n_connection *conn);
2220 
2228 S2N_API extern const uint8_t *s2n_connection_get_ocsp_response(struct s2n_connection *conn, uint32_t *length);
2229 
2237 S2N_API extern const uint8_t *s2n_connection_get_sct_list(struct s2n_connection *conn, uint32_t *length);
2238 
2244 typedef enum {
2245  S2N_NOT_BLOCKED = 0,
2246  S2N_BLOCKED_ON_READ,
2247  S2N_BLOCKED_ON_WRITE,
2248  S2N_BLOCKED_ON_APPLICATION_INPUT,
2249  S2N_BLOCKED_ON_EARLY_DATA,
2251 
2267 S2N_API extern int s2n_negotiate(struct s2n_connection *conn, s2n_blocked_status *blocked);
2268 
2286 S2N_API extern ssize_t s2n_send(struct s2n_connection *conn, const void *buf, ssize_t size, s2n_blocked_status *blocked);
2287 
2288 #ifndef _WIN32
2289 
2300 S2N_API extern ssize_t s2n_sendv(struct s2n_connection *conn, const struct iovec *bufs, ssize_t count, s2n_blocked_status *blocked);
2301 
2320 S2N_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);
2321 #endif
2322 
2338 S2N_API extern ssize_t s2n_recv(struct s2n_connection *conn, void *buf, ssize_t size, s2n_blocked_status *blocked);
2339 
2351 S2N_API extern uint32_t s2n_peek(struct s2n_connection *conn);
2352 
2361 S2N_API extern int s2n_connection_free_handshake(struct s2n_connection *conn);
2362 
2372 S2N_API extern int s2n_connection_release_buffers(struct s2n_connection *conn);
2373 
2384 S2N_API extern int s2n_connection_wipe(struct s2n_connection *conn);
2385 
2395 S2N_API extern int s2n_connection_free(struct s2n_connection *conn);
2396 
2412 S2N_API extern int s2n_shutdown(struct s2n_connection *conn, s2n_blocked_status *blocked);
2413 
2440 S2N_API extern int s2n_shutdown_send(struct s2n_connection *conn, s2n_blocked_status *blocked);
2441 
2462 typedef enum {
2463  S2N_CERT_AUTH_NONE,
2464  S2N_CERT_AUTH_REQUIRED,
2465  S2N_CERT_AUTH_OPTIONAL
2467 
2475 S2N_API extern int s2n_config_get_client_auth_type(struct s2n_config *config, s2n_cert_auth_type *client_auth_type);
2476 
2487 S2N_API extern int s2n_config_set_client_auth_type(struct s2n_config *config, s2n_cert_auth_type client_auth_type);
2488 
2496 S2N_API extern int s2n_connection_get_client_auth_type(struct s2n_connection *conn, s2n_cert_auth_type *client_auth_type);
2497 
2508 S2N_API extern int s2n_connection_set_client_auth_type(struct s2n_connection *conn, s2n_cert_auth_type client_auth_type);
2509 
2525 S2N_API extern int s2n_connection_get_client_cert_chain(struct s2n_connection *conn, uint8_t **der_cert_chain_out, uint32_t *cert_chain_len);
2526 
2534 S2N_API extern int s2n_config_set_initial_ticket_count(struct s2n_config *config, uint8_t num);
2535 
2543 S2N_API extern int s2n_connection_add_new_tickets_to_send(struct s2n_connection *conn, uint8_t num);
2544 
2557 S2N_API extern int s2n_connection_get_tickets_sent(struct s2n_connection *conn, uint16_t *num);
2558 
2567 S2N_API extern int s2n_connection_set_server_keying_material_lifetime(struct s2n_connection *conn, uint32_t lifetime_in_secs);
2568 
2569 struct s2n_session_ticket;
2570 
2585 typedef int (*s2n_session_ticket_fn)(struct s2n_connection *conn, void *ctx, struct s2n_session_ticket *ticket);
2586 
2599 S2N_API extern int s2n_config_set_session_ticket_cb(struct s2n_config *config, s2n_session_ticket_fn callback, void *ctx);
2600 
2607 S2N_API extern int s2n_session_ticket_get_data_len(struct s2n_session_ticket *ticket, size_t *data_len);
2608 
2620 S2N_API extern int s2n_session_ticket_get_data(struct s2n_session_ticket *ticket, size_t max_data_len, uint8_t *data);
2621 
2628 S2N_API extern int s2n_session_ticket_get_lifetime(struct s2n_session_ticket *ticket, uint32_t *session_lifetime);
2629 
2642 S2N_API extern int s2n_connection_set_session(struct s2n_connection *conn, const uint8_t *session, size_t length);
2643 
2657 S2N_API extern int s2n_connection_get_session(struct s2n_connection *conn, uint8_t *session, size_t max_length);
2658 
2670 S2N_API extern int s2n_connection_get_session_ticket_lifetime_hint(struct s2n_connection *conn);
2671 
2679 S2N_API extern int s2n_connection_get_session_length(struct s2n_connection *conn);
2680 
2690 S2N_API extern int s2n_connection_get_session_id_length(struct s2n_connection *conn);
2691 
2705 S2N_API extern int s2n_connection_get_session_id(struct s2n_connection *conn, uint8_t *session_id, size_t max_length);
2706 
2714 S2N_API extern int s2n_connection_is_session_resumed(struct s2n_connection *conn);
2715 
2723 S2N_API extern int s2n_connection_is_ocsp_stapled(struct s2n_connection *conn);
2724 
2729 typedef enum {
2730  S2N_TLS_SIGNATURE_ANONYMOUS = 0,
2731  S2N_TLS_SIGNATURE_RSA = 1,
2732  S2N_TLS_SIGNATURE_ECDSA = 3,
2733  S2N_TLS_SIGNATURE_MLDSA = 9,
2734 
2735  /* Use Private Range for RSA PSS since it's not defined there */
2736  S2N_TLS_SIGNATURE_RSA_PSS_RSAE = 224,
2737  S2N_TLS_SIGNATURE_RSA_PSS_PSS
2739 
2743 typedef enum {
2744  S2N_TLS_HASH_NONE = 0,
2745  S2N_TLS_HASH_MD5 = 1,
2746  S2N_TLS_HASH_SHA1 = 2,
2747  S2N_TLS_HASH_SHA224 = 3,
2748  S2N_TLS_HASH_SHA256 = 4,
2749  S2N_TLS_HASH_SHA384 = 5,
2750  S2N_TLS_HASH_SHA512 = 6,
2751 
2752  /* Use Private Range for MD5_SHA1 */
2753  S2N_TLS_HASH_MD5_SHA1 = 224
2755 
2764 S2N_API extern int s2n_connection_get_selected_signature_algorithm(struct s2n_connection *conn, s2n_tls_signature_algorithm *chosen_alg);
2765 
2774 S2N_API extern int s2n_connection_get_selected_digest_algorithm(struct s2n_connection *conn, s2n_tls_hash_algorithm *chosen_alg);
2775 
2784 S2N_API extern int s2n_connection_get_selected_client_cert_signature_algorithm(struct s2n_connection *conn, s2n_tls_signature_algorithm *chosen_alg);
2785 
2794 S2N_API extern int s2n_connection_get_selected_client_cert_digest_algorithm(struct s2n_connection *conn, s2n_tls_hash_algorithm *chosen_alg);
2795 
2832 S2N_API extern int s2n_connection_get_signature_scheme(struct s2n_connection *conn, const char **scheme_name);
2833 
2847 S2N_API extern struct s2n_cert_chain_and_key *s2n_connection_get_selected_cert(struct s2n_connection *conn);
2848 
2854 S2N_API extern int s2n_cert_chain_get_length(const struct s2n_cert_chain_and_key *chain_and_key, uint32_t *cert_length);
2855 
2874 S2N_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);
2875 
2901 S2N_API extern int s2n_cert_get_der(const struct s2n_cert *cert, const uint8_t **out_cert_der, uint32_t *cert_length);
2902 
2916 S2N_API extern int s2n_connection_get_peer_cert_chain(const struct s2n_connection *conn, struct s2n_cert_chain_and_key *cert_chain);
2917 
2925 S2N_API extern int s2n_cert_get_x509_extension_value_length(struct s2n_cert *cert, const uint8_t *oid, uint32_t *ext_value_len);
2926 
2938 S2N_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);
2939 
2947 S2N_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);
2948 
2960 S2N_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);
2961 
2965 typedef enum {
2966  S2N_PSK_HMAC_SHA256,
2967  S2N_PSK_HMAC_SHA384,
2968 } s2n_psk_hmac;
2969 
2973 struct s2n_psk;
2974 
2983 S2N_API struct s2n_psk *s2n_external_psk_new(void);
2984 
2990 S2N_API int s2n_psk_free(struct s2n_psk **psk);
2991 
3009 S2N_API int s2n_psk_set_identity(struct s2n_psk *psk, const uint8_t *identity, uint16_t identity_size);
3010 
3027 S2N_API int s2n_psk_set_secret(struct s2n_psk *psk, const uint8_t *secret, uint16_t secret_size);
3028 
3036 S2N_API int s2n_psk_set_hmac(struct s2n_psk *psk, s2n_psk_hmac hmac);
3037 
3047 S2N_API int s2n_connection_append_psk(struct s2n_connection *conn, struct s2n_psk *psk);
3048 
3055 typedef enum {
3056  S2N_PSK_MODE_RESUMPTION,
3057  S2N_PSK_MODE_EXTERNAL
3058 } s2n_psk_mode;
3059 
3067 S2N_API int s2n_config_set_psk_mode(struct s2n_config *config, s2n_psk_mode mode);
3068 
3077 S2N_API int s2n_connection_set_psk_mode(struct s2n_connection *conn, s2n_psk_mode mode);
3078 
3090 S2N_API int s2n_connection_get_negotiated_psk_identity_length(struct s2n_connection *conn, uint16_t *identity_length);
3091 
3108 S2N_API int s2n_connection_get_negotiated_psk_identity(struct s2n_connection *conn, uint8_t *identity, uint16_t max_identity_length);
3109 
3110 struct s2n_offered_psk;
3111 
3122 S2N_API struct s2n_offered_psk *s2n_offered_psk_new(void);
3123 
3129 S2N_API int s2n_offered_psk_free(struct s2n_offered_psk **psk);
3130 
3138 S2N_API int s2n_offered_psk_get_identity(struct s2n_offered_psk *psk, uint8_t **identity, uint16_t *size);
3139 
3140 struct s2n_offered_psk_list;
3141 
3154 S2N_API bool s2n_offered_psk_list_has_next(struct s2n_offered_psk_list *psk_list);
3155 
3163 S2N_API int s2n_offered_psk_list_next(struct s2n_offered_psk_list *psk_list, struct s2n_offered_psk *psk);
3164 
3173 S2N_API int s2n_offered_psk_list_reread(struct s2n_offered_psk_list *psk_list);
3174 
3186 S2N_API int s2n_offered_psk_list_choose_psk(struct s2n_offered_psk_list *psk_list, struct s2n_offered_psk *psk);
3187 
3202 typedef int (*s2n_psk_selection_callback)(struct s2n_connection *conn, void *context,
3203  struct s2n_offered_psk_list *psk_list);
3204 
3214 S2N_API int s2n_config_set_psk_selection_callback(struct s2n_config *config, s2n_psk_selection_callback cb, void *context);
3215 
3222 S2N_API extern uint64_t s2n_connection_get_wire_bytes_in(struct s2n_connection *conn);
3223 
3230 S2N_API extern uint64_t s2n_connection_get_wire_bytes_out(struct s2n_connection *conn);
3231 
3241 S2N_API extern int s2n_connection_get_client_protocol_version(struct s2n_connection *conn);
3242 
3252 S2N_API extern int s2n_connection_get_server_protocol_version(struct s2n_connection *conn);
3253 
3263 S2N_API extern int s2n_connection_get_actual_protocol_version(struct s2n_connection *conn);
3264 
3274 S2N_API extern int s2n_connection_get_client_hello_version(struct s2n_connection *conn);
3275 
3287 S2N_API extern int s2n_client_hello_get_legacy_record_version(struct s2n_client_hello *ch, uint8_t *out);
3288 
3296 S2N_API extern int s2n_connection_client_cert_used(struct s2n_connection *conn);
3297 
3311 S2N_API extern const char *s2n_connection_get_cipher(struct s2n_connection *conn);
3312 
3324 typedef enum {
3325  S2N_SNI_NONE = 1,
3326  S2N_SNI_EXACT_MATCH,
3327  S2N_SNI_WILDCARD_MATCH,
3328  S2N_SNI_NO_MATCH,
3330 
3343 S2N_API extern int s2n_connection_get_certificate_match(struct s2n_connection *conn, s2n_cert_sni_match *match_status);
3344 
3374 S2N_API extern int s2n_connection_get_master_secret(const struct s2n_connection *conn,
3375  uint8_t *secret_bytes, size_t max_size);
3376 
3393 S2N_API extern int s2n_connection_tls_exporter(struct s2n_connection *conn,
3394  const uint8_t *label, uint32_t label_length, const uint8_t *context, uint32_t context_length,
3395  uint8_t *output, uint32_t output_length);
3396 
3412 S2N_API extern int s2n_connection_get_cipher_iana_value(struct s2n_connection *conn, uint8_t *first, uint8_t *second);
3413 
3421 S2N_API extern int s2n_connection_is_valid_for_cipher_preferences(struct s2n_connection *conn, const char *version);
3422 
3431 S2N_API extern const char *s2n_connection_get_curve(struct s2n_connection *conn);
3432 
3443 S2N_API extern const char *s2n_connection_get_kem_name(struct s2n_connection *conn);
3444 
3455 S2N_API extern const char *s2n_connection_get_kem_group_name(struct s2n_connection *conn);
3456 
3469 S2N_API extern int s2n_connection_get_key_exchange_group(struct s2n_connection *conn, const char **group_name);
3470 
3478 S2N_API extern int s2n_connection_get_alert(struct s2n_connection *conn);
3479 
3486 S2N_API extern const char *s2n_connection_get_handshake_type_name(struct s2n_connection *conn);
3487 
3508 S2N_API extern bool s2n_connection_handshake_complete(struct s2n_connection *conn);
3509 
3515 S2N_API extern const char *s2n_connection_get_last_message_name(struct s2n_connection *conn);
3516 
3520 struct s2n_async_pkey_op;
3521 
3530 typedef enum {
3531  S2N_ASYNC_PKEY_VALIDATION_FAST,
3532  S2N_ASYNC_PKEY_VALIDATION_STRICT
3534 
3538 typedef enum {
3539  S2N_ASYNC_DECRYPT,
3540  S2N_ASYNC_SIGN
3542 
3555 typedef int (*s2n_async_pkey_fn)(struct s2n_connection *conn, struct s2n_async_pkey_op *op);
3556 
3563 S2N_API extern int s2n_config_set_async_pkey_callback(struct s2n_config *config, s2n_async_pkey_fn fn);
3564 
3577 S2N_API extern int s2n_async_pkey_op_perform(struct s2n_async_pkey_op *op, s2n_cert_private_key *key);
3578 
3595 S2N_API extern int s2n_async_pkey_op_apply(struct s2n_async_pkey_op *op, struct s2n_connection *conn);
3596 
3606 S2N_API extern int s2n_async_pkey_op_free(struct s2n_async_pkey_op *op);
3607 
3615 S2N_API extern int s2n_config_set_async_pkey_validation_mode(struct s2n_config *config, s2n_async_pkey_validation_mode mode);
3616 
3623 S2N_API extern int s2n_async_pkey_op_get_op_type(struct s2n_async_pkey_op *op, s2n_async_pkey_op_type *type);
3624 
3631 S2N_API extern int s2n_async_pkey_op_get_input_size(struct s2n_async_pkey_op *op, uint32_t *data_len);
3632 
3652 S2N_API extern int s2n_async_pkey_op_get_input(struct s2n_async_pkey_op *op, uint8_t *data, uint32_t data_len);
3653 
3665 S2N_API extern int s2n_async_pkey_op_set_output(struct s2n_async_pkey_op *op, const uint8_t *data, uint32_t data_len);
3666 
3686 typedef int (*s2n_key_log_fn)(void *ctx, struct s2n_connection *conn, uint8_t *logline, size_t len);
3687 
3705 S2N_API extern int s2n_config_set_key_log_cb(struct s2n_config *config, s2n_key_log_fn callback, void *ctx);
3706 
3713 S2N_API extern int s2n_config_enable_cert_req_dss_legacy_compat(struct s2n_config *config);
3714 
3725 S2N_API int s2n_config_set_server_max_early_data_size(struct s2n_config *config, uint32_t max_early_data_size);
3726 
3737 S2N_API int s2n_connection_set_server_max_early_data_size(struct s2n_connection *conn, uint32_t max_early_data_size);
3738 
3754 S2N_API int s2n_connection_set_server_early_data_context(struct s2n_connection *conn, const uint8_t *context, uint16_t context_size);
3755 
3771 S2N_API int s2n_psk_configure_early_data(struct s2n_psk *psk, uint32_t max_early_data_size,
3772  uint8_t cipher_suite_first_byte, uint8_t cipher_suite_second_byte);
3773 
3785 S2N_API int s2n_psk_set_application_protocol(struct s2n_psk *psk, const uint8_t *application_protocol, uint8_t size);
3786 
3798 S2N_API int s2n_psk_set_early_data_context(struct s2n_psk *psk, const uint8_t *context, uint16_t size);
3799 
3809 typedef enum {
3810  S2N_EARLY_DATA_STATUS_OK,
3811  S2N_EARLY_DATA_STATUS_NOT_REQUESTED,
3812  S2N_EARLY_DATA_STATUS_REJECTED,
3813  S2N_EARLY_DATA_STATUS_END,
3815 
3825 S2N_API int s2n_connection_get_early_data_status(struct s2n_connection *conn, s2n_early_data_status_t *status);
3826 
3838 S2N_API int s2n_connection_get_remaining_early_data_size(struct s2n_connection *conn, uint32_t *allowed_early_data_size);
3839 
3851 S2N_API int s2n_connection_get_max_early_data_size(struct s2n_connection *conn, uint32_t *max_early_data_size);
3852 
3867 S2N_API int s2n_send_early_data(struct s2n_connection *conn, const uint8_t *data, ssize_t data_len,
3868  ssize_t *data_sent, s2n_blocked_status *blocked);
3869 
3884 S2N_API int s2n_recv_early_data(struct s2n_connection *conn, uint8_t *data, ssize_t max_data_len,
3885  ssize_t *data_received, s2n_blocked_status *blocked);
3886 
3887 struct s2n_offered_early_data;
3888 
3906 typedef int (*s2n_early_data_cb)(struct s2n_connection *conn, struct s2n_offered_early_data *early_data);
3907 
3915 S2N_API int s2n_config_set_early_data_cb(struct s2n_config *config, s2n_early_data_cb cb);
3916 
3924 S2N_API int s2n_offered_early_data_get_context_length(struct s2n_offered_early_data *early_data, uint16_t *context_len);
3925 
3934 S2N_API int s2n_offered_early_data_get_context(struct s2n_offered_early_data *early_data, uint8_t *context, uint16_t max_len);
3935 
3942 S2N_API int s2n_offered_early_data_reject(struct s2n_offered_early_data *early_data);
3943 
3950 S2N_API int s2n_offered_early_data_accept(struct s2n_offered_early_data *early_data);
3951 
3977 S2N_API int s2n_config_get_supported_groups(struct s2n_config *config, uint16_t *groups, uint16_t groups_count_max,
3978  uint16_t *groups_count);
3979 
3983 typedef enum {
3984  S2N_SERIALIZED_CONN_NONE = 0,
3985  S2N_SERIALIZED_CONN_V1 = 1
3987 
4000 S2N_API int s2n_config_set_serialization_version(struct s2n_config *config, s2n_serialization_version version);
4001 
4013 S2N_API int s2n_connection_serialization_length(struct s2n_connection *conn, uint32_t *length);
4014 
4051 S2N_API int s2n_connection_serialize(struct s2n_connection *conn, uint8_t *buffer, uint32_t buffer_length);
4052 
4076 S2N_API int s2n_connection_deserialize(struct s2n_connection *conn, uint8_t *buffer, uint32_t buffer_length);
4077 
4098 S2N_API int s2n_config_set_cert_authorities_from_trust_store(struct s2n_config *config);
4099 
4103 S2N_API s2n_mode s2n_connection_get_mode(struct s2n_connection *conn);
4104 
4123 S2N_API extern int s2n_conn_get_signature_public_key_type(struct s2n_connection *conn,
4124  s2n_mode mode, char *output, uint32_t *output_size);
4125 
4126 #ifdef __cplusplus
4127 }
4128 #endif
S2N_API int s2n_config_set_cipher_preferences(struct s2n_config *config, const char *version)
S2N_API int s2n_connection_get_server_protocol_version(struct s2n_connection *conn)
S2N_API int s2n_connection_set_psk_mode(struct s2n_connection *conn, s2n_psk_mode mode)
S2N_API int s2n_config_set_session_cache_onoff(struct s2n_config *config, uint8_t enabled)
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_set_server_name(struct s2n_connection *conn, const char *server_name)
S2N_API int s2n_config_set_client_auth_type(struct s2n_config *config, s2n_cert_auth_type client_auth_type)
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_get_negotiated_psk_identity_length(struct s2n_connection *conn, uint16_t *identity_length)
S2N_API int s2n_async_pkey_op_perform(struct s2n_async_pkey_op *op, s2n_cert_private_key *key)
S2N_API int s2n_client_hello_get_session_id_length(struct s2n_client_hello *ch, uint32_t *out_length)
s2n_tls_signature_algorithm
Definition: s2n.h:2729
S2N_API struct s2n_cert_chain_and_key * s2n_connection_get_selected_cert(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 const char * s2n_connection_get_handshake_type_name(struct s2n_connection *conn)
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_get_key_exchange_group(struct s2n_connection *conn, const char **group_name)
S2N_API int s2n_config_set_status_request_type(struct s2n_config *config, s2n_status_request_type type)
S2N_API int s2n_connection_get_session(struct s2n_connection *conn, uint8_t *session, size_t max_length)
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 int s2n_cleanup(void)
S2N_API int s2n_error_get_type(int error)
S2N_API int s2n_connection_get_negotiated_psk_identity(struct s2n_connection *conn, uint8_t *identity, uint16_t max_identity_length)
S2N_API int s2n_config_free_dhparams(struct s2n_config *config)
S2N_API int s2n_config_set_verification_ca_location(struct s2n_config *config, const char *ca_pem_filename, const char *ca_dir)
S2N_API const char * s2n_connection_get_last_message_name(struct s2n_connection *conn)
S2N_API int s2n_connection_get_cipher_iana_value(struct s2n_connection *conn, uint8_t *first, uint8_t *second)
S2N_API int s2n_connection_get_client_cert_chain(struct s2n_connection *conn, uint8_t **der_cert_chain_out, uint32_t *cert_chain_len)
int(* s2n_mem_free_callback)(void *ptr, uint32_t size)
Definition: s2n.h:559
int(* s2n_clock_time_nanoseconds)(void *, uint64_t *)
Definition: s2n.h:337
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 int s2n_offered_early_data_reject(struct s2n_offered_early_data *early_data)
s2n_cert_auth_type
Definition: s2n.h:2462
Definition: s2n.h:156
S2N_API int s2n_config_set_async_pkey_callback(struct s2n_config *config, s2n_async_pkey_fn fn)
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_connection_append_psk(struct s2n_connection *conn, struct s2n_psk *psk)
S2N_API int s2n_connection_get_selected_client_cert_signature_algorithm(struct s2n_connection *conn, s2n_tls_signature_algorithm *chosen_alg)
S2N_API ssize_t s2n_send(struct s2n_connection *conn, const void *buf, ssize_t size, s2n_blocked_status *blocked)
s2n_tls_extension_type
Definition: s2n.h:614
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_offered_early_data_get_context_length(struct s2n_offered_early_data *early_data, uint16_t *context_len)
s2n_async_pkey_op_type
Definition: s2n.h:3538
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_config_set_extension_data(struct s2n_config *config, s2n_tls_extension_type type, const uint8_t *data, uint32_t length)
s2n_verify_after_sign
Definition: s2n.h:931
S2N_API int s2n_connection_get_session_ticket_lifetime_hint(struct s2n_connection *conn)
S2N_API uint64_t s2n_connection_get_wire_bytes_out(struct s2n_connection *conn)
S2N_API int s2n_shutdown(struct s2n_connection *conn, s2n_blocked_status *blocked)
S2N_API const char * s2n_connection_get_cipher(struct s2n_connection *conn)
s2n_ct_support_level
Definition: s2n.h:1186
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:783
S2N_API int s2n_config_set_early_data_cb(struct s2n_config *config, s2n_early_data_cb cb)
S2N_API int s2n_config_accept_max_fragment_length(struct s2n_config *config)
int(* s2n_cache_delete_callback)(struct s2n_connection *conn, void *, const void *key, uint64_t key_size)
Definition: s2n.h:386
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_session_length(struct s2n_connection *conn)
S2N_API int s2n_get_stacktrace(struct s2n_stacktrace *trace)
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:374
S2N_API int s2n_config_set_client_hello_cb(struct s2n_config *config, s2n_client_hello_fn client_hello_callback, void *ctx)
S2N_API int s2n_connection_set_server_keying_material_lifetime(struct s2n_connection *conn, uint32_t lifetime_in_secs)
S2N_API int s2n_config_set_session_tickets_onoff(struct s2n_config *config, uint8_t enabled)
S2N_API int s2n_config_set_monotonic_clock(struct s2n_config *config, s2n_clock_time_nanoseconds clock_fn, void *ctx)
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_add_cert_chain_and_key_to_store(struct s2n_config *config, struct s2n_cert_chain_and_key *cert_key_pair)
S2N_API int s2n_offered_psk_list_reread(struct s2n_offered_psk_list *psk_list)
S2N_API int s2n_connection_free_handshake(struct s2n_connection *conn)
S2N_API int s2n_config_set_psk_selection_callback(struct s2n_config *config, s2n_psk_selection_callback cb, void *context)
s2n_mode
Definition: s2n.h:1372
S2N_API int s2n_config_set_ticket_encrypt_decrypt_key_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs)
S2N_API int s2n_conn_get_signature_public_key_type(struct s2n_connection *conn, s2n_mode mode, char *output, uint32_t *output_size)
S2N_API int s2n_config_set_recv_multi_record(struct s2n_config *config, bool enabled)
Definition: s2n.h:160
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 int s2n_offered_early_data_accept(struct s2n_offered_early_data *early_data)
S2N_API int s2n_connection_get_tickets_sent(struct s2n_connection *conn, uint16_t *num)
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_max_frag_len
Definition: s2n.h:630
S2N_API int s2n_connection_is_session_resumed(struct s2n_connection *conn)
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_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)
int s2n_recv_fn(void *io_context, uint8_t *buf, uint32_t len)
Definition: s2n.h:1830
S2N_API s2n_mode s2n_connection_get_mode(struct s2n_connection *conn)
S2N_API int s2n_config_set_cache_delete_callback(struct s2n_config *config, s2n_cache_delete_callback cache_delete_callback, void *data)
Definition: s2n.h:152
S2N_API int s2n_client_hello_cb_done(struct s2n_connection *conn)
Definition: s2n.h:166
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 const char * s2n_strerror_name(int error)
S2N_API struct s2n_config * s2n_config_new_minimal(void)
s2n_async_pkey_validation_mode
Definition: s2n.h:3530
S2N_API int s2n_async_pkey_op_apply(struct s2n_async_pkey_op *op, struct s2n_connection *conn)
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:359
S2N_API int s2n_connection_get_actual_protocol_version(struct s2n_connection *conn)
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_errno_location(void)
S2N_API int s2n_connection_prefer_throughput(struct s2n_connection *conn)
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_get_ctx(struct s2n_config *config, void **ctx)
S2N_API int s2n_offered_psk_list_choose_psk(struct s2n_offered_psk_list *psk_list, struct s2n_offered_psk *psk)
struct s2n_pkey s2n_cert_public_key
Definition: s2n.h:655
S2N_API int s2n_psk_set_hmac(struct s2n_psk *psk, s2n_psk_hmac hmac)
S2N_API int s2n_connection_get_selected_digest_algorithm(struct s2n_connection *conn, s2n_tls_hash_algorithm *chosen_alg)
S2N_API struct s2n_config * s2n_config_new(void)
int s2n_client_hello_fn(struct s2n_connection *conn, void *ctx)
Definition: s2n.h:1426
S2N_API int s2n_config_append_protocol_preference(struct s2n_config *config, const uint8_t *protocol, uint8_t protocol_len)
int(* s2n_psk_selection_callback)(struct s2n_connection *conn, void *context, struct s2n_offered_psk_list *psk_list)
Definition: s2n.h:3202
s2n_client_hello_cb_mode
Definition: s2n.h:1435
int(* s2n_rand_seed_callback)(void *data, uint32_t size)
Definition: s2n.h:588
S2N_API int s2n_async_pkey_op_get_input(struct s2n_async_pkey_op *op, uint8_t *data, uint32_t data_len)
S2N_API int s2n_connection_get_early_data_status(struct s2n_connection *conn, s2n_early_data_status_t *status)
S2N_API int s2n_connection_get_certificate_match(struct s2n_connection *conn, s2n_cert_sni_match *match_status)
int(* s2n_key_log_fn)(void *ctx, struct s2n_connection *conn, uint8_t *logline, size_t len)
Definition: s2n.h:3686
S2N_API int s2n_config_free(struct s2n_config *config)
S2N_API int s2n_connection_serialization_length(struct s2n_connection *conn, uint32_t *length)
S2N_API const char * s2n_strerror_debug(int error, const char *lang)
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_psk_set_application_protocol(struct s2n_psk *psk, const uint8_t *application_protocol, uint8_t size)
S2N_API int s2n_connection_get_signature_scheme(struct s2n_connection *conn, const char **scheme_name)
S2N_API int s2n_psk_set_secret(struct s2n_psk *psk, const uint8_t *secret, uint16_t secret_size)
S2N_API ssize_t s2n_client_hello_get_cipher_suites(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length)
struct s2n_pkey s2n_cert_private_key
Definition: s2n.h:660
S2N_API int s2n_connection_set_fd(struct s2n_connection *conn, int fd)
Definition: s2n.h:158
S2N_API int s2n_connection_server_name_extension_used(struct s2n_connection *conn)
int(* s2n_mem_cleanup_callback)(void)
Definition: s2n.h:544
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_config_set_async_pkey_validation_mode(struct s2n_config *config, s2n_async_pkey_validation_mode mode)
int s2n_send_fn(void *io_context, const uint8_t *buf, uint32_t len)
Definition: s2n.h:1835
Definition: s2n.h:164
S2N_API int s2n_config_add_pem_to_trust_store(struct s2n_config *config, const char *pem)
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 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)
S2N_API int s2n_print_stacktrace(FILE *fptr)
S2N_API struct s2n_cert_chain_and_key * s2n_cert_chain_and_key_new(void)
S2N_API int s2n_connection_serialize(struct s2n_connection *conn, uint8_t *buffer, uint32_t buffer_length)
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 int s2n_config_set_wall_clock(struct s2n_config *config, s2n_clock_time_nanoseconds clock_fn, void *ctx)
S2N_API int s2n_config_require_ticket_forward_secrecy(struct s2n_config *config, bool enabled)
S2N_API int s2n_session_ticket_get_lifetime(struct s2n_session_ticket *ticket, uint32_t *session_lifetime)
S2N_API int s2n_config_set_session_state_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs)
s2n_blinding
Definition: s2n.h:2074
S2N_API const char * s2n_strerror_source(int error)
S2N_API int s2n_connection_set_send_ctx(struct s2n_connection *conn, void *ctx)
S2N_API int s2n_config_load_system_certs(struct s2n_config *config)
S2N_API bool s2n_connection_handshake_complete(struct s2n_connection *conn)
S2N_API int s2n_connection_is_valid_for_cipher_preferences(struct s2n_connection *conn, const char *version)
s2n_serialization_version
Definition: s2n.h:3983
S2N_API struct s2n_psk * s2n_external_psk_new(void)
S2N_API int s2n_connection_get_session_id_length(struct s2n_connection *conn)
S2N_API int s2n_negotiate(struct s2n_connection *conn, s2n_blocked_status *blocked)
S2N_API const uint8_t * s2n_connection_get_ocsp_response(struct s2n_connection *conn, uint32_t *length)
S2N_API int s2n_config_disable_x509_intent_verification(struct s2n_config *config)
S2N_API int s2n_client_hello_get_server_name_length(struct s2n_client_hello *ch, uint16_t *length)
S2N_API int s2n_config_disable_x509_verification(struct s2n_config *config)
S2N_API int s2n_connection_get_selected_signature_algorithm(struct s2n_connection *conn, s2n_tls_signature_algorithm *chosen_alg)
S2N_API int s2n_client_hello_get_compression_methods_length(struct s2n_client_hello *ch, uint32_t *out_length)
S2N_API int s2n_config_set_initial_ticket_count(struct s2n_config *config, uint8_t num)
Definition: s2n.h:154
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 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_client_hello_free(struct s2n_client_hello **ch)
S2N_API uint64_t s2n_connection_get_wire_bytes_in(struct s2n_connection *conn)
S2N_API int s2n_connection_set_write_fd(struct s2n_connection *conn, int writefd)
s2n_psk_hmac
Definition: s2n.h:2965
s2n_peer_key_update
Definition: s2n.h:2138
s2n_tls_hash_algorithm
Definition: s2n.h:2743
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 struct s2n_client_hello * s2n_connection_get_client_hello(struct s2n_connection *conn)
S2N_API __thread int s2n_errno
S2N_API int s2n_connection_free(struct s2n_connection *conn)
S2N_API int s2n_connection_use_corked_io(struct s2n_connection *conn)
S2N_API int s2n_client_hello_get_legacy_protocol_version(struct s2n_client_hello *ch, uint8_t *out)
S2N_API int s2n_config_set_max_blinding_delay(struct s2n_config *config, uint32_t seconds)
s2n_status_request_type
Definition: s2n.h:1161
S2N_API int s2n_connection_request_key_update(struct s2n_connection *conn, s2n_peer_key_update peer_request)
int(* s2n_rand_init_callback)(void)
Definition: s2n.h:578
S2N_API int s2n_shutdown_send(struct s2n_connection *conn, s2n_blocked_status *blocked)
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_deserialize(struct s2n_connection *conn, uint8_t *buffer, uint32_t buffer_length)
S2N_API int s2n_config_set_session_ticket_cb(struct s2n_config *config, s2n_session_ticket_fn callback, void *ctx)
S2N_API bool s2n_stack_traces_enabled(void)
s2n_early_data_status_t
Definition: s2n.h:3809
S2N_API int s2n_connection_set_ctx(struct s2n_connection *conn, void *ctx)
S2N_API int s2n_calculate_stacktrace(void)
S2N_API uint32_t s2n_peek(struct s2n_connection *conn)
s2n_blocked_status
Definition: s2n.h:2244
S2N_API int s2n_psk_set_early_data_context(struct s2n_psk *psk, const uint8_t *context, uint16_t size)
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_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_alert_behavior
Definition: s2n.h:1210
S2N_API int s2n_config_set_serialization_version(struct s2n_config *config, s2n_serialization_version version)
S2N_API int s2n_connection_set_read_fd(struct s2n_connection *conn, int readfd)
S2N_API bool s2n_offered_psk_list_has_next(struct s2n_offered_psk_list *psk_list)
S2N_API int s2n_config_send_max_fragment_length(struct s2n_config *config, s2n_max_frag_len mfl_code)
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_psk_set_identity(struct s2n_psk *psk, const uint8_t *identity, uint16_t identity_size)
S2N_API int s2n_connection_set_recv_ctx(struct s2n_connection *conn, void *ctx)
S2N_API ssize_t s2n_client_hello_get_cipher_suites_length(struct s2n_client_hello *ch)
S2N_API int s2n_connection_set_recv_cb(struct s2n_connection *conn, s2n_recv_fn recv)
S2N_API int s2n_config_set_alert_behavior(struct s2n_config *config, s2n_alert_behavior alert_behavior)
S2N_API int s2n_connection_get_client_protocol_version(struct s2n_connection *conn)
S2N_API int s2n_client_hello_get_legacy_record_version(struct s2n_client_hello *ch, uint8_t *out)
int(* s2n_rand_cleanup_callback)(void)
Definition: s2n.h:583
S2N_API struct s2n_connection * s2n_connection_new(s2n_mode mode)
S2N_API int s2n_config_add_dhparams(struct s2n_config *config, const char *dhparams_pem)
S2N_API ssize_t s2n_client_hello_get_extensions_length(struct s2n_client_hello *ch)
S2N_API const char * s2n_strerror(int error, const char *lang)
int(* s2n_mem_init_callback)(void)
Definition: s2n.h:539
S2N_API int s2n_connection_get_max_early_data_size(struct s2n_connection *conn, uint32_t *max_early_data_size)
S2N_API int s2n_config_disable_x509_time_verification(struct s2n_config *config)
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_connection_set_blinding(struct s2n_connection *conn, s2n_blinding blinding)
S2N_API int s2n_connection_is_ocsp_stapled(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_connection_set_cipher_preferences(struct s2n_connection *conn, const char *version)
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_config_set_ctx(struct s2n_config *config, void *ctx)
S2N_API int s2n_cert_get_x509_extension_value_length(struct s2n_cert *cert, const uint8_t *oid, uint32_t *ext_value_len)
S2N_API int s2n_disable_atexit(void)
S2N_API int s2n_config_set_cert_authorities_from_trust_store(struct s2n_config *config)
S2N_API int s2n_connection_set_config(struct s2n_connection *conn, struct s2n_config *config)
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_client_hello_has_extension(struct s2n_client_hello *ch, uint16_t extension_iana, bool *exists)
S2N_API int s2n_connection_prefer_low_latency(struct s2n_connection *conn)
S2N_API int s2n_connection_set_server_early_data_context(struct s2n_connection *conn, const uint8_t *context, uint16_t context_size)
int(* s2n_rand_mix_callback)(void *data, uint32_t size)
Definition: s2n.h:593
S2N_API int s2n_connection_set_dynamic_buffers(struct s2n_connection *conn, bool enabled)
s2n_cert_sni_match
Definition: s2n.h:3324
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_recv_buffering(struct s2n_connection *conn, bool enabled)
S2N_API int s2n_config_set_protocol_preferences(struct s2n_config *config, const char *const *protocols, int protocol_count)
S2N_API int s2n_offered_psk_get_identity(struct s2n_offered_psk *psk, uint8_t **identity, uint16_t *size)
S2N_API int s2n_cleanup_final(void)
S2N_API struct s2n_offered_psk * s2n_offered_psk_new(void)
S2N_API int s2n_connection_wipe(struct s2n_connection *conn)
S2N_API int s2n_session_ticket_get_data_len(struct s2n_session_ticket *ticket, size_t *data_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_async_pkey_op_get_input_size(struct s2n_async_pkey_op *op, uint32_t *data_len)
S2N_API int s2n_crypto_disable_init(void)
int(* s2n_early_data_cb)(struct s2n_connection *conn, struct s2n_offered_early_data *early_data)
Definition: s2n.h:3906
S2N_API int s2n_connection_set_dynamic_record_threshold(struct s2n_connection *conn, uint32_t resize_threshold, uint16_t timeout_threshold)
S2N_API const char * s2n_connection_get_kem_name(struct s2n_connection *conn)
S2N_API ssize_t s2n_client_hello_get_raw_message_length(struct s2n_client_hello *ch)
int(* s2n_mem_malloc_callback)(void **ptr, uint32_t requested, uint32_t *allocated)
Definition: s2n.h:554
S2N_API const char * s2n_connection_get_kem_group_name(struct s2n_connection *conn)
s2n_psk_mode
Definition: s2n.h:3055
S2N_API int s2n_connection_get_client_hello_version(struct s2n_connection *conn)
s2n_error_type
Definition: s2n.h:150
S2N_API int s2n_connection_set_session(struct s2n_connection *conn, const uint8_t *session, size_t length)
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_get_fips_mode(s2n_fips_mode *fips_mode)
S2N_API int s2n_connection_set_client_auth_type(struct s2n_connection *conn, s2n_cert_auth_type client_auth_type)
S2N_API int s2n_config_set_cache_retrieve_callback(struct s2n_config *config, s2n_cache_retrieve_callback cache_retrieve_callback, void *data)
S2N_API ssize_t s2n_client_hello_get_raw_message(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length)
S2N_API uint32_t s2n_peek_buffered(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_offered_early_data_get_context(struct s2n_offered_early_data *early_data, uint8_t *context, uint16_t max_len)
S2N_API const char * s2n_connection_get_curve(struct s2n_connection *conn)
S2N_API int s2n_connection_release_buffers(struct s2n_connection *conn)
S2N_API int s2n_connection_get_client_auth_type(struct s2n_connection *conn, s2n_cert_auth_type *client_auth_type)
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_verify_host_callback(struct s2n_config *config, s2n_verify_host_fn, void *data)
S2N_API int s2n_config_set_check_stapled_ocsp_response(struct s2n_config *config, uint8_t check_ocsp)
S2N_API int s2n_psk_free(struct s2n_psk **psk)
uint8_t(* s2n_verify_host_fn)(const char *host_name, size_t host_name_len, void *data)
Definition: s2n.h:1007
int(* s2n_async_pkey_fn)(struct s2n_connection *conn, struct s2n_async_pkey_op *op)
Definition: s2n.h:3555
S2N_API int s2n_cert_chain_get_length(const struct s2n_cert_chain_and_key *chain_and_key, uint32_t *cert_length)
S2N_API void * s2n_cert_chain_and_key_get_ctx(struct s2n_cert_chain_and_key *cert_and_key)
S2N_API int s2n_async_pkey_op_free(struct s2n_async_pkey_op *op)
S2N_API int s2n_config_set_verify_after_sign(struct s2n_config *config, s2n_verify_after_sign mode)
S2N_API int s2n_offered_psk_list_next(struct s2n_offered_psk_list *psk_list, struct s2n_offered_psk *psk)
S2N_API const char * s2n_get_server_name(struct s2n_connection *conn)
S2N_API uint64_t s2n_connection_get_delay(struct s2n_connection *conn)
S2N_API int s2n_connection_get_alert(struct s2n_connection *conn)
S2N_API int s2n_config_set_key_log_cb(struct s2n_config *config, s2n_key_log_fn callback, void *ctx)
S2N_API const uint8_t * s2n_connection_get_sct_list(struct s2n_connection *conn, uint32_t *length)
s2n_fips_mode
Definition: s2n.h:258
S2N_API int s2n_offered_psk_free(struct s2n_offered_psk **psk)
S2N_API int s2n_config_set_ct_support_level(struct s2n_config *config, s2n_ct_support_level level)
S2N_API int s2n_config_set_max_cert_chain_depth(struct s2n_config *config, uint16_t max_depth)
S2N_API int s2n_config_enable_cert_req_dss_legacy_compat(struct s2n_config *config)
S2N_API struct s2n_client_hello * s2n_client_hello_parse_message(const uint8_t *bytes, uint32_t size)
S2N_API int s2n_config_set_cert_tiebreak_callback(struct s2n_config *config, s2n_cert_tiebreak_callback cert_tiebreak_cb)
S2N_API unsigned long s2n_get_openssl_version(void)
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_connection_get_write_fd(struct s2n_connection *conn, int *writefd)
S2N_API int s2n_config_set_send_buffer_size(struct s2n_config *config, uint32_t size)
S2N_API int s2n_connection_set_send_cb(struct s2n_connection *conn, s2n_send_fn send)
S2N_API int s2n_connection_get_read_fd(struct s2n_connection *conn, int *readfd)
S2N_API int s2n_init(void)
Definition: s2n.h:162
int(* s2n_session_ticket_fn)(struct s2n_connection *conn, void *ctx, struct s2n_session_ticket *ticket)
Definition: s2n.h:2585
S2N_API int s2n_stack_traces_enabled_set(bool newval)
S2N_API int s2n_connection_add_new_tickets_to_send(struct s2n_connection *conn, uint8_t num)
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_connection_set_server_max_early_data_size(struct s2n_connection *conn, uint32_t max_early_data_size)
S2N_API ssize_t s2n_recv(struct s2n_connection *conn, void *buf, ssize_t size, s2n_blocked_status *blocked)
S2N_API int s2n_connection_set_protocol_preferences(struct s2n_connection *conn, const char *const *protocols, int protocol_count)
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_wipe_trust_store(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_set_ticket_decrypt_key_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs)
S2N_API int s2n_config_free_cert_chain_and_key(struct s2n_config *config)
S2N_API int s2n_cert_chain_and_key_set_ctx(struct s2n_cert_chain_and_key *cert_and_key, void *ctx)
S2N_API int s2n_connection_client_cert_used(struct s2n_connection *conn)
S2N_API int s2n_config_set_psk_mode(struct s2n_config *config, s2n_psk_mode mode)
S2N_API int s2n_cert_chain_and_key_free(struct s2n_cert_chain_and_key *cert_and_key)
S2N_API int s2n_config_get_client_auth_type(struct s2n_config *config, s2n_cert_auth_type *client_auth_type)
S2N_API const char * s2n_get_application_protocol(struct s2n_connection *conn)
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_free_stacktrace(void)
#define S2N_API
Definition: s2n.h:29
S2N_API void * s2n_connection_get_ctx(struct s2n_connection *conn)