summaryrefslogtreecommitdiff
path: root/src/ref/lilliput-i.c
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2019-06-27 16:36:11 +0200
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2019-07-05 11:16:58 +0200
commitde866ad56fd465e89c9df6c6e12e0819098be386 (patch)
treef666b2efb3acca5fa385a634eff7511d1b0a4707 /src/ref/lilliput-i.c
parenta8da992171ac09ccca931f9909f5b199042b2ea8 (diff)
downloadlilliput-ae-implem-de866ad56fd465e89c9df6c6e12e0819098be386.tar.xz
Réécriture des commentaires schématiques sur les tweaks
Diffstat (limited to 'src/ref/lilliput-i.c')
-rw-r--r--src/ref/lilliput-i.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/ref/lilliput-i.c b/src/ref/lilliput-i.c
index fb06237..3358b10 100644
--- a/src/ref/lilliput-i.c
+++ b/src/ref/lilliput-i.c
@@ -44,13 +44,15 @@ static uint8_t _lower_nibble(uint8_t i)
static void _init_msg_tweak(const uint8_t N[NONCE_BYTES], uint8_t tweak[TWEAK_BYTES])
{
- /* With an s-bit block index, the t-bit tweak is filled as follows:
+ /* The t-bit tweak is filled as follows:
*
- * [ 1, 4]: 4-bit prefix
- * [ 5, |N|+4]: nonce
- * [ |N|+5, t]: block index
- * [|N|+5, t-s]: 0-padding
- * [t-s+1, t]: actual block index, from MSB to LSB
+ * 1 4 5 |N|+4 |N|+5 t
+ * [ prefix || nonce || block index ]
+ *
+ * The s-bit block index is encoded as follows:
+ *
+ * |N|+5 t-s t-s+1 t
+ * [ zero padding || block index, MSB first ]
*
* This function sets bits 5 to t-s once and for all.
*/
@@ -77,13 +79,15 @@ static void _fill_msg_tweak(
uint8_t tweak[TWEAK_BYTES]
)
{
- /* With an s-bit block index, the t-bit tweak is filled as follows:
+ /* The t-bit tweak is filled as follows:
+ *
+ * 1 4 5 |N|+4 |N|+5 t
+ * [ prefix || nonce || block index ]
+ *
+ * The s-bit block index is encoded as follows:
*
- * [ 1, 4]: 4-bit prefix
- * [ 5, |N|+4]: nonce
- * [ |N|+5, t]: block index
- * [|N|+5, t-s]: 0-padding
- * [t-s+1, t]: actual block index, from MSB to LSB
+ * |N|+5 t-s t-s+1 t
+ * [ zero padding || block index, MSB first ]
*
* This function assumes bits 5 to t-s have already been set, and
* only sets bits 1 to 4 and t-s+1 to t.