Skip to content
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
83 commits
Select commit Hold shift + click to select a range
4485c47
WIP support new Go fips140 module
wadey Mar 31, 2025
3da3d41
log if fips140 in use
wadey Jul 24, 2025
6da314a
WIP
wadey Jul 24, 2025
31cc3a4
Merge remote-tracking branch 'origin/master' into fips140
wadey Jul 24, 2025
f6b206d
cleanup
wadey Jul 25, 2025
0eb92dc
WIP
wadey Jul 25, 2025
fd3fa57
comments
wadey Jul 25, 2025
b418a08
cleanup
wadey Jul 25, 2025
6fa1ecd
Merge remote-tracking branch 'origin/master' into fips140
wadey Jan 30, 2026
2d5d86f
Merge remote-tracking branch 'origin/master' into fips140
wadey Apr 27, 2026
08ee2ab
cleanup
wadey Apr 27, 2026
243cf4a
Revert "cleanup"
wadey Apr 27, 2026
ef8b700
fix mismerge
wadey Apr 27, 2026
e6eeb37
fix smoke tests
wadey Apr 27, 2026
fcfbec4
log the fips140 mode and version
wadey Apr 27, 2026
f9532f4
requires go1.26
wadey Apr 27, 2026
65450f9
need go1.26
wadey Apr 27, 2026
ae58085
cleanup, no GODEBUG needed
wadey Apr 28, 2026
1403473
bump linter to support go1.26
wadey Apr 28, 2026
bdbd483
Revert "bump linter to support go1.26"
wadey Apr 28, 2026
4ff9e97
Revert "need go1.26"
wadey Apr 28, 2026
d4d747f
no longer need go1.26 with this fix
wadey Apr 28, 2026
b79fdc2
better default
wadey Apr 28, 2026
5dd566e
also support fips140v1.26
wadey Apr 30, 2026
7f6976b
Merge remote-tracking branch 'origin/master' into fips140
wadey May 1, 2026
441a67f
fix missing space
wadey May 1, 2026
a1b8954
update Makefile
wadey May 1, 2026
b5ad62a
Merge remote-tracking branch 'origin/master' into fips140
wadey Jun 1, 2026
8671a4e
cleanup
wadey Jun 1, 2026
0897f49
default GODEBUG=fips140=only
wadey Jun 1, 2026
c3e2a2b
better smoke
wadey Jun 1, 2026
cfcdcb0
use go1.26
wadey Jun 1, 2026
dd081ff
cleanup
wadey Jun 1, 2026
f1a8054
latest golanglint-ci
wadey Jun 1, 2026
c73245c
fix missing import
wadey Jun 1, 2026
7c8a70b
fix smoke boringcrypto and fips140
wadey Jun 1, 2026
1d17c78
fixup tests
wadey Jun 1, 2026
56a09b7
fix
wadey Jun 1, 2026
cf5d73d
better check
wadey Jun 1, 2026
adb01f6
make the test match the code
wadey Jun 1, 2026
c7e0354
enforce GODEBUG=fips140=only
wadey Jun 2, 2026
37b752b
WIP
wadey Jun 8, 2026
90ea634
WIP
wadey Jun 8, 2026
7cd3875
fix expected for fips140
wadey Jun 8, 2026
06fb503
WIP
wadey Jun 9, 2026
d725e53
makefile cleanup
wadey Jun 9, 2026
f437c7d
more cleanup
wadey Jun 9, 2026
32db819
cleanup
wadey Jun 9, 2026
9709893
use testing log
wadey Jun 9, 2026
69a6db7
cleanup unused test
wadey Jun 9, 2026
cb9547b
remove commented out code
wadey Jun 9, 2026
3b30526
boringcrypto cleanup
wadey Jun 9, 2026
a383937
make the build tag clearer
wadey Jun 9, 2026
69c6132
fix the tag
wadey Jun 9, 2026
060b46f
better names
wadey Jun 9, 2026
67da623
cleanup enforcement
wadey Jun 9, 2026
7d087a6
add all fips140 platforms
wadey Jun 9, 2026
92bd785
no mips64le
wadey Jun 9, 2026
2efdcb0
fips140-all
wadey Jun 10, 2026
ac5a18e
use fips140-all in CI tests
wadey Jun 10, 2026
d42407c
dont need race detector on these extra smoke runs
wadey Jun 10, 2026
81afed4
Merge remote-tracking branch 'origin/master' into fips140
wadey Jun 18, 2026
90c7630
extract the internal FIPS GCM implementation
wadey Jul 8, 2026
14c9288
Ensure Curve25519 and ChaChaPoly are not used in fips140 enforced mode
wadey Jul 8, 2026
6675f5a
use go:debug to enable fips140=only
wadey Jul 8, 2026
4e8733c
run all smoke tests with -race
wadey Jul 8, 2026
3c1dd52
update README
wadey Jul 8, 2026
3264ebf
cleanup
wadey Jul 8, 2026
048fa3f
Merge remote-tracking branch 'origin/master' into fips140
wadey Jul 20, 2026
6be3d22
cleanup nonce
wadey Jul 20, 2026
e16a31f
return err instead of panic
wadey Jul 23, 2026
8d8cc4f
note that boringcrypto is deprecated
wadey Jul 23, 2026
009d42b
Merge remote-tracking branch 'origin/master' into fips140
wadey Jul 23, 2026
e832250
fix fips140-all
wadey Jul 24, 2026
0d91e3e
update PHONY
wadey Jul 24, 2026
fc950cf
one var for default fips version
wadey Jul 24, 2026
69e5e8e
cleanup
wadey Jul 24, 2026
00b498f
self-test the reflect code at init
wadey Jul 24, 2026
0e1f534
test fips140.Enforced mode
wadey Jul 24, 2026
738b4fa
cleanup
wadey Jul 24, 2026
7c00c74
complain earlier if in FIPS-140 enforced mode
wadey Jul 29, 2026
bf2f26b
clean up empty line
wadey Jul 29, 2026
a5cb635
use P256 as the default curve for fips140 mode
wadey Jul 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,12 @@ jobs:
working-directory: ./.github/workflows/smoke
run: NAME="smoke-p256" ./smoke.sh

