shishi_encrypt_ivupdate(3)

πŸ“¦
version 1.0.3 Β· 2 versions
  • 1.0.3 Β· debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking (latest)
  • 1.0.2 Β· ubuntu jammy
, in debian bookworm, debian trixie, nixos 26.05, nixpkgs unstable, ubuntu noble, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– shishi_encrypt_ivupdate πŸ’–

okay bestie, pull up a chair, because this one is from the shishi manual (section 3, library calls, iykyk) and it's literally the glow-up function for your encryption era ✨


✨ NAME ✨

shishi_encrypt_ivupdate β€” API function 🌸


πŸŽ€ SYNOPSIS πŸŽ€

#include <shishi.h>

int shishi_encrypt_ivupdate(Shishi * handle, Shishi_key * key, int
keyusage, const char * iv, size_t ivlen, char ** ivout, size_t *
ivoutlen, const char * in, size_t inlen, char ** out, size_t * outlen);

πŸ¦‹ ARGUMENTS πŸ¦‹

like, so many parameters, but every single one is doing its little job and we respect that πŸ’…

  • Shishi * handle β€” the shishi handle, the one you got from shishi_init(). your main character, basically πŸ‘‘
  • Shishi_key * key β€” the key we're encrypting with πŸ”‘
  • int keyusage β€” an integer saying what exactly this key is encrypting, so the key derivation knows what's up
  • const char * iv β€” input array holding the initialization vector 🧚
  • size_t ivlen β€” how big that initialization vector input array is
  • char ** ivout β€” output array with the newly allocated updated initialization vector (yes, freshly allocated, we love a new buffer)
  • size_t * ivoutlen β€” the size of that output array with the updated initialization vector
  • const char * in β€” input array with the data you wanna encrypt πŸ“
  • size_t inlen β€” size of the input array with the data to encrypt
  • char ** out β€” output array with the newly allocated encrypted data ✨
  • size_t * outlen β€” output variable holding the size of that newly allocated output array

πŸ’œ DESCRIPTION πŸ’œ

so basically it encrypts data using the specified initialization vector and key. periodt. πŸ’«

the key that actually gets used is derived using the key usage. and if key usage is 0, then no key derivation is used at all, no cap. 🫢

the OUT buffer must be deallocated by the caller. that's on you, bestie, not on shishi. 😭

and if IVOUT or IVOUTLEN is NULL, then the updated IV just... doesn't get saved anywhere. it's giving "we move on" πŸ™ˆ

now, important lore: DECRYPT(ENCRYPT(data)) does not necessarily yield data exactly. nope, not even close. some encryption types add pad so the data fits into the block size of the encryption algorithm. and the pad is not guaranteed to look any special way, although existing implementations often pad with the zero byte. πŸ’€

which means 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. iconic behaviour, honestly ⭐


🌈 RETURN VALUE 🌈

returns SHISHI_OK iff successful. that's it, that's the whole vibe check βœ…


πŸ’€ REPORTING BUGS πŸ’€

found a bug? not cute. report it to <bug-shishi@gnu.org>.


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. slay, and also legally binding πŸŽ€


🌸 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. go read it, bestie πŸ“–βœ¨


that's the whole page, fr fr β€” this one's from shishi version 1.0.3, section 3, page shishi_encrypt_ivupdate(3). mwah, take care of those buffers πŸ’–πŸ’…πŸ¦‹