libcryfs/interface/helpers/BlockStoreWithRandomKeys.cpp

21 lines
457 B
C++
Raw Normal View History

2015-02-17 00:23:33 +01:00
#include <messmer/blockstore/interface/helpers/BlockStoreWithRandomKeys.h>
2014-12-09 17:19:59 +01:00
using namespace blockstore;
using std::string;
using std::unique_ptr;
2014-12-09 17:19:59 +01:00
unique_ptr<Block> BlockStoreWithRandomKeys::create(size_t size) {
auto result = tryCreate(size);
while (!result) {
result = tryCreate(size);
}
return result;
2014-12-09 17:19:59 +01:00
}
unique_ptr<Block> BlockStoreWithRandomKeys::tryCreate(size_t size) {
Key key = Key::CreateRandomKey();
return create(key, size);
2014-12-09 17:19:59 +01:00
}