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

Function get_hardware_key

TactilityCore/Source/crypt/Crypt.cpp:27–39  ·  view source on GitHub ↗

* Get a key based on hardware parameters. * @param[out] key the output key */

Source from the content-addressed store, hash-verified

25 * @param[out] key the output key
26 */
27static void get_hardware_key(uint8_t key[32]) {
28 uint8_t mac[8];
29 // MAC can be 6 or 8 bytes
30 size_t mac_length = esp_mac_addr_len_get(ESP_MAC_EFUSE_FACTORY);
31 LOGGER.info("Using MAC with length {}", mac_length);
32 check(mac_length <= 8);
33 ESP_ERROR_CHECK(esp_read_mac(mac, ESP_MAC_EFUSE_FACTORY));
34
35 // Fill buffer with repeating MAC
36 for (size_t i = 0; i < 32; ++i) {
37 key[i] = mac[i % mac_length];
38 }
39}
40#endif
41
42#ifdef ESP_PLATFORM

Callers 1

getKeyFunction · 0.85

Calls 2

infoMethod · 0.80
checkFunction · 0.50

Tested by

no test coverage detected