AWS s2n-tls v1.6.1-a29a82a9
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#include <sys/uio.h>
41
45#define S2N_SUCCESS 0
49#define S2N_FAILURE -1
50
54#define S2N_CALLBACK_BLOCKED -2
55
59#define S2N_MINIMUM_SUPPORTED_TLS_RECORD_MAJOR_VERSION 2
60
64#define S2N_MAXIMUM_SUPPORTED_TLS_RECORD_MAJOR_VERSION 3
65
69#define S2N_SSLv2 20
70
74#define S2N_SSLv3 30
75
79#define S2N_TLS10 31
80
84#define S2N_TLS11 32
85
89#define S2N_TLS12 33
90
94#define S2N_TLS13 34
95
99#define S2N_UNKNOWN_PROTOCOL_VERSION 0
100
118S2N_API extern __thread int s2n_errno;
119
126S2N_API extern int *s2n_errno_location(void);
127
142typedef enum {
160
171S2N_API extern int s2n_error_get_type(int error);
172
176struct s2n_config;
177
181struct s2n_connection;
182
198
212
219S2N_API extern unsigned long s2n_get_openssl_version(void);
220
229S2N_API extern int s2n_init(void);
230
237S2N_API extern int s2n_cleanup(void);
238
239/*
240 * Performs a complete deinitialization and cleanup of the s2n-tls library.
241 *
242 * @returns S2N_SUCCESS on success. S2N_FAILURE on failure
243 */
244S2N_API extern int s2n_cleanup_final(void);
245
246typedef enum {
247 S2N_FIPS_MODE_DISABLED = 0,
248 S2N_FIPS_MODE_ENABLED,
249} s2n_fips_mode;
250
265S2N_API extern int s2n_get_fips_mode(s2n_fips_mode *fips_mode);
266
279S2N_API extern struct s2n_config *s2n_config_new(void);
280
294S2N_API extern struct s2n_config *s2n_config_new_minimal(void);
295
302S2N_API extern int s2n_config_free(struct s2n_config *config);
303
310S2N_API extern int s2n_config_free_dhparams(struct s2n_config *config);
311
318S2N_API extern int s2n_config_free_cert_chain_and_key(struct s2n_config *config);
319
327typedef int (*s2n_clock_time_nanoseconds)(void *, uint64_t *);
328
349typedef int (*s2n_cache_retrieve_callback)(struct s2n_connection *conn, void *, const void *key, uint64_t key_size, void *value, uint64_t *value_size);
350
364typedef 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);
365
376typedef int (*s2n_cache_delete_callback)(struct s2n_connection *conn, void *, const void *key, uint64_t key_size);
377
390S2N_API extern int s2n_config_set_wall_clock(struct s2n_config *config, s2n_clock_time_nanoseconds clock_fn, void *ctx);
391
404S2N_API extern int s2n_config_set_monotonic_clock(struct s2n_config *config, s2n_clock_time_nanoseconds clock_fn, void *ctx);
405
413S2N_API extern const char *s2n_strerror(int error, const char *lang);
414
424S2N_API extern const char *s2n_strerror_debug(int error, const char *lang);
425
432S2N_API extern const char *s2n_strerror_name(int error);
433
440S2N_API extern const char *s2n_strerror_source(int error);
441
445struct s2n_stacktrace;
446
453
460S2N_API extern int s2n_stack_traces_enabled_set(bool newval);
461
468
476S2N_API extern int s2n_print_stacktrace(FILE *fptr);
477
484
491S2N_API extern int s2n_get_stacktrace(struct s2n_stacktrace *trace);
492
502S2N_API extern int s2n_config_set_cache_store_callback(struct s2n_config *config, s2n_cache_store_callback cache_store_callback, void *data);
503
513S2N_API extern int s2n_config_set_cache_retrieve_callback(struct s2n_config *config, s2n_cache_retrieve_callback cache_retrieve_callback, void *data);
514
524S2N_API extern int s2n_config_set_cache_delete_callback(struct s2n_config *config, s2n_cache_delete_callback cache_delete_callback, void *data);
525
529typedef int (*s2n_mem_init_callback)(void);
530
534typedef int (*s2n_mem_cleanup_callback)(void);
535
544typedef int (*s2n_mem_malloc_callback)(void **ptr, uint32_t requested, uint32_t *allocated);
545
549typedef int (*s2n_mem_free_callback)(void *ptr, uint32_t size);
550
562S2N_API extern int s2n_mem_set_callbacks(s2n_mem_init_callback mem_init_callback, s2n_mem_cleanup_callback mem_cleanup_callback,
563 s2n_mem_malloc_callback mem_malloc_callback, s2n_mem_free_callback mem_free_callback);
564
568typedef int (*s2n_rand_init_callback)(void);
569
573typedef int (*s2n_rand_cleanup_callback)(void);
574
579typedef int (*s2n_rand_seed_callback)(void *data, uint32_t size);
580
585typedef int (*s2n_rand_mix_callback)(void *data, uint32_t size);
586
600S2N_API extern int s2n_rand_set_callbacks(s2n_rand_init_callback rand_init_callback, s2n_rand_cleanup_callback rand_cleanup_callback,
601 s2n_rand_seed_callback rand_seed_callback, s2n_rand_mix_callback rand_mix_callback);
602
606typedef enum {
607 S2N_EXTENSION_SERVER_NAME = 0,
608 S2N_EXTENSION_MAX_FRAG_LEN = 1,
609 S2N_EXTENSION_OCSP_STAPLING = 5,
610 S2N_EXTENSION_SUPPORTED_GROUPS = 10,
611 S2N_EXTENSION_EC_POINT_FORMATS = 11,
612 S2N_EXTENSION_SIGNATURE_ALGORITHMS = 13,
613 S2N_EXTENSION_ALPN = 16,
614 S2N_EXTENSION_CERTIFICATE_TRANSPARENCY = 18,
615 S2N_EXTENSION_SUPPORTED_VERSIONS = 43,
616 S2N_EXTENSION_RENEGOTIATION_INFO = 65281,
618
622typedef enum {
623 S2N_TLS_MAX_FRAG_LEN_512 = 1,
624 S2N_TLS_MAX_FRAG_LEN_1024 = 2,
625 S2N_TLS_MAX_FRAG_LEN_2048 = 3,
626 S2N_TLS_MAX_FRAG_LEN_4096 = 4,
628
632struct s2n_cert;
633
637struct s2n_cert_chain_and_key;
638
642struct s2n_pkey;
643
647typedef struct s2n_pkey s2n_cert_public_key;
648
652typedef struct s2n_pkey s2n_cert_private_key;
653
660S2N_API extern struct s2n_cert_chain_and_key *s2n_cert_chain_and_key_new(void);
661
677S2N_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);
678
694S2N_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);
695
707S2N_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);
708
715S2N_API extern int s2n_cert_chain_and_key_free(struct s2n_cert_chain_and_key *cert_and_key);
716
724S2N_API extern int s2n_cert_chain_and_key_set_ctx(struct s2n_cert_chain_and_key *cert_and_key, void *ctx);
725
732S2N_API extern void *s2n_cert_chain_and_key_get_ctx(struct s2n_cert_chain_and_key *cert_and_key);
733
740S2N_API extern s2n_cert_private_key *s2n_cert_chain_and_key_get_private_key(struct s2n_cert_chain_and_key *cert_and_key);
741
750S2N_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);
751
761S2N_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);
762
775typedef 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);
776
786S2N_API extern int s2n_config_set_cert_tiebreak_callback(struct s2n_config *config, s2n_cert_tiebreak_callback cert_tiebreak_cb);
787
802S2N_API extern int s2n_config_add_cert_chain_and_key(struct s2n_config *config, const char *cert_chain_pem, const char *private_key_pem);
803
821S2N_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);
822
842S2N_API extern int s2n_config_set_cert_chain_and_key_defaults(struct s2n_config *config,
843 struct s2n_cert_chain_and_key **cert_key_pairs, uint32_t num_cert_key_pairs);
844
869S2N_API extern int s2n_config_set_verification_ca_location(struct s2n_config *config, const char *ca_pem_filename, const char *ca_dir);
870
890S2N_API extern int s2n_config_add_pem_to_trust_store(struct s2n_config *config, const char *pem);
891
903S2N_API extern int s2n_config_wipe_trust_store(struct s2n_config *config);
904
918S2N_API extern int s2n_config_load_system_certs(struct s2n_config *config);
919
920typedef enum {
921 S2N_VERIFY_AFTER_SIGN_DISABLED,
922 S2N_VERIFY_AFTER_SIGN_ENABLED
923} s2n_verify_after_sign;
924
937S2N_API extern int s2n_config_set_verify_after_sign(struct s2n_config *config, s2n_verify_after_sign mode);
938
961S2N_API extern int s2n_config_set_send_buffer_size(struct s2n_config *config, uint32_t size);
962
980S2N_API extern int s2n_config_set_recv_multi_record(struct s2n_config *config, bool enabled);
981
996typedef uint8_t (*s2n_verify_host_fn)(const char *host_name, size_t host_name_len, void *data);
997
1012S2N_API extern int s2n_config_set_verify_host_callback(struct s2n_config *config, s2n_verify_host_fn, void *data);
1013
1026S2N_API extern int s2n_config_set_check_stapled_ocsp_response(struct s2n_config *config, uint8_t check_ocsp);
1027
1050S2N_API extern int s2n_config_disable_x509_time_verification(struct s2n_config *config);
1051
1059S2N_API extern int s2n_config_disable_x509_verification(struct s2n_config *config);
1060
1071S2N_API extern int s2n_config_set_max_cert_chain_depth(struct s2n_config *config, uint16_t max_depth);
1072
1081S2N_API extern int s2n_config_add_dhparams(struct s2n_config *config, const char *dhparams_pem);
1082
1089S2N_API extern int s2n_config_set_cipher_preferences(struct s2n_config *config, const char *version);
1090
1100S2N_API extern int s2n_config_append_protocol_preference(struct s2n_config *config, const uint8_t *protocol, uint8_t protocol_len);
1101
1119S2N_API extern int s2n_config_set_protocol_preferences(struct s2n_config *config, const char *const *protocols, int protocol_count);
1120
1126typedef enum {
1127 S2N_STATUS_REQUEST_NONE = 0,
1128 S2N_STATUS_REQUEST_OCSP = 1
1130
1146S2N_API extern int s2n_config_set_status_request_type(struct s2n_config *config, s2n_status_request_type type);
1147
1151typedef enum {
1152 S2N_CT_SUPPORT_NONE = 0,
1153 S2N_CT_SUPPORT_REQUEST = 1
1155
1163S2N_API extern int s2n_config_set_ct_support_level(struct s2n_config *config, s2n_ct_support_level level);
1164
1175typedef enum {
1176 S2N_ALERT_FAIL_ON_WARNINGS = 0,
1177 S2N_ALERT_IGNORE_WARNINGS = 1
1179
1187S2N_API extern int s2n_config_set_alert_behavior(struct s2n_config *config, s2n_alert_behavior alert_behavior);
1188
1202S2N_API extern int s2n_config_set_extension_data(struct s2n_config *config, s2n_tls_extension_type type, const uint8_t *data, uint32_t length);
1203
1217S2N_API extern int s2n_config_send_max_fragment_length(struct s2n_config *config, s2n_max_frag_len mfl_code);
1218
1229S2N_API extern int s2n_config_accept_max_fragment_length(struct s2n_config *config);
1230
1238S2N_API extern int s2n_config_set_session_state_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs);
1239
1247S2N_API extern int s2n_config_set_session_tickets_onoff(struct s2n_config *config, uint8_t enabled);
1248
1259S2N_API extern int s2n_config_set_session_cache_onoff(struct s2n_config *config, uint8_t enabled);
1260
1270S2N_API extern int s2n_config_set_ticket_encrypt_decrypt_key_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs);
1271
1282S2N_API extern int s2n_config_set_ticket_decrypt_key_lifetime(struct s2n_config *config, uint64_t lifetime_in_secs);
1283
1297S2N_API extern int s2n_config_add_ticket_crypto_key(struct s2n_config *config, const uint8_t *name, uint32_t name_len,
1298 uint8_t *key, uint32_t key_len, uint64_t intro_time_in_seconds_from_epoch);
1299
1313S2N_API extern int s2n_config_require_ticket_forward_secrecy(struct s2n_config *config, bool enabled);
1314
1322S2N_API extern int s2n_config_set_ctx(struct s2n_config *config, void *ctx);
1323
1332S2N_API extern int s2n_config_get_ctx(struct s2n_config *config, void **ctx);
1333
1337typedef enum {
1338 S2N_SERVER,
1339 S2N_CLIENT
1340} s2n_mode;
1341
1358S2N_API extern struct s2n_connection *s2n_connection_new(s2n_mode mode);
1359
1367S2N_API extern int s2n_connection_set_config(struct s2n_connection *conn, struct s2n_config *config);
1368
1376S2N_API extern int s2n_connection_set_ctx(struct s2n_connection *conn, void *ctx);
1377
1383S2N_API extern void *s2n_connection_get_ctx(struct s2n_connection *conn);
1384
1391typedef int s2n_client_hello_fn(struct s2n_connection *conn, void *ctx);
1392
1400typedef enum {
1401 S2N_CLIENT_HELLO_CB_BLOCKING,
1402 S2N_CLIENT_HELLO_CB_NONBLOCKING
1404
1413S2N_API extern int s2n_config_set_client_hello_cb(struct s2n_config *config, s2n_client_hello_fn client_hello_callback, void *ctx);
1414
1424S2N_API extern int s2n_config_set_client_hello_cb_mode(struct s2n_config *config, s2n_client_hello_cb_mode cb_mode);
1425
1433S2N_API extern int s2n_client_hello_cb_done(struct s2n_connection *conn);
1434
1442S2N_API extern int s2n_connection_server_name_extension_used(struct s2n_connection *conn);
1443
1447struct s2n_client_hello;
1448
1458S2N_API extern struct s2n_client_hello *s2n_connection_get_client_hello(struct s2n_connection *conn);
1459
1475S2N_API extern struct s2n_client_hello *s2n_client_hello_parse_message(const uint8_t *bytes, uint32_t size);
1476
1487S2N_API extern int s2n_client_hello_free(struct s2n_client_hello **ch);
1488
1498S2N_API extern ssize_t s2n_client_hello_get_raw_message_length(struct s2n_client_hello *ch);
1499
1519S2N_API extern ssize_t s2n_client_hello_get_raw_message(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length);
1520
1528S2N_API extern ssize_t s2n_client_hello_get_cipher_suites_length(struct s2n_client_hello *ch);
1529
1543S2N_API extern ssize_t s2n_client_hello_get_cipher_suites(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length);
1544
1552S2N_API extern ssize_t s2n_client_hello_get_extensions_length(struct s2n_client_hello *ch);
1553
1562S2N_API extern ssize_t s2n_client_hello_get_extensions(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length);
1563
1572S2N_API extern ssize_t s2n_client_hello_get_extension_length(struct s2n_client_hello *ch, s2n_tls_extension_type extension_type);
1573
1585S2N_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);
1586
1596S2N_API extern int s2n_client_hello_has_extension(struct s2n_client_hello *ch, uint16_t extension_iana, bool *exists);
1597
1607S2N_API extern int s2n_client_hello_get_session_id_length(struct s2n_client_hello *ch, uint32_t *out_length);
1608
1624S2N_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);
1625
1633S2N_API extern int s2n_client_hello_get_compression_methods_length(struct s2n_client_hello *ch, uint32_t *out_length);
1634
1653S2N_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);
1654
1665S2N_API extern int s2n_client_hello_get_legacy_protocol_version(struct s2n_client_hello *ch, uint8_t *out);
1666
1681S2N_API extern int s2n_client_hello_get_random(struct s2n_client_hello *ch, uint8_t *out, uint32_t max_length);
1682
1705S2N_API extern int s2n_client_hello_get_supported_groups(struct s2n_client_hello *ch, uint16_t *groups,
1706 uint16_t groups_count_max, uint16_t *groups_count);
1707
1714S2N_API extern int s2n_client_hello_get_server_name_length(struct s2n_client_hello *ch, uint16_t *length);
1715
1726S2N_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);
1727
1739S2N_API extern int s2n_connection_set_fd(struct s2n_connection *conn, int fd);
1740
1752S2N_API extern int s2n_connection_set_read_fd(struct s2n_connection *conn, int readfd);
1753
1762S2N_API extern int s2n_connection_set_write_fd(struct s2n_connection *conn, int writefd);
1763
1771S2N_API extern int s2n_connection_get_read_fd(struct s2n_connection *conn, int *readfd);
1772
1780S2N_API extern int s2n_connection_get_write_fd(struct s2n_connection *conn, int *writefd);
1781
1790S2N_API extern int s2n_connection_use_corked_io(struct s2n_connection *conn);
1791
1795typedef int s2n_recv_fn(void *io_context, uint8_t *buf, uint32_t len);
1796
1800typedef int s2n_send_fn(void *io_context, const uint8_t *buf, uint32_t len);
1801
1812S2N_API extern int s2n_connection_set_recv_ctx(struct s2n_connection *conn, void *ctx);
1813
1824S2N_API extern int s2n_connection_set_send_ctx(struct s2n_connection *conn, void *ctx);
1825
1837S2N_API extern int s2n_connection_set_recv_cb(struct s2n_connection *conn, s2n_recv_fn recv);
1838
1850S2N_API extern int s2n_connection_set_send_cb(struct s2n_connection *conn, s2n_send_fn send);
1851
1861S2N_API extern int s2n_connection_prefer_throughput(struct s2n_connection *conn);
1862
1872S2N_API extern int s2n_connection_prefer_low_latency(struct s2n_connection *conn);
1873
1933S2N_API extern int s2n_connection_set_recv_buffering(struct s2n_connection *conn, bool enabled);
1934
1952S2N_API extern uint32_t s2n_peek_buffered(struct s2n_connection *conn);
1953
1965S2N_API extern int s2n_connection_set_dynamic_buffers(struct s2n_connection *conn, bool enabled);
1966
1983S2N_API extern int s2n_connection_set_dynamic_record_threshold(struct s2n_connection *conn, uint32_t resize_threshold, uint16_t timeout_threshold);
1984
1998S2N_API extern int s2n_connection_set_verify_host_callback(struct s2n_connection *conn, s2n_verify_host_fn host_fn, void *data);
1999
2013typedef enum {
2014 S2N_BUILT_IN_BLINDING,
2015 S2N_SELF_SERVICE_BLINDING
2016} s2n_blinding;
2017
2026S2N_API extern int s2n_connection_set_blinding(struct s2n_connection *conn, s2n_blinding blinding);
2027
2033S2N_API extern uint64_t s2n_connection_get_delay(struct s2n_connection *conn);
2034
2061S2N_API extern int s2n_config_set_max_blinding_delay(struct s2n_config *config, uint32_t seconds);
2062
2071S2N_API extern int s2n_connection_set_cipher_preferences(struct s2n_connection *conn, const char *version);
2072
2077typedef enum {
2078 S2N_KEY_UPDATE_NOT_REQUESTED = 0,
2079 S2N_KEY_UPDATE_REQUESTED
2081
2096S2N_API extern int s2n_connection_request_key_update(struct s2n_connection *conn, s2n_peer_key_update peer_request);
2107S2N_API extern int s2n_connection_append_protocol_preference(struct s2n_connection *conn, const uint8_t *protocol, uint8_t protocol_len);
2108
2118S2N_API extern int s2n_connection_set_protocol_preferences(struct s2n_connection *conn, const char *const *protocols, int protocol_count);
2119
2139S2N_API extern int s2n_set_server_name(struct s2n_connection *conn, const char *server_name);
2140
2150S2N_API extern const char *s2n_get_server_name(struct s2n_connection *conn);
2151
2158S2N_API extern const char *s2n_get_application_protocol(struct s2n_connection *conn);
2159
2167S2N_API extern const uint8_t *s2n_connection_get_ocsp_response(struct s2n_connection *conn, uint32_t *length);
2168
2176S2N_API extern const uint8_t *s2n_connection_get_sct_list(struct s2n_connection *conn, uint32_t *length);
2177
2183typedef enum {
2184 S2N_NOT_BLOCKED = 0,
2185 S2N_BLOCKED_ON_READ,
2186 S2N_BLOCKED_ON_WRITE,
2187 S2N_BLOCKED_ON_APPLICATION_INPUT,
2188 S2N_BLOCKED_ON_EARLY_DATA,
2190
2206S2N_API extern int s2n_negotiate(struct s2n_connection *conn, s2n_blocked_status *blocked);
2207
2225S2N_API extern ssize_t s2n_send(struct s2n_connection *conn, const void *buf, ssize_t size, s2n_blocked_status *blocked);
2226
2238S2N_API extern ssize_t s2n_sendv(struct s2n_connection *conn, const struct iovec *bufs, ssize_t count, s2n_blocked_status *blocked);
2239
2257S2N_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);
2258
2274S2N_API extern ssize_t s2n_recv(struct s2n_connection *conn, void *buf, ssize_t size, s2n_blocked_status *blocked);
2275
2287S2N_API extern uint32_t s2n_peek(struct s2n_connection *conn);
2288
2297S2N_API extern int s2n_connection_free_handshake(struct s2n_connection *conn);
2298
2308S2N_API extern int s2n_connection_release_buffers(struct s2n_connection *conn);
2309
2320S2N_API extern int s2n_connection_wipe(struct s2n_connection *conn);
2321
2331S2N_API extern int s2n_connection_free(struct s2n_connection *conn);
2332
2348S2N_API extern int s2n_shutdown(struct s2n_connection *conn, s2n_blocked_status *blocked);
2349
2376S2N_API extern int s2n_shutdown_send(struct s2n_connection *conn, s2n_blocked_status *blocked);
2377
2398typedef enum {
2399 S2N_CERT_AUTH_NONE,
2400 S2N_CERT_AUTH_REQUIRED,
2401 S2N_CERT_AUTH_OPTIONAL
2403
2411S2N_API extern int s2n_config_get_client_auth_type(struct s2n_config *config, s2n_cert_auth_type *client_auth_type);
2412
2423S2N_API extern int s2n_config_set_client_auth_type(struct s2n_config *config, s2n_cert_auth_type client_auth_type);
2424
2432S2N_API extern int s2n_connection_get_client_auth_type(struct s2n_connection *conn, s2n_cert_auth_type *client_auth_type);
2433
2444S2N_API extern int s2n_connection_set_client_auth_type(struct s2n_connection *conn, s2n_cert_auth_type client_auth_type);
2445
2461S2N_API extern int s2n_connection_get_client_cert_chain(struct s2n_connection *conn, uint8_t **der_cert_chain_out, uint32_t *cert_chain_len);
2462
2470S2N_API extern int s2n_config_set_initial_ticket_count(struct s2n_config *config, uint8_t num);
2471
2479S2N_API extern int s2n_connection_add_new_tickets_to_send(struct s2n_connection *conn, uint8_t num);
2480
2493S2N_API extern int s2n_connection_get_tickets_sent(struct s2n_connection *conn, uint16_t *num);
2494
2503S2N_API extern int s2n_connection_set_server_keying_material_lifetime(struct s2n_connection *conn, uint32_t lifetime_in_secs);
2504
2505struct s2n_session_ticket;
2506
2521typedef int (*s2n_session_ticket_fn)(struct s2n_connection *conn, void *ctx, struct s2n_session_ticket *ticket);
2522
2535S2N_API extern int s2n_config_set_session_ticket_cb(struct s2n_config *config, s2n_session_ticket_fn callback, void *ctx);
2536
2543S2N_API extern int s2n_session_ticket_get_data_len(struct s2n_session_ticket *ticket, size_t *data_len);
2544
2556S2N_API extern int s2n_session_ticket_get_data(struct s2n_session_ticket *ticket, size_t max_data_len, uint8_t *data);
2557
2564S2N_API extern int s2n_session_ticket_get_lifetime(struct s2n_session_ticket *ticket, uint32_t *session_lifetime);
2565
2578S2N_API extern int s2n_connection_set_session(struct s2n_connection *conn, const uint8_t *session, size_t length);
2579
2593S2N_API extern int s2n_connection_get_session(struct s2n_connection *conn, uint8_t *session, size_t max_length);
2594
2606S2N_API extern int s2n_connection_get_session_ticket_lifetime_hint(struct s2n_connection *conn);
2607
2615S2N_API extern int s2n_connection_get_session_length(struct s2n_connection *conn);
2616
2626S2N_API extern int s2n_connection_get_session_id_length(struct s2n_connection *conn);
2627
2641S2N_API extern int s2n_connection_get_session_id(struct s2n_connection *conn, uint8_t *session_id, size_t max_length);
2642
2650S2N_API extern int s2n_connection_is_session_resumed(struct s2n_connection *conn);
2651
2659S2N_API extern int s2n_connection_is_ocsp_stapled(struct s2n_connection *conn);
2660
2665typedef enum {
2666 S2N_TLS_SIGNATURE_ANONYMOUS = 0,
2667 S2N_TLS_SIGNATURE_RSA = 1,
2668 S2N_TLS_SIGNATURE_ECDSA = 3,
2669 S2N_TLS_SIGNATURE_MLDSA = 9,
2670
2671 /* Use Private Range for RSA PSS since it's not defined there */
2672 S2N_TLS_SIGNATURE_RSA_PSS_RSAE = 224,
2673 S2N_TLS_SIGNATURE_RSA_PSS_PSS
2675
2679typedef enum {
2680 S2N_TLS_HASH_NONE = 0,
2681 S2N_TLS_HASH_MD5 = 1,
2682 S2N_TLS_HASH_SHA1 = 2,
2683 S2N_TLS_HASH_SHA224 = 3,
2684 S2N_TLS_HASH_SHA256 = 4,
2685 S2N_TLS_HASH_SHA384 = 5,
2686 S2N_TLS_HASH_SHA512 = 6,
2687
2688 /* Use Private Range for MD5_SHA1 */
2689 S2N_TLS_HASH_MD5_SHA1 = 224
2691
2701
2710S2N_API extern int s2n_connection_get_selected_digest_algorithm(struct s2n_connection *conn, s2n_tls_hash_algorithm *chosen_alg);
2711
2721
2731
2768S2N_API extern int s2n_connection_get_signature_scheme(struct s2n_connection *conn, const char **scheme_name);
2769
2783S2N_API extern struct s2n_cert_chain_and_key *s2n_connection_get_selected_cert(struct s2n_connection *conn);
2784
2790S2N_API extern int s2n_cert_chain_get_length(const struct s2n_cert_chain_and_key *chain_and_key, uint32_t *cert_length);
2791
2810S2N_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);
2811
2837S2N_API extern int s2n_cert_get_der(const struct s2n_cert *cert, const uint8_t **out_cert_der, uint32_t *cert_length);
2838
2849S2N_API extern int s2n_connection_get_peer_cert_chain(const struct s2n_connection *conn, struct s2n_cert_chain_and_key *cert_chain);
2850
2858S2N_API extern int s2n_cert_get_x509_extension_value_length(struct s2n_cert *cert, const uint8_t *oid, uint32_t *ext_value_len);
2859
2871S2N_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);
2872
2880S2N_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);
2881
2893S2N_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);
2894
2898typedef enum {
2899 S2N_PSK_HMAC_SHA256,
2900 S2N_PSK_HMAC_SHA384,
2901} s2n_psk_hmac;
2902
2906struct s2n_psk;
2907
2916S2N_API struct s2n_psk *s2n_external_psk_new(void);
2917
2923S2N_API int s2n_psk_free(struct s2n_psk **psk);
2924
2942S2N_API int s2n_psk_set_identity(struct s2n_psk *psk, const uint8_t *identity, uint16_t identity_size);
2943
2960S2N_API int s2n_psk_set_secret(struct s2n_psk *psk, const uint8_t *secret, uint16_t secret_size);
2961
2969S2N_API int s2n_psk_set_hmac(struct s2n_psk *psk, s2n_psk_hmac hmac);
2970
2980S2N_API int s2n_connection_append_psk(struct s2n_connection *conn, struct s2n_psk *psk);
2981
2988typedef enum {
2989 S2N_PSK_MODE_RESUMPTION,
2990 S2N_PSK_MODE_EXTERNAL
2991} s2n_psk_mode;
2992
3000S2N_API int s2n_config_set_psk_mode(struct s2n_config *config, s2n_psk_mode mode);
3001
3010S2N_API int s2n_connection_set_psk_mode(struct s2n_connection *conn, s2n_psk_mode mode);
3011
3023S2N_API int s2n_connection_get_negotiated_psk_identity_length(struct s2n_connection *conn, uint16_t *identity_length);
3024
3041S2N_API int s2n_connection_get_negotiated_psk_identity(struct s2n_connection *conn, uint8_t *identity, uint16_t max_identity_length);
3042
3043struct s2n_offered_psk;
3044
3055S2N_API struct s2n_offered_psk *s2n_offered_psk_new(void);
3056
3062S2N_API int s2n_offered_psk_free(struct s2n_offered_psk **psk);
3063
3071S2N_API int s2n_offered_psk_get_identity(struct s2n_offered_psk *psk, uint8_t **identity, uint16_t *size);
3072
3073struct s2n_offered_psk_list;
3074
3087S2N_API bool s2n_offered_psk_list_has_next(struct s2n_offered_psk_list *psk_list);
3088
3096S2N_API int s2n_offered_psk_list_next(struct s2n_offered_psk_list *psk_list, struct s2n_offered_psk *psk);
3097
3106S2N_API int s2n_offered_psk_list_reread(struct s2n_offered_psk_list *psk_list);
3107
3119S2N_API int s2n_offered_psk_list_choose_psk(struct s2n_offered_psk_list *psk_list, struct s2n_offered_psk *psk);
3120
3135typedef int (*s2n_psk_selection_callback)(struct s2n_connection *conn, void *context,
3136 struct s2n_offered_psk_list *psk_list);
3137
3147S2N_API int s2n_config_set_psk_selection_callback(struct s2n_config *config, s2n_psk_selection_callback cb, void *context);
3148
3155S2N_API extern uint64_t s2n_connection_get_wire_bytes_in(struct s2n_connection *conn);
3156
3163S2N_API extern uint64_t s2n_connection_get_wire_bytes_out(struct s2n_connection *conn);
3164
3174S2N_API extern int s2n_connection_get_client_protocol_version(struct s2n_connection *conn);
3175
3185S2N_API extern int s2n_connection_get_server_protocol_version(struct s2n_connection *conn);
3186
3196S2N_API extern int s2n_connection_get_actual_protocol_version(struct s2n_connection *conn);
3197
3207S2N_API extern int s2n_connection_get_client_hello_version(struct s2n_connection *conn);
3208
3220S2N_API extern int s2n_client_hello_get_legacy_record_version(struct s2n_client_hello *ch, uint8_t *out);
3221
3229S2N_API extern int s2n_connection_client_cert_used(struct s2n_connection *conn);
3230
3244S2N_API extern const char *s2n_connection_get_cipher(struct s2n_connection *conn);
3245
3257typedef enum {
3258 S2N_SNI_NONE = 1,
3259 S2N_SNI_EXACT_MATCH,
3260 S2N_SNI_WILDCARD_MATCH,
3261 S2N_SNI_NO_MATCH,
3263
3276S2N_API extern int s2n_connection_get_certificate_match(struct s2n_connection *conn, s2n_cert_sni_match *match_status);
3277
3307S2N_API extern int s2n_connection_get_master_secret(const struct s2n_connection *conn,
3308 uint8_t *secret_bytes, size_t max_size);
3309
3320S2N_API extern int s2n_connection_tls_exporter(struct s2n_connection *conn,
3321 const uint8_t *label, uint32_t label_length, const uint8_t *context, uint32_t context_length,
3322 uint8_t *output, uint32_t output_length);
3323
3339S2N_API extern int s2n_connection_get_cipher_iana_value(struct s2n_connection *conn, uint8_t *first, uint8_t *second);
3340
3348S2N_API extern int s2n_connection_is_valid_for_cipher_preferences(struct s2n_connection *conn, const char *version);
3349
3358S2N_API extern const char *s2n_connection_get_curve(struct s2n_connection *conn);
3359
3370S2N_API extern const char *s2n_connection_get_kem_name(struct s2n_connection *conn);
3371
3382S2N_API extern const char *s2n_connection_get_kem_group_name(struct s2n_connection *conn);
3383
3396S2N_API extern int s2n_connection_get_key_exchange_group(struct s2n_connection *conn, const char **group_name);
3397
3405S2N_API extern int s2n_connection_get_alert(struct s2n_connection *conn);
3406
3413S2N_API extern const char *s2n_connection_get_handshake_type_name(struct s2n_connection *conn);
3414
3420S2N_API extern const char *s2n_connection_get_last_message_name(struct s2n_connection *conn);
3421
3425struct s2n_async_pkey_op;
3426
3435typedef enum {
3436 S2N_ASYNC_PKEY_VALIDATION_FAST,
3437 S2N_ASYNC_PKEY_VALIDATION_STRICT
3439
3443typedef enum {
3444 S2N_ASYNC_DECRYPT,
3445 S2N_ASYNC_SIGN
3447
3460typedef int (*s2n_async_pkey_fn)(struct s2n_connection *conn, struct s2n_async_pkey_op *op);
3461
3468S2N_API extern int s2n_config_set_async_pkey_callback(struct s2n_config *config, s2n_async_pkey_fn fn);
3469
3482S2N_API extern int s2n_async_pkey_op_perform(struct s2n_async_pkey_op *op, s2n_cert_private_key *key);
3483
3497S2N_API extern int s2n_async_pkey_op_apply(struct s2n_async_pkey_op *op, struct s2n_connection *conn);
3498
3508S2N_API extern int s2n_async_pkey_op_free(struct s2n_async_pkey_op *op);
3509
3518
3525S2N_API extern int s2n_async_pkey_op_get_op_type(struct s2n_async_pkey_op *op, s2n_async_pkey_op_type *type);
3526
3533S2N_API extern int s2n_async_pkey_op_get_input_size(struct s2n_async_pkey_op *op, uint32_t *data_len);
3534
3554S2N_API extern int s2n_async_pkey_op_get_input(struct s2n_async_pkey_op *op, uint8_t *data, uint32_t data_len);
3555
3567S2N_API extern int s2n_async_pkey_op_set_output(struct s2n_async_pkey_op *op, const uint8_t *data, uint32_t data_len);
3568
3588typedef int (*s2n_key_log_fn)(void *ctx, struct s2n_connection *conn, uint8_t *logline, size_t len);
3589
3607S2N_API extern int s2n_config_set_key_log_cb(struct s2n_config *config, s2n_key_log_fn callback, void *ctx);
3608
3615S2N_API extern int s2n_config_enable_cert_req_dss_legacy_compat(struct s2n_config *config);
3616
3627S2N_API int s2n_config_set_server_max_early_data_size(struct s2n_config *config, uint32_t max_early_data_size);
3628
3639S2N_API int s2n_connection_set_server_max_early_data_size(struct s2n_connection *conn, uint32_t max_early_data_size);
3640
3656S2N_API int s2n_connection_set_server_early_data_context(struct s2n_connection *conn, const uint8_t *context, uint16_t context_size);
3657
3673S2N_API int s2n_psk_configure_early_data(struct s2n_psk *psk, uint32_t max_early_data_size,
3674 uint8_t cipher_suite_first_byte, uint8_t cipher_suite_second_byte);
3675
3687S2N_API int s2n_psk_set_application_protocol(struct s2n_psk *psk, const uint8_t *application_protocol, uint8_t size);
3688
3700S2N_API int s2n_psk_set_early_data_context(struct s2n_psk *psk, const uint8_t *context, uint16_t size);
3701
3711typedef enum {
3712 S2N_EARLY_DATA_STATUS_OK,
3713 S2N_EARLY_DATA_STATUS_NOT_REQUESTED,
3714 S2N_EARLY_DATA_STATUS_REJECTED,
3715 S2N_EARLY_DATA_STATUS_END,
3717
3728
3740S2N_API int s2n_connection_get_remaining_early_data_size(struct s2n_connection *conn, uint32_t *allowed_early_data_size);
3741
3753S2N_API int s2n_connection_get_max_early_data_size(struct s2n_connection *conn, uint32_t *max_early_data_size);
3754
3769S2N_API int s2n_send_early_data(struct s2n_connection *conn, const uint8_t *data, ssize_t data_len,
3770 ssize_t *data_sent, s2n_blocked_status *blocked);
3771
3786S2N_API int s2n_recv_early_data(struct s2n_connection *conn, uint8_t *data, ssize_t max_data_len,
3787 ssize_t *data_received, s2n_blocked_status *blocked);
3788
3789struct s2n_offered_early_data;
3790
3808typedef int (*s2n_early_data_cb)(struct s2n_connection *conn, struct s2n_offered_early_data *early_data);
3809
3817S2N_API int s2n_config_set_early_data_cb(struct s2n_config *config, s2n_early_data_cb cb);
3818
3826S2N_API int s2n_offered_early_data_get_context_length(struct s2n_offered_early_data *early_data, uint16_t *context_len);
3827
3836S2N_API int s2n_offered_early_data_get_context(struct s2n_offered_early_data *early_data, uint8_t *context, uint16_t max_len);
3837
3844S2N_API int s2n_offered_early_data_reject(struct s2n_offered_early_data *early_data);
3845
3852S2N_API int s2n_offered_early_data_accept(struct s2n_offered_early_data *early_data);
3853
3879S2N_API int s2n_config_get_supported_groups(struct s2n_config *config, uint16_t *groups, uint16_t groups_count_max,
3880 uint16_t *groups_count);
3881
3882/* Indicates which serialized connection version will be provided. The default value is
3883 * S2N_SERIALIZED_CONN_NONE, which indicates the feature is off.
3884 */
3885typedef enum {
3886 S2N_SERIALIZED_CONN_NONE = 0,
3887 S2N_SERIALIZED_CONN_V1 = 1
3888} s2n_serialization_version;
3889
3902S2N_API int s2n_config_set_serialization_version(struct s2n_config *config, s2n_serialization_version version);
3903
3915S2N_API int s2n_connection_serialization_length(struct s2n_connection *conn, uint32_t *length);
3916
3944S2N_API int s2n_connection_serialize(struct s2n_connection *conn, uint8_t *buffer, uint32_t buffer_length);
3945
3967S2N_API int s2n_connection_deserialize(struct s2n_connection *conn, uint8_t *buffer, uint32_t buffer_length);
3968
3969/* Load all acceptable certificate authorities from the currently configured trust store.
3970 *
3971 * The loaded certificate authorities will be advertised during the handshake.
3972 * This can help your peer select a certificate if they have multiple certificate
3973 * chains available.
3974 *
3975 * For now, s2n-tls only supports advertising certificate authorities to support
3976 * client auth, so only servers will send the list of certificate authorities.
3977 *
3978 * To avoid configuration mistakes, certificate authorities cannot be loaded from
3979 * a trust store that includes the default system certificates. That means that
3980 * s2n_config_new_minimal or s2n_config_wipe_trust_store should be used.
3981 *
3982 * s2n-tls currently limits the total certificate authorities size to 10k bytes.
3983 * This method will fail if the certificate authorities retrieved from the trust
3984 * store exceed that limit.
3985 *
3986 * @param config A pointer to the s2n_config object.
3987 * @returns S2N_SUCCESS on success. S2N_FAILURE on failure.
3988 */
3989S2N_API int s2n_config_set_cert_authorities_from_trust_store(struct s2n_config *config);
3990
3991#ifdef __cplusplus
3992}
3993#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:775
int s2n_client_hello_fn(struct s2n_connection *conn, void *ctx)
Definition: s2n.h:1391
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:2679
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:1795
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:327
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:622
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:3460
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:2013
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:3135
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:3257
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:3435
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:2988
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:142
@ S2N_ERR_T_OK
Definition: s2n.h:144
@ S2N_ERR_T_CLOSED
Definition: s2n.h:148
@ S2N_ERR_T_USAGE
Definition: s2n.h:158
@ S2N_ERR_T_ALERT
Definition: s2n.h:152
@ S2N_ERR_T_INTERNAL
Definition: s2n.h:156
@ S2N_ERR_T_IO
Definition: s2n.h:146
@ S2N_ERR_T_BLOCKED
Definition: s2n.h:150
@ S2N_ERR_T_PROTO
Definition: s2n.h:154
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:3588
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:585
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:349
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:647
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:549
int(* s2n_rand_cleanup_callback)(void)
Definition: s2n.h:573
int(* s2n_mem_init_callback)(void)
Definition: s2n.h:529
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:1337
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:1400
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:1126
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:2898
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:2398
int(* s2n_session_ticket_fn)(struct s2n_connection *conn, void *ctx, struct s2n_session_ticket *ticket)
Definition: s2n.h:2521
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:996
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:544
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:2665
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:652
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:2077
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:3711
S2N_API struct s2n_psk * s2n_external_psk_new(void)
s2n_tls_extension_type
Definition: s2n.h:606
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:1175
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:376
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:1800
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:364
int(* s2n_rand_init_callback)(void)
Definition: s2n.h:568
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:3808
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:534
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:579
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:1151
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:3443
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:2183
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)