zuluCrypt  5.7.1
About: zuluCrypt is a simple but feature rich solution for hard drives encryption. It can manage PLAIN dm-crypt, LUKS, TrueCrypt and VeraCrypt encrypted volumes.
  Fossies Dox: zuluCrypt-5.7.1.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

libzuluCrypt-exe.h
Go to the documentation of this file.
1  /*
2  * Copyright (c) 2011-2015
3  * name : Francis Banyikwa
4  * email: mhogomchungu@gmail.com
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 
20 #ifndef ZULUCRYPTEXE
21 #define ZULUCRYPTEXE
22 
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26 
27 #include <sys/types.h>
28 
29 #define TRUECRYPT_MAX_KEYFILES 16
30 
31 /*
32  * this structure holds command line arguments. *
33  * It is instantiated in main.c *
34  */
35 typedef struct struct_opts_1{
36  const char * plugin_path ;
37  const char * device ;
38  const char * mount_point ;
39  const char * m_opts ;
40  const char * fs_opts ;
41  const char * key_source ;
42  const char * key ;
43  const char * fs ;
44  const char * type ;
45  const char * rng ;
46  const char * existing_key_source ;
47  const char * existing_key ;
48  const char * new_key ;
49  const char * new_key_source ;
50  const char * argv ;
52  const char * tcrypt_hidden_volume_key ;
55  const char * back_up_file_path ;
56  const char * offset ;
57  const char * uid ;
58  const char * luks_external_header ;
59  char * const * env ;
60  char action ;
63  int open_mount ;
66  int share ;
69 
70 /*
71  * this function is defined in security.c
72  */
73 void zuluCryptExeSetOriginalUID( uid_t s ) ;
74 
75 /*
76  * this function is defined in security.c
77  */
79 
80 /*
81  * get command line arguments and in struct_opts structure to be used in various calls *
82  */
83 void zuluCryptEXEGetOpts( int argc,char * argv[],struct_opts * ) ;
84 
85 /*
86  * this function is responsibe for creating and restoring luks header.
87  *
88  * the function is defined in save_and_restore_luks_header.c
89  */
90 int zuluCryptEXESaveAndRestoreVolumeHeader( const struct_opts * opts,uid_t uid,int option ) ;
91 
92 /*
93  * this function is responsibe for printing information about an opened volume.
94  * It is defined in volume_info.c
95  */
96 int zuluCryptEXEVolumeInfo( const char * mapper,const char * device,uid_t ) ;
97 
98 /*
99  * this function is responsibe for closing an opened volume.
100  * It is defined in close_volume.c
101  */
102 int zuluCryptEXECloseVolume( const char * device,const char * mapping_name,uid_t ) ;
103 
104 /*
105  * this function is responsibe for opening volumes.
106  * It is defined in open_volume.c *
107  */
108 int zuluCryptEXEOpenVolume( const struct_opts *,const char * mapping_name,uid_t uid ) ;
109 
110 /*
111  * this function is responsibe for creating volumes.
112  * It is defined in create_volume.c
113  */
114 int zuluCryptEXECreateVolume( const struct_opts *,const char * mapping_name,uid_t uid ) ;
115 
116 /*
117  * this function is responsibe for adding keys to luks volumes.
118  * It is defined in add_key.c
119  */
120 int zuluCryptEXEAddKey( const struct_opts *,uid_t ) ;
121 
122 /*
123  * this function is responsibe for removing keys from luks files.
124  * It is defined in remove_key.c
125  */
126 int zuluCryptEXERemoveKey( const struct_opts *,uid_t ) ;
127 
128 /*
129  * this function is responsibe for checking if a path exist or not.
130  * It is defined in ../lib/is_path_valid.c
131  */
132 int zuluCryptIsPathValid( const char * path ) ;
133 
134 /*
135  * this function checks if a user who started the tool has writing access to a file or device they want this tool to
136  * write to.
137  * It is defined in path_access.c
138  */
139 int zuluCryptCanOpenPathForWriting( const char * path,uid_t uid ) ;
140 
141 /*
142  * this function checks if a user who started the tool has reading access to a file or device they want this tool to
143  * read from.
144  * It is defined in path_access.c
145  */
146 int zuluCryptCanOpenPathForReading( const char * path,uid_t uid ) ;
147 
148 /*
149  * check if the volume has atleast one corrupted key slot
150  */
151 void zuluCryptCheckInvalidKey( const char * device ) ;
152 
153 /*
154  * this function checks if a device is a system partition or not.
155  *
156  * the function is defined in partitions.c *
157  */
158 int zuluCryptCheckIfPartitionIsSystemPartition( const char * device ) ;
159 
160 /*
161  * defined in crypt_file.c
162  */
163 int zuluCryptExeFileEncrypt( const struct_opts *,uid_t uid ) ;
164 
165 /*
166  * defined in crypt_file.c
167  */
168 int zuluCryptExeFileDecrypt( const struct_opts *,uid_t uid ) ;
169 
170 /*
171  * defined in check_opened_mapper.c
172  *
173  * the function checks to see if the argument mapper has an entry in crypt_get_dir().
174  *
175  * the function is used to prevent performing operations like creating a volume on devices with mapper open.
176  */
177 int zuluCryptCheckOpenedMapper( const char * mapper ) ;
178 
179 /*
180  * check if a device with a path "path" as an entry in /etc/mtab.
181  *
182  * defined in process_mountinfo.c
183  */
184 int zuluCryptCheckIfMounted( const char * path ) ;
185 
186 /*
187  * function defined at write_device_with_junk.c
188  */
189 int zuluCryptEXEWriteDeviceWithJunk( const struct_opts * opts,const char * mapping_name,uid_t uid ) ;
190 
191 /*
192  * function defined at write_device_with_junk.c
193  */
194 int zuluCryptEXEOpenPlainAsMe(const struct_opts * opts,const char * mapping_name,uid_t uid ) ;
195 
196 /*
197  * defined in lib/status.c
198  * remember to free() the return value when done with it
199  * */
200 char * zuluCryptVolumeDeviceName( const char * ) ;
201 
202 /*
203  * defined at help.c
204  * */
205 void zuluCryptEXEHelp( void ) ;
206 
207 /*
208  * defined at partitions.c
209  */
210 int zuluCryptCheckSystemTools( void ) ;
211 
212 /*
213  * defined in partitions.c
214  * remember to free() the return value when done with it *
215  */
216 char * zuluCryptDeviceFromUUID( const char * uuid ) ;
217 
218 /*
219  * defined in partitions.c
220  */
221 int zuluCryptPrintPartitions( int option,int info,uid_t uid ) ;
222 
223 /*
224  * defined at process_mountinfo.c
225  * remember to free() a returned pointer when done with it.
226  */
227 char * zuluCryptGetMountPointFromPath( const char * path ) ;
228 
229 
230 #ifdef __cplusplus
231 }
232 #endif
233 
234 #endif
struct_opts_1::tcrypt_multiple_keyfiles
const char * tcrypt_multiple_keyfiles[16+1]
Definition: libzuluCrypt-exe.h:54
zuluCryptEXEAddKey
int zuluCryptEXEAddKey(const struct_opts *, uid_t)
Definition: add_key.c:244
zuluCryptExeFileDecrypt
int zuluCryptExeFileDecrypt(const struct_opts *, uid_t uid)
Definition: crypt_file.c:204
zuluCryptDeviceFromUUID
char * zuluCryptDeviceFromUUID(const char *uuid)
Definition: blkid_evaluate_tag.c:42
struct_opts_1::tcrypt_hidden_volume_multiple_keyfiles
const char * tcrypt_hidden_volume_multiple_keyfiles[16+1]
Definition: libzuluCrypt-exe.h:53
struct_opts_1::mount_point_option
int mount_point_option
Definition: libzuluCrypt-exe.h:64
struct_opts_1::argv
const char * argv
Definition: libzuluCrypt-exe.h:50
struct_opts_1::type
const char * type
Definition: libzuluCrypt-exe.h:44
struct_opts_1::key
const char * key
Definition: libzuluCrypt-exe.h:42
zuluCryptPrintPartitions
int zuluCryptPrintPartitions(int option, int info, uid_t uid)
Definition: volumes.c:972
struct_opts_1::partition_number
int partition_number
Definition: libzuluCrypt-exe.h:61
struct_opts_1::device
const char * device
Definition: libzuluCrypt-exe.h:37
zuluCryptEXEOpenPlainAsMe
int zuluCryptEXEOpenPlainAsMe(const struct_opts *opts, const char *mapping_name, uid_t uid)
Definition: write_device_with_junk.c:252
struct_opts_1::open_mount
int open_mount
Definition: libzuluCrypt-exe.h:63
struct_opts_1::new_key
const char * new_key
Definition: libzuluCrypt-exe.h:48
struct_opts_1::plugin_path
const char * plugin_path
Definition: libzuluCrypt-exe.h:36
zuluCryptExeSetOriginalUID
void zuluCryptExeSetOriginalUID(uid_t s)
Definition: security.c:54
zuluCryptGetMountPointFromPath
char * zuluCryptGetMountPointFromPath(const char *path)
Definition: mountinfo.c:380
zuluCryptEXECreateVolume
int zuluCryptEXECreateVolume(const struct_opts *, const char *mapping_name, uid_t uid)
Definition: create_volumes.c:80
zuluCryptIsPathValid
int zuluCryptIsPathValid(const char *path)
zuluCryptCanOpenPathForWriting
int zuluCryptCanOpenPathForWriting(const char *path, uid_t uid)
Definition: path_access.c:103
struct_opts_1::back_up_file_path
const char * back_up_file_path
Definition: libzuluCrypt-exe.h:55
struct_opts_1
Definition: libzuluCrypt-exe.h:35
struct_opts_1::key_source
const char * key_source
Definition: libzuluCrypt-exe.h:41
zuluCryptExeFileEncrypt
int zuluCryptExeFileEncrypt(const struct_opts *, uid_t uid)
Definition: crypt_file.c:209
zuluCryptEXEOpenVolume
int zuluCryptEXEOpenVolume(const struct_opts *, const char *mapping_name, uid_t uid)
Definition: open_volume.c:254
zuluCryptEXERemoveKey
int zuluCryptEXERemoveKey(const struct_opts *, uid_t)
Definition: remove_key.c:95
zuluCryptCanOpenPathForReading
int zuluCryptCanOpenPathForReading(const char *path, uid_t uid)
Definition: path_access.c:98
struct_opts_1::new_key_source
const char * new_key_source
Definition: libzuluCrypt-exe.h:49
struct_opts_1::fs
const char * fs
Definition: libzuluCrypt-exe.h:43
zuluCryptEXEWriteDeviceWithJunk
int zuluCryptEXEWriteDeviceWithJunk(const struct_opts *opts, const char *mapping_name, uid_t uid)
Definition: write_device_with_junk.c:263
zuluCryptCheckIfMounted
int zuluCryptCheckIfMounted(const char *path)
zuluCryptEXEVolumeInfo
int zuluCryptEXEVolumeInfo(const char *mapper, const char *device, uid_t)
Definition: volume_info.c:26
struct_opts_1::existing_key
const char * existing_key
Definition: libzuluCrypt-exe.h:47
struct_opts_1::action
char action
Definition: libzuluCrypt-exe.h:60
struct_opts_1::tcrypt_hidden_volume_key
const char * tcrypt_hidden_volume_key
Definition: libzuluCrypt-exe.h:52
zuluCryptCheckOpenedMapper
int zuluCryptCheckOpenedMapper(const char *mapper)
Definition: check_opened_mapper.c:23
zuluCryptVolumeDeviceName
char * zuluCryptVolumeDeviceName(const char *)
Definition: status.c:895
zuluCryptCheckIfPartitionIsSystemPartition
int zuluCryptCheckIfPartitionIsSystemPartition(const char *device)
struct_opts_1::offset
const char * offset
Definition: libzuluCrypt-exe.h:56
struct_opts
struct struct_opts_1 struct_opts
zuluCryptEXESaveAndRestoreVolumeHeader
int zuluCryptEXESaveAndRestoreVolumeHeader(const struct_opts *opts, uid_t uid, int option)
Definition: save_and_restore_volume_header.c:612
zuluCryptCheckInvalidKey
void zuluCryptCheckInvalidKey(const char *device)
Definition: check_invalid_key.c:23
zuluCryptEXEHelp
void zuluCryptEXEHelp(void)
Definition: help.c:29
struct_opts_1::ask_confirmation
int ask_confirmation
Definition: libzuluCrypt-exe.h:62
struct_opts_1::existing_key_source
const char * existing_key_source
Definition: libzuluCrypt-exe.h:46
struct_opts_1::uid
const char * uid
Definition: libzuluCrypt-exe.h:57
struct_opts_1::rng
const char * rng
Definition: libzuluCrypt-exe.h:45
struct_opts_1::share
int share
Definition: libzuluCrypt-exe.h:66
struct_opts_1::tcrypt_hidden_volume_size
const char * tcrypt_hidden_volume_size
Definition: libzuluCrypt-exe.h:51
struct_opts_1::luks_external_header
const char * luks_external_header
Definition: libzuluCrypt-exe.h:58
TRUECRYPT_MAX_KEYFILES
#define TRUECRYPT_MAX_KEYFILES
Definition: libzuluCrypt-exe.h:29
zuluCryptEXEGetOpts
void zuluCryptEXEGetOpts(int argc, char *argv[], struct_opts *)
Definition: get_opts.c:46
struct_opts_1::fs_opts
const char * fs_opts
Definition: libzuluCrypt-exe.h:40
struct_opts_1::m_opts
const char * m_opts
Definition: libzuluCrypt-exe.h:39
struct_opts_1::mount_point
const char * mount_point
Definition: libzuluCrypt-exe.h:38
zuluCryptEXECloseVolume
int zuluCryptEXECloseVolume(const char *device, const char *mapping_name, uid_t)
Definition: close_volume.c:50
struct_opts_1::print_partition_type
int print_partition_type
Definition: libzuluCrypt-exe.h:65
struct_opts_1::env
char *const * env
Definition: libzuluCrypt-exe.h:59
zuluCryptExeOriginalUserIsNotRoot
int zuluCryptExeOriginalUserIsNotRoot()
Definition: security.c:59
zuluCryptCheckSystemTools
int zuluCryptCheckSystemTools(void)
struct_opts_1::use_cryptsetup_for_bitlocker
int use_cryptsetup_for_bitlocker
Definition: libzuluCrypt-exe.h:67