mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-02 15:36:41 -05:00
fix build break
This commit is contained in:
parent
47c3646162
commit
ce34a25e66
@ -2,9 +2,9 @@ package encoding
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/md5"
|
"crypto/md5"
|
||||||
|
"errors"
|
||||||
"hash/fnv"
|
"hash/fnv"
|
||||||
|
|
||||||
"v2ray.com/core/common/crypto"
|
|
||||||
"v2ray.com/core/common/serial"
|
"v2ray.com/core/common/serial"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ func (v *FnvAuthenticator) Seal(dst, nonce, plaintext, additionalData []byte) []
|
|||||||
// Open implements AEAD.Open().
|
// Open implements AEAD.Open().
|
||||||
func (v *FnvAuthenticator) Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) {
|
func (v *FnvAuthenticator) Open(dst, nonce, ciphertext, additionalData []byte) ([]byte, error) {
|
||||||
if serial.BytesToUint32(ciphertext[:4]) != Authenticate(ciphertext[4:]) {
|
if serial.BytesToUint32(ciphertext[:4]) != Authenticate(ciphertext[4:]) {
|
||||||
return dst, crypto.ErrAuthenticationFailed
|
return dst, errors.New("VMess|FNV: Invalid authentication.")
|
||||||
}
|
}
|
||||||
return append(dst, ciphertext[4:]...), nil
|
return append(dst, ciphertext[4:]...), nil
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,9 @@ package kcp
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/cipher"
|
"crypto/cipher"
|
||||||
|
"errors"
|
||||||
"hash/fnv"
|
"hash/fnv"
|
||||||
|
|
||||||
"v2ray.com/core/common/crypto"
|
|
||||||
"v2ray.com/core/common/serial"
|
"v2ray.com/core/common/serial"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -64,12 +64,12 @@ func (v *SimpleAuthenticator) Open(dst, nonce, cipherText, extra []byte) ([]byte
|
|||||||
fnvHash := fnv.New32a()
|
fnvHash := fnv.New32a()
|
||||||
fnvHash.Write(dst[4:])
|
fnvHash.Write(dst[4:])
|
||||||
if serial.BytesToUint32(dst[:4]) != fnvHash.Sum32() {
|
if serial.BytesToUint32(dst[:4]) != fnvHash.Sum32() {
|
||||||
return nil, crypto.ErrAuthenticationFailed
|
return nil, errors.New("KCP:SimpleAuthenticator: Invalid auth.")
|
||||||
}
|
}
|
||||||
|
|
||||||
length := serial.BytesToUint16(dst[4:6])
|
length := serial.BytesToUint16(dst[4:6])
|
||||||
if len(dst)-6 != int(length) {
|
if len(dst)-6 != int(length) {
|
||||||
return nil, crypto.ErrAuthenticationFailed
|
return nil, errors.New("KCP:SimpleAuthenticator: Invalid auth.")
|
||||||
}
|
}
|
||||||
|
|
||||||
return dst[6:], nil
|
return dst[6:], nil
|
||||||
|
Loading…
Reference in New Issue
Block a user