18#ifndef __PJ_SSL_SOCK_H__
19#define __PJ_SSL_SOCK_H__
141 PJ_SSL_CERT_NAME_UNKNOWN = 0,
142 PJ_SSL_CERT_NAME_RFC822,
143 PJ_SSL_CERT_NAME_DNS,
144 PJ_SSL_CERT_NAME_URI,
307 const char *error_strings[],
325 PJ_TLS_UNKNOWN_CIPHER = -1,
328 PJ_TLS_NULL_WITH_NULL_NULL = 0x00000000,
331 PJ_TLS_RSA_WITH_NULL_MD5 = 0x00000001,
332 PJ_TLS_RSA_WITH_NULL_SHA = 0x00000002,
333 PJ_TLS_RSA_WITH_NULL_SHA256 = 0x0000003B,
334 PJ_TLS_RSA_WITH_RC4_128_MD5 = 0x00000004,
335 PJ_TLS_RSA_WITH_RC4_128_SHA = 0x00000005,
336 PJ_TLS_RSA_WITH_3DES_EDE_CBC_SHA = 0x0000000A,
337 PJ_TLS_RSA_WITH_AES_128_CBC_SHA = 0x0000002F,
338 PJ_TLS_RSA_WITH_AES_256_CBC_SHA = 0x00000035,
339 PJ_TLS_RSA_WITH_AES_128_CBC_SHA256 = 0x0000003C,
340 PJ_TLS_RSA_WITH_AES_256_CBC_SHA256 = 0x0000003D,
341 PJ_TLS_DH_DSS_WITH_3DES_EDE_CBC_SHA = 0x0000000D,
342 PJ_TLS_DH_RSA_WITH_3DES_EDE_CBC_SHA = 0x00000010,
343 PJ_TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA = 0x00000013,
344 PJ_TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA = 0x00000016,
345 PJ_TLS_DH_DSS_WITH_AES_128_CBC_SHA = 0x00000030,
346 PJ_TLS_DH_RSA_WITH_AES_128_CBC_SHA = 0x00000031,
347 PJ_TLS_DHE_DSS_WITH_AES_128_CBC_SHA = 0x00000032,
348 PJ_TLS_DHE_RSA_WITH_AES_128_CBC_SHA = 0x00000033,
349 PJ_TLS_DH_DSS_WITH_AES_256_CBC_SHA = 0x00000036,
350 PJ_TLS_DH_RSA_WITH_AES_256_CBC_SHA = 0x00000037,
351 PJ_TLS_DHE_DSS_WITH_AES_256_CBC_SHA = 0x00000038,
352 PJ_TLS_DHE_RSA_WITH_AES_256_CBC_SHA = 0x00000039,
353 PJ_TLS_DH_DSS_WITH_AES_128_CBC_SHA256 = 0x0000003E,
354 PJ_TLS_DH_RSA_WITH_AES_128_CBC_SHA256 = 0x0000003F,
355 PJ_TLS_DHE_DSS_WITH_AES_128_CBC_SHA256 = 0x00000040,
356 PJ_TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 = 0x00000067,
357 PJ_TLS_DH_DSS_WITH_AES_256_CBC_SHA256 = 0x00000068,
358 PJ_TLS_DH_RSA_WITH_AES_256_CBC_SHA256 = 0x00000069,
359 PJ_TLS_DHE_DSS_WITH_AES_256_CBC_SHA256 = 0x0000006A,
360 PJ_TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 = 0x0000006B,
361 PJ_TLS_DH_anon_WITH_RC4_128_MD5 = 0x00000018,
362 PJ_TLS_DH_anon_WITH_3DES_EDE_CBC_SHA = 0x0000001B,
363 PJ_TLS_DH_anon_WITH_AES_128_CBC_SHA = 0x00000034,
364 PJ_TLS_DH_anon_WITH_AES_256_CBC_SHA = 0x0000003A,
365 PJ_TLS_DH_anon_WITH_AES_128_CBC_SHA256 = 0x0000006C,
366 PJ_TLS_DH_anon_WITH_AES_256_CBC_SHA256 = 0x0000006D,
369 PJ_TLS_RSA_EXPORT_WITH_RC4_40_MD5 = 0x00000003,
370 PJ_TLS_RSA_EXPORT_WITH_RC2_CBC_40_MD5 = 0x00000006,
371 PJ_TLS_RSA_WITH_IDEA_CBC_SHA = 0x00000007,
372 PJ_TLS_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x00000008,
373 PJ_TLS_RSA_WITH_DES_CBC_SHA = 0x00000009,
374 PJ_TLS_DH_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x0000000B,
375 PJ_TLS_DH_DSS_WITH_DES_CBC_SHA = 0x0000000C,
376 PJ_TLS_DH_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x0000000E,
377 PJ_TLS_DH_RSA_WITH_DES_CBC_SHA = 0x0000000F,
378 PJ_TLS_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA = 0x00000011,
379 PJ_TLS_DHE_DSS_WITH_DES_CBC_SHA = 0x00000012,
380 PJ_TLS_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA = 0x00000014,
381 PJ_TLS_DHE_RSA_WITH_DES_CBC_SHA = 0x00000015,
382 PJ_TLS_DH_anon_EXPORT_WITH_RC4_40_MD5 = 0x00000017,
383 PJ_TLS_DH_anon_EXPORT_WITH_DES40_CBC_SHA = 0x00000019,
384 PJ_TLS_DH_anon_WITH_DES_CBC_SHA = 0x0000001A,
387 PJ_SSL_FORTEZZA_KEA_WITH_NULL_SHA = 0x0000001C,
388 PJ_SSL_FORTEZZA_KEA_WITH_FORTEZZA_CBC_SHA = 0x0000001D,
389 PJ_SSL_FORTEZZA_KEA_WITH_RC4_128_SHA = 0x0000001E,
392 PJ_SSL_CK_RC4_128_WITH_MD5 = 0x00010080,
393 PJ_SSL_CK_RC4_128_EXPORT40_WITH_MD5 = 0x00020080,
394 PJ_SSL_CK_RC2_128_CBC_WITH_MD5 = 0x00030080,
395 PJ_SSL_CK_RC2_128_CBC_EXPORT40_WITH_MD5 = 0x00040080,
396 PJ_SSL_CK_IDEA_128_CBC_WITH_MD5 = 0x00050080,
397 PJ_SSL_CK_DES_64_CBC_WITH_MD5 = 0x00060040,
398 PJ_SSL_CK_DES_192_EDE3_CBC_WITH_MD5 = 0x000700C0
412 unsigned *cipher_num);
453 PJ_TLS_UNKNOWN_CURVE = 0,
454 PJ_TLS_CURVE_SECT163K1 = 1,
455 PJ_TLS_CURVE_SECT163R1 = 2,
456 PJ_TLS_CURVE_SECT163R2 = 3,
457 PJ_TLS_CURVE_SECT193R1 = 4,
458 PJ_TLS_CURVE_SECT193R2 = 5,
459 PJ_TLS_CURVE_SECT233K1 = 6,
460 PJ_TLS_CURVE_SECT233R1 = 7,
461 PJ_TLS_CURVE_SECT239K1 = 8,
462 PJ_TLS_CURVE_SECT283K1 = 9,
463 PJ_TLS_CURVE_SECT283R1 = 10,
464 PJ_TLS_CURVE_SECT409K1 = 11,
465 PJ_TLS_CURVE_SECT409R1 = 12,
466 PJ_TLS_CURVE_SECT571K1 = 13,
467 PJ_TLS_CURVE_SECT571R1 = 14,
468 PJ_TLS_CURVE_SECP160K1 = 15,
469 PJ_TLS_CURVE_SECP160R1 = 16,
470 PJ_TLS_CURVE_SECP160R2 = 17,
471 PJ_TLS_CURVE_SECP192K1 = 18,
472 PJ_TLS_CURVE_SECP192R1 = 19,
473 PJ_TLS_CURVE_SECP224K1 = 20,
474 PJ_TLS_CURVE_SECP224R1 = 21,
475 PJ_TLS_CURVE_SECP256K1 = 22,
476 PJ_TLS_CURVE_SECP256R1 = 23,
477 PJ_TLS_CURVE_SECP384R1 = 24,
478 PJ_TLS_CURVE_SECP521R1 = 25,
479 PJ_TLS_CURVE_BRAINPOOLP256R1 = 26,
480 PJ_TLS_CURVE_BRAINPOOLP384R1 = 27,
481 PJ_TLS_CURVE_BRAINPOOLP512R1 = 28,
482 PJ_TLS_CURVE_ARBITRARY_EXPLICIT_PRIME_CURVES = 0XFF01,
483 PJ_TLS_CURVE_ARBITRARY_EXPLICIT_CHAR2_CURVES = 0XFF02
495 unsigned *curve_num);
532typedef enum pj_ssl_entropy
unsigned char pj_uint8_t
Definition: types.h:55
long pj_ssize_t
Definition: types.h:64
int pj_bool_t
Definition: types.h:71
struct pj_ioqueue_t pj_ioqueue_t
Definition: types.h:210
unsigned short pj_uint16_t
Definition: types.h:49
size_t pj_size_t
Definition: types.h:58
void pj_sockaddr_t
Definition: types.h:267
int pj_status_t
Definition: types.h:68
struct pj_grp_lock_t pj_grp_lock_t
Definition: types.h:242
struct pj_timer_heap_t pj_timer_heap_t
Definition: types.h:221
unsigned int pj_uint32_t
Definition: types.h:43
const char * pj_ssl_cipher_name(pj_ssl_cipher cipher)
pj_bool_t pj_ssl_cipher_is_supported(pj_ssl_cipher cipher)
const char * pj_ssl_curve_name(pj_ssl_curve curve)
pj_status_t pj_ssl_cipher_get_availables(pj_ssl_cipher ciphers[], unsigned *cipher_num)
pj_status_t pj_ssl_sock_set_certificate(pj_ssl_sock_t *ssock, pj_pool_t *pool, const pj_ssl_cert_t *cert)
pj_ssize_t pj_ssl_cert_info_dump(const pj_ssl_cert_info *ci, const char *indent, char *buf, pj_size_t buf_size)
pj_status_t pj_ssl_sock_send(pj_ssl_sock_t *ssock, pj_ioqueue_op_key_t *send_key, const void *data, pj_ssize_t *size, unsigned flags)
pj_status_t pj_ssl_sock_set_user_data(pj_ssl_sock_t *ssock, void *user_data)
pj_str_t pj_ssl_cert_buffer
Definition: ssl_sock.h:202
pj_status_t pj_ssl_sock_start_connect2(pj_ssl_sock_t *ssock, pj_ssl_start_connect_param *connect_param)
pj_status_t pj_ssl_sock_start_accept2(pj_ssl_sock_t *ssock, pj_pool_t *pool, const pj_sockaddr_t *local_addr, int addr_len, const pj_ssl_sock_param *newsock_param)
pj_ssl_curve pj_ssl_curve_id(const char *curve_name)
pj_status_t pj_ssl_sock_start_recvfrom2(pj_ssl_sock_t *ssock, pj_pool_t *pool, unsigned buff_size, void *readbuf[], pj_uint32_t flags)
pj_status_t pj_ssl_sock_start_read(pj_ssl_sock_t *ssock, pj_pool_t *pool, unsigned buff_size, pj_uint32_t flags)
pj_status_t pj_ssl_cert_load_from_files(pj_pool_t *pool, const pj_str_t *CA_file, const pj_str_t *cert_file, const pj_str_t *privkey_file, const pj_str_t *privkey_pass, pj_ssl_cert_t **p_cert)
void pj_ssl_sock_param_default(pj_ssl_sock_param *param)
pj_status_t pj_ssl_sock_create(pj_pool_t *pool, const pj_ssl_sock_param *param, pj_ssl_sock_t **p_ssock)
pj_status_t pj_ssl_sock_start_read2(pj_ssl_sock_t *ssock, pj_pool_t *pool, unsigned buff_size, void *readbuf[], pj_uint32_t flags)
pj_ssl_cipher
Definition: ssl_sock.h:322
pj_status_t pj_ssl_cert_get_verify_status_strings(pj_uint32_t verify_status, const char *error_strings[], unsigned *count)
pj_status_t pj_ssl_cert_load_from_files2(pj_pool_t *pool, const pj_str_t *CA_file, const pj_str_t *CA_path, const pj_str_t *cert_file, const pj_str_t *privkey_file, const pj_str_t *privkey_pass, pj_ssl_cert_t **p_cert)
void * pj_ssl_sock_get_user_data(pj_ssl_sock_t *ssock)
pj_status_t pj_ssl_sock_sendto(pj_ssl_sock_t *ssock, pj_ioqueue_op_key_t *send_key, const void *data, pj_ssize_t *size, unsigned flags, const pj_sockaddr_t *addr, int addr_len)
pj_status_t pj_ssl_sock_start_accept(pj_ssl_sock_t *ssock, pj_pool_t *pool, const pj_sockaddr_t *local_addr, int addr_len)
void pj_ssl_cert_wipe_keys(pj_ssl_cert_t *cert)
pj_ssl_cert_name_type
Definition: ssl_sock.h:140
pj_status_t pj_ssl_sock_start_connect(pj_ssl_sock_t *ssock, pj_pool_t *pool, const pj_sockaddr_t *localaddr, const pj_sockaddr_t *remaddr, int addr_len)
pj_ssl_curve
Definition: ssl_sock.h:452
struct pj_ssl_sock_t pj_ssl_sock_t
Definition: ssl_sock.h:52
struct pj_ssl_cert_t pj_ssl_cert_t
Definition: ssl_sock.h:59
pj_ssl_sock_proto
Definition: ssl_sock.h:703
pj_status_t pj_ssl_sock_renegotiate(pj_ssl_sock_t *ssock)
pj_status_t pj_ssl_cert_load_from_buffer(pj_pool_t *pool, const pj_ssl_cert_buffer *CA_buf, const pj_ssl_cert_buffer *cert_buf, const pj_ssl_cert_buffer *privkey_buf, const pj_str_t *privkey_pass, pj_ssl_cert_t **p_cert)
pj_ssl_cert_verify_flag_t
Definition: ssl_sock.h:66
pj_status_t pj_ssl_sock_close(pj_ssl_sock_t *ssock)
pj_bool_t pj_ssl_curve_is_supported(pj_ssl_curve curve)
void pj_ssl_sock_param_copy(pj_pool_t *pool, pj_ssl_sock_param *dst, const pj_ssl_sock_param *src)
pj_ssl_entropy_t
Definition: ssl_sock.h:533
pj_ssl_cipher pj_ssl_cipher_id(const char *cipher_name)
pj_status_t pj_ssl_curve_get_availables(pj_ssl_curve curves[], unsigned *curve_num)
pj_status_t pj_ssl_sock_start_recvfrom(pj_ssl_sock_t *ssock, pj_pool_t *pool, unsigned buff_size, pj_uint32_t flags)
pj_status_t pj_ssl_sock_get_info(pj_ssl_sock_t *ssock, pj_ssl_sock_info *info)
@ PJ_SSL_SOCK_PROTO_TLS1_2
Definition: ssl_sock.h:732
@ PJ_SSL_SOCK_PROTO_TLS1_1
Definition: ssl_sock.h:727
@ PJ_SSL_SOCK_PROTO_SSL23
Definition: ssl_sock.h:743
@ PJ_SSL_SOCK_PROTO_TLS1_3
Definition: ssl_sock.h:737
@ PJ_SSL_SOCK_PROTO_DEFAULT
Definition: ssl_sock.h:707
@ PJ_SSL_SOCK_PROTO_SSL2
Definition: ssl_sock.h:712
@ PJ_SSL_SOCK_PROTO_DTLS1
Definition: ssl_sock.h:749
@ PJ_SSL_SOCK_PROTO_TLS1
Definition: ssl_sock.h:722
@ PJ_SSL_SOCK_PROTO_SSL3
Definition: ssl_sock.h:717
@ PJ_SSL_CERT_EVALIDITY_PERIOD
Definition: ssl_sock.h:85
@ PJ_SSL_CERT_EISSUER_MISMATCH
Definition: ssl_sock.h:103
@ PJ_SSL_CERT_EINVALID_FORMAT
Definition: ssl_sock.h:91
@ PJ_SSL_CERT_ESUCCESS
Definition: ssl_sock.h:70
@ PJ_SSL_CERT_EINVALID_PURPOSE
Definition: ssl_sock.h:96
@ PJ_SSL_CERT_ECRL_FAILURE
Definition: ssl_sock.h:108
@ PJ_SSL_CERT_EREVOKED
Definition: ssl_sock.h:113
@ PJ_SSL_CERT_EIDENTITY_NOT_MATCH
Definition: ssl_sock.h:126
@ PJ_SSL_CERT_EUNKNOWN
Definition: ssl_sock.h:131
@ PJ_SSL_CERT_ECHAIN_TOO_LONG
Definition: ssl_sock.h:118
@ PJ_SSL_CERT_EISSUER_NOT_FOUND
Definition: ssl_sock.h:75
@ PJ_SSL_CERT_EUNTRUSTED
Definition: ssl_sock.h:80
@ PJ_SSL_ENTROPY_URANDOM
Definition: ssl_sock.h:537
@ PJ_SSL_ENTROPY_EGD
Definition: ssl_sock.h:535
@ PJ_SSL_ENTROPY_NONE
Definition: ssl_sock.h:534
@ PJ_SSL_ENTROPY_FILE
Definition: ssl_sock.h:538
@ PJ_SSL_ENTROPY_RANDOM
Definition: ssl_sock.h:536
@ PJ_SSL_ENTROPY_UNKNOWN
Definition: ssl_sock.h:539
#define PJ_BEGIN_DECL
Definition: config.h:1284
#define PJ_END_DECL
Definition: config.h:1285
pj_qos_type
Definition: sock_qos.h:235
I/O Dispatching Mechanism.
Definition: ioqueue.h:208
Definition: sock_qos.h:274
Definition: ssl_sock.h:151
struct pj_ssl_cert_info::@5 subj_alt_name
pj_str_t cn
Definition: ssl_sock.h:160
struct pj_ssl_cert_info::@5::@7 * entry
struct pj_ssl_cert_info::@4 validity
pj_time_val start
Definition: ssl_sock.h:173
pj_str_t name
Definition: ssl_sock.h:184
pj_bool_t gmt
Definition: ssl_sock.h:175
pj_str_t info
Definition: ssl_sock.h:161
pj_uint8_t serial_no[20]
Definition: ssl_sock.h:155
pj_str_t raw
Definition: ssl_sock.h:189
pj_time_val end
Definition: ssl_sock.h:174
unsigned version
Definition: ssl_sock.h:153
struct pj_ssl_cert_info::@3 issuer
pj_ssl_cert_name_type type
Definition: ssl_sock.h:182
struct pj_ssl_cert_info::@2 subject
unsigned cnt
Definition: ssl_sock.h:180
Definition: ssl_sock.h:546
pj_bool_t(* on_accept_complete2)(pj_ssl_sock_t *ssock, pj_ssl_sock_t *newsock, const pj_sockaddr_t *src_addr, int src_addr_len, pj_status_t status)
Definition: ssl_sock.h:659
pj_bool_t(* on_data_read)(pj_ssl_sock_t *ssock, void *data, pj_size_t size, pj_status_t status, pj_size_t *remainder)
Definition: ssl_sock.h:573
pj_bool_t(* on_data_sent)(pj_ssl_sock_t *ssock, pj_ioqueue_op_key_t *send_key, pj_ssize_t sent)
Definition: ssl_sock.h:618
pj_bool_t(* on_accept_complete)(pj_ssl_sock_t *ssock, pj_ssl_sock_t *newsock, const pj_sockaddr_t *src_addr, int src_addr_len)
Definition: ssl_sock.h:637
pj_bool_t(* on_data_recvfrom)(pj_ssl_sock_t *ssock, void *data, pj_size_t size, const pj_sockaddr_t *src_addr, int addr_len, pj_status_t status)
Definition: ssl_sock.h:598
pj_bool_t(* on_verify_cb)(pj_ssl_sock_t *ssock, pj_bool_t is_server)
Definition: ssl_sock.h:693
pj_bool_t(* on_connect_complete)(pj_ssl_sock_t *ssock, pj_status_t status)
Definition: ssl_sock.h:677
Definition: ssl_sock.h:758
pj_uint32_t verify_status
Definition: ssl_sock.h:800
pj_sockaddr local_addr
Definition: ssl_sock.h:780
pj_bool_t established
Definition: ssl_sock.h:763
pj_ssl_cert_info * local_cert_info
Definition: ssl_sock.h:790
unsigned long last_native_err
Definition: ssl_sock.h:805
pj_ssl_cert_info * remote_cert_info
Definition: ssl_sock.h:795
pj_grp_lock_t * grp_lock
Definition: ssl_sock.h:810
pj_uint32_t proto
Definition: ssl_sock.h:769
pj_sockaddr remote_addr
Definition: ssl_sock.h:785
pj_ssl_cipher cipher
Definition: ssl_sock.h:775
Definition: ssl_sock.h:819
pj_ssl_entropy_t entropy_type
Definition: ssl_sock.h:988
unsigned ciphers_num
Definition: ssl_sock.h:946
pj_uint32_t proto
Definition: ssl_sock.h:874
pj_timer_heap_t * timer_heap
Definition: ssl_sock.h:856
pj_size_t send_buffer_size
Definition: ssl_sock.h:928
pj_grp_lock_t * grp_lock
Definition: ssl_sock.h:829
pj_time_val timeout
Definition: ssl_sock.h:1005
pj_bool_t reuse_addr
Definition: ssl_sock.h:1040
int sock_type
Definition: ssl_sock.h:843
void * user_data
Definition: ssl_sock.h:866
pj_ioqueue_t * ioqueue
Definition: ssl_sock.h:849
pj_sockopt_params sockopt_params
Definition: ssl_sock.h:1074
pj_ssl_curve * curves
Definition: ssl_sock.h:967
pj_str_t sigalgs
Definition: ssl_sock.h:977
unsigned curves_num
Definition: ssl_sock.h:961
pj_bool_t whole_data
Definition: ssl_sock.h:918
pj_bool_t require_client_cert
Definition: ssl_sock.h:1020
pj_str_t entropy_path
Definition: ssl_sock.h:997
pj_qos_type qos_type
Definition: ssl_sock.h:1049
pj_bool_t qos_ignore_error
Definition: ssl_sock.h:1066
pj_qos_params qos_params
Definition: ssl_sock.h:1058
unsigned async_cnt
Definition: ssl_sock.h:888
pj_str_t server_name
Definition: ssl_sock.h:1032
pj_ssl_sock_cb cb
Definition: ssl_sock.h:861
pj_bool_t sockopt_ignore_error
Definition: ssl_sock.h:1083
pj_ssl_cipher * ciphers
Definition: ssl_sock.h:952
int concurrency
Definition: ssl_sock.h:903
int sock_af
Definition: ssl_sock.h:836
pj_size_t read_buffer_size
Definition: ssl_sock.h:938
pj_bool_t verify_peer
Definition: ssl_sock.h:1012
Definition: ssl_sock.h:1091
const pj_sockaddr_t * localaddr
Definition: ssl_sock.h:1100
pj_pool_t * pool
Definition: ssl_sock.h:1095
pj_uint16_t local_port_range
Definition: ssl_sock.h:1107
int addr_len
Definition: ssl_sock.h:1117
const pj_sockaddr_t * remaddr
Definition: ssl_sock.h:1112
Definition: activesock.c:270