// Copyright 2024 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package hkdf

import (
	
	
)

func [ fips140.Hash]( func() , ,  []byte) []byte {
	if len() < 112/8 {
		fips140.RecordNonApproved()
	}
	if  == nil {
		 = make([]byte, ().Size())
	}
	 := hmac.New(, )
	hmac.MarkAsUsedInKDF()
	.Write()

	return .Sum(nil)
}

func [ fips140.Hash]( func() ,  []byte,  string,  int) []byte {
	 := make([]byte, 0, )
	 := hmac.New(, )
	hmac.MarkAsUsedInKDF()
	var  uint8
	var  []byte

	for len() <  {
		++
		if  == 0 {
			panic("hkdf: counter overflow")
		}
		if  > 1 {
			.Reset()
		}
		.Write()
		.Write([]byte())
		.Write([]byte{})
		 = .Sum([:0])
		 :=  - len()
		 = min(, len())
		 = append(, [:]...)
	}

	return 
}

func [ fips140.Hash]( func() , ,  []byte,  string,  int) []byte {
	 := Extract(, , )
	return Expand(, , , )
}