aboutsummaryrefslogtreecommitdiffstats
path: root/libsecauth.h
blob: 67c2430dd063c5a3169643a44ee6f72ce80a0641 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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