microsoft / MSRSec

Security and Privacy Research at Microsoft
MIT License
37 stars 28 forks source link

Fallthorugh definition within OP-TEE 3.11-rc1 breaks fTPM compilation #33

Open Emantor opened 3 years ago

Emantor commented 3 years ago

OP-TEE introduced a #define fallthrough which is included in OP-TEE 3.11.0-rc1. However this clashes with WolfSSL, leading to a compilation error:

| /home/phoenix/build/YOCTO.BSP-Pengutronix-Labgrid/build/tmp/work/cortexa7hf-neon-oe-linux-gnueabi/ms-ftpm-ref/1.0+gitAUTOINC+81abeb9fa9-r0/recipe-sysroot/usr/include/optee/export-user_ta/include/compiler.h:257:21: error: expected ')' before '__attribute__'
|   257 | #define fallthrough __attribute__((__fallthrough__))
|       |                     ^~~~~~~~~~~~~
| ./lib/wolf/wolf_symlink/wolfssl/wolfcrypt/types.h:184:50: note: in expansion of macro 'fallthrough'
|   184 |             #define FALL_THROUGH __attribute__ ((fallthrough));
|       |                                                  ^~~~~~~~~~~
| lib/wolf/wolf_symlink/wolfcrypt/src/asn.c:5062:9: note: in expansion of macro 'FALL_THROUGH'
|  5062 |         FALL_THROUGH;
|       |         ^~~~~~~~~~~~
| In file included from ./lib/wolf/wolf_symlink/wolfssl/wolfcrypt/asn.h:26,
|                  from lib/wolf/wolf_symlink/wolfcrypt/src/asn.c:53:
| ./lib/wolf/wolf_symlink/wolfssl/wolfcrypt/types.h:184:62: error: expected identifier or '(' before ')' token
|   184 |             #define FALL_THROUGH __attribute__ ((fallthrough));
|       |                                                              ^
| lib/wolf/wolf_symlink/wolfcrypt/src/asn.c:5062:9: note: in expansion of macro 'FALL_THROUGH'
|  5062 |         FALL_THROUGH;
|       |         ^~~~~~~~~~~~
| make[1]: *** [/home/phoenix/build/YOCTO.BSP-Pengutronix-Labgrid/build/tmp/work/cortexa7hf-neon-oe-linux-gnueabi/ms-ftpm-ref/1.0+gitAUTOINC+81abeb9fa9-r0/recipe-sysroot/usr/include/optee/export-user_ta/mk/compile.mk:159: ../out/AuthVars/./lib/wolf/wolf_symlink/wolfcrypt/src/asn.o] Error 1
| make[1]: Leaving directory '/home/phoenix/build/YOCTO.BSP-Pengutronix-Labgrid/build/tmp/work/cortexa7hf-neon-oe-linux-gnueabi/ms-ftpm-ref/1.0+gitAUTOINC+81abeb9fa9-r0/git/TAs/optee_ta/AuthVars'
| make: *** [Makefile:9: authvars] Error 2
| WARNING: exit code 1 from a shell command.

Relevant PR in OP-TEE can be found here: https://github.com/OP-TEE/optee_os/pull/4125

muvarov commented 2 years ago

https://github.com/wolfSSL/wolfssl/pull/4563

muvarov commented 2 years ago

Submodules needs to be updated on top of https://github.com/wolfSSL/wolfssl/pull/4580 once merged.