summaryrefslogtreecommitdiffhomepage
path: root/libs/luci-lib-nixio/src/nixio-tls.h
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2014-12-03 15:17:05 +0100
committerJo-Philipp Wich <jow@openwrt.org>2015-01-08 16:26:20 +0100
commit1bb4822dca6113f73e3bc89e2acf15935e6f8e92 (patch)
tree35e16f100466e4e00657199b38bb3d87d52bf73f /libs/luci-lib-nixio/src/nixio-tls.h
parent9edd0e46c3f880727738ce8ca6ff1c8b85f99ef4 (diff)
Rework LuCI build system
* Rename subdirectories to their repective OpenWrt package names * Make each LuCI module its own standalone package * Deploy a shared luci.mk which is used by each module Makefile Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'libs/luci-lib-nixio/src/nixio-tls.h')
-rw-r--r--libs/luci-lib-nixio/src/nixio-tls.h53
1 files changed, 53 insertions, 0 deletions
diff --git a/libs/luci-lib-nixio/src/nixio-tls.h b/libs/luci-lib-nixio/src/nixio-tls.h
new file mode 100644
index 0000000000..0fac5a980d
--- /dev/null
+++ b/libs/luci-lib-nixio/src/nixio-tls.h
@@ -0,0 +1,53 @@
+#ifndef NIXIO_TLS_H_
+#define NIXIO_TLS_H_
+
+#include "nixio.h"
+#include <sys/types.h>
+
+#ifndef WITHOUT_OPENSSL
+#include <openssl/ssl.h>
+#include <openssl/md5.h>
+#include <openssl/sha.h>
+#endif
+
+#define NIXIO_TLS_CTX_META "nixio.tls.ctx"
+#define NIXIO_TLS_SOCK_META "nixio.tls.sock"
+
+typedef struct nixio_tls_socket {
+ SSL *socket;
+#ifdef WITH_AXTLS
+ char connected;
+ size_t pbufsiz;
+ char *pbufpos;
+ char *pbuffer;
+#endif
+} nixio_tls_sock;
+
+#define NIXIO_CRYPTO_HASH_META "nixio.crypto.hash"
+#define NIXIO_DIGEST_SIZE 64
+#define NIXIO_CRYPTO_BLOCK_SIZE 64
+
+#define NIXIO_HASH_NONE 0
+#define NIXIO_HASH_MD5 0x01
+#define NIXIO_HASH_SHA1 0x02
+
+#define NIXIO_HMAC_BIT 0x40
+
+typedef int(*nixio_hash_initcb)(void *);
+typedef int(*nixio_hash_updatecb)(void *, const void *, unsigned long);
+typedef int(*nixio_hash_finalcb)(unsigned char *, void *);
+
+typedef struct nixio_hash_obj {
+ uint type;
+ unsigned char digest[NIXIO_DIGEST_SIZE];
+ size_t digest_size;
+ unsigned char key[NIXIO_CRYPTO_BLOCK_SIZE];
+ size_t key_size;
+ size_t block_size;
+ void *ctx;
+ nixio_hash_initcb init;
+ nixio_hash_updatecb update;
+ nixio_hash_finalcb final;
+} nixio_hash;
+
+#endif /* NIXIO_TLS_H_ */