@@ -824,7 +824,22 @@ static int __sgx_encl_init(struct sgx_encl *encl, char *sigstruct,
out:
if (ret) {
sgx_dbg(encl, "EINIT returned %d\n", ret);
- ret = -EBUSY;
+ switch (ret) {
+ case SGX_UNMASKED_EVENT:
+ ret = -EBUSY;
+ break;
+ case SGX_INVALID_SIG_STRUCT:
+ case SGX_INVALID_ATTRIBUTE:
+ case SGX_INVALID_MEASUREMENT:
+ case SGX_INVALID_SIGNATURE:
+ case SGX_INVALID_LICENSE:
+ case SGX_INVALID_CPUSVN:
+ ret = -EPERM;
+ break;
+ default:
+ ret = -EFAULT;
+ break;
+ }
} else {
encl->flags |= SGX_ENCL_INITIALIZED;