diff options
| author | jsing <> | 2016-11-11 14:02:24 +0000 |
|---|---|---|
| committer | jsing <> | 2016-11-11 14:02:24 +0000 |
| commit | 0d62016eab9c94cf7e9178860d6d3857adf3bc52 (patch) | |
| tree | 504fc58fe886a67b537ee2b43b1a736f9a752c98 | |
| parent | 934a055de1ed87c2fa867444e84af322f6a4051b (diff) | |
| download | openbsd-0d62016eab9c94cf7e9178860d6d3857adf3bc52.tar.gz openbsd-0d62016eab9c94cf7e9178860d6d3857adf3bc52.tar.bz2 openbsd-0d62016eab9c94cf7e9178860d6d3857adf3bc52.zip | |
Change the return value of tls_config_set_protocols() and
tls_config_set_verify_depth() from void to int. This makes them consistent
with all other tls_config_set_* functions and will allow for call time
validation to be implemented.
Rides libtls major bump.
ok beck@
| -rw-r--r-- | src/lib/libtls/tls.h | 6 | ||||
| -rw-r--r-- | src/lib/libtls/tls_config.c | 16 | ||||
| -rw-r--r-- | src/lib/libtls/tls_init.3 | 8 |
3 files changed, 18 insertions, 12 deletions
diff --git a/src/lib/libtls/tls.h b/src/lib/libtls/tls.h index 2f8c721a15..edf7343f2f 100644 --- a/src/lib/libtls/tls.h +++ b/src/lib/libtls/tls.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls.h,v 1.41 2016/11/05 15:13:26 beck Exp $ */ | 1 | /* $OpenBSD: tls.h,v 1.42 2016/11/11 14:02:24 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -108,8 +108,8 @@ int tls_config_set_keypair_mem(struct tls_config *_config, const uint8_t *_cert, | |||
| 108 | size_t _cert_len, const uint8_t *_key, size_t _key_len); | 108 | size_t _cert_len, const uint8_t *_key, size_t _key_len); |
| 109 | int tls_config_set_ocsp_staple_mem(struct tls_config *_config, char *_staple, size_t _len); | 109 | int tls_config_set_ocsp_staple_mem(struct tls_config *_config, char *_staple, size_t _len); |
| 110 | int tls_config_set_ocsp_staple_file(struct tls_config *_config, const char *_staple_file); | 110 | int tls_config_set_ocsp_staple_file(struct tls_config *_config, const char *_staple_file); |
| 111 | void tls_config_set_protocols(struct tls_config *_config, uint32_t _protocols); | 111 | int tls_config_set_protocols(struct tls_config *_config, uint32_t _protocols); |
| 112 | void tls_config_set_verify_depth(struct tls_config *_config, int _verify_depth); | 112 | int tls_config_set_verify_depth(struct tls_config *_config, int _verify_depth); |
| 113 | 113 | ||
| 114 | void tls_config_prefer_ciphers_client(struct tls_config *_config); | 114 | void tls_config_prefer_ciphers_client(struct tls_config *_config); |
| 115 | void tls_config_prefer_ciphers_server(struct tls_config *_config); | 115 | void tls_config_prefer_ciphers_server(struct tls_config *_config); |
diff --git a/src/lib/libtls/tls_config.c b/src/lib/libtls/tls_config.c index 3ac674e597..5bc671fc99 100644 --- a/src/lib/libtls/tls_config.c +++ b/src/lib/libtls/tls_config.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: tls_config.c,v 1.32 2016/11/05 15:13:26 beck Exp $ */ | 1 | /* $OpenBSD: tls_config.c,v 1.33 2016/11/11 14:02:24 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -194,8 +194,10 @@ tls_config_new(void) | |||
| 194 | if (tls_config_set_ciphers(config, "secure") != 0) | 194 | if (tls_config_set_ciphers(config, "secure") != 0) |
| 195 | goto err; | 195 | goto err; |
| 196 | 196 | ||
| 197 | tls_config_set_protocols(config, TLS_PROTOCOLS_DEFAULT); | 197 | if (tls_config_set_protocols(config, TLS_PROTOCOLS_DEFAULT) != 0) |
| 198 | tls_config_set_verify_depth(config, 6); | 198 | goto err; |
| 199 | if (tls_config_set_verify_depth(config, 6) != 0) | ||
| 200 | goto err; | ||
| 199 | 201 | ||
| 200 | tls_config_prefer_ciphers_server(config); | 202 | tls_config_prefer_ciphers_server(config); |
| 201 | 203 | ||
| @@ -575,16 +577,20 @@ tls_config_set_keypair_mem(struct tls_config *config, const uint8_t *cert, | |||
| 575 | return (0); | 577 | return (0); |
| 576 | } | 578 | } |
| 577 | 579 | ||
| 578 | void | 580 | int |
| 579 | tls_config_set_protocols(struct tls_config *config, uint32_t protocols) | 581 | tls_config_set_protocols(struct tls_config *config, uint32_t protocols) |
| 580 | { | 582 | { |
| 581 | config->protocols = protocols; | 583 | config->protocols = protocols; |
| 584 | |||
| 585 | return (0); | ||
| 582 | } | 586 | } |
| 583 | 587 | ||
| 584 | void | 588 | int |
| 585 | tls_config_set_verify_depth(struct tls_config *config, int verify_depth) | 589 | tls_config_set_verify_depth(struct tls_config *config, int verify_depth) |
| 586 | { | 590 | { |
| 587 | config->verify_depth = verify_depth; | 591 | config->verify_depth = verify_depth; |
| 592 | |||
| 593 | return (0); | ||
| 588 | } | 594 | } |
| 589 | 595 | ||
| 590 | void | 596 | void |
diff --git a/src/lib/libtls/tls_init.3 b/src/lib/libtls/tls_init.3 index dd167faa54..4e8c4a6627 100644 --- a/src/lib/libtls/tls_init.3 +++ b/src/lib/libtls/tls_init.3 | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | .\" $OpenBSD: tls_init.3,v 1.80 2016/11/05 18:30:02 bcook Exp $ | 1 | .\" $OpenBSD: tls_init.3,v 1.81 2016/11/11 14:02:24 jsing Exp $ |
| 2 | .\" | 2 | .\" |
| 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> | 3 | .\" Copyright (c) 2014 Ted Unangst <tedu@openbsd.org> |
| 4 | .\" | 4 | .\" |
| @@ -14,7 +14,7 @@ | |||
| 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 14 | .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 15 | .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | .\" | 16 | .\" |
| 17 | .Dd $Mdocdate: November 5 2016 $ | 17 | .Dd $Mdocdate: November 11 2016 $ |
| 18 | .Dt TLS_INIT 3 | 18 | .Dt TLS_INIT 3 |
| 19 | .Os | 19 | .Os |
| 20 | .Sh NAME | 20 | .Sh NAME |
| @@ -140,9 +140,9 @@ | |||
| 140 | .Fn tls_config_set_ocsp_staple_mem "struct tls_config *config" "const char *staple" "size_t len" | 140 | .Fn tls_config_set_ocsp_staple_mem "struct tls_config *config" "const char *staple" "size_t len" |
| 141 | .Ft "int" | 141 | .Ft "int" |
| 142 | .Fn tls_config_set_ocsp_staple_file "struct tls_config *config" "const char *staple_file" | 142 | .Fn tls_config_set_ocsp_staple_file "struct tls_config *config" "const char *staple_file" |
| 143 | .Ft "void" | 143 | .Ft "int" |
| 144 | .Fn tls_config_set_protocols "struct tls_config *config" "uint32_t protocols" | 144 | .Fn tls_config_set_protocols "struct tls_config *config" "uint32_t protocols" |
| 145 | .Ft "void" | 145 | .Ft "int" |
| 146 | .Fn tls_config_set_verify_depth "struct tls_config *config" "int verify_depth" | 146 | .Fn tls_config_set_verify_depth "struct tls_config *config" "int verify_depth" |
| 147 | .Ft "void" | 147 | .Ft "void" |
| 148 | .Fn tls_config_prefer_ciphers_client "struct tls_config *config" | 148 | .Fn tls_config_prefer_ciphers_client "struct tls_config *config" |
