mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-21 16:56:27 -05:00
allow nil additional data generator
This commit is contained in:
parent
4b990c49bc
commit
981c43afc2
@ -68,7 +68,10 @@ func (v *AEADAuthenticator) Open(dst, cipherText []byte) ([]byte, error) {
|
||||
return nil, newError("invalid AEAD nonce size: ", len(iv))
|
||||
}
|
||||
|
||||
additionalData := v.AdditionalDataGenerator.Next()
|
||||
var additionalData []byte
|
||||
if v.AdditionalDataGenerator != nil {
|
||||
additionalData = v.AdditionalDataGenerator.Next()
|
||||
}
|
||||
return v.AEAD.Open(dst, iv, cipherText, additionalData)
|
||||
}
|
||||
|
||||
@ -78,7 +81,10 @@ func (v *AEADAuthenticator) Seal(dst, plainText []byte) ([]byte, error) {
|
||||
return nil, newError("invalid AEAD nonce size: ", len(iv))
|
||||
}
|
||||
|
||||
additionalData := v.AdditionalDataGenerator.Next()
|
||||
var additionalData []byte
|
||||
if v.AdditionalDataGenerator != nil {
|
||||
additionalData = v.AdditionalDataGenerator.Next()
|
||||
}
|
||||
return v.AEAD.Seal(dst, iv, plainText, additionalData), nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user