MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / getKey

Function getKey

TactilityCore/Source/crypt/Crypt.cpp:111–128  ·  view source on GitHub ↗

* Combines a stored key and a hardware key into a single reliable key value. * @param[out] key the key output */

Source from the content-addressed store, hash-verified

109 * @param[out] key the key output
110 */
111static void getKey(uint8_t key[32]) {
112#if !defined(CONFIG_SECURE_BOOT) || !defined(CONFIG_SECURE_FLASH_ENC_ENABLED)
113 LOGGER.warn("Using tt_secure_* code with secure boot and/or flash encryption disabled.");
114 LOGGER.warn("An attacker with physical access to your ESP32 can decrypt your secure data.");
115#endif
116
117#ifdef ESP_PLATFORM
118 uint8_t hardware_key[32];
119 uint8_t nvs_key[32];
120
121 get_hardware_key(hardware_key);
122 get_nvs_key(nvs_key);
123 xorKey(hardware_key, nvs_key, key, 32);
124#else
125 LOGGER.warn("Using unsafe key for debugging purposes.");
126 memset(key, 0, 32);
127#endif
128}
129
130void getIv(const void* data, size_t dataLength, uint8_t iv[16]) {
131 memset(iv, 0, 16);

Callers 2

encryptFunction · 0.85
decryptFunction · 0.85

Calls 4

get_hardware_keyFunction · 0.85
get_nvs_keyFunction · 0.85
xorKeyFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected