Skip to content

Commit f5d58a7

Browse files
committed
use function
1 parent dcc600e commit f5d58a7

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

cng/hkdf.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
package cng
88

99
import (
10-
"encoding/binary"
1110
"errors"
1211
"hash"
1312
"runtime"
@@ -83,7 +82,7 @@ func ExtractHKDF(h func() hash.Hash, secret, salt []byte) ([]byte, error) {
8382
if len(blob) < 4 {
8483
return nil, errors.New("cng: exported key is corrupted")
8584
}
86-
cbHashName := binary.BigEndian.Uint32(blob)
85+
cbHashName := bigEndianUint32(blob)
8786
blob = blob[4:]
8887
if len(blob) < int(cbHashName) {
8988
return nil, errors.New("cng: exported key is corrupted")
@@ -123,7 +122,7 @@ func ExpandHKDF(h func() hash.Hash, pseudorandomKey, info []byte, keyLength int)
123122
return out, err
124123
}
125124

126-
func bigUint32(b []byte) uint32 {
125+
func bigEndianUint32(b []byte) uint32 {
127126
_ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
128127
return uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24
129128
}

0 commit comments

Comments
 (0)