Skip to content

Commit

Permalink
test rc get random
Browse files Browse the repository at this point in the history
  • Loading branch information
JuergenReppSIT committed Jan 17, 2025
1 parent 33384e5 commit efd66d3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .ci/docker.run
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ fi
if [ "$SCANBUILD" == "yes" ]; then
scan-build --status-bugs make -j
elif [ "$CC" == "clang" ]; then
make -j distcheck
make -j distcheck V=1
else
make -j check
fi
Expand Down
4 changes: 3 additions & 1 deletion src/tss2-esys/api/Esys_GetRandom.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#ifdef HAVE_CONFIG_H
#include "config.h" // IWYU pragma: keep
#endif

#include <stdio.h>
#include <inttypes.h> // for PRIx32, PRIx16, int32_t
#include <stdlib.h> // for NULL, calloc

Expand Down Expand Up @@ -254,6 +254,8 @@ Esys_GetRandom_Finish(
}
/* This block handle the resubmission of TPM commands given a certain set of
* TPM response codes. */
fprintf(stdout, "XXX Test return code %x", r);
LOG_ERROR("XXX Test return code %x", r);
if (r == TPM2_RC_RETRY || r == TPM2_RC_TESTING || r == TPM2_RC_YIELDED) {
LOG_DEBUG("TPM returned RETRY, TESTING or YIELDED, which triggers a "
"resubmission: %" PRIx32, r);
Expand Down
7 changes: 5 additions & 2 deletions test/integration/esys-cp-hash.int.c
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ test_esyscp_hash(ESYS_CONTEXT * esys_context)
free(cp_hash);

r = Esys_GetRandom_Finish(esys_context, &randomBytes);
while (r == TSS2_ESYS_RC_TRY_AGAIN) {
LOG_ERROR("XXX Test return code2 %x", r);
while (base_rc(r) == TSS2_BASE_RC_TRY_AGAIN) {
// while (r == TSS2_ESYS_RC_TRY_AGAIN) {
r = Esys_GetRandom_Finish(esys_context, &randomBytes);
}
if (r != TPM2_RC_SUCCESS) {
Expand Down Expand Up @@ -155,7 +157,8 @@ test_esyscp_hash(ESYS_CONTEXT * esys_context)
LOG_ERROR("FlushContext FAILED! Response Code : 0x%x", r);
}

return EXIT_SUCCESS;
// return EXIT_SUCCESS;
return 77;

error_cleansession:
r = Esys_FlushContext(esys_context, session);
Expand Down

0 comments on commit efd66d3

Please sign in to comment.