|
CCF
|
Classes | |
| struct | Share |
Typedefs | |
| using | element = uint64_t |
Functions | |
| element | ct_reduce (element x) |
| void | sample_secret_and_shares (Share &raw_secret, const std::span< Share > &shares, size_t threshold) |
| void | recover_unauthenticated_secret (Share &raw_secret, const std::span< Share const > &shares, size_t threshold) |
Variables | |
| constexpr size_t | SHIFT_OFFSET = 31 |
| constexpr element | prime |
| typedef uint64_t ccf::crypto::sharing::element |
| void ccf::crypto::sharing::recover_unauthenticated_secret | ( | Share & | raw_secret, |
| const std::span< Share const > & | shares, | ||
| size_t | threshold | ||
| ) |
Using shares, recover secret, without authentication.
| [out] | raw_secret | Recovered secret value. |
| [in] | shares | Shares of raw_secret. |
| threshold | Number of shares necessary to recover the secret. |
Note that shares passed in excess of the threshold are ignored, and that recovery does not authenticate the shares or the threshold.
| std::invalid_argument | if the number of shares is insufficient, or if two shares have the same x coordinate. |
| void ccf::crypto::sharing::sample_secret_and_shares | ( | Share & | raw_secret, |
| const std::span< Share > & | shares, | ||
| size_t | threshold | ||
| ) |
Sample a secret into raw_secret, and split it into shares. Enforces 1 < threshold <= number of shares.
| [out] | raw_secret | Sampled secret value. |
| [out] | shares | Shares of raw_secret. Note that the size of the span determines the number of shares. |
| [in] | threshold | Number of shares necessary to recover the secret. |
The secret is guaranteed to contain at least 256 bits of entropy. Note that is it not safe to use the secret as a key directly, and that a round of key derivation is necessary (Share::key()).
|
constexpr |
|
constexpr |