---
name: "libressl-ERR_error_string"
section: "3"
platform: "linux"
package: "libressl"
version: "4.4.0-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/libressl-ERR_error_string"
---

# libressl-ERR\_error\_string(3)

obtain human-readable OpenSSL error messages

## NAME

**ERR\_error\_string**, **ERR\_error\_string\_n**, **ERR\_lib\_error\_string**, **ERR\_func\_error\_string**, **ERR\_reason\_error\_string** – obtain human-readable OpenSSL error messages

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#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\_func\_error\_string**(*unsigned long e*);

*const* *char* *\**\

**ERR\_reason\_error\_string**(*unsigned long e*);

## DESCRIPTION

**ERR\_error\_string**() generates a human-readable string representing the error code *e* and places it in *buf*. *buf* must be at least 256 bytes long. If *buf* is NULL, the error string is placed in a static buffer. Note that this function is not thread-safe and does no checks on the size of the buffer; use **ERR\_error\_string\_n**() instead.

**ERR\_error\_string\_n**() is a variant of **ERR\_error\_string**() that writes at most *len* characters (including the terminating NUL) and truncates the string if necessary. For **ERR\_error\_string\_n**(), *buf* may not be NULL.

The string will have the following format:

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

The error code is an 8-digit hexadecimal number. The library name, the function name, and the reason string are ASCII text.

**ERR\_lib\_error\_string**(), **ERR\_func\_error\_string**(), and **ERR\_reason\_error\_string**() return the library name, the function name, and the reason string, respectively.

The OpenSSL error strings should be loaded by calling ERR\_load\_crypto\_strings(3) or, for SSL applications, SSL\_load\_error\_strings(3) first. If there is no text string registered for the given error code, the error string will contain the numeric code.

ERR\_print\_errors(3) can be used to print all error codes currently in the queue.

## RETURN VALUES

**ERR\_error\_string**() returns a pointer to a static buffer containing the string if *buf* is NULL, or *buf* otherwise.

**ERR\_lib\_error\_string**(), **ERR\_func\_error\_string**(), and **ERR\_reason\_error\_string**() return the strings, or NULL if none is registered for the error code.

## SEE ALSO

ERR(3), ERR\_get\_error(3), ERR\_load\_crypto\_strings(3), ERR\_print\_errors(3), SSL\_load\_error\_strings(3)

## HISTORY

**ERR\_error\_string**(), **ERR\_lib\_error\_string**(), **ERR\_func\_error\_string**(), and **ERR\_reason\_error\_string**() first appeared in SSLeay 0.4.4 and have been available since OpenBSD 2.4.

**ERR\_error\_string\_n**() first appeared in OpenSSL 0.9.6 and has been available since OpenBSD 2.9.
