mirror of https://gogs.blitter.com/RLabs/xs
Update default-if-unspecified kex to HERRADURA1024
This commit is contained in:
parent
a929fdc211
commit
7e4d68e607
33
xsnet/net.go
33
xsnet/net.go
|
@ -261,16 +261,6 @@ func (hc *Conn) SetOpts(opts uint32) {
|
|||
//
|
||||
// Note this is internal: use Dial() or Accept()
|
||||
func _new(kexAlg KEXAlg, conn *net.Conn) (hc *Conn, e error) {
|
||||
// Set up stuff common to all KEx/KEM types
|
||||
hc = &Conn{kex: kexAlg,
|
||||
m: &sync.Mutex{},
|
||||
c: conn,
|
||||
closeStat: new(CSOType),
|
||||
WinCh: make(chan WinSize, 1),
|
||||
dBuf: new(bytes.Buffer)}
|
||||
tempMap := make(map[uint16]*TunEndpoint)
|
||||
hc.tuns = &tempMap
|
||||
|
||||
// Set up KEx/KEM-specifics
|
||||
switch kexAlg {
|
||||
case KEX_HERRADURA256:
|
||||
|
@ -298,14 +288,25 @@ func _new(kexAlg KEXAlg, conn *net.Conn) (hc *Conn, e error) {
|
|||
case KEX_FRODOKEM_976AES:
|
||||
fallthrough
|
||||
case KEX_FRODOKEM_976SHAKE:
|
||||
//log.Printf("[KEx alg %d is valid]\n", kexAlg)
|
||||
log.Printf("[KEx alg %d specified]\n", kexAlg)
|
||||
default:
|
||||
// UNREACHABLE: _getkexalgnum() guarantees a valid KEX value
|
||||
hc.kex = KEX_HERRADURA512
|
||||
log.Printf("[KEx alg %d ?? defaults to %d]\n", kexAlg, hc.kex)
|
||||
// UNREACHABLE(?): _getkexalgnum() SHOULD guarantee a valid KEX value
|
||||
log.Printf("[KEx alg %d ?? - REPORT A BUG IF YOU SEE THIS]", kexAlg)
|
||||
kexAlg = KEX_HERRADURA1024
|
||||
log.Printf(" defaulting to %d]\n", kexAlg)
|
||||
}
|
||||
|
||||
//hc.logCipherText = true // !!! DEBUGGING ONLY !!! NEVER DEPLOY this uncommented !!!
|
||||
|
||||
hc = &Conn{kex: kexAlg,
|
||||
m: &sync.Mutex{},
|
||||
c: conn,
|
||||
closeStat: new(CSOType),
|
||||
WinCh: make(chan WinSize, 1),
|
||||
dBuf: new(bytes.Buffer)}
|
||||
tempMap := make(map[uint16]*TunEndpoint)
|
||||
hc.tuns = &tempMap
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -378,7 +379,6 @@ func (hc *Conn) applyConnExtensions(extensions ...string) {
|
|||
}
|
||||
|
||||
func getkexalgnum(extensions ...string) (k KEXAlg) {
|
||||
k = KEX_HERRADURA512 // default
|
||||
for _, s := range extensions {
|
||||
switch s {
|
||||
case "KEX_HERRADURA256":
|
||||
|
@ -420,6 +420,9 @@ func getkexalgnum(extensions ...string) (k KEXAlg) {
|
|||
case "KEX_FRODOKEM_976SHAKE":
|
||||
k = KEX_FRODOKEM_976SHAKE
|
||||
break //out of for
|
||||
default:
|
||||
k = KEX_HERRADURA1024 // default
|
||||
//fmt.Printf("[INFO: defaulting to %s\n", k.String())
|
||||
}
|
||||
}
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue