Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem reading using this lib on esp32 + ECC508A #22

Open
themagicm opened this issue Jul 31, 2023 · 4 comments
Open

Problem reading using this lib on esp32 + ECC508A #22

themagicm opened this issue Jul 31, 2023 · 4 comments

Comments

@themagicm
Copy link

themagicm commented Jul 31, 2023

I'm using an ESP32-WROOM-32D connected to an ECC508A via SDA and SCL. Both have 4.7k resistors.

I am using example 1 configure, example 2 sign and then data from example 2 into example 3 verify. Verification fails:

================Config:

rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:1184
load:0x40078000,len:13260
load:0x40080400,len:3028
entry 0x400805e4
Successful wakeUp(). I2C connections are good.

Serial Number: 0123877DBB070B14EE
Rev Number: 00005000
Config Zone: NOT Locked
Data/OTP Zone: NOT Locked
Data Slot 0: NOT Locked

Would you like to configure your Cryptographic Co-processor with SparkFun Standard settings? (y/n)
Note, this is PERMANENT and cannot be changed later
If you do not want to do this, type an 'n' or unplug now.

Configuration beginning.
Write Config: Success!
Lock Config: Success!
Key Creation: Success!
Lock Data-OTP: Success!
Lock Slot 0: Success!
Configuration done.

Serial Number: 0123877DBB070B14EE
Rev Number: 00005000
Config Zone: Locked
Data/OTP Zone: Locked
Data Slot 0: Locked

This device's Public Key:

uint8_t publicKey[64] = {
0xE5, 0xDC, 0x8B, 0x6F, 0x47, 0xAC, 0xA0, 0x62, 0x83, 0x18, 0x5A, 0xB6, 0xFF, 0x3D, 0x36, 0xAB,
0xAF, 0xF5, 0xF1, 0x9D, 0xBB, 0xAB, 0x84, 0xC1, 0xD8, 0xDC, 0xCF, 0x66, 0x28, 0xFE, 0x97, 0x3F,
0xDC, 0x24, 0x57, 0xD3, 0x1B, 0xB6, 0x36, 0x60, 0xAA, 0x9D, 0x89, 0x29, 0x7E, 0x14, 0xDB, 0xE8,
0x35, 0x98, 0xD6, 0x81, 0xB6, 0x39, 0xD0, 0xEA, 0x94, 0x1C, 0xC7, 0xDA, 0x3B, 0xF7, 0x83, 0x94
};

==============SIGN:

Successful wakeUp(). I2C connections are good.

Serial Number: 0123877DBB070B14EE
Rev Number: 00005000
Config Zone: Locked
Data/OTP Zone: Locked
Data Slot 0: Locked

This device's Public Key:

uint8_t publicKey[64] = {
0xE5, 0xDC, 0x8B, 0x6F, 0x47, 0xAC, 0xA0, 0x62, 0x83, 0x18, 0x5A, 0xB6, 0xFF, 0x3D, 0x36, 0xAB,
0xAF, 0xF5, 0xF1, 0x9D, 0xBB, 0xAB, 0x84, 0xC1, 0xD8, 0xDC, 0xCF, 0x66, 0x28, 0xFE, 0x97, 0x3F,
0xDC, 0x24, 0x57, 0xD3, 0x1B, 0xB6, 0x36, 0x60, 0xAA, 0x9D, 0x89, 0x29, 0x7E, 0x14, 0xDB, 0xE8,
0x35, 0x98, 0xD6, 0x81, 0xB6, 0x39, 0xD0, 0xEA, 0x94, 0x1C, 0xC7, 0xDA, 0x3B, 0xF7, 0x83, 0x94
};

uint8_t message[32] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
};

uint8_t signature[64] = {
0x43, 0x03, 0xE2, 0xFE, 0x1E, 0x0C, 0xB3, 0x21, 0x3E, 0x4C, 0xE5, 0x2E, 0xE6, 0xBE, 0x38, 0xA0,
0x2E, 0x4C, 0xCC, 0x74, 0x9C, 0x6F, 0x16, 0x05, 0xE4, 0xAC, 0xAF, 0x45, 0x88, 0x43, 0xB9, 0xC9,
0xA0, 0xBF, 0x1D, 0x69, 0x9A, 0x76, 0xBB, 0xC3, 0x0B, 0x84, 0xDF, 0x11, 0x3A, 0x19, 0xDB, 0x90,
0x6C, 0xDA, 0xAE, 0x95, 0xAA, 0x31, 0x86, 0xA3, 0x4C, 0x16, 0x09, 0x78, 0xA8, 0x66, 0x2F, 0x94
};

==============VERIFY:
Successful wakeUp(). I2C connections are good.

Serial Number: 0123877DBB070B14EE
Rev Number: 00005000
Config Zone: Locked
Data/OTP Zone: Locked
Data Slot 0: Locked

uint8_t publicKeyExternal[64] = {
0xE5, 0xDC, 0x8B, 0x6F, 0x47, 0xAC, 0xA0, 0x62, 0x83, 0x18, 0x5A, 0xB6, 0xFF, 0x3D, 0x36, 0xAB,
0xAF, 0xF5, 0xF1, 0x9D, 0xBB, 0xAB, 0x84, 0xC1, 0xD8, 0xDC, 0xCF, 0x66, 0x28, 0xFE, 0x97, 0x3F,
0xDC, 0x24, 0x57, 0xD3, 0x1B, 0xB6, 0x36, 0x60, 0xAA, 0x9D, 0x89, 0x29, 0x7E, 0x14, 0xDB, 0xE8,
0x35, 0x98, 0xD6, 0x81, 0xB6, 0x39, 0xD0, 0xEA, 0x94, 0x1C, 0xC7, 0xDA, 0x3B, 0xF7, 0x83, 0x94
};

uint8_t message[32] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F
};

uint8_t signature[64] = {
0x43, 0x03, 0xE2, 0xFE, 0x1E, 0x0C, 0xB3, 0x21, 0x3E, 0x4C, 0xE5, 0x2E, 0xE6, 0xBE, 0x38, 0xA0,
0x2E, 0x4C, 0xCC, 0x74, 0x9C, 0x6F, 0x16, 0x05, 0xE4, 0xAC, 0xAF, 0x45, 0x88, 0x43, 0xB9, 0xC9,
0xA0, 0xBF, 0x1D, 0x69, 0x9A, 0x76, 0xBB, 0xC3, 0x0B, 0x84, 0xDF, 0x11, 0x3A, 0x19, 0xDB, 0x90,
0x6C, 0xDA, 0xAE, 0x95, 0xAA, 0x31, 0x86, 0xA3, 0x4C, 0x16, 0x09, 0x78, 0xA8, 0x66, 0x2F, 0x94
};

Verification failure.

@lewispg228
Copy link
Member

Hi there,
Sorry you've been having issues with this example.

I am currently rounding up some hardware to see if I can replicate this issue.

For now, I do have one idea for you to try:

These examples do require a larger-ish i2c buffer. If you can adjust your wire.h file before compiling, I might try increasing this from 128 to 256. I believe the hookup guide was created with the Artemis because this defaults to 256.

For reference, it is located here in the espressif github repo:

https://github.com/espressif/arduino-esp32/blob/master/libraries/Wire/src/Wire.h#L43

And it usually lives deep within your arduino install here-ish:

C:\Users\user.name\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.11\libraries\Wire\src

But I'm also wondering if something changed with the recent big update to Arduino "2.0", so we may need to dig deeper.

I'll keep ya posted on how testing goes on our end.
Thanks,
-Pete

@themagicm
Copy link
Author

themagicm commented Jul 31, 2023 via email

@lewispg228
Copy link
Member

Excellent! Glad it was resolved so easily and qwiicly for you :) Hope the rest of your authentication project goes well! This reminds me, I need to update my garage door opener to accept new public keys.

@themagicm
Copy link
Author

cool. whats the private key? lol I kid I kid.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants