Clean more
This commit is contained in:
parent
8b30278ce6
commit
355e9bd619
7 changed files with 52 additions and 65 deletions
32
cookie.go
32
cookie.go
|
|
@ -48,19 +48,19 @@ func (st *CookieChecker) Init(pk NoisePublicKey) {
|
|||
// mac1 state
|
||||
|
||||
func() {
|
||||
hsh, _ := blake2s.New256(nil)
|
||||
hsh.Write([]byte(WGLabelMAC1))
|
||||
hsh.Write(pk[:])
|
||||
hsh.Sum(st.mac1.key[:0])
|
||||
hash, _ := blake2s.New256(nil)
|
||||
hash.Write([]byte(WGLabelMAC1))
|
||||
hash.Write(pk[:])
|
||||
hash.Sum(st.mac1.key[:0])
|
||||
}()
|
||||
|
||||
// mac2 state
|
||||
|
||||
func() {
|
||||
hsh, _ := blake2s.New256(nil)
|
||||
hsh.Write([]byte(WGLabelCookie))
|
||||
hsh.Write(pk[:])
|
||||
hsh.Sum(st.mac2.encryptionKey[:0])
|
||||
hash, _ := blake2s.New256(nil)
|
||||
hash.Write([]byte(WGLabelCookie))
|
||||
hash.Write(pk[:])
|
||||
hash.Sum(st.mac2.encryptionKey[:0])
|
||||
}()
|
||||
|
||||
st.mac2.secretSet = time.Time{}
|
||||
|
|
@ -181,17 +181,17 @@ func (st *CookieGenerator) Init(pk NoisePublicKey) {
|
|||
defer st.mutex.Unlock()
|
||||
|
||||
func() {
|
||||
hsh, _ := blake2s.New256(nil)
|
||||
hsh.Write([]byte(WGLabelMAC1))
|
||||
hsh.Write(pk[:])
|
||||
hsh.Sum(st.mac1.key[:0])
|
||||
hash, _ := blake2s.New256(nil)
|
||||
hash.Write([]byte(WGLabelMAC1))
|
||||
hash.Write(pk[:])
|
||||
hash.Sum(st.mac1.key[:0])
|
||||
}()
|
||||
|
||||
func() {
|
||||
hsh, _ := blake2s.New256(nil)
|
||||
hsh.Write([]byte(WGLabelCookie))
|
||||
hsh.Write(pk[:])
|
||||
hsh.Sum(st.mac2.encryptionKey[:0])
|
||||
hash, _ := blake2s.New256(nil)
|
||||
hash.Write([]byte(WGLabelCookie))
|
||||
hash.Write(pk[:])
|
||||
hash.Sum(st.mac2.encryptionKey[:0])
|
||||
}()
|
||||
|
||||
st.mac2.cookieSet = time.Time{}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue