b574275e9c1badc5bf47a26f3f4d1f4811f1cec7
[platform/upstream/cryptsetup.git] / docs / doxygen_index
1 /**
2  * @mainpage Cryptsetup API
3  *
4  * The documentation covers public parts of cryptsetup API. In the following sections you'll find
5  * the examples that describe some features of cryptsetup API.
6  *
7  * <OL type="A">
8  *      <LI>@ref cexamples "Cryptsetup API examples"</LI>
9  *      <OL type="1">
10  *              <LI>@ref cluks "crypt_luks_usage" - cryptsetup LUKS device type usage examples</LI>
11  *                      <UL>
12  *                              <LI>@ref cinit "crypt_init()"</LI>
13  *                              <LI>@ref cformat "crypt_format()" - header and payload on mutual device</LI>
14  *                              <LI>@ref ckeys "Keyslot operations" </LI>
15  *                              <UL>
16  *                                      <LI>@ref ckeyslot_vol "crypt_keyslot_add_by_volume_key()"</LI>
17  *                                      <LI>@ref ckeyslot_pass "crypt_keyslot_add_by_passphrase()"</LI>
18  *                              </UL>
19  *                              <LI>@ref cload "crypt_load()"
20  *                              <LI>@ref cactivate "crypt_activate_by_passphrase()"</LI>
21  *                              <LI>@ref cactive_pars "crypt_get_active_device()"</LI>
22  *                              <LI>@ref cinit_by_name "crypt_init_by_name()"</LI>
23  *                              <LI>@ref cdeactivate "crypt_deactivate()"</LI>
24  *                              <LI>@ref cluks_ex "crypt_luks_usage.c"</LI>
25  *                      </UL>
26  *              <LI>@ref clog "crypt_log_usage" - cryptsetup logging API examples</LI>
27  *      </OL>
28  * </OL>
29  *
30  * @section cexamples Cryptsetup API examples
31  *      @section cluks crypt_luks_usage - cryptsetup LUKS device type usage
32  *              @subsection cinit crypt_init()
33  *
34  *                      Every time you need to do something with cryptsetup or dmcrypt device
35  *                      you need a valid context. The first step to start your work is
36  *                      @ref crypt_init call. You can call it either with path
37  *                      to the block device or path to the regular file. If you don't supply the path,
38  *                      empty context is initialized.
39  *
40  *              @subsection cformat crypt_format() - header and payload on mutual device
41  *
42  *                      This section covers basic use cases for formatting LUKS devices. Format operation
43  *                      sets device type in context and in case of LUKS header is written at the beginning
44  *                      of block device. In the example bellow we use the scenario where LUKS header and data
45  *                      are both stored on the same device. There's also a possibility to store header and
46  *                      data separately.
47  *
48  *                      <B>Bear in mind</B> that @ref crypt_format() is destructive operation and it
49  *                      overwrites part of the backing block device.
50  *
51  *              @subsection ckeys Keyslot operations examples
52  *
53  *                      After successful @ref crypt_format of LUKS device, volume key is not stored
54  *                      in a persistent way on the device. Keyslot area is an array beyond LUKS header, where
55  *                      volume key is stored in the encrypted form using user input passphrase. For more info about
56  *                      LUKS keyslots and how it's actually protected, please look at
57  *                      <A HREF="http://code.google.com/p/cryptsetup/wiki/Specification">LUKS specification</A>.
58  *                      There are two basic methods to create a new keyslot:
59  *
60  *                      @subsection ckeyslot_vol crypt_keyslot_add_by_volume_key()
61  *
62  *                              Creates a new keyslot directly by encrypting volume_key stored in the device
63  *                              context. Passphrase should be supplied or user is prompted if passphrase param is
64  *                              NULL.
65  *
66  *                      @subsection ckeyslot_pass crypt_keyslot_add_by_passphrase()
67  *
68  *                              Creates a new keyslot for the volume key by opening existing active keyslot,
69  *                              extracting volume key from it and storing it into a new keyslot
70  *                              protected by a new passphrase
71  *
72  *              @subsection cload crypt_load()
73  *
74  *                      Function loads header from backing block device into device context.
75  *
76  *              @subsection cactivate crypt_activate_by_passphrase()
77  *
78  *                      Activates crypt device by user supplied password for keyslot containing the volume_key.
79  *                      If <I>keyslot</I> parameter is set to <I>CRYPT_ANY_SLOT</I> then all active keyslots
80  *                      are tried one by one until the volume key is found.
81  *
82  *              @subsection cactive_pars crypt_get_active_device()
83  *
84  *                      This call returns structure containing runtime attributes of active device.
85  *
86  *              @subsection cinit_by_name crypt_init_by_name()
87  *
88  *                      In case you need to do operations with active device (device which already
89  *                      has its corresponding mapping) and you miss valid device context stored in
90  *                      *crypt_device reference, you should use this call. Function tries to
91  *                      get path to backing device from DM, initializes context for it and loads LUKS
92  *                      header.
93  *
94  *                      @subsection cdeactivate crypt_deactivate()
95  *
96  *                      Deactivates crypt device (removes DM mapping and safely erases volume key from kernel).
97  *
98  *              @subsection cluks_ex crypt_luks_usage.c - Complex example
99  *
100  *                      To compile and run use following commands in examples directory:
101  *
102  * @code
103  * make
104  * ./crypt_luks_usage _path_to_[block_device]_file
105  * @endcode
106  *
107  *                      Note that you need to have the cryptsetup library compiled. @include crypt_luks_usage.c
108  *
109  *      @section clog crypt_log_usage - cryptsetup logging API example
110  *
111  *              Example describes basic use case for cryptsetup logging. To compile and run
112  *              use following commands in examples directory:
113  *
114  * @code
115  * make
116  * ./crypt_log_usage
117  * @endcode
118  *
119  *              Note that you need to have the cryptsetup library compiled. @include crypt_log_usage.c
120  *
121  *              @example crypt_luks_usage.c
122  *              @example crypt_log_usage.c
123  */