Implement SGX getrandom/getentropy without ocall (#1176)

Implement SGX getrandom with sgx_read_rand and getentropy with `rdseed` instruction
instead of ocall to improve the security.
This commit is contained in:
Wenyong Huang
2022-05-21 12:21:09 +08:00
committed by GitHub
parent c72501781a
commit 37cc6eac3b
5 changed files with 109 additions and 32 deletions

View File

@ -10,7 +10,6 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/random.h>
#include <sys/uio.h>
#include <fcntl.h>
#include <unistd.h>
@ -303,18 +302,6 @@ ocall_getopt(int argc, char *argv_buf, unsigned int argv_buf_len,
return getopt(argc, argv, optstring);
}
ssize_t
ocall_getrandom(void *buf, size_t buflen, unsigned int flags)
{
return getrandom(buf, buflen, flags);
}
int
ocall_getentropy(void *buffer, size_t length)
{
return getentropy(buffer, length);
}
int
ocall_sched_yield()
{