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)
|
#if defined(HAVE_PKCS7) && defined(ASN_BER_TO_DER)
|
||||||
EXPECT_DECLS;
|
EXPECT_DECLS;
|
||||||
PKCS7* pkcs7 = NULL;
|
PKCS7* pkcs7 = NULL;
|
||||||
int ret;
|
int ret = 0;
|
||||||
FILE* f = NULL;
|
XFILE f = XBADFILE;
|
||||||
const char* testStream = "./certs/test-stream-dec.p7b";
|
const char* testStream = "./certs/test-stream-dec.p7b";
|
||||||
byte testStreamBuffer[100];
|
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 */
|
byte decodedData[MAX_TEST_DECODE_SIZE]; /* large enough to hold result of decode, which is ca-cert.pem */
|
||||||
WOLFSSL_BUFFER_INFO out;
|
WOLFSSL_BUFFER_INFO out;
|
||||||
|
|
||||||
out.length = 0;
|
out.length = 0;
|
||||||
out.buffer = decodedData;
|
out.buffer = decodedData;
|
||||||
|
|
||||||
ExpectNotNull(pkcs7 = wc_PKCS7_New(HEAP_HINT, testDevId));
|
ExpectNotNull(pkcs7 = wc_PKCS7_New(HEAP_HINT, testDevId));
|
||||||
ExpectIntEQ(wc_PKCS7_InitWithCert(pkcs7, (byte*)client_cert_der_2048,
|
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);
|
test_wc_PKCS7_DecodeEnvelopedData_stream_decrypt_cb, (void*)&out), 0);
|
||||||
|
|
||||||
ExpectTrue((f = XFOPEN(testStream, "rb")) != XBADFILE);
|
ExpectTrue((f = XFOPEN(testStream, "rb")) != XBADFILE);
|
||||||
do {
|
if (EXPECT_SUCCESS()) {
|
||||||
testStreamBufferSz = (int)XFREAD(testStreamBuffer, 1,
|
do {
|
||||||
sizeof(testStreamBuffer), f);
|
testStreamBufferSz = XFREAD(testStreamBuffer, 1,
|
||||||
ExpectIntGE(testStreamBufferSz, 0);
|
sizeof(testStreamBuffer), f);
|
||||||
if (testStreamBufferSz < 0) {
|
if (testStreamBufferSz == 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = wc_PKCS7_DecodeEnvelopedData(pkcs7, testStreamBuffer,
|
ret = wc_PKCS7_DecodeEnvelopedData(pkcs7, testStreamBuffer,
|
||||||
testStreamBufferSz, NULL, 0);
|
(word32)testStreamBufferSz, NULL, 0);
|
||||||
} while (ret == WC_NO_ERR_TRACE(WC_PKCS7_WANT_READ_E));
|
if (testStreamBufferSz < sizeof(testStreamBuffer)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} while (ret == WC_NO_ERR_TRACE(WC_PKCS7_WANT_READ_E));
|
||||||
#ifdef NO_DES3
|
#ifdef NO_DES3
|
||||||
ExpectIntEQ(ret, ALGO_ID_E);
|
ExpectIntEQ(ret, ALGO_ID_E);
|
||||||
#else
|
#else
|
||||||
ExpectIntGT(ret, 0);
|
ExpectIntGT(ret, 0);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (f != XBADFILE) {
|
if (f != XBADFILE) {
|
||||||
XFCLOSE(f);
|
XFCLOSE(f);
|
||||||
|
Reference in New Issue
Block a user