- name: setup docker image for fips140
working-directory: ./.github/workflows/smoke
run: NAME="smoke-fips140" CURVE=P256 GOFIPS140=v1.0.0 LDFLAGS=-checklinkname=0 ./build.sh

- name: run smoke-fips140
working-directory: ./.github/workflows/smoke
run: NAME="smoke-fips140" ./smoke.sh

timeout-minutes: 10
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,27 @@ jobs:
- name: End 2 end
run: make e2e GOEXPERIMENT=boringcrypto CGO_ENABLED=1 TEST_ENV="TEST_LOGS=1" TEST_FLAGS="-v -ldflags -checklinkname=0"

test-linux-fips140:
name: Build and test on linux with fips140=on
runs-on: ubuntu-latest
steps:

- uses: actions/checkout@v6

- uses: actions/setup-go@v6
with:
go-version: '1.25'
check-latest: true

- name: Build
run: make fips140

- name: Test
run: make fips140 test

- name: End 2 end
run: make fips140 e2evv

test-linux-pkcs11:
name: Build and test on linux with pkcs11
runs-on: ubuntu-latest
Expand Down
34 changes: 22 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ bin-pkcs11: CGO_ENABLED = 1
bin-pkcs11: bin

bin:
go build $(BUILD_ARGS) -ldflags "$(LDFLAGS)" -o ./nebula${NEBULA_CMD_SUFFIX} ${NEBULA_CMD_PATH}
go build $(BUILD_ARGS) -ldflags "$(LDFLAGS)" -o ./nebula-cert${NEBULA_CMD_SUFFIX} ./cmd/nebula-cert
$(GOENV) go build $(BUILD_ARGS) -ldflags "$(LDFLAGS)" -o ./nebula${NEBULA_CMD_SUFFIX} ${NEBULA_CMD_PATH}
$(GOENV) go build $(BUILD_ARGS) -ldflags "$(LDFLAGS)" -o ./nebula-cert${NEBULA_CMD_SUFFIX} ./cmd/nebula-cert

