AMD tag over GF(2¹²⁸) (share format qs2) #
Before splitting, the secret s (L bytes) is extended to
E = s ‖ x ‖ t (L + 32 bytes)
xis a random GF(2¹²⁸) element (16 bytes, from the OS random number generator).t = x^(D+2) + s₁·x + s₂·x² + ⋯ + s_d·x^d, wheres₁ … s_dare the 16-byte blocks ofs(the last one padded with zeros for the computation only), andD = chooseD d.
E is split byte by byte like any secret. After combining, decode recomputes the tag and
refuses if it does not match. This is an algebraic manipulation detection (AMD) code
(Cramer, Dodis, Fehr, Padró, Wichs, EUROCRYPT 2008). Whatever shares are combined, the rebuilt
bytes are a·E + β (each byte times the same a, plus an offset), where a has one term per
honest share and (a, β) does not depend on x. The proof in proofs/ shows that, for a ≠ 0,
such a change passes the check for at most D + 2 of the 2¹²⁸ keys x, unless it changes
nothing. D is odd and gcd(D + 1, 255) = 1; the second condition handles a ≠ 1.
a ≠ 0 holds when only one given share is honest, and a = 1 when the forgers know or use at
most k − 1 indices. Forgers with k − 1 shares and two honest shares present can make
a = 0, which no tag can catch
(README: Forged shares).
The secret length L is not stored: it is the payload length minus 32.