Changed x509parse_crt_der() to support adding to chain.

Removed chain functionality from x509parse_crt() as x509parse_crt_der()
now handles that much cleaner.
x509parse_crtpath() is now reentrant and uses more portable stat()

Moved from readdir() to readdir_r() and use stat instead of the less
portable d_type from struct dirent.