mirror of
https://github.com/XTLS/Xray-core.git
synced 2024-11-22 08:31:28 +00:00
Co-authored-by: NaLan ZeYu <nalanzeyu@gmail.com>
This commit is contained in:
parent
aa846b8420
commit
d3efd2d24f
|
@ -2,8 +2,8 @@ package crypto
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/cipher"
|
"crypto/cipher"
|
||||||
|
"crypto/rand"
|
||||||
"io"
|
"io"
|
||||||
"math/rand"
|
|
||||||
|
|
||||||
"github.com/xtls/xray-core/common"
|
"github.com/xtls/xray-core/common"
|
||||||
"github.com/xtls/xray-core/common/buf"
|
"github.com/xtls/xray-core/common/buf"
|
||||||
|
@ -265,7 +265,8 @@ func (w *AuthenticationWriter) seal(b []byte) (*buf.Buffer, error) {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if paddingSize > 0 {
|
if paddingSize > 0 {
|
||||||
// With size of the chunk and padding length encrypted, the content of padding doesn't matter much.
|
// These paddings will send in clear text.
|
||||||
|
// To avoid leakage of PRNG internal state, a cryptographically secure PRNG should be used.
|
||||||
paddingBytes := eb.Extend(paddingSize)
|
paddingBytes := eb.Extend(paddingSize)
|
||||||
common.Must2(rand.Read(paddingBytes))
|
common.Must2(rand.Read(paddingBytes))
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue