diff --git a/whisper/whisperv6/message_test.go b/whisper/whisperv6/message_test.go index f8e61c31ab..884bc71d76 100644 --- a/whisper/whisperv6/message_test.go +++ b/whisper/whisperv6/message_test.go @@ -465,6 +465,6 @@ func TestAesNonce(t *testing.T) { // This is the most important single test in this package. // If it fails, whisper will not be working. if aesgcm.NonceSize() != aesNonceLength { - t.Fatalf("Nonce size is wrong. This is a critical error. Apparently AES nonce size have changed in the new version of AES GCM package. Whisper will not be working untill this problem is resolved.") + t.Fatalf("Nonce size is wrong. This is a critical error. Apparently AES nonce size have changed in the new version of AES GCM package. Whisper will not be working until this problem is resolved.") } } diff --git a/whisper/whisperv6/whisper.go b/whisper/whisperv6/whisper.go index f7d71f612d..859546c671 100644 --- a/whisper/whisperv6/whisper.go +++ b/whisper/whisperv6/whisper.go @@ -984,7 +984,13 @@ func validatePrivateKey(k *ecdsa.PrivateKey) bool { // validateSymmetricKey returns false if the key contains all zeros, // which is a simplest and the most common bug. func validateRandomData(k []byte, expectedSize int) bool { - return len(k) == expectedSize && !containsOnlyZeros(k) + if len(k) != expectedSize { + return false + } + if expectedSize > 4 && containsOnlyZeros(k) { + return false + } + return true } // containsOnlyZeros checks if the data contain only zeros.