Add a curve-independent Shamir secret sharing implementation. - #134
Open
tbrezot wants to merge 2 commits into
Open
Add a curve-independent Shamir secret sharing implementation.#134tbrezot wants to merge 2 commits into
tbrezot wants to merge 2 commits into
Conversation
tbrezot
force-pushed
the
tbz/shamir_secret_sharing
branch
from
August 26, 2026 11:34
fd2ab4f to
3abf07d
Compare
This implementation of Shamir secret sharing is based on the generic `Field` trait to perform all operations independently from the concrete scalars in use. This allows instantiating the secret sharing with both the P256 scalars (via the OpenSSL provider), or the Ristretto/Curve25519 scalars (via the Dalek provider). Additionally, guaranteed sized serialization is done through the modification of the `FixedSizeCBytes` trait (which may be renamed?). In order to implement this feature, a rework of the global structure of the library was needed in order to prevent dependency cycles (in which Shamir requires a concrete instantiation provided by a provider in a different crate, which in turns depends on the traits that where hosted in the same crate as Shamir). Previously, the curve providers depended on `traits.rs` which was in `core`, meaning that instantiating Shamir secret sharing from there would create a dependency cycle. *NOTE.1* to avoid most breaking change, all `base` structures are re-exported from `core`, almost recovering the same interface as before. *NOTE.2* the Shamir-secret-sharing implementation is tested based on both P256 and R25519 scalars.
tbrezot
force-pushed
the
tbz/shamir_secret_sharing
branch
from
August 26, 2026 11:37
3abf07d to
875e2c6
Compare
pointche-ens
previously approved these changes
Aug 26, 2026
|
|
||
| /// Splits a freshly generated `SKSeed` into `share_count` shares such that any | ||
| /// `threshold` of them suffice to reconstruct it, using a random polynomial of | ||
| /// degree `threshold - 1` over the P-256 scalar field. `threshold` is the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This implementation of Shamir secret sharing is based on the generic
Fieldtrait to perform all operations independently from the concrete scalars in use.
This allows instantiating the secret sharing with both the P256 scalars (via the
OpenSSL provider), or the Ristretto/Curve25519 scalars (via the Dalek provider).
Additionally, guaranteed sized serialization is done through the modification of
the
FixedSizeCBytestrait (which may be renamed?).In order to implement this feature, a rework of the global structure of the
library was needed in order to prevent dependency cycles (in which Shamir
requires a concrete instantiation provided by a provider in a different crate,
which in turns depends on the traits that where hosted in the same crate as
Shamir).
Previously, the curve providers depended on
traits.rswhich was incore,meaning that instantiating Shamir secret sharing from there would create a
dependency cycle.
NOTE.1 to avoid most breaking change, all
basestructures are re-exportedfrom
core, almost recovering the same interface as before.NOTE.2 the Shamir-secret-sharing implementation is tested based on both P256
and R25519 scalars.
NOTE.3 There are still some breaking changes, e.g. some old traits have been
removed and the key derivation as a method has been removed (it is to be replaced by
the use of some KDF).