mirror of
https://github.com/emmansun/gmsm.git
synced 2025-04-26 04:06:18 +08:00
kdf-sm3: fix buffer length issue
This commit is contained in:
parent
dc23026764
commit
53cd7522a0
@ -28,9 +28,11 @@ func copyResult(result []byte, dig *[8]uint32) {
|
|||||||
binary.BigEndian.PutUint32(result[28:], dig[7])
|
binary.BigEndian.PutUint32(result[28:], dig[7])
|
||||||
}
|
}
|
||||||
|
|
||||||
// state || words
|
// p || state || words
|
||||||
// 1216 = 68 * 4 * 4 + 8 * 4 * 4 = 76 * 16
|
// p = 64 * 4 * 2 = 512
|
||||||
const preallocSize = 1216
|
// state = 8 * 16 = 128
|
||||||
|
// words = 68 * 16 = 1088
|
||||||
|
const preallocSize = 1728
|
||||||
|
|
||||||
func kdfBy4(baseMD *digest, keyLen int, limit int) []byte {
|
func kdfBy4(baseMD *digest, keyLen int, limit int) []byte {
|
||||||
if limit < 4 {
|
if limit < 4 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user