25 #ifndef BR_BEARSSL_SSL_H__ 26 #define BR_BEARSSL_SSL_H__ 61 #define BR_SSL_BUFSIZE_INPUT (16384 + 325) 64 #define BR_SSL_BUFSIZE_OUTPUT (16384 + 85) 68 #define BR_SSL_BUFSIZE_MONO BR_SSL_BUFSIZE_INPUT 72 #define BR_SSL_BUFSIZE_BIDI (BR_SSL_BUFSIZE_INPUT + BR_SSL_BUFSIZE_OUTPUT) 81 #define BR_SSL30 0x0300 83 #define BR_TLS10 0x0301 85 #define BR_TLS11 0x0302 87 #define BR_TLS12 0x0303 102 #define BR_ERR_BAD_PARAM 1 107 #define BR_ERR_BAD_STATE 2 110 #define BR_ERR_UNSUPPORTED_VERSION 3 114 #define BR_ERR_BAD_VERSION 4 117 #define BR_ERR_BAD_LENGTH 5 121 #define BR_ERR_TOO_LARGE 6 125 #define BR_ERR_BAD_MAC 7 129 #define BR_ERR_NO_RANDOM 8 132 #define BR_ERR_UNKNOWN_TYPE 9 136 #define BR_ERR_UNEXPECTED 10 140 #define BR_ERR_BAD_CCS 12 144 #define BR_ERR_BAD_ALERT 13 147 #define BR_ERR_BAD_HANDSHAKE 14 151 #define BR_ERR_OVERSIZED_ID 15 156 #define BR_ERR_BAD_CIPHER_SUITE 16 160 #define BR_ERR_BAD_COMPRESSION 17 164 #define BR_ERR_BAD_FRAGLEN 18 167 #define BR_ERR_BAD_SECRENEG 19 172 #define BR_ERR_EXTRA_EXTENSION 20 176 #define BR_ERR_BAD_SNI 21 180 #define BR_ERR_BAD_HELLO_DONE 22 184 #define BR_ERR_LIMIT_EXCEEDED 23 188 #define BR_ERR_BAD_FINISHED 24 192 #define BR_ERR_RESUME_MISMATCH 25 196 #define BR_ERR_INVALID_ALGORITHM 26 200 #define BR_ERR_BAD_SIGNATURE 27 204 #define BR_ERR_WRONG_KEY_USAGE 28 208 #define BR_ERR_NO_CLIENT_AUTH 29 219 #define BR_ERR_RECV_FATAL_ALERT 256 225 #define BR_ERR_SEND_FATAL_ALERT 512 278 unsigned char *(*decrypt)(
const br_sslrec_in_class **ctx,
279 int record_type,
unsigned version,
280 void *payload,
size_t *len);
317 void (*max_plaintext)(
const br_sslrec_out_class *
const *ctx,
318 size_t *start,
size_t *end);
337 unsigned char *(*encrypt)(
const br_sslrec_out_class **ctx,
338 int record_type,
unsigned version,
339 void *plaintext,
size_t *len);
389 void (*init)(
const br_sslrec_in_cbc_class **ctx,
390 const br_block_cbcdec_class *bc_impl,
391 const void *bc_key,
size_t bc_key_len,
392 const br_hash_class *dig_impl,
393 const void *mac_key,
size_t mac_key_len,
size_t mac_out_len,
428 void (*init)(
const br_sslrec_out_cbc_class **ctx,
429 const br_block_cbcenc_class *bc_impl,
430 const void *bc_key,
size_t bc_key_len,
431 const br_hash_class *dig_impl,
432 const void *mac_key,
size_t mac_key_len,
size_t mac_out_len,
446 #ifndef BR_DOXYGEN_IGNORE 449 const br_block_cbcdec_class *vtable;
455 unsigned char iv[16];
475 #ifndef BR_DOXYGEN_IGNORE 478 const br_block_cbcenc_class *vtable;
484 unsigned char iv[16];
523 void (*init)(
const br_sslrec_in_gcm_class **ctx,
524 const br_block_ctr_class *bc_impl,
525 const void *key,
size_t key_len,
557 void (*init)(
const br_sslrec_out_gcm_class **ctx,
558 const br_block_ctr_class *bc_impl,
559 const void *key,
size_t key_len,
576 const br_sslrec_in_gcm_class *
in;
577 const br_sslrec_out_gcm_class *
out;
579 #ifndef BR_DOXYGEN_IGNORE 582 const br_block_ctr_class *vtable;
629 void (*init)(
const br_sslrec_in_chapol_class **ctx,
632 const void *key,
const void *iv);
661 void (*init)(
const br_sslrec_out_chapol_class **ctx,
664 const void *key,
const void *iv);
679 const br_sslrec_in_chapol_class *
in;
680 const br_sslrec_out_chapol_class *
out;
682 #ifndef BR_DOXYGEN_IGNORE 684 unsigned char key[32];
685 unsigned char iv[12];
730 void (*init)(
const br_sslrec_in_ccm_class **ctx,
731 const br_block_ctrcbc_class *bc_impl,
732 const void *key,
size_t key_len,
733 const void *iv,
size_t tag_len);
763 void (*init)(
const br_sslrec_out_ccm_class **ctx,
764 const br_block_ctrcbc_class *bc_impl,
765 const void *key,
size_t key_len,
766 const void *iv,
size_t tag_len);
781 const br_sslrec_in_ccm_class *
in;
782 const br_sslrec_out_ccm_class *
out;
784 #ifndef BR_DOXYGEN_IGNORE 787 const br_block_ctrcbc_class *vtable;
812 unsigned char session_id[32];
820 unsigned char master_secret[48];
823 #ifndef BR_DOXYGEN_IGNORE 827 #define BR_MAX_CIPHER_SUITES 48 846 #ifndef BR_DOXYGEN_IGNORE 856 unsigned char *ibuf, *obuf;
857 size_t ibuf_len, obuf_len;
865 uint16_t max_frag_len;
866 unsigned char log_max_frag_len;
867 unsigned char peer_log_max_frag_len;
872 size_t ixa, ixb, ixc;
873 size_t oxa, oxb, oxc;
874 unsigned char iomode;
875 unsigned char incrypt;
883 unsigned char shutdown_recv;
891 unsigned char record_type_in, record_type_out;
910 uint16_t version_out;
916 const br_sslrec_in_class *vtable;
923 const br_sslrec_out_class *vtable;
938 unsigned char application_data;
953 int rng_os_rand_done;
958 uint16_t version_min;
959 uint16_t version_max;
960 uint16_t suites_buf[BR_MAX_CIPHER_SUITES];
961 unsigned char suites_num;
967 char server_name[256];
973 unsigned char client_random[32];
974 unsigned char server_random[32];
981 unsigned char ecdhe_curve;
982 unsigned char ecdhe_point[133];
983 unsigned char ecdhe_point_len;
996 unsigned char saved_finished[24];
1013 const unsigned char *ip;
1015 uint32_t dp_stack[32];
1016 uint32_t rp_stack[32];
1017 unsigned char pad[512];
1018 unsigned char *hbuf_in, *hbuf_out, *saved_hbuf_out;
1019 size_t hlen_in, hlen_out;
1020 void (*hsrun)(
void *ctx);
1031 unsigned char action;
1038 unsigned char alert;
1044 unsigned char close_received;
1057 const br_x509_class **x509ctx;
1066 const unsigned char *cert_cur;
1086 const char **protocol_names;
1087 uint16_t protocol_names_num;
1088 uint16_t selected_protocol;
1098 const br_block_cbcenc_class *iaes_cbcenc;
1099 const br_block_cbcdec_class *iaes_cbcdec;
1100 const br_block_ctr_class *iaes_ctr;
1101 const br_block_ctrcbc_class *iaes_ctrcbc;
1102 const br_block_cbcenc_class *ides_cbcenc;
1103 const br_block_cbcdec_class *ides_cbcdec;
1107 const br_sslrec_in_cbc_class *icbc_in;
1108 const br_sslrec_out_cbc_class *icbc_out;
1109 const br_sslrec_in_gcm_class *igcm_in;
1110 const br_sslrec_out_gcm_class *igcm_out;
1111 const br_sslrec_in_chapol_class *ichapol_in;
1112 const br_sslrec_out_chapol_class *ichapol_out;
1113 const br_sslrec_in_ccm_class *iccm_in;
1114 const br_sslrec_out_ccm_class *iccm_out;
1127 static inline uint32_t
1172 cc->flags &= ~flags;
1181 #define BR_OPT_ENFORCE_SERVER_PREFERENCES ((uint32_t)1 << 0) 1190 #define BR_OPT_NO_RENEGOTIATION ((uint32_t)1 << 1) 1210 #define BR_OPT_TOLERATE_NO_CLIENT_AUTH ((uint32_t)1 << 2) 1236 #define BR_OPT_FAIL_ON_ALPN_MISMATCH ((uint32_t)1 << 3) 1251 unsigned version_min,
unsigned version_max)
1253 cc->version_min = version_min;
1254 cc->version_max = version_max;
1277 const uint16_t *suites,
size_t suites_num);
1290 cc->x509ctx = x509ctx;
1324 const char **names,
size_t num)
1326 ctx->protocol_names = names;
1327 ctx->protocol_names_num = num;
1343 static inline const char *
1348 k = ctx->selected_protocol;
1349 return (k == 0 || k == 0xFFFF) ? NULL : ctx->protocol_names[k - 1];
1366 int id,
const br_hash_class *impl)
1381 static inline const br_hash_class *
1414 cc->prf_sha256 = impl;
1429 cc->prf_sha384 = impl;
1441 const br_block_cbcenc_class *impl_enc,
1442 const br_block_cbcdec_class *impl_dec)
1444 cc->iaes_cbcenc = impl_enc;
1445 cc->iaes_cbcdec = impl_dec;
1468 const br_block_ctr_class *impl)
1470 cc->iaes_ctr = impl;
1494 const br_block_cbcenc_class *impl_enc,
1495 const br_block_cbcdec_class *impl_dec)
1497 cc->ides_cbcenc = impl_enc;
1498 cc->ides_cbcdec = impl_dec;
1535 cc->ichacha = ichacha;
1571 const br_block_ctrcbc_class *impl)
1573 cc->iaes_ctrcbc = impl;
1597 const br_sslrec_in_cbc_class *impl_in,
1598 const br_sslrec_out_cbc_class *impl_out)
1600 cc->icbc_in = impl_in;
1601 cc->icbc_out = impl_out;
1613 const br_sslrec_in_gcm_class *impl_in,
1614 const br_sslrec_out_gcm_class *impl_out)
1616 cc->igcm_in = impl_in;
1617 cc->igcm_out = impl_out;
1629 const br_sslrec_in_ccm_class *impl_in,
1630 const br_sslrec_out_ccm_class *impl_out)
1632 cc->iccm_in = impl_in;
1633 cc->iccm_out = impl_out;
1646 const br_sslrec_in_chapol_class *impl_in,
1647 const br_sslrec_out_chapol_class *impl_out)
1649 cc->ichapol_in = impl_in;
1650 cc->ichapol_out = impl_out;
1705 cc->irsavrfy = irsavrfy;
1728 return cc->irsavrfy;
1749 cc->iecdsa = iecdsa;
1808 void *iobuf,
size_t iobuf_len,
int bidi);
1831 void *ibuf,
size_t ibuf_len,
void *obuf,
size_t obuf_len);
1865 const void *data,
size_t len);
1883 static inline const char *
1886 return cc->server_name;
1899 static inline unsigned 1902 return cc->session.version;
1924 memcpy(pp, &cc->session,
sizeof *pp);
1941 memcpy(&cc->session, pp,
sizeof *pp);
1960 return cc->ecdhe_curve;
2009 #define BR_SSL_CLOSED 0x0001 2011 #define BR_SSL_SENDREC 0x0002 2013 #define BR_SSL_RECVREC 0x0004 2015 #define BR_SSL_SENDAPP 0x0008 2017 #define BR_SSL_RECVAPP 0x0010 2269 void *dst,
size_t len,
const char *label,
2270 const void *context,
size_t context_len);
2331 #define BR_AUTH_ECDH 0 2333 #define BR_AUTH_RSA 1 2335 #define BR_AUTH_ECDSA 3 2366 void (*start_name_list)(
const br_ssl_client_certificate_class **pctx);
2377 void (*start_name)(
const br_ssl_client_certificate_class **pctx,
2391 void (*append_name)(
const br_ssl_client_certificate_class **pctx,
2392 const unsigned char *data,
size_t len);
2402 void (*end_name)(
const br_ssl_client_certificate_class **pctx);
2412 void (*end_name_list)(
const br_ssl_client_certificate_class **pctx);
2458 void (*choose)(
const br_ssl_client_certificate_class **pctx,
2459 const br_ssl_client_context *cc, uint32_t auth_types,
2504 uint32_t (*do_keyx)(
const br_ssl_client_certificate_class **pctx,
2505 unsigned char *data,
size_t *len);
2542 size_t (*do_sign)(
const br_ssl_client_certificate_class **pctx,
2543 int hash_id,
size_t hv_len,
unsigned char *data,
size_t len);
2557 const br_ssl_client_certificate_class *
vtable;
2558 #ifndef BR_DOXYGEN_IGNORE 2580 const br_ssl_client_certificate_class *
vtable;
2581 #ifndef BR_DOXYGEN_IGNORE 2585 unsigned allowed_usages;
2586 unsigned issuer_key_type;
2607 #ifndef BR_DOXYGEN_IGNORE 2614 uint16_t min_clienthello_len;
2630 const br_ssl_client_certificate_class **client_auth_vtable;
2635 unsigned char auth_type;
2641 unsigned char hash_id;
2648 const br_ssl_client_certificate_class *vtable;
2690 static inline uint32_t
2708 return cc->server_curve;
2760 const br_ssl_client_certificate_class **pctx)
2762 cc->client_auth_vtable = pctx;
2777 cc->irsapub = irsapub;
2811 cc->min_clienthello_len = len;
2845 const char *server_name,
int resume_session);
2859 cc->eng.session.session_id_len = 0;
2926 unsigned cert_issuer_key_type,
2982 #ifndef BR_DOXYGEN_IGNORE 2987 #define BR_SSLKEYX_RSA 0 2988 #define BR_SSLKEYX_ECDHE_RSA 1 2989 #define BR_SSLKEYX_ECDHE_ECDSA 2 2990 #define BR_SSLKEYX_ECDH_RSA 3 2991 #define BR_SSLKEYX_ECDH_ECDSA 4 2993 #define BR_SSLENC_3DES_CBC 0 2994 #define BR_SSLENC_AES128_CBC 1 2995 #define BR_SSLENC_AES256_CBC 2 2996 #define BR_SSLENC_AES128_GCM 3 2997 #define BR_SSLENC_AES256_GCM 4 2998 #define BR_SSLENC_CHACHA20 5 3000 #define BR_SSLMAC_AEAD 0 3001 #define BR_SSLMAC_SHA1 br_sha1_ID 3002 #define BR_SSLMAC_SHA256 br_sha256_ID 3003 #define BR_SSLMAC_SHA384 br_sha384_ID 3005 #define BR_SSLPRF_SHA256 br_sha256_ID 3006 #define BR_SSLPRF_SHA384 br_sha384_ID 3134 int (*choose)(
const br_ssl_server_policy_class **pctx,
3135 const br_ssl_server_context *cc,
3189 uint32_t (*do_keyx)(
const br_ssl_server_policy_class **pctx,
3190 unsigned char *data,
size_t *len);
3231 size_t (*do_sign)(
const br_ssl_server_policy_class **pctx,
3233 unsigned char *data,
size_t hv_len,
size_t len);
3249 #ifndef BR_DOXYGEN_IGNORE 3253 unsigned allowed_usages;
3276 #ifndef BR_DOXYGEN_IGNORE 3280 unsigned allowed_usages;
3281 unsigned cert_issuer_key_type;
3317 void (*save)(
const br_ssl_session_cache_class **ctx,
3318 br_ssl_server_context *server_ctx,
3335 int (*load)(
const br_ssl_session_cache_class **ctx,
3336 br_ssl_server_context *server_ctx,
3357 #ifndef BR_DOXYGEN_IGNORE 3358 unsigned char *store;
3359 size_t store_len, store_ptr;
3360 unsigned char index_key[32];
3361 const br_hash_class *hash;
3363 uint32_t head, tail, root;
3379 unsigned char *store,
size_t store_len);
3408 #ifndef BR_DOXYGEN_IGNORE 3412 uint16_t client_max_version;
3417 const br_ssl_session_cache_class **cache_vtable;
3425 br_suite_translated client_suites[BR_MAX_CIPHER_SUITES];
3426 unsigned char client_suites_num;
3444 const br_ssl_server_policy_class **policy_vtable;
3445 uint16_t sign_hash_id;
3452 const br_ssl_server_policy_class *vtable;
3460 unsigned char ecdhe_key[70];
3461 size_t ecdhe_key_len;
3470 size_t cur_dn_index;
3471 const unsigned char *cur_dn;
3478 unsigned char hash_CV[64];
3700 static inline const br_suite_translated *
3703 *num = cc->client_suites_num;
3704 return cc->client_suites;
3737 static inline uint32_t
3751 static inline uint32_t
3780 const br_ssl_server_policy_class **pctx)
3782 cc->policy_vtable = pctx;
3835 unsigned cert_issuer_key_type,
3861 cc->ta_names = ta_names;
3888 cc->ta_names = NULL;
3904 const br_ssl_session_cache_class **vtable)
3906 cc->cache_vtable = vtable;
3952 #ifndef BR_DOXYGEN_IGNORE 3954 int (*low_read)(
void *read_context,
3955 unsigned char *data,
size_t len);
3957 int (*low_write)(
void *write_context,
3958 const unsigned char *data,
size_t len);
3959 void *write_context;
4012 int (*low_read)(
void *read_context,
4013 unsigned char *data,
size_t len),
4015 int (*low_write)(
void *write_context,
4016 const unsigned char *data,
size_t len),
4017 void *write_context);
4146 #define BR_TLS_NULL_WITH_NULL_NULL 0x0000 4147 #define BR_TLS_RSA_WITH_NULL_MD5 0x0001 4148 #define BR_TLS_RSA_WITH_NULL_SHA 0x0002 4149 #define BR_TLS_RSA_WITH_NULL_SHA256 0x003B 4150 #define BR_TLS_RSA_WITH_RC4_128_MD5 0x0004 4151 #define BR_TLS_RSA_WITH_RC4_128_SHA 0x0005 4152 #define BR_TLS_RSA_WITH_3DES_EDE_CBC_SHA 0x000A 4153 #define BR_TLS_RSA_WITH_AES_128_CBC_SHA 0x002F 4154 #define BR_TLS_RSA_WITH_AES_256_CBC_SHA 0x0035 4155 #define BR_TLS_RSA_WITH_AES_128_CBC_SHA256 0x003C 4156 #define BR_TLS_RSA_WITH_AES_256_CBC_SHA256 0x003D 4157 #define BR_TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA 0x000D 4158 #define BR_TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA 0x0010 4159 #define BR_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA 0x0013 4160 #define BR_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA 0x0016 4161 #define BR_TLS_DH_DSS_WITH_AES_128_CBC_SHA 0x0030 4162 #define BR_TLS_DH_RSA_WITH_AES_128_CBC_SHA 0x0031 4163 #define BR_TLS_DHE_DSS_WITH_AES_128_CBC_SHA 0x0032 4164 #define BR_TLS_DHE_RSA_WITH_AES_128_CBC_SHA 0x0033 4165 #define BR_TLS_DH_DSS_WITH_AES_256_CBC_SHA 0x0036 4166 #define BR_TLS_DH_RSA_WITH_AES_256_CBC_SHA 0x0037 4167 #define BR_TLS_DHE_DSS_WITH_AES_256_CBC_SHA 0x0038 4168 #define BR_TLS_DHE_RSA_WITH_AES_256_CBC_SHA 0x0039 4169 #define BR_TLS_DH_DSS_WITH_AES_128_CBC_SHA256 0x003E 4170 #define BR_TLS_DH_RSA_WITH_AES_128_CBC_SHA256 0x003F 4171 #define BR_TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 0x0040 4172 #define BR_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 0x0067 4173 #define BR_TLS_DH_DSS_WITH_AES_256_CBC_SHA256 0x0068 4174 #define BR_TLS_DH_RSA_WITH_AES_256_CBC_SHA256 0x0069 4175 #define BR_TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 0x006A 4176 #define BR_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 0x006B 4177 #define BR_TLS_DH_anon_WITH_RC4_128_MD5 0x0018 4178 #define BR_TLS_DH_anon_WITH_3DES_EDE_CBC_SHA 0x001B 4179 #define BR_TLS_DH_anon_WITH_AES_128_CBC_SHA 0x0034 4180 #define BR_TLS_DH_anon_WITH_AES_256_CBC_SHA 0x003A 4181 #define BR_TLS_DH_anon_WITH_AES_128_CBC_SHA256 0x006C 4182 #define BR_TLS_DH_anon_WITH_AES_256_CBC_SHA256 0x006D 4185 #define BR_TLS_ECDH_ECDSA_WITH_NULL_SHA 0xC001 4186 #define BR_TLS_ECDH_ECDSA_WITH_RC4_128_SHA 0xC002 4187 #define BR_TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA 0xC003 4188 #define BR_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA 0xC004 4189 #define BR_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA 0xC005 4190 #define BR_TLS_ECDHE_ECDSA_WITH_NULL_SHA 0xC006 4191 #define BR_TLS_ECDHE_ECDSA_WITH_RC4_128_SHA 0xC007 4192 #define BR_TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA 0xC008 4193 #define BR_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA 0xC009 4194 #define BR_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA 0xC00A 4195 #define BR_TLS_ECDH_RSA_WITH_NULL_SHA 0xC00B 4196 #define BR_TLS_ECDH_RSA_WITH_RC4_128_SHA 0xC00C 4197 #define BR_TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA 0xC00D 4198 #define BR_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA 0xC00E 4199 #define BR_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA 0xC00F 4200 #define BR_TLS_ECDHE_RSA_WITH_NULL_SHA 0xC010 4201 #define BR_TLS_ECDHE_RSA_WITH_RC4_128_SHA 0xC011 4202 #define BR_TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA 0xC012 4203 #define BR_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA 0xC013 4204 #define BR_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA 0xC014 4205 #define BR_TLS_ECDH_anon_WITH_NULL_SHA 0xC015 4206 #define BR_TLS_ECDH_anon_WITH_RC4_128_SHA 0xC016 4207 #define BR_TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA 0xC017 4208 #define BR_TLS_ECDH_anon_WITH_AES_128_CBC_SHA 0xC018 4209 #define BR_TLS_ECDH_anon_WITH_AES_256_CBC_SHA 0xC019 4212 #define BR_TLS_RSA_WITH_AES_128_GCM_SHA256 0x009C 4213 #define BR_TLS_RSA_WITH_AES_256_GCM_SHA384 0x009D 4214 #define BR_TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 0x009E 4215 #define BR_TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 0x009F 4216 #define BR_TLS_DH_RSA_WITH_AES_128_GCM_SHA256 0x00A0 4217 #define BR_TLS_DH_RSA_WITH_AES_256_GCM_SHA384 0x00A1 4218 #define BR_TLS_DHE_DSS_WITH_AES_128_GCM_SHA256 0x00A2 4219 #define BR_TLS_DHE_DSS_WITH_AES_256_GCM_SHA384 0x00A3 4220 #define BR_TLS_DH_DSS_WITH_AES_128_GCM_SHA256 0x00A4 4221 #define BR_TLS_DH_DSS_WITH_AES_256_GCM_SHA384 0x00A5 4222 #define BR_TLS_DH_anon_WITH_AES_128_GCM_SHA256 0x00A6 4223 #define BR_TLS_DH_anon_WITH_AES_256_GCM_SHA384 0x00A7 4226 #define BR_TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256 0xC023 4227 #define BR_TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384 0xC024 4228 #define BR_TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256 0xC025 4229 #define BR_TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384 0xC026 4230 #define BR_TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256 0xC027 4231 #define BR_TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384 0xC028 4232 #define BR_TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256 0xC029 4233 #define BR_TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384 0xC02A 4234 #define BR_TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 0xC02B 4235 #define BR_TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384 0xC02C 4236 #define BR_TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256 0xC02D 4237 #define BR_TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384 0xC02E 4238 #define BR_TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 0xC02F 4239 #define BR_TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 0xC030 4240 #define BR_TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256 0xC031 4241 #define BR_TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384 0xC032 4244 #define BR_TLS_RSA_WITH_AES_128_CCM 0xC09C 4245 #define BR_TLS_RSA_WITH_AES_256_CCM 0xC09D 4246 #define BR_TLS_RSA_WITH_AES_128_CCM_8 0xC0A0 4247 #define BR_TLS_RSA_WITH_AES_256_CCM_8 0xC0A1 4248 #define BR_TLS_ECDHE_ECDSA_WITH_AES_128_CCM 0xC0AC 4249 #define BR_TLS_ECDHE_ECDSA_WITH_AES_256_CCM 0xC0AD 4250 #define BR_TLS_ECDHE_ECDSA_WITH_AES_128_CCM_8 0xC0AE 4251 #define BR_TLS_ECDHE_ECDSA_WITH_AES_256_CCM_8 0xC0AF 4254 #define BR_TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256 0xCCA8 4255 #define BR_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256 0xCCA9 4256 #define BR_TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256 0xCCAA 4257 #define BR_TLS_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAB 4258 #define BR_TLS_ECDHE_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAC 4259 #define BR_TLS_DHE_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAD 4260 #define BR_TLS_RSA_PSK_WITH_CHACHA20_POLY1305_SHA256 0xCCAE 4263 #define BR_TLS_FALLBACK_SCSV 0x5600 4268 #define BR_ALERT_CLOSE_NOTIFY 0 4269 #define BR_ALERT_UNEXPECTED_MESSAGE 10 4270 #define BR_ALERT_BAD_RECORD_MAC 20 4271 #define BR_ALERT_RECORD_OVERFLOW 22 4272 #define BR_ALERT_DECOMPRESSION_FAILURE 30 4273 #define BR_ALERT_HANDSHAKE_FAILURE 40 4274 #define BR_ALERT_BAD_CERTIFICATE 42 4275 #define BR_ALERT_UNSUPPORTED_CERTIFICATE 43 4276 #define BR_ALERT_CERTIFICATE_REVOKED 44 4277 #define BR_ALERT_CERTIFICATE_EXPIRED 45 4278 #define BR_ALERT_CERTIFICATE_UNKNOWN 46 4279 #define BR_ALERT_ILLEGAL_PARAMETER 47 4280 #define BR_ALERT_UNKNOWN_CA 48 4281 #define BR_ALERT_ACCESS_DENIED 49 4282 #define BR_ALERT_DECODE_ERROR 50 4283 #define BR_ALERT_DECRYPT_ERROR 51 4284 #define BR_ALERT_PROTOCOL_VERSION 70 4285 #define BR_ALERT_INSUFFICIENT_SECURITY 71 4286 #define BR_ALERT_INTERNAL_ERROR 80 4287 #define BR_ALERT_USER_CANCELED 90 4288 #define BR_ALERT_NO_RENEGOTIATION 100 4289 #define BR_ALERT_UNSUPPORTED_EXTENSION 110 4290 #define BR_ALERT_NO_APPLICATION_PROTOCOL 120
Type for the client certificate, if requested by the server.
Definition: bearssl_ssl.h:2280
Type for the server policy choices, taken after analysis of the client message (ClientHello).
Definition: bearssl_ssl.h:3019
Context structure for processing records with GCM.
Definition: bearssl_ssl.h:572
Type for an X.509 certificate (DER-encoded).
Definition: bearssl_x509.h:1098
unsigned algo_id
Hash function or algorithm for signing the ServerKeyExchange.
Definition: bearssl_ssl.h:3066
int auth_type
Authentication type.
Definition: bearssl_ssl.h:2287
br_sslrec_in_class inner
Superclass, as first vtable field.
Definition: bearssl_ssl.h:372
Record encryption engine class, for GCM mode.
Definition: bearssl_ssl.h:539
const br_sslrec_in_gcm_class * in
Definition: bearssl_ssl.h:576
br_ssl_engine_context eng
The encapsulated engine context.
Definition: bearssl_ssl.h:2605
const br_ssl_server_policy_class * vtable
Pointer to vtable.
Definition: bearssl_ssl.h:3248
size_t context_size
Context size (in bytes).
Definition: bearssl_ssl.h:3303
A single-chain RSA client certificate handler.
Definition: bearssl_ssl.h:2555
const br_x509_certificate * chain
Certificate chain to send to the client.
Definition: bearssl_ssl.h:3075
Class type for a session parameter cache.
Definition: bearssl_ssl.h:3299
br_sslrec_out_class inner
Superclass, as first vtable field.
Definition: bearssl_ssl.h:411
const void * gen
Definition: bearssl_ssl.h:780
br_sslrec_in_class inner
Superclass, as first vtable field.
Definition: bearssl_ssl.h:616
const br_ssl_session_cache_class * vtable
Pointer to vtable.
Definition: bearssl_ssl.h:3356
A single-chain RSA policy handler.
Definition: bearssl_ssl.h:3246
int(* check_length)(const br_sslrec_in_class *const *ctx, size_t record_len)
Test validity of the incoming record length.
Definition: bearssl_ssl.h:256
uint16_t cipher_suite
Cipher suite.
Definition: bearssl_ssl.h:818
const br_sslrec_in_cbc_class * vtable
Pointer to vtable.
Definition: bearssl_ssl.h:445
Record encryption engine class, for CCM mode.
Definition: bearssl_ssl.h:745
Aggregate structure large enough to be used as context for subkeys (CTR encryption/decryption + CBC-M...
Definition: bearssl_block.h:2200
const br_x509_certificate * chain
Certificate chain to send to the server.
Definition: bearssl_ssl.h:2314
Context structure for processing records with ChaCha20+Poly1305.
Definition: bearssl_ssl.h:675
const br_ssl_server_policy_class * vtable
Pointer to vtable.
Definition: bearssl_ssl.h:3275
const br_sslrec_in_ccm_class * in
Definition: bearssl_ssl.h:781
Distinguished Name (X.500) structure.
Definition: bearssl_x509.h:245
Context structure for a SSL client.
Definition: bearssl_ssl.h:2601
size_t context_size
Context size (in bytes).
Definition: bearssl_ssl.h:3101
const br_sslrec_out_chapol_class * out
Definition: bearssl_ssl.h:680
Context for a no-encryption engine.
Definition: bearssl_ssl.h:348
br_sslrec_out_class inner
Superclass, as first vtable field.
Definition: bearssl_ssl.h:749
const br_sslrec_in_chapol_class * in
Definition: bearssl_ssl.h:679
Class type for a policy handler (server side).
Definition: bearssl_ssl.h:3097
Encryption engine for SSL.
Definition: bearssl_ssl.h:294
Type for session parameters, to be saved for session resumption.
Definition: bearssl_ssl.h:810
br_ssl_engine_context eng
The encapsulated engine context.
Definition: bearssl_ssl.h:3406
Multi-hasher context structure.
Definition: bearssl_hash.h:1107
Context structure for the simplified SSL I/O wrapper.
Definition: bearssl_ssl.h:3951
Context structure for SSL engine.
Definition: bearssl_ssl.h:845
Record encryption engine class, for CBC mode.
Definition: bearssl_ssl.h:407
Aggregate structure large enough to be used as context for subkeys (CTR encryption and decryption) fo...
Definition: bearssl_block.h:2186
const br_sslrec_out_cbc_class * vtable
Pointer to vtable.
Definition: bearssl_ssl.h:474
Context structure for decrypting incoming records with CBC + HMAC.
Definition: bearssl_ssl.h:443
Context for HMAC_DRBG.
Definition: bearssl_rand.h:196
int hash_id
Hash function for computing the CertificateVerify.
Definition: bearssl_ssl.h:2303
The "minimal" X.509 engine structure.
Definition: bearssl_x509.h:637
br_sslrec_in_class inner
Superclass, as first vtable field.
Definition: bearssl_ssl.h:509
uint16_t version
Protocol version.
Definition: bearssl_ssl.h:816
Trust anchor structure.
Definition: bearssl_x509.h:255
const br_sslrec_out_ccm_class * out
Definition: bearssl_ssl.h:782
HMAC key context.
Definition: bearssl_hmac.h:66
const br_ssl_client_certificate_class * vtable
Pointer to vtable.
Definition: bearssl_ssl.h:2557
size_t context_size
Context size (in bytes).
Definition: bearssl_ssl.h:244
A single-chain EC policy handler.
Definition: bearssl_ssl.h:3273
Record encryption engine class, for ChaCha20+Poly1305.
Definition: bearssl_ssl.h:644
size_t context_size
Context size (in bytes).
Definition: bearssl_ssl.h:2358
const br_ssl_client_certificate_class * vtable
Pointer to vtable.
Definition: bearssl_ssl.h:2580
Structure for an EC private key.
Definition: bearssl_ec.h:258
Decryption engine for SSL.
Definition: bearssl_ssl.h:240
Aggregate structure large enough to be used as context for subkeys (CBC encryption) for all AES imple...
Definition: bearssl_block.h:2158
Record decryption engine class, for CCM mode.
Definition: bearssl_ssl.h:712
Aggregate structure large enough to be used as context for subkeys (CBC encryption) for all DES imple...
Definition: bearssl_block.h:2403
uint16_t cipher_suite
Cipher suite to use with that client.
Definition: bearssl_ssl.h:3023
unsigned char session_id_len
Session ID length (in bytes, at most 32).
Definition: bearssl_ssl.h:814
Record decryption engine class, for ChaCha20+Poly1305.
Definition: bearssl_ssl.h:612
A single-chain EC client certificate handler.
Definition: bearssl_ssl.h:2578
const void * gen
Definition: bearssl_ssl.h:678
RSA private key.
Definition: bearssl_rsa.h:181
Context for a basic cache system.
Definition: bearssl_ssl.h:3354
Record decryption engine class, for CBC mode.
Definition: bearssl_ssl.h:368
size_t chain_len
Certificate chain length (number of certificates).
Definition: bearssl_ssl.h:3080
Context structure for encrypting outgoing records with CBC + HMAC.
Definition: bearssl_ssl.h:472
Record decryption engine class, for GCM mode.
Definition: bearssl_ssl.h:505
const br_sslrec_out_gcm_class * out
Definition: bearssl_ssl.h:577
Aggregate structure large enough to be used as context for subkeys (CBC decryption) for all AES imple...
Definition: bearssl_block.h:2172
Context structure for processing records with CCM.
Definition: bearssl_ssl.h:777
Aggregate structure large enough to be used as context for subkeys (CBC decryption) for all DES imple...
Definition: bearssl_block.h:2413
Class type for a certificate handler (client side).
Definition: bearssl_ssl.h:2354
const void * gen
Definition: bearssl_ssl.h:575
br_sslrec_out_class inner
Superclass, as first vtable field.
Definition: bearssl_ssl.h:543
Context structure for a SSL server.
Definition: bearssl_ssl.h:3402
Type for an EC implementation.
Definition: bearssl_ec.h:270
br_sslrec_out_class inner
Superclass, as first vtable field.
Definition: bearssl_ssl.h:648
const br_sslrec_out_class * vtable
No-encryption engine vtable.
Definition: bearssl_ssl.h:350
size_t chain_len
Certificate chain length (number of certificates).
Definition: bearssl_ssl.h:2322
size_t context_size
Context size (in bytes).
Definition: bearssl_ssl.h:298
br_sslrec_in_class inner
Superclass, as first vtable field.
Definition: bearssl_ssl.h:716