7 ms·
Worth also knowing that the Go team has made significant improvements in crypto speed: https://code.google.com/p/go/source/detail?r=eb2c99e6ec17db272ef3a20fa41
by jgrahamc 14y ago
Worth also knowing that the Go team has made significant improvements in crypto speed:
https://code.google.com/p/go/source/detail?r=eb2c99e6ec17db272ef3a20fa416f3fe86ba9f29 https://code.google.com/p/go/source/detail?r=eb2c99e6ec17db2...
https://code.google.com/p/go/source/detail?r=e7304334527349c395f150e109296dfc0f81d271 https://code.google.com/p/go/source/detail?r=e7304334527349c...
https://code.google.com/p/go/source/detail?r=e5620fd3ba5fb1d5fb083dbba864ca66d84fa859 https://code.google.com/p/go/source/detail?r=e5620fd3ba5fb1d...
Fast approaching OpenSSL speeds.
Also, the integration of the network poller into the main scheduler is likely to make a big difference to Go programs that make heavy use of the network.
- drewcoo 14y agoSo I can't tell easily (mea culpa, I'm new to Go) but were the crypto speedups also timing-attack-safe?
- laurent123456 14y agoShouldn't that be a property of the algorithm rather than the implementation? I mean as long as they implement the algorithm correctly, do they need to care about being timing-attack-safe?
- pbsd 14y agoYes and no. Certain algorithms make it harder to do timing-resistant implementations, but by no means impossible. Probably the easiest mistake to make is on DH/RSA exponentiation. Using the simple square-and-multiply algorithm gives away plenty of timing data; you usually need to explicitly protect against it by either using blinding or always performing both the square and multiply at each iteration.
- arnehormann 14y agoYes, they do. Read http://www.imperialviolet.org/2013/02/04/luckythirteen.html http://www.imperialviolet.org/2013/02/04/luckythirteen.html - even a division in the cpu may introduce timing differences depending on the input (bottom of the blog post). https://groups.google.com/forum/?fromgroups=#!topic/golang-nuts/HF5O5vAKRcQ https://groups.google.com/forum/?fromgroups=#!topic/golang-n... indicates golangs implentation may not be timing attack safe, but that's another version and I don't know for sure.
- _ak 14y agoCan't speak about the speedups per se, but since the standard library has a package with certain operations necessary in crypto implementations to preempt timing attacks, I would say they know what they're doing: http://golang.org/pkg/crypto/subtle/ http://golang.org/pkg/crypto/subtle/
- dchest 14y agoagl (https://news.ycombinator.com/user?id=agl https://news.ycombinator.com/user?id=agl) knows better, as he wrote most crypto in Go, but here's what I know. AES and RC4 in Go standard library are not constant time. AES should be timing safe when used on amd64 CPU with AES instructions. RSA is blinded, but not constant time, and ECC is not constant time (amd64 implementation of curve25519 in go.crypto is constant time, though). The linked hash functions (MD5 and SHA1) shouldn't be used for cryptography, but they and SHA-2 should be safe as there are no loads or branches that depend on secret data. If you want a timing safe cipher, use (X)Salsa20 from go.crypto repository.
- SagelyGuru 14y agoGood work! While speedups of go of the order of 30% in general are a good thing, they do point at the relative immaturity of the language. You would not be able to get these kinds of seedups in gcc, where tings presumably already are close to optimal. Another worry I have is the 'backwards compatibility'. It sounds good but in the long run creates its own problems. I think Java and even Python run into major problems with this.
- mseepgood 14y agoWasn't it Python 3 having major problems by not being backwards compatible? Django still doesn't support Python 3.
- fulafel 14y ago> [Speedups] point at the relative immaturity of the language. You would not be able to get these kinds of seedups in gcc, where tings presumably already are close to optimal If you actually follow the links, you will see they are reimplementations of the algorithms in assembly. GCC doesn't have any crypto code, fast or otherwise. Crypto algorithms routinely get dramatic speedups when going from C to hand-coded assembly, C compilers produce code that is far from optimal. See eg. http://cr.yp.to/aes-speed.html http://cr.yp.to/aes-speed.html
- laumars 14y ago> Another worry I have is the 'backwards compatibility'. It sounds good > but in the long run creates its own problems. I think Java and even > Python run into major problems with this. At this point in Go's life, it makes more sense to be backwards compatible as the last thing you want to do is turn your back on your small current developer base. As Go grows and people have started adapting to the changes, then you can start depreciating the old stuff.