os_ crypto

Some cosmetic and security related changes in os_crypto.
See single commits for details.
Would error checking snprintf be a good thing?