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

Remove signing key and conf from tests. Instead use OE_SET_ENCLAVE_SGX macro. #632

Merged
merged 0 commits into from
Sep 5, 2018

Conversation

anakrish
Copy link
Contributor

@anakrish anakrish commented Sep 4, 2018

  1. Remove signing key and conf from tests. Instead use OE_SET_ENCLAVE_SGX macro.
  2. Fix OE_SET_ENCLAVE_SGX macro to work in C++.
  3. The following 3 tests retain the signing key and conf:
    1.tests/load: This does not seem to be doing anything. No add_test is made.
    2.tests/props: Retained so that property merging scenario is tested.
    3. tests/debug-mode: Retained since it is testing debug property.

@CodeMonkeyLeet CodeMonkeyLeet added the engineering Issue is related to tools and processes necessary for maintaining the Open Enclave repo label Sep 4, 2018
@CodeMonkeyLeet CodeMonkeyLeet added this to Backlog in Public preview via automation Sep 4, 2018
Copy link
Contributor

@mikbras mikbras left a comment

Choose a reason for hiding this comment

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

Thank Anand for doing this. I was thinking you might want to add a test that retains the .pem and .conf files as a test of these features. I realize that props retains these, but I think we need a test that does not use that macro.

// In C++, by default const objects have internal linkage, causing the
// OE_EXPORT (visibility) to be ignored unless also qualified with
// extern
#define OE_EXPORT_CONST OE_EXPORT extern const
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe move this to bits/defs.h?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. Will move.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@@ -7,4 +7,4 @@ if (UNIX)
add_subdirectory(enc)
endif()

add_enclave_test(tests/echo ./host echo_host ./enc echo_enc.signed.so)
Copy link
Contributor

@mikbras mikbras Sep 4, 2018

Choose a reason for hiding this comment

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

Maybe add a test called oesign that has both the .pem and .conf files (but no macro).

Copy link
Contributor

Choose a reason for hiding this comment

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

And maybe a test called "configure" to test creation of an enclave that uses configuration file and signing.

Copy link
Contributor

Choose a reason for hiding this comment

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

@mikbras These tests already exist:

  • The new tests/bigmalloc only uses the signed form
  • The tests/props test enclave creation and the interaction of properties from config file with runtime settings/build time settings.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mikbras as Simon remaked, oesign functionality is covered by props.

  1. Should we rename tests/props to tests/oesign instead? I can also add a basic oesign test if that makese more sense.
  2. Can you look at tests/load? It seems to be doing nothing. Should it be deleted?

Copy link
Contributor

Choose a reason for hiding this comment

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

@anakrish I would not rename test/props to tests/oesign (I would reserve that name for tests explicitly testing various aspects of oesign on the command line (e.g. negative tests for input args etc.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@CodeMonkeyLeet, @mikbras
Fixed. Added basic tests/oesign that creates an enclave using sign.conf and private.pem, and checks conf values. We can later expand this for oesign tool negative testing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Anand, did you check this in yet? I don't see it in the anakrish.remove_signingkey branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

@CodeMonkeyLeet: props does not adequately test the scenario I am concerned about. We need a test that uses the .conf + .pem files but not the OE_SET_SGX_* macro. Else, how will we know it is picking up the correct settings from the .conf file and not the macro?

Copy link
Contributor

Choose a reason for hiding this comment

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

@mikbras As previously mentioned, tests/bigmalloc uses only the signed form without the SGX macro, and it's dependent on the properties being correctly interpreted for the large allocation testing.

Copy link
Contributor

@CodeMonkeyLeet CodeMonkeyLeet left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for doing this! A couple of additional comments:

  • I would remove tests/load entirely. It looks like an early debugging tool and it takes a cross folder dependency on tests/echo for its enclave.
  • Can you also remove the *.conf and *.pem files currently in the tools/oesign folder? They really shouldn't be there (not sure why the log.txt is there either under /files)

@CodeMonkeyLeet CodeMonkeyLeet moved this from Backlog to In review in Public preview Sep 4, 2018
@anakrish
Copy link
Contributor Author

anakrish commented Sep 5, 2018

@CodeMonkeyLeet Good catch. I have removed the files folder and conf from tools/oesign.
Addressed all PR feedback and all tests pass.

#include <openenclave/internal/tests.h>
#include <stdio.h>

static void _CheckProperties(
Copy link
Contributor

Choose a reason for hiding this comment

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

I would recommend not adding placeholders. It doesn't look like it's providing any additional code coverage relative to tests/props, and this is not a generalized framework for oesign testing (i.e. we hardcode the validation values based on the single sign.conf). Consider taking this out entirely until we can add a data driven framework to test and validate each of the command line arguments, and also various formatting quirks of the sign.conf files themselves.

@anakrish
Copy link
Contributor Author

anakrish commented Sep 5, 2018

@mikbras @CodeMonkeyLeet Can we come to a conclusion re whether we need to add tests/oesign as part of this PR or not?
If yes, I can bring it back. Otherwise this PR is good to go.

@anakrish
Copy link
Contributor Author

anakrish commented Sep 5, 2018

Failures only in Kabylake since that system is down. Merging so that I can move on to next task.

@anakrish anakrish merged commit 377b7e1 into master Sep 5, 2018
Public preview automation moved this from In review to Done Sep 5, 2018
@anakrish
Copy link
Contributor Author

anakrish commented Sep 5, 2018

This addresses #465

@CodeMonkeyLeet CodeMonkeyLeet deleted the anakrish.remove_signingkey branch September 11, 2018 19:18
johnkord pushed a commit that referenced this pull request Sep 12, 2018
…X macro. (#632)

* Remove sign.conf and private.pem from tests.

* Fix test.

* Address PR feedback.

* Remove unused feedback.

* Fix missing braces warning.

* Remove oseign tests based on PR feedback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
engineering Issue is related to tools and processes necessary for maintaining the Open Enclave repo
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants