Hello, I'm developing a device and wanted to add a security layer to it. My goal is to be able to distribute updates by publishing hex files after product distribution. However, I have a concern - users could potentially load the hex file onto an empty Teensy device, which I don't want to happen. That's why I added security to my device:
I embedded this code into the firmware and check it in setup(). Are there any ways to bypass this? Is it possible to spoof the values used in this code? I assume they can't reverse the hex file back to code. I'd appreciate any clarification.
Code:
const TeensyID authorizedTeensys[] = {
{0x4E9, 0xE51Bxxxx, "x Person"},
{0x4E9, 0xE51Bxxxx, "y Person"},
{0x4E9, 0xE518xxxx, "z Person"}
};
bool isAuthorizedTeeensy() {
uint32_t current_mac1 = HW_OCOTP_MAC1;
uint32_t current_mac0 = HW_OCOTP_MAC0;
for (int i = 0; i < AUTHORIZED_COUNT; i++) {
if (current_mac1 == authorizedTeensys[i].mac1 &&
current_mac0 == authorizedTeensys[i].mac0) {
Serial.println(authorizedTeensys[i].name);
return true;
}
}
return false;
}