mirror of
https://github.com/cbeuw/Cloak.git
synced 2024-11-15 18:13:29 +00:00
Force aead key sizes as 32 bytes due to chacha20-poly1305
This commit is contained in:
parent
581c2332d1
commit
acb999ee64
@ -117,7 +117,6 @@ func GenerateObfs(encryptionMethod byte, sessionKey []byte) (obfuscator *Obfusca
|
|||||||
err = errors.New("sessionKey size must be 32 bytes")
|
err = errors.New("sessionKey size must be 32 bytes")
|
||||||
}
|
}
|
||||||
|
|
||||||
blockKey := sessionKey[:16]
|
|
||||||
var salsaKey [32]byte
|
var salsaKey [32]byte
|
||||||
copy(salsaKey[:], sessionKey)
|
copy(salsaKey[:], sessionKey)
|
||||||
|
|
||||||
@ -127,7 +126,7 @@ func GenerateObfs(encryptionMethod byte, sessionKey []byte) (obfuscator *Obfusca
|
|||||||
payloadCipher = nil
|
payloadCipher = nil
|
||||||
case 0x01:
|
case 0x01:
|
||||||
var c cipher.Block
|
var c cipher.Block
|
||||||
c, err = aes.NewCipher(blockKey)
|
c, err = aes.NewCipher(sessionKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -136,7 +135,7 @@ func GenerateObfs(encryptionMethod byte, sessionKey []byte) (obfuscator *Obfusca
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
case 0x02:
|
case 0x02:
|
||||||
payloadCipher, err = chacha20poly1305.New(blockKey)
|
payloadCipher, err = chacha20poly1305.New(sessionKey)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user