@@ -49,18 +49,6 @@ typedef struct {
4949 void (* const random_32_bytes )(uint8_t * buf );
5050} securechip_interface_functions_t ;
5151
52- typedef enum {
53- SECURECHIP_SLOT_IO_PROTECTION_KEY = 0 ,
54- SECURECHIP_SLOT_AUTHKEY = 1 ,
55- SECURECHIP_SLOT_ENCRYPTION_KEY = 2 ,
56- SECURECHIP_SLOT_ROLLKEY = 3 ,
57- SECURECHIP_SLOT_KDF = 4 ,
58- SECURECHIP_SLOT_ATTESTATION = 5 ,
59- SECURECHIP_SLOT_ECC_UNSAFE_SIGN = 6 ,
60- SECURECHIP_SLOT_DATA0 = 9 ,
61- // The other slots are currently not in use.
62- } securechip_slot_t ;
63-
6452/**
6553 * Initializes the cryptoauthlib communication, by providing a custom i2c chip
6654 * communication interface/bridge to cryptoauthlib. On first call, the chip
@@ -80,22 +68,26 @@ USE_RESULT int securechip_setup(const securechip_interface_functions_t* ifs);
8068USE_RESULT bool securechip_update_keys (void );
8169
8270/**
83- * Perform KDF using the key in predefined slot with the input msg.
84- * Calling this function for SECURECHIP_SLOT_ROLLKEY also increments the
71+ * Perform HMAC using the key in KDF slot with the input msg.
72+ * @param[in] msg Use this msg as input
73+ * @param[in] len Must be <= 127.
74+ * @param[out] kdf_out Must have size 32. Result of the kdf will be stored here.
75+ * Cannot be the same as `msg`.
76+ * @return values of `securechip_error_t` if negative, values of `ATCA_STATUS` if positive, 0 on
77+ */
78+ USE_RESULT int securechip_kdf (const uint8_t * msg , size_t len , uint8_t * kdf_out );
79+
80+ /**
81+ * Perform KDF using the key in rollkey slot with the input msg.
82+ * Calling this function increments the
8583 * monotonic counter Counter0.
86- * @param[in] slot should be one of SECURECHIP_SLOT_ROLLKEY and
87- * SECURECHIP_SLOT_KDF.
8884 * @param[in] msg Use this msg as input
8985 * @param[in] len Must be <= 127.
9086 * @param[out] kdf_out Must have size 32. Result of the kdf will be stored here.
9187 * Cannot be the same as `msg`.
9288 * @return values of `securechip_error_t` if negative, values of `ATCA_STATUS` if positive, 0 on
9389 */
94- USE_RESULT int securechip_kdf (
95- securechip_slot_t slot ,
96- const uint8_t * msg ,
97- size_t len ,
98- uint8_t * kdf_out );
90+ USE_RESULT int securechip_kdf_rollkey (const uint8_t * msg , size_t len , uint8_t * kdf_out );
9991
10092/**
10193 * Generates a new attestation device key and outputs the public key.
0 commit comments