Skip to content
This repository has been archived by the owner on Jan 20, 2022. It is now read-only.

[Pal/Linux-SGX] Add sgx.protected_mr{enclave,signer}_files manifest options #2484

Closed
wants to merge 1 commit into from

Conversation

dimakuv
Copy link

@dimakuv dimakuv commented Jun 29, 2021

Description of the changes

Previously, only sgx.protected_files were available in the manifest. This kind of protected files needs a provisioned master (wrap) key. But sometimes it is enough to seal files on the same platform for later usage by the same enclave or by enclaves of the same signer: this is the SGX sealing feature.

This PR adds two more options to support SGX sealing: sgx.protected_mrenclave_files and sgx.protected_mrsigner_files.
Similarly to sgx.protected_files, these new options specify lists of files that are encrypted by the SGX key generated via SGX instruction EGETKEY(SEAL_KEY), bound to the MRENCLAVE/MRSIGNER enclave measurement (so that only instances of the same enclave/only enclaves with the same signer may decrypt protected files).

This is a reincarnation of #2328 but with a different user interface (and more flexible -- now we have three keys at the same time).

Closes #2328.

How to test this PR?

A corresponding LibOS test is added and documentation is updated.


This change is Reviewable

Copy link
Member

@mkow mkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 10 files at r1.
Reviewable status: 1 of 10 files reviewed, 3 unresolved discussions, not enough approvals from maintainers (1 more required), not enough approvals from different teams (1 more required, approved so far: Intel) (waiting on @dimakuv)


Documentation/manifest-syntax.rst, line 493 at r1 (raw file):

    sgx.protected_files.[identifier]           = "[URI]"
    sgx.protected_mrenclave_files.[identifier] = "[URI]"
    sgx.protected_mrsigner_files.[identifier]  = "[URI]"

Could we use the proper syntax for this? (i.e. TOML arrays, not dictionaries)
We'll be changing this for all other file types soon, so I don't like adding this it this way and then rewriting 3 weeks later :)


Documentation/manifest-syntax.rst, line 521 at r1 (raw file):

enclaves from the same signer

I'd say "enclaves signed with the same key", it's less convoluted (i.e. it's IMO not obvious what "signer" means precisely).


LibOS/shim/test/regression/test_libos.py, line 728 at r1 (raw file):

            self.assertIn(f'{node}/hugepages/hugepages-1048576kB/nr_hugepages: file', lines)

    def test_060_protected_file(self):

shouldn't this be named "sealed_file"?

Copy link
Author

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 10 files reviewed, 3 unresolved discussions, not enough approvals from maintainers (1 more required), not enough approvals from different teams (1 more required, approved so far: Intel), "fixup! " found in commit messages' one-liners (waiting on @mkow)


Documentation/manifest-syntax.rst, line 493 at r1 (raw file):

Previously, mkow (Michał Kowalczyk) wrote…

Could we use the proper syntax for this? (i.e. TOML arrays, not dictionaries)
We'll be changing this for all other file types soon, so I don't like adding this it this way and then rewriting 3 weeks later :)

The old sgx.protected_files and the new sgx.protected_{mrenclave,mrsigner}_files are both handled by the same (old) code. This old code uses TOML dictionaries. So it will not be straight-forward to use TOML dicts only for the new options.

Anyway, it looks like high time to change from TOML dicts -> TOML arrays in our SGX files. I will submit a separate PR on this... And then I guess we'll rebase this PR on top of that other one.


Documentation/manifest-syntax.rst, line 521 at r1 (raw file):

Previously, mkow (Michał Kowalczyk) wrote…
enclaves from the same signer

I'd say "enclaves signed with the same key", it's less convoluted (i.e. it's IMO not obvious what "signer" means precisely).

Done.


LibOS/shim/test/regression/test_libos.py, line 728 at r1 (raw file):

Previously, mkow (Michał Kowalczyk) wrote…

shouldn't this be named "sealed_file"?

Do you mean to rename just this test? Or do you want to rename sgx.protected_mrenclave_files/sgx.protected_mrsigner_files?

Aynway, I currently changed the name of this test and the name of the generated test file.

… options

Previously, only `sgx.protected_files` were available in the manifest.
This kind of protected files needs a provisioned master (wrap) key. But
sometimes it is enough to seal files on the same platform for later
usage by the same enclave or by enclaves of the same signer: this is the
SGX sealing feature.

This commit adds two more options to support SGX sealing:
`sgx.protected_mrenclave_files` and `sgx.protected_mrsigner_files`.
Similarly to `sgx.protected_files`, these new options specify lists of
files that are encrypted by the SGX key generated via SGX instruction
`EGETKEY(SEAL_KEY)`, bound to the MRENCLAVE/MRSIGNER enclave measurement
(so that only instances of the same enclave/only enclaves with the same
signer may decrypt protected files). A corresponding LibOS test is added
and documentation is updated to reflect this.

Signed-off-by: Dmitrii Kuvaiskii <[email protected]>
@dimakuv dimakuv force-pushed the dimakuv/add-seal-key-to-protected-files-2 branch from 1bcadc4 to 2dd6c64 Compare September 2, 2021 13:21
Copy link
Author

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 0 of 11 files reviewed, 3 unresolved discussions, not enough approvals from maintainers (1 more required), not enough approvals from different teams (1 more required, approved so far: Intel) (waiting on @mkow)


Documentation/manifest-syntax.rst, line 493 at r1 (raw file):

Previously, dimakuv (Dmitrii Kuvaiskii) wrote…

The old sgx.protected_files and the new sgx.protected_{mrenclave,mrsigner}_files are both handled by the same (old) code. This old code uses TOML dictionaries. So it will not be straight-forward to use TOML dicts only for the new options.

Anyway, it looks like high time to change from TOML dicts -> TOML arrays in our SGX files. I will submit a separate PR on this... And then I guess we'll rebase this PR on top of that other one.

Done. Rebased to the latest master. @mkow Please re-review.

Copy link
Author

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed comment

@dimakuv
Copy link
Author

dimakuv commented Sep 29, 2021

Recreated this PR in gramineproject/gramine#101. Closing here.

@dimakuv dimakuv closed this Sep 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants