Fix buffered aead tcp

This commit is contained in:
世界 2022-06-18 10:21:45 +08:00
parent 85de9615c7
commit a4a11dea4c
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -118,15 +118,15 @@ type clientConn struct {
func (c *clientConn) writeRequest(payload []byte) error {
_salt := buf.StackNewSize(c.keySaltLength)
defer common.KeepAlive(_salt)
salt := common.Dup(_salt)
defer salt.Release()
salt.WriteRandom(c.keySaltLength)
_key := buf.StackNewSize(c.keySaltLength)
key := common.Dup(_key)
Kdf(c.key, salt.Bytes(), key)
salt.Release()
common.KeepAlive(_salt)
writeCipher, err := c.constructor(key.Bytes())
key.Release()
common.KeepAlive(_key)