Skip to content

Commit dccc62b

Browse files
author
gojimmypi
committed
Rename wolfssh test certs
1 parent 7fdcf24 commit dccc62b

6 files changed

Lines changed: 47 additions & 38 deletions

File tree

examples/echoserver/echoserver.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1704,18 +1704,18 @@ static int load_key(byte isEcc, byte* buf, word32 bufSz)
17041704
#else
17051705
/* using buffers instead */
17061706
if (isEcc) {
1707-
if ((word32)sizeof_ecc_key_der_256 > bufSz) {
1707+
if ((word32)sizeof_ecc_key_der_256_ssh > bufSz) {
17081708
return 0;
17091709
}
1710-
WMEMCPY(buf, ecc_key_der_256, sizeof_ecc_key_der_256);
1711-
sz = sizeof_ecc_key_der_256;
1710+
WMEMCPY(buf, ecc_key_der_256_ssh, sizeof_ecc_key_der_256_ssh);
1711+
sz = sizeof_ecc_key_der_256_ssh;
17121712
}
17131713
else {
1714-
if ((word32)sizeof_rsa_key_der_2048 > bufSz) {
1714+
if ((word32)sizeof_rsa_key_der_2048_ssh > bufSz) {
17151715
return 0;
17161716
}
1717-
WMEMCPY(buf, (byte*)rsa_key_der_2048, sizeof_rsa_key_der_2048);
1718-
sz = sizeof_rsa_key_der_2048;
1717+
WMEMCPY(buf, (byte*)rsa_key_der_2048_ssh, sizeof_rsa_key_der_2048_ssh);
1718+
sz = sizeof_rsa_key_der_2048_ssh;
17191719
}
17201720
#endif
17211721

ide/Espressif/ESP-IDF/examples/wolfssh_echoserver/main/echoserver.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1677,18 +1677,18 @@ static int load_key(byte isEcc, byte* buf, word32 bufSz)
16771677
#else
16781678
/* using buffers instead */
16791679
if (isEcc) {
1680-
if ((word32)sizeof_ecc_key_der_256 > bufSz) {
1680+
if ((word32)sizeof_ecc_key_der_256_ssh > bufSz) {
16811681
return 0;
16821682
}
1683-
WMEMCPY(buf, ecc_key_der_256, sizeof_ecc_key_der_256);
1684-
sz = sizeof_ecc_key_der_256;
1683+
WMEMCPY(buf, ecc_key_der_256_ssh, sizeof_ecc_key_der_256_ssh);
1684+
sz = sizeof_ecc_key_der_256_ssh;
16851685
}
16861686
else {
1687-
if ((word32)sizeof_rsa_key_der_2048 > bufSz) {
1687+
if ((word32)sizeof_rsa_key_der_2048_ssh > bufSz) {
16881688
return 0;
16891689
}
1690-
WMEMCPY(buf, (byte*)rsa_key_der_2048, sizeof_rsa_key_der_2048);
1691-
sz = sizeof_rsa_key_der_2048;
1690+
WMEMCPY(buf, (byte*)rsa_key_der_2048_ssh, sizeof_rsa_key_der_2048_ssh);
1691+
sz = sizeof_rsa_key_der_2048_ssh;
16921692
}
16931693
#endif
16941694

ide/Renesas/cs+/demo_server/wolfssh_demo.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,18 +239,18 @@ static int load_key(byte isEcc, byte* buf, word32 bufSz)
239239
#else
240240
/* using buffers instead */
241241
if (isEcc) {
242-
if (sizeof_ecc_key_der_256 > bufSz) {
242+
if (sizeof_ecc_key_der_256_ssh > bufSz) {
243243
return 0;
244244
}
245-
WMEMCPY(buf, ecc_key_der_256, sizeof_ecc_key_der_256);
246-
sz = sizeof_ecc_key_der_256;
245+
WMEMCPY(buf, ecc_key_der_256_ssh, sizeof_ecc_key_der_256_ssh);
246+
sz = sizeof_ecc_key_der_256_ssh;
247247
}
248248
else {
249-
if (sizeof_rsa_key_der_2048 > bufSz) {
249+
if (sizeof_rsa_key_der_2048_ssh > bufSz) {
250250
return 0;
251251
}
252-
WMEMCPY(buf, rsa_key_der_2048, sizeof_rsa_key_der_2048);
253-
sz = sizeof_rsa_key_der_2048;
252+
WMEMCPY(buf, rsa_key_der_2048_ssh, sizeof_rsa_key_der_2048_ssh);
253+
sz = sizeof_rsa_key_der_2048_ssh;
254254
}
255255
#endif
256256

ide/mplabx/wolfssh.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -354,18 +354,18 @@ static int load_key(byte isEcc, byte* buf, word32 bufSz)
354354
word32 sz = 0;
355355

356356
if (isEcc) {
357-
if (sizeof_ecc_key_der_256 > bufSz) {
357+
if (sizeof_ecc_key_der_256_ssh > bufSz) {
358358
return 0;
359359
}
360-
WMEMCPY(buf, ecc_key_der_256, sizeof_ecc_key_der_256);
361-
sz = sizeof_ecc_key_der_256;
360+
WMEMCPY(buf, ecc_key_der_256_ssh, sizeof_ecc_key_der_256_ssh);
361+
sz = sizeof_ecc_key_der_256_ssh;
362362
}
363363
else {
364-
if (sizeof_rsa_key_der_2048 > bufSz) {
364+
if (sizeof_rsa_key_der_2048_ssh > bufSz) {
365365
return 0;
366366
}
367-
WMEMCPY(buf, (byte*)rsa_key_der_2048, sizeof_rsa_key_der_2048);
368-
sz = sizeof_rsa_key_der_2048;
367+
WMEMCPY(buf, (byte*)rsa_key_der_2048_ssh, sizeof_rsa_key_der_2048_ssh);
368+
sz = sizeof_rsa_key_der_2048_ssh;
369369
}
370370

371371
return sz;

tests/auth.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,18 +201,18 @@ static int load_key(byte isEcc, byte* buf, word32 bufSz)
201201
#else
202202
/* using buffers instead */
203203
if (isEcc) {
204-
if ((word32)sizeof_ecc_key_der_256 > bufSz) {
204+
if ((word32)sizeof_ecc_key_der_256_ssh > bufSz) {
205205
return 0;
206206
}
207-
WMEMCPY(buf, ecc_key_der_256, sizeof_ecc_key_der_256);
208-
sz = sizeof_ecc_key_der_256;
207+
WMEMCPY(buf, ecc_key_der_256_ssh, sizeof_ecc_key_der_256_ssh);
208+
sz = sizeof_ecc_key_der_256_ssh;
209209
}
210210
else {
211-
if ((word32)sizeof_rsa_key_der_2048 > bufSz) {
211+
if ((word32)sizeof_rsa_key_der_2048_ssh > bufSz) {
212212
return 0;
213213
}
214-
WMEMCPY(buf, (byte*)rsa_key_der_2048, sizeof_rsa_key_der_2048);
215-
sz = sizeof_rsa_key_der_2048;
214+
WMEMCPY(buf, (byte*)rsa_key_der_2048_ssh, sizeof_rsa_key_der_2048_ssh);
215+
sz = sizeof_rsa_key_der_2048_ssh;
216216
}
217217
#endif
218218

wolfssh/certs_test.h

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,19 @@
2121
#ifndef _WOLFSSH_CERTS_TEST_H_
2222
#define _WOLFSSH_CERTS_TEST_H_
2323

24+
/* To distinguish these certs from those in wolfssl add suffix: _ssh
25+
* See: https://github.com/wolfSSL/wolfssl/blob/master/wolfssl/certs_test.h
26+
* Generate: https://github.com/wolfSSL/wolfssl/blob/master/gencertbuf.pl
27+
*
28+
* In C89/C90 (which Watcom generally defaults to), sizeof must be a
29+
* compile-time constant expression when used in a static initializer.
30+
* So don't use `static const int sizeof_`
31+
*/
32+
2433
#if defined(NO_FILESYSTEM)
2534

2635
/* ./keys/server-key-rsa.der, 2048-bit */
27-
static const unsigned char rsa_key_der_2048[] =
36+
static const unsigned char rsa_key_der_2048_ssh[] =
2837
{
2938
0x30, 0x82, 0x04, 0xA3, 0x02, 0x01, 0x00, 0x02, 0x82, 0x01,
3039
0x01, 0x00, 0xDA, 0x5D, 0xAD, 0x25, 0x14, 0x76, 0x15, 0x59,
@@ -147,10 +156,10 @@ static const unsigned char rsa_key_der_2048[] =
147156
0x56, 0xC3, 0xCE, 0x77, 0x5F, 0x5B, 0xBA, 0x6C, 0x42, 0xF1,
148157
0x21
149158
};
150-
static const int sizeof_rsa_key_der_2048 = sizeof(rsa_key_der_2048);
159+
#define sizeof_rsa_key_der_2048_ssh (sizeof(rsa_key_der_2048_ssh))
151160

152161
/* ./keys/server-key-ecc.der, ECC */
153-
static const unsigned char ecc_key_der_256[] =
162+
static const unsigned char ecc_key_der_256_ssh[] =
154163
{
155164
0x30, 0x77, 0x02, 0x01, 0x01, 0x04, 0x20, 0x61, 0x09, 0x99,
156165
0x0B, 0x79, 0xD2, 0x5F, 0x28, 0x5A, 0x0F, 0x5D, 0x15, 0xCC,
@@ -166,10 +175,10 @@ static const unsigned char ecc_key_der_256[] =
166175
0x05, 0x58, 0x6B, 0x5F, 0x63, 0xC8, 0xDA, 0x1B, 0xC4, 0xF5,
167176
0x69
168177
};
169-
static const int sizeof_ecc_key_der_256 = sizeof(ecc_key_der_256);
178+
#define sizeof_ecc_key_der_256_ssh (sizeof(ecc_key_der_256_ssh))
170179

171180
/* ./keys/server-key-ecc-384.der, ECC */
172-
static const unsigned char ecc_key_der_384[] =
181+
static const unsigned char ecc_key_der_384_ssh[] =
173182
{
174183
0x30, 0x81, 0xA4, 0x02, 0x01, 0x01, 0x04, 0x30, 0x3E, 0xAD,
175184
0xD2, 0xBB, 0xBF, 0x05, 0xA7, 0xBE, 0x3A, 0x3F, 0x7C, 0x28,
@@ -189,10 +198,10 @@ static const unsigned char ecc_key_der_384[] =
189198
0x3D, 0x3E, 0xB8, 0x8D, 0x46, 0x7B, 0x5F, 0x27, 0xEB, 0xAB,
190199
0x21, 0x61, 0xC0, 0x00, 0x66, 0xFE, 0xBD
191200
};
192-
static const int sizeof_ecc_key_der_384 = sizeof(ecc_key_der_384);
201+
#define sizeof_ecc_key_der_384_ssh (sizeof(ecc_key_der_384_ssh))
193202

194203
/* ./keys/server-key-ecc-521.der, ECC */
195-
static const unsigned char ecc_key_der_521[] =
204+
static const unsigned char ecc_key_der_521_ssh[] =
196205
{
197206
0x30, 0x81, 0xDC, 0x02, 0x01, 0x01, 0x04, 0x42, 0x00, 0x4C,
198207
0xA4, 0xD8, 0x64, 0x28, 0xD9, 0x40, 0x0E, 0x7B, 0x2D, 0xF3,
@@ -218,7 +227,7 @@ static const unsigned char ecc_key_der_521[] =
218227
0x23, 0x7C, 0xA5, 0xA3, 0x45, 0xB1, 0x9E, 0x3F, 0x1A, 0x22,
219228
0x90, 0xB1, 0x54
220229
};
221-
static const int sizeof_ecc_key_der_521 = sizeof(ecc_key_der_521);
230+
#define sizeof_ecc_key_der_521_ssh (sizeof(ecc_key_der_521_ssh))
222231

223232
#endif /* NO_FILESYSTEM */
224233

0 commit comments

Comments
 (0)