Skip to content

Commit

Permalink
fapi: Add an integration test for policy nv with a TPM nv_index.
Browse files Browse the repository at this point in the history
A nv policy with the nv index 0x1800000 was added, and the integration
test for policy nv was modified to test also this policy.

Signed-off-by: Juergen Repp <juergen_repp@web.de>
  • Loading branch information
JuergenReppSIT committed Jul 8, 2022
1 parent bb9dc99 commit 92f1e4a
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Makefile-test.am
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ FAPI_TESTS_INTEGRATION += \
test/integration/fapi-provision-certificate.fint \
test/integration/fapi-provision-fingerprint_ecc.fint \
test/integration/fapi-provision-certificate_ecc.fint \
test/integration/fapi-quote-destructive.fint
test/integration/fapi-quote-destructive.fint \
test/integration/fapi-key-create-policy-nv-tpm-idx-sign.fint
endif #!TESTDEVICE

TESTS_INTEGRATION += $(FAPI_TESTS_INTEGRATION)
Expand Down Expand Up @@ -1888,6 +1889,14 @@ test_integration_fapi_key_create_policy_nv_sign_fint_SOURCES = \
test/integration/fapi-key-create-policy-nv-sign.int.c \
test/integration/main-fapi.c test/integration/test-fapi.h

test_integration_fapi_key_create_policy_nv_tpm_idx_sign_fint_CFLAGS = $(TESTS_CFLAGS) \
-DTPMIDX
test_integration_fapi_key_create_policy_nv_tpm_idx_sign_fint_LDADD = $(TESTS_LDADD)
test_integration_fapi_key_create_policy_nv_tpm_idx_sign_fint_LDFLAGS = $(TESTS_LDFLAGS)
test_integration_fapi_key_create_policy_nv_tpm_idx_sign_fint_SOURCES = \
test/integration/fapi-key-create-policy-nv-sign.int.c \
test/integration/main-fapi.c test/integration/test-fapi.h

test_integration_fapi_key_create_policy_nv_counter_sign_fint_CFLAGS = $(TESTS_CFLAGS)
test_integration_fapi_key_create_policy_nv_counter_sign_fint_LDADD = $(TESTS_LDADD)
test_integration_fapi_key_create_policy_nv_counter_sign_fint_LDFLAGS = $(TESTS_LDFLAGS)
Expand Down
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,7 @@ EXTRA_DIST += \
test/data/fapi/policy/pol_pcr16_0_or.json \
test/data/fapi/policy/pol_pcr8_0.json \
test/data/fapi/policy/pol_nv.json \
test/data/fapi/policy/pol_nv_tpm_idx.json \
test/data/fapi/policy/pol_nv_counter.json \
test/data/fapi/policy/pol_nv_written.json \
test/data/fapi/policy/pol_signed.json \
Expand Down
11 changes: 11 additions & 0 deletions test/data/fapi/policy/pol_nv_tpm_idx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"description":"Description pol_nv",
"policy":[
{
"type": "POLICYNV",
"nvIndex": 25165824,
"operandB": "01020304",
"operation": "EQ"
}
]
}
5 changes: 5 additions & 0 deletions test/integration/fapi-key-create-policy-nv-sign.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,19 @@ int
test_fapi_key_create_policy_nv_sign(FAPI_CONTEXT *context)
{
TSS2_RC r;
#ifdef TPMIDX
char *policy_name = "/policy/pol_nv";
#else
char *policy_name = "/policy/pol_nv_tpm_idx";
#endif
char *policy_file = TOP_SOURCEDIR "/test/data/fapi/policy/pol_nv.json";;
FILE *stream = NULL;
char *json_policy = NULL;
uint8_t *signature = NULL;
char *publicKey = NULL;
char *certificate = NULL;
long policy_size;

char *nvPathOrdinary = "/nv/Owner/myNV";
uint8_t data_nv[NV_SIZE] = { 1, 2, 3, 4 };
char *pathList = NULL;
Expand Down

0 comments on commit 92f1e4a

Please sign in to comment.