[keys] Add mode-dependent keys support.
[test] Fix test-keys to consider only non-headers.
Merge branch 'mode-in-fsm' into develop