Skip to content

Commit 02c2f44

Browse files
committed
Cleanup unused variables and function (void).
1 parent 6b02d78 commit 02c2f44

1 file changed

Lines changed: 22 additions & 29 deletions

File tree

IDE/Renesas/e2studio/RX72N/EnvisionKit/wolfssl_demo/wolfssl_tsip_unit_test.c

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,11 @@
5656
#endif
5757

5858
#ifndef NO_SHA
59-
int sha_test();
59+
int sha_test(void);
6060
#endif
6161

6262
#ifndef NO_SHA256
63-
int sha256_test();
63+
int sha256_test(void);
6464
#endif
6565

6666
#define SMALL_STACK_SIZE (1 * 1024)
@@ -718,36 +718,31 @@ static int tsip_rsa_test(int prnt, int keySize)
718718
RsaKey *key = NULL;
719719
WC_RNG rng;
720720
const char inStr [] = TEST_STRING;
721-
const char inStr2[] = TEST_STRING2;
722721
const word32 inLen = (word32)TEST_STRING_SZ;
723722
const word32 outSz = RSA_TEST_BYTES;
724723
word32 out_actual_len = 0;
725724
byte *in = NULL;
726-
byte *in2 = NULL;
727725
byte *out= NULL;
728-
byte *out2 = NULL;
726+
byte *outplain = NULL;
729727
int initRsa = 0;
730728
int devId = 7890; /* fixed devid for TSIP/SCE */
731729

732730
XMEMSET(&rng, 0, sizeof(rng));
733731

