12 #define SECTOR_SHIFT 9
13 #define SECTOR_SIZE (1 << SECTOR_SHIFT)
14 #define DEFAULT_ALIGNMENT 4096
16 /* private struct crypt_options flags */
18 #define CRYPT_FLAG_FREE_DEVICE (1 << 24)
19 #define CRYPT_FLAG_FREE_CIPHER (1 << 25)
21 #define CRYPT_FLAG_PRIVATE_MASK ((unsigned int)-1 << 24)
26 int (*fn)(void *data, int size, char *key,
27 int sizep, const char *passphrase);
32 struct hash_type * (*get_hashes)(void);
33 void (*free_hashes)(struct hash_type *hashes);
36 struct setup_backend {
40 int (*create)(int reload, struct crypt_options *options,
41 const char *key, const char *uuid);
42 int (*status)(int details, struct crypt_options *options,
44 int (*remove)(int force, struct crypt_options *options);
46 const char * (*dir)(void);
49 void set_error_va(const char *fmt, va_list va);
50 void set_error(const char *fmt, ...);
51 const char *get_error(void);
52 void *safe_alloc(size_t size);
53 void safe_free(void *data);
54 void *safe_realloc(void *data, size_t size);
55 char *safe_strdup(const char *s);
57 struct hash_backend *get_hash_backend(const char *name);
58 void put_hash_backend(struct hash_backend *backend);
59 int hash(const char *backend_name, const char *hash_name,
60 char *result, size_t size,
61 const char *passphrase, size_t sizep);
63 struct setup_backend *get_setup_backend(const char *name);
64 void put_setup_backend(struct setup_backend *backend);
66 void hexprint(char *d, int n);
68 int sector_size_for_device(const char *device);
69 ssize_t write_blockwise(int fd, const void *buf, size_t count);
70 ssize_t read_blockwise(int fd, void *_buf, size_t count);
71 ssize_t write_lseek_blockwise(int fd, const char *buf, size_t count, off_t offset);
74 int get_key(char *prompt, char **key, unsigned int *passLen, int key_size,
75 const char *key_file, int passphrase_fd, int timeout, int how2verify);
77 #endif /* INTERNAL_H */