shishi_encrypt_ivupdate_etype(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_etype β€” the manual page, bestie edition πŸ’–

okay so you're reading the shishi manual, section 3 (that's the library-call girlies ✨), and this specific page is all about shishi_encrypt_ivupdate_etype. she's an API function. she encrypts stuff AND hands you back an updated initialization vector, which is a lot for one function but she ate, no cap πŸ‘‘


🌸 SYNOPSIS 🌸

#include <shishi.h>

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

look at all those parameters. twelve of them. she's high maintenance but she delivers πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • Shishi * handle β€” the shishi handle, bestie. you get one from shishi_init(), obviously.
  • Shishi_key * key β€” the key you're encrypting with. the main character of this operation fr.
  • int keyusage β€” an integer saying what exactly this key is encrypting. context matters, always πŸ’œ
  • int32_t etype β€” an integer saying which cipher to use. pick your fighter ✨
  • const char * iv β€” input array holding the initialization vector.
  • size_t ivlen β€” how big that input array with the initialization vector is.
  • char ** ivout β€” output array with the freshly allocated updated initialization vector. new IV, who dis πŸ¦‹
  • size_t * ivoutlen β€” how big the output array with the updated initialization vector is.
  • const char * in β€” input array with the data you wanna encrypt.
  • size_t inlen β€” size of that input array with the data to encrypt.
  • char ** out β€” output array with the newly allocated encrypted data. the glow-up 🫢
  • size_t * outlen β€” output variable holding the size of that newly allocated output array.

🌈 DESCRIPTION 🌈

so what does she actually do. she encrypts data as per the encryption method, using the initialization vector and key you specified. iconic behaviour honestly.

the key that actually gets used? it's derived using the key usage. and if key usage is 0, then no key derivation is used at all β€” zero, none, skipped, periodt.

the OUT buffer must be deallocated by the caller. that's your job, not hers. and if IVOUT or IVOUTLEN is NULL, the updated IV just... isn't saved anywhere. gone. into the void πŸ’€

🚨 okay important thing, listen up: DECRYPT(ENCRYPT(data)) does not necessarily give you back data exactly. like, not even close sometimes. some encryption types add pad to make the data fit into the block size of the encryption algorithm. and the pad isn't guaranteed to look any special way, though existing implementations often pad with the zero byte. so basically you may have to "frame" your data so it's possible to infer the original length after decryption. compare ASN.1 DER, which contains exactly that kind of information. so like, don't be shocked when round-tripping isn't a perfect circle, it's giving expected behaviour 😭

⭐ RETURN VALUE ⭐

returns SHISHI_OK iff successful. that's the only answer we accept πŸ’–


πŸ™ˆ REPORTING BUGS πŸ™ˆ

found a bug? report it 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/

(no gatekeeping, just tell them directly 🫢)


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.


🧚 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 the whole thing, iykyk πŸ“šβœ¨


and that's the page, bestie!! this was shishi_encrypt_ivupdate_etype(3) from shishi, version 1.0.3 πŸŽ€πŸ’– thanks for reading, you're literally so smart for making it to the end, slay, go encrypt something responsibly πŸ’…βœ¨πŸŒΈ