Skip to content

Commit

Permalink
Add comments on entropy check
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Schwartz committed Aug 27, 2020
1 parent 62e89ea commit 777815a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions shadowsocks/cipher_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,11 @@ type CipherEntry struct {
func MakeCipherEntry(id string, cipher shadowaead.Cipher, secret string) CipherEntry {
var saltGenerator ServerSaltGenerator
if cipher.SaltSize()-ServerSaltMarkLen >= minSaltEntropy {
// Mark salts with a tag for reverse replay protection.
saltGenerator = NewServerSaltGenerator(secret)
} else {
// Adding a tag would leave too little randomness to protect
// against accidental salt reuse, so don't mark the salts.
saltGenerator = RandomSaltGenerator
}
return CipherEntry{
Expand Down

0 comments on commit 777815a

Please sign in to comment.