-
Notifications
You must be signed in to change notification settings - Fork 100
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
Add: import of TPM keys #140
Conversation
Signed-off-by: Andreas Fuchs <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #140 +/- ##
==========================================
+ Coverage 67.34% 67.47% +0.13%
==========================================
Files 9 9
Lines 1228 1276 +48
==========================================
+ Hits 827 861 +34
- Misses 401 415 +14
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for picking up that work !!!
Some minor things in comments below...
@@ -199,6 +213,12 @@ parse_opts(int argc, char **argv) | |||
ERR("%s", help); | |||
exit(1); | |||
} | |||
|
|||
if (opt.importpub && !opt.importtpm) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
( ... || (!opt.importpub && opt.importtpm))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (a != b)
* @retval 1 on success | ||
* @retval 0 on failure | ||
*/ | ||
//TODO: all the Errors !!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that's done ?
* Read a tpm key as marshaled TPM2B_PUBLIC and (encrypted) TPM2B_PRIVATE from | ||
* disk and convert them into a TPM2_DATA representation | ||
* @param filename The filename to read the data from. | ||
* @param tpm2Datap The data after read. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing parameters...
return 0; | ||
} | ||
|
||
tpm2data = OPENSSL_malloc(sizeof(TPM2_DATA)); |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
} | ||
|
||
tpm2data = OPENSSL_malloc(sizeof(TPM2_DATA)); | ||
if (!tpm2data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indentation issue.
@@ -199,6 +213,12 @@ parse_opts(int argc, char **argv) | |||
ERR("%s", help); | |||
exit(1); | |||
} | |||
|
|||
if (opt.importpub && !opt.importtpm) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (a != b)
@@ -199,6 +213,12 @@ parse_opts(int argc, char **argv) | |||
ERR("%s", help); | |||
exit(1); | |||
} | |||
|
|||
if (opt.importpub && !opt.importtpm) { | |||
ERR("--importpub requires --importtpm"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we really need this limitation? Can't we just import a public key only?
Signed-off-by: Petr Gotthard <[email protected]>
- Migrated tests to tpm2-tools 4.x - Added missing documentation - Fixed indentation Signed-off-by: Petr Gotthard <[email protected]>
Closing; see #194 |
I have merged AndreasFuchsTPM@7f35306 , removed -j option, and fixed testcases so that they works with tpm2-tools 3.2.1-rc0.
I confirmed that existing openssl-generated RSA keys can be imported with tpm2-tools-4.0-rc0 in this way:
tpm2_createprimary -C o -g sha256 -G ecc -a "fixedtpm|fixedparent|sensitivedataorigin|noda|decrypt|restricted|userwithauth" -c primary.ctx
tpm2_import -G rsa -g sha256 -i rsakey.pem -C primary.ctx -u tpmkey.pub -r tpmkey.priv
tpm2tss-genkey -i tpmkey.pub -k tpmkey.priv rsakey.tss
I did not added testcase for this though since it requires migration to tpm2-tools-4.0, which breaks other testcases.
so Issue #39 could be closed after migration to tpm2-tools-4.0.