im-tomu / chopstx

U2F firmware for Tomu board (+ chopstx port)
https://tomu.im/
GNU General Public License v3.0
68 stars 14 forks source link

u2f fails to build on macos #9

Open Firstyear opened 5 years ago

Firstyear commented 5 years ago

commit 449b9e5 fails to build on macos with:

[william@amethyst 16:16] ~/development/tomu-chopstx-u2f/u2f I0> make

arm-none-eabi-gcc -c -mcpu=cortex-m0plus -O3 -Os -fstack-usage -ffunction-sections -fdata-sections -fno-common -Wall -Wextra -Wstrict-prototypes -Wa,-alms=build/u2f-apdu.lst -DMAKE_ENTRY_PUBLIC -DUSE_SYS3 -DFREE_STANDING -DMHZ=21 -DENFORCE_DEBUG_LOCK -mthumb -mno-thumb-interwork -DTHUMB -MD -MP -MF .dep/u2f-apdu.o.d -I. -I.. u2f-apdu.c -o build/u2f-apdu.o
u2f-apdu.c:101:21: error: 'ATTESTATION_DER_LEN' undeclared here (not in a function)
     uint8_t attCert[ATTESTATION_DER_LEN]; // Attestation certificate
                     ^~~~~~~~~~~~~~~~~~~
u2f-apdu.c: In function 'u2f_register':
u2f-apdu.c:337:26: error: 'attestation_der' undeclared (first use in this function)
   memcpy (resp->attCert, attestation_der, ATTESTATION_DER_LEN);
                          ^~~~~~~~~~~~~~~
u2f-apdu.c:337:26: note: each undeclared identifier is reported only once for each function it appears in
u2f-apdu.c:341:37: error: 'attestation_key' undeclared (first use in this function)
   if (ecdsa_sign_p256r1 (hash, sig, attestation_key))
                                     ^~~~~~~~~~~~~~~
u2f-apdu.c:352:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make: *** [build/u2f-apdu.o] Error 1

This appears to be a missing header file.

Other tomu examples and code builds (ie toboot, examples, quickstart). So I suspect there is a missing dependency for macos that provides the header, or there is an un-commited header that is required.

Thanks,

mcassaniti commented 3 years ago

This doesn't just seem to be Mac OS. I've tried on Ubuntu 16.04 and 20.04.1 using Docker containers.

[EDIT] After looking harder and following the documentation to make sure a certificate is generated, I got this working. Try running make certclean && make after you've got the Python asn1crypto package installed correctly.