734-
key = (RsaKey *)XMALLOC(sizeof *key, NULL, DYNAMIC_TYPE_TMP_BUFFER);
732+
key = (RsaKey *)XMALLOC(sizeof(*key), NULL, DYNAMIC_TYPE_TMP_BUFFER);
735733
in = (byte*)XMALLOC(inLen, NULL, DYNAMIC_TYPE_TMP_BUFFER);
736-
in2 = (byte*)XMALLOC(inLen, NULL, DYNAMIC_TYPE_TMP_BUFFER);
737734
out = (byte*)XMALLOC(outSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
738-
out2 = (byte*)XMALLOC(outSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
735+
outplain = (byte*)XMALLOC(outSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
739736

740-
if (key == NULL || in == NULL || out == NULL ||
741-
in2 == NULL || out2 == NULL) {
737+
if (key == NULL || in == NULL || out == NULL || outplain == NULL) {
742738
ret = -1;
743739
goto out;
744740
}
745741

746-
XMEMSET(key, 0, sizeof *key);
742+
XMEMSET(key, 0, sizeof(*key));
747743
XMEMCPY(in, inStr, inLen);
748-
XMEMCPY(in2, inStr2, inLen);
749744
XMEMSET(out, 0, outSz);
750-
XMEMSET(out2, 0, outSz);
745+
XMEMSET(outplain, 0, outSz);
751746

752747
ret = wc_InitRsaKey_ex(key, NULL, devId);
753748
if (ret != 0) {
@@ -761,7 +756,7 @@ static int tsip_rsa_test(int prnt, int keySize)
761756
if ((ret = wc_RsaSetRNG(key, &rng)) != 0)
762757
goto out;
763758

764-
/* Set Rsa Key created by TSIP in Advance */
759+
/* Generate a new RSA key to use with TSIP/SCE */
765760
if ((ret = wc_MakeRsaKey(key, keySize, 65537, &rng)) != 0) {
766761
goto out;
767762
}
@@ -771,13 +766,13 @@ static int tsip_rsa_test(int prnt, int keySize)
771766
goto out;
772767
}
773768

774-
ret = wc_RsaPrivateDecrypt(out, (word32)(keySize/8), out2, outSz, key);
769+
ret = wc_RsaPrivateDecrypt(out, (word32)(keySize/8), outplain, outSz, key);
775770
if (ret < 0) {
776771
ret = -1;
777772
goto out;
778773
}
779774

780-
if (XMEMCMP(in, out2, inLen) != 0) {
775+
if (XMEMCMP(in, outplain, inLen) != 0) {
781776
ret = -2;
782777
goto out;
783778
}
@@ -792,11 +787,10 @@ static int tsip_rsa_test(int prnt, int keySize)
792787
XFREE(key, NULL, DYNAMIC_TYPE_TMP_BUFFER);
793788
}
794789
XFREE(in, NULL, DYNAMIC_TYPE_TMP_BUFFER);
795-
XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
796790
XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER);
797-
XFREE(out2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
791+
XFREE(outplain, NULL, DYNAMIC_TYPE_TMP_BUFFER);
798792

799-
(void) prnt;
793+
(void)prnt;
800794
return ret;
801795
}
802796

@@ -819,19 +813,17 @@ static int tsip_rsa_SignVerify_test(int prnt, int keySize)
819813

820814
XMEMSET(&rng, 0, sizeof(rng));
821815

822-
key = (RsaKey *)XMALLOC(sizeof *key, NULL, DYNAMIC_TYPE_TMP_BUFFER);
816+
key = (RsaKey *)XMALLOC(sizeof(*key), NULL, DYNAMIC_TYPE_TMP_BUFFER);
823817
in = (byte*)XMALLOC(inLen, NULL, DYNAMIC_TYPE_TMP_BUFFER);
824818
in2 = (byte*)XMALLOC(inLen, NULL, DYNAMIC_TYPE_TMP_BUFFER);
825819
out = (byte*)XMALLOC(outSz, NULL, DYNAMIC_TYPE_TMP_BUFFER);
826820

827-
(void)prnt;
828-
829821
if (key == NULL || in == NULL || out == NULL) {
830822
ret = -1;
831823
goto out;
832824
}
833825

834-
XMEMSET(key, 0, sizeof *key);
826+
XMEMSET(key, 0, sizeof(*key));
835827
XMEMCPY(in, inStr, inLen);
836828
XMEMCPY(in2, inStr2, inLen);
837829

@@ -847,7 +839,7 @@ static int tsip_rsa_SignVerify_test(int prnt, int keySize)
847839
if ((ret = wc_RsaSetRNG(key, &rng)) != 0)
848840
goto out;
849841

850-
/* make rsa key by SCE */
842+
/* Generate a new RSA key to use with TSIP/SCE */
851843
if ((ret = wc_MakeRsaKey(key, keySize, 65537, &rng)) != 0) {
852844
goto out;
853845
}
@@ -883,13 +875,14 @@ static int tsip_rsa_SignVerify_test(int prnt, int keySize)
883875
XFREE(in2, NULL, DYNAMIC_TYPE_TMP_BUFFER);
884876
XFREE(out, NULL, DYNAMIC_TYPE_TMP_BUFFER);
885877

878+
(void)prnt;
886879
return ret;
887880
}
888881
#endif /* NO_RSA */
889882

890883

891884
#ifdef TSIP_MULTIUNIT_TEST
892-
int tsip_crypt_sha_multitest()
885+
int tsip_crypt_sha_multitest(void)
893886
{
894887
int ret = 0;
895888
int num = 0;
@@ -947,7 +940,7 @@ int tsip_crypt_sha_multitest()
947940
}
948941

949942

950-
int tsip_crypt_AesCbc_multitest()
943+
int tsip_crypt_AesCbc_multitest(void)
951944
{
952945
int ret = 0;
953946
int num = 0;
@@ -1028,7 +1021,7 @@ int tsip_crypt_AesCbc_multitest()
10281021
}
10291022

10301023

1031-
int tsip_crypt_AesGcm_multitest()
1024+
int tsip_crypt_AesGcm_multitest(void)
10321025
{
10331026
int ret = 0;
10341027
int num = 0;
@@ -1107,7 +1100,7 @@ int tsip_crypt_AesGcm_multitest()
11071100
return ret;
11081101
}
11091102

1110-
int tsip_crypt_Sha_AesCbcGcm_multitest()
1103+
int tsip_crypt_Sha_AesCbcGcm_multitest(void)
11111104
{
11121105
int ret = 0;
11131106
int num = 0;
@@ -1187,7 +1180,7 @@ int tsip_crypt_Sha_AesCbcGcm_multitest()
11871180
#endif
11881181

11891182

1190-
int tsip_crypt_test()
1183+
int tsip_crypt_test(void)
11911184
{
11921185
int ret = 0;
11931186
e_tsip_err_t tsip_error_code;

0 commit comments

Comments
 (0)