From fe2cb136a4e36f16fb2f773628ae45e753baa0e1 Mon Sep 17 00:00:00 2001 From: Valient Gough Date: Tue, 18 Jun 2013 05:54:58 +0000 Subject: [PATCH] add KDF duration prompt in expert config mode, fixes #168 git-svn-id: http://encfs.googlecode.com/svn/trunk@105 db9cf616-1c43-0410-9cb8-a902689de0d6 --- fs/FileUtils.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/fs/FileUtils.cpp b/fs/FileUtils.cpp index cfb0ee2..9b5bd8d 100644 --- a/fs/FileUtils.cpp +++ b/fs/FileUtils.cpp @@ -668,6 +668,18 @@ Interface selectNameCoding(const CipherV1::CipherAlgorithm &alg) } } +static int selectKDFDuration() { + cout << autosprintf(_("Select desired KDF duration in milliseconds.\n" + "The default is 500 (half a second): ")); + + char answer[10]; + char *res = fgets( answer, sizeof(answer), stdin ); + int duration = (res == 0 ? 0 : atoi( answer )); + cout << "\n"; + + return duration; +} + static int selectKeySize( const CipherV1::CipherAlgorithm &alg ) { @@ -1028,6 +1040,7 @@ RootPtr createConfig( EncFS_Context *ctx, selectBlockMAC(&blockMACBytes, &blockMACRandBytes); allowHoles = selectZeroBlockPassThrough(); } + desiredKDFDuration = selectKDFDuration(); } shared_ptr cipher = CipherV1::New( alg.iface, keySize );