aboutsummaryrefslogtreecommitdiffstats
path: root/link/tls.h
diff options
context:
space:
mode:
authoreunhhu <[email protected]>2026-09-29 07:06:27 +0100
committereunhhu <[email protected]>2026-09-29 07:06:27 +0100
commita052b95c8135cdc5f9b91f8efc991cac80fbbe8b (patch)
tree2b7b0d7a0ccd5bc6ceaa603a01eb87deb6c1f2e8 /link/tls.h
parent0b4a9f7225b5873e606106b8eaf9174b254c0c0f (diff)
downloadpure-a052b95c8135cdc5f9b91f8efc991cac80fbbe8b.tar.gz
pure-a052b95c8135cdc5f9b91f8efc991cac80fbbe8b.zip
Put the links and the crypto they use in link/, a part of their own
libpure-link.a holds them; pure-serve and the M5 harness link it instead of naming its source files.
Diffstat (limited to 'link/tls.h')
-rw-r--r--link/tls.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/link/tls.h b/link/tls.h
new file mode 100644
index 0000000..3939f21
--- /dev/null
+++ b/link/tls.h
@@ -0,0 +1,18 @@
+#ifndef PURE_TLS_H
+#define PURE_TLS_H
+#include <stdbool.h>
+#include <stddef.h>
+
+/* TLS to https receivers (link/crypto.c): one client context, verifying a
+ * receiver's certificate against the system's CAs or ca_file, and its name. */
+typedef struct PureTls PureTls;
+/* The context, made once; false with why in error when it cannot be. */
+bool pure_tls_start(const char *ca_file, char *error, size_t size);
+/* A session over a connected socket to host (a DNS name, or an IP address
+ * written as one), its certificate verified; NULL when it fails. */
+PureTls *pure_tls_open(const char *host, int fd);
+/* As SSL_read and SSL_write: the bytes moved, or <= 0. */
+int pure_tls_read(PureTls *, void *bytes, int size);
+int pure_tls_write(PureTls *, const void *bytes, int size);
+void pure_tls_close(PureTls *);
+#endif