Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SGX: Enable basic Key Separation and Sharing Support #3054

Closed
bodzhang opened this issue May 19, 2020 · 2 comments · Fixed by #3700
Closed

SGX: Enable basic Key Separation and Sharing Support #3054

bodzhang opened this issue May 19, 2020 · 2 comments · Fixed by #3700
Assignees
Labels
attestation Related to attestation SGX Tag indicating associated with Intel SGX triaged This label classifies an issue/PR as having been triaged.
Milestone

Comments

@bodzhang
Copy link
Collaborator

Intel's Icelake CPU (10nm Gen 10 Core) adds SGX Key Separation and Sharing (KSS) feature. The feature is enumerated in CPUID.(EAX=12H, ECX=1).EAX.KSS[7]. This feature introduces new fields in multiple SGX data structure. The Table/Section reference used below refers to Intel's Software Developers Manual

  • ISVFAMILYID: ISV assigned 16-byte Product Family ID, at SW build time, in SIGSTRUCT(Table 37-19). It's reflected in REPORT(Table 37-21)

  • ISVEXTPRODID: ISV assigned 16-byte extend Product ID, in addition to the ISV assigned 2-byte ISVPRODID, at SW build time, in SIGSTRUCT. It's reflected in REPORT.

  • CONFIGID (Section 38.4.1.3): SGX runtime SW specified 32-byte configuration identifier, at Enclave creation time, in SECS (Table 37-2). It's reflected in REPORT and must be filled in TARGETINFO (Table 37-22). CONFIGID is intended to allow enclave creator to indicate what additional content may be accepted by the enclave post enclave initialization, whose exact usage depends on the enclave implementation.

  • CONFIGSVN (Section 38.4.2.3): SGX runtime SW specified 2-byte security version number to pair with CONFIGID, at Enclave creation time, in SECS. It's reflected in REPORT and must be filled in TARGETINFO. CONFIGSVN can be used in case the CONFIGID does not fully reflect the identity of the additional content that may be accepted by the enclave post enclave initialization, for example, CONFIGID as the hash of the signing key for verifying the additional content.

  • KEYREQUEST (Table 37-23) and KEYPOLICY (Table 37-25) are extended to allow selection of CONFIGSVN, ISVPRODID, CONFIGID, ISVFAMILYID, ISVEXTPROID, and exclusion of ISVPRODID as part of Enclave Seal or Provisioning Seal key derivation (Table 40-64).

  • KSS bit in ATTRIBUTES (Table 37-3): If SECS.ATTRIBUTES.KSS is set, KSS feature is enabled. If KSS is disabled, ISVFAMILYID, ISVEXTPRODID, CONFIGID, CONFIGSVN in SIGSTRUCT and SECS must be all-zeros, KSS bit must not be set in ATTRIBUTES, and KEYREQUEST/KEYPOLICY must not specify mixing them into Enclave Seal or Provisioning Seal key derivation. KSS bit in SIGSTRUCT.ATTRIBUTES and SIGSTRUCT.ATTRIBUTEMASK decides whether the enclave requires the KSS feature. EINIT instruction makes sure SECS.ATTRIBUTES & SIGSTRUCT.ATTRIBUTEMASK = SIGSTRUCT.ATTRIBUTES & SIGSTRUCT.ATTRIBUTEMASK (EINIT instruction section). So setting SIGSTRUCT.ATTRIBUTES.KSS = SIGSTRUCT.ATTRIBUTEMASK.KSS=1 means the Enclave must be initialized with SECS.ATTRIBTUES.KSS=1

OE SDK can enable the basic KSS support, to allow the ISVs to leverage the ISVFAMILYID, ISVEXTPROID for more flexibility in Enclave identity management scheme, and lay the foundation for future support of loading dynamic code/data after enclave initialization through CONFIGID/CONFIGSVN, for example, loading Java Applet into a Java Runtime enclave, while reflecting the loaded Java Applet identity in the Enclave identity reported in the Enclave REPORT.

For the basic KSS support, changes are required in the following OE SDK components:

  • SGX data structure definition to include KSS related fields.

  • Development tool to allow ISV to specify ISVFAMILYID, ISVEXTPRODID, and whether KSS feature is required by the Enclave through the KSS bit in SIGSTRUCT.ATTRIBUTES and SIGSTRUCT.ATTRIBUTEMASK, in SIGSTRUCT.

  • Enclave loader to detect whether the system support KSS, to parse the Enclave SIGSTRUCT.ATTRIBUTES and SIGSTRUCT.ATTRIBUTEMASK and decide whether to enable KSS (SECS.ATTRIBUTE.KSS bit), to set default CONFIGID/CONFIGSVN in SECS (before full support of loading dynamic code/data after enclave initialization, CONFIGID/CONFIGSVN should default to 0).

  • The code that fills TARGETINFO to include CONFIGID/CONFIGSVN fields from REPORT.

  • EGETKEY wrapper code to allow selection of CONFIGSVN, ISVPRODID, CONFIGID, ISVFAMILYID, ISVEXTPROID, and exclusion of ISVPRODID as part of Enclave Seal or Provisioning Seal key derivation.

  • Any Enclave identity check policy sample code to include ISVFAMILYID, ISVEXTPROID, CONFIGID, CONFIGSVN in the policy

Intel's SGX SDK already has the basic KSS support and can be used as reference for the implementation in the OE SDK.

@dthaler dthaler added the SGX Tag indicating associated with Intel SGX label May 19, 2020
@mingweishih mingweishih self-assigned this May 19, 2020
@radhikaj radhikaj added the core Issue is related to the core design of Open Enclave and its default 3rd party libs label Jun 1, 2020
@radhikaj radhikaj added triaged This label classifies an issue/PR as having been triaged. and removed core Issue is related to the core design of Open Enclave and its default 3rd party libs labels Jun 1, 2020
@radhikaj radhikaj added this to the Backlog milestone Jun 1, 2020
@radhikaj radhikaj added the attestation Related to attestation label Jun 1, 2020
@radhikaj
Copy link
Contributor

Fixed in #3799

@yentsanglee
Copy link
Contributor

Fixed in #3985

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
attestation Related to attestation SGX Tag indicating associated with Intel SGX triaged This label classifies an issue/PR as having been triaged.
Projects
None yet
5 participants