Speeding up and strengthening HTTPS connections for Chrome on Android
googleonlinesecurity.blogspot.com
googleonlinesecurity.blogspot.com
ChaCha20 is a refinement of Salsa20, which is probably Bernstein's best-known crypto design (it survived the eSTREAM contest to become one of the final portfolio ciphers). Bernstein wrote an extremely readable design paper on Salsa20:
http://cr.yp.to/snuffle/salsafamily-20071225.pdf
Salsa20 is essentially a fast hash function run in a carefully designed counter mode. If you don't care about speed, you can turn any secure hash function into a stream cipher by, for instance, running the HMAC of that hash in counter mode. Here, Bernstein has designed the Formula 1 car of hash cores to run quickly in software without side channels as the basis for a counter-mode stream cipher.
Poly1305 is, like the GHASH construction from GCM, a "polynomial MAC", which is the modern way to say "cryptographic CRC". Poly1305 was designed more carefully for software performance than GHASH. In particular, because it's based on binary fields, for competitive performance GHASH requires either hardware support (such as the Intel CLMUL instructions) or a table-based implementation that potentially leaks secrets from cache timing. Poly1305 is based on prime fields and is fast in software on platforms without instructions tailored to it. It is also mercifully easier to code (though maybe I'm just irrationally biased against binary field polynomial math).
Does that mean 25B->21B per-packet overhead? What percentage overhead are TLS headers?
There's always five bytes of record header: the record type, u16 length and u16 version. (The version is basically a waste.)
For AES-CBC there's an average of 8 bytes of padding (half the block size).
For AES-GCM there's eight bytes of wasted nonce because of FIPS concerns that appear to have been groundless.
Then there's the MAC: 20 bytes for HMAC-SHA1 or 16 for GCM or Poly1305.
But as for allowing handshake messages, alert messages etc to mix with application data, no.
(See the QUIC design as an example: https://docs.google.com/document/d/1g5nIXAIkN_Y-7XJW5K45IblH...)
I'm puzzled why a shorter MAC would be considered a good thing in a security application - because theoretically, a 20-byte MAC gives roughly 4 billion times the space of a 16-byte one. It's like shortening an encryption key - hasn't the trend been toward making them longer and thus more resistant to attack?
Considering the HMAC subset of MAC, the final value of the function should be of the same length of the base hash function.
So i.e. hmac-sha256 would be longer than hmac-sha1, but I don't understand why the latter would be simpler to check and of higher security.
Or do you mean that Poly1305 is all three (simpler, more secure, shorter mac) compared to the HMAC family?
Another difference is that old communication is not at risk. As soon as the client and server is upgraded, they are secure, as opposed to encryption where attackers may still recover sensitive information from things that were encrypted years ago. So it doesn't need the same degree of future proofing.
So while a 80-bit encryption key is on the weak end of the spectrum, even 80 bits of security is pretty conservative for a MAC.
I want SPDY, QUIC, and whatever cypher ordering magic is required to make my service faster on android. Unfortunately I probably won't be able to deploy this for at least a year because I have to wait on nginx and openSSL. By the time I could reasonably deploy this, shipping android phones will have the hardware to make this irrelevant.
Maybe google sees their in house webserver as a competitive advantage. Maybe their own internal infrastructure is too complicated to pull out a simple useful webserver.
I've used mod_spdy on Ubuntu 12.04 for several months now, and it seems to work pretty well.
You could also just truncate HMAC-SHA1 to 16 bytes, right?
Poly1305 is arguably less misuse-resistant, since it requires a nonce.