mirror of
https://gogs.blitter.com/RLabs/xs
synced 2024-08-14 10:26:42 +00:00
Merge branch 'whirlpool-hash' of RLabs/xs into master
This commit is contained in:
commit
ec9b4fe2f4
7 changed files with 18 additions and 3 deletions
|
@ -26,7 +26,7 @@ import (
|
|||
"github.com/aead/chacha20/chacha"
|
||||
"golang.org/x/crypto/blowfish"
|
||||
"golang.org/x/crypto/twofish"
|
||||
|
||||
whirlpool "github.com/jzelinskie/whirlpool"
|
||||
// hash algos must be manually imported thusly:
|
||||
// (Would be nice if the golang pkg docs were more clear
|
||||
// on this...)
|
||||
|
@ -157,6 +157,9 @@ func (hc *Conn) getStream(keymat []byte) (rc cipher.Stream, mc hash.Hash, err er
|
|||
if !halg.Available() {
|
||||
log.Fatal("hash not available!")
|
||||
}
|
||||
case HmacWHIRLPOOL:
|
||||
log.Printf("[hash HmacWHIRLPOOL (%d)]\n", hopts)
|
||||
mc = whirlpool.New()
|
||||
default:
|
||||
log.Printf("[invalid hmac (%d)]\n", hopts)
|
||||
fmt.Printf("DOOFUS SET A VALID HMAC ALG (%d)\n", hopts)
|
||||
|
|
|
@ -119,6 +119,7 @@ type CSCipherAlg uint32
|
|||
const (
|
||||
HmacSHA256 = iota
|
||||
HmacSHA512
|
||||
HmacWHIRLPOOL
|
||||
HmacNoneDisallowed
|
||||
)
|
||||
|
||||
|
|
|
@ -177,6 +177,8 @@ func (h *CSHmacAlg) String() string {
|
|||
return "H_SHA256"
|
||||
case HmacSHA512:
|
||||
return "H_SHA512"
|
||||
case HmacWHIRLPOOL:
|
||||
return "H_WHIRLPOOL"
|
||||
default:
|
||||
return "H_ERR_UNK"
|
||||
}
|
||||
|
@ -363,6 +365,10 @@ func (hc *Conn) applyConnExtensions(extensions ...string) {
|
|||
log.Println("[extension arg = H_SHA512]")
|
||||
hc.cipheropts &= (0xFFFF00FF)
|
||||
hc.cipheropts |= (HmacSHA512 << 8)
|
||||
case "H_WHIRLPOOL":
|
||||
log.Println("[extension arg = H_WHIRLPOOL]")
|
||||
hc.cipheropts &= (0xFFFF00FF)
|
||||
hc.cipheropts |= (HmacWHIRLPOOL << 8)
|
||||
case "OPT_REMOD":
|
||||
log.Println("[extension arg = OPT_REMOD]")
|
||||
hc.opts |= CORemodulateShields
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue