begin adding Botan support.

implement pbkdf-hmac-sha256 module for Botan and CommonCrypto.


git-svn-id: http://encfs.googlecode.com/svn/trunk@98 db9cf616-1c43-0410-9cb8-a902689de0d6
This commit is contained in:
Valient Gough
2013-03-06 08:02:23 +00:00
parent 63c2d1c539
commit 95750d4539
16 changed files with 422 additions and 75 deletions

View File

@ -21,12 +21,18 @@
#ifndef _MemoryPool_incl_
#define _MemoryPool_incl_
#include "base/config.h"
#include "base/types.h"
#ifdef WITH_BOTAN
#include <botan/secmem.h>
#endif
namespace encfs {
/*
Memory Pool for fixed sized objects.
Use SecureMem if storing sensitive information.
Usage:
MemBlock mb;
@ -55,13 +61,37 @@ inline MemBlock::MemBlock()
class SecureMem
{
public:
int size;
byte *data;
byte* data() const;
int size() const;
explicit SecureMem(int len);
~SecureMem();
private:
#ifdef WITH_BOTAN
Botan::SecureVector<Botan::byte> data_;
#else
byte *data_;
int size_;
#endif
};
#ifdef WITH_BOTAN
inline byte* SecureMem::data() const {
return const_cast<byte*>(data_.begin());
}
inline int SecureMem::size() const {
return data_.size();
}
#else
inline byte* SecureMem::data() const {
return data_;
}
inline int SecureMem::size() const {
return size_;
}
#endif
bool operator == (const SecureMem &a, const SecureMem &b);
} // namespace encfs