blob: aacacd0bcc41f67dc5f8aabe53a611876e638eb5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
/*
* (C) 2009 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/
#include "tests.h"
#if defined(BOTAN_HAS_THRESHOLD_SECRET_SHARING)
#include <botan/tss.h>
#include <botan/hex.h>
#endif
namespace Botan_Tests {
namespace {
#if defined(BOTAN_HAS_THRESHOLD_SECRET_SHARING)
class TSS_Tests : public Test
{
public:
std::vector<Test::Result> run() override
{
std::vector<Test::Result> results;
Test::Result result("TSS");
uint8_t id[16];
for(int i = 0; i != 16; ++i)
id[i] = i;
const std::vector<uint8_t> S = Botan::hex_decode("7465737400");
std::vector<Botan::RTSS_Share> shares =
Botan::RTSS_Share::split(2, 4, S.data(), S.size(), id, Test::rng());
result.test_eq("reconstruction", Botan::RTSS_Share::reconstruct(shares), S);
shares.resize(shares.size()-1);
result.test_eq("reconstruction after removal", Botan::RTSS_Share::reconstruct(shares), S);
results.push_back(result);
return results;
}
};
BOTAN_REGISTER_TEST("tss", TSS_Tests);
#endif // BOTAN_HAS_THRESHOLD_SECRET_SHARING
}
}
|