14
14
15
15
#include <string.h>
16
16
17
- #include "atecc/atecc.h"
18
17
#include "cipher/cipher.h"
19
18
#include "hardfault.h"
20
19
#include "keystore.h"
23
22
#include "random.h"
24
23
#include "reset.h"
25
24
#include "salt.h"
25
+ #include "securechip/securechip.h"
26
26
#include "util.h"
27
27
28
28
#include <rust/rust.h>
@@ -72,7 +72,7 @@ USE_RESULT static keystore_error_t _stretch_retained_seed_encryption_key(
72
72
if (!salt_hash_data (encryption_key , 32 , purpose_in , salted_hashed )) {
73
73
return KEYSTORE_ERR_SALT ;
74
74
}
75
- if (atecc_kdf (salted_hashed , 32 , out )) {
75
+ if (securechip_kdf (salted_hashed , 32 , out )) {
76
76
return KEYSTORE_ERR_SECURECHIP ;
77
77
}
78
78
if (!salt_hash_data (encryption_key , 32 , purpose_out , salted_hashed )) {
@@ -188,7 +188,7 @@ static keystore_error_t _stretch_password(
188
188
memcpy (kdf_in , password_salted_hashed , 32 );
189
189
190
190
// First KDF on rollkey increments the monotonic counter. Call only once!
191
- int securechip_result = atecc_kdf_rollkey (kdf_in , 32 , kdf_out );
191
+ int securechip_result = securechip_kdf_rollkey (kdf_in , 32 , kdf_out );
192
192
if (securechip_result ) {
193
193
if (securechip_result_out != NULL ) {
194
194
* securechip_result_out = securechip_result ;
@@ -198,7 +198,7 @@ static keystore_error_t _stretch_password(
198
198
// Second KDF does not use the counter and we call it multiple times.
199
199
for (int i = 0 ; i < KDF_NUM_ITERATIONS ; i ++ ) {
200
200
memcpy (kdf_in , kdf_out , 32 );
201
- securechip_result = atecc_kdf (kdf_in , 32 , kdf_out );
201
+ securechip_result = securechip_kdf (kdf_in , 32 , kdf_out );
202
202
if (securechip_result ) {
203
203
if (securechip_result_out != NULL ) {
204
204
* securechip_result_out = securechip_result ;
@@ -302,7 +302,7 @@ keystore_error_t keystore_encrypt_and_store_seed(
302
302
// Update the two kdf keys before setting a new password. This already
303
303
// happens on a device reset, but we do it here again anyway so the keys are
304
304
// initialized also on first use, reducing trust in the factory setup.
305
- if (!atecc_update_keys ()) {
305
+ if (!securechip_update_keys ()) {
306
306
return KEYSTORE_ERR_SECURECHIP ;
307
307
}
308
308
uint8_t secret [32 ] = {0 };
0 commit comments