xs/hkexnet/consts.go

62 lines
1.7 KiB
Go
Raw Normal View History

// consts.go - consts for hkexnet
// Copyright (c) 2017-2018 Russell Magee
// Licensed under the terms of the MIT license (see LICENSE.mit in this
// distribution)
//
// golang implementation by Russ Magee (rmagee_at_gmail.com)
package hkexnet
const (
KEX_HERRADURA = iota // this MUST be first for default if omitted in ctor
2018-10-09 04:31:11 +00:00
KEX_KYBER768
//KEX_DH
//KEX_ETC
)
2018-10-09 04:31:11 +00:00
2018-09-18 06:07:04 +00:00
// Sent from client to server in order to specify which
// algo shall be used (eg., HerraduraKEx, [TODO: others...])
type KEXAlg uint8
const (
CSENone = 32 + iota
CSEBadAuth // Failed login password
CSETruncCSO // No CSOExitStatus in payload
CSEStillOpen // Channel closed unexpectedly
CSEExecFail // cmd.Start() (exec) failed
CSEPtyExecFail // pty.Start() (exec w/pty) failed
)
2018-09-18 06:07:04 +00:00
// Extended (>255 UNIX exit status) codes
// This indicate channel-related or internal errors
type CSExtendedCode uint32
const (
CSONone = iota // No error, normal packet
CSOHmacInvalid // HMAC mismatch detected on remote end
CSOTermSize // set term size (rows:cols)
CSOExitStatus // Remote cmd exit status
CSOChaff // Dummy packet, do not pass beyond decryption
)
2018-09-18 06:07:04 +00:00
// Channel status type
type CSOType uint32
2018-10-09 04:31:11 +00:00
//TODO: this should be small (max unfragmented packet size?)
const MAX_PAYLOAD_LEN = 4*1024*1024*1024 - 1
2018-09-18 06:07:04 +00:00
const (
CAlgAES256 = iota
CAlgTwofish128 // golang.org/x/crypto/twofish
CAlgBlowfish64 // golang.org/x/crypto/blowfish
CAlgNoneDisallowed
)
// Available ciphers for hkex.Conn
type CSCipherAlg uint32
const (
HmacSHA256 = iota
2018-09-30 07:19:25 +00:00
HmacSHA512
2018-09-18 06:07:04 +00:00
HmacNoneDisallowed
)
// Available HMACs for hkex.Conn (TODO: not currently used)
type CSHmacAlg uint32