mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 20:24:39 +02:00
Make unit test more resilient to earlier errors
This commit is contained in:
36
tests/api.c
36
tests/api.c
@@ -18338,30 +18338,34 @@ static int test_wc_PKCS7_GetEnvelopedDataKariRid(void)
|
|||||||
if (skiHexFile != XBADFILE)
|
if (skiHexFile != XBADFILE)
|
||||||
XFCLOSE(skiHexFile);
|
XFCLOSE(skiHexFile);
|
||||||
|
|
||||||
ret = wc_PKCS7_GetEnvelopedDataKariRid(cms, cmsSz, rid, &ridSz);
|
if (EXPECT_SUCCESS()) {
|
||||||
|
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);
|
||||||
for (i = 0; i < (ridSz - ridKeyIdentifierOffset); i++)
|
if (EXPECT_SUCCESS()) {
|
||||||
{
|
for (i = 0; i < (ridSz - ridKeyIdentifierOffset); i++)
|
||||||
size_t j;
|
|
||||||
byte ridKeyIdByte = rid[ridKeyIdentifierOffset + i];
|
|
||||||
byte skiByte = 0;
|
|
||||||
for (j = 0; j <= 1; j++)
|
|
||||||
{
|
{
|
||||||
byte hexChar = skiHex[i * 2 + j];
|
size_t j;
|
||||||
skiByte = skiByte << 4;
|
byte ridKeyIdByte = rid[ridKeyIdentifierOffset + i];
|
||||||
if ('0' <= hexChar && hexChar <= '9')
|
byte skiByte = 0;
|
||||||
skiByte |= (hexChar - '0');
|
for (j = 0; j <= 1; j++)
|
||||||
else if ('A' <= hexChar && hexChar <= 'F')
|
{
|
||||||
skiByte |= (hexChar - 'A' + 10);
|
byte hexChar = skiHex[i * 2 + j];
|
||||||
else
|
skiByte = skiByte << 4;
|
||||||
ExpectTrue(0);
|
if ('0' <= hexChar && hexChar <= '9')
|
||||||
|
skiByte |= (hexChar - '0');
|
||||||
|
else if ('A' <= hexChar && hexChar <= 'F')
|
||||||
|
skiByte |= (hexChar - 'A' + 10);
|
||||||
|
else
|
||||||
|
ExpectTrue(0);
|
||||||
|
}
|
||||||
|
ExpectIntEQ(ridKeyIdByte, skiByte);
|
||||||
}
|
}
|
||||||
ExpectIntEQ(ridKeyIdByte, skiByte);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* HAVE_PKCS7 */
|
#endif /* HAVE_PKCS7 */
|
||||||
|
Reference in New Issue
Block a user