diff options
author | jsing <> | 2014-10-31 13:46:17 +0000 |
---|---|---|
committer | jsing <> | 2014-10-31 13:46:17 +0000 |
commit | cd85e00508e178758948e7a759609d0f1e7764df (patch) | |
tree | 44ea21a19ccf529a3e38fb107d3a2d1330f58d8e /src/lib/libtls/tls.h | |
parent | e83bdb8edcd9388f13b71372b277fdcce386a9b0 (diff) | |
download | openbsd-cd85e00508e178758948e7a759609d0f1e7764df.tar.gz openbsd-cd85e00508e178758948e7a759609d0f1e7764df.tar.bz2 openbsd-cd85e00508e178758948e7a759609d0f1e7764df.zip |
Rename libressl to libtls to avoid confusion and to make it easier to
distinguish between LibreSSL (the project) and libressl (the library).
Discussed with many.
Diffstat (limited to 'src/lib/libtls/tls.h')
-rw-r--r-- | src/lib/libtls/tls.h | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/src/lib/libtls/tls.h b/src/lib/libtls/tls.h new file mode 100644 index 0000000000..0fa776e584 --- /dev/null +++ b/src/lib/libtls/tls.h | |||
@@ -0,0 +1,74 @@ | |||
1 | /* $OpenBSD: tls.h,v 1.1 2014/10/31 13:46:17 jsing Exp $ */ | ||
2 | /* | ||
3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | ||
4 | * | ||
5 | * Permission to use, copy, modify, and distribute this software for any | ||
6 | * purpose with or without fee is hereby granted, provided that the above | ||
7 | * copyright notice and this permission notice appear in all copies. | ||
8 | * | ||
9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
16 | */ | ||
17 | |||
18 | #ifndef HEADER_TLS_H | ||
19 | #define HEADER_TLS_H | ||
20 | |||
21 | #define TLS_API 20141031 | ||
22 | |||
23 | #define TLS_PROTOCOL_TLSv1_0 (1 << 1) | ||
24 | #define TLS_PROTOCOL_TLSv1_1 (1 << 2) | ||
25 | #define TLS_PROTOCOL_TLSv1_2 (1 << 3) | ||
26 | #define TLS_PROTOCOL_TLSv1 \ | ||
27 | (TLS_PROTOCOL_TLSv1_0|TLS_PROTOCOL_TLSv1_1|TLS_PROTOCOL_TLSv1_2) | ||
28 | #define TLS_PROTOCOLS_DEFAULT TLS_PROTOCOL_TLSv1 | ||
29 | |||
30 | #define TLS_READ_AGAIN -2 | ||
31 | #define TLS_WRITE_AGAIN -3 | ||
32 | |||
33 | struct tls; | ||
34 | struct tls_config; | ||
35 | |||
36 | int tls_init(void); | ||
37 | |||
38 | const char *tls_error(struct tls *ctx); | ||
39 | |||
40 | struct tls_config *tls_config_new(void); | ||
41 | void tls_config_free(struct tls_config *config); | ||
42 | |||
43 | int tls_config_set_ca_file(struct tls_config *config, const char *ca_file); | ||
44 | int tls_config_set_ca_path(struct tls_config *config, const char *ca_path); | ||
45 | int tls_config_set_cert_file(struct tls_config *config, const char *cert_file); | ||
46 | int tls_config_set_cert_mem(struct tls_config *config, const uint8_t *cert, | ||
47 | size_t len); | ||
48 | int tls_config_set_ciphers(struct tls_config *config, const char *ciphers); | ||
49 | int tls_config_set_ecdhcurve(struct tls_config *config, const char *name); | ||
50 | int tls_config_set_key_file(struct tls_config *config, const char *key_file); | ||
51 | int tls_config_set_key_mem(struct tls_config *config, const uint8_t *key, | ||
52 | size_t len); | ||
53 | void tls_config_set_protocols(struct tls_config *config, uint32_t protocols); | ||
54 | void tls_config_set_verify_depth(struct tls_config *config, int verify_depth); | ||
55 | |||
56 | void tls_config_clear_keys(struct tls_config *config); | ||
57 | void tls_config_insecure_noverifyhost(struct tls_config *config); | ||
58 | void tls_config_insecure_noverifycert(struct tls_config *config); | ||
59 | void tls_config_verify(struct tls_config *config); | ||
60 | |||
61 | struct tls *tls_client(void); | ||
62 | struct tls *tls_server(void); | ||
63 | int tls_configure(struct tls *ctx, struct tls_config *config); | ||
64 | void tls_reset(struct tls *ctx); | ||
65 | void tls_free(struct tls *ctx); | ||
66 | |||
67 | int tls_accept_socket(struct tls *ctx, struct tls **cctx, int socket); | ||
68 | int tls_connect(struct tls *ctx, const char *host, const char *port); | ||
69 | int tls_connect_socket(struct tls *ctx, int s, const char *hostname); | ||
70 | int tls_read(struct tls *ctx, void *buf, size_t buflen, size_t *outlen); | ||
71 | int tls_write(struct tls *ctx, const void *buf, size_t buflen, size_t *outlen); | ||
72 | int tls_close(struct tls *ctx); | ||
73 | |||
74 | #endif /* HEADER_TLS_H */ | ||