install:
go install $(BUILD_ARGS) -ldflags "$(LDFLAGS)" ${NEBULA_CMD_PATH}
go install $(BUILD_ARGS) -ldflags "$(LDFLAGS)" ./cmd/nebula-cert
$(GOENV) go install $(BUILD_ARGS) -ldflags "$(LDFLAGS)" ${NEBULA_CMD_PATH}
$(GOENV) go install $(BUILD_ARGS) -ldflags "$(LDFLAGS)" ./cmd/nebula-cert

build/linux-arm-%: GOENV += GOARM=$(word 3, $(subst -, ,$*))
build/linux-mips-%: GOENV += GOMIPS=$(word 3, $(subst -, ,$*))
Expand Down Expand Up @@ -169,7 +169,7 @@ vet:
go vet $(VET_FLAGS) -v ./...

test:
go test -v ./...
$(TEST_ENV) go test $(TEST_FLAGS) -v ./...

test-boringcrypto:
GOEXPERIMENT=boringcrypto CGO_ENABLED=1 go test -ldflags "-checklinkname=0" -v ./...
Expand Down Expand Up @@ -215,17 +215,27 @@ ifeq ($(words $(MAKECMDGOALS)),1)
@$(MAKE) service ${.DEFAULT_GOAL} --no-print-directory
endif

fips140:

@nbrownus nbrownus Apr 29, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boringcrypto outputs with a suffix on the folder like: build/linux-amd64-boringcrypto/nebula

fips140 outputs to a colliding path with non fips140: build/linux-amd64/nebula, seems like a good idea to push this into build/linux-amd64-fips140/nebula.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch! let me rework this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added release-fips140 and bin-fips140 for this

@echo > $(NULL_FILE)
$(eval GOENV += GOFIPS140=v1.0.0)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will also need to require go 1.26 and include this LDFLAGS: -X runtime.godebugDefault=fips140=only

Otherwise fips is enabled but all non fips crypto just keeps working. Will need to couple this with a change to assert fips140.Enforced() is true.

@wadey wadey Jun 1, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added the default, but not enforcing and instead just logging the state of it. Considering the check.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented with a build tag fips140enforce

$(eval LDFLAGS += -checklinkname=0)
$(eval TEST_FLAGS += -ldflags -checklinkname=0)
$(eval TEST_ENV += $(GOENV))
ifeq ($(words $(MAKECMDGOALS)),1)
@$(MAKE) fips140 ${.DEFAULT_GOAL} --no-print-directory
endif

bin-docker: bin build/linux-amd64/nebula build/linux-amd64/nebula-cert

smoke-docker: bin-docker
cd .github/workflows/smoke/ && ./build.sh
cd .github/workflows/smoke/ && ./smoke.sh
cd .github/workflows/smoke/ && NAME="smoke-p256" CURVE="P256" ./build.sh
cd .github/workflows/smoke/ && NAME="smoke-p256" ./smoke.sh
cd .github/workflows/smoke/ && $(GOENV) ./build.sh
cd .github/workflows/smoke/ && $(GOENV)./smoke.sh

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a space after $(GOENV)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, fixed

cd .github/workflows/smoke/ && $(GOENV) NAME="smoke-p256" CURVE="P256" ./build.sh
cd .github/workflows/smoke/ && $(GOENV) NAME="smoke-p256" ./smoke.sh

smoke-relay-docker: bin-docker
cd .github/workflows/smoke/ && ./build-relay.sh
cd .github/workflows/smoke/ && ./smoke-relay.sh
cd .github/workflows/smoke/ && $(GOENV) ./build-relay.sh
cd .github/workflows/smoke/ && $(GOENV) ./smoke-relay.sh

