[2/5] common/cnxk: derive hash key for MACsec
Checks
Commit Message
Signed-off-by: Akhil Goyal <gakhil@marvell.com>
---
drivers/common/cnxk/roc_aes.c | 17 +++++++++++++++++
drivers/common/cnxk/roc_aes.h | 2 ++
drivers/common/cnxk/version.map | 1 +
3 files changed, 20 insertions(+)
@@ -206,3 +206,20 @@ roc_aes_xcbc_key_derive(const uint8_t *auth_key, uint8_t *derived_key)
cipher(k3, derived_key, aes_ks);
}
+
+void
+roc_aes_hash_key_derive(const uint8_t *key, uint16_t len, uint8_t hash_key[])
+{
+ uint32_t aes_ks[KEY_SCHEDULE_LEN] = {0};
+ uint8_t data[16] = {0x0};
+ int i;
+
+ if (len == 16) {
+ aes_key_expand(key, aes_ks);
+ cipher(data, hash_key, aes_ks);
+ for (i = 0; i < 16; i++)
+ plt_info(" 0x%x", hash_key[i]);
+ } else {
+ plt_err("\n AES-256 key conversion not supported");
+ }
+}
@@ -10,5 +10,7 @@
*/
void __roc_api roc_aes_xcbc_key_derive(const uint8_t *auth_key,
uint8_t *derived_key);
+void __roc_api roc_aes_hash_key_derive(const uint8_t *key, uint16_t len,
+ uint8_t *hash_key);
#endif /* _ROC_AES_H_ */
@@ -29,6 +29,7 @@ INTERNAL {
roc_ae_ec_grp_put;
roc_ae_fpm_get;
roc_ae_fpm_put;
+ roc_aes_hash_key_derive;
roc_aes_xcbc_key_derive;
roc_bphy_cgx_cpri_mode_change;
roc_bphy_cgx_cpri_mode_misc;