aboutsummaryrefslogtreecommitdiff
path: root/libtls-standalone/tests/test.c
diff options
context:
space:
mode:
authorBrent Cook <busterb@gmail.com>2020-08-20 09:53:08 -0500
committerBrent Cook <busterb@gmail.com>2020-08-20 09:53:08 -0500
commit24a3218467ac9ed1181b234ac005f074d5056053 (patch)
treea15bf42d0bf6c38094888d5cf9c5bac61c989812 /libtls-standalone/tests/test.c
parent8a4ac6a8289d8eb5b278763b989d9bda9eeec353 (diff)
downloadportable-24a3218467ac9ed1181b234ac005f074d5056053.tar.gz
portable-24a3218467ac9ed1181b234ac005f074d5056053.tar.bz2
portable-24a3218467ac9ed1181b234ac005f074d5056053.zip
remove libtls-standalone, it's unmaintained
libtls-standalone was originally intended to make something that could link to any other OpenSSL fork or OpenSSL itself, but I don't think there's anyone who is terribly interested in that after all, so let's clean this up. #610 may be the better solution anyway.
Diffstat (limited to 'libtls-standalone/tests/test.c')
-rw-r--r--libtls-standalone/tests/test.c51
1 files changed, 0 insertions, 51 deletions
diff --git a/libtls-standalone/tests/test.c b/libtls-standalone/tests/test.c
deleted file mode 100644
index 4069332..0000000
--- a/libtls-standalone/tests/test.c
+++ /dev/null
@@ -1,51 +0,0 @@
1#include <stdio.h>
2#include <tls.h>
3
4int main()
5{
6 struct tls *tls;
7 struct tls_config *tls_config;
8 ssize_t written, read;
9 char buf[4096];
10
11 if (tls_init() != 0) {
12 fprintf(stderr, "tls_init failed");
13 return 1;
14 }
15
16 if ((tls = tls_client()) == NULL)
17 goto err;
18
19 if ((tls_config = tls_config_new()) == NULL)
20 goto err;
21
22 if (tls_config_set_ciphers(tls_config, "compat") != 0)
23 goto err;
24
25 tls_config_insecure_noverifycert(tls_config);
26 tls_config_insecure_noverifyname(tls_config);
27
28 if (tls_configure(tls, tls_config) != 0)
29 goto err;
30
31 if (tls_connect(tls, "google.com", "443") != 0)
32 goto err;
33
34 if ((written = tls_write(tls, "GET /\r\n", 7)) < 0)
35 goto err;
36
37 if ((read = tls_read(tls, buf, sizeof(buf))) < 0)
38 goto err;
39
40 buf[read - 1] = '\0';
41 puts(buf);
42
43 if (tls_close(tls) != 0)
44 goto err;
45
46 return 0;
47
48err:
49 fprintf(stderr, "%s\n", tls_error(tls));
50 return 1;
51}