KCAPI_PAD_IV(3)
π KCAPI_PAD_IV π
okay bestie, so this one's from the libkcapi manual, and it's literally just kcapi_pad_iv β the girl whose whole job is fixing up your IV so the cipher will actually accept it. no cap.
β¨ NAME β¨
kcapi_pad_iv β realign the IV as necessary for cipher
πΈ SYNOPSIS πΈ
int kcapi_pad_iv(struct kcapi_handle * handle, const uint8_t * iv,
uint32_t ivlen, uint8_t ** newiv, uint32_t * newivlen);
π ARGUMENTS π
handleβ [in] the cipher handle, your main character π«Άivβ [in] the current IV bufferivlenβ [in] how long that IV buffer isnewivβ [out] the buffer of the aligned IV (the glow-up version β¨)newivlenβ [out] how long the newly aligned IV is
π¦ DESCRIPTION π¦
so the way this works is: the function pads the least significant bits of the IV you handed it with zeros, all the way up to the block size of the cipher. cute, right?
and if your IV is longer than the block size? not me being extra β the least significant bits just get truncated down to the block size. periodt.
π
the function allocates memory for newiv when the return code says success. the consumer must free that memory after use. yes, that means you. don't leave her hanging.
it returns 0 for success, or a negative errno-style error code if something went wrong π
π AUTHOR π
Stephan Mueller <smueller@chronox.de> Author.
π COPYRIGHT π
that's the whole thing, bestie β libkcapi Manual 1.5.0, dated July 2025, and the page is KCAPI_PAD_IV(3). slay, go free your memory now πβ
π¦ where this page comes from
- fedora 43: libkcapi-devel 1.5.0-6.fc43 Β· BSD-3-Clause OR GPL-2.0-only
- fedora 43: libkcapi-devel 1.5.0-6.fc43 Β· BSD-3-Clause OR GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms