summaryrefslogtreecommitdiff
path: root/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_auth_hmacsha256.h
diff options
context:
space:
mode:
Diffstat (limited to 'toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_auth_hmacsha256.h')
-rw-r--r--toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_auth_hmacsha256.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_auth_hmacsha256.h b/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_auth_hmacsha256.h
new file mode 100644
index 00000000..994c0942
--- /dev/null
+++ b/toxencryptsave/crypto_pwhash_scryptsalsa208sha256/crypto_auth_hmacsha256.h
@@ -0,0 +1,65 @@
1#ifdef HAVE_CONFIG_H
2#include "config.h"
3#endif
4#ifdef VANILLA_NACL /* toxcore only uses this when libsodium is unavailable */
5
6#ifndef crypto_auth_hmacsha256_H
7#define crypto_auth_hmacsha256_H
8
9#include <stddef.h>
10#include "crypto_hash_sha256.h"
11#include "export.h"
12
13#ifdef __cplusplus
14# if __GNUC__
15# pragma GCC diagnostic ignored "-Wlong-long"
16# endif
17extern "C" {
18#endif
19
20typedef struct crypto_auth_hmacsha256_state {
21 crypto_hash_sha256_state ictx;
22 crypto_hash_sha256_state octx;
23} crypto_auth_hmacsha256_state;
24
25#define crypto_auth_hmacsha256_BYTES 32U
26SODIUM_EXPORT
27size_t crypto_auth_hmacsha256_bytes(void);
28
29#define crypto_auth_hmacsha256_KEYBYTES 32U
30SODIUM_EXPORT
31size_t crypto_auth_hmacsha256_keybytes(void);
32
33SODIUM_EXPORT
34int crypto_auth_hmacsha256(unsigned char *out,
35 const unsigned char *in,
36 unsigned long long inlen,
37 const unsigned char *k);
38
39SODIUM_EXPORT
40int crypto_auth_hmacsha256_verify(const unsigned char *h,
41 const unsigned char *in,
42 unsigned long long inlen,
43 const unsigned char *k);
44
45SODIUM_EXPORT
46int crypto_auth_hmacsha256_init(crypto_auth_hmacsha256_state *state,
47 const unsigned char *key,
48 size_t keylen);
49
50SODIUM_EXPORT
51int crypto_auth_hmacsha256_update(crypto_auth_hmacsha256_state *state,
52 const unsigned char *in,
53 unsigned long long inlen);
54
55SODIUM_EXPORT
56int crypto_auth_hmacsha256_final(crypto_auth_hmacsha256_state *state,
57 unsigned char *out);
58
59#ifdef __cplusplus
60}
61#endif
62
63#endif
64
65#endif