The error handling code currently has a couple of issues:
* It relies on ordered lists and upstream not changing any constants.
* Converted messages are not stored in constant memory which means
that log_strdup is needed whenever they are printed.
This change also factors out error handling to a separate file,
lw_priv.{c,h}, to facilitate reuse in a future secure element and
state storage implementation.
Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>