aboutsummaryrefslogtreecommitdiffstats
path: root/libsecauth.h
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-12 23:05:22 +0200
committerMattias Andrée <maandree@kth.se>2021-04-12 23:05:22 +0200
commit90054e8a7df36eea21b612de6bd28d88e67989f9 (patch)
tree2fddd2123ea3aa13f7d4d031e685bd13979c4a38 /libsecauth.h
downloadsecauth-90054e8a7df36eea21b612de6bd28d88e67989f9.tar.gz
secauth-90054e8a7df36eea21b612de6bd28d88e67989f9.tar.bz2
secauth-90054e8a7df36eea21b612de6bd28d88e67989f9.tar.xz
First commit
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libsecauth.h')
-rw-r--r--libsecauth.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/libsecauth.h b/libsecauth.h
new file mode 100644
index 0000000..67c2430
--- /dev/null
+++ b/libsecauth.h
@@ -0,0 +1,29 @@
+/* See LICENSE file for copyright and license details. */
+#ifndef LIBSECAUTH_H
+#define LIBSECAUTH_H
+
+#include <stdint.h>
+#include <stddef.h>
+
+
+/* $secauth${$<prehash>$}${$<xferhash>$}$<client_rounds>$<server_rounds>${$<posthash>$}$<expected> */
+
+
+struct libsecauth_spec {
+ const char *prehash; /* secret if empty, all information is stored at client-side */
+ const char *xferhash;
+ const char *posthash;
+ const char *expected;
+ uint32_t client_rounds;
+ uint32_t server_rounds;
+};
+
+
+int libsecauth_parse_spec(struct libsecauth_spec *spec, char *settings);
+size_t libsecauth_format_spec(struct libsecauth_spec *spec, char *buffer, size_t buffer_size);
+
+char *libsecauth_client_hash(const struct libsecauth_spec *spec, const char *password);
+int libsecauth_server_hash(const struct libsecauth_spec *spec, const char *inhash, const char *pepper, char **resultp);
+
+
+#endif