libcanlock(3)
π libcanlock(3) β the cl_get_lock glow-up
okay bestie, so this is the libcanlock manual, version 3.3.3, and it's all about making Cancel-Locks. yes it's as iconic as it sounds. let's get into it π
β¨ NAME β¨
cl_get_lock β literally the function that creates a Cancel-Lock for you, with libcanlock doing all the heavy lifting. no cap.
π¦ SYNOPSIS π¦
#include <libcanlock-3/canlock.h>
char *cl_get_lock(cl_hash_version hash,
const unsigned char *sec, size_t sec_len,
const unsigned char *msg, size_t msg_len);
the hash values that are supported (as of version 3.0.0 of libcanlock, iykyk) are:
CL_SHA1 CL_SHA224 CL_SHA256 CL_SHA384 CL_SHA512
πΈ DESCRIPTION πΈ
so what does cl_get_lock() actually do? it creates a <c-lock> element using the algorithm that RFC 8315 recommends, in Section 4. and the hash algorithm you pick for <scheme>? yeah, it gets used for the HMAC operation too. two birds, one slay π₯
which hash algorithm <scheme> gets is chosen with hash. that's it, that's the vibe check.
the local secret goes in sec (and sec_len has to be set to the length of sec, fr fr). and heads up bestie β the length of the local secret should be at least the length of the hash you selected for <scheme>. so that's 32 octets if you went with SHA256. don't skimp π
the Message-ID of the target article (the one you're making the lock for) goes in msg, and msg_len must be set to the length of msg. obvious? yes. still saying it. π
and here's the cute extra: the Message-ID msg can be prepended with an optional User-ID. if you do that, the length of the User-ID has to be added to msg_len. oh and β important β the User-ID must not contain angle brackets. none. zero. π
π RETURN VALUE π
- if it works, you get a pointer to the result string. slay β¨
- if it doesn't, you get
NULL. that's it. that's the whole mood π
and on success? the caller is responsible for calling free() on the pointer that gets returned. yes, you. don't forget, or that's a leak and we don't do leaks π«Ά
π AUTHORS π
- Dennis Preiser
- (based in part on the implementation from G. J. Andruk for Version 2 β shoutout to the ancestors π )
- the base64 implementation is written by Kungliga Tekniska Hogskolan (Royal Institute of Technology, Stockholm, Sweden) πΈπͺ
- the hash algorithms are implemented with code from RFC 6234 β
π REPORTING BUGS π
found a bug? don't suffer in silence, bestie β report it to <mailto:michael.baeuerle@gmx.net>. π
π STANDARDS π
libcanlock tries to comply with these standards, and honestly? respect:
π₯ SEE ALSO π₯
free(3), cl_clear_secret(3), cl_get_key(3), cl_split(3), cl_verify(3), cl_verify_multi(3), canlock(1)
go read them, they're all part of the same little universe π§
okay that's the whole page, bestie β you're officially a Cancel-Lock girlie now π this was libcanlock version 3.3.3, dated 2026-07-06, and yes the Unix manual vibes are immaculate. mwah π
π¦ 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-2024 Michael Baeuerle
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms