Cathedrow / Cryptosuite

Cryptographic suite for Arduino (SHA, HMAC-SHA)
318 stars 148 forks source link

[Error Compiling] read-only variables must be const. #10

Open e-lin opened 9 years ago

e-lin commented 9 years ago

The compiling error message is shown below:


Arduino: 1.7.4 (Mac OS X), Board: "Arduino Uno"

In file included from /Users/../Documents/Arduino/libraries/Sha/sha256.cpp:3:0: /Users/../Documents/Arduino/libraries/Sha/sha256.cpp:6:20: error: variable 'sha256K' must be const in order to be put into read-only section by means of 'attribute((progmem))' uint32_t sha256K[] PROGMEM = { ^ /Users/../Documents/Arduino/libraries/Sha/sha256.cpp:19:27: error: variable 'sha256InitState' must be const in order to be put into read-only section by means of 'attribute((progmem))' uint8_t sha256InitState[] PROGMEM = { ^

Error compiling.

Read-only variables must be const as above suggestion. Thanks!

beyondszine commented 7 years ago

also, declare them const.

raddevus commented 6 years ago

Just confirming that I had same issues: In Sha256.cpp need to change so it looks like (partial snippets of each) : -- simply added const keyword to each.

uint32_t const sha256K[] PROGMEM = {
  0x428a2f98,0x71374491,0xb5c0fbcf,

and

uint8_t const sha256InitState[] PROGMEM = {
  0x67,0xe6,0x09,0x6a, // H0
  0x85,0xae,0x67,0xbb, // H1

After changing these -- along with a changing the return value of write() method, it all compiled in the Arduino IDE against a nano board with atmeg328. Thanks,