summaryrefslogtreecommitdiff
path: root/internal/stupidgcm/stupidchacha_test.go
blob: 2690f85e7e3d90b5584c79dd2d6d07b747b000bc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// +build !without_openssl

// We compare against Go's built-in GCM implementation. Since stupidgcm only
// supports 128-bit IVs and Go only supports that from 1.5 onward, we cannot
// run these tests on older Go versions.
package stupidgcm

import (
	"testing"

	"golang.org/x/crypto/chacha20poly1305"
)

func TestStupidChacha20poly1305(t *testing.T) {
	key := randBytes(32)
	c := newChacha20poly1305(key)
	ref, err := chacha20poly1305.New(key)
	if err != nil {
		t.Fatal(err)
	}

	testCiphers(t, c, ref)
}