smoke-docker-race: BUILD_ARGS = -race
smoke-docker-race: CGO_ENABLED = 1
Expand All @@ -236,5 +246,5 @@ smoke-vagrant/%: bin-docker build/%/nebula
cd .github/workflows/smoke/ && ./smoke-vagrant.sh $*

.FORCE:
.PHONY: bench bench-cpu bench-cpu-long bin build-test-mobile e2e e2ev e2evv e2evvv e2evvvv proto release service smoke-docker smoke-docker-race test test-cov-html smoke-vagrant/%
.PHONY: bench bench-cpu bench-cpu-long bin build-test-mobile e2e e2ev e2evv e2evvv e2evvvv fips140 proto release service smoke-docker smoke-docker-race test test-cov-html smoke-vagrant/%
.DEFAULT_GOAL := bin
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,17 +145,25 @@ To build nebula for a specific platform (ex, Windows):

See the [Makefile](Makefile) for more details on build targets

## Curve P256 and BoringCrypto
## Curve P256, BoringCrypto and FIPS 140-3 mode

The default curve used for cryptographic handshakes and signatures is Curve25519. This is the recommended setting for most users. If your deployment has certain compliance requirements, you have the option of creating your CA using `nebula-cert ca -curve P256` to use NIST Curve P256. The CA will then sign certificates using ECDSA P256, and any hosts using these certificates will use P256 for ECDH handshakes.

