1
2
3
4
5 package fipstest
6
7 import (
8 "crypto/internal/cryptotest"
9 . "crypto/internal/fips140/edwards25519"
10 "testing"
11 )
12
13 var testAllocationsSink byte
14
15 func TestEdwards25519Allocations(t *testing.T) {
16 cryptotest.SkipTestAllocations(t)
17 if allocs := testing.AllocsPerRun(100, func() {
18 p := NewIdentityPoint()
19 p.Add(p, NewGeneratorPoint())
20 s := NewScalar()
21 testAllocationsSink ^= s.Bytes()[0]
22 testAllocationsSink ^= p.Bytes()[0]
23 }); allocs > 0 {
24 t.Errorf("expected zero allocations, got %0.1v", allocs)
25 }
26 }
27
View as plain text