selabel_digest(3)
π selabel_digest β the tea β
okay bestie, so this is selabel_digest(3) from the SELinux API documentation, section 3, and it's literally the little function that hands you a digest and the receipts for which specfiles went into it. let's get into it π«Ά
β¨ 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 π¦
so selabel_digest() does a whole operation on the handle hnd, and it hands you back the results of the SHA256 digest that digest points at β and the length of that lil digest goes into digest_len. β¨
then the list of specfiles that were used in the SHA256 digest calculation comes back in specfiles, with the number of entries in num_specfiles. it's giving "here's the math, and here's everything that went into the math" π
important bestie moment: for selabel_digest() to be able to return any of this info, the SELABEL_OPT_DIGEST option has to be enabled in selabel_open(3). no option, no digest, periodt.
β οΈ and the result ofselabel_digest()must not be used afterselabel_close(3). like, do not. it's gone. it's giving expired. π
β RETURN VALUE β
- on success, zero is returned π
- on error, -1 is returned and
errnois set appropriately π
π ERRORS π
EINVALβ No digest available (returned ifSELABEL_OPT_DIGESToption not enabled). yeah she'll hit you with this one if you forgot the option, no cap πENOMEMβ An attempt to allocate memory failed. the memory said no π
π SEE ALSO π
iykyk, go read those next fr fr πΈ
and that's the whole page bestie!! this icon of a manpage was brought to you by the SELinux API documentation, dated 16 Sept 2015, and this rewrite is signing off β stay slay, keep your options enabled, and never touch a digest after close π β¨π
π¦ where this page comes from
- centos-stream 10: libselinux-devel 3.11-3.el10 Β· LicenseRef-Fedora-Public-Domain
- centos-stream 9: libselinux-devel 3.6-5.el9 Β· Public Domain
- centos-stream 9: libselinux-devel 3.6-5.el9 Β· Public Domain
- fedora 43: libselinux-devel 3.9-5.fc43 Β· LicenseRef-Fedora-Public-Domain
- fedora 43: libselinux-devel 3.9-5.fc43 Β· LicenseRef-Fedora-Public-Domain
- fedora 44: libselinux-devel 3.10-1.fc44 Β· LicenseRef-Fedora-Public-Domain
- fedora 44: libselinux-devel 3.10-1.fc44 Β· LicenseRef-Fedora-Public-Domain
- fedora 44: libselinux-devel 3.11-2.fc44 Β· LicenseRef-Fedora-Public-Domain
- fedora 44: libselinux-devel 3.11-2.fc44 Β· LicenseRef-Fedora-Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms