keys: fix signed overflow