Skip to content

Commit

Permalink
use pthread_self and pthread_equal from SGX SDK (#89)
Browse files Browse the repository at this point in the history
Signed-off-by: Jing He <jing.j.he@intel.com>
  • Loading branch information
jinghe-INTC committed May 17, 2021
1 parent 11c83e2 commit 2d0473a
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 29 deletions.
26 changes: 0 additions & 26 deletions Linux/sgx/libsgx_tsgxssl/tpthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,17 +278,6 @@ int sgxssl_pthread_setspecific (pthread_key_t key, const void *data)
return 0;
}

pthread_t sgxssl_pthread_self (void)
{
FSTART;

sgx_thread_t thread_self = sgx_thread_self();

FEND;

return thread_self;
}

//Thread forking isn't supported inside enclave.
int sgxssl_pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void))
{
Expand All @@ -300,20 +289,5 @@ int sgxssl_pthread_atfork(void (*prepare)(void), void (*parent)(void), void (*ch
return EPERM;
}

// Return 0 if the threads are not equal
int sgxssl_pthread_equal (pthread_t thread1, pthread_t thread2)
{
FSTART;

int retval = FALSE;

if (thread1 == thread2)
retval = TRUE;

FEND;

return retval;
}

}

2 changes: 1 addition & 1 deletion Linux/sgx/test_app/enclave/TestEnclave.edl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
enclave {

from "sgx_tsgxssl.edl" import *;

from "sgx_pthread.edl" import *;
/*
* uprint - invokes OCALL to display string buffer inside the enclave.
* [in]: copy the string buffer to App outside.
Expand Down
2 changes: 0 additions & 2 deletions openssl_source/bypass_to_sgxssl.h
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,6 @@ char * sgxssl___builtin___strcpy_chk(char *dest, const char *src, unsigned int d
#define pthread_setspecific sgxssl_pthread_setspecific
#define pthread_getspecific sgxssl_pthread_getspecific
#define pthread_key_delete sgxssl_pthread_key_delete
#define pthread_self sgxssl_pthread_self
#define pthread_equal sgxssl_pthread_equal

#define __ctype_b_loc sgxssl___ctype_b_loc
#define __ctype_tolower_loc sgxssl___ctype_tolower_loc
Expand Down

0 comments on commit 2d0473a

Please sign in to comment.