ERR_PRINT_ERRORS(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

🌸 ERR_PRINT_ERRORS(3) β€” like, the OpenSSL error-spiller, bestie πŸ’…

okay so real talk: this is a page from the Library Functions Manual, and it's all about libcrypto (yes, the OpenSSL crypto library, she's iconic) and her three little helpers that print out OpenSSL error messages. πŸŽ€


✨ NAME ✨

ERR_print_errors, ERR_print_errors_fp, ERR_print_errors_cb β€” print OpenSSL error messages πŸ—£οΈπŸ’¬


πŸ¦‹ SYNOPSIS πŸ¦‹

first things first, you gotta pull in the header, and ngl she lives in libcrypto:

#include <openssl/err.h>

void
ERR_print_errors(BIO *bp);

void
ERR_print_errors_fp(FILE *fp);

void
ERR_print_errors_cb(int (*cb)(const char *str, size_t len, void *u),
    void *u);

πŸ’– DESCRIPTION πŸ’–

so ERR_print_errors() is your convenience function, your little bestie who does the heavy lifting 🫢 β€” she prints the error strings for all the errors that OpenSSL has recorded over to bp, and the way that she does it empties the error queue. like, she reads the whole queue and then it's gone. periodt. πŸ’€

ERR_print_errors_fp() is literally the same thing, except the output goes to a FILE. same energy, different destination. πŸ“

ERR_print_errors_cb() is also the same, except it calls your callback function cb for each error line, passing the string, the length, and the userdata u as the callback parameters. so you get to be the main character and decide what happens to every single line. πŸ‘‘


πŸŽ€ the error string format πŸŽ€

each error string looks exactly like this, no cap:

[pid]:error:[error code]:[library name]:[function name]:[reason string]:[file name]:[line]:[optional text message]

quick breakdown, because iykyk:

  • the [error code] is an 8-digit hexadecimal number πŸ”’
  • the [library name], the [function name], and the [reason string] are all ASCII text
  • the [optional text message] is also ASCII text, if one was set for the respective error code
  • and okay, important caveat bestie πŸ™ˆ β€” if there's no text string registered for the given error code, the error string will just contain the numeric code instead. she's giving "no thoughts, just digits." πŸ’…

🌈 SEE ALSO 🌈

go read these next, they're all linked and they all slay:


⭐ HISTORY ⭐

a lil origin story, because she's been around forever 🧚:

  • ERR_print_errors() first appeared in SSLeay 0.4.5 β€” ancient. vintage. iconic.
  • ERR_print_errors_fp() first appeared in SSLeay 0.6.0
  • both of those two have been available since OpenBSD 2.4 πŸ¦‹
  • ERR_print_errors_cb() first appeared in OpenSSL 0.9.7 and has been available since OpenBSD 3.2

lowkey a note from me to you: these functions empty the error queue, so if you print once, the errors are gone. don't call it twice expecting a rerun, bestie πŸ˜­πŸ’€

okay that's the whole page! this one came from Debian, dated June 8, 2025 β€” so yeah, she's fresh, she's documented, and she ate. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from