xref: /openbmc/phosphor-net-ipmid/rmcp.hpp (revision 9d9b7638)
19b307be6SVernon Mauery #pragma once
29b307be6SVernon Mauery 
39b307be6SVernon Mauery #include <array>
4*9d9b7638SAndrew Geissler #include <cstddef>
59b307be6SVernon Mauery #include <cstdint>
69b307be6SVernon Mauery 
79b307be6SVernon Mauery namespace rmcp
89b307be6SVernon Mauery {
99b307be6SVernon Mauery 
109b307be6SVernon Mauery /*
119b307be6SVernon Mauery  * RSP needs more keying material than can be provided by session
129b307be6SVernon Mauery  * integrity key alone. As a result all keying material for the RSP
139b307be6SVernon Mauery  * confidentiality algorithms will be generated by processing a
149b307be6SVernon Mauery  * pre-defined set of constants using HMAC per [RFC2104], keyed by SIK.
159b307be6SVernon Mauery  * These constants are constructed using a hexadecimal octet value
169b307be6SVernon Mauery  * repeated up to the HMAC block size in length starting with the
179b307be6SVernon Mauery  * constant 01h. This mechanism can be used to derive up to 255
189b307be6SVernon Mauery  * HMAC-block-length pieces of keying material from a single SIK.For the
199b307be6SVernon Mauery  * mandatory confidentiality algorithm AES-CBC-128, processing the
209b307be6SVernon Mauery  * following constant will generate the required amount of keying
219b307be6SVernon Mauery  * material.
229b307be6SVernon Mauery  */
239b307be6SVernon Mauery constexpr size_t CONST_N_SIZE = 20;
249b307be6SVernon Mauery using Const_n = std::array<uint8_t, CONST_N_SIZE>;
259b307be6SVernon Mauery 
269e801a2bSVernon Mauery static constexpr Const_n const_1 = {0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
279e801a2bSVernon Mauery                                     0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
289e801a2bSVernon Mauery                                     0x01, 0x01, 0x01, 0x01, 0x01, 0x01};
299b307be6SVernon Mauery 
309e801a2bSVernon Mauery static constexpr Const_n const_2 = {0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
319e801a2bSVernon Mauery                                     0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
329e801a2bSVernon Mauery                                     0x02, 0x02, 0x02, 0x02, 0x02, 0x02};
339b307be6SVernon Mauery 
349b307be6SVernon Mauery } // namespace rmcp
35