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:
parent
ee29b329fb
commit
0de6aaf2d7
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue