core/crypto/kmac: Early reject pathologically short tags in verify

This commit is contained in:
Yawning Angel
2026-08-05 18:07:32 +09:00
parent 97b38169de
commit a51cdd43bf

View File

@@ -35,6 +35,10 @@ sum :: proc(sec_strength: int, dst, msg, key, domain_sep: []byte) {
// strength, key and domain separator over msg and return true if and only if (⟺) the
// tag is valid.
verify :: proc(sec_strength: int, tag, msg, key, domain_sep: []byte, allocator := context.temp_allocator) -> bool {
if len(tag) < MIN_TAG_SIZE {
return false
}
derived_tag := make([]byte, len(tag), allocator)
defer(delete(derived_tag))