f411131b0e99880b1d8159771204290a31696338
[platform/upstream/cryptsetup.git] / lib / crypto_backend / crypto_backend.h
1 #ifndef _CRYPTO_BACKEND_H
2 #define _CRYPTO_BACKEND_H
3
4 #include "libcryptsetup.h"
5 #include "internal.h"
6
7 struct crypt_hash;
8 struct crypt_hmac;
9
10 int crypt_backend_init(void);
11
12 #define CRYPT_BACKEND_KERNEL (1 << 0)   /* Crypto uses kernel part, for benchmark */
13
14 uint32_t crypt_backend_flags();
15
16 /* HASH */
17 int crypt_hash_size(const char *name);
18 int crypt_hash_init(struct crypt_hash **ctx, const char *name);
19 int crypt_hash_restart(struct crypt_hash *ctx);
20 int crypt_hash_write(struct crypt_hash *ctx, const char *buffer, size_t length);
21 int crypt_hash_final(struct crypt_hash *ctx, char *buffer, size_t length);
22 int crypt_hash_destroy(struct crypt_hash *ctx);
23
24 /* HMAC */
25 int crypt_hmac_size(const char *name);
26 int crypt_hmac_init(struct crypt_hmac **ctx, const char *name,
27                     const void *buffer, size_t length);
28 int crypt_hmac_restart(struct crypt_hmac *ctx);
29 int crypt_hmac_write(struct crypt_hmac *ctx, const char *buffer, size_t length);
30 int crypt_hmac_final(struct crypt_hmac *ctx, char *buffer, size_t length);
31 int crypt_hmac_destroy(struct crypt_hmac *ctx);
32
33 #endif /* _CRYPTO_BACKEND_H */