selabel\_digest(3) SELinux API documentation selabel\_digest(3)

# [NAME](#NAME)

selabel\_digest - Return digest of specfiles and list of files used

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;selinux/selinux.h&gt;**  
**#include &lt;selinux/label.h&gt;**

**int selabel\_digest(struct selabel\_handle \*hnd,**  
**unsigned char \*\*digest,** **size\_t \*digest\_len,**  
**char \*\*\*specfiles,** **size\_t \*num\_specfiles);**

# [DESCRIPTION](#DESCRIPTION)

**selabel\_digest**() performs an operation on the handle *hnd*, returning the results of the SHA1 digest pointed to by *digest*, whose length will be *digest\_len*. The list of specfiles used in the SHA1 digest calculation is returned in *specfiles* with the number of entries in *num\_specfiles*.

To enable **selabel\_digest**() to return this information the **SELABEL\_OPT\_DIGEST** option must be enable in [**selabel\_open**(3)](/man/os/libselinux/selabel_open.3).

The result of **selabel\_digest**() must not be used after [**selabel\_close**(3)](/man/os/libselinux/selabel_close.3).

# [RETURN VALUE](#RETURN_VALUE)

On success, zero is returned. On error, -1 is returned and *errno* is set appropriately.

# [ERRORS](#ERRORS)

[**EINVAL**](#EINVAL)

No digest available (returned if **SELABEL\_OPT\_DIGEST** option not enabled).

[**ENOMEM**](#ENOMEM)

An attempt to allocate memory failed.

# [SEE ALSO](#SEE_ALSO)

[**selabel\_open**(3)](/man/os/libselinux/selabel_open.3), [**selinux**(8)](/man/os/libselinux/selinux.8)

16 Sept 2015

---

Document: selabel_digest(3) from libselinux 3.11-r2 (Chainguard OS)
Source: https://github.com/SELinuxProject/selinux.git
