arduino-libraries / ArduinoECCX08

76 stars 49 forks source link

fix: input length for ECCX08.ecSign() is 32 bytes #49

Closed fogzot closed 12 months ago

fogzot commented 1 year ago

When using ECCX08.ecSign() the input buffer should be exactly 32 bytes long. The old example worked only because the signature was generated and then checked on the first 32 bytes of the 64 bytes buffer.

CLAassistant commented 1 year ago

CLA assistant check
All committers have signed the CLA.

github-actions[bot] commented 1 year ago

Memory usage change @ b7f79d8fdc77bbe4921378eb014a2f4ebb39585e

Board flash % RAM for global variables %
arduino:mbed:envie_m7 :green_heart: -32 - 0 -0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:mbed_nano:nanorp2040connect :green_heart: -32 - 0 -0.0 - 0.0 0 - 0 0.0 - 0.0
arduino:megaavr:uno2018 :green_heart: -20 - 0 -0.04 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkr1000 :green_heart: -32 - 0 -0.01 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrgsm1400 :green_heart: -32 - 0 -0.01 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrnb1500 :green_heart: -32 - 0 -0.01 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrvidor4000 :green_heart: -32 - 0 -0.01 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrwan1300 :green_heart: -32 - 0 -0.01 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrwan1310 :green_heart: -32 - 0 -0.01 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:mkrwifi1010 :green_heart: -32 - 0 -0.01 - 0.0 0 - 0 0.0 - 0.0
arduino:samd:nano_33_iot :green_heart: -32 - 0 -0.01 - 0.0 0 - 0 0.0 - 0.0
Click for full report table Board|`examples/ECCX08HMAC`
flash|%|`examples/ECCX08HMAC`
RAM for global variables|%|`examples/ECCX08RandomNumber`
flash|%|`examples/ECCX08RandomNumber`
RAM for global variables|%|`examples/ECCX08Signing`
flash|%|`examples/ECCX08Signing`
RAM for global variables|%|`examples/Tools/ECCX08CSR`
flash|%|`examples/Tools/ECCX08CSR`
RAM for global variables|%|`examples/Tools/ECCX08JWSPublicKey`
flash|%|`examples/Tools/ECCX08JWSPublicKey`
RAM for global variables|%|`examples/Tools/ECCX08SelfSignedCert`
flash|%|`examples/Tools/ECCX08SelfSignedCert`
RAM for global variables|% -|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|-|- `arduino:mbed:envie_m7`|0|0.0|0|0.0|0|0.0|0|0.0|-32|-0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:mbed_nano:nanorp2040connect`|0|0.0|0|0.0|0|0.0|0|0.0|-32|-0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:megaavr:uno2018`|0|0.0|0|0.0|0|0.0|0|0.0|-20|-0.04|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:samd:mkr1000`|0|0.0|0|0.0|0|0.0|0|0.0|-32|-0.01|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:samd:mkrgsm1400`|0|0.0|0|0.0|0|0.0|0|0.0|-32|-0.01|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:samd:mkrnb1500`|0|0.0|0|0.0|0|0.0|0|0.0|-32|-0.01|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:samd:mkrvidor4000`|0|0.0|0|0.0|0|0.0|0|0.0|-32|-0.01|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:samd:mkrwan1300`|0|0.0|0|0.0|0|0.0|0|0.0|-32|-0.01|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:samd:mkrwan1310`|0|0.0|0|0.0|0|0.0|0|0.0|-32|-0.01|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:samd:mkrwifi1010`|0|0.0|0|0.0|0|0.0|0|0.0|-32|-0.01|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0 `arduino:samd:nano_33_iot`|0|0.0|0|0.0|0|0.0|0|0.0|-32|-0.01|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0|0|0.0
Click for full report CSV ``` Board,examples/ECCX08HMAC
flash,%,examples/ECCX08HMAC
RAM for global variables,%,examples/ECCX08RandomNumber
flash,%,examples/ECCX08RandomNumber
RAM for global variables,%,examples/ECCX08Signing
flash,%,examples/ECCX08Signing
RAM for global variables,%,examples/Tools/ECCX08CSR
flash,%,examples/Tools/ECCX08CSR
RAM for global variables,%,examples/Tools/ECCX08JWSPublicKey
flash,%,examples/Tools/ECCX08JWSPublicKey
RAM for global variables,%,examples/Tools/ECCX08SelfSignedCert
flash,%,examples/Tools/ECCX08SelfSignedCert
RAM for global variables,% arduino:mbed:envie_m7,0,0.0,0,0.0,0,0.0,0,0.0,-32,-0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 arduino:mbed_nano:nanorp2040connect,0,0.0,0,0.0,0,0.0,0,0.0,-32,-0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 arduino:megaavr:uno2018,0,0.0,0,0.0,0,0.0,0,0.0,-20,-0.04,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 arduino:samd:mkr1000,0,0.0,0,0.0,0,0.0,0,0.0,-32,-0.01,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 arduino:samd:mkrgsm1400,0,0.0,0,0.0,0,0.0,0,0.0,-32,-0.01,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 arduino:samd:mkrnb1500,0,0.0,0,0.0,0,0.0,0,0.0,-32,-0.01,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 arduino:samd:mkrvidor4000,0,0.0,0,0.0,0,0.0,0,0.0,-32,-0.01,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 arduino:samd:mkrwan1300,0,0.0,0,0.0,0,0.0,0,0.0,-32,-0.01,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 arduino:samd:mkrwan1310,0,0.0,0,0.0,0,0.0,0,0.0,-32,-0.01,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 arduino:samd:mkrwifi1010,0,0.0,0,0.0,0,0.0,0,0.0,-32,-0.01,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 arduino:samd:nano_33_iot,0,0.0,0,0.0,0,0.0,0,0.0,-32,-0.01,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0,0,0.0 ```
manchoz commented 1 year ago

@pennam, would you mind to review? Thanks!

pennam commented 12 months ago

:+1: Thanks for the fix @fogzot