MCPcopy Create free account
hub / github.com/bailey27/cppcryptfs / get_dir_iv

Function get_dir_iv

libcppcryptfs/util/fileutil.cpp:195–228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193#endif // _WIN32
194
195bool
196get_dir_iv(CryptContext *con, const WCHAR *path, unsigned char *diriv)
197{
198
199 if (con && !con->GetConfig()->DirIV()) {
200 memset(diriv, 0, DIR_IV_LEN);
201 return true;
202 }
203
204 bool bret = true;
205
206 try {
207
208 if (con && con->GetConfig()->m_reverse) {
209 throw(wstring(L"\tcalled for reverse fs"));
210 }
211
212 if (!con->m_dir_iv_cache.lookup(path, diriv)) {
213 FILETIME LastWritten;
214 if (!read_dir_iv(path, diriv, LastWritten))
215 throw(wstring(L"read_dir_iv failed for") + path);
216 if (!con->m_dir_iv_cache.store(path, diriv, LastWritten)) {
217 throw(wstring(L"store_diriv failed for ") + path);
218 }
219 }
220 } catch (const wstring& mes) {
221 DbgPrint(L"\tget_diriv %s\n", mes.c_str());
222 bret = false;
223 } catch (...) {
224 bret = false;
225 }
226
227 return bret;
228}
229
230static bool
231convert_fdata(CryptContext *con, BOOL isRoot, const BYTE *dir_iv, const WCHAR *path, WIN32_FIND_DATAW& fdata, string *actual_encrypted, wstring& storage)

Callers 5

find_filesFunction · 0.85
convert_find_stream_dataFunction · 0.85
init_serialMethod · 0.85
unencrypt_pathFunction · 0.85
encrypt_pathFunction · 0.85

Calls 6

read_dir_ivFunction · 0.85
DbgPrintFunction · 0.85
DirIVMethod · 0.80
GetConfigMethod · 0.80
lookupMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected