AES + Integration with Io
#7
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Telodendria/Cytoplasm#7
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
While it may not strictly be necessary for Telodendria, I think it would be cool to have an AES implementation in Cytoplasm. We should also add an
IoAes
API which allows streams to be encrypted on the fly using GCM.Attached is the official NIST specification.
I don't think touching crypto is good idea. Maybe use implementation from TLS library?
Everyone says not to touch crypto, but somebody has to do it, and honestly it isn't that hard. Conceptually it is not difficult to understand, and the specifications are very thorough. There are also plenty of good, high-quality test suites that can verify the correctness of an implementation.
This for sure isn't something that would replace the already-existing TLS implementations we support in Cytoplasm. It would just be a fun exercise, although someday I would definitely love to implement a TLS library. Understanding cryptography is really important. It's critical for our digital safety and privacy. I think knowing how it works is a good thing because everyone relies on it so heavily and if only a few people understand it, that sounds dangerous.
So I think touching crypto is a great idea. A low-priority idea that I probably won't be able to get to for a long time, but a good idea nonetheless.
I do believe that if we ever have to do it, we should be extremely careful to get the implementation right (as one that wouldn't can, both in theory and practice leak information about keys through side-channels), and ideally use the TLS library's version if possible, for speed (with modern processors having dedicated instructions for basic AES operations that we cannot use), size (TBF, an AES implementation doesn't seem too heavy, but may as well cut down space), and security (see the point I made about leaking information).
An AES implementation could also mean a pretty decent (still not as perfect as something like
/dev/random
, but a pretty good last resort) secure random number generator too with CTR-DRBG, which would be highly important for projects that need to have good randomness, like Telodendria would for signatures (This would also require having a CTR mode, which would be also useful for e.g Matrix clients, since files can be encrypted with that mode)Yep, that was kind of my thoughts as well. Interestingly enough, I was just thinking about
/dev/random
a few days ago, and since it is implemented on pretty much every operating system, it might be worth using instead of our current random code, even if it isn't necessarily POSIX. Thoughts?I don't think getting rid of the old
Rand
code is a good thing. As you said/dev/random
may not even exist, but even if it does, it still can block in cases where entropy is not low, and I think there are scenarios where usingRand
is good enough as-is, and where/dev/random
may actually be harmful due to blocking. (e.g: non-cryptographic tasks)I believe we should just go and add a set of cryptographic RNG functions(that can use
/dev/random
if possible), and just keepRand
as-is (or at least, keep a way to generate non-cryptographic numbers somehow)