core/crypto/pbkdf2: Ensure non-zero iteration count

This commit is contained in:
Yawning Angel
2026-08-05 17:31:31 +09:00
parent e8e12a24b5
commit 6e682a768e

View File

@@ -19,6 +19,8 @@ derive :: proc(
iterations: u32,
dst: []byte,
) {
ensure(iterations > 0, "crypto/pbkdf2: non-zero iterations required")
h_len := hash.DIGEST_SIZES[hmac_hash]
// 1. If dkLen > (2^32 - 1) * hLen, output "derived key too long"