Wade Simmons 1 天之前
父节点
当前提交
fd3fa57e79
共有 1 个文件被更改,包括 2 次插入0 次删除
  1. 2 0
      noiseutil/fips140.go

+ 2 - 0
noiseutil/fips140.go

@@ -37,6 +37,7 @@ func (c cipherFn) CipherName() string             { return c.name }
 // CipherAESGCM is the AES256-GCM AEAD cipher (using aeadAESGCM when fips140 is enabled)
 // CipherAESGCM is the AES256-GCM AEAD cipher (using aeadAESGCM when fips140 is enabled)
 var CipherAESGCM noise.CipherFunc = cipherFn{cipherAESGCM, "AESGCM"}
 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}
 var emptyPrefix = []byte{0, 0, 0, 0}
 
 
 func cipherAESGCM(k [32]byte) noise.Cipher {
 func cipherAESGCM(k [32]byte) noise.Cipher {
@@ -44,6 +45,7 @@ func cipherAESGCM(k [32]byte) noise.Cipher {
 	return aeadCipher{
 	return aeadCipher{
 		gcm,
 		gcm,
 		func(n uint64) []byte {
 		func(n uint64) []byte {
+			// tls.aeadAESGCM uses a 4 byte static prefix and an 8 byte nonce
 			var nonce [8]byte
 			var nonce [8]byte
 			binary.BigEndian.PutUint64(nonce[:], n)
 			binary.BigEndian.PutUint64(nonce[:], n)
 			return nonce[:]
 			return nonce[:]