Make unit test more resilient to earlier errors

This commit is contained in:
Josh Holtrop
2025-07-24 15:46:01 -04:00
parent 6309b241cd
commit 71bd9e2f6e

View File

@@ -18338,13 +18338,16 @@ static int test_wc_PKCS7_GetEnvelopedDataKariRid(void)
if (skiHexFile != XBADFILE) if (skiHexFile != XBADFILE)
XFCLOSE(skiHexFile); XFCLOSE(skiHexFile);
if (EXPECT_SUCCESS()) {
ret = wc_PKCS7_GetEnvelopedDataKariRid(cms, cmsSz, rid, &ridSz); ret = wc_PKCS7_GetEnvelopedDataKariRid(cms, cmsSz, rid, &ridSz);
}
ExpectIntEQ(ret, 0); ExpectIntEQ(ret, 0);
ExpectIntGT(ridSz, ridKeyIdentifierOffset); ExpectIntGT(ridSz, ridKeyIdentifierOffset);
/* The Subject Key Identifier hex file should have 2 hex characters for each /* The Subject Key Identifier hex file should have 2 hex characters for each
* byte of the key identifier in the returned recipient ID (rid), plus a * byte of the key identifier in the returned recipient ID (rid), plus a
* terminating new line character. */ * terminating new line character. */
ExpectIntGE(skiHexSz, ((ridSz - ridKeyIdentifierOffset) * 2) + 1); ExpectIntGE(skiHexSz, ((ridSz - ridKeyIdentifierOffset) * 2) + 1);
if (EXPECT_SUCCESS()) {
for (i = 0; i < (ridSz - ridKeyIdentifierOffset); i++) for (i = 0; i < (ridSz - ridKeyIdentifierOffset); i++)
{ {
size_t j; size_t j;
@@ -18363,6 +18366,7 @@ static int test_wc_PKCS7_GetEnvelopedDataKariRid(void)
} }
ExpectIntEQ(ridKeyIdByte, skiByte); ExpectIntEQ(ridKeyIdByte, skiByte);
} }
}
#endif #endif
#endif /* HAVE_PKCS7 */ #endif /* HAVE_PKCS7 */
return EXPECT_RESULT(); return EXPECT_RESULT();