intel / linux-sgx

Intel SGX for Linux*
https://www.intel.com/content/www/us/en/developer/tools/software-guard-extensions/linux-overview.html
Other
1.32k stars 543 forks source link

PSW Package Build on RHEL8.2 will not create all rpm's and second try will fail with compile error #591

Open florianbecker opened 4 years ago

florianbecker commented 4 years ago

Build: cd /tmp && \ git clone -b sgx_2.11 --depth 1 https://github.com/intel/linux-sgx.git linux-sgx-psw && \ cd linux-sgx-psw && \ ./download_prebuilt.sh && \ make preparation && \ \cp external/toolset/rhel8.2/{as,ld,ld.gold,objdump} /usr/local/bin && \ make -jnprocrpm_psw_pkg

Will result with aesmd rpm and nothing else - also exit the build with error code: `....

If you run manually second try: make -jnprocrpm_psw_pkg You will receive this build error: `[ 56%] Building CXX object bundles/epid_quote_service_bundle/CMakeFiles/epid_quote_service_bundle.dir/epid_provision_msg1.cpp.o /tmp/linux-sgx-psw/psw/ae/aesm_service/source/bundles/epid_quote_service_bundle/epid_provision_msg1.cpp: In Funktion »ae_error_t aesm_rsa_oaep_encrypt(const uint8_t, uint32_t, const void, uint8_t)«: /tmp/linux-sgx-psw/psw/ae/aesm_service/source/bundles/epid_quote_service_bundle/epid_provision_msg1.cpp:122:51: Fehler: ungültige Umwandlung von »const void« in »void« [-fpermissive] sgx_status_t res = sgx_rsa_pub_encrypt_sha256(rsa, NULL, &dst_len, src, src_len); ^~~ In file included from /tmp/linux-sgx-psw/psw/ae/aesm_service/source/../../inc/internal/pce_cert.h:34, from /tmp/linux-sgx-psw/psw/ae/aesm_service/source/common/type_length_value.h:78, from /tmp/linux-sgx-psw/psw/ae/aesm_service/source/bundles/epid_quote_service_bundle/epid_provision_msg1.cpp:33: /opt/intel/sgxsdk/include/sgx_tcrypto.h:828:51: Anmerkung: Argument 1 von »sgx_status_t sgx_rsa_pub_encrypt_sha256(void, unsigned char, size_t, const unsigned char, size_t)« wird initialisiert sgx_status_t sgx_rsa_pub_encrypt_sha256(void rsa_key, unsigned char pout_data, size_t pout_len, const unsigned char* pin_data, const size_t pin_len);


/tmp/linux-sgx-psw/psw/ae/aesm_service/source/bundles/epid_quote_service_bundle/epid_provision_msg1.cpp:128:38: Fehler: ungültige Umwandlung von »const void*« in »void*« [-fpermissive]
     res = sgx_rsa_pub_encrypt_sha256(rsa, dst, &dst_len, src, src_len);
                                      ^~~
In file included from /tmp/linux-sgx-psw/psw/ae/aesm_service/source/../../inc/internal/pce_cert.h:34,
                 from /tmp/linux-sgx-psw/psw/ae/aesm_service/source/common/type_length_value.h:78,
                 from /tmp/linux-sgx-psw/psw/ae/aesm_service/source/bundles/epid_quote_service_bundle/epid_provision_msg1.cpp:33:
/opt/intel/sgxsdk/include/sgx_tcrypto.h:828:51: Anmerkung:   Argument 1 von »sgx_status_t sgx_rsa_pub_encrypt_sha256(void*, unsigned char*, size_t*, const unsigned char*, size_t)« wird initialisiert
     sgx_status_t sgx_rsa_pub_encrypt_sha256(void* rsa_key, unsigned char* pout_data, size_t* pout_len, const unsigned char* pin_data, const size_t pin_len);
                                             ~~~~~~^~~~~~~
make[6]: *** [bundles/epid_quote_service_bundle/CMakeFiles/epid_quote_service_bundle.dir/build.make:172: bundles/epid_quote_service_bundle/CMakeFiles/epid_quote_service_bundle.dir/epid_provision_msg1.cpp.o] Fehler 1
make[6]: Verzeichnis „/tmp/linux-sgx-psw/psw/ae/aesm_service/source/build“ wird verlassen
make[5]: *** [CMakeFiles/Makefile2:434: bundles/epid_quote_service_bundle/CMakeFiles/epid_quote_service_bundle.dir/all] Fehler 2
make[5]: Verzeichnis „/tmp/linux-sgx-psw/psw/ae/aesm_service/source/build“ wird verlassen
make[4]: *** [Makefile:84: all] Fehler 2
make[4]: Verzeichnis „/tmp/linux-sgx-psw/psw/ae/aesm_service/source/build“ wird verlassen
make[3]: *** [Makefile:79: source/build/bin/aesm_service] Fehler 2
make[3]: *** Datei „source/build/bin/aesm_service“ wird gelöscht
make[3]: Verzeichnis „/tmp/linux-sgx-psw/psw/ae/aesm_service“ wird verlassen
make[2]: *** [Makefile:61: AESM] Fehler 2
make[2]: Verzeichnis „/tmp/linux-sgx-psw/psw/ae“ wird verlassen
make[1]: *** [Makefile:52: AE] Fehler 2
make[1]: Verzeichnis „/tmp/linux-sgx-psw/psw“ wird verlassen
make: *** [Makefile:61: psw] Fehler 2`

Building packages manually is possible, but i think this is not the way you preferred.
lzha101 commented 4 years ago

What is the version of the SGXSDK under /opt/intel/sgxsdk? From the build log, it should be an old version. Could you please reinstall an updated SDK and then try PSW build?

florianbecker commented 4 years ago

You are right, the sgxsdk was 2.9 - so installing 2.11 fixes the build error, but not the needed second run of make rpm_psw_pkg to create all psw packages. Is there also a solution to fix this?

Real issue is, that my dockerfile will abort here. PSW 2.9 builded correctly and complete.

lzha101 commented 4 years ago

but not the needed second run of make rpm_psw_pkg to create all psw packages. Is there also a solution to fix this?

Not very clear about this question. You can try to cleanup your repo and then build again.

florianbecker commented 4 years ago

This is a dockerfile for sgxsdk and psw build - you can see the build commands and the preinstall things. Dockerfile_rhel82.txt

This will result in: Ausführung(%clean): /bin/sh -e /var/tmp/rpm-tmp.B1ytp3

The container is not build correctly. Also, this happens, if you build it on a fresh RHEL8.2 installation. If you use the sgx_2.9 tag everything is fine. If you build it manually you can just rerun make rpm_psw_pkg and everything seems fine.