Crypto ECC won't run on nrf52840 DK


#1

When you compile the Crypto ECC example you get the following warnings:

[info] Compiling /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/builtins.h => line 55 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/pcode.h => line 192 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/vbl.h => line 191 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/vbl.h => line 192 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/vbl.h => line 193 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/vbl.h => line 194 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 20 : comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 26 : function declaration isn't a prototype [-Wstrict-prototypes]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 53 : comparison of unsigned expression < 0 is always false [-Wtype-limits]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 53 : comparison of unsigned expression < 0 is always false [-Wtype-limits]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 110 : assignment to 'PObject *' {aka 'struct _p_obj *'} from incompatible pointer type 'PTuple *' {aka 'struct _pisequence *'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 53 : comparison of unsigned expression < 0 is always false [-Wtype-limits]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 53 : comparison of unsigned expression < 0 is always false [-Wtype-limits]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 158 : assignment to 'PObject *' {aka 'struct _p_obj *'} from incompatible pointer type 'PBytes *' {aka 'struct _pisequence *'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 53 : comparison of unsigned expression < 0 is always false [-Wtype-limits]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 179 : assignment to 'PObject *' {aka 'struct _p_obj *'} from incompatible pointer type 'PBytes *' {aka 'struct _pisequence *'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 53 : comparison of unsigned expression < 0 is always false [-Wtype-limits]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 200 : assignment to 'PObject *' {aka 'struct _p_obj *'} from incompatible pointer type 'PBytes *' {aka 'struct _pisequence *'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 53 : comparison of unsigned expression < 0 is always false [-Wtype-limits]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 257 : assignment to 'void (*)(const struct uECC_HashContext *)' from incompatible pointer type 'void (*)(uECC_HashContext *)' {aka 'void (*)(struct uECC_HashContext *)'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 258 : assignment to 'void (*)(const struct uECC_HashContext *, const uint8_t *, unsigned int)' {aka 'void (*)(const struct uECC_HashContext *, const unsigned char *, unsigned int)'} from incompatible pointer type 'void (*)(uECC_HashContext *, const uint8_t *, unsigned int)' {aka 'void (*)(struct uECC_HashContext *, const unsigned char *, unsigned int)'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 259 : assignment to 'void (*)(const struct uECC_HashContext *, uint8_t *)' {aka 'void (*)(const struct uECC_HashContext *, unsigned char *)'} from incompatible pointer type 'void (*)(uECC_HashContext *, uint8_t *)' {aka 'void (*)(struct uECC_HashContext *, unsigned char *)'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/ecc_ifc.c => line 278 : assignment to 'PObject *' {aka 'struct _p_obj *'} from incompatible pointer type 'PTuple *' {aka 'struct _pisequence *'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/natives.h => line 51 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/natives.h => line 52 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__common/vhal_pins.h => line 60 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[info] Compiling /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/uECC.c
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/ecc/csrc/microecc/curve-specific.inc => line 544 : unused parameter 'curve' [-Wunused-parameter]
[info] Compiling /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/sha1_ifc.c
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/sha1_ifc.c => line 15 : assignment to 'PObject *' {aka 'struct _p_obj *'} from incompatible pointer type 'PBytes *' {aka 'struct _pisequence *'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/sha1_ifc.c => line 33 : passing argument 1 of 'cf_sha1_update' from incompatible pointer type [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/sha1_ifc.c => line 55 : passing argument 1 of 'cf_sha1_digest' from incompatible pointer type [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/sha1_ifc.c => line 57 : assignment to 'PObject *' {aka 'struct _p_obj *'} from incompatible pointer type 'PBytes *' {aka 'struct _pisequence *'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/sha1_ifc.c => line 48 : unused variable 'data_len' [-Wunused-variable]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/sha1_ifc.c => line 47 : unused variable 'data' [-Wunused-variable]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/sha1_ifc.c => line 76 : assignment to 'void (*)(void *)' from incompatible pointer type 'void (*)(cf_sha1_context *)' {aka 'void (*)(struct  *)'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/sha1_ifc.c => line 77 : assignment to 'void (*)(void *, const uint8_t *, unsigned int)' {aka 'void (*)(void *, const unsigned char *, unsigned int)'} from incompatible pointer type 'void (*)(cf_sha1_context *, const void *, size_t)' {aka 'void (*)(struct  *, const void *, unsigned int)'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/sha1_ifc.c => line 78 : assignment to 'void (*)(void *, uint8_t *)' {aka 'void (*)(void *, unsigned char *)'} from incompatible pointer type 'void (*)(const cf_sha1_context *, uint8_t *)' {aka 'void (*)(const struct  *, unsigned char *)'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/sha1_ifc.c => line 82 : assignment to 'PObject *' {aka 'struct _p_obj *'} from incompatible pointer type 'PBytes *' {aka 'struct _pisequence *'} [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/builtins.h => line 55 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/pcode.h => line 192 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/vbl.h => line 191 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/vbl.h => line 192 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/vbl.h => line 193 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/vbl.h => line 194 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/natives.h => line 51 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/natives.h => line 52 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__lang/psequence.h => line 82 : passing argument 1 of 'cf_sha1_init' from incompatible pointer type [-Wincompatible-pointer-types]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/__common/vhal_pins.h => line 60 : duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
[info] Compiling /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/cifra/src/blockwise.c
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/cifra/src/ext/handy.h => line 40 : multi-line comment [-Wcomment]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/cifra/src/ext/handy.h => line 46 : multi-line comment [-Wcomment]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/cifra/src/ext/handy.h => line 54 : multi-line comment [-Wcomment]
[info] Compiling /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/cifra/src/sha1.c
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/cifra/src/ext/handy.h => line 40 : multi-line comment [-Wcomment]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/cifra/src/ext/handy.h => line 46 : multi-line comment [-Wcomment]
[warning] /home/jelle/.zerynth2/dist/r2.2.0/stdlib/crypto/hash/csrc/cifra/src/ext/handy.h => line 54 : multi-line comment [-Wcomment]

It does compile but then you run it you get the error:
[Thread 1 exited with exception ValueError @[0038:0022:0000:0070:0000:0000:0000:0000]]

It is caused by this line:
signature = ec.sign(ec.SECP256R1,digest,pv)

Other curves don’t work either.

Any suggestions?