chiark / gitweb /
server/bulkcrypto.c: Adjust the scale in the data-format diagrams.
[tripe] / server / bulkcrypto.c
index 9af4bb8ce063ac0fb4d2b77f6ab257638a4e68ef..10b51d60883e8ce572aa6385e56f2bb0b54be282 100644 (file)
@@ -285,10 +285,10 @@ static void gencomp_freechal(bulkchal *bc)
  * encrypt the input message with the cipher, and format the type, sequence
  * number, IV, and ciphertext as follows.
  *
- *             +------+ +------+---...---+------...------+
- *             | type | | seq  |   iv    |   ciphertext  |
- *             +------+ +------+---...---+------...------+
- *                32       32     blksz         sz
+ *             +--------+ +--------+---...---+------...------+
+ *             |  type  | |  seq   |   iv    |   ciphertext  |
+ *             +--------+ +--------+---...---+------...------+
+ *                 32         32      blksz         sz
  *
  * All of this is fed into the MAC to compute a tag.  The type is not
  * transmitted: the other end knows what type of message it expects, and the
@@ -296,10 +296,10 @@ static void gencomp_freechal(bulkchal *bc)
  * kind of ciphertext has been substituted.  The tag is prepended to the
  * remainder, to yield the finished cryptogram, as follows.
  *
- *             +---...---+------+---...---+------...------+
- *             |   tag   | seq  |   iv    |   ciphertext  |
- *             +---...---+------+---...---+------...------+
- *                tagsz     32     blksz         sz
+ *             +---...---+--------+---...---+------...------+
+ *             |   tag   |  seq   |   iv    |   ciphertext  |
+ *             +---...---+--------+---...---+------...------+
+ *                tagsz      32      blksz         sz
  *
  * Decryption: checks the overall size, verifies the tag, then decrypts the
  * ciphertext and extracts the sequence number.
@@ -527,10 +527,10 @@ static int v0_decrypt(bulkctx *bbc, unsigned ty,
  *
  * So, a MAC is computed over
  *
- *             +------+ +------+------...------+
- *             | type | | seq  |   ciphertext  |
- *             +------+ +------+------...------+
- *                32       32         sz
+ *             +--------+ +--------+------...------+
+ *             |  type  | |  seq   |   ciphertext  |
+ *             +--------+ +--------+------...------+
+ *                 32         32          sz
  *
  * and we actually transmit the following as the cryptogram.
  *
@@ -824,17 +824,17 @@ static int iiv_decrypt(bulkctx *bbc, unsigned ty,
  * Catacomb's current AEAD schemes are suitable.)  The low 32 bits are the
  * sequence number, and the high 32 bits are the type, both big-endian.
  *
- *             +------+------+
- *             | seq  | type |
- *             +------+------+
- *                32     32
+ *             +--------+--------+
+ *             |  seq   |  type  |
+ *             +--------+--------+
+ *                 32       32
  *
  * The ciphertext is formatted as
  *
- *             +---...---+------+------...------+
- *             |   tag   | seq  |   ciphertext  |
- *             +---...---+------+------...------+
- *                tagsz     32         sz
+ *             +---...---+--------+------...------+
+ *             |   tag   |  seq   |   ciphertext  |
+ *             +---...---+--------+------...------+
+ *                tagsz      32          sz
  *
  */
 
@@ -1149,10 +1149,10 @@ static int aead_decrypt(bulkctx *bbc, unsigned ty,
  * Salsa20 and ChaCha accept a 64-bit nonce.  The low 32 bits are the
  * sequence number, and the high 32 bits are the type, both big-endian.
  *
- *             +------+------+
- *             | seq  | type |
- *             +------+------+
- *                32     32
+ *             +--------+--------+
+ *             |  seq   |  type  |
+ *             +--------+--------+
+ *                 32       32
  *
  * A stream is generated by concatenating the raw output blocks generated
  * with this nonce and successive counter values starting from zero.  The