Implement more Botan support.

git-svn-id: http://encfs.googlecode.com/svn/trunk@99 db9cf616-1c43-0410-9cb8-a902689de0d6
This commit is contained in:
Valient Gough
2013-06-17 03:11:46 +00:00
parent 95750d4539
commit bd182db260
9 changed files with 268 additions and 35 deletions

View File

@ -297,6 +297,8 @@ bool CipherV1::initCiphers(const Interface &iface, const Interface &realIface,
else
_keySize = keyRange.closest(keyLength) / 8;
LOG_IF(ERROR, _keySize == 0) << "invalid key size";
_pbkdf.reset(PBKDF::GetRegistry().CreateForMatch(
NAME_PBKDF2_HMAC_SHA1));
if (!_pbkdf) {
@ -405,6 +407,9 @@ bool CipherV1::pseudoRandomize( byte *buf, int len )
bool CipherV1::setKey(const CipherKey &keyIv) {
Lock l(_hmacMutex);
LOG_IF(ERROR, _keySize != keyIv.size()) << "Mismatched key size: passed "
<< keyIv.size() << ", expecting " << _keySize;
// Key is actually key plus iv, so extract the different parts.
CipherKey key(_keySize);
memcpy(key.data(), keyIv.data(), _keySize);