Article ID: 000058765 Content Type: Compatibility Last Reviewed: 10/13/2021

Unable to Use std::stringstream in an Intel® Software Guard Extensions (Intel® SGX) Enclave

BUILT IN - ARTICLE INTRO SECOND COMPONENT
Summary

Unsupported C++ Standard Libraries in Intel® SGX enclaves

Description

Why is it not possible to use std::stringstream in an enclave?

Resolution

Stringstream is part of <iostream> which is not supported by Intel SGX. The Intel SGX SDK Developer Reference Guide states:

"As for the C++ standard library, most functions will work just as its untrusted counterpart, but here is a high-level summary of features that are not supported inside the enclave:

  1. I/O related functions and classes, like <iostream>;
  2. Functions depending on a locale library;
  3. Any other functions that require system calls."

The Unsupported C++ Standard Classes and Functions section contains a table, titled Input/Output Library, in which iostream is listed as not supported.

As a workaround to accessing iostream functions within an enclave, create an ocall that calls the iostream functions in the untrusted app on behalf of the enclave. The SampleEnclave example in the SGX Software Development Kit (SGX SDK) demonstrates how to implement an ocall for using printf within an enclave.

Related Products

This article applies to 1 products