Fix TLS and no-wolfCrypt CI failures

pull/598/head
Aidan Garske 2026-09-10 09:22:04 -07:00
parent 2f4b959ebb
commit 0df6f5253a
3 changed files with 28 additions and 21 deletions

View File

@ -895,8 +895,15 @@ echo -e "PCR Quote tests"
./examples/pcr/reset 16 >> $TPMPWD/run.out 2>&1
RESULT=$?
[ $RESULT -ne 0 ] && echo -e "pcr reset failed! $RESULT" && exit 1
./examples/pcr/extend 16 /usr/bin/zip >> $TPMPWD/run.out 2>&1
PCR_EXTEND_FILE=/usr/bin/zip
if [ $WOLFCRYPT_ENABLE -eq 0 ]; then
# Without wolfCrypt, extend expects a raw, precomputed SHA-256 digest.
PCR_EXTEND_FILE="$TPMPWD/pcr-extend.digest"
printf '%s' '0123456789abcdef0123456789abcdef' > "$PCR_EXTEND_FILE"
fi
./examples/pcr/extend 16 "$PCR_EXTEND_FILE" >> $TPMPWD/run.out 2>&1
RESULT=$?
[ $WOLFCRYPT_ENABLE -eq 0 ] && rm -f "$PCR_EXTEND_FILE"
[ $RESULT -ne 0 ] && echo -e "pcr extend file failed! $RESULT" && exit 1
./examples/pcr/quote 16 zip.quote >> $TPMPWD/run.out 2>&1
RESULT=$?

View File

@ -102,7 +102,7 @@ static void usage(void)
printf("* -h=host: Server hostname (default %s)\n", TLS_HOST);
printf("* -p=port: Supply a custom port number (default %d)\n", TLS_PORT);
#ifndef NO_FILESYSTEM
printf("* -A=file: Additional CA certificate file to trust\n");
printf("* -A=file: CA certificate file to trust\n");
#endif
#if defined(WOLFTPM_CRYPTOCB) && defined(HAVE_PK_CALLBACKS)
printf("* -pk: Use PK callbacks, not crypto callbacks\n");
@ -490,7 +490,15 @@ tls_setup:
}
#else
/* Load CA Certificates */
if (!useECC) {
if (caFile != NULL) {
if (wolfSSL_CTX_load_verify_locations(ctx, caFile,
0) != WOLFSSL_SUCCESS) {
printf("Error loading %s cert\n", caFile);
rc = -1;
goto exit;
}
}
else if (!useECC) {
#ifndef NO_RSA
if (wolfSSL_CTX_load_verify_locations(ctx, "./certs/ca-rsa-cert.pem",
0) != WOLFSSL_SUCCESS) {
@ -528,14 +536,6 @@ tls_setup:
goto exit;
#endif /* HAVE_ECC */
}
if (caFile != NULL) {
if (wolfSSL_CTX_load_verify_locations(ctx, caFile,
0) != WOLFSSL_SUCCESS) {
printf("Error loading %s cert\n", caFile);
rc = -1;
goto exit;
}
}
#endif /* !NO_FILESYSTEM */
/* Client Key (Mutual Authentication) */

View File

@ -123,7 +123,7 @@ static void usage(void)
printf("* -aes/xor: Use Parameter Encryption\n");
printf("* -p=port: Supply a custom port number (default %d)\n", TLS_PORT);
#ifndef NO_FILESYSTEM
printf("* -A=file: Additional CA certificate file to trust\n");
printf("* -A=file: CA certificate file to trust\n");
#endif
#if defined(WOLFTPM_CRYPTOCB) && defined(HAVE_PK_CALLBACKS)
printf("* -pk: Use PK callbacks, not crypto callbacks\n");
@ -537,7 +537,15 @@ tls_setup:
#endif
#else
/* Load CA Certificates */
if (!useECC) {
if (caFile != NULL) {
if (wolfSSL_CTX_load_verify_locations(ctx, caFile,
0) != WOLFSSL_SUCCESS) {
printf("Error loading %s cert\n", caFile);
rc = -1;
goto exit;
}
}
else if (!useECC) {
#ifndef NO_RSA
if (wolfSSL_CTX_load_verify_locations(ctx, CA_RSA_CERT_PATH,
0) != WOLFSSL_SUCCESS) {
@ -579,14 +587,6 @@ tls_setup:
goto exit;
#endif /* HAVE_ECC */
}
if (caFile != NULL) {
if (wolfSSL_CTX_load_verify_locations(ctx, caFile,
0) != WOLFSSL_SUCCESS) {
printf("Error loading %s cert\n", caFile);
rc = -1;
goto exit;
}
}
#endif /* !NO_FILESYSTEM */