Score:0

AES GCM representation of lev(IV) in IV padding to compute ICB

cn flag

I have a question regarding understanding representation of length in AES-GCM while doing padding for the IV to calculate ICB/J0. In the aes GCM test vectors testcase5 I see the IV is of length 8 bytes as follows:

IV cafebabefacedbad

But len({})||len(IV ) is mentioned as

00000000000000000000000000000040

but since the length of IV is of 8 bytes in length the representation len({})||len(IV ) should be as follows

00000000000000000000000000000008

Can someone help me in understanding whether how the len(IV) which is of 8 bytes is of 40 instead of 8.

Edit 1:

For IV of length 60, I see it was represented as

000000000000000000000000000001e0

As it was mentioned in comments, if we see the pattern whatever the IV length is it is multiplied by 8 when its get represented with len(IV). Any thoughts on this?

Maarten Bodewes avatar
in flag
$0x40 = 64$. Similarly, $8 \cdot 8 = 64$. Coincidence? I think not!
sg777 avatar
cn flag
For IV of length 60, i see it was represented as `000000000000000000000000000001e0`. Since `0x1e0 = 480`, i.e `60.8 = 480`. So if we go with this logic, why the actual length is multiplied by .8 when representing len(IV), any thoughts on this?
sg777 avatar
cn flag
Got it, len() is a bit string length, i miscalculated it as byte string length.
Maarten Bodewes avatar
in flag
Great, I think this was a simple misunderstanding, otherwise I'd have answered. Let me know if I should post one.
sg777 avatar
cn flag
sure, your 1st comment helped me, please post. thank you.
Score:1
in flag

Usually in lower level algorithm descriptions the size indications - such as key size - is indicated in bits, not bytes. So internally we see that the IV size is also described in bits.

So the value that you are seeing is 0x40 in hex or 64 in decimals, itself encoded in a static amount of bits. Although the IV is generally always a multiple of bytes, the algorithm uses bit-length. So for your 8 bytes, the 0x40 value is correct, as 8 x 8 = 64.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.