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_config.c | |
| 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 '')
| -rw-r--r-- | src/lib/libtls/tls_config.c (renamed from src/lib/libressl/ressl_config.c) | 60 | 
1 files changed, 30 insertions, 30 deletions
| diff --git a/src/lib/libressl/ressl_config.c b/src/lib/libtls/tls_config.c index a45364c2ef..0e435f616a 100644 --- a/src/lib/libressl/ressl_config.c +++ b/src/lib/libtls/tls_config.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ressl_config.c,v 1.14 2014/10/03 14:14:40 tedu Exp $ */ | 1 | /* $OpenBSD: tls_config.c,v 1.1 2014/10/31 13:46:17 jsing Exp $ */ | 
| 2 | /* | 2 | /* | 
| 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014 Joel Sing <jsing@openbsd.org> | 
| 4 | * | 4 | * | 
| @@ -18,8 +18,8 @@ | |||
| 18 | #include <errno.h> | 18 | #include <errno.h> | 
| 19 | #include <stdlib.h> | 19 | #include <stdlib.h> | 
| 20 | 20 | ||
| 21 | #include <ressl.h> | 21 | #include <tls.h> | 
| 22 | #include "ressl_internal.h" | 22 | #include "tls_internal.h" | 
| 23 | 23 | ||
| 24 | static int | 24 | static int | 
| 25 | set_string(const char **dest, const char *src) | 25 | set_string(const char **dest, const char *src) | 
| @@ -56,10 +56,10 @@ set_mem(char **dest, size_t *destlen, const void *src, size_t srclen) | |||
| 56 | return 0; | 56 | return 0; | 
| 57 | } | 57 | } | 
| 58 | 58 | ||
| 59 | struct ressl_config * | 59 | struct tls_config * | 
| 60 | ressl_config_new(void) | 60 | tls_config_new(void) | 
| 61 | { | 61 | { | 
| 62 | struct ressl_config *config; | 62 | struct tls_config *config; | 
| 63 | 63 | ||
| 64 | if ((config = calloc(1, sizeof(*config))) == NULL) | 64 | if ((config = calloc(1, sizeof(*config))) == NULL) | 
| 65 | return (NULL); | 65 | return (NULL); | 
| @@ -67,26 +67,26 @@ ressl_config_new(void) | |||
| 67 | /* | 67 | /* | 
| 68 | * Default configuration. | 68 | * Default configuration. | 
| 69 | */ | 69 | */ | 
| 70 | if (ressl_config_set_ca_file(config, _PATH_SSL_CA_FILE) != 0) { | 70 | if (tls_config_set_ca_file(config, _PATH_SSL_CA_FILE) != 0) { | 
| 71 | ressl_config_free(config); | 71 | tls_config_free(config); | 
| 72 | return (NULL); | 72 | return (NULL); | 
| 73 | } | 73 | } | 
| 74 | ressl_config_set_ecdhcurve(config, "auto"); | 74 | tls_config_set_ecdhcurve(config, "auto"); | 
| 75 | ressl_config_set_protocols(config, RESSL_PROTOCOLS_DEFAULT); | 75 | tls_config_set_protocols(config, TLS_PROTOCOLS_DEFAULT); | 
| 76 | ressl_config_set_verify_depth(config, 6); | 76 | tls_config_set_verify_depth(config, 6); | 
| 77 | 77 | ||
| 78 | ressl_config_verify(config); | 78 | tls_config_verify(config); | 
| 79 | 79 | ||
| 80 | return (config); | 80 | return (config); | 
| 81 | } | 81 | } | 
| 82 | 82 | ||
| 83 | void | 83 | void | 
| 84 | ressl_config_free(struct ressl_config *config) | 84 | tls_config_free(struct tls_config *config) | 
| 85 | { | 85 | { | 
| 86 | if (config == NULL) | 86 | if (config == NULL) | 
| 87 | return; | 87 | return; | 
| 88 | 88 | ||
| 89 | ressl_config_clear_keys(config); | 89 | tls_config_clear_keys(config); | 
| 90 | 90 | ||
| 91 | free((char *)config->ca_file); | 91 | free((char *)config->ca_file); | 
| 92 | free((char *)config->ca_path); | 92 | free((char *)config->ca_path); | 
| @@ -100,45 +100,45 @@ ressl_config_free(struct ressl_config *config) | |||
| 100 | } | 100 | } | 
| 101 | 101 | ||
| 102 | void | 102 | void | 
| 103 | ressl_config_clear_keys(struct ressl_config *config) | 103 | tls_config_clear_keys(struct tls_config *config) | 
| 104 | { | 104 | { | 
| 105 | ressl_config_set_cert_mem(config, NULL, 0); | 105 | tls_config_set_cert_mem(config, NULL, 0); | 
| 106 | ressl_config_set_key_mem(config, NULL, 0); | 106 | tls_config_set_key_mem(config, NULL, 0); | 
| 107 | } | 107 | } | 
| 108 | 108 | ||
| 109 | int | 109 | int | 
| 110 | ressl_config_set_ca_file(struct ressl_config *config, const char *ca_file) | 110 | tls_config_set_ca_file(struct tls_config *config, const char *ca_file) | 
| 111 | { | 111 | { | 
| 112 | return set_string(&config->ca_file, ca_file); | 112 | return set_string(&config->ca_file, ca_file); | 
| 113 | } | 113 | } | 
| 114 | 114 | ||
| 115 | int | 115 | int | 
| 116 | ressl_config_set_ca_path(struct ressl_config *config, const char *ca_path) | 116 | tls_config_set_ca_path(struct tls_config *config, const char *ca_path) | 
| 117 | { | 117 | { | 
| 118 | return set_string(&config->ca_path, ca_path); | 118 | return set_string(&config->ca_path, ca_path); | 
| 119 | } | 119 | } | 
| 120 | 120 | ||
| 121 | int | 121 | int | 
| 122 | ressl_config_set_cert_file(struct ressl_config *config, const char *cert_file) | 122 | tls_config_set_cert_file(struct tls_config *config, const char *cert_file) | 
| 123 | { | 123 | { | 
| 124 | return set_string(&config->cert_file, cert_file); | 124 | return set_string(&config->cert_file, cert_file); | 
| 125 | } | 125 | } | 
| 126 | 126 | ||
| 127 | int | 127 | int | 
| 128 | ressl_config_set_cert_mem(struct ressl_config *config, const uint8_t *cert, | 128 | tls_config_set_cert_mem(struct tls_config *config, const uint8_t *cert, | 
| 129 | size_t len) | 129 | size_t len) | 
| 130 | { | 130 | { | 
| 131 | return set_mem(&config->cert_mem, &config->cert_len, cert, len); | 131 | return set_mem(&config->cert_mem, &config->cert_len, cert, len); | 
| 132 | } | 132 | } | 
| 133 | 133 | ||
| 134 | int | 134 | int | 
| 135 | ressl_config_set_ciphers(struct ressl_config *config, const char *ciphers) | 135 | tls_config_set_ciphers(struct tls_config *config, const char *ciphers) | 
| 136 | { | 136 | { | 
| 137 | return set_string(&config->ciphers, ciphers); | 137 | return set_string(&config->ciphers, ciphers); | 
| 138 | } | 138 | } | 
| 139 | 139 | ||
| 140 | int | 140 | int | 
| 141 | ressl_config_set_ecdhcurve(struct ressl_config *config, const char *name) | 141 | tls_config_set_ecdhcurve(struct tls_config *config, const char *name) | 
| 142 | { | 142 | { | 
| 143 | int nid; | 143 | int nid; | 
| 144 | 144 | ||
| @@ -155,13 +155,13 @@ ressl_config_set_ecdhcurve(struct ressl_config *config, const char *name) | |||
| 155 | } | 155 | } | 
| 156 | 156 | ||
| 157 | int | 157 | int | 
| 158 | ressl_config_set_key_file(struct ressl_config *config, const char *key_file) | 158 | tls_config_set_key_file(struct tls_config *config, const char *key_file) | 
| 159 | { | 159 | { | 
| 160 | return set_string(&config->key_file, key_file); | 160 | return set_string(&config->key_file, key_file); | 
| 161 | } | 161 | } | 
| 162 | 162 | ||
| 163 | int | 163 | int | 
| 164 | ressl_config_set_key_mem(struct ressl_config *config, const uint8_t *key, | 164 | tls_config_set_key_mem(struct tls_config *config, const uint8_t *key, | 
| 165 | size_t len) | 165 | size_t len) | 
| 166 | { | 166 | { | 
| 167 | if (config->key_mem) | 167 | if (config->key_mem) | 
| @@ -170,31 +170,31 @@ ressl_config_set_key_mem(struct ressl_config *config, const uint8_t *key, | |||
| 170 | } | 170 | } | 
| 171 | 171 | ||
| 172 | void | 172 | void | 
| 173 | ressl_config_set_protocols(struct ressl_config *config, uint32_t protocols) | 173 | tls_config_set_protocols(struct tls_config *config, uint32_t protocols) | 
| 174 | { | 174 | { | 
| 175 | config->protocols = protocols; | 175 | config->protocols = protocols; | 
| 176 | } | 176 | } | 
| 177 | 177 | ||
| 178 | void | 178 | void | 
| 179 | ressl_config_set_verify_depth(struct ressl_config *config, int verify_depth) | 179 | tls_config_set_verify_depth(struct tls_config *config, int verify_depth) | 
| 180 | { | 180 | { | 
| 181 | config->verify_depth = verify_depth; | 181 | config->verify_depth = verify_depth; | 
| 182 | } | 182 | } | 
| 183 | 183 | ||
| 184 | void | 184 | void | 
| 185 | ressl_config_insecure_noverifyhost(struct ressl_config *config) | 185 | tls_config_insecure_noverifyhost(struct tls_config *config) | 
| 186 | { | 186 | { | 
| 187 | config->verify_host = 0; | 187 | config->verify_host = 0; | 
| 188 | } | 188 | } | 
| 189 | 189 | ||
| 190 | void | 190 | void | 
| 191 | ressl_config_insecure_noverifycert(struct ressl_config *config) | 191 | tls_config_insecure_noverifycert(struct tls_config *config) | 
| 192 | { | 192 | { | 
| 193 | config->verify_cert = 0; | 193 | config->verify_cert = 0; | 
| 194 | } | 194 | } | 
| 195 | 195 | ||
| 196 | void | 196 | void | 
| 197 | ressl_config_verify(struct ressl_config *config) | 197 | tls_config_verify(struct tls_config *config) | 
| 198 | { | 198 | { | 
| 199 | config->verify_host = 1; | 199 | config->verify_host = 1; | 
| 200 | config->verify_cert = 1; | 200 | config->verify_cert = 1; | 