In addition, Nebula can be built using the [BoringCrypto GOEXPERIMENT](https://github.com/golang/go/blob/go1.20/src/crypto/internal/boring/README.md) by running either of the following make targets:
Nebula can be built using the [BoringCrypto GOEXPERIMENT](https://github.com/golang/go/blob/go1.20/src/crypto/internal/boring/README.md) by running either of the following make targets:

```sh
make bin-boringcrypto
make release-boringcrypto
```

Nebula can also be built to support the [FIPS 140-3](https://go.dev/doc/security/fips140) mode of Go by running either of the following make targets. (This sets GOFIPS140=v1.0.0,
which must be done at compile time so that the correct AES-GCM can be used for FIPS 140-3 enforcement mode).

```sh
make fips140
make fips140 release
```

This is not the recommended default deployment, but may be useful based on your compliance requirements.

## Credits
Expand Down
7 changes: 6 additions & 1 deletion boring.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,9 @@ package nebula

import "crypto/boring"

var boringEnabled = boring.Enabled
func getFIPS140() string {
if boring.Enabled() {
return "boringcrypto"
}
return "off"
}
2 changes: 1 addition & 1 deletion interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (f *Interface) activate() error {
"networks", f.myVpnNetworks,
"build", f.version,
"udpAddr", addr,
"boringcrypto", boringEnabled(),
"fips140", getFIPS140(),
)

if f.routines > 1 {
Expand Down
55 changes: 35 additions & 20 deletions noise.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ func NewNebulaCipherState(s *noise.CipherState) *NebulaCipherState {
return &NebulaCipherState{c: x.(cipher.AEAD)}
}

type cipherAEADDanger interface {
EncryptDanger(out, ad, plaintext []byte, n uint64, nb []byte) ([]byte, error)
DecryptDanger(out, ad, plaintext []byte, n uint64, nb []byte) ([]byte, error)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plaintext -> ciphertext

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im confused, when you call this function it is still plaintext

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

err nm lol I see

}

// EncryptDanger encrypts and authenticates a given payload.
//
// out is a destination slice to hold the output of the EncryptDanger operation.
Expand All @@ -33,33 +38,43 @@ func NewNebulaCipherState(s *noise.CipherState) *NebulaCipherState {
// be re-used by callers to minimize garbage collection.
func (s *NebulaCipherState) EncryptDanger(out, ad, plaintext []byte, n uint64, nb []byte) ([]byte, error) {
if s != nil {
// TODO: Is this okay now that we have made messageCounter atomic?
// Alternative may be to split the counter space into ranges
//if n <= s.n {
// return nil, errors.New("CRITICAL: a duplicate counter value was used")
//}
//s.n = n
nb[0] = 0
nb[1] = 0
nb[2] = 0
nb[3] = 0
noiseEndianness.PutUint64(nb[4:], n)
out = s.c.Seal(out, nb, plaintext, ad)
//l.Debugf("Encryption: outlen: %d, nonce: %d, ad: %s, plainlen %d", len(out), n, ad, len(plaintext))
return out, nil
switch ce := s.c.(type) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be awesome to swap out the interface and avoid the type check for each packet.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in latest commit

case cipherAEADDanger:
return ce.EncryptDanger(out, ad, plaintext, n, nb)
default:
// TODO: Is this okay now that we have made messageCounter atomic?
// Alternative may be to split the counter space into ranges
//if n <= s.n {
// return nil, errors.New("CRITICAL: a duplicate counter value was used")
//}
//s.n = n
nb[0] = 0
nb[1] = 0
nb[2] = 0
nb[3] = 0
noiseEndianness.PutUint64(nb[4:], n)
out = s.c.Seal(out, nb, plaintext, ad)
//l.Debugf("Encryption: outlen: %d, nonce: %d, ad: %s, plainlen %d", len(out), n, ad, len(plaintext))
return out, nil
}
} else {
return nil, errors.New("no cipher state available to encrypt")
}
}

func (s *NebulaCipherState) DecryptDanger(out, ad, ciphertext []byte, n uint64, nb []byte) ([]byte, error) {
if s != nil {
nb[0] = 0
nb[1] = 0
nb[2] = 0
nb[3] = 0
noiseEndianness.PutUint64(nb[4:], n)
return s.c.Open(out, nb, ciphertext, ad)
switch ce := s.c.(type) {
case cipherAEADDanger:
return ce.DecryptDanger(out, ad, ciphertext, n, nb)
default:
nb[0] = 0
nb[1] = 0
nb[2] = 0
nb[3] = 0
noiseEndianness.PutUint64(nb[4:], n)
return s.c.Open(out, nb, ciphertext, ad)
}
} else {
return []byte{}, nil
}
Expand Down
78 changes: 78 additions & 0 deletions noiseutil/fips140.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
//go:build fips140v1.0
// +build fips140v1.0

package noiseutil

import (
"crypto/cipher"
"encoding/binary"

// unsafe needed for go:linkname
_ "unsafe"

"github.com/flynn/noise"
)

// EncryptLockNeeded indicates if calls to Encrypt need a lock
// This is true for fips140 because the Seal function verifies that the
// nonce is strictly increasing.
const EncryptLockNeeded = true

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The other part of -X runtime.godebugDefault=fips140=only is that we will want an init check to assert fips140.Enforced() here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Implemented with a build tag fips140enforce.


// TODO: Use NewGCMWithCounterNonce once available:
// - https://github.com/golang/go/issues/73110
// Using tls.aeadAESGCM gives us the TLS 1.2 GCM, which also verifies
// that the nonce is strictly increasing.
//
//go:linkname aeadAESGCM crypto/tls.aeadAESGCM
func aeadAESGCM(key, noncePrefix []byte) cipher.AEAD

type cipherFn struct {
fn func([32]byte) noise.Cipher
name string
}

func (c cipherFn) Cipher(k [32]byte) noise.Cipher { return c.fn(k) }
func (c cipherFn) CipherName() string { return c.name }

// CipherAESGCM is the AES256-GCM AEAD cipher (using aeadAESGCM when fips140 is enabled)
var CipherAESGCM noise.CipherFunc = cipherFn{cipherAESGCM, "AESGCM"}

// tls.aeadAESGCM uses a 4 byte static prefix and an 8 byte nonce
var emptyPrefix = []byte{0, 0, 0, 0}

func cipherAESGCM(k [32]byte) noise.Cipher {
gcm := aeadAESGCM(k[:], emptyPrefix)
return aeadCipher{
gcm,
func(n uint64) []byte {
// tls.aeadAESGCM uses a 4 byte static prefix and an 8 byte nonce
var nonce [8]byte
binary.BigEndian.PutUint64(nonce[:], n)
return nonce[:]
},
}
}

type aeadCipher struct {
cipher.AEAD
nonce func(uint64) []byte
}

func (c aeadCipher) Encrypt(out []byte, n uint64, ad, plaintext []byte) []byte {
return c.Seal(out, c.nonce(n), plaintext, ad)
}

func (c aeadCipher) Decrypt(out []byte, n uint64, ad, ciphertext []byte) ([]byte, error) {
return c.Open(out, c.nonce(n), ciphertext, ad)
}

func (c aeadCipher) EncryptDanger(out, ad, plaintext []byte, n uint64, nb []byte) ([]byte, error) {
binary.BigEndian.PutUint64(nb[4:], n)
out = c.Seal(out, nb[4:], plaintext, ad)
return out, nil
}

func (c aeadCipher) DecryptDanger(out, ad, ciphertext []byte, n uint64, nb []byte) ([]byte, error) {
binary.BigEndian.PutUint64(nb[4:], n)
return c.Open(out, nb[4:], ciphertext, ad)
}
42 changes: 42 additions & 0 deletions noiseutil/fips140_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
//go:build fips140v1.0
// +build fips140v1.0

package noiseutil

import (
"crypto/fips140"
"encoding/hex"
"log"
"testing"

"github.com/stretchr/testify/assert"
)

func TestEncryptLockNeeded(t *testing.T) {
assert.True(t, EncryptLockNeeded)
}

// Ensure NewAESGCM validates the nonce is non-repeating
func TestNewAESGCM(t *testing.T) {
assert.True(t, fips140.Enabled())

key, _ := hex.DecodeString("feffe9928665731c6d6a8f9467308308feffe9928665731c6d6a8f9467308308")
iv, _ := hex.DecodeString("00000000facedbaddecaf888")
plaintext, _ := hex.DecodeString("d9313225f88406e5a55909c5aff5269a86a7a9531534f7da2e4c303d8a318a721c3c0c95956809532fcf0e2449a6b525b16aedf5aa0de657ba637b39")
aad, _ := hex.DecodeString("feedfacedeadbeeffeedfacedeadbeefabaddad2")
expected, _ := hex.DecodeString("72ce2ea385f88c20d856e9d1248c2ca08562bbe8a61459ffae06ec393540518e9b6b4c40a146053f26a3df83c5384a48d273148b15aba64d970107432b2892741359275676441c1572c3fa9e")

var keyArray [32]byte
copy(keyArray[:], key)
c := CipherAESGCM.Cipher(keyArray)
aead := c.(aeadCipher).AEAD

dst := aead.Seal([]byte{}, iv, plaintext, aad)
log.Printf("%x", dst)
assert.Equal(t, expected, dst)

// We expect this to fail since we are re-encrypting with a repeat IV
assert.PanicsWithValue(t, "crypto/cipher: counter decreased", func() {
dst = aead.Seal([]byte{}, iv, plaintext, aad)
})
}
4 changes: 2 additions & 2 deletions noiseutil/notboring.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !boringcrypto
// +build !boringcrypto
//go:build !boringcrypto && !fips140v1.0
// +build !boringcrypto,!fips140v1.0

package noiseutil

Expand Down
4 changes: 2 additions & 2 deletions noiseutil/notboring_test.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//go:build !boringcrypto
// +build !boringcrypto
//go:build !boringcrypto && !fips140v1.0
// +build !boringcrypto,!fips140v1.0

package noiseutil

Expand Down
Loading
Loading