github.com/emmansun/gmsm@v0.29.1/sm3/kdf_amd64.go (about)

     1  // Copyright 2024 Sun Yimin. All rights reserved.
     2  // Use of this source code is governed by a MIT-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build !purego
     6  
     7  package sm3
     8  
     9  func kdf(baseMD *digest, keyLen int, limit int) []byte {
    10  	if limit < 4 {
    11  		return kdfGeneric(baseMD, keyLen, limit)
    12  	}
    13  
    14  	if useAVX2 && limit >= 8 {
    15  		return kdfBy8(baseMD, keyLen, limit)
    16  	}
    17  
    18  	return kdfBy4(baseMD, keyLen, limit)
    19  }