4963e78e0 tests/kms: correct index validation logic