intel/intel-sgx-ssl

Link fail

dominions opened this issue · 2 comments

sgxsdk verison:2.12
sgxssl verion: 1.1.1i

I use EVP_* (such as EVP_CIPHER_CTX_new ) functions inside the enclave. Something wrong during the enclave's link phase.

GEN => App/Enclave_u.c
CC <= App/Enclave_u.c
CXX <= App/App.cpp
LINK => app
GEN => Enclave/Enclave_t.c
CC <= Enclave/Enclave_t.c
CXX <= Enclave/Enclave.cpp
/usr/local/bin/ld: /opt/intel/sgxssl/lib64/libsgx_tsgxssl_crypto.a(threads_pthread.o): in function CRYPTO_THREAD_lock_new': threads_pthread.c:(.text+0x45): undefined reference to pthread_rwlock_init'
/usr/local/bin/ld: /opt/intel/sgxssl/lib64/libsgx_tsgxssl_crypto.a(threads_pthread.o): in function CRYPTO_THREAD_read_lock': threads_pthread.c:(.text+0x75): undefined reference to pthread_rwlock_rdlock'
/usr/local/bin/ld: /opt/intel/sgxssl/lib64/libsgx_tsgxssl_crypto.a(threads_pthread.o): in function CRYPTO_THREAD_write_lock': threads_pthread.c:(.text+0x95): undefined reference to pthread_rwlock_wrlock'
/usr/local/bin/ld: /opt/intel/sgxssl/lib64/libsgx_tsgxssl_crypto.a(threads_pthread.o): in function CRYPTO_THREAD_unlock': threads_pthread.c:(.text+0xb5): undefined reference to pthread_rwlock_unlock'
/usr/local/bin/ld: /opt/intel/sgxssl/lib64/libsgx_tsgxssl_crypto.a(threads_pthread.o): in function CRYPTO_THREAD_lock_free': threads_pthread.c:(.text+0xda): undefined reference to pthread_rwlock_destroy'

I have fixed this issue by linking the library libsgx_pthread.
The issue occurs after I update the Intel sgxsdk and sgxssl. It seems that the old version doesn't need to link this library.

I have fixed this issue by linking the library libsgx_pthread.
The issue occurs after I update the Intel sgxsdk and sgxssl. It seems that the old version doesn't need to link this library.

Same issue with Linux 2.13 SGX SDK OpenSSL 1.1.1i, fixed by adding -lsgx_pthread, thanks for your solution.