libcanlock(3)
πΈ libcanlock(3) β the cl_clear_secret glow-up π
okay bestie, so we're deep in libcanlock 3.3.3 territory and this page is all about wiping secrets out of memory like the FBI is at the door π΅οΈββοΈβ¨ Strap in.
β¨ NAME β¨
cl_clear_secret β overwrites secret data in memory, using libcanlock π«Ά
π SYNOPSIS π
#include <libcanlock-3/canlock.h>
int cl_clear_secret(void *sec, size_t sec_size,
size_t buf_size);
like, that's the whole vibe. two size_t's and a void pointer, no cap π
π DESCRIPTION π
so the cl_clear_secret() function tries to overwrite sec_size bytes of memory, starting at whatever address sec points to. it's giving "shred the evidence" energy π₯
here's the catch tho β buf_size must be set to the size of the whole buffer. don't skip that, fr fr, it's literally required.
and now for the β¨implementation dramaβ¨ (this part is super important, bestie, pay attention):
- the C standard provides
memset_explicit()since C23. that one is preferred, if available. it's the main character π - the C standard provides
memset_s()since C11, but only in the optional Annex K. it gets called with both length values, if available. - otherwise, nonportable functions like NetBSD
explicit_memset()get used, if available. - and if nothing better is available? we fall back to a plain call to
memset()instead. π
β οΈ okay this is the scary bit: with that memset() fallback, the compiler may translate this attempt to NOP β like, it might just... not do it π. In that case, a positive value is returned as a warning. so like, check your return values, bestie!!
β RETURN VALUE β
0β success, we ate, everything worked π- negative values β error. it's giving "something went wrong"
- positive values β warning. like, "technically fine but look out"
the value -1 is returned if the parameter sec is NULL, or if sec_size is greater than buf_size π©
the value 1 indicates missing support for explicit memory access from the system π¬
π¦ AUTHORS π¦
Michael Baeuerle π (the icon behind it all)
π REPORTING BUGS π
found a bug? don't be shy, report it to <mailto:michael.baeuerle@gmx.net> π
π§ STANDARDS π§
libcanlock tries to comply with the following standards, and honestly? we stan the effort:
π SEE ALSO π
cl_get_key(3)cl_get_lock(3)cl_split(3)cl_verify(3)cl_verify_multi(3)canlock(1)memset(3)memset_explicit(3)memset_s(3)
and that's the whole page, bestie!! π the manual itself is dated 2026-07-06 and comes from the Unix manual set, from libcanlock 3.3.3 β go forth and clear those secrets ππβ¨
π¦ where this page comes from
- epel 10: libcanlock-devel 3.3.3-2.el10_3 Β· BSD-3-Clause AND NLPL AND ICU
- π the page's license: ICU
- (c) 2018-2026 Michael Baeuerle
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms