Since in all cases that LoadCertFromCertDb is called
is always twice, one for sysnand and another for emunand
just make it a single call and quit early when cert found.
At least in the caller perspective.
Also break down some functionalities into separate funcs,
interally calling them on cert.c to avoid too many checks.
And tried to avoid too much repeated code.