diff options
author | Dirk Engling <erdgeist@erdgeist.org> | 2022-05-16 15:53:39 +0200 |
---|---|---|
committer | Dirk Engling <erdgeist@erdgeist.org> | 2022-05-16 15:53:39 +0200 |
commit | d1ac67f6d73f24a165ccc008440bb8b208ae140f (patch) | |
tree | 0da0184ec2273ffa6f642ab06e776fcdda9f4ac3 /vchat-tls.h | |
parent | 43b74147212ddc5e619ac17dd1b5967b6b293d8a (diff) |
Decouple IO openssl's BIO abstraction and split connection and tls handling to allow for other TLS libs
Diffstat (limited to 'vchat-tls.h')
-rwxr-xr-x | vchat-tls.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/vchat-tls.h b/vchat-tls.h new file mode 100755 index 0000000..8d33ebd --- /dev/null +++ b/vchat-tls.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #pragma once | ||
2 | |||
3 | /* prototypes */ | ||
4 | |||
5 | struct vc_x509store_t; | ||
6 | typedef struct vc_x509store_t vc_x509store_t; | ||
7 | typedef int (*vc_askpass_cb_t)(char *, int, int, void *); | ||
8 | |||
9 | vc_x509store_t *vc_init_x509store(); | ||
10 | void vc_x509store_set_pkeycb(vc_x509store_t *, vc_askpass_cb_t); | ||
11 | void vc_x509store_setflags(vc_x509store_t *, int); | ||
12 | void vc_x509store_setkeyfile(vc_x509store_t *, char *); | ||
13 | void vc_x509store_setcertfile(vc_x509store_t *, char *); | ||
14 | void vc_x509store_setcafile(vc_x509store_t *, char *); | ||
15 | void vc_cleanup_x509store(vc_x509store_t *s); | ||
16 | |||
17 | int vc_tls_connect(int serverfd, vc_x509store_t * ); | ||
18 | ssize_t vc_tls_sendmessage(const void *buf, size_t size); | ||
19 | ssize_t vc_tls_receivemessage(void *buf, size_t size); | ||
20 | void vc_tls_cleanup(); | ||
21 | |||
22 | #define VC_X509S_NODEF_CAFILE 0x01 | ||
23 | #define VC_X509S_NODEF_CAPATH 0x02 | ||
24 | #define VC_X509S_USE_CERTIFICATE 0x04 | ||
25 | #define VC_X509S_SSL_VERIFY_NONE 0x10 | ||
26 | #define VC_X509S_SSL_VERIFY_PEER 0x20 | ||
27 | #define VC_X509S_SSL_VERIFY_FAIL_IF_NO_PEER_CERT 0x40 | ||
28 | #define VC_X509S_SSL_VERIFY_CLIENT_ONCE 0x80 | ||
29 | #define VC_X509S_SSL_VERIFY_MASK 0xF0 | ||
30 | |||