diff options
author | Juergen Repp <juergen.repp@sit.fraunhofer.de> | 2020-01-29 13:11:17 +0100 |
---|---|---|
committer | Tadeusz Struk <tadeusz.struk@intel.com> | 2020-01-29 09:36:23 -0800 |
commit | 401e2f276ec24b822eb5a69bb3aab5dfbf29f471 (patch) | |
tree | fbbc970365d8637905121095227f7da034aae6c3 /test/integration | |
parent | 69d6523137f1c625e0d660bc168c9d94b565a6a3 (diff) | |
download | tpm2-tss-401e2f276ec24b822eb5a69bb3aab5dfbf29f471.tar.gz |
FAPI: Fix exported Key lacks policy field (Addresses #1606)
* The policy was not part of the JSON export data for key duplication.
* The serialization and deserialization of the corresponding FAPI object,
and the export and import functions were adapted.
* The policy now is included in the key store for the imported object.
* The integration test was renamed, because the test is not RSA specific.
Signed-off-by: Juergen Repp <juergen.repp@sit.fraunhofer.de>
Diffstat (limited to 'test/integration')
-rw-r--r-- | test/integration/fapi-duplicate.int.c (renamed from test/integration/fapi-rsa-duplicate.int.c) | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/test/integration/fapi-rsa-duplicate.int.c b/test/integration/fapi-duplicate.int.c index 107c9662..e8722c76 100644 --- a/test/integration/fapi-rsa-duplicate.int.c +++ b/test/integration/fapi-duplicate.int.c @@ -76,21 +76,21 @@ test_fapi_duplicate(FAPI_CONTEXT *context) r = Fapi_Import(context, policy_name, json_policy); goto_if_error(r, "Error Fapi_List", error); - r = Fapi_CreateKey(context, "HS/SRK/myRsaCryptKey", "restricted,decrypt,noDa", + r = Fapi_CreateKey(context, "HS/SRK/myCryptKey", "restricted,decrypt,noDa", "", NULL); goto_if_error(r, "Error Fapi_CreateKey", error); - r = Fapi_ExportKey(context, "HS/SRK/myRsaCryptKey", NULL, &json_string_pub_key); + r = Fapi_ExportKey(context, "HS/SRK/myCryptKey", NULL, &json_string_pub_key); goto_if_error(r, "Error Fapi_CreateKey", error); r = Fapi_Import(context, "ext/myNewParent", json_string_pub_key); goto_if_error(r, "Error Fapi_Import", error); - r = Fapi_CreateKey(context, "HS/SRK/myRsaCryptKey/myRsaCryptKey2", + r = Fapi_CreateKey(context, "HS/SRK/myCryptKey/myCryptKey2", "exportable,decrypt,noDa", policy_name, NULL); goto_if_error(r, "Error Fapi_CreateKey", error); - r = Fapi_ExportKey(context, "HS/SRK/myRsaCryptKey/myRsaCryptKey2", + r = Fapi_ExportKey(context, "HS/SRK/myCryptKey/myCryptKey2", "ext/myNewParent", &json_duplicate); goto_if_error(r, "Error Fapi_CreateKey", error); @@ -101,22 +101,15 @@ test_fapi_duplicate(FAPI_CONTEXT *context) fprintf(stderr, "Duplicate:\n%s\n", json_duplicate); -#ifdef EK_PERSISTENT - Fapi_Delete(context, "P_RSA_EK_persistent"); -#else - Fapi_Delete(context, "P_RSA"); -#endif + r = Fapi_Delete(context, "/"); + goto_if_error(r, "Error Fapi_Delete", error); + SAFE_FREE(json_string_pub_key); SAFE_FREE(json_duplicate); SAFE_FREE(json_policy); return EXIT_SUCCESS; error: -#ifdef EK_PERSISTENT - Fapi_Delete(context, "P_RSA_EK_persistent"); -#else - Fapi_Delete(context, "P_RSA"); -#endif SAFE_FREE(json_string_pub_key); SAFE_FREE(json_duplicate); SAFE_FREE(json_policy); |