# 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 Dec 6, 2017 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? Dec 6, 2017 at 14:22
• @Melab: a keyed operation which is computationally indistinguishable from a random permutation Dec 6, 2017 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. Dec 6, 2017 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. Dec 6, 2017 at 17:02
{"ft_lang_label":"__label__en","ft_lang_prob":0.95637095,"math_prob":0.92832255,"size":1035,"snap":"2022-05-2022-21","text_gpt3_token_len":249,"char_repetition_ratio":0.086323954,"word_repetition_ratio":0.0,"special_character_ratio":0.23091787,"punctuation_ratio":0.10454545,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9883754,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-05-17T21:49:17Z\",\"WARC-Record-ID\":\"<urn:uuid:0d4d2929-dc5d-4b24-9d8b-8c3ece5ded75>\",\"Content-Length\":\"240683\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:f7464979-8181-4904-aee3-235e3f7f20e0>\",\"WARC-Concurrent-To\":\"<urn:uuid:027f60b1-74d8-4978-acc9-fbf517104625>\",\"WARC-IP-Address\":\"151.101.193.69\",\"WARC-Target-URI\":\"https://crypto.stackexchange.com/questions/53727/why-is-the-subhash-key-h-of-aes-gcm-defined-as-such\",\"WARC-Payload-Digest\":\"sha1:FJE6JZDWJUFCFUDEFOXHSTROQ4VX3DOE\",\"WARC-Block-Digest\":\"sha1:P6CM3U33TR2WFOQCUM6PEBOLDN6RUFBP\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-21/CC-MAIN-2022-21_segments_1652662520817.27_warc_CC-MAIN-20220517194243-20220517224243-00441.warc.gz\"}"}