TEST ESYS: Fix wrong check of bad authorization.
The usage of the mask to get the return code was fixed.
Signed-off-by: Juergen Repp <juergen.repp@sit.fraunhofer.de>
diff --git a/test/integration/esys-audit.int.c b/test/integration/esys-audit.int.c
index 5dd20ee..c61c784 100644
--- a/test/integration/esys-audit.int.c
+++ b/test/integration/esys-audit.int.c
@@ -204,7 +204,7 @@
&setList,
&clearList);
- if ((r & (~TPM2_RC_N_MASK & ~TPM2_RC_H & ~TPM2_RC_S & ~TPM2_RC_P)) == TPM2_RC_BAD_AUTH) {
+ if ((r & ~TPM2_RC_N_MASK) == TPM2_RC_BAD_AUTH) {
/* Platform authorization not possible test will be skipped */
LOG_WARNING("Platform authorization not possible.");
failure_return = EXIT_SKIP;
diff --git a/test/integration/esys-change-eps.int.c b/test/integration/esys-change-eps.int.c
index f15493f..fb332f3 100644
--- a/test/integration/esys-change-eps.int.c
+++ b/test/integration/esys-change-eps.int.c
@@ -34,7 +34,7 @@
goto error;
}
- if ((r & (~TPM2_RC_N_MASK & ~TPM2_RC_H & ~TPM2_RC_S & ~TPM2_RC_P)) == TPM2_RC_BAD_AUTH) {
+ if ((r & ~TPM2_RC_N_MASK) == TPM2_RC_BAD_AUTH) {
/* Platform authorization not possible test will be skipped */
LOG_WARNING("Platform authorization not possible.");
return EXIT_SKIP;
diff --git a/test/integration/esys-clear-control.int.c b/test/integration/esys-clear-control.int.c
index 19ee10f..f1fee67 100644
--- a/test/integration/esys-clear-control.int.c
+++ b/test/integration/esys-clear-control.int.c
@@ -22,6 +22,7 @@
test_invoke_esapi(ESYS_CONTEXT * esys_context)
{
TSS2_RC r;
+ int failure_return = EXIT_FAILURE;
ESYS_TR auth_handle = ESYS_TR_RH_PLATFORM;
TPMI_YES_NO disable = TPM2_YES;
@@ -34,6 +35,13 @@
ESYS_TR_NONE,
disable);
+ if ((r & ~TPM2_RC_N_MASK) == TPM2_RC_BAD_AUTH) {
+ /* Platform authorization not possible test will be skipped */
+ LOG_WARNING("Platform authorization not possible.");
+ failure_return = EXIT_SKIP;
+ goto error;
+ }
+
goto_if_error(r, "Error: ClearControl", error);
r = Esys_Clear (
@@ -59,5 +67,5 @@
return EXIT_SUCCESS;
error:
- return EXIT_FAILURE;
+ return failure_return;
}
diff --git a/test/integration/esys-clockset.int.c b/test/integration/esys-clockset.int.c
index af023f2..473003c 100644
--- a/test/integration/esys-clockset.int.c
+++ b/test/integration/esys-clockset.int.c
@@ -42,7 +42,7 @@
);
goto_if_error(r, "Error: ClockSet", error);
- if ((r & (~TPM2_RC_N_MASK & ~TPM2_RC_H & ~TPM2_RC_S & ~TPM2_RC_P)) == TPM2_RC_BAD_AUTH) {
+ if ((r & ~TPM2_RC_N_MASK) == TPM2_RC_BAD_AUTH) {
/* Platform authorization not possible test will be skipped */
LOG_WARNING("Platform authorization not possible.");
failure_return = EXIT_SKIP;
diff --git a/test/integration/esys-hierarchy-control.int.c b/test/integration/esys-hierarchy-control.int.c
index 09ea10b..14bd168 100644
--- a/test/integration/esys-hierarchy-control.int.c
+++ b/test/integration/esys-hierarchy-control.int.c
@@ -38,7 +38,7 @@
enable,
state);
- if ((r & (~TPM2_RC_N_MASK & ~TPM2_RC_H & ~TPM2_RC_S & ~TPM2_RC_P)) == TPM2_RC_BAD_AUTH) {
+ if ((r & ~TPM2_RC_N_MASK) == TPM2_RC_BAD_AUTH) {
/* Platform authorization not possible test will be skipped */
LOG_WARNING("Platform authorization not possible.");
return EXIT_SKIP;
diff --git a/test/integration/esys-lock.int.c b/test/integration/esys-lock.int.c
index 4902f77..ab7d4b6 100644
--- a/test/integration/esys-lock.int.c
+++ b/test/integration/esys-lock.int.c
@@ -49,7 +49,7 @@
goto error;
}
- if ((r & (~TPM2_RC_N_MASK & ~TPM2_RC_H & ~TPM2_RC_S & ~TPM2_RC_P)) == TPM2_RC_BAD_AUTH) {
+ if ((r & ~TPM2_RC_N_MASK) == TPM2_RC_BAD_AUTH) {
/* Platform authorization not possible test will be skipped */
LOG_WARNING("Platform authorization not possible.");
return EXIT_SKIP;
diff --git a/test/integration/esys-pcr-auth-value.int.c b/test/integration/esys-pcr-auth-value.int.c
index 76dbb0b..95a7c54 100644
--- a/test/integration/esys-pcr-auth-value.int.c
+++ b/test/integration/esys-pcr-auth-value.int.c
@@ -70,7 +70,7 @@
TPM2_ALG_SHA1,
pcrHandle_handle);
- if ((r & (~TPM2_RC_N_MASK & ~TPM2_RC_H & ~TPM2_RC_S & ~TPM2_RC_P)) == TPM2_RC_BAD_AUTH) {
+ if ((r & ~TPM2_RC_N_MASK) == TPM2_RC_BAD_AUTH) {
/* Platform authorization not possible test will be skipped */
LOG_WARNING("Platform authorization not possible.");
failure_return = EXIT_SKIP;
diff --git a/test/integration/esys-pcr-basic.int.c b/test/integration/esys-pcr-basic.int.c
index 4721c12..f6e686d 100644
--- a/test/integration/esys-pcr-basic.int.c
+++ b/test/integration/esys-pcr-basic.int.c
@@ -118,7 +118,7 @@
&sizeNeeded,
&sizeAvailable);
- if ((r & (~TPM2_RC_N_MASK & ~TPM2_RC_H & ~TPM2_RC_S & ~TPM2_RC_P)) == TPM2_RC_BAD_AUTH) {
+ if ((r & ~TPM2_RC_N_MASK) == TPM2_RC_BAD_AUTH) {
/* Platform authorization not possible test will be skipped */
LOG_WARNING("Platform authorization not possible.");
failure_return = EXIT_SKIP;
diff --git a/test/integration/esys-policy-nv-undefine-special.int.c b/test/integration/esys-policy-nv-undefine-special.int.c
index 13312a5..c63200e 100644
--- a/test/integration/esys-policy-nv-undefine-special.int.c
+++ b/test/integration/esys-policy-nv-undefine-special.int.c
@@ -110,7 +110,7 @@
&publicInfo,
&nvHandle);
- if ((r & (~TPM2_RC_N_MASK & ~TPM2_RC_H & ~TPM2_RC_S & ~TPM2_RC_P)) == TPM2_RC_BAD_AUTH) {
+ if ((r & ~TPM2_RC_N_MASK) == TPM2_RC_BAD_AUTH) {
/* Platform authorization not possible test will be skipped */
LOG_WARNING("Platform authorization not possible.");
failure_return = EXIT_SKIP;
@@ -161,7 +161,7 @@
ESYS_TR_NONE
);
- if ((r & (~TPM2_RC_N_MASK & ~TPM2_RC_H & ~TPM2_RC_S & ~TPM2_RC_P)) == TPM2_RC_BAD_AUTH) {
+ if ((r & ~TPM2_RC_N_MASK) == TPM2_RC_BAD_AUTH) {
/* Platform authorization not possible test will be skipped */
LOG_WARNING("Platform authorization not possible.");
failure_return = EXIT_SKIP;
diff --git a/test/integration/esys-pp-commands.int.c b/test/integration/esys-pp-commands.int.c
index ee7dced..f165e22 100644
--- a/test/integration/esys-pp-commands.int.c
+++ b/test/integration/esys-pp-commands.int.c
@@ -45,7 +45,7 @@
return EXIT_SUCCESS;
}
- if ((r & (~TPM2_RC_N_MASK & ~TPM2_RC_H & ~TPM2_RC_S & ~TPM2_RC_P)) == TPM2_RC_BAD_AUTH) {
+ if ((r & ~TPM2_RC_N_MASK) == TPM2_RC_BAD_AUTH) {
/* Platform authorization not possible test will be skipped */
LOG_WARNING("Platform authorization not possible.");
failure_return = EXIT_SKIP;
diff --git a/test/integration/esys-set-algorithm-set.int.c b/test/integration/esys-set-algorithm-set.int.c
index 82170d9..74e8ea3 100644
--- a/test/integration/esys-set-algorithm-set.int.c
+++ b/test/integration/esys-set-algorithm-set.int.c
@@ -37,7 +37,7 @@
goto error;
}
- if ((r & (~TPM2_RC_N_MASK & ~TPM2_RC_H & ~TPM2_RC_S & ~TPM2_RC_P)) == TPM2_RC_BAD_AUTH) {
+ if ((r & ~TPM2_RC_N_MASK) == TPM2_RC_BAD_AUTH) {
/* Platform authorization not possible test will be skipped */
LOG_WARNING("Platform authorization not possible.");
failure_return = EXIT_SKIP;