forked from wolfSSL/wolfssl
clang-tidy fixes for test case
This commit is contained in:
32
tests/api.c
32
tests/api.c
@ -39240,16 +39240,16 @@ static int test_wc_PKCS7_DecodeEnvelopedData_stream(void)
|
||||
#if defined(HAVE_PKCS7) && defined(ASN_BER_TO_DER)
|
||||
EXPECT_DECLS;
|
||||
PKCS7* pkcs7 = NULL;
|
||||
int ret;
|
||||
FILE* f = NULL;
|
||||
int ret = 0;
|
||||
XFILE f = XBADFILE;
|
||||
const char* testStream = "./certs/test-stream-dec.p7b";
|
||||
byte testStreamBuffer[100];
|
||||
int testStreamBufferSz = 0;
|
||||
size_t testStreamBufferSz = 0;
|
||||
byte decodedData[MAX_TEST_DECODE_SIZE]; /* large enough to hold result of decode, which is ca-cert.pem */
|
||||
WOLFSSL_BUFFER_INFO out;
|
||||
|
||||
out.length = 0;
|
||||
out.buffer = decodedData;
|
||||
out.buffer = decodedData;
|
||||
|
||||
ExpectNotNull(pkcs7 = wc_PKCS7_New(HEAP_HINT, testDevId));
|
||||
ExpectIntEQ(wc_PKCS7_InitWithCert(pkcs7, (byte*)client_cert_der_2048,
|
||||
@ -39261,22 +39261,26 @@ static int test_wc_PKCS7_DecodeEnvelopedData_stream(void)
|
||||
test_wc_PKCS7_DecodeEnvelopedData_stream_decrypt_cb, (void*)&out), 0);
|
||||
|
||||
ExpectTrue((f = XFOPEN(testStream, "rb")) != XBADFILE);
|
||||
do {
|
||||
testStreamBufferSz = (int)XFREAD(testStreamBuffer, 1,
|
||||
sizeof(testStreamBuffer), f);
|
||||
ExpectIntGE(testStreamBufferSz, 0);
|
||||
if (testStreamBufferSz < 0) {
|
||||
break;
|
||||
}
|
||||
if (EXPECT_SUCCESS()) {
|
||||
do {
|
||||
testStreamBufferSz = XFREAD(testStreamBuffer, 1,
|
||||
sizeof(testStreamBuffer), f);
|
||||
if (testStreamBufferSz == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
ret = wc_PKCS7_DecodeEnvelopedData(pkcs7, testStreamBuffer,
|
||||
testStreamBufferSz, NULL, 0);
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PKCS7_WANT_READ_E));
|
||||
ret = wc_PKCS7_DecodeEnvelopedData(pkcs7, testStreamBuffer,
|
||||
(word32)testStreamBufferSz, NULL, 0);
|
||||
if (testStreamBufferSz < sizeof(testStreamBuffer)) {
|
||||
break;
|
||||
}
|
||||
} while (ret == WC_NO_ERR_TRACE(WC_PKCS7_WANT_READ_E));
|
||||
#ifdef NO_DES3
|
||||
ExpectIntEQ(ret, ALGO_ID_E);
|
||||
#else
|
||||
ExpectIntGT(ret, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (f != XBADFILE) {
|
||||
XFCLOSE(f);
|
||||
|
Reference in New Issue
Block a user