Dear all, On Thu, 2022-06-16 at 11:54 -0500, T Taylor Gurney wrote: > > I'm also weary of "rolling your own crypto". Unless you are a > > cryptographer, I have never heard that go well. > > I have heard of it going well (though admittedly not without major > difficulties): > > https://loup-vaillant.fr/articles/implemented-my-own-crypto > > > > This person studied cryptography on his own for a while and then > decided > to roll his own crypto library. The result is a single .c file, about > 3000 > lines, which received a favorable third-party audit. I humbly suggest > it > as an example of suckless cryptography. >
Another interesting, and similar project is "Tiny AES in c" [0] Small portable AES128/192/256 in C To quote the author: > This is a small and portable implementation of the AES ECB, CTR and CBC encryption algorithms written in C. There are some people that have self-implemented various LUKS/2 tools, some are from known projects (grub, qemu) WARNING: These are not meant to give you a solution, but to be used as a learning exercise, their goals are completely different (often). - luks2flt [1] Mainly for win32 (Please don't be sick!) It's quite interesting. - grub have a huge code base, the luks implementation seems 'light' [2] Have a look at grub-core/disk/luks2.c and grub-core/lib/crypto.c - libvirt/qemu [3] Another mastodon, but again, the implementation looks neat (almost) See src/qemu/qemu_block.c And on GitHub/GitLab, there are plenty of other mini/home projects meant to brute-force-crack an encrypted disk and/or block device. Often they use cryptosetup, but sometimes are full self made. Hope it helps ;-P [0] https://github.com/kokke/tiny-AES-c [1] https://github.com/Oknolynx/luks2flt [2] https://github.com/xoros-repo/grub (just a mirror) [3] https://github.com/libvirt/libvirt -- Antenore Gatta