Skip to content

Commit

Permalink
Remove ATECC crypto chip placeholder code (#5461)
Browse files Browse the repository at this point in the history
  • Loading branch information
thebentern authored Nov 27, 2024
1 parent 601d912 commit 0832388
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 70 deletions.
3 changes: 1 addition & 2 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ framework = arduino
lib_deps =
${env.lib_deps}
end2endzone/[email protected]
https://github.com/meshtastic/SparkFun_ATECCX08a_Arduino_Library.git#5cf62b36c6f30bc72a07bdb2c11fc9a22d1e31da
build_flags = ${env.build_flags} -Os
build_src_filter = ${env.build_src_filter} -<platform/portduino/>

Expand Down Expand Up @@ -160,4 +159,4 @@ lib_deps =
https://github.com/KodinLanewave/[email protected]
mprograms/[email protected]
dfrobot/[email protected]
https://github.com/meshtastic/DFRobot_LarkWeatherStation#4de3a9cadef0f6a5220a8a906cf9775b02b0040d
https://github.com/meshtastic/DFRobot_LarkWeatherStation#4de3a9cadef0f6a5220a8a906cf9775b02b0040d
3 changes: 1 addition & 2 deletions src/configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// -----------------------------------------------------------------------------
// Security
// -----------------------------------------------------------------------------
#define ATECC608B_ADDR 0x35

// -----------------------------------------------------------------------------
// IO Expander
Expand Down Expand Up @@ -362,4 +361,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#endif

#include "DebugConfiguration.h"
#include "RF95Configuration.h"
#include "RF95Configuration.h"
1 change: 0 additions & 1 deletion src/detect/ScanI2C.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class ScanI2C
SCREEN_SH1106,
SCREEN_UNKNOWN, // has the same address as the two above but does not respond to the same commands
SCREEN_ST7567,
ATECC608B,
RTC_RV3028,
RTC_PCF8563,
CARDKB,
Expand Down
52 changes: 0 additions & 52 deletions src/detect/ScanI2CTwoWire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "linux/LinuxHardwareI2C.h"
#endif
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
#include "main.h" // atecc
#include "meshUtils.h" // vformat
#endif

Expand Down Expand Up @@ -84,40 +83,6 @@ ScanI2C::DeviceType ScanI2CTwoWire::probeOLED(ScanI2C::DeviceAddress addr) const

return o_probe;
}
void ScanI2CTwoWire::printATECCInfo() const
{
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
atecc.readConfigZone(false);

std::string atecc_numbers = "ATECC608B Serial Number: ";
for (int i = 0; i < 9; i++) {
atecc_numbers += vformat("%02x", atecc.serialNumber[i]);
}

atecc_numbers += ", Rev Number: ";
for (int i = 0; i < 4; i++) {
atecc_numbers += vformat("%02x", atecc.revisionNumber[i]);
}
LOG_DEBUG(atecc_numbers.c_str());

LOG_DEBUG("ATECC608B Config %s, Data %s, Slot 0 %s", atecc.configLockStatus ? "Locked" : "Unlocked",
atecc.dataOTPLockStatus ? "Locked" : "Unlocked", atecc.slot0LockStatus ? "Locked" : "Unlocked");

std::string atecc_publickey = "";
if (atecc.configLockStatus && atecc.dataOTPLockStatus && atecc.slot0LockStatus) {
if (atecc.generatePublicKey() == false) {
atecc_publickey += "ATECC608B Error generating public key";
} else {
atecc_publickey += "ATECC608B Public Key: ";
for (int i = 0; i < 64; i++) {
atecc_publickey += vformat("%02x", atecc.publicKey64Bytes[i]);
}
}
LOG_DEBUG(atecc_publickey.c_str());
}
#endif
}

uint16_t ScanI2CTwoWire::getRegisterValue(const ScanI2CTwoWire::RegisterLocation &registerLocation,
ScanI2CTwoWire::ResponseWidth responseWidth) const
{
Expand Down Expand Up @@ -203,23 +168,6 @@ void ScanI2CTwoWire::scanPort(I2CPort port, uint8_t *address, uint8_t asize)
type = probeOLED(addr);
break;

#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
case ATECC608B_ADDR:
#ifdef RP2040_SLOW_CLOCK
if (atecc.begin(addr.address, Wire, Serial2) == true)
#else
if (atecc.begin(addr.address) == true)
#endif

{
LOG_INFO("ATECC608B initialized");
} else {
LOG_WARN("ATECC608B initialization failed");
}
printATECCInfo();
break;
#endif

#ifdef RV3028_RTC
case RV3028_RTC:
// foundDevices[addr] = RTC_RV3028;
Expand Down
2 changes: 0 additions & 2 deletions src/detect/ScanI2CTwoWire.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ class ScanI2CTwoWire : public ScanI2C

concurrency::Lock lock;

void printATECCInfo() const;

uint16_t getRegisterValue(const RegisterLocation &, ResponseWidth) const;

DeviceType probeOLED(ScanI2C::DeviceAddress) const;
Expand Down
4 changes: 0 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ ScanI2C::DeviceAddress accelerometer_found = ScanI2C::ADDRESS_NONE;
// The I2C address of the RGB LED (if found)
ScanI2C::FoundDevice rgb_found = ScanI2C::FoundDevice(ScanI2C::DeviceType::NONE, ScanI2C::ADDRESS_NONE);

#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
ATECCX08A atecc;
#endif

#ifdef T_WATCH_S3
Adafruit_DRV2605 drv;
#endif
Expand Down
7 changes: 0 additions & 7 deletions src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
#include "mesh/generated/meshtastic/telemetry.pb.h"
#include <SPI.h>
#include <map>
#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
#include <SparkFun_ATECCX08a_Arduino_Library.h>
#endif
#if defined(ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S2)
#include "nimble/NimbleBluetooth.h"
extern NimbleBluetooth *nimbleBluetooth;
Expand Down Expand Up @@ -42,10 +39,6 @@ extern bool pmu_found;
extern bool isCharging;
extern bool isUSBPowered;

#if !defined(ARCH_PORTDUINO) && !defined(ARCH_STM32WL)
extern ATECCX08A atecc;
#endif

#ifdef T_WATCH_S3
#include <Adafruit_DRV2605.h>
extern Adafruit_DRV2605 drv;
Expand Down

0 comments on commit 0832388

Please sign in to comment.