From ffc2fe8eefa092efa4c851e603aaaa64b146d4bb Mon Sep 17 00:00:00 2001 From: Nicolas Schneider Date: Mon, 23 Jan 2017 01:23:51 +0100 Subject: [PATCH 1/2] print defaults for cipher and blocksize in cli help (#124) Closes #94. --- src/cryfs-cli/program_options/Parser.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/cryfs-cli/program_options/Parser.cpp b/src/cryfs-cli/program_options/Parser.cpp index c5833cf0..0391f20b 100644 --- a/src/cryfs-cli/program_options/Parser.cpp +++ b/src/cryfs-cli/program_options/Parser.cpp @@ -2,11 +2,13 @@ #include "utils.h" #include #include +#include #include namespace po = boost::program_options; namespace bf = boost::filesystem; using namespace cryfs::program_options; +using cryfs::CryConfigConsole; using std::pair; using std::vector; using std::cerr; @@ -118,12 +120,16 @@ vector Parser::_to_const_char_vector(const vector &options) void Parser::_addAllowedOptions(po::options_description *desc) { po::options_description options("Allowed options"); + string cipher_description = "Cipher to use for encryption. See possible values by calling cryfs with --show-ciphers. Default: "; + cipher_description += CryConfigConsole::DEFAULT_CIPHER; + string blocksize_description = "The block size used when storing ciphertext blocks (in bytes). Default: "; + blocksize_description += std::to_string(CryConfigConsole::DEFAULT_BLOCKSIZE_BYTES); options.add_options() ("help,h", "show help message") ("config,c", po::value(), "Configuration file") ("foreground,f", "Run CryFS in foreground.") - ("cipher", po::value(), "Cipher to use for encryption. See possible values by calling cryfs with --show-ciphers.") - ("blocksize", po::value(), "The block size used when storing ciphertext blocks (in bytes).") + ("cipher", po::value(), cipher_description.c_str()) + ("blocksize", po::value(), blocksize_description.c_str()) ("show-ciphers", "Show list of supported ciphers.") ("unmount-idle", po::value(), "Automatically unmount after specified number of idle minutes.") ("logfile", po::value(), "Specify the file to write log messages to. If this is not specified, log messages will go to stdout, or syslog if CryFS is running in the background.") From 7267bb5be47a9f1849da55a55c61999402f2ed84 Mon Sep 17 00:00:00 2001 From: Sebastian Messmer Date: Sat, 4 Feb 2017 14:21:00 +0000 Subject: [PATCH 2/2] Fix buid on Mac OS X --- src/cpp-utils/system/clock_gettime.h | 4 ++-- src/cryfs/filesystem/fsblobstore/utils/DirEntry.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/cpp-utils/system/clock_gettime.h b/src/cpp-utils/system/clock_gettime.h index 7c7d9765..42ce5775 100644 --- a/src/cpp-utils/system/clock_gettime.h +++ b/src/cpp-utils/system/clock_gettime.h @@ -2,11 +2,11 @@ #ifndef MESSMER_CPPUTILS_SYSTEM_CLOCKGETTIME_H #define MESSMER_CPPUTILS_SYSTEM_CLOCKGETTIME_H -// Implements clock_gettime for Mac OS X (where it is not implemented by in the standard library) +// Implements clock_gettime for Mac OS X before 10.12 (where it is not implemented by in the standard library) // Source: http://stackoverflow.com/a/9781275/829568 // Caution: The returned value is less precise than the returned value from a linux clock_gettime would be. -#ifdef __MACH__ +#if defined(__MACH__) && !defined(CLOCK_REALTIME) #include #define CLOCK_REALTIME 0 inline int clock_gettime(int /*clk_id*/, struct timespec *result) { diff --git a/src/cryfs/filesystem/fsblobstore/utils/DirEntry.h b/src/cryfs/filesystem/fsblobstore/utils/DirEntry.h index 2ff8b617..16a000a1 100644 --- a/src/cryfs/filesystem/fsblobstore/utils/DirEntry.h +++ b/src/cryfs/filesystem/fsblobstore/utils/DirEntry.h @@ -5,6 +5,7 @@ #include #include #include +#include // TODO Implement (and test) atime, noatime, strictatime, relatime mount options