facebook/conceal — pull request #9 by siyengar (2014-01-30 09:09:44+00:00)
Title: Add versions to mac and cipher streams.

Currently the mac and cipher streams do not maintain versioning
of their own but rely on higher layers for verisioning.

However some apps could store data persistently and not having
versioning might make it difficult for apps to upgrade libs.

This adds 2 version numbers to macs and ciphers
1. CIPHER_SERIALIZATION_VERSION / MAC_* : Determines the wire format of
the rest of the message
2. CIPHER_ID / MAC_ID: Determines the id of the encryption algorithm
used + the framing format for the algorithm.

We also add authentication of the IDs to protect against cross-protocol
attacks if algorithms are changed in the future.

Test Plan:
Ran both the unit tests and the integration tests.
They both pass with flying colors.