Rewrite key input handling, add limits.
[platform/upstream/cryptsetup.git] / lib / utils_crypt.h
1 #ifndef _UTILS_CRYPT_H
2 #define _UTILS_CRYPT_H
3
4 #include <unistd.h>
5 #include "config.h"
6
7 #define MAX_CIPHER_LEN          32
8 #define MAX_CIPHER_LEN_STR      "32"
9
10 struct crypt_device;
11
12 int crypt_parse_name_and_mode(const char *s, char *cipher,
13                               int *key_nums, char *cipher_mode);
14
15 int crypt_get_key(const char *prompt,
16                   char **key, size_t *key_size,
17                   size_t keyfile_size_max,
18                   const char *key_file,
19                   int timeout, int verify,
20                   struct crypt_device *cd);
21
22 void *crypt_safe_alloc(size_t size);
23 void crypt_safe_free(void *data);
24 void *crypt_safe_realloc(void *data, size_t size);
25
26 #endif /* _UTILS_CRYPT_H */