| 1 |
#ifndef _CANL_SSL_H |
| 2 |
#define _CANL_SSL_H |
| 3 |
|
| 4 |
#include <canl.h> |
| 5 |
#include <openssl/ssl.h> |
| 6 |
|
| 7 |
#ifdef __cplusplus |
| 8 |
extern "C" { |
| 9 |
#endif |
| 10 |
|
| 11 |
typedef enum canl_ctx_ssl_flags { |
| 12 |
CANL_SSL_ACCEPT_SSLv2 = 0x0001, |
| 13 |
CANL_SSL_DN_OSSL = 0x0002, |
| 14 |
CANL_SSL_VERIFY_NONE = 0x0004, |
| 15 |
CANL_SSL_OCSP_VERIFY_ALL = 0x0008, |
| 16 |
} canl_ctx_ssl_flags; |
| 17 |
|
| 18 |
canl_err_code CANL_CALLCONV |
| 19 |
canl_ctx_set_ssl_flags(canl_ctx, unsigned int); |
| 20 |
|
| 21 |
canl_err_code CANL_CALLCONV |
| 22 |
canl_ctx_set_ssl_cred(canl_ctx, char *, char *key, char *proxy, |
| 23 |
canl_password_callback, void *); |
| 24 |
|
| 25 |
canl_err_code CANL_CALLCONV |
| 26 |
canl_ctx_set_ca_dir(canl_ctx, const char *); |
| 27 |
|
| 28 |
canl_err_code CANL_CALLCONV |
| 29 |
canl_ctx_set_crl_dir(canl_ctx, const char *); |
| 30 |
|
| 31 |
canl_err_code CANL_CALLCONV |
| 32 |
canl_ctx_set_ca_fn(canl_ctx, const char *); |
| 33 |
|
| 34 |
/*MP not impemented yet*/ |
| 35 |
canl_err_code CANL_CALLCONV |
| 36 |
canl_ctx_set_crl_fn(canl_ctx, const char *); |
| 37 |
|
| 38 |
/* Set canl cert verification callbacks into SSL_CTX. |
| 39 |
Do not use SSL_CTX stored in canl_ctx. |
| 40 |
|
| 41 |
Special case: if verify_callback is not NULL, then caNl will be ready |
| 42 |
to use its callback,but it must be called separately by canl_direct_pv_clb() |
| 43 |
(e.g. in verify_callback)-try to avoid this, unless you |
| 44 |
know what you are doing. |
| 45 |
|
| 46 |
Any data set into the extern SSL_CTX by the caNl in this function |
| 47 |
are not freed by calling canl_free_ctx(). |
| 48 |
This might look like memory leak (e.g. by valgrind), but in this special case |
| 49 |
is intended. |
| 50 |
|
| 51 |
*/ |
| 52 |
canl_err_code CANL_CALLCONV |
| 53 |
canl_ssl_ctx_set_clb(canl_ctx cc, SSL_CTX *ssl_ctx, int ver_mode, |
| 54 |
int (*verify_callback)(int, X509_STORE_CTX *)); |
| 55 |
|
| 56 |
/* Call caNl proxy certificate verification callback directly. Use it only |
| 57 |
when you really know what you are doing. canl_ssl_ctx_set_clb() should be |
| 58 |
called before. (X509_STORE_CTX param of this function must correspond to |
| 59 |
SSL_CTX of canl_ssl_ctx_set_clb()) |
| 60 |
|
| 61 |
Return - 0 varification OK, 1 verification failed |
| 62 |
|
| 63 |
Note: This is one of the funcions that accept NULL as canl_ctx |
| 64 |
parameter, since it is intended to be called inside |
| 65 |
other callback funcion. |
| 66 |
*/ |
| 67 |
int CANL_CALLCONV |
| 68 |
canl_direct_pv_clb(canl_ctx cc, X509_STORE_CTX *store_ctx, int ok); |
| 69 |
|
| 70 |
canl_err_code CANL_CALLCONV |
| 71 |
canl_ocsp_set_url(canl_ctx cc, const char *ocsp_url); |
| 72 |
|
| 73 |
#ifdef __cplusplus |
| 74 |
} |
| 75 |
#endif |
| 76 |
|
| 77 |
#endif |