helper/kdf: changing argument name for clarity
This commit is contained in:
parent
bd347e0430
commit
81f39fbc16
|
@ -20,7 +20,7 @@ type PRF func([]byte, []byte) ([]byte, error)
|
||||||
// CounterMode implements the counter mode KDF that uses a psuedo-random-function (PRF)
|
// CounterMode implements the counter mode KDF that uses a psuedo-random-function (PRF)
|
||||||
// along with a counter to generate derived keys. The KDF takes a base key
|
// along with a counter to generate derived keys. The KDF takes a base key
|
||||||
// a derivation context, and the requried number of output bits.
|
// a derivation context, and the requried number of output bits.
|
||||||
func CounterMode(prf PRF, prfLen uint32, base []byte, context []byte, bits uint32) ([]byte, error) {
|
func CounterMode(prf PRF, prfLen uint32, key []byte, context []byte, bits uint32) ([]byte, error) {
|
||||||
// Ensure the PRF is byte aligned
|
// Ensure the PRF is byte aligned
|
||||||
if prfLen%8 != 0 {
|
if prfLen%8 != 0 {
|
||||||
return nil, fmt.Errorf("PRF must be byte aligned")
|
return nil, fmt.Errorf("PRF must be byte aligned")
|
||||||
|
@ -50,7 +50,7 @@ func CounterMode(prf PRF, prfLen uint32, base []byte, context []byte, bits uint3
|
||||||
binary.BigEndian.PutUint32(input[:4], i)
|
binary.BigEndian.PutUint32(input[:4], i)
|
||||||
|
|
||||||
// Compute a more key material
|
// Compute a more key material
|
||||||
part, err := prf(base, input)
|
part, err := prf(key, input)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue