Initial aead/chacha20 support (ChaCha20_12)

Signed-off-by: Russ Magee <rmagee@gmail.com>
This commit is contained in:
Russ Magee 2020-02-21 17:21:19 -08:00
parent 8de76520e4
commit e9aa0072a5
18 changed files with 2592 additions and 2 deletions

View file

@ -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)