mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 02:37:28 +02:00
Remove unneccessary local variable initializations and remove local variable declarations in for-loops
This commit is contained in:
23
tests/api.c
23
tests/api.c
@ -2401,7 +2401,7 @@ static void test_wolfSSL_EVP_PKEY_print_public(void)
|
||||
WOLFSSL_BIO* wbio = NULL;
|
||||
WOLFSSL_EVP_PKEY* pkey = NULL;
|
||||
char line[256] = { 0 };
|
||||
|
||||
int i;
|
||||
|
||||
printf(testingFmt, "wolfSSL_EVP_PKEY_print_public()");
|
||||
/* test error cases */
|
||||
@ -2442,7 +2442,7 @@ static void test_wolfSSL_EVP_PKEY_print_public(void)
|
||||
|
||||
|
||||
/* skip to the end of modulus element*/
|
||||
for( int i = 0; i < 7 ;i++) {
|
||||
for( i = 0; i < 7 ;i++) {
|
||||
BIO_gets(wbio, line, sizeof(line));
|
||||
}
|
||||
|
||||
@ -2493,7 +2493,7 @@ static void test_wolfSSL_EVP_PKEY_print_public(void)
|
||||
sizeof(" 00:c2:35:2d:ec:83:83:6c:73:13:9e:52:7c:74:c8:\n")),0);
|
||||
|
||||
/* skip to the end of pub element*/
|
||||
for( int i = 0; i < 17 ;i++) {
|
||||
for( i = 0; i < 17 ;i++) {
|
||||
BIO_gets(wbio, line, sizeof(line));
|
||||
}
|
||||
|
||||
@ -2503,7 +2503,7 @@ static void test_wolfSSL_EVP_PKEY_print_public(void)
|
||||
sizeof("P:\n")),0);
|
||||
|
||||
/* skip to the end of P element*/
|
||||
for( int i = 0; i < 18 ;i++) {
|
||||
for( i = 0; i < 18 ;i++) {
|
||||
BIO_gets(wbio, line, sizeof(line));
|
||||
}
|
||||
|
||||
@ -2513,7 +2513,7 @@ static void test_wolfSSL_EVP_PKEY_print_public(void)
|
||||
sizeof("Q:\n")),0);
|
||||
|
||||
/* skip to the end of Q element*/
|
||||
for( int i = 0; i < 3 ;i++) {
|
||||
for( i = 0; i < 3 ;i++) {
|
||||
BIO_gets(wbio, line, sizeof(line));
|
||||
}
|
||||
BIO_gets(wbio, line, sizeof(line));
|
||||
@ -2522,7 +2522,7 @@ static void test_wolfSSL_EVP_PKEY_print_public(void)
|
||||
sizeof("G:\n")),0);
|
||||
|
||||
/* skip to the end of G element*/
|
||||
for( int i = 0; i < 18 ;i++) {
|
||||
for( i = 0; i < 18 ;i++) {
|
||||
BIO_gets(wbio, line, sizeof(line));
|
||||
}
|
||||
/* should reach EOF */
|
||||
@ -2568,7 +2568,7 @@ static void test_wolfSSL_EVP_PKEY_print_public(void)
|
||||
sizeof(" 04:55:bf:f4:0f:44:50:9a:3d:ce:9b:b7:f0:c5:4d:\n")),0);
|
||||
|
||||
/* skip to the end of pub element*/
|
||||
for( int i = 0; i < 4 ;i++) {
|
||||
for( i = 0; i < 4 ;i++) {
|
||||
BIO_gets(wbio, line, sizeof(line));
|
||||
}
|
||||
|
||||
@ -2624,7 +2624,7 @@ static void test_wolfSSL_EVP_PKEY_print_public(void)
|
||||
sizeof(" 34:41:bf:e9:f2:11:bf:05:db:b2:72:a8:29:cc:bd:\n")),0);
|
||||
|
||||
/* skip to the end of public-key element*/
|
||||
for( int i = 0; i < 17 ;i++) {
|
||||
for( i = 0; i < 17 ;i++) {
|
||||
BIO_gets(wbio, line, sizeof(line));
|
||||
}
|
||||
|
||||
@ -2639,7 +2639,7 @@ static void test_wolfSSL_EVP_PKEY_print_public(void)
|
||||
sizeof(" 00:d3:b2:99:84:5c:0a:4c:e7:37:cc:fc:18:37:01:\n")),0);
|
||||
|
||||
/* skip to the end of prime element*/
|
||||
for( int i = 0; i < 17 ;i++) {
|
||||
for( i = 0; i < 17 ;i++) {
|
||||
BIO_gets(wbio, line, sizeof(line));
|
||||
}
|
||||
|
||||
@ -2665,6 +2665,7 @@ static void test_wolfSSL_EVP_PKEY_print_public(void)
|
||||
(void)wbio;
|
||||
(void)rbio;
|
||||
(void)line;
|
||||
(void)i;
|
||||
printf(resultFmt, passed);
|
||||
#endif /* OPENSSL_EXTRA */
|
||||
}
|
||||
@ -22600,9 +22601,10 @@ static int test_wc_DhPublicKeyDecode(void)
|
||||
{
|
||||
int ret = 0;
|
||||
word32 inOutIdx;
|
||||
DhKey key;
|
||||
|
||||
#if defined(WOLFSSL_DH_EXTRA) && defined(USE_CERT_BUFFERS_2048)
|
||||
DhKey key;
|
||||
|
||||
printf(testingFmt, "test_wc_DhPublicKeyDecode()");
|
||||
|
||||
if (ret == 0) {
|
||||
@ -22643,7 +22645,6 @@ static int test_wc_DhPublicKeyDecode(void)
|
||||
printf(resultFmt, ret == 0 ? passed : failed);
|
||||
#endif
|
||||
(void)inOutIdx;
|
||||
(void)key;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -6890,10 +6890,6 @@ static int DumpElement(WOLFSSL_BIO* out, const byte* input,
|
||||
left = len % 15;
|
||||
|
||||
/* print pub element */
|
||||
idx = 0;
|
||||
wsz = Indent(indent, buff + idx);
|
||||
idx += wsz;
|
||||
|
||||
|
||||
while (line) {
|
||||
idx = 0;
|
||||
@ -6913,8 +6909,6 @@ static int DumpElement(WOLFSSL_BIO* out, const byte* input,
|
||||
|
||||
wolfSSL_BIO_write(out, buff, idx);
|
||||
XMEMSET(buff, 0, sizeof(buff));
|
||||
idx = 0;
|
||||
wsz = 0;
|
||||
line--;
|
||||
}
|
||||
idx = 0;
|
||||
@ -6953,11 +6947,12 @@ static int PrintPubKeyRSA(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
||||
word32 localIdx;
|
||||
word32 oid;
|
||||
byte tag;
|
||||
(void)pctx;
|
||||
int idx = 0;
|
||||
int wsz = 0;
|
||||
word32 i;
|
||||
|
||||
(void)pctx;
|
||||
|
||||
if (GetSequence(pkey, &inOutIdx, &length, pkeySz) < 0)
|
||||
return WOLFSSL_FAILURE;
|
||||
|
||||
@ -7024,8 +7019,6 @@ static int PrintPubKeyRSA(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
||||
/* print out public key elements */
|
||||
|
||||
idx = 0;
|
||||
wsz = 0;
|
||||
|
||||
wsz = Indent(indent, buff + idx);
|
||||
idx += wsz;
|
||||
|
||||
@ -7135,8 +7128,6 @@ static int PrintPubKeyEC(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
||||
nistCurveName = wolfSSL_EC_curve_nid2nist(nid);
|
||||
|
||||
idx = 0;
|
||||
wsz = 0;
|
||||
|
||||
wsz = Indent(indent, buff + idx);
|
||||
idx += wsz;
|
||||
|
||||
@ -7305,8 +7296,6 @@ static int PrintPubKeyDSA(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
||||
ySz = length;
|
||||
|
||||
idx = 0;
|
||||
wsz = 0;
|
||||
|
||||
wsz = Indent(indent, buff + idx);
|
||||
idx += wsz;
|
||||
|
||||
@ -7462,8 +7451,6 @@ static int PrintPubKeyDH(WOLFSSL_BIO* out, const byte* pkey, int pkeySz,
|
||||
|
||||
/* print elements */
|
||||
idx = 0;
|
||||
wsz = 0;
|
||||
|
||||
wsz = Indent(indent, buff + idx);
|
||||
idx += wsz;
|
||||
|
||||
|
Reference in New Issue
Block a user