mirror of
https://gogs.blitter.com/RLabs/xs
synced 2024-08-14 10:26:42 +00:00
Initial aead/chacha20 support (ChaCha20_12)
Signed-off-by: Russ Magee <rmagee@gmail.com>
This commit is contained in:
parent
8de76520e4
commit
e9aa0072a5
18 changed files with 2592 additions and 2 deletions
10
xsnet/net.go
10
xsnet/net.go
|
@ -145,6 +145,8 @@ func (c *CSCipherAlg) String() string {
|
|||
return "C_BLOWFISH_64"
|
||||
case CAlgCryptMT1:
|
||||
return "C_CRYPTMT1"
|
||||
case CAlgChaCha20_12:
|
||||
return "C_CHACHA20_12"
|
||||
default:
|
||||
return "C_ERR_UNK"
|
||||
}
|
||||
|
@ -280,6 +282,8 @@ func _new(kexAlg KEXAlg, conn *net.Conn) (hc *Conn, e error) {
|
|||
hc.kex = KEX_HERRADURA512
|
||||
log.Printf("[KEx alg %d ?? defaults to %d]\n", kexAlg, hc.kex)
|
||||
}
|
||||
|
||||
//hc.logCipherText = true // !!! DEBUGGING ONLY !!! NEVER DEPLOY this uncommented !!!
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -298,7 +302,7 @@ func _new(kexAlg KEXAlg, conn *net.Conn) (hc *Conn, e error) {
|
|||
//
|
||||
// Session (symmetric) crypto
|
||||
//
|
||||
// C_AES_256 C_TWOFISH_128 C_BLOWFISH_128 C_CRYPTMT1
|
||||
// C_AES_256 C_TWOFISH_128 C_BLOWFISH_128 C_CRYPTMT1 C_CHACHA20_12
|
||||
//
|
||||
// Session HMACs
|
||||
//
|
||||
|
@ -322,6 +326,10 @@ func (hc *Conn) applyConnExtensions(extensions ...string) {
|
|||
log.Println("[extension arg = C_CRYPTMT1]")
|
||||
hc.cipheropts &= (0xFFFFFF00)
|
||||
hc.cipheropts |= CAlgCryptMT1
|
||||
case "C_CHACHA20_12":
|
||||
log.Println("[extension arg = C_CHACHA20_12]")
|
||||
hc.cipheropts &= (0xFFFFFF00)
|
||||
hc.cipheropts |= CAlgChaCha20_12
|
||||
case "H_SHA256":
|
||||
log.Println("[extension arg = H_SHA256]")
|
||||
hc.cipheropts &= (0xFFFF00FF)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue