shishi_decrypt_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_decrypt_ivupdate_etype(3) โ€” the shishi manual, section 3 ๐Ÿ’–

okay bestie, gather round, because today we're decoding (literally) one of the shishi API functions ๐Ÿฆ‹ it's called shishi_decrypt_ivupdate_etype, and yes the name is a whole mouthful, but it's giving "I do exactly what my name says" energy and honestly? iconic. ๐Ÿ‘‘


โœจ NAME โœจ

shishi_decrypt_ivupdate_etype โ€” an API function. that's it, that's the name, she's an API function and she's thriving ๐Ÿ’…


๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <shishi.h>

int shishi_decrypt_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. a whole squad. a friend group, if you will. ๐Ÿซถ


๐ŸŽ€ ARGUMENTS ๐ŸŽ€

  • Shishi * handle โ€” your shishi handle, the one you got from shishi_init(). she's the main character, everything routes through her.
  • Shishi_key * key โ€” the key you're decrypting with. no key, no decryption, no vibes. ๐Ÿ”‘
  • int keyusage โ€” an integer that says what this key is being used to decrypt. context matters bestie.
  • int32_t etype โ€” an integer telling us which cipher to use. pick your fighter. ๐ŸฅŠ
  • const char * iv โ€” input array holding the initialization vector. the IV. the little sparkle that makes each encryption unique โœจ
  • size_t ivlen โ€” the size of that input IV array. how big is the sparkle.
  • char ** ivout โ€” output array with a newly allocated updated initialization vector. she's fresh, she's new, she's yours to free (more on that in a sec ๐Ÿ˜ญ).
  • size_t * ivoutlen โ€” the size of that output array with the updated IV.
  • const char * in โ€” input array with the data you wanna decrypt. the mystery box ๐Ÿ“ฆ
  • size_t inlen โ€” size of the input array with data to decrypt.
  • char ** out โ€” output array with the newly allocated decrypted data. THE REVEAL. ๐ŸŽ‰
  • size_t * outlen โ€” output variable holding the size of that newly allocated output array.

๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

So what does she actually do? She decrypts data according to the encryption method, using the initialization vector and key you handed her. ๐Ÿ”“

The key that actually gets used? It's derived using the key usage. and here's the tea: if key usage is 0, no key derivation is used at all. zero. none. periodt.

The OUT buffer must be deallocated by the caller. not by her, not by your other functions, by you. don't leave her hanging with a memory leak, that's not the move. ๐Ÿšฎ

And if IVOUT or IVOUTLEN is NULL? then the updated IV just... isn't saved anywhere. she keeps it to herself. lowkey mysterious of her. ๐Ÿ™ˆ

โš ๏ธ okay this part is important, no cap: DECRYPT(ENCRYPT(data)) does not necessarily give you back your data exactly. some encryption types add pad to make the data fit into the block size of the encryption algorithm. and the pad? it's not guaranteed to look in any special way, even though existing implementations often pad with the zero byte. so like, you genuinely cannot trust the padding to be recognizable.

what does that mean for you, bestie? it 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. framing: it's giving "wrap it up so you know what you got." ๐ŸŽ


โญ RETURN VALUE โญ

Returns SHISHI_OK iff successful. that "iff" is doing a lot of heavy lifting and she's right to do it. ๐Ÿ’ฏ


๐Ÿ˜ญ REPORTING BUGS ๐Ÿ˜ญ

found a bug? report it to <bug-shishi@gnu.org>. they wanna hear it, fr fr.


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.

(that's the license, and it's generous, and we respect it ๐ŸŒˆ)


๐ŸŒŸ 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, it's the whole lore. ๐Ÿ“š


and that's the page, bestie!! ๐Ÿ’– this was shishi_decrypt_ivupdate_etype(3) from shishi version 1.0.3, and yes, the copyright has been holding it down since 2002. now go forth, decrypt responsibly, and free your buffers. ๐Ÿฆ‹โœจ๐ŸŽ€