Question about GCM IV Length Support in HSE FW 2.40.0 and 2.55.0 Hello, I have a question regarding the GCM operation of the HSE on the S32K358. In the AEAD service description of the HSE Service API Reference Manual, both HSE FW 2.40.0 and 2.55.0 specify the following for GCM: GCM: 1 <= ivLength <= 2^32-1. Recommended 12 bytes or greater. However, the HSE FW 2.40.0 manual contains the following additional note, which is not present in the HSE FW 2.55.0 manual: In GCM operations, it is recommended to use IV values of exactly 12 bytes. For any IV size different from 12 bytes, the authentication tag generated by the GCM encryption operation might not be correct. In GCM decryption operations, the authentication check might fail. In this regard, I would like to clarify the following: 1. Can GCM operations be used normally in HSE FW 2.40.0 when the IV length is not 12 bytes? 2. Is there any behavioral difference in GCM operations between HSE FW 2.40.0 and 2.55.0 when using an IV length other than 12 bytes? 3. Is there any difference in the reliability of GCM operations between HSE FW 2.40.0 and 2.55.0 when using an IV length other than 12 bytes? In our tests, GCM encryption and decryption were performed successfully even when the IV length was not 12 bytes, and the authentication results were also correct. Therefore, I would like to confirm whether using an IV length other than 12 bytes is fully supported in HSE FW 2.40.0, and whether there is any functional difference compared to using HSE FW 2.55.0 in this case. Thank you for your clarification. Re: Question about GCM IV Length Support in HSE FW 2.40.0 and 2.55.0 Hi @wodudwo
Technically, ivLength can be configured with a different length; however, doing so is not recommended because the behavior is not guaranteed to be reliable. As you correctly pointed out, the documentation states that for GCM decryption operations, the authentication check may fail when IV lengths other than 12 bytes are used.
While your test may have passed using a different IV length, this does not guarantee that the operation will always succeed. In other words, a successful result in a particular test case should not be interpreted as an indication that the configuration is fully supported or will work consistently in all scenarios.
Additionally, if you review the release notes for both firmware versions, you will find that the List of Limitations includes the same recommendation: use IV values of exactly 12 bytes.
Although the note was removed from the HSE Service API Reference Manual starting with HSE FW 2.55.0, the limitation itself remains unchanged.
BR, VaneB Re: Question about GCM IV Length Support in HSE FW 2.40.0 and 2.55.0 Hi, Thank you for the clarification. I have one additional question regarding the use of an IV other than 12 bytes. I understand that the authentication tag generation/verification may not be reliable when a non-12-byte IV is used. In this case, can the encryption/decryption operation itself be considered reliable, regardless of the authentication tag? For example, if a 16-byte IV is used for GCM encryption, is the resulting ciphertext guaranteed to be correct and consistent, even though the authentication tag may not be reliable? In other words, is the limitation specific to the authentication tag generation/verification, or does using an IV other than 12 bytes also affect the reliability/correctness of the actual encryption/decryption operation? Thank you. Re: Question about GCM IV Length Support in HSE FW 2.40.0 and 2.55.0 Hi @wodudwo
As stated in the HSE Service API Reference Manual, the recommended IV length is within the range 1<= ivLength <= 2∧32-1 with 12 bytes or greater recommended.
Reference implementations are available in hse_crypto.c (S32K3 General Purpose HSE Demo Examples) and hse_sessionkeys_example.c (HSE DemoApp). Re: Question about GCM IV Length Support in HSE FW 2.40.0 and 2.55.0 Hi, thank you for your response. However, I would like to clarify one specific point that was not addressed in my previous question. If a non-12-byte IV, such as a 16-byte IV, is used for GCM: 1. Is the ciphertext generated by the encryption operation guaranteed to be correct and reliable? 2. Is the plaintext recovered by the decryption operation guaranteed to be correct and reliable? I understand that the authentication tag generation/verification may not be reliable with a non-12-byte IV. My question is whether this limitation also applies to the actual encryption/decryption result (ciphertext/plaintext), or whether the limitation is only related to the authentication tag. Could you please clarify this point specifically?
View full article