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)  

includes.h
Go to the documentation of this file.
1  /*
2  *
3  * Copyright (c) 2011-2015
4  * name : Francis Banyikwa
5  * email: mhogomchungu@gmail.com
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 
21 #ifndef ZULUCRYPT_BIN
22 #define ZULUCRYPT_BIN
23 
24 #define STRING_MEMORY_HACK 1
25 
26 #include "../utility/string/String.h"
27 #include "../utility/string/StringList.h"
28 #include "../constants.h"
29 #include "../lib/libzuluCrypt.h"
30 #include "../utility/socket/socket.h"
31 #include "../utility/process/process.h"
32 #include "libzuluCrypt-exe.h"
33 #include "security.h"
34 #include "locale_path.h"
35 #include "../lib/includes.h"
36 
37 typedef struct{
38 
41 
42 }tvcrypt ;
43 
44 /*
45  * these two defines are used in save_and_restore_volume_header.c
46  */
47 #define VOLUME_HEADER_RESTORE 1
48 #define VOLUME_HEADER_SAVE 0
49 
50 /*
51  * These functions are here and not in libzuluCrypt-exe.h because they use string_t and the type is not supposed to be
52  * seen in public API
53  */
54 
55 /*
56  * global_variable_user_uid global variable is defined in security.c
57  */
58 extern uid_t global_variable_user_uid ;
59 
60 /*
61  * zuluCryptTrueCryptVeraCryptVolumeInfo() is defined in open_volume.c
62  */
63 void zuluCryptTrueCryptVeraCryptVolumeInfo( const char * type,tvcrypt * e ) ;
64 
65 /*
66  * this function is defined in security.c
67  */
68 int zuluCryptSecurityConvertUID( uid_t uid,const char * u_id ) ;
69 
70 /*
71  * this function is defined in volumes.c
72  */
73 int zuluCryptVolumeIsInSystemVolumeList( const char * device ) ;
74 
75 /*
76  * this function is defined in path_access.c
77  */
78 void zuluCryptPrepareSocketPath( uid_t uid ) ;
79 
80 /*
81  * this function is defined in open_volume.c
82  */
83 stringList_t zuluCryptCreateKeyFiles( const char * const * list,int s ) ;
84 
85 /*
86  * this function is defined in save_and_restore_volume_header.c
87  */
88 stringList_t veraCryptVolumePIMValue( info_t * s,const char * type ) ;
89 
90 /*
91  * this function is defined in open_volume.c
92  */
94 
95 /*
96  * this function is defined in module_system.c
97  * It gets a passphrase from a .so file as a plugin.
98  */
99 string_t GetKeyFromModule( const char * path,uid_t ) ;
100 
101 /*
102  * this function is defined in get_key_from_socket.c
103  */
104 void zuluCryptGetKeyFromSocket( const char * path,string_t *,uid_t uid ) ;
105 
106 /*
107  * this function returns "$HOME/" and is defined in ../pluginManager/zuluCryptPluginManager.c
108  */
110 
111 /*
112  * this function is defined in volumes.c
113  */
114 int zuluCryptPartitionIsSystemPartition( const char * dev,uid_t uid ) ;
115 
116 /*
117  * this function is defined in is_luks.c
118  */
119 int zuluCryptVolumeIsNotLuks( const char * dev ) ;
120 
121 /*
122  * this function is defined in volumes.c
123  */
124 int zuluCryptPrintDeviceProperties( int type ) ;
125 
126 /*
127  * this function is defined in volumes.c
128  */
129 const char * zuluCryptVolumeType( blkid_probe blkid,const char * device ) ;
130 
131 /*
132  * this function is defined in security.c
133  */
135 
136 /*
137  * this function is defined in volumes.c
138  */
139 char * zuluCryptDeviceFromLabel( const char * label ) ;
140 
141 /*
142  * this function is defined in security.c
143  */
144 int zuluCryptSecurityPathIsValid( const char * path,uid_t uid ) ;
145 
146 /*
147  * this function is defined in get_opts.c
148  */
150 
151 /*
152  * this function is defined in mount_flags.c
153  */
154 int zuluCryptMountFlagsAreNotCorrect( const char * mode,uid_t uid,unsigned long * flags ) ;
155 
156 /*
157  * this function is defined in security.c
158  */
160 
161 /*
162  * this function is defined in security.c
163  */
165 
166 /*
167  * this function is defined in security.c
168  */
170 
171 /*
172  * this function is defined in real_path.c
173  */
174 int zuluCryptPathStartsWith( const char * path,const char * start ) ;
175 
176 /*
177  * this function is defined in real_path.c
178  */
179 int zuluCryptPathDoesNotStartsWith( const char * path,const char * start ) ;
180 
181 /*
182  * this function is defined in mount_fs_options.c
183  */
184 int zulucryptFileSystemIsNotSupported( const char * fs ) ;
185 
186 /*
187  * this function is defined in ../lib/real_path.c
188  */
189 char * zuluCryptRealPath( const char * path ) ;
190 
191 /*
192  * this function is defined in clear_dead_mapper.c
193  */
194 void zuluCryptClearDeadMappers( uid_t uid,int ) ;
195 
196 /*
197  * this function is defined in clear_dead_mapper.c
198  */
200 
201 /*
202  * this function is defined in save_and_restore_luks_header.c
203  */
204 int zuluCryptHeaderMatchBackUpHeader( const char * device,const char * header_backup,uid_t uid ) ;
205 
206 /*
207  * this function is defined in bind.c
208  */
209 int zuluCryptBindUnmountVolume( stringList_t mountinfo,const char * device,uid_t uid ) ;
210 
211 /*
212  * this function is defined in bind.c
213  */
214 int zuluCryptBindMountVolume( const char * device,string_t,unsigned long flags ) ;
215 
216 /*
217  * this function is defined in bind.c
218  */
220 
221 /*
222  * this function is defined in ../pluginManager/zuluCryptPluginManager.c
223  */
225  const char * name,
226  const char * uuid,
227  uid_t uid,
228  const struct_opts * opts,
229  const char * run_path,
230  int * r ) ;
231 
232 /*
233  * this function is defined in volumes.c
234  */
236 
237 /*
238  * this function is defined in volumes.c
239  */
241 
242 /*
243  * this function is defined in volumes.c
244  */
246 
247 /*
248  * this function is defined in create_mount_point.c
249  */
250 string_t zuluCryptCreateMountPoint( const char * device,const char * m_point,const char * m_opts,uid_t uid ) ;
251 
252 /*
253  * this function is defined in create_mount_point.c
254  */
255 void zuluCryptCreateMountPointPrefix( uid_t uid ) ;
256 
257 /*
258  * zuluCryptCreateMountPath() is defined in create_mount_point.c
259  */
260 void zuluCryptCreateMountPath( const char * path ) ;
261 
262 /*
263  * this function is defined in create_mount_point.c
264  */
265 int zuluCryptMountPointPrefixMatch( const char * path,uid_t uid,string_t * m_point ) ;
266 
267 /*
268  * this function is defined in path_access.c
269  */
270 int zuluCryptGetPassFromFile( int * socket_path,const char * path,uid_t uid,string_t * st ) ;
271 
272 /*
273  * this function is defined in path_access.c
274  */
275 char * zuluCryptUUIDFromPath( const char * device ) ;
276 
277 /*
278  * this function is defined in path_access.c
279  */
280 char * zuluCryptEvaluateDeviceTags( const char * tag,const char * path ) ;
281 
282 /*
283  * zuluCryptRunTest() is defined in test.c
284  */
285 int zuluCryptRunTest( void ) ;
286 
287 /*
288  * zuluCryptDeviceIsSupported() is defined in volumes.c
289  */
290 int zuluCryptDeviceIsSupported( const char * device,uid_t uid ) ;
291 
292 /*
293  * zuluCryptPartitions() is defined in volumes.c
294  */
295 stringList_t zuluCryptPartitions( int option,uid_t uid ) ;
296 
297 /*
298  * zuluCryptGetVolumeSize() is defined in volumes.c
299  */
300 u_int64_t zuluCryptGetVolumeSize( const char * device ) ;
301 
302 /*
303  * zuluCryptGetAListOfAllPartitions() is defined in volumes.c
304  */
306 
307 /*
308  * zuluCryptReuseMountPoint() is defined in create_mount_point.c
309  */
310 int zuluCryptReuseMountPoint( void ) ;
311 
312 #endif
zuluCryptPartitionList
stringList_t zuluCryptPartitionList(void)
zuluCryptGetPartitionFromConfigFile
stringList_t zuluCryptGetPartitionFromConfigFile(const char *path)
Definition: volumes.c:1092
zuluCryptPartitions
stringList_t zuluCryptPartitions(int option, uid_t uid)
Definition: volumes.c:530
zuluCryptEvaluateDeviceTags
char * zuluCryptEvaluateDeviceTags(const char *tag, const char *path)
Definition: path_access.c:175
zuluCryptPathDoesNotStartsWith
int zuluCryptPathDoesNotStartsWith(const char *path, const char *start)
Definition: real_path.c:66
zuluCryptCreateMountPoint
string_t zuluCryptCreateMountPoint(const char *device, const char *m_point, const char *m_opts, uid_t uid)
Definition: create_mount_point.c:370
zuluCryptVolumeIsInSystemVolumeList
int zuluCryptVolumeIsInSystemVolumeList(const char *device)
Definition: volumes.c:715
zuluCryptDeviceFromLabel
char * zuluCryptDeviceFromLabel(const char *label)
Definition: blkid_evaluate_tag.c:47
zuluCryptMountFlagsAreNotCorrect
int zuluCryptMountFlagsAreNotCorrect(const char *mode, uid_t uid, unsigned long *flags)
Definition: mount_flags.c:41
zuluCryptBindSharedMountPointPathTaken
int zuluCryptBindSharedMountPointPathTaken(string_t path)
Definition: bind.c:223
zuluCryptBindUnmountVolume
int zuluCryptBindUnmountVolume(stringList_t mountinfo, const char *device, uid_t uid)
Definition: bind.c:200
zuluCryptDeleteKeyFiles
void zuluCryptDeleteKeyFiles(stringList_t stl)
Definition: open_volume.c:71
zuluCryptGetPartitionFromCrypttab
stringList_t zuluCryptGetPartitionFromCrypttab(void)
Definition: volumes.c:1050
security.h
zulucryptFileSystemIsNotSupported
int zulucryptFileSystemIsNotSupported(const char *fs)
struct_opts_1
Definition: libzuluCrypt-exe.h:35
zuluCryptSecurityGetFileSystemFromDevice
string_t zuluCryptSecurityGetFileSystemFromDevice(const char *path)
zuluCryptSecurityCheckPartitionPermissions
int zuluCryptSecurityCheckPartitionPermissions(uid_t uid)
zuluCryptGetAListOfAllVolumes
stringList_t zuluCryptGetAListOfAllVolumes(void)
Definition: volumes.c:406
zuluCryptCreateMountPath
void zuluCryptCreateMountPath(const char *path)
Definition: create_mount_point.c:291
zuluCryptUUIDFromPath
char * zuluCryptUUIDFromPath(const char *device)
Definition: path_access.c:197
zuluCryptGetUserHomePath
string_t zuluCryptGetUserHomePath(uid_t)
Definition: user_home_path.c:23
zuluCryptVolumeType
const char * zuluCryptVolumeType(blkid_probe blkid, const char *device)
Definition: blkid_evaluate_tag.c:210
zuluCryptPrintDeviceProperties
int zuluCryptPrintDeviceProperties(int type)
zuluCryptEXEGetOptsSetDefault
void zuluCryptEXEGetOptsSetDefault(struct_opts *stopts)
Definition: get_opts.c:24
zuluCryptMountPointPrefixMatch
int zuluCryptMountPointPrefixMatch(const char *path, uid_t uid, string_t *m_point)
Definition: create_mount_point.c:390
zuluCryptClearDeadMappers
void zuluCryptClearDeadMappers(uid_t uid, int)
Definition: clear_dead_mappers.c:184
zuluCryptTrueCryptVeraCryptVolumeInfo
void zuluCryptTrueCryptVeraCryptVolumeInfo(const char *type, tvcrypt *e)
Definition: open_volume.c:229
StringType
Definition: String.c:49
libzuluCrypt-exe.h
zuluCryptSecurityDropElevatedPrivileges
int zuluCryptSecurityDropElevatedPrivileges(void)
Definition: security.c:109
tvcrypt
Definition: includes.h:37
zuluCryptVolumeIsNotLuks
int zuluCryptVolumeIsNotLuks(const char *dev)
Definition: is_luks.c:63
zuluCryptDeleteDeadMountPoints
void zuluCryptDeleteDeadMountPoints(uid_t, stringList_t)
Definition: clear_dead_mappers.c:172
zuluCryptBindMountVolume
int zuluCryptBindMountVolume(const char *device, string_t, unsigned long flags)
Definition: bind.c:240
zuluCryptSecurityGainElevatedPrivileges
int zuluCryptSecurityGainElevatedPrivileges(void)
Definition: security.c:64
zuluCryptGetVolumeSize
u_int64_t zuluCryptGetVolumeSize(const char *device)
Definition: volumes.c:726
zuluCryptSecurityConvertUID
int zuluCryptSecurityConvertUID(uid_t uid, const char *u_id)
Definition: security.c:81
zuluCryptPrepareSocketPath
void zuluCryptPrepareSocketPath(uid_t uid)
Definition: path_access.c:108
StringListType
Definition: StringList.c:33
veraCryptVolumePIMValue
stringList_t veraCryptVolumePIMValue(info_t *s, const char *type)
Definition: save_and_restore_volume_header.c:411
e
static QString e
Definition: about.cpp:31
zuluCryptGetPassFromFile
int zuluCryptGetPassFromFile(int *socket_path, const char *path, uid_t uid, string_t *st)
Definition: path_access.c:121
zuluCryptPartitionIsSystemPartition
int zuluCryptPartitionIsSystemPartition(const char *dev, uid_t uid)
Definition: volumes.c:1143
info_t
Definition: includes.h:51
zuluCryptRealPath
char * zuluCryptRealPath(const char *path)
Definition: real_path.c:28
zuluCryptGetKeyFromSocket
void zuluCryptGetKeyFromSocket(const char *path, string_t *, uid_t uid)
Definition: zuluCryptPluginManager.c:74
tvcrypt::iteration_count
int iteration_count
Definition: includes.h:39
zuluCryptPathStartsWith
int zuluCryptPathStartsWith(const char *path, const char *start)
Definition: real_path.c:55
zuluCryptCreateKeyFiles
stringList_t zuluCryptCreateKeyFiles(const char *const *list, int s)
Definition: open_volume.c:30
GetKeyFromModule
string_t GetKeyFromModule(const char *path, uid_t)
global_variable_user_uid
uid_t global_variable_user_uid
Definition: security.c:96
zuluCryptHeaderMatchBackUpHeader
int zuluCryptHeaderMatchBackUpHeader(const char *device, const char *header_backup, uid_t uid)
Definition: save_and_restore_volume_header.c:753
zuluCryptPluginManagerGetKeyFromModule
string_t zuluCryptPluginManagerGetKeyFromModule(const char *device, const char *name, const char *uuid, uid_t uid, const struct_opts *opts, const char *run_path, int *r)
Definition: zuluCryptPluginManager.c:164
zuluCryptSecurityPathIsValid
int zuluCryptSecurityPathIsValid(const char *path, uid_t uid)
zuluCryptReuseMountPoint
int zuluCryptReuseMountPoint(void)
Definition: create_mount_point.c:58
zuluCryptDeviceIsSupported
int zuluCryptDeviceIsSupported(const char *device, uid_t uid)
Definition: volumes.c:411
zuluCryptRunTest
int zuluCryptRunTest(void)
zuluCryptCreateMountPointPrefix
void zuluCryptCreateMountPointPrefix(uid_t uid)
Definition: create_mount_point.c:359
tvcrypt::type
string_t type
Definition: includes.h:40