12 #define SECTOR_SHIFT 9
13 #define SECTOR_SIZE (1 << SECTOR_SHIFT)
15 /* private struct crypt_options flags */
17 #define CRYPT_FLAG_FREE_DEVICE (1 << 24)
18 #define CRYPT_FLAG_FREE_CIPHER (1 << 25)
20 #define CRYPT_FLAG_PRIVATE_MASK ((unsigned int)-1 << 24)
25 int (*fn)(void *data, int size, char *key,
26 int sizep, const char *passphrase);
31 struct hash_type * (*get_hashes)(void);
32 void (*free_hashes)(struct hash_type *hashes);
35 struct setup_backend {
39 int (*create)(int reload, struct crypt_options *options,
40 const char *key, const char *uuid);
41 int (*status)(int details, struct crypt_options *options,
43 int (*remove)(int force, struct crypt_options *options);
45 const char * (*dir)(void);
48 void set_error_va(const char *fmt, va_list va);
49 void set_error(const char *fmt, ...);
50 const char *get_error(void);
51 void *safe_alloc(size_t size);
52 void safe_free(void *data);
53 void *safe_realloc(void *data, size_t size);
54 char *safe_strdup(const char *s);
56 struct hash_backend *get_hash_backend(const char *name);
57 void put_hash_backend(struct hash_backend *backend);
58 int hash(const char *backend_name, const char *hash_name,
59 char *result, size_t size,
60 const char *passphrase, size_t sizep);
62 struct setup_backend *get_setup_backend(const char *name);
63 void put_setup_backend(struct setup_backend *backend);
65 void hexprint(char *d, int n);
67 int sector_size_for_device(const char *device);
68 ssize_t write_blockwise(int fd, const void *buf, size_t count);
69 ssize_t read_blockwise(int fd, void *_buf, size_t count);
70 ssize_t write_lseek_blockwise(int fd, const char *buf, size_t count, off_t offset);
73 int get_key(char *prompt, char **key, unsigned int *passLen, int key_size,
74 const char *key_file, int passphrase_fd, int timeout, int how2verify);
76 #endif /* INTERNAL_H */