libcryfs/interface/helpers/BlockStoreWithRandomKeys.cpp

21 lines
417 B
C++
Raw Normal View History

#include "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) {
2015-04-09 20:07:03 +02:00
Key key = Key::CreateRandom();
return create(key, size);
2014-12-09 17:19:59 +01:00
}