mirror of
https://github.com/lightningnetwork/lnd.git
synced 2024-11-20 10:39:01 +01:00
0b4e03f5fc
With go 1.17 a change to the build flags was implemented: https://go.googlesource.com/proposal/+/master/design/draft-gobuild.md The formatter now automatically adds the forward-compatible build tag format and the linter checks for them, so we need to include them in our code.
29 lines
667 B
Go
29 lines
667 B
Go
//go:build gofuzz
|
|
// +build gofuzz
|
|
|
|
package brontidefuzz
|
|
|
|
import (
|
|
"bytes"
|
|
)
|
|
|
|
// Fuzz_random_init_decrypt is a go-fuzz harness that decrypts arbitrary data
|
|
// with the initiator.
|
|
func Fuzz_random_init_decrypt(data []byte) int {
|
|
// This will return brontide machines with random keys.
|
|
initiator, responder := getBrontideMachines()
|
|
|
|
// Complete the brontide handshake.
|
|
completeHandshake(initiator, responder)
|
|
|
|
// Create a reader with the byte array.
|
|
r := bytes.NewReader(data)
|
|
|
|
// Decrypt the encrypted message using ReadMessage w/ initiator machine.
|
|
if _, err := initiator.ReadMessage(r); err == nil {
|
|
nilAndPanic(initiator, responder, nil)
|
|
}
|
|
|
|
return 1
|
|
}
|