50#define FURI_HAL_CRYPTO_ENCLAVE_MASTER_KEY_SLOT (0u)
53#define FURI_HAL_CRYPTO_ENCLAVE_FACTORY_KEY_SLOT_START (1u)
54#define FURI_HAL_CRYPTO_ENCLAVE_FACTORY_KEY_SLOT_END (10u)
57#define FURI_HAL_CRYPTO_ENCLAVE_UNIQUE_KEY_SLOT (11u)
60#define FURI_HAL_CRYPTO_ENCLAVE_USER_KEY_SLOT_START (12u)
61#define FURI_HAL_CRYPTO_ENCLAVE_USER_KEY_SLOT_END (100u)
64#define FURI_HAL_CRYPTO_ADVANCED_AVAIL 1
75 FuriHalCryptoKeySize128,
76 FuriHalCryptoKeySize256,
206 const uint8_t* input,
234 const uint8_t* input,
261 const uint8_t* input,
288 const uint8_t* input,
bool furi_hal_crypto_enclave_ensure_key(uint8_t key_slot)
Ensure that requested slot and slots before this slot contains keys.
Definition furi_hal_crypto.c:105
bool furi_hal_crypto_unload_key(void)
Unload key and de-init AES engine.
Definition furi_hal_crypto.c:327
FuriHalCryptoGCMState
FuriHalCryptoGCMState Result of a GCM operation.
Definition furi_hal_crypto.h:87
@ FuriHalCryptoGCMStateError
error during encryption/decryption
Definition furi_hal_crypto.h:89
@ FuriHalCryptoGCMStateOk
operation successful
Definition furi_hal_crypto.h:88
@ FuriHalCryptoGCMStateAuthFailure
tags do not match, auth failed
Definition furi_hal_crypto.h:90
FuriHalCryptoKeySize
FuriHalCryptoKey Size in bits.
Definition furi_hal_crypto.h:74
bool furi_hal_crypto_load_key(const uint8_t *key, const uint8_t *iv)
Init AES engine and load supplied key.
Definition furi_hal_crypto.c:315
void furi_hal_crypto_init(void)
Initialize cryptography layer(includes AES engines, PKA and RNG)
Definition furi_hal_crypto.c:83
bool furi_hal_crypto_decrypt(const uint8_t *input, uint8_t *output, size_t size)
Decrypt data.
Definition furi_hal_crypto.c:359
bool furi_hal_crypto_enclave_unload_key(uint8_t slot)
Unload key and deinit AES engine.
Definition furi_hal_crypto.c:290
bool furi_hal_crypto_enclave_verify(uint8_t *keys_nb, uint8_t *valid_keys_nb)
Verify factory provisioned keys.
Definition furi_hal_crypto.c:131
bool furi_hal_crypto_gcm(const uint8_t *key, const uint8_t *iv, const uint8_t *aad, size_t aad_length, const uint8_t *input, uint8_t *output, size_t length, uint8_t *tag, bool decrypt)
Encrypt/decrypt the input using AES-GCM.
Definition furi_hal_crypto.c:655
bool furi_hal_crypto_enclave_store_key(FuriHalCryptoKey *key, uint8_t *slot)
Store key in crypto enclave.
Definition furi_hal_crypto.c:157
FuriHalCryptoGCMState furi_hal_crypto_gcm_encrypt_and_tag(const uint8_t *key, const uint8_t *iv, const uint8_t *aad, size_t aad_length, const uint8_t *input, uint8_t *output, size_t length, uint8_t *tag)
Encrypt the input using AES-GCM and generate a tag.
Definition furi_hal_crypto.c:710
bool furi_hal_crypto_ctr(const uint8_t *key, const uint8_t *iv, const uint8_t *input, uint8_t *output, size_t length)
Encrypt the input using AES-CTR.
Definition furi_hal_crypto.c:513
bool furi_hal_crypto_enclave_load_key(uint8_t slot, const uint8_t *iv)
Init AES engine and load key from crypto enclave.
Definition furi_hal_crypto.c:258
bool furi_hal_crypto_encrypt(const uint8_t *input, uint8_t *output, size_t size)
Encrypt data.
Definition furi_hal_crypto.c:336
FuriHalCryptoKeyType
FuriHalCryptoKey Type.
Definition furi_hal_crypto.h:67
@ FuriHalCryptoKeyTypeMaster
Master key.
Definition furi_hal_crypto.h:68
@ FuriHalCryptoKeyTypeSimple
Simple unencrypted key.
Definition furi_hal_crypto.h:69
@ FuriHalCryptoKeyTypeEncrypted
Encrypted with Master key.
Definition furi_hal_crypto.h:70
FuriHalCryptoGCMState furi_hal_crypto_gcm_decrypt_and_verify(const uint8_t *key, const uint8_t *iv, const uint8_t *aad, size_t aad_length, const uint8_t *input, uint8_t *output, size_t length, const uint8_t *tag)
Decrypt the input using AES-GCM and verify the provided tag.
Definition furi_hal_crypto.c:728
FuriHalCryptoKey.
Definition furi_hal_crypto.h:80