From 4e073434bd41f570c3258faef201ad828c9d92f7 Mon Sep 17 00:00:00 2001 From: Aidan Garske Date: Tue, 8 Sep 2026 11:06:28 -0700 Subject: [PATCH] F-11907 - Fail PKCS7 examples when the output file cannot be opened --- examples/pkcs7/pkcs7.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/examples/pkcs7/pkcs7.c b/examples/pkcs7/pkcs7.c index 3bdc248b..721c8bea 100644 --- a/examples/pkcs7/pkcs7.c +++ b/examples/pkcs7/pkcs7.c @@ -221,6 +221,10 @@ static int PKCS7_SignVerifyEx(WOLFTPM2_DEV* dev, int tpmDevId, XFCLOSE(pemFile); } + else { + printf("Failed to open %s for writing\n", outFile); + rc = -1; goto exit; + } #else (void)outFile; #endif @@ -306,6 +310,10 @@ static int PKCS7_SignVerify(WOLFTPM2_DEV* dev, int tpmDevId, rc = -1; goto exit; } } + else { + printf("Failed to open %s for writing\n", outFile); + rc = -1; goto exit; + } #else (void)outFile; #endif