mirror of https://gogs.blitter.com/RLabs/xs
				
				
				
			Addition of WHIRLPOOL hash
This commit is contained in:
		
							parent
							
								
									952279a108
								
							
						
					
					
						commit
						91bb0778b2
					
				
							
								
								
									
										1
									
								
								go.mod
								
								
								
								
							
							
						
						
									
										1
									
								
								go.mod
								
								
								
								
							|  | @ -23,6 +23,7 @@ require ( | |||
| require ( | ||||
| 	blitter.com/go/chacha20 v0.0.0-20200130200441-214e4085f54c // indirect | ||||
| 	blitter.com/go/mtwist v1.0.1 // indirect | ||||
| 	github.com/jzelinskie/whirlpool v0.0.0-20201016144138-0675e54bb004 // indirect | ||||
| 	github.com/klauspost/cpuid/v2 v2.2.6 // indirect | ||||
| 	github.com/klauspost/reedsolomon v1.12.1 // indirect | ||||
| 	github.com/pkg/errors v0.9.1 // indirect | ||||
|  |  | |||
							
								
								
									
										2
									
								
								go.sum
								
								
								
								
							
							
						
						
									
										2
									
								
								go.sum
								
								
								
								
							|  | @ -45,6 +45,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw | |||
| github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= | ||||
| github.com/jameskeane/bcrypt v0.0.0-20120420032655-c3cd44c1e20f h1:UWGE8Vi+1Agt0lrvnd7UsmvwqWKRzb9byK9iQmsbY0Y= | ||||
| github.com/jameskeane/bcrypt v0.0.0-20120420032655-c3cd44c1e20f/go.mod h1:u+9Snq0w+ZdYKi8BBoaxnEwWu0fY4Kvu9ByFpM51t1s= | ||||
| github.com/jzelinskie/whirlpool v0.0.0-20201016144138-0675e54bb004 h1:G+9t9cEtnC9jFiTxyptEKuNIAbiN5ZCQzX2a74lj3xg= | ||||
| github.com/jzelinskie/whirlpool v0.0.0-20201016144138-0675e54bb004/go.mod h1:KmHnJWQrgEvbuy0vcvj00gtMqbvNn1L+3YUZLK/B92c= | ||||
| github.com/klauspost/cpuid/v2 v2.2.6 h1:ndNyv040zDGIDh8thGkXYjnFtiN02M1PVVF+JE/48xc= | ||||
| github.com/klauspost/cpuid/v2 v2.2.6/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= | ||||
| github.com/klauspost/reedsolomon v1.12.1 h1:NhWgum1efX1x58daOBGCFWcxtEhOhXKKl1HAPQUp03Q= | ||||
|  |  | |||
							
								
								
									
										3
									
								
								xs/xs.go
								
								
								
								
							
							
						
						
									
										3
									
								
								xs/xs.go
								
								
								
								
							|  | @ -733,7 +733,8 @@ func main() { //nolint: funlen, gocyclo | |||
|       C_CHACHA20_12`) | ||||
| 	flag.StringVar(&hmacAlg, "m", "H_SHA256", "session `HMAC`"+` | ||||
|       H_SHA256 | ||||
|       H_SHA512`) | ||||
|       H_SHA512 | ||||
|       H_WHIRLPOOL`) | ||||
| 	flag.StringVar(&kexAlg, "k", "KEX_HERRADURA512", "KEx `alg`"+` | ||||
|       KEX_HERRADURA256 | ||||
|       KEX_HERRADURA512 | ||||
|  |  | |||
|  | @ -572,7 +572,8 @@ func main() { //nolint:funlen,gocyclo | |||
| 	flag.Var(&aHMACAlgs, "aH", "Allowed `HMAC`s (eg. '-aH HMACAlgA -aH HMACAlgB ...')"+` | ||||
|       H_all | ||||
|       H_SHA256 | ||||
|       H_SHA512`) | ||||
|       H_SHA512 | ||||
|       H_WHIRLPOOL`) | ||||
| 
 | ||||
| 	flag.StringVar(&cpuprofile, "cpuprofile", "", "write cpu profile to <`file`>") | ||||
| 	flag.StringVar(&memprofile, "memprofile", "", "write memory profile to <`file`>") | ||||
|  |  | |||
|  | @ -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…
	
		Reference in New Issue