Initial checking of what was revision 56 on http://luks.endorphin.org/svn/cryptsetup
[platform/upstream/cryptsetup.git] / lib / libcryptsetup.h
1 #ifndef _LIBCRYPTSETUP_H
2 #define _LIBCRYPTSETUP_H
3
4 #include <stdint.h>
5
6
7 #define CRYPT_LOG_NORMAL 0
8 #define CRYPT_LOG_ERROR  1
9
10 struct interface_callbacks { 
11     int (*yesDialog)(char *msg);
12     void (*log)(int class, char *msg);
13 };
14
15
16 #define CRYPT_FLAG_VERIFY               (1 << 0)
17 #define CRYPT_FLAG_READONLY             (1 << 1)
18 #define CRYPT_FLAG_VERIFY_IF_POSSIBLE   (1 << 2)
19 #define CRYPT_FLAG_VERIFY_ON_DELKEY     (1 << 3)
20
21 struct crypt_options {
22         const char      *name;
23         const char      *device;
24
25         const char      *cipher;
26         const char      *hash;
27
28         const char      *passphrase;
29         int             passphrase_fd;
30         const char      *key_file;
31         const char      *new_key_file;  
32         int             key_size;
33         
34         unsigned int    flags;
35         int             key_slot;
36
37         uint64_t        size;
38         uint64_t        offset;
39         uint64_t        skip;
40         uint64_t        iteration_time;
41         uint64_t        timeout;
42
43         uint64_t        align_payload;
44         int             tries;
45
46         struct interface_callbacks *icb;
47 };
48
49 int crypt_create_device(struct crypt_options *options);
50 int crypt_update_device(struct crypt_options *options);
51 int crypt_resize_device(struct crypt_options *options);
52 int crypt_query_device(struct crypt_options *options);
53 int crypt_remove_device(struct crypt_options *options);
54 int crypt_luksFormat(struct crypt_options *options);
55 int crypt_luksOpen(struct crypt_options *options);
56 int crypt_luksKillSlot(struct crypt_options *options);
57 int crypt_luksRemoveKey(struct crypt_options *options);
58 int crypt_luksAddKey(struct crypt_options *options);
59 int crypt_luksUUID(struct crypt_options *options);
60 int crypt_isLuks(struct crypt_options *options);
61 int crypt_luksFormat(struct crypt_options *options);
62 int crypt_luksDump(struct crypt_options *options);
63
64 void crypt_get_error(char *buf, size_t size);
65 void crypt_put_options(struct crypt_options *options);
66 const char *crypt_get_dir(void);
67
68 #endif /* _LIBCRYPTSETUP_H */