Skip to content

Commit 11ef4e7

Browse files
resolve the compile error.
Update the test cases' source code to solve the conflict of test function name,like below:"/home/yangjiao/Vela_Project/vela_TinyCrypt/apps/crypto/tinycrypt/tinycrypt/tests/test_sha256.c:149: multiple definition of `test_5'; /home/yangjiao/Vela_Project/vela_TinyCrypt/nuttx/staging/libapps.a(test_hmac_prng.c.home.yangjiao.Vela_Project.vela_TinyCrypt.apps.crypto.tinycrypt.o):/home/yangjiao/Vela_Project/vela_TinyCrypt/apps/crypto/tinycrypt/tinycrypt/tests/test_hmac_prng.c:316: first defined here". Signed-off-by: yangjiao <[email protected]>
1 parent c62e6a0 commit 11ef4e7

File tree

2 files changed

+205
-0
lines changed

2 files changed

+205
-0
lines changed
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
--- tests/test_ctr_mode.c 2017-08-30 05:21:56.000000000 +0800
2+
+++ tests/test_ctr_mode.c 2023-08-11 15:31:21.409557000 +0800
3+
@@ -50,7 +50,7 @@
4+
/*
5+
* NIST SP 800-38a CTR Test for encryption and decryption.
6+
*/
7+
-unsigned int test_1_and_2(void)
8+
+static unsigned int test_1_and_2(void)
9+
{
10+
const uint8_t key[16] = {
11+
0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, 0xab, 0xf7, 0x15, 0x88,
12+
--- tests/test_hmac.c 2017-08-30 05:21:56.000000000 +0800
13+
+++ tests/test_hmac.c 2023-08-11 15:32:58.239231000 +0800
14+
@@ -66,7 +66,7 @@
15+
/*
16+
* NIST test vectors for encryption.
17+
*/
18+
-unsigned int test_1(void)
19+
+static unsigned int test_1(void)
20+
{
21+
unsigned int result = TC_PASS;
22+
23+
@@ -94,7 +94,7 @@
24+
return result;
25+
}
26+
27+
-unsigned int test_2(void)
28+
+static unsigned int test_2(void)
29+
{
30+
unsigned int result = TC_PASS;
31+
TC_PRINT("HMAC %s:\n", __func__);
32+
@@ -122,7 +122,7 @@
33+
return result;
34+
}
35+
36+
-unsigned int test_3(void)
37+
+static unsigned int test_3(void)
38+
{
39+
unsigned int result = TC_PASS;
40+
TC_PRINT("HMAC %s:\n", __func__);
41+
@@ -153,7 +153,7 @@
42+
return result;
43+
}
44+
45+
-unsigned int test_4(void)
46+
+static unsigned int test_4(void)
47+
{
48+
unsigned int result = TC_PASS;
49+
TC_PRINT("HMAC %s:\n", __func__);
50+
@@ -186,7 +186,7 @@
51+
return result;
52+
}
53+
54+
-unsigned int test_5(void)
55+
+static unsigned int test_5(void)
56+
{
57+
unsigned int result = TC_PASS;
58+
TC_PRINT("HMAC %s:\n", __func__);
59+
@@ -214,7 +214,7 @@
60+
return result;
61+
}
62+
63+
-unsigned int test_6(void)
64+
+static unsigned int test_6(void)
65+
{
66+
unsigned int result = TC_PASS;
67+
TC_PRINT("HMAC %s:\n", __func__);
68+
@@ -254,7 +254,7 @@
69+
return result;
70+
}
71+
72+
-unsigned int test_7(void)
73+
+static unsigned int test_7(void)
74+
{
75+
unsigned int result = TC_PASS;
76+
TC_PRINT("HMAC %s:\n", __func__);
77+
--- tests/test_sha256.c 2017-08-30 05:21:56.000000000 +0800
78+
+++ tests/test_sha256.c 2023-08-11 15:54:28.022372000 +0800
79+
@@ -50,7 +50,7 @@
80+
/*
81+
* NIST SHA256 test vector 1.
82+
*/
83+
-unsigned int test_1(void)
84+
+static unsigned int test_1(void)
85+
{
86+
unsigned int result = TC_PASS;
87+
88+
@@ -76,7 +76,7 @@
89+
/*
90+
* NIST SHA256 test vector 2.
91+
*/
92+
-unsigned int test_2(void)
93+
+static unsigned int test_2(void)
94+
{
95+
unsigned int result = TC_PASS;
96+
TC_PRINT("SHA256 test #2:\n");
97+
@@ -99,7 +99,7 @@
98+
return result;
99+
}
100+
101+
-unsigned int test_3(void)
102+
+static unsigned int test_3(void)
103+
{
104+
unsigned int result = TC_PASS;
105+
TC_PRINT("SHA256 test #3:\n");
106+
@@ -122,7 +122,7 @@
107+
return result;
108+
}
109+
110+
-unsigned int test_4(void)
111+
+static unsigned int test_4(void)
112+
{
113+
unsigned int result = TC_PASS;
114+
TC_PRINT("SHA256 test #4:\n");
115+
@@ -145,7 +145,7 @@
116+
return result;
117+
}
118+
119+
-unsigned int test_5(void)
120+
+static unsigned int test_5(void)
121+
{
122+
unsigned int result = TC_PASS;
123+
TC_PRINT("SHA256 test #5:\n");
124+
@@ -171,7 +171,7 @@
125+
return result;
126+
}
127+
128+
-unsigned int test_6(void)
129+
+static unsigned int test_6(void)
130+
{
131+
unsigned int result = TC_PASS;
132+
TC_PRINT("SHA256 test #6:\n");
133+
@@ -196,7 +196,7 @@
134+
return result;
135+
}
136+
137+
-unsigned int test_7(void)
138+
+static unsigned int test_7(void)
139+
{
140+
unsigned int result = TC_PASS;
141+
TC_PRINT("SHA256 test #7:\n");
142+
@@ -221,7 +221,7 @@
143+
return result;
144+
}
145+
146+
-unsigned int test_8(void)
147+
+static unsigned int test_8(void)
148+
{
149+
unsigned int result = TC_PASS;
150+
151+
@@ -247,7 +247,7 @@
152+
return result;
153+
}
154+
155+
-unsigned int test_9(void)
156+
+static unsigned int test_9(void)
157+
{
158+
unsigned int result = TC_PASS;
159+
TC_PRINT("SHA256 test #9:\n");
160+
@@ -272,7 +272,7 @@
161+
return result;
162+
}
163+
164+
-unsigned int test_10(void)
165+
+static unsigned int test_10(void)
166+
{
167+
unsigned int result = TC_PASS;
168+
TC_PRINT("SHA256 test #10:\n");
169+
@@ -297,7 +297,7 @@
170+
return result;
171+
}
172+
173+
-unsigned int test_11(void)
174+
+static unsigned int test_11(void)
175+
{
176+
unsigned int result = TC_PASS;
177+
TC_PRINT("SHA256 test #11:\n");
178+
@@ -322,7 +322,7 @@
179+
return result;
180+
}
181+
182+
-unsigned int test_12(void)
183+
+static unsigned int test_12(void)
184+
{
185+
unsigned int result = TC_PASS;
186+
TC_PRINT("SHA256 test #12:\n");
187+
@@ -351,7 +351,7 @@
188+
return result;
189+
}
190+
191+
-unsigned int test_13(void)
192+
+static unsigned int test_13(void)
193+
{
194+
unsigned int result = TC_PASS;
195+
TC_PRINT("SHA256 test #13:\n");
196+
@@ -379,7 +379,7 @@
197+
return result;
198+
}
199+
200+
-unsigned int test_14(void)
201+
+static unsigned int test_14(void)
202+
{
203+
unsigned int result = TC_PASS;
204+
TC_PRINT("SHA256 test #14:\n");

crypto/tinycrypt/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ $(TINYCRYPT_UNPACKNAME): $(TINYCRYPT_ZIP)
3737
$(Q) $(UNPACK) $(TINYCRYPT_ZIP)
3838
$(Q) mv tinycrypt-$(TINYCRYPT_VERSION) $(TINYCRYPT_UNPACKNAME)
3939
$(Q) touch $(TINYCRYPT_UNPACKNAME)
40+
$(Q) patch -p0 -d $(TINYCRYPT_UNPACKNAME) < 0001-TinyCrypt-test-resolve-compile-error.patch
4041

4142
ifeq ($(wildcard $(TINYCRYPT_UNPACKNAME)/.git),)
4243
context:: $(TINYCRYPT_UNPACKNAME)

0 commit comments

Comments
 (0)