ERR_ERROR_STRING(3ossl)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1

πŸ’– ERR_ERROR_STRING(3ossl) πŸ’–

hey bestie!! so you've summoned the 3ossl manual page for the error-string girlies, and honestly? you came to the right place. this whole family of functions is about turning that cursed little number you got back into actual words a human can read. let's go πŸŽ€


✨ NAME ✨

ERR_error_string, ERR_error_string_n, ERR_lib_error_string, ERR_func_error_string, ERR_reason_error_string β€” obtain human-readable error message. that's the whole vibe: number goes in, words come out, you stop crying 😭


🌈 SYNOPSIS 🌈

#include <openssl/err.h>

char *ERR_error_string(unsigned long e, char *buf);
void ERR_error_string_n(unsigned long e, char *buf, size_t len);

const char *ERR_lib_error_string(unsigned long e);
const char *ERR_reason_error_string(unsigned long e);

and now, the deprecated one β€” deprecated in OpenSSL 3.0, so like… she's still here but she's not thriving:

const char *ERR_func_error_string(unsigned long e);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so first up, ERR_error_string() generates a human-readable string representing the error code e, and places it at buf. and listen β€” buf must be at least 256 bytes long. not 200, not "eh probably fine". 256. 🫢

if buf is NULL, the error string goes into a static buffer instead. but heads up, bestie: this function is not thread-safe and it does no checks on the size of the buffer. no vibe check at all, she just writes. so please, use ERR_error_string_n() instead. πŸ™ˆ

ERR_error_string_n() is the variant of ERR_error_string() that writes at most len characters (including the terminating 0) and truncates the string if necessary. and for ERR_error_string_n(), buf MUST NOT be NULL. like, at all. non-negotiable πŸ’…

the string will have this format, and yes it has that empty :: in the middle, that's not a typo, that's just her 🧚

error:[error code]:[library name]::[reason string]

where error code is an 8 digit hexadecimal number, and library name and reason string are ASCII text. iconic little trio.

ERR_lib_error_string() and ERR_reason_error_string() return the library name and reason string respectively. feeling efficient today.

if there is no text string registered for the given error code, the error string will contain the numeric code. no name, no reason, just numbers β€” she's giving mystery πŸ”₯

also!! ERR_print_errors(3) can be used to print all error codes currently in the queue. very handy, very main character energy.


⭐ RETURN VALUES ⭐

  • ERR_error_string() returns a pointer to a static buffer containing the string if buf == NULL, and buf otherwise. yep, exactly like that πŸ‘‘
  • ERR_lib_error_string() and ERR_reason_error_string() return the strings, and NULL if none is registered for the error code.
  • ERR_func_error_string() returns NULL. that's it. that's the whole return value. she's retired πŸ’€

🌸 SEE ALSO 🌸

go read those next, iykyk πŸ“


πŸ’œ HISTORY πŸ’œ

ERR_func_error_string() became deprecated in OpenSSL 3.0. she had a good run πŸŽ€


Copyright 2000-2017 The OpenSSL Project Authors. All Rights Reserved.

Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.


okay that's the whole page bestie, no cap, every detail intact πŸ’– this was version 3.5.6, dated 2026-04-07, and you've been reading ERR_ERROR_STRING(3ossl) β€” slay, go fix that error code, you've got this 🫢✨

πŸ“¦ where this page comes from