mirror of https://gogs.blitter.com/RLabs/xs
[nonworking] Groestl hash addition
This commit is contained in:
parent
02e379e50d
commit
56f62709ad
3
go.mod
3
go.mod
|
@ -2,6 +2,8 @@ module blitter.com/go/xs
|
|||
|
||||
go 1.12
|
||||
|
||||
replace groestl => ../groestl
|
||||
|
||||
require (
|
||||
blitter.com/go/cryptmt v1.0.2
|
||||
blitter.com/go/goutmp v1.0.5
|
||||
|
@ -28,4 +30,5 @@ require (
|
|||
gopkg.in/hlandau/easymetric.v1 v1.0.0 // indirect
|
||||
gopkg.in/hlandau/measurable.v1 v1.0.1 // indirect
|
||||
gopkg.in/hlandau/passlib.v1 v1.0.10
|
||||
groestl v0.0.0-00010101000000-000000000000
|
||||
)
|
||||
|
|
3
xs/xs.go
3
xs/xs.go
|
@ -719,7 +719,8 @@ func main() {
|
|||
C_CHACHA20_12`)
|
||||
flag.StringVar(&hmacAlg, "m", "H_SHA256", "session `HMAC`"+`
|
||||
H_SHA256
|
||||
H_SHA512`)
|
||||
H_SHA512
|
||||
H_GROESTL256`)
|
||||
flag.StringVar(&kexAlg, "k", "KEX_HERRADURA512", "KEx `alg`"+`
|
||||
KEX_HERRADURA256
|
||||
KEX_HERRADURA512
|
||||
|
|
|
@ -553,7 +553,8 @@ func main() {
|
|||
flag.Var(&aHMACAlgs, "aH", "Allowed `HMAC`s (eg. '-aH HMACAlgA -aH HMACAlgB ...')" + `
|
||||
H_all
|
||||
H_SHA256
|
||||
H_SHA512`)
|
||||
H_SHA512
|
||||
H_GROESTL256`)
|
||||
|
||||
flag.Parse()
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ import (
|
|||
// on this...)
|
||||
_ "crypto/sha256"
|
||||
_ "crypto/sha512"
|
||||
groestl "groestl/pkg/groestl"
|
||||
)
|
||||
|
||||
// Expand keymat, if necessary, to a minimum of 2x(blocksize).
|
||||
|
@ -144,6 +145,9 @@ func (hc *Conn) getStream(keymat []byte) (rc cipher.Stream, mc hash.Hash, err er
|
|||
if !halg.Available() {
|
||||
log.Fatal("hash not available!")
|
||||
}
|
||||
case HmacGroestl256:
|
||||
log.Printf("[hash HmacGroestl256 (%d)]\n", hopts)
|
||||
mc = groestl.New256()
|
||||
default:
|
||||
log.Printf("[invalid hmac (%d)]\n", hopts)
|
||||
fmt.Printf("DOOFUS SET A VALID HMAC ALG (%d)\n", hopts)
|
||||
|
|
|
@ -118,6 +118,7 @@ type CSCipherAlg uint32
|
|||
const (
|
||||
HmacSHA256 = iota
|
||||
HmacSHA512
|
||||
HmacGroestl256
|
||||
HmacNoneDisallowed
|
||||
)
|
||||
|
||||
|
|
|
@ -174,6 +174,8 @@ func (h *CSHmacAlg) String() string {
|
|||
return "H_SHA256"
|
||||
case HmacSHA512:
|
||||
return "H_SHA512"
|
||||
case HmacGroestl256:
|
||||
return "H_GROESTL256"
|
||||
default:
|
||||
return "H_ERR_UNK"
|
||||
}
|
||||
|
@ -362,6 +364,10 @@ func (hc *Conn) applyConnExtensions(extensions ...string) {
|
|||
log.Println("[extension arg = H_SHA512]")
|
||||
hc.cipheropts &= (0xFFFF00FF)
|
||||
hc.cipheropts |= (HmacSHA512 << 8)
|
||||
case "H_GROESTL256":
|
||||
log.Println("[extension arg = H_GROESTL256]")
|
||||
hc.cipheropts &= (0xFFFF00FF)
|
||||
hc.cipheropts |= (HmacGroestl256 << 8)
|
||||
//default:
|
||||
// log.Printf("[Dial ext \"%s\" ignored]\n", s)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue