1414
1515#include <string.h>
1616
17- #include "atecc/atecc.h"
1817#include "cipher/cipher.h"
1918#include "hardfault.h"
2019#include "keystore.h"
2322#include "random.h"
2423#include "reset.h"
2524#include "salt.h"
25+ #include "securechip/securechip.h"
2626#include "util.h"
2727
2828#include <rust/rust.h>
@@ -72,7 +72,7 @@ USE_RESULT static keystore_error_t _stretch_retained_seed_encryption_key(
7272 if (!salt_hash_data (encryption_key , 32 , purpose_in , salted_hashed )) {
7373 return KEYSTORE_ERR_SALT ;
7474 }
75- if (atecc_kdf (salted_hashed , 32 , out )) {
75+ if (securechip_kdf (salted_hashed , 32 , out )) {
7676 return KEYSTORE_ERR_SECURECHIP ;
7777 }
7878 if (!salt_hash_data (encryption_key , 32 , purpose_out , salted_hashed )) {
@@ -188,7 +188,7 @@ static keystore_error_t _stretch_password(
188188 memcpy (kdf_in , password_salted_hashed , 32 );
189189
190190 // 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 );
192192 if (securechip_result ) {
193193 if (securechip_result_out != NULL ) {
194194 * securechip_result_out = securechip_result ;
@@ -198,7 +198,7 @@ static keystore_error_t _stretch_password(
198198 // Second KDF does not use the counter and we call it multiple times.
199199 for (int i = 0 ; i < KDF_NUM_ITERATIONS ; i ++ ) {
200200 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 );
202202 if (securechip_result ) {
203203 if (securechip_result_out != NULL ) {
204204 * securechip_result_out = securechip_result ;
@@ -302,7 +302,7 @@ keystore_error_t keystore_encrypt_and_store_seed(
302302 // Update the two kdf keys before setting a new password. This already
303303 // happens on a device reset, but we do it here again anyway so the keys are
304304 // initialized also on first use, reducing trust in the factory setup.
305- if (!atecc_update_keys ()) {
305+ if (!securechip_update_keys ()) {
306306 return KEYSTORE_ERR_SECURECHIP ;
307307 }
308308 uint8_t secret [32 ] = {0 };
0 commit comments