frost_enrollment: add reduced enrollment protocol
This commit is contained in:
1 parent
4690e742ab
commit
49272f1b2f
4 files changed
+459
-22
No files matched your search
@@ -28,6 +28,14 @@ extern "C" {
|
||||
* parameter serialization used here are this module's own, frozen by the
|
||||
* regression vectors in src/modules/frost_enrollment/vectors.h.
|
||||
*
|
||||
* The `reduced_` entry points implement the reduced enrollment RTS of Section
|
||||
* 4.1.3 of the same survey, as discussed in
|
||||
* https://gist.github.com/nickfarrow/64c2e65191cde6a1a47bbd4572bf8cf8.
|
||||
* They are a separately versioned protocol: they bind a session identifier,
|
||||
* use different tagged-hash domains, exchange a triangular rather than a full
|
||||
* share matrix, and require every target-side verification check. The two
|
||||
* protocols must not be mixed within a run.
|
||||
*
|
||||
* Identifiers follow the frost module: participants are identified by uint32
|
||||
* values 0..n-1, and participant id i sits at polynomial x-coordinate i+1.
|
||||
* The party receiving a share is identified by `new_id`, which selects the
|
||||
@@ -400,6 +408,134 @@ SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_enrollment_secsha
|
||||
const secp256k1_pubkey *expected_pubshare
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5);
|
||||
|
||||
/** Compute the version 2 reduced-enrollment parameters hash.
|
||||
*
|
||||
* The hash commits to the reduced-protocol domain, threshold public key,
|
||||
* n_participants, threshold, new_id, the sorted helper set and session_id32.
|
||||
* It is incompatible with secp256k1_frost_enrollment_params_hash by design.
|
||||
*
|
||||
* session_id32 must identify exactly one enrollment or repair request. It
|
||||
* should be generated freshly by the target and authenticated by every helper
|
||||
* as part of its authorization decision. It need not be secret.
|
||||
*
|
||||
* The parameter ranges and output behavior are the same as for
|
||||
* secp256k1_frost_enrollment_params_hash.
|
||||
*/
|
||||
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_enrollment_reduced_params_hash(
|
||||
const secp256k1_context *ctx,
|
||||
unsigned char *out32,
|
||||
const secp256k1_pubkey *thresh_pk,
|
||||
const uint32_t *ids,
|
||||
size_t n_ids,
|
||||
uint32_t new_id,
|
||||
size_t n_participants,
|
||||
uint32_t threshold,
|
||||
const unsigned char *session_id32
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(9);
|
||||
|
||||
/** Round 1.1 of reduced enrollment: generate a helper's triangular share row.
|
||||
*
|
||||
* The weighted share v = lambda_my_id(x_new)*secshare is split using the
|
||||
* Section 4.1.3 triangular matrix. Numerically sorting the helper identifiers
|
||||
* defines the protocol rank, independently of the order of `ids`:
|
||||
*
|
||||
* - for every helper with a larger identifier, the corresponding output
|
||||
* entry is a masking share to send to that helper;
|
||||
* - the entry at my_id's position is the locally retained remainder;
|
||||
* - every entry for a smaller identifier is zero and has no message.
|
||||
*
|
||||
* Thus a run with u helpers sends only u*(u-1)/2 helper-to-helper deltas,
|
||||
* rather than the full protocol's u*(u-1). Arrays remain aligned with `ids`
|
||||
* and shares32_out remains u*32 bytes. Routing is determined by identifiers,
|
||||
* never by testing whether an entry is zero.
|
||||
*
|
||||
* Send every larger-identifier entry with params_hash32_out, my_id and the
|
||||
* recipient identifier over a confidential and authenticated channel. Keep
|
||||
* the entry at my_id's position for reduced_share_agg.
|
||||
*
|
||||
* session_secrand32 must be fresh uniform randomness and is wiped on every
|
||||
* path that enters the function body. All other randomness, validation,
|
||||
* domain-separation and failure-output rules match shares_gen, except that
|
||||
* the reduced tags also bind session_id32.
|
||||
*/
|
||||
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_enrollment_reduced_shares_gen(
|
||||
const secp256k1_context *ctx,
|
||||
unsigned char *shares32_out,
|
||||
unsigned char *params_hash32_out,
|
||||
unsigned char *session_secrand32,
|
||||
const unsigned char *secshare32,
|
||||
const secp256k1_pubkey *thresh_pk,
|
||||
const uint32_t *ids,
|
||||
size_t n_ids,
|
||||
uint32_t my_id,
|
||||
uint32_t new_id,
|
||||
size_t n_participants,
|
||||
uint32_t threshold,
|
||||
const unsigned char *session_id32
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5) SECP256K1_ARG_NONNULL(6) SECP256K1_ARG_NONNULL(7) SECP256K1_ARG_NONNULL(13);
|
||||
|
||||
/** Round 1.2 of reduced enrollment: aggregate one triangular matrix column.
|
||||
*
|
||||
* Helper my_id reads all_shares32 entries from itself and helpers with smaller
|
||||
* identifiers. Entries from larger helpers must be zero: there is no message
|
||||
* in those cells. received_params_hashes32 is read only for helpers with
|
||||
* smaller identifiers; the own slot and all larger-helper slots are ignored
|
||||
* and may be zero. Each read hash is compared with a freshly recomputed hash.
|
||||
*
|
||||
* On success, send sigma32_out, the recomputed parameters hash and my_id to
|
||||
* the target over a confidential and authenticated channel. mismatch_id has
|
||||
* the same meaning as in the full protocol, including attribution for a
|
||||
* nonzero structurally omitted share.
|
||||
*/
|
||||
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_enrollment_reduced_share_agg(
|
||||
const secp256k1_context *ctx,
|
||||
unsigned char *sigma32_out,
|
||||
uint32_t *mismatch_id,
|
||||
const unsigned char *all_shares32,
|
||||
const unsigned char *received_params_hashes32,
|
||||
const secp256k1_pubkey *thresh_pk,
|
||||
const uint32_t *ids,
|
||||
size_t n_ids,
|
||||
uint32_t my_id,
|
||||
uint32_t new_id,
|
||||
size_t n_participants,
|
||||
uint32_t threshold,
|
||||
const unsigned char *session_id32
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5) SECP256K1_ARG_NONNULL(6) SECP256K1_ARG_NONNULL(7) SECP256K1_ARG_NONNULL(13);
|
||||
|
||||
/** Round 2 of reduced enrollment: derive and verify the target secret share.
|
||||
*
|
||||
* received_params_hashes32 is u*32 bytes aligned with `ids`; every entry must
|
||||
* equal the hash recomputed from thresh_pk, the parameter tuple and
|
||||
* session_id32. sigmas32 is the corresponding array of u secret values. The
|
||||
* caller must have established exactly one sigma from every expected helper.
|
||||
*
|
||||
* expected_pubshare is REQUIRED and must come from authenticated group data,
|
||||
* either through secp256k1_frost_enrollment_pubshare_derive or through an
|
||||
* authenticated commitment polynomial. The function succeeds only if the sum
|
||||
* of the sigmas is a nonzero scalar whose public key equals
|
||||
* expected_pubshare. It requires a signing-capable context and wipes
|
||||
* secshare32_out on failure.
|
||||
*
|
||||
* thresh_pk and the data used to derive expected_pubshare MUST be
|
||||
* authenticated independently of the helpers' enrollment messages. Otherwise
|
||||
* colluding helpers can provide a consistent fabricated polynomial.
|
||||
*/
|
||||
SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_frost_enrollment_reduced_secshare_gen(
|
||||
const secp256k1_context *ctx,
|
||||
unsigned char *secshare32_out,
|
||||
const unsigned char *sigmas32,
|
||||
const unsigned char *received_params_hashes32,
|
||||
const secp256k1_pubkey *thresh_pk,
|
||||
const uint32_t *ids,
|
||||
size_t n_ids,
|
||||
uint32_t new_id,
|
||||
size_t n_participants,
|
||||
uint32_t threshold,
|
||||
const unsigned char *session_id32,
|
||||
const secp256k1_pubkey *expected_pubshare
|
||||
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3) SECP256K1_ARG_NONNULL(4) SECP256K1_ARG_NONNULL(5) SECP256K1_ARG_NONNULL(6) SECP256K1_ARG_NONNULL(11) SECP256K1_ARG_NONNULL(12);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user