---
name: "libressl-X509_STORE_load_locations"
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-X509_STORE_load_locations"
---

# libressl-X509\_STORE\_load\_locations(3)

configure files and directories used by a certificate store

## NAME

**X509\_STORE\_load\_locations**, **X509\_STORE\_set\_default\_paths**, **X509\_STORE\_load\_mem**, **X509\_STORE\_add\_lookup** – configure files and directories used by a certificate store

## SYNOPSIS

Crypto Library (libcrypto, -lcrypto)

**#include \<openssl/x509\_vfy.h\>**

*int*\

**X509\_STORE\_load\_locations**(*X509\_STORE \*store*, *const char \*file*, *const char \*dirs*);

*int*\

**X509\_STORE\_set\_default\_paths**(*X509\_STORE \*store*);

*int*\

**X509\_STORE\_load\_mem**(*X509\_STORE \*store*, *void \*buffer*, *int length*);

*X509\_LOOKUP* *\**\

**X509\_STORE\_add\_lookup**(*X509\_STORE \*store*, *const X509\_LOOKUP\_METHOD \*method*);

## DESCRIPTION

**X509\_STORE\_load\_locations**() instructs the *store* to use the PEM *file* and all the PEM files in the directories contained in the colon-separated list *dirs* for looking up certificates, in addition to files and directories that are already configured. The certificates in the directories must be in hashed form, as documented in X509\_LOOKUP\_hash\_dir(3). Directories already in use are not added again. If NULL is passed for *file* or *dirs*, no new file or no new directories are added, respectively.

**X509\_STORE\_load\_locations**() is identical to SSL\_CTX\_load\_verify\_locations(3) except that it operates directly on an *X509\_STORE* object, rather than on the store used by an SSL context. See that manual page for more information.

**X509\_STORE\_set\_default\_paths**() is similar except that it instructs the *store* to use the default PEM file and directory (as documented in FILES) in addition to what is already configured. It ignores errors that occur while trying to load the file or to add the directory, but it may still fail for other reasons, for example when out of memory while trying to allocate the required *X509\_LOOKUP* objects.

**X509\_STORE\_set\_default\_paths**() is identical to SSL\_CTX\_set\_default\_verify\_paths(3) except that it operates directly on an *X509\_STORE* object, rather than on the store used by an SSL context. See that manual page for more information.

The above functions are wrappers around X509\_LOOKUP\_load\_file(3) and X509\_LOOKUP\_add\_dir(3).

**X509\_STORE\_load\_mem**() instructs the *store* to use the certificates contained in the memory *buffer* of the given *length* for certificate lookup. It is a wrapper around X509\_LOOKUP\_add\_mem(3).

**X509\_STORE\_add\_lookup**() checks whether the *store* already contains an *X509\_LOOKUP* object using the given *method*; if it does, the existing object is returned and no other action occurs. Otherwise, a new *X509\_LOOKUP* object is allocated, added, and returned. This function is used internally by all the functions listed above.

## RETURN VALUES

**X509\_STORE\_load\_locations**() returns 1 if all files and directories specified were successfully added. It returns 0 for failure. That can happen if adding the file failed, if adding any of the directories failed, or if both arguments were NULL.

**X509\_STORE\_set\_default\_paths**() returns 0 for some error conditions and 1 otherwise, not just for success, but also for various cases of failure.

**X509\_STORE\_load\_mem**() returns 1 for success or 0 for failure. In particular, parse errors or lack of memory can cause failure.

**X509\_STORE\_add\_lookup**() returns the existing or new lookup object or NULL on failure. This is an internal pointer that must not be freed. With LibreSSL, the only reason for failure is lack of memory.

## FILES

- */etc/ssl/cert.pem*

  default PEM file for **X509\_STORE\_set\_default\_paths**()

- */etc/ssl/certs/*

  default directory for **X509\_STORE\_set\_default\_paths**()

## SEE ALSO

SSL\_CTX\_load\_verify\_locations(3), X509\_load\_cert\_file(3), X509\_LOOKUP\_hash\_dir(3), X509\_LOOKUP\_new(3), X509\_STORE\_new(3), X509\_STORE\_set1\_param(3), X509\_STORE\_set\_verify\_cb(3)

## HISTORY

**X509\_STORE\_load\_locations**(), **X509\_STORE\_set\_default\_paths**(), and **X509\_STORE\_add\_lookup**() first appeared in SSLeay 0.8.0 and have been available since OpenBSD 2.4.

**X509\_STORE\_load\_mem**() first appeared in OpenBSD 5.7.

## BUGS

By the time that adding a directory is found to have failed, the file and some other directories may already have been successfully loaded, so these functions may change the state of the store even when they fail.

**X509\_STORE\_set\_default\_paths**() clears the error queue, deleting even error information that was already present when it was called.
