aboutsummaryrefslogtreecommitdiff
path: root/lib/sec_library/include/keyram.h
diff options
context:
space:
mode:
authorthead_admin <occ_thead@service.alibaba.com>2022-09-13 11:04:33 +0800
committerthead_admin <occ_thead@service.alibaba.com>2022-09-13 11:04:33 +0800
commit43db9e00d5837c100c0b2fbbee64a08ab807d1e0 (patch)
treeb40c0eed02935b6682e8c5c975e3016b6b2f55fe /lib/sec_library/include/keyram.h
Linux_SDK_V0.9.5Linux_SDK_V0.9.5
Diffstat (limited to 'lib/sec_library/include/keyram.h')
-rw-r--r--lib/sec_library/include/keyram.h78
1 files changed, 78 insertions, 0 deletions
diff --git a/lib/sec_library/include/keyram.h b/lib/sec_library/include/keyram.h
new file mode 100644
index 00000000..6f8f706a
--- /dev/null
+++ b/lib/sec_library/include/keyram.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2017-2021 Alibaba Group Holding Limited
+ */
+
+/******************************************************************************
+ * @file keyram.h
+ * @brief CSI Source File for kdf Driver
+ * @version V1.0
+ * @date 12. MAR 2021
+ ******************************************************************************/
+
+#include "drv/kdf.h"
+#include <stdio.h>
+#include <string.h>
+
+#define KDF_CON 0x000
+#define KDF_KEYTRANSFER 0x004
+#define KDF_KEYINDEX 0x008
+#define KDF_INTCON 0x00C
+#define KDF_ZONE1SADDR 0x020
+#define KDF_ZONE2SADDR 0x030
+#define KDF_ZONE3SADDR 0x040
+#define KDF_RAMENC_KEY0H 0x058
+#define KDF_RAMENC_KEY0L 0x05c
+#define KDF_RAMENC_KEY1H 0x060
+#define KDF_RAMENC_KEY1L 0x064
+#define KDF_RAMENC_KEY2H 0x068
+#define KDF_RAMENC_KEY2L 0x06c
+#define KDF_RAMENC_KEY3H 0x070
+#define KDF_RAMENC_KEY3L 0x074
+#define KDF_MASK_RNG0 0x080
+#define KDF_MASK_RNG1 0x084
+#define KDF_MASK_RNG2 0x088
+#define KDF_MASK_RNG3 0x08c
+#define KDF_MASK_RNG4 0x090
+#define KDF_MASK_RNG5 0x094
+#define KDF_MASK_RNG6 0x098
+#define KDF_MASK_RNG7 0x09c
+#define KDF_STA 0x0a0
+#define KDF_IPID 0x0fc
+#define KDF_RAM 0x8000
+
+/**
+ * @brief keyram init.
+ *
+ * @return uint32_t
+ */
+uint32_t keyram_init();
+
+/**
+ * @brief keyram set key.
+ *
+ * @param key
+ * @param len
+ * @return uint32_t
+ */
+uint32_t keyram_set_key(csi_kdf_derived_key_t key, uint32_t len);
+
+/**
+ * @brief get key addr in keyram.
+ *
+ * @param key
+ * @param addr
+ * @return uint32_t
+ */
+uint32_t keyram_get_key_addr(csi_kdf_derived_key_t key, uint64_t *addr);
+
+/**
+ * @brief Clear key in keyram.
+ *
+ * @return uint32_t
+ */
+uint32_t keyram_clear();
+
+/**
+ * @brief Uninit. This function will lock KDF.
+ */
+void keyram_uninit();