Refine must2 and apply NewAesGcm() to all usage

This commit is contained in:
风扇滑翔翼
2025-08-10 11:20:20 +00:00
committed by GitHub
parent 0cceea75da
commit 68ae33c9e5
10 changed files with 22 additions and 70 deletions

View File

@@ -32,9 +32,7 @@ func NewAesCTRStream(key []byte, iv []byte) cipher.Stream {
// NewAesGcm creates a AEAD cipher based on AES-GCM.
func NewAesGcm(key []byte) cipher.AEAD {
block, err := aes.NewCipher(key)
common.Must(err)
aead, err := cipher.NewGCM(block)
common.Must(err)
block := common.Must2(aes.NewCipher(key))
aead := common.Must2(cipher.NewGCM(block))
return aead
}