From 6d433edc3887d007b20c9dc6ee05dfcc1b459b1f Mon Sep 17 00:00:00 2001 From: ClaraCrazy Date: Sun, 4 Jun 2023 10:48:46 +0200 Subject: [PATCH 1/2] Add furi_hal_version_uid_default (Fix TOTP) --- applications/external/totp/services/crypto/crypto.c | 2 +- firmware/targets/f7/api_symbols.csv | 3 ++- firmware/targets/f7/furi_hal/furi_hal_version.c | 4 ++++ firmware/targets/furi_hal_include/furi_hal_version.h | 2 ++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/applications/external/totp/services/crypto/crypto.c b/applications/external/totp/services/crypto/crypto.c index 03d9c9d51..d01fe5c11 100644 --- a/applications/external/totp/services/crypto/crypto.c +++ b/applications/external/totp/services/crypto/crypto.c @@ -90,7 +90,7 @@ CryptoSeedIVResult max_i = uid_size; } - const uint8_t* uid = furi_hal_version_uid(); + const uint8_t* uid = furi_hal_version_uid_default(); for(uint8_t i = 0; i < max_i; i++) { plugin_state->iv[i] = plugin_state->iv[i] ^ uid[i]; } diff --git a/firmware/targets/f7/api_symbols.csv b/firmware/targets/f7/api_symbols.csv index c033cf3ea..5128fdace 100644 --- a/firmware/targets/f7/api_symbols.csv +++ b/firmware/targets/f7/api_symbols.csv @@ -1,5 +1,5 @@ entry,status,name,type,params -Version,+,28.2,, +Version,+,28.3,, Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli_vcp.h,, @@ -1481,6 +1481,7 @@ Function,+,furi_hal_version_get_otp_version,FuriHalVersionOtpVersion, Function,-,furi_hal_version_init,void, Function,-,furi_hal_version_set_name,void,const char* Function,+,furi_hal_version_uid,const uint8_t*, +Function,+,furi_hal_version_uid_default,const uint8_t*, Function,+,furi_hal_version_uid_size,size_t, Function,-,furi_hal_vibro_init,void, Function,+,furi_hal_vibro_on,void,_Bool diff --git a/firmware/targets/f7/furi_hal/furi_hal_version.c b/firmware/targets/f7/furi_hal/furi_hal_version.c index d0857f288..0e5f428ba 100644 --- a/firmware/targets/f7/furi_hal/furi_hal_version.c +++ b/firmware/targets/f7/furi_hal/furi_hal_version.c @@ -314,6 +314,10 @@ size_t furi_hal_version_uid_size() { return 64 / 8; } +const uint8_t* furi_hal_version_uid_default() { + return (const uint8_t*)UID64_BASE; +} + const uint8_t* furi_hal_version_uid() { if(version_get_custom_name(NULL) != NULL) { return (const uint8_t*)&(*((uint32_t*)version_get_custom_name(NULL))); diff --git a/firmware/targets/furi_hal_include/furi_hal_version.h b/firmware/targets/furi_hal_include/furi_hal_version.h index f5e5ca49a..4a3f4c170 100644 --- a/firmware/targets/furi_hal_include/furi_hal_version.h +++ b/firmware/targets/furi_hal_include/furi_hal_version.h @@ -204,6 +204,8 @@ size_t furi_hal_version_uid_size(); */ const uint8_t* furi_hal_version_uid(); +const uint8_t* furi_hal_version_uid_default(); + #ifdef __cplusplus } #endif From a12f563d1c44b9bd6b71035bc50f6a4b8cfea4bf Mon Sep 17 00:00:00 2001 From: ClaraCrazy Date: Sun, 4 Jun 2023 10:56:53 +0200 Subject: [PATCH 2/2] revert in app, dumb idea, needs some more work. --- applications/external/totp/services/crypto/crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/external/totp/services/crypto/crypto.c b/applications/external/totp/services/crypto/crypto.c index d01fe5c11..03d9c9d51 100644 --- a/applications/external/totp/services/crypto/crypto.c +++ b/applications/external/totp/services/crypto/crypto.c @@ -90,7 +90,7 @@ CryptoSeedIVResult max_i = uid_size; } - const uint8_t* uid = furi_hal_version_uid_default(); + const uint8_t* uid = furi_hal_version_uid(); for(uint8_t i = 0; i < max_i; i++) { plugin_state->iv[i] = plugin_state->iv[i] ^ uid[i]; }