# Why is the subhash key (H) of AES-GCM defined as such?

From what I've read in section 5.3 of NIST 800-38D it states:

The hash subkey, denoted H, is generated by applying the block cipher to the “zero” block.

In serious crypto J.P Aumasson describes the implementation of it as H = AES(K,0) for a single block of zeros, hence no block chaining mode, hence no IV as I understand it. Therefore the mapping between H and K should be universally constant.

The book notes:

In GCM, GHASH doesn't use K directly in order to ensure that if GHASH's key is compromised, the master key K remains secret. Given K, you can get H by computing AES(K,0), but you can't recover K from that value since K acts as AES's key.

If the mapping is universally constant wouldn't it be the case that this could be pre-computed and available somewhere? (I wanted to say rainbow table here, but that probably doesn't quite apply based on what I read in this response)

So is the strength just that storing this permutation space for later indexing is thought to be too large? Or is there more to it that what I laid out?

• fixed plaintext variable K is not always a bijection, there can be multiple K where encrypting 0 gives the same H – Richie Frame Dec 6 '17 at 14:57

In GCM, GHASH doesn't use K directly in order to ensure that if GHASH's key is compromised, the master key K remains secret.

Actually, there's not why GCM was designed the way it was (it may be an effect, but not the reason). Instead, the reasons were:

• To allow provable security (based on the assumption that the block cipher was a secure keyed random permutation). If we used $k$ as both the block cipher key, and used as an input to compute the tag, we need to make additional assumptions on the block cipher.

• Because of the size mismatch; $h$ is 128 bits, $k$ is (at least, for AES) is either 128, 192 or 256 bits. Yes, one could select an arbitrary section of $k$ as your $h$, however, that seems a bit, well, arbitrary...

If the mapping is universally constant wouldn't it be the case that this could be pre-computed and available somewhere?

Not really, the effort of pre-computing such a table would be at least $O(2^{128})$ operations; we believe that is infeasible for anyone, even as a one-time effort. And, generating a rainbow table doesn't decrease this effort any; it just makes the generated table smaller...

• A secure keyed random permutation or a secure keyed pseudorandom permutation? – Melab Dec 6 '17 at 14:22
• @Melab: a keyed operation which is computationally indistinguishable from a random permutation – poncho Dec 6 '17 at 14:50

Therefore the mapping between H and K should be universally constant.

Well, no, of course not. Because $K$ is not universally constant. It is only constant for the same key. $K$ picks a permutation out of all possible permutations (for the set of keys). And therefore $K$ determines the value of $H$.

If the mapping is universally constant wouldn't it be the case that this could be pre-computed and available somewhere? (I wanted to say rainbow table here, but that probably doesn't quite apply based on what I read in this response)

So is the strength just that storing this permutation space for later indexing is thought to be too large? Or is there more to it that what I laid out?

Yes, because you cannot pre-compute a rainbow table for things like AES keys. You cannot compute nor store a table of $2^{128}$ elements, or even a large subset of the keys.

Rainbow tables work only for limited input ranges; relatively simple passwords - for instance - are in this category.

• I think the word mapping was important here, I never said k was constant. Someone above made a good point that it's not always a bijection, as block size is 128bits and key size is that or greater, hence by pigeonhole it won't be 1:1, but in the case where keysize is 128bits it wouldn't be too far off. – JoeKir Dec 6 '17 at 16:51
• There is a mapping from K to H. The order is important here because different elements of K will map to the same value within H. – Maarten Bodewes Dec 6 '17 at 17:02