ERR_LOAD_STRINGS(3ossl)

πŸ“¦ version 3.5.0, in opensuse-leap 16.0

πŸ’… ERR_LOAD_STRINGS β€” bestie, it's giving "load arbitrary error strings" (this is the 3ossl page, hi 🫢)

✨ NAME ✨

ERR_load_strings, ERR_PACK, ERR_get_next_error_library β€” okay so these three are your lil squad for loading arbitrary error strings. Like, custom error messages for your very own library. Slay. πŸ’–


🌸 SYNOPSIS 🌸

#include <openssl/err.h>

int ERR_load_strings(int lib, ERR_STRING_DATA *str);

int ERR_get_next_error_library(void);

unsigned long ERR_PACK(int lib, int func, int reason);

πŸ¦‹ DESCRIPTION πŸ¦‹

So ERR_load_strings() registers error strings for library number lib. That's the whole vibe. ✨

The str argument is an array of error string data, and it looks exactly like this:

typedef struct ERR_string_data_st
{
    unsigned long error;
    char *string;
} ERR_STRING_DATA;

Now, the error code itself? It's generated from the library number plus a function code and a reason code, like:

error = ERR_PACK(lib, func, reason);

And important!! ERR_PACK() is a macro, not a function. iykyk. πŸ’…

The last entry in the array is {0,0}. Do not forget the {0,0}, bestie, it's literally the terminator of this whole thing. πŸ™ˆ

Also ERR_get_next_error_library() exists so you can assign library numbers to user libraries at run time. Iconic.


πŸŽ€ RETURN VALUES πŸŽ€

  • ERR_load_strings() β€” returns 1 for success, 0 for failure. That's it, that's the number.
  • ERR_PACK() β€” returns the error code. 🎯
  • ERR_get_next_error_library() β€” returns zero on failure, otherwise it hands you a brand new library number. New number, new me. πŸ”₯

🌈 SEE ALSO 🌈


Copyright 2000-2018 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>.


And that's the page, bestie 🫢 β€” brought to you by OpenSSL 3.5.0, dated 2026-09-25, filed under ERR_LOAD_STRINGS(3ossl). Go forth and load those strings. πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from