shishi_encrypt_iv(3)
π shishi_encrypt_iv(3) π
okay bestie, so this is a page from the shishi manual β section 3, the library-call girlies β and we're talking about shishi_encrypt_iv, an API function. yes it's giving cryptography. yes it's iconic. let's go π¦
β¨ NAME β¨
shishi_encrypt_iv β literally just an API function, that's the whole name, no notes π
πΈ SYNOPSIS πΈ
#include <shishi.h>
int shishi_encrypt_iv(Shishi * handle, Shishi_key * key, int keyusage,
const char * iv, size_t ivlen, const char * in, size_t inlen, char **
out, size_t * outlen);
look at her. eight arguments. main character energy fr fr π
π ARGUMENTS π
Shishi * handleβ the shishi handle, the one you got fromshishi_init(). she's the whole vibe, everything runs through her.Shishi_key * keyβ the key you're encrypting with. the actual lock-and-key moment πint keyusageβ an integer saying what this key is out here encrypting. like, context bestie, context.const char * ivβ input array holding the initialization vector.size_t ivlenβ the size of that input array with the initialization vector. yes, you gotta tell it how big your IV is, it's not psychic πconst char * inβ input array with the data you wanna encrypt. the actual tea βsize_t inlenβ size of that input array with the data to encrypt.char ** outβ output array with the newly allocated encrypted data. she's fresh, she's new, she's yours to free later.size_t * outlenβ output variable holding the size of that newly allocated output array.
π DESCRIPTION π
So. What does she do? She encrypts data using the specified initialization vector and key. that's it, that's the job β¨
the key that actually gets used is derived using the key usage. and here's the lil detail: if key usage is 0, no key derivation is used at all. zero means raw, bestie.
the OUT buffer must be deallocated by the caller. that's on you, not on her. she handed you a freshly allocated thing and now it's your responsibility, no take-backs π«Ά
β οΈ the next IV is lost. like, gone gone. if you actually need it, go see shishi_encrypt_ivupdate instead β she's the one holding onto it.
and now the part that lowkey trips everyone up, so pay attention:
πDECRYPT(ENCRYPT(data))does not necessarily yielddataexactly.
not a typo, not a glitch, that's just how it is. some encryption types add pad to make the data fit into the block size of the encryption algorithm. and the pad? not guaranteed to look in any special way, though existing implementations often pad with the zero byte. so yeah β you may have to "frame" your data, so it's possible to infer the original length after decryption. compare ASN.1 DER, which contains such information. DER said "I'll just include the length myself" and honestly? slay.
β RETURN VALUE β
Returns SHISHI_OK iff successful. that's the only good outcome, bestie. anything else and it's a vibe check failure π
π REPORTING BUGS π
Report bugs to <bug-shishi@gnu.org>.
- GNU Shishi home page:
http://www.gnu.org/software/shishi/ - General help using GNU software:
http://www.gnu.org/gethelp/
if something's broken, tell the maintainers, don't just suffer in silence π«Ά
π COPYRIGHT π
Copyright Β© 2002-2022 Simon Josefsson.
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. periodt.
π SEE ALSO π
The full documentation for shishi is maintained as a Texinfo manual. If the info and shishi programs are properly installed at your site, the command
info shishi
should give you access to the complete manual. iykyk, the Texinfo girlies stay winning π
okay that's the whole page, we ate and left no crumbs π this was shishi_encrypt_iv(3) from the shishi manual, version 1.0.3 β mwah, take care of your IVs bestie πβ¨
π¦ where this page comes from
- debian bookworm: shishi-doc 1.0.3-1 Β· GPL-3.0-or-later
- debian trixie: shishi-doc 1.0.3-5 Β· GPL-3.0-or-later
- nixos 26.05: shishi 1.0.3
- nixpkgs unstable: shishi 1.0.3
- ubuntu noble: shishi-doc 1.0.3-2.1build2 Β· GPL-3.0-or-later
- ubuntu questing: shishi-doc 1.0.3-5
- ubuntu resolute: shishi-doc 1.0.3-5build1 Β· GPL-3.0-or-later
- ubuntu stonking: shishi-doc 1.0.3-7 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms