Commit Graph

440 Commits

Author SHA1 Message Date
Sebastian Messmer
e85019e95b Cache value of DataTree.numLeaves(). This should make read()/write() faster. 2016-07-05 23:56:44 -07:00
Sebastian Messmer
2f8e8d8157 Add test case for DataTree::numLeaves after resize 2016-07-05 23:53:13 -07:00
Sebastian Messmer
3a447a7110 Add a test case to VersionCompareTest 2016-06-28 15:24:18 -07:00
Sebastian Messmer
9e1d466eee Merge branch 'develop' into next 2016-06-28 01:38:12 -07:00
Sebastian Messmer
967b04929d Fix compiling test cases on older gcc versions 2016-06-28 01:37:08 -07:00
Sebastian Messmer
f706e46868 Fix compiling test cases on older gcc versions 2016-06-27 22:57:31 -07:00
Sebastian Messmer
0f9aba1fc4 Fix compilation of test cases for old gcc 2016-06-27 22:39:33 -07:00
Sebastian Messmer
397de9372f Each blob stores a parent pointer (i.e. the ID of the directory that contains this blob). This stores the directory structure in a conflict-proof way and can be used to resolve such conflicts. 2016-06-27 18:22:13 -07:00
Sebastian Messmer
a7f13ad7c1 When creating a file system, the user can choose whether to choose missing blocks as integrity violations. 2016-06-26 23:24:32 -07:00
Sebastian Messmer
2451a8c46f Add --missing-block-is-integrity-violation option. The option doesn't have an effect yet though. 2016-06-26 22:16:44 -07:00
Sebastian Messmer
7bf84b1948 Add some test cases for the consistency of the generated myClientId. 2016-06-26 22:15:52 -07:00
Sebastian Messmer
be8dffb24d MyClientId is generated outside of CryDevice to give the CryConfigCreator access to it. 2016-06-26 22:15:52 -07:00
Sebastian Messmer
b838046246 Add a 'exclusive client' option to the config file 2016-06-26 22:15:52 -07:00
Sebastian Messmer
514dbcb6c7 ClientId is not loaded/generated inside of KnownBlockVersions, but in CryDevice. This way, CryDevice also has access to the ClientID. This is later needed to recognize whether we're in a single-client or in a multi-client setting. 2016-06-26 22:15:52 -07:00
Sebastian Messmer
f066b45954 VersionCountingBlockStore::forEachBlock() has an integrity check checking that all expected blocks are still existing. 2016-06-26 22:15:52 -07:00
Sebastian Messmer
491b277cee In case of an integrity violation, tell the user how they can reset integrity data. 2016-06-26 22:15:52 -07:00
Sebastian Messmer
839a511c4d When an integrity violation is detected, any further access to the file system is blocked. This ensures that the user notices the integrity violation. 2016-06-26 22:15:52 -07:00
Sebastian Messmer
2284571127 Add test cases to KnownBlockVersionsTest 2016-06-26 22:15:52 -07:00
Sebastian Messmer
c84a230afd VersionCountingBlockStore is initialized with a flag, saying whether missing blocks are integrity errors. This flag is meant to be activated in a single-client scenario to have this additional integrity check. 2016-06-26 22:15:52 -07:00
Sebastian Messmer
e02021ecdc Throw an IntegrityViolationError exception instead of just logging integrity violations. This makes sure the user notices. 2016-06-26 22:15:52 -07:00
Sebastian Messmer
32001d0af3 Write another integrity test case 2016-06-26 22:15:52 -07:00
Sebastian Messmer
473e9cc8bb Fix compiler errors 2016-06-26 22:15:52 -07:00
Sebastian Messmer
1a72d3c226 Deleting a block doesn't set the version number to MAX_UINT64, but just increases it by one. This makes sure, that if (in case of a synchronization conflict) the block is reintroduced by another client, this is accepted. 2016-06-26 22:15:52 -07:00
Sebastian Messmer
5534b56ce3 When increasing the version number, don't only look at the version number in the block, but also at the last version number given to it by the current client. Ensure, the new version number is higher than both. 2016-06-26 22:15:52 -07:00
Sebastian Messmer
577c697856 When a client deletes a block, it will never again accept it as a valid block. 2016-06-26 22:15:52 -07:00
Sebastian Messmer
e7ac9bec57 Implement BlockStore::forEachBlock 2016-06-26 22:15:52 -07:00
Sebastian Messmer
4d1f7a46b9 * Prevent rollback to the "newest" version of a client when this version was superseded by a version from a different client.
* Use mutex/locks to secure access to KnownBlockVersions
2016-06-26 22:15:52 -07:00
Sebastian Messmer
ea3de7360c * Block versions don't have to be globally nondecreasing, but only per client id. This solves potential synchronization conflicts in a multi-client setting.
* Use cpputils::Serializer and cpputils::Deserializer instead of std::ifstream for storing/loading the block version list
2016-06-26 22:15:52 -07:00
Sebastian Messmer
389273a24f Test cases use a fake home directory for their configuration, so they don't clutter the actual home directory. 2016-06-26 22:15:52 -07:00
Sebastian Messmer
13411c4e59 Integrity data from KnownBlockVersions is persisted to a file 2016-06-26 22:15:52 -07:00
Sebastian Messmer
d7f547dd47 Implement a VersionCountingBlockStore that checks that version numbers are nondecreasing. Currently, the block store is not used yet and the state is not stored over different runs of CryFS. This comes with future commits. 2016-06-26 22:15:52 -07:00
Sebastian Messmer
da6390646e Add test cases for command line parser when options are not given. 2016-06-26 22:15:43 -07:00
Sebastian Messmer
9358c10adf Finish test cases for Block::resize() 2016-06-23 21:30:09 -07:00
Sebastian Messmer
acedbbd0c4 Fix EncryptedBlock::resize() and add test cases for it 2016-06-23 21:20:36 -07:00
Sebastian Messmer
e4501d51e5 Each file system gets a unique ID. This ID will later be used to store local configuration of a client for that file system. 2016-06-20 16:14:07 -07:00
Sebastian Messmer
354f72443e Adapt test cases to new behavior from commit 2642507344 2016-06-07 12:52:06 -07:00
Sebastian Messmer
1bb38f39b4 * Fix FuseTest
* Refactor Fuse: shorter functions, and factor out common functionality of adding a fuse option into own method
2016-06-04 00:45:49 -07:00
Sebastian Messmer
40c64a879c Hide fuse quirks inside the Fuse class.
fuse_main needs the program arguments as char ** instead of const char ** or (even better) vector<string>.
With this commit, we hide that inside the Fuse class. Everything outside handles these arguments as vector<string> and passes it as such to the Fuse class.
2016-05-09 16:07:02 -07:00
Sebastian Messmer
9a0b0a0c36 Ask before migrating an old CryFS file system to a new version. 2016-05-03 20:34:30 -07:00
Sebastian Messmer
9ed7bd0b41 Ciphertext blocks are split into subdirectories (before, all were on top level) to reduce number of files per directory. Some unix tools don't work well with directories with too many entries. 2016-04-29 12:21:02 -07:00
Sebastian Messmer
811c163bfa Fix rename() when overwriting an existing file: (a) Keep the invariant that the list of directory entries is sorted and (b) delete the blob of the overwritten file 2016-04-25 17:42:17 -07:00
Sebastian Messmer
97bd758eb8 Fix test case on 32bit platform (caused by double inaccuracy) 2016-04-02 10:13:28 +02:00
Sebastian Messmer
4069358b31 Fix VersionCompare for stable versions vs tag versions 2016-03-29 11:07:00 +08:00
Sebastian Messmer
078ab78c5a Removed unnecessary workaround 2016-03-26 23:42:07 +08:00
Sebastian Messmer
b9ac810414 - The version field in the config file is updated when the file system is opened with a newer CryFS version (i.e. it is migrated to the newer version).
- We introduced a CreatedWithVersion field instead which gets the semantics the version field had before (i.e. which version of CryFS was the file system originally created with)
- Move VersionCompare to gitversion package
2016-03-27 00:09:07 +08:00
Sebastian Messmer
18d05d165e Use --blocksize instead of --blocksize-bytes, so we can (later) allow users to write "--blocksize 2M" 2016-03-24 06:45:41 +00:00
Sebastian Messmer
1c0199e147 When the user specifies a block size for the file system, this is taken as the physical block size, not virtual block size. 2016-03-16 19:30:26 +00:00
Sebastian Messmer
037b59634e Implemented BlockStore::blockSizeFromPhysicalBlockSize. This will be used to let the user configure physical block size instead of virtual block size. 2016-03-16 18:56:06 +00:00
Sebastian Messmer
526b749d1d Add a command line option for blocksize 2016-03-04 23:12:41 +01:00
Sebastian Messmer
5579270108 Handle fallback version "0+unknown" correctly 2016-03-02 14:39:30 +01:00