5 ms·
So you're doing DH negotiation and AES yourself because "stunnel is 10k lines of code"? What could possibly go wrong?
by sneak 15y ago
So you're doing DH negotiation and AES yourself because "stunnel is 10k lines of code"?
What could possibly go wrong?
- cperciva 15y agoNo, I prefer STUD over stunnel because stunnel is 10k lines of code. spiped is because it's dumb to do asymmetric crypto when you can establish a pre-shared key.
- devedev1234 15y agojust wait until you find out how many lines of code are in openssl you may have a panic attack o_0
- cperciva 15y agoOh, I'm very aware of how bloated the monstrosity called OpenSSL is.
- tptacek 15y agoThis is a reasonable comment, but you should read spiped before coming to a conclusion; in this one case, we're talking about (for instance) DH code from someone who writes his own blinded modexp. I don't see anything crazy in it.
- sneak 15y agoI spent about five minutes poking through it and nothing stuck out... but when I stopped I contemplated how many eyeballs have done the same thing to stunnel/gnutls already. I didn't reach any conclusion from my quick look, but was definitely put off by the "it's big so it must be insecure" view taken by the author.
- cperciva 15y agoI'm not saying that stunnel is insecure. I'm saying that I don't trust it to be secure.
- sneak 15y agoWhat OS kernel do you run? Also, what's the next question I'm about to ask you after you answer that?
- tptacek 15y agoHe's the FreeBSD security officer. What were you thinking was going to stick out when you read through it? What mistakes did you look for?
- sneak 15y agoDidn't know that, I'd never heard of him before (I haven't run BSD in years, and when I did it wasn't FreeBSD). Most of the time when someone posts a "look what I just implemented in C" to HN it's, well, not great. As I mentioned I only looked for five minutes, but I looked for really basic general programming errors, low-hanging fruit kind of stuff. That's enough to effectively cull a lot of the noise that gets posted here. His code is good - I just wonder why someone'd go to the effort (which is much higher than most other programming projects, due to the consequences of a bug) when we already have well-worn codebases for stuff /almost/ exactly like this, considering the tightrope-of-vigilance that is correctly implementing crypto protocols. I understand now that he wants a PSK vs. stunnel/TLS's certs-on-both-ends method, but effectively it only really differs in connection setup, as TLS (the way I understand it to be generally used) does symmetric crypto for the payload data anyway (after key setup). PS: His project is the first time I've encountered the use of gotos resulting in _cleaner_ code than without them. :)
- cperciva 15y agoI just wonder why someone'd go to the effort It wasn't that much effort. Almost everything under /lib/ I had already written as part of tarsnap or kivaloo; I spent maybe 10 hours making minor tweaks and cleanups to that code (which will be useful when I next use the library code anyway) and somewhere around 40 hours figuring out the protocol and writing the spiped specific code. Having a simple secure pipe tool will save me far more time than that, once you count things like wanting to programmatically set up encrypted pipes (for which spiped's command line and arbitrary key is much better than stunnel's configuration file and SSL certificates). effectively it only really differs in connection setup And connection setup is a big deal. That's where almost all the vulnerabilities happen. In SSL, you go through a complicated handshake before you can decide that the client you're talking to doesn't have the right keys; in spiped, you exchange 256-bit nonces, and then if the very next buffer you read doesn't have right right HMAC, the connection is dropped. Evil data never meets asymmetric crypto. If an attacker doesn't have the key, they can't force you to burn any significant amount of CPU time.