edit: Another suggestion... use a proper source of random numbers in init_aes_key_iv(). Using the time isn't good.
edit: Another suggestion... use a proper source of random numbers in init_aes_key_iv(). Using the time isn't good.
I apologize for the certificate errors. If you want the cert its here: https://demo.envelope.xyz/certificate/index.html
time(NULL) * getpid() * clock()
Thanks!https://www.schneier.com/blog/archives/2013/10/insecurities_...
Edit: For reference, this is exactly how the Netscape's original SSL implementation was broken: https://web.archive.org/web/20141214141822/http://www.cs.ber...
I think it's also best to use #ifdef to prevent those hardcoded debugging keys from being included in production builds. That is, if you still need to keep them at all.
edit:
joelthelion: You are mistaken. It's not the 1990s anymore. Use the non-blocking /dev/urandom, not /dev/random. (I can't seem to reply directly to you)
This is why cryptography is doomed to fail.
This /dev/random vs /dev/urandom (blocking vs non-blocking and whether it matters) is discussed frequently on HN, usually with very long threads, and yet it still comes up.
If I want to remember whether there's an apostrophe in possessive its there's a cartoon to tell me. We need a good, accurate, fact-checked cartoon for urandom vs random.
(It's one of the things I'd do if I had FU money.)
As for actually generating random numbers, here's a good explanation from 'tptacek: http://sockpuppet.org/blog/2014/02/25/safely-generate-random...