KEYGEN: add const modifiers where possible