Skip to content

Commit ef61e91

Browse files
committed
take mod with order
1 parent 35ba8f6 commit ef61e91

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

shlib/shcrypto/encryption_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ func makeKeys(t *testing.T) (*EonPublicKey, *EpochSecretKey, *EpochID) {
219219
eonSecretKey := big.NewInt(0)
220220
for i := 0; i < n; i++ {
221221
eonSecretKey.Add(eonSecretKey, ps[i].Eval(big.NewInt(0)))
222+
eonSecretKey.Mod(eonSecretKey, order)
222223

223224
ss := []*big.Int{}
224225
for j := 0; j < n; j++ {

shlib/shcrypto/keys_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,9 @@ func TestEonPublicKeyMatchesSecretKey(t *testing.T) {
165165
esk := big.NewInt(0)
166166
for _, p := range []*Polynomial{p1, p2, p3} {
167167
esk = esk.Add(esk, p.Eval(big.NewInt(0)))
168+
esk = esk.Mod(esk, order) // Ensure esk stays within the field modulus
168169
}
170+
169171
epkExp := generateP2(esk)
170172

171173
gammas := []*Gammas{p1.Gammas(), p2.Gammas(), p3.Gammas()}

0 commit comments

Comments
 (0)