Don't exclude 0 from the set of valid polynomials in Shamir. This leads to a potential (although extremely trivial) amount of information leakage.

This commit is contained in:
Jeff Mitchell 2016-11-17 12:57:36 -05:00
parent ee29b329fb
commit 0de6aaf2d7
1 changed files with 4 additions and 6 deletions

View File

@ -29,13 +29,11 @@ func makePolynomial(intercept, degree uint8) (polynomial, error) {
// Ensure the intercept is set
p.coefficients[0] = intercept
// Assign random co-efficients to the polynomial, ensuring
// the highest order co-efficient is non-zero
for p.coefficients[degree] == 0 {
if _, err := rand.Read(p.coefficients[1:]); err != nil {
return p, err
}
// Assign random co-efficients to the polynomial
if _, err := rand.Read(p.coefficients[1:]); err != nil {
return p, err
}
return p, nil
}