@@ -49,18 +49,6 @@ typedef struct {
49
49
void (* const random_32_bytes )(uint8_t * buf );
50
50
} securechip_interface_functions_t ;
51
51
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
-
64
52
/**
65
53
* Initializes the cryptoauthlib communication, by providing a custom i2c chip
66
54
* 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);
80
68
USE_RESULT bool securechip_update_keys (void );
81
69
82
70
/**
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
85
83
* monotonic counter Counter0.
86
- * @param[in] slot should be one of SECURECHIP_SLOT_ROLLKEY and
87
- * SECURECHIP_SLOT_KDF.
88
84
* @param[in] msg Use this msg as input
89
85
* @param[in] len Must be <= 127.
90
86
* @param[out] kdf_out Must have size 32. Result of the kdf will be stored here.
91
87
* Cannot be the same as `msg`.
92
88
* @return values of `securechip_error_t` if negative, values of `ATCA_STATUS` if positive, 0 on
93
89
*/
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 );
99
91
100
92
/**
101
93
* Generates a new attestation device key and outputs the public key.
0 commit comments