---
name: "selabel_digest"
section: "3"
platform: "linux"
package: "libselinux1-dev"
version: "3.8.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/selabel_digest"
---

# selabel\_digest(3)

Return digest of specfiles and list of files used

## NAME

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

## SYNOPSIS

**#include \<selinux/selinux.h\>**\
 **#include \<selinux/label.h\>**

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

## 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)](/selabel_open/3.md).

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

## RETURN VALUE

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

## ERRORS

- **EINVAL**

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

- **ENOMEM**

  An attempt to allocate memory failed.

## SEE ALSO

[**selabel\_open**(3)](/selabel_open/3.md), [**selinux**(8)](/selinux/8.md)
