kmackay / micro-ecc

ECDH and ECDSA for 8-bit, 32-bit, and 64-bit processors.
BSD 2-Clause "Simplified" License
1.26k stars 460 forks source link

Expression cannot be used as a function #216

Open fatburg3r opened 1 year ago

fatburg3r commented 1 year ago

I tried compiling the example sketch provided in the library using the Arduino IDE, but I got the following error. I'm using an Ardunio Nano 33 BLE. Any idea why this is happening?

Arduino: 1.8.19 (Windows Store 1.8.57.0) (Windows 10), Board: "Arduino Nano 33 BLE"

C:\Users\suiyu\OneDrive\Documents\Arduino\libraries\micro-ecc-master\examples\ecc_test\ecc_test.ino: In function 'void loop()':

ecc_test:37:54: error: expression cannot be used as a function

   const struct uECC_Curve_t * curve = uECC_secp160r1();

                                                      ^

ecc_test:48:41: error: too many arguments to function 'int uECC_make_key(uint8_t*, uint8_t*)'

   uECC_make_key(public1, private1, curve);

                                         ^

In file included from C:\Users\suiyu\OneDrive\Documents\Arduino\libraries\micro-ecc-master\examples\ecc_test\ecc_test.ino:1:0:

C:\Users\suiyu\OneDrive\Documents\ArduinoData\packages\arduino\hardware\mbed_nano\4.0.2\cores\arduino/mbed/connectivity/FEATURE_BLE/libraries/TARGET_CORDIO_LL/stack/thirdparty/uecc/uECC.h:107:5: note: declared here

 int uECC_make_key(uint8_t public_key[uECC_BYTES*2], uint8_t private_key[uECC_BYTES]);

     ^~~~~~~~~~~~~

ecc_test:53:41: error: too many arguments to function 'int uECC_make_key(uint8_t*, uint8_t*)'

   uECC_make_key(public2, private2, curve);

                                         ^

In file included from C:\Users\suiyu\OneDrive\Documents\Arduino\libraries\micro-ecc-master\examples\ecc_test\ecc_test.ino:1:0:

C:\Users\suiyu\OneDrive\Documents\ArduinoData\packages\arduino\hardware\mbed_nano\4.0.2\cores\arduino/mbed/connectivity/FEATURE_BLE/libraries/TARGET_CORDIO_LL/stack/thirdparty/uecc/uECC.h:107:5: note: declared here

 int uECC_make_key(uint8_t public_key[uECC_BYTES*2], uint8_t private_key[uECC_BYTES]);

     ^~~~~~~~~~~~~

ecc_test:58:63: error: too many arguments to function 'int uECC_shared_secret(const uint8_t*, const uint8_t*, uint8_t*)'

   int r = uECC_shared_secret(public2, private1, secret1, curve);

                                                               ^

In file included from C:\Users\suiyu\OneDrive\Documents\Arduino\libraries\micro-ecc-master\examples\ecc_test\ecc_test.ino:1:0:

C:\Users\suiyu\OneDrive\Documents\ArduinoData\packages\arduino\hardware\mbed_nano\4.0.2\cores\arduino/mbed/connectivity/FEATURE_BLE/libraries/TARGET_CORDIO_LL/stack/thirdparty/uecc/uECC.h:123:5: note: declared here

 int uECC_shared_secret(const uint8_t public_key[uECC_BYTES*2],

     ^~~~~~~~~~~~~~~~~~

ecc_test:67:59: error: too many arguments to function 'int uECC_shared_secret(const uint8_t*, const uint8_t*, uint8_t*)'

   r = uECC_shared_secret(public1, private2, secret2, curve);

                                                           ^

In file included from C:\Users\suiyu\OneDrive\Documents\Arduino\libraries\micro-ecc-master\examples\ecc_test\ecc_test.ino:1:0:

C:\Users\suiyu\OneDrive\Documents\ArduinoData\packages\arduino\hardware\mbed_nano\4.0.2\cores\arduino/mbed/connectivity/FEATURE_BLE/libraries/TARGET_CORDIO_LL/stack/thirdparty/uecc/uECC.h:123:5: note: declared here

 int uECC_shared_secret(const uint8_t public_key[uECC_BYTES*2],

     ^~~~~~~~~~~~~~~~~~

exit status 1

expression cannot be used as a function