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

update package mode signing engine samples #1471

Merged
merged 1 commit into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions doc/sign-package.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,11 @@ EXT2 image.
##### Running the signed application

Since the EXT2 image is separate from the signed application, its location must
be specified either by an environment variable (``MYST_ROOTFS``) or by an option
be specified either by an environment variable (``MYST_ROOTFS_PATH``) or by an option
(``--rootfs``). For example,

```
$ MYST_ROOTFS=ext2image ./myst/bin/hello
$ MYST_ROOTFS_PATH=ext2image ./myst/bin/hello
```

Or equivalently,
Expand Down
28 changes: 27 additions & 1 deletion tests/myst/signing-engine-test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,23 @@ tests: rootfs $(PRIVATE)
$(MAKE) test-ext2
$(MAKE) test-cpio

verify:
oesign dump --enclave-image=./hello.signed/lib/openenclave/mystenc.so # Verify without package mode enclave
myst dump-sgx ./myst/bin/hello # Verify packaged binary

test-ext2: rootfs roothash
$(RUNTEST) $(MYST) package-sgx --roothash=roothash NULL config.json --signing-engine-name $(TEST_ENGINE_ID) --signing-engine-path $(TEST_ENGINE_PATH) --signing-engine-key $(PRIVATE)
$(RUNTEST) ./myst/bin/hello --rootfs=ext2rootfs # METHOD 1
MYST_ROOTFS_PATH=ext2rootfs $(RUNTEST) ./myst/bin/hello # METHOD 2
rm -rf myst
@ echo "=== passed test (myst-sign-package-ext2-valid-1)\n\n"

$(RUNTEST) $(MYST) package-sgx --roothash=roothash NULL config.json --signing-engine-name $(TEST_ENGINE_ID) --signing-engine-path $(TEST_ENGINE_PATH) --signing-engine-key $(PRIVATE) --outfile "helloworld"
$(RUNTEST) ./helloworld --rootfs=ext2rootfs # METHOD 1
MYST_ROOTFS_PATH=ext2rootfs $(RUNTEST) ./helloworld # METHOD 2
rm helloworld
@ echo "=== passed test (myst-sign-package-ext2-valid-2)\n\n"

$(RUNTEST) $(MYST) sign ext2rootfs NULL config.json --signing-engine-name $(TEST_ENGINE_ID) --signing-engine-path $(TEST_ENGINE_PATH) --signing-engine-key $(PRIVATE) --roothash=roothash
$(RUNTEST) ./hello.signed/bin/myst $(EXEC) hello.signed/rootfs /bin/hello
rm -rf hello.signed
Expand Down Expand Up @@ -61,6 +77,16 @@ test-ext2: rootfs roothash
@ echo "=== passed test (myst-sign-ext2-engine-sign-wrong)\n\n"

test-cpio: rootfs
$(RUNTEST) $(MYST) package-sgx appdir $(PRIVATE) config.json --signing-engine-name $(TEST_ENGINE_ID) --signing-engine-path $(TEST_ENGINE_PATH) --signing-engine-key $(PRIVATE)
$(RUNTEST) ./myst/bin/hello
rm -rf myst
@ echo "=== passed test (myst-sign-package-cpio-valid-1)\n\n"

$(RUNTEST) $(MYST) package-sgx appdir $(PRIVATE) config.json --signing-engine-name $(TEST_ENGINE_ID) --signing-engine-path $(TEST_ENGINE_PATH) --signing-engine-key $(PRIVATE) --outfile "helloworld"
$(RUNTEST) ./helloworld
rm helloworld
@ echo "=== passed test (myst-sign-package-cpio-valid-2)\n\n"

$(RUNTEST) $(MYST) sign cpiorootfs NULL config.json --signing-engine-name $(TEST_ENGINE_ID) --signing-engine-path $(TEST_ENGINE_PATH) --signing-engine-key $(PRIVATE)
$(RUNTEST) ./hello.signed/bin/myst $(EXEC) hello.signed/rootfs /bin/hello
rm -rf hello.signed
Expand Down Expand Up @@ -104,4 +130,4 @@ myst:
$(MAKE) -C $(TOP)/tools/myst

clean:
rm -rf $(PRIVATE) wrongprivate.pem $(APPDIR) Helloworld ext2rootfs cpiorootfs hello.signed 1 2 3 4 roothash
rm -rf $(PRIVATE) wrongprivate.pem $(APPDIR) Helloworld ext2rootfs cpiorootfs hello.signed 1 2 3 4 roothash rootfs libmyst* myst*