Expose additional functions of the crypto engine to user (#2923)

* Allow loading user supplied keys and add CTR mode
* Add GCM mode to furi_hal_crypto
* Split up CTR and GCM code, add flag for adv crypto
* Add convenience functions for GCM crypto
* Run fbt format
* Update GCM to support additional auth data
* Update APIs
* FuriHal: update crypto documentation, method names and usage
* Clean up code for key (un)loading, GCM and CTR
  - get rid of goto
  - do not use furi_hal_bt_is_alive() when not using secure enclave
  - give defines a type and wrap in ()
* Add unit test for CTR and GCM crypto
* FuriHal: const in crypto unit tests, cortex timer for crypto operations timeouts
* FuriHal: update crypto docs

Co-authored-by: twisted_pear <twstd@posteo.net>
Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
twisted-pear
2023-08-10 17:44:46 +09:00
committed by GitHub
co-authored by twisted_pear hedger あく
parent fb63e53d9a
commit c976ff11bf
10 changed files with 1301 additions and 92 deletions
+12 -6
View File
@@ -1,5 +1,5 @@
entry,status,name,type,params
Version,+,34.4,,
Version,+,35.0,,
Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,,
@@ -1036,14 +1036,20 @@ Function,+,furi_hal_cortex_instructions_per_microsecond,uint32_t,
Function,+,furi_hal_cortex_timer_get,FuriHalCortexTimer,uint32_t
Function,+,furi_hal_cortex_timer_is_expired,_Bool,FuriHalCortexTimer
Function,+,furi_hal_cortex_timer_wait,void,FuriHalCortexTimer
Function,+,furi_hal_crypto_ctr,_Bool,"const uint8_t*, const uint8_t*, const uint8_t*, uint8_t*, size_t"
Function,+,furi_hal_crypto_decrypt,_Bool,"const uint8_t*, uint8_t*, size_t"
Function,+,furi_hal_crypto_encrypt,_Bool,"const uint8_t*, uint8_t*, size_t"
Function,+,furi_hal_crypto_gcm,_Bool,"const uint8_t*, const uint8_t*, const uint8_t*, size_t, const uint8_t*, uint8_t*, size_t, uint8_t*, _Bool"
Function,+,furi_hal_crypto_gcm_decrypt_and_verify,FuriHalCryptoGCMState,"const uint8_t*, const uint8_t*, const uint8_t*, size_t, const uint8_t*, uint8_t*, size_t, const uint8_t*"
Function,+,furi_hal_crypto_gcm_encrypt_and_tag,FuriHalCryptoGCMState,"const uint8_t*, const uint8_t*, const uint8_t*, size_t, const uint8_t*, uint8_t*, size_t, uint8_t*"
Function,-,furi_hal_crypto_init,void,
Function,+,furi_hal_crypto_store_add_key,_Bool,"FuriHalCryptoKey*, uint8_t*"
Function,+,furi_hal_crypto_store_load_key,_Bool,"uint8_t, const uint8_t*"
Function,+,furi_hal_crypto_store_unload_key,_Bool,uint8_t
Function,+,furi_hal_crypto_verify_enclave,_Bool,"uint8_t*, uint8_t*"
Function,+,furi_hal_crypto_verify_key,_Bool,uint8_t
Function,+,furi_hal_crypto_load_key,_Bool,"const uint8_t*, const uint8_t*"
Function,+,furi_hal_crypto_enclave_store_key,_Bool,"FuriHalCryptoKey*, uint8_t*"
Function,+,furi_hal_crypto_enclave_load_key,_Bool,"uint8_t, const uint8_t*"
Function,+,furi_hal_crypto_enclave_unload_key,_Bool,uint8_t
Function,+,furi_hal_crypto_unload_key,_Bool,
Function,+,furi_hal_crypto_enclave_verify,_Bool,"uint8_t*, uint8_t*"
Function,+,furi_hal_crypto_enclave_ensure_key,_Bool,uint8_t
Function,+,furi_hal_debug_disable,void,
Function,+,furi_hal_debug_enable,void,
Function,+,furi_hal_debug_is_gdb_session_active,_Bool,
1 entry status name type params
2 Version + 34.4 35.0
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/cli/cli.h
5 Header + applications/services/cli/cli_vcp.h
1036 Function + furi_hal_cortex_timer_get FuriHalCortexTimer uint32_t
1037 Function + furi_hal_cortex_timer_is_expired _Bool FuriHalCortexTimer
1038 Function + furi_hal_cortex_timer_wait void FuriHalCortexTimer
1039 Function + furi_hal_crypto_ctr _Bool const uint8_t*, const uint8_t*, const uint8_t*, uint8_t*, size_t
1040 Function + furi_hal_crypto_decrypt _Bool const uint8_t*, uint8_t*, size_t
1041 Function + furi_hal_crypto_encrypt _Bool const uint8_t*, uint8_t*, size_t
1042 Function + furi_hal_crypto_gcm _Bool const uint8_t*, const uint8_t*, const uint8_t*, size_t, const uint8_t*, uint8_t*, size_t, uint8_t*, _Bool
1043 Function + furi_hal_crypto_gcm_decrypt_and_verify FuriHalCryptoGCMState const uint8_t*, const uint8_t*, const uint8_t*, size_t, const uint8_t*, uint8_t*, size_t, const uint8_t*
1044 Function + furi_hal_crypto_gcm_encrypt_and_tag FuriHalCryptoGCMState const uint8_t*, const uint8_t*, const uint8_t*, size_t, const uint8_t*, uint8_t*, size_t, uint8_t*
1045 Function - furi_hal_crypto_init void
1046 Function + furi_hal_crypto_store_add_key furi_hal_crypto_load_key _Bool FuriHalCryptoKey*, uint8_t* const uint8_t*, const uint8_t*
1047 Function + furi_hal_crypto_store_load_key furi_hal_crypto_enclave_store_key _Bool uint8_t, const uint8_t* FuriHalCryptoKey*, uint8_t*
1048 Function + furi_hal_crypto_store_unload_key furi_hal_crypto_enclave_load_key _Bool uint8_t uint8_t, const uint8_t*
1049 Function + furi_hal_crypto_verify_enclave furi_hal_crypto_enclave_unload_key _Bool uint8_t*, uint8_t* uint8_t
1050 Function + furi_hal_crypto_verify_key furi_hal_crypto_unload_key _Bool uint8_t
1051 Function + furi_hal_crypto_enclave_verify _Bool uint8_t*, uint8_t*
1052 Function + furi_hal_crypto_enclave_ensure_key _Bool uint8_t
1053 Function + furi_hal_debug_disable void
1054 Function + furi_hal_debug_enable void
1055 Function + furi_hal_debug_is_gdb_session_active _Bool