Initial version
This commit is contained in:
1176
FreeRTOSv10.2.1/FreeRTOS-Plus/Source/WolfSSL/tests/api.c
Normal file
1176
FreeRTOSv10.2.1/FreeRTOS-Plus/Source/WolfSSL/tests/api.c
Normal file
File diff suppressed because it is too large
Load Diff
855
FreeRTOSv10.2.1/FreeRTOS-Plus/Source/WolfSSL/tests/hash.c
Normal file
855
FreeRTOSv10.2.1/FreeRTOS-Plus/Source/WolfSSL/tests/hash.c
Normal file
@ -0,0 +1,855 @@
|
||||
/* hash.c has unit tests
|
||||
*
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <wolfssl/wolfcrypt/md4.h>
|
||||
#include <wolfssl/wolfcrypt/md5.h>
|
||||
#include <wolfssl/wolfcrypt/sha.h>
|
||||
#include <wolfssl/wolfcrypt/sha256.h>
|
||||
#include <wolfssl/wolfcrypt/sha512.h>
|
||||
#include <wolfssl/wolfcrypt/ripemd.h>
|
||||
#include <wolfssl/wolfcrypt/hmac.h>
|
||||
|
||||
#include <tests/unit.h>
|
||||
|
||||
typedef struct testVector {
|
||||
const char* input;
|
||||
const char* output;
|
||||
size_t inLen;
|
||||
size_t outLen;
|
||||
} testVector;
|
||||
|
||||
int md4_test(void);
|
||||
int md5_test(void);
|
||||
int sha_test(void);
|
||||
int sha256_test(void);
|
||||
int sha512_test(void);
|
||||
int sha384_test(void);
|
||||
int ripemd_test(void);
|
||||
int hmac_md5_test(void);
|
||||
int hmac_sha_test(void);
|
||||
int hmac_sha256_test(void);
|
||||
int hmac_sha384_test(void);
|
||||
|
||||
int HashTest(void)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
printf(" Begin HASH Tests\n");
|
||||
|
||||
#ifndef NO_MD4
|
||||
if ( (ret = md4_test()) ) {
|
||||
printf( " MD4 test failed!\n");
|
||||
return ret;
|
||||
} else
|
||||
printf( " MD4 test passed!\n");
|
||||
#endif
|
||||
|
||||
#ifndef NO_MD5
|
||||
if ( (ret = md5_test()) ) {
|
||||
printf( " MD5 test failed!\n");
|
||||
return ret;
|
||||
} else
|
||||
printf( " MD5 test passed!\n");
|
||||
#endif
|
||||
|
||||
#ifndef NO_SHA
|
||||
if ( (ret = sha_test()) ) {
|
||||
printf( " SHA test failed!\n");
|
||||
return ret;
|
||||
} else
|
||||
printf( " SHA test passed!\n");
|
||||
#endif
|
||||
|
||||
#ifndef NO_SHA256
|
||||
if ( (ret = sha256_test()) ) {
|
||||
printf( " SHA-256 test failed!\n");
|
||||
return ret;
|
||||
} else
|
||||
printf( " SHA-256 test passed!\n");
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SHA512
|
||||
if ( (ret = sha512_test()) ) {
|
||||
printf( " SHA-512 test failed!\n");
|
||||
return ret;
|
||||
} else
|
||||
printf( " SHA-512 test passed!\n");
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SHA384
|
||||
if ( (ret = sha384_test()) ) {
|
||||
printf( " SHA-384 test failed!\n");
|
||||
return ret;
|
||||
} else
|
||||
printf( " SHA-384 test passed!\n");
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_RIPEMD
|
||||
if ( (ret = ripemd_test()) ) {
|
||||
printf( " RIPEMD test failed!\n");
|
||||
return ret;
|
||||
} else
|
||||
printf( " RIPEMD test passed!\n");
|
||||
#endif
|
||||
|
||||
#ifndef NO_HMAC
|
||||
#ifndef NO_MD5
|
||||
if ( (ret = hmac_md5_test()) ) {
|
||||
printf( " HMAC-MD5 test failed!\n");
|
||||
return ret;
|
||||
} else
|
||||
printf( " HMAC-MD5 test passed!\n");
|
||||
#endif
|
||||
|
||||
#ifndef NO_SHA
|
||||
if ( (ret = hmac_sha_test()) )
|
||||
printf( " HMAC-SHA test failed!\n");
|
||||
else
|
||||
printf( " HMAC-SHA test passed!\n");
|
||||
#endif
|
||||
|
||||
#ifndef NO_SHA256
|
||||
if ( (ret = hmac_sha256_test()) )
|
||||
printf( " HMAC-SHA256 test failed!\n");
|
||||
else
|
||||
printf( " HMAC-SHA256 test passed!\n");
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SHA384
|
||||
if ( (ret = hmac_sha384_test()) )
|
||||
printf( " HMAC-SHA384 test failed!\n");
|
||||
else
|
||||
printf( " HMAC-SHA384 test passed!\n");
|
||||
#endif
|
||||
#endif
|
||||
|
||||
printf(" End HASH Tests\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef NO_MD4
|
||||
|
||||
int md4_test(void)
|
||||
{
|
||||
Md4 md4;
|
||||
byte hash[MD4_DIGEST_SIZE];
|
||||
|
||||
testVector a, b, c, d, e, f, g;
|
||||
testVector test_md4[7];
|
||||
int times = sizeof(test_md4) / sizeof(testVector), i;
|
||||
|
||||
a.input = "";
|
||||
a.output = "\x31\xd6\xcf\xe0\xd1\x6a\xe9\x31\xb7\x3c\x59\xd7\xe0\xc0\x89"
|
||||
"\xc0";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
|
||||
b.input = "a";
|
||||
b.output = "\xbd\xe5\x2c\xb3\x1d\xe3\x3e\x46\x24\x5e\x05\xfb\xdb\xd6\xfb"
|
||||
"\x24";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
|
||||
c.input = "abc";
|
||||
c.output = "\xa4\x48\x01\x7a\xaf\x21\xd8\x52\x5f\xc1\x0a\xe8\x7a\xa6\x72"
|
||||
"\x9d";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
|
||||
d.input = "message digest";
|
||||
d.output = "\xd9\x13\x0a\x81\x64\x54\x9f\xe8\x18\x87\x48\x06\xe1\xc7\x01"
|
||||
"\x4b";
|
||||
d.inLen = strlen(d.input);
|
||||
d.outLen = strlen(d.output);
|
||||
|
||||
e.input = "abcdefghijklmnopqrstuvwxyz";
|
||||
e.output = "\xd7\x9e\x1c\x30\x8a\xa5\xbb\xcd\xee\xa8\xed\x63\xdf\x41\x2d"
|
||||
"\xa9";
|
||||
e.inLen = strlen(e.input);
|
||||
e.outLen = strlen(e.output);
|
||||
|
||||
f.input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345"
|
||||
"6789";
|
||||
f.output = "\x04\x3f\x85\x82\xf2\x41\xdb\x35\x1c\xe6\x27\xe1\x53\xe7\xf0"
|
||||
"\xe4";
|
||||
f.inLen = strlen(f.input);
|
||||
f.outLen = strlen(f.output);
|
||||
|
||||
g.input = "1234567890123456789012345678901234567890123456789012345678"
|
||||
"9012345678901234567890";
|
||||
g.output = "\xe3\x3b\x4d\xdc\x9c\x38\xf2\x19\x9c\x3e\x7b\x16\x4f\xcc\x05"
|
||||
"\x36";
|
||||
g.inLen = strlen(g.input);
|
||||
g.outLen = strlen(g.output);
|
||||
|
||||
test_md4[0] = a;
|
||||
test_md4[1] = b;
|
||||
test_md4[2] = c;
|
||||
test_md4[3] = d;
|
||||
test_md4[4] = e;
|
||||
test_md4[5] = f;
|
||||
test_md4[6] = g;
|
||||
|
||||
wc_InitMd4(&md4);
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
wc_Md4Update(&md4, (byte*)test_md4[i].input, (word32)test_md4[i].inLen);
|
||||
wc_Md4Final(&md4, hash);
|
||||
|
||||
if (memcmp(hash, test_md4[i].output, MD4_DIGEST_SIZE) != 0)
|
||||
return -205 - i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* NO_MD4 */
|
||||
|
||||
#ifndef NO_MD5
|
||||
|
||||
int md5_test(void)
|
||||
{
|
||||
Md5 md5;
|
||||
byte hash[MD5_DIGEST_SIZE];
|
||||
|
||||
testVector a, b, c, d, e;
|
||||
testVector test_md5[5];
|
||||
int times = sizeof(test_md5) / sizeof(testVector), i;
|
||||
|
||||
a.input = "abc";
|
||||
a.output = "\x90\x01\x50\x98\x3c\xd2\x4f\xb0\xd6\x96\x3f\x7d\x28\xe1\x7f"
|
||||
"\x72";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
|
||||
b.input = "message digest";
|
||||
b.output = "\xf9\x6b\x69\x7d\x7c\xb7\x93\x8d\x52\x5a\x2f\x31\xaa\xf1\x61"
|
||||
"\xd0";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
|
||||
c.input = "abcdefghijklmnopqrstuvwxyz";
|
||||
c.output = "\xc3\xfc\xd3\xd7\x61\x92\xe4\x00\x7d\xfb\x49\x6c\xca\x67\xe1"
|
||||
"\x3b";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
|
||||
d.input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345"
|
||||
"6789";
|
||||
d.output = "\xd1\x74\xab\x98\xd2\x77\xd9\xf5\xa5\x61\x1c\x2c\x9f\x41\x9d"
|
||||
"\x9f";
|
||||
d.inLen = strlen(d.input);
|
||||
d.outLen = strlen(d.output);
|
||||
|
||||
e.input = "1234567890123456789012345678901234567890123456789012345678"
|
||||
"9012345678901234567890";
|
||||
e.output = "\x57\xed\xf4\xa2\x2b\xe3\xc9\x55\xac\x49\xda\x2e\x21\x07\xb6"
|
||||
"\x7a";
|
||||
e.inLen = strlen(e.input);
|
||||
e.outLen = strlen(e.output);
|
||||
|
||||
test_md5[0] = a;
|
||||
test_md5[1] = b;
|
||||
test_md5[2] = c;
|
||||
test_md5[3] = d;
|
||||
test_md5[4] = e;
|
||||
|
||||
wc_InitMd5(&md5);
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
wc_Md5Update(&md5, (byte*)test_md5[i].input, (word32)test_md5[i].inLen);
|
||||
wc_Md5Final(&md5, hash);
|
||||
|
||||
if (memcmp(hash, test_md5[i].output, MD5_DIGEST_SIZE) != 0)
|
||||
return -5 - i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* NO_MD5 */
|
||||
|
||||
#ifndef NO_SHA
|
||||
int sha_test(void)
|
||||
{
|
||||
Sha sha;
|
||||
byte hash[SHA_DIGEST_SIZE];
|
||||
|
||||
testVector a, b, c, d;
|
||||
testVector test_sha[4];
|
||||
int ret = 0;
|
||||
int times = sizeof(test_sha) / sizeof(struct testVector), i;
|
||||
|
||||
a.input = "abc";
|
||||
a.output = "\xA9\x99\x3E\x36\x47\x06\x81\x6A\xBA\x3E\x25\x71\x78\x50\xC2"
|
||||
"\x6C\x9C\xD0\xD8\x9D";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
|
||||
b.input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
|
||||
b.output = "\x84\x98\x3E\x44\x1C\x3B\xD2\x6E\xBA\xAE\x4A\xA1\xF9\x51\x29"
|
||||
"\xE5\xE5\x46\x70\xF1";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
|
||||
c.input = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
"aaaaaa";
|
||||
c.output = "\x00\x98\xBA\x82\x4B\x5C\x16\x42\x7B\xD7\xA1\x12\x2A\x5A\x44"
|
||||
"\x2A\x25\xEC\x64\x4D";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
|
||||
d.input = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
||||
"aaaaaaaaaa";
|
||||
d.output = "\xAD\x5B\x3F\xDB\xCB\x52\x67\x78\xC2\x83\x9D\x2F\x15\x1E\xA7"
|
||||
"\x53\x99\x5E\x26\xA0";
|
||||
d.inLen = strlen(d.input);
|
||||
d.outLen = strlen(d.output);
|
||||
|
||||
test_sha[0] = a;
|
||||
test_sha[1] = b;
|
||||
test_sha[2] = c;
|
||||
test_sha[3] = d;
|
||||
|
||||
ret = wc_InitSha(&sha);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
wc_ShaUpdate(&sha, (byte*)test_sha[i].input, (word32)test_sha[i].inLen);
|
||||
wc_ShaFinal(&sha, hash);
|
||||
|
||||
if (memcmp(hash, test_sha[i].output, SHA_DIGEST_SIZE) != 0)
|
||||
return -10 - i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* NO_SHA */
|
||||
|
||||
#ifndef NO_SHA256
|
||||
int sha256_test(void)
|
||||
{
|
||||
Sha256 sha;
|
||||
byte hash[SHA256_DIGEST_SIZE];
|
||||
|
||||
testVector a, b;
|
||||
testVector test_sha[2];
|
||||
int ret;
|
||||
int times = sizeof(test_sha) / sizeof(struct testVector), i;
|
||||
|
||||
a.input = "abc";
|
||||
a.output = "\xBA\x78\x16\xBF\x8F\x01\xCF\xEA\x41\x41\x40\xDE\x5D\xAE\x22"
|
||||
"\x23\xB0\x03\x61\xA3\x96\x17\x7A\x9C\xB4\x10\xFF\x61\xF2\x00"
|
||||
"\x15\xAD";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
|
||||
b.input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
|
||||
b.output = "\x24\x8D\x6A\x61\xD2\x06\x38\xB8\xE5\xC0\x26\x93\x0C\x3E\x60"
|
||||
"\x39\xA3\x3C\xE4\x59\x64\xFF\x21\x67\xF6\xEC\xED\xD4\x19\xDB"
|
||||
"\x06\xC1";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
|
||||
test_sha[0] = a;
|
||||
test_sha[1] = b;
|
||||
|
||||
ret = wc_InitSha256(&sha);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
ret = wc_Sha256Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
ret = wc_Sha256Final(&sha, hash);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
if (memcmp(hash, test_sha[i].output, SHA256_DIGEST_SIZE) != 0)
|
||||
return -10 - i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SHA512
|
||||
int sha512_test(void)
|
||||
{
|
||||
Sha512 sha;
|
||||
byte hash[SHA512_DIGEST_SIZE];
|
||||
|
||||
testVector a, b;
|
||||
testVector test_sha[2];
|
||||
int times = sizeof(test_sha) / sizeof(struct testVector), i;
|
||||
int ret;
|
||||
|
||||
a.input = "abc";
|
||||
a.output = "\xdd\xaf\x35\xa1\x93\x61\x7a\xba\xcc\x41\x73\x49\xae\x20\x41"
|
||||
"\x31\x12\xe6\xfa\x4e\x89\xa9\x7e\xa2\x0a\x9e\xee\xe6\x4b\x55"
|
||||
"\xd3\x9a\x21\x92\x99\x2a\x27\x4f\xc1\xa8\x36\xba\x3c\x23\xa3"
|
||||
"\xfe\xeb\xbd\x45\x4d\x44\x23\x64\x3c\xe8\x0e\x2a\x9a\xc9\x4f"
|
||||
"\xa5\x4c\xa4\x9f";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
|
||||
b.input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
|
||||
"jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
|
||||
b.output = "\x8e\x95\x9b\x75\xda\xe3\x13\xda\x8c\xf4\xf7\x28\x14\xfc\x14"
|
||||
"\x3f\x8f\x77\x79\xc6\xeb\x9f\x7f\xa1\x72\x99\xae\xad\xb6\x88"
|
||||
"\x90\x18\x50\x1d\x28\x9e\x49\x00\xf7\xe4\x33\x1b\x99\xde\xc4"
|
||||
"\xb5\x43\x3a\xc7\xd3\x29\xee\xb6\xdd\x26\x54\x5e\x96\xe5\x5b"
|
||||
"\x87\x4b\xe9\x09";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
|
||||
test_sha[0] = a;
|
||||
test_sha[1] = b;
|
||||
|
||||
ret = wc_InitSha512(&sha);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
ret = wc_Sha512Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
ret = wc_Sha512Final(&sha, hash);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
if (memcmp(hash, test_sha[i].output, SHA512_DIGEST_SIZE) != 0)
|
||||
return -10 - i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_SHA384
|
||||
int sha384_test()
|
||||
{
|
||||
Sha384 sha;
|
||||
byte hash[SHA384_DIGEST_SIZE];
|
||||
|
||||
testVector a, b;
|
||||
testVector test_sha[2];
|
||||
int times = sizeof(test_sha) / sizeof(struct testVector), i;
|
||||
int ret;
|
||||
|
||||
a.input = "abc";
|
||||
a.output = "\xcb\x00\x75\x3f\x45\xa3\x5e\x8b\xb5\xa0\x3d\x69\x9a\xc6\x50"
|
||||
"\x07\x27\x2c\x32\xab\x0e\xde\xd1\x63\x1a\x8b\x60\x5a\x43\xff"
|
||||
"\x5b\xed\x80\x86\x07\x2b\xa1\xe7\xcc\x23\x58\xba\xec\xa1\x34"
|
||||
"\xc8\x25\xa7";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
|
||||
b.input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
|
||||
"jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
|
||||
b.output = "\x09\x33\x0c\x33\xf7\x11\x47\xe8\x3d\x19\x2f\xc7\x82\xcd\x1b"
|
||||
"\x47\x53\x11\x1b\x17\x3b\x3b\x05\xd2\x2f\xa0\x80\x86\xe3\xb0"
|
||||
"\xf7\x12\xfc\xc7\xc7\x1a\x55\x7e\x2d\xb9\x66\xc3\xe9\xfa\x91"
|
||||
"\x74\x60\x39";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
|
||||
test_sha[0] = a;
|
||||
test_sha[1] = b;
|
||||
|
||||
ret = wc_InitSha384(&sha);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
ret = wc_Sha384Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
ret = wc_Sha384Final(&sha, hash);
|
||||
if (ret != 0)
|
||||
return ret;
|
||||
|
||||
if (memcmp(hash, test_sha[i].output, SHA384_DIGEST_SIZE) != 0)
|
||||
return -10 - i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_RIPEMD
|
||||
int ripemd_test(void)
|
||||
{
|
||||
RipeMd ripemd;
|
||||
byte hash[RIPEMD_DIGEST_SIZE];
|
||||
|
||||
testVector a, b, c, d;
|
||||
testVector test_ripemd[4];
|
||||
int times = sizeof(test_ripemd) / sizeof(struct testVector), i;
|
||||
|
||||
a.input = "abc";
|
||||
a.output = "\x8e\xb2\x08\xf7\xe0\x5d\x98\x7a\x9b\x04\x4a\x8e\x98\xc6"
|
||||
"\xb0\x87\xf1\x5a\x0b\xfc";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
|
||||
b.input = "message digest";
|
||||
b.output = "\x5d\x06\x89\xef\x49\xd2\xfa\xe5\x72\xb8\x81\xb1\x23\xa8"
|
||||
"\x5f\xfa\x21\x59\x5f\x36";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
|
||||
c.input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
|
||||
c.output = "\x12\xa0\x53\x38\x4a\x9c\x0c\x88\xe4\x05\xa0\x6c\x27\xdc"
|
||||
"\xf4\x9a\xda\x62\xeb\x2b";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
|
||||
d.input = "12345678901234567890123456789012345678901234567890123456"
|
||||
"789012345678901234567890";
|
||||
d.output = "\x9b\x75\x2e\x45\x57\x3d\x4b\x39\xf4\xdb\xd3\x32\x3c\xab"
|
||||
"\x82\xbf\x63\x32\x6b\xfb";
|
||||
d.inLen = strlen(d.input);
|
||||
d.outLen = strlen(d.output);
|
||||
|
||||
test_ripemd[0] = a;
|
||||
test_ripemd[1] = b;
|
||||
test_ripemd[2] = c;
|
||||
test_ripemd[3] = d;
|
||||
|
||||
wc_InitRipeMd(&ripemd);
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
wc_RipeMdUpdate(&ripemd, (byte*)test_ripemd[i].input,
|
||||
(word32)test_ripemd[i].inLen);
|
||||
wc_RipeMdFinal(&ripemd, hash);
|
||||
|
||||
if (memcmp(hash, test_ripemd[i].output, RIPEMD_DIGEST_SIZE) != 0)
|
||||
return -10 - i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* WOLFSSL_RIPEMD */
|
||||
|
||||
#if !defined(NO_HMAC) && !defined(NO_MD5)
|
||||
int hmac_md5_test(void)
|
||||
{
|
||||
Hmac hmac;
|
||||
byte hash[MD5_DIGEST_SIZE];
|
||||
|
||||
const char* keys[]=
|
||||
{
|
||||
"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b",
|
||||
"Jefe",
|
||||
"\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
|
||||
};
|
||||
|
||||
testVector a, b, c;
|
||||
testVector test_hmac[3];
|
||||
|
||||
int ret;
|
||||
int times = sizeof(test_hmac) / sizeof(testVector), i;
|
||||
|
||||
a.input = "Hi There";
|
||||
a.output = "\x92\x94\x72\x7a\x36\x38\xbb\x1c\x13\xf4\x8e\xf8\x15\x8b\xfc"
|
||||
"\x9d";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
|
||||
b.input = "what do ya want for nothing?";
|
||||
b.output = "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7"
|
||||
"\x38";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
|
||||
c.input = "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD";
|
||||
c.output = "\x56\xbe\x34\x52\x1d\x14\x4c\x88\xdb\xb8\xc7\x33\xf0\xe8\xb3"
|
||||
"\xf6";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
|
||||
test_hmac[0] = a;
|
||||
test_hmac[1] = b;
|
||||
test_hmac[2] = c;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
#if defined(HAVE_FIPS)
|
||||
if (i == 1)
|
||||
continue; /* fips not allowed */
|
||||
#endif
|
||||
ret = wc_HmacSetKey(&hmac, MD5, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
if (ret != 0)
|
||||
return -4014;
|
||||
ret = wc_HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
(word32)test_hmac[i].inLen);
|
||||
if (ret != 0)
|
||||
return -4015;
|
||||
ret = wc_HmacFinal(&hmac, hash);
|
||||
if (ret != 0)
|
||||
return -4016;
|
||||
|
||||
if (memcmp(hash, test_hmac[i].output, MD5_DIGEST_SIZE) != 0)
|
||||
return -20 - i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(NO_HMAC) && !defined(NO_SHA)
|
||||
int hmac_sha_test(void)
|
||||
{
|
||||
Hmac hmac;
|
||||
byte hash[SHA_DIGEST_SIZE];
|
||||
|
||||
const char* keys[]=
|
||||
{
|
||||
"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
|
||||
"\x0b\x0b\x0b",
|
||||
"Jefe",
|
||||
"\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
|
||||
"\xAA\xAA\xAA"
|
||||
};
|
||||
|
||||
testVector a, b, c;
|
||||
testVector test_hmac[3];
|
||||
|
||||
int ret;
|
||||
int times = sizeof(test_hmac) / sizeof(testVector), i;
|
||||
|
||||
a.input = "Hi There";
|
||||
a.output = "\xb6\x17\x31\x86\x55\x05\x72\x64\xe2\x8b\xc0\xb6\xfb\x37\x8c"
|
||||
"\x8e\xf1\x46\xbe\x00";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
|
||||
b.input = "what do ya want for nothing?";
|
||||
b.output = "\xef\xfc\xdf\x6a\xe5\xeb\x2f\xa2\xd2\x74\x16\xd5\xf1\x84\xdf"
|
||||
"\x9c\x25\x9a\x7c\x79";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
|
||||
c.input = "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD";
|
||||
c.output = "\x12\x5d\x73\x42\xb9\xac\x11\xcd\x91\xa3\x9a\xf4\x8a\xa1\x7b"
|
||||
"\x4f\x63\xf1\x75\xd3";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
|
||||
test_hmac[0] = a;
|
||||
test_hmac[1] = b;
|
||||
test_hmac[2] = c;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
#if defined(HAVE_FIPS)
|
||||
if (i == 1)
|
||||
continue; /* fips not allowed */
|
||||
#endif
|
||||
ret = wc_HmacSetKey(&hmac, SHA, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
if (ret != 0)
|
||||
return -4017;
|
||||
ret = wc_HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
(word32)test_hmac[i].inLen);
|
||||
if (ret != 0)
|
||||
return -4018;
|
||||
ret = wc_HmacFinal(&hmac, hash);
|
||||
if (ret != 0)
|
||||
return -4019;
|
||||
|
||||
if (memcmp(hash, test_hmac[i].output, SHA_DIGEST_SIZE) != 0)
|
||||
return -20 - i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(NO_HMAC) && !defined(NO_SHA256)
|
||||
int hmac_sha256_test(void)
|
||||
{
|
||||
Hmac hmac;
|
||||
byte hash[SHA256_DIGEST_SIZE];
|
||||
|
||||
const char* keys[]=
|
||||
{
|
||||
"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
|
||||
"\x0b\x0b\x0b",
|
||||
"Jefe",
|
||||
"\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
|
||||
"\xAA\xAA\xAA"
|
||||
};
|
||||
|
||||
testVector a, b, c;
|
||||
testVector test_hmac[3];
|
||||
|
||||
int ret;
|
||||
int times = sizeof(test_hmac) / sizeof(testVector), i;
|
||||
|
||||
a.input = "Hi There";
|
||||
a.output = "\xb0\x34\x4c\x61\xd8\xdb\x38\x53\x5c\xa8\xaf\xce\xaf\x0b\xf1"
|
||||
"\x2b\x88\x1d\xc2\x00\xc9\x83\x3d\xa7\x26\xe9\x37\x6c\x2e\x32"
|
||||
"\xcf\xf7";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
|
||||
b.input = "what do ya want for nothing?";
|
||||
b.output = "\x5b\xdc\xc1\x46\xbf\x60\x75\x4e\x6a\x04\x24\x26\x08\x95\x75"
|
||||
"\xc7\x5a\x00\x3f\x08\x9d\x27\x39\x83\x9d\xec\x58\xb9\x64\xec"
|
||||
"\x38\x43";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
|
||||
c.input = "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD";
|
||||
c.output = "\x77\x3e\xa9\x1e\x36\x80\x0e\x46\x85\x4d\xb8\xeb\xd0\x91\x81"
|
||||
"\xa7\x29\x59\x09\x8b\x3e\xf8\xc1\x22\xd9\x63\x55\x14\xce\xd5"
|
||||
"\x65\xfe";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
|
||||
test_hmac[0] = a;
|
||||
test_hmac[1] = b;
|
||||
test_hmac[2] = c;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
#if defined(HAVE_FIPS)
|
||||
if (i == 1)
|
||||
continue; /* fips not allowed */
|
||||
#endif
|
||||
ret = wc_HmacSetKey(&hmac,SHA256, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
if (ret != 0)
|
||||
return -4020;
|
||||
ret = wc_HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
(word32)test_hmac[i].inLen);
|
||||
if (ret != 0)
|
||||
return -4021;
|
||||
ret = wc_HmacFinal(&hmac, hash);
|
||||
if (ret != 0)
|
||||
return -4022;
|
||||
|
||||
if (memcmp(hash, test_hmac[i].output, SHA256_DIGEST_SIZE) != 0)
|
||||
return -20 - i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(NO_HMAC) && defined(WOLFSSL_SHA384)
|
||||
int hmac_sha384_test(void)
|
||||
{
|
||||
Hmac hmac;
|
||||
byte hash[SHA384_DIGEST_SIZE];
|
||||
|
||||
const char* keys[]=
|
||||
{
|
||||
"\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b"
|
||||
"\x0b\x0b\x0b",
|
||||
"Jefe",
|
||||
"\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
|
||||
"\xAA\xAA\xAA"
|
||||
};
|
||||
|
||||
testVector a, b, c;
|
||||
testVector test_hmac[3];
|
||||
|
||||
int ret;
|
||||
int times = sizeof(test_hmac) / sizeof(testVector), i;
|
||||
|
||||
a.input = "Hi There";
|
||||
a.output = "\xaf\xd0\x39\x44\xd8\x48\x95\x62\x6b\x08\x25\xf4\xab\x46\x90"
|
||||
"\x7f\x15\xf9\xda\xdb\xe4\x10\x1e\xc6\x82\xaa\x03\x4c\x7c\xeb"
|
||||
"\xc5\x9c\xfa\xea\x9e\xa9\x07\x6e\xde\x7f\x4a\xf1\x52\xe8\xb2"
|
||||
"\xfa\x9c\xb6";
|
||||
a.inLen = strlen(a.input);
|
||||
a.outLen = strlen(a.output);
|
||||
|
||||
b.input = "what do ya want for nothing?";
|
||||
b.output = "\xaf\x45\xd2\xe3\x76\x48\x40\x31\x61\x7f\x78\xd2\xb5\x8a\x6b"
|
||||
"\x1b\x9c\x7e\xf4\x64\xf5\xa0\x1b\x47\xe4\x2e\xc3\x73\x63\x22"
|
||||
"\x44\x5e\x8e\x22\x40\xca\x5e\x69\xe2\xc7\x8b\x32\x39\xec\xfa"
|
||||
"\xb2\x16\x49";
|
||||
b.inLen = strlen(b.input);
|
||||
b.outLen = strlen(b.output);
|
||||
|
||||
c.input = "\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD\xDD"
|
||||
"\xDD\xDD\xDD\xDD\xDD\xDD";
|
||||
c.output = "\x88\x06\x26\x08\xd3\xe6\xad\x8a\x0a\xa2\xac\xe0\x14\xc8\xa8"
|
||||
"\x6f\x0a\xa6\x35\xd9\x47\xac\x9f\xeb\xe8\x3e\xf4\xe5\x59\x66"
|
||||
"\x14\x4b\x2a\x5a\xb3\x9d\xc1\x38\x14\xb9\x4e\x3a\xb6\xe1\x01"
|
||||
"\xa3\x4f\x27";
|
||||
c.inLen = strlen(c.input);
|
||||
c.outLen = strlen(c.output);
|
||||
|
||||
test_hmac[0] = a;
|
||||
test_hmac[1] = b;
|
||||
test_hmac[2] = c;
|
||||
|
||||
for (i = 0; i < times; ++i) {
|
||||
#if defined(HAVE_FIPS)
|
||||
if (i == 1)
|
||||
continue; /* fips not allowed */
|
||||
#endif
|
||||
ret = wc_HmacSetKey(&hmac,SHA384, (byte*)keys[i], (word32)strlen(keys[i]));
|
||||
if (ret != 0)
|
||||
return -4023;
|
||||
ret = wc_HmacUpdate(&hmac, (byte*)test_hmac[i].input,
|
||||
(word32)test_hmac[i].inLen);
|
||||
if (ret != 0)
|
||||
return -4024;
|
||||
ret = wc_HmacFinal(&hmac, hash);
|
||||
if (ret != 0)
|
||||
return -4025;
|
||||
|
||||
if (memcmp(hash, test_hmac[i].output, SHA384_DIGEST_SIZE) != 0)
|
||||
return -20 - i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
@ -0,0 +1,23 @@
|
||||
# vim:ft=automake
|
||||
# included from Top Level Makefile.am
|
||||
# All paths should be given relative to the root
|
||||
|
||||
|
||||
if BUILD_EXAMPLES
|
||||
check_PROGRAMS += tests/unit.test
|
||||
noinst_PROGRAMS += tests/unit.test
|
||||
tests_unit_test_SOURCES = \
|
||||
tests/unit.c \
|
||||
tests/api.c \
|
||||
tests/suites.c \
|
||||
tests/hash.c \
|
||||
examples/client/client.c \
|
||||
examples/server/server.c
|
||||
tests_unit_test_CFLAGS = -DNO_MAIN_DRIVER $(AM_CFLAGS)
|
||||
tests_unit_test_LDADD = src/libwolfssl.la
|
||||
tests_unit_test_DEPENDENCIES = src/libwolfssl.la
|
||||
endif
|
||||
EXTRA_DIST += tests/unit.h
|
||||
EXTRA_DIST += tests/test.conf \
|
||||
tests/test-dtls.conf
|
||||
DISTCLEANFILES+= tests/.libs/unit.test
|
468
FreeRTOSv10.2.1/FreeRTOS-Plus/Source/WolfSSL/tests/suites.c
Normal file
468
FreeRTOSv10.2.1/FreeRTOS-Plus/Source/WolfSSL/tests/suites.c
Normal file
@ -0,0 +1,468 @@
|
||||
/* suites.c
|
||||
*
|
||||
* Copyright (C) 2006-2015 wolfSSL Inc.
|
||||
*
|
||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
||||
*
|
||||
* wolfSSL is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* wolfSSL is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <wolfssl/ssl.h>
|
||||
#include <tests/unit.h>
|
||||
|
||||
|
||||
#define MAX_ARGS 40
|
||||
#define MAX_COMMAND_SZ 240
|
||||
#define MAX_SUITE_SZ 80
|
||||
#define NOT_BUILT_IN -123
|
||||
#ifdef NO_OLD_TLS
|
||||
#define VERSION_TOO_OLD -124
|
||||
#endif
|
||||
|
||||
#include "examples/client/client.h"
|
||||
#include "examples/server/server.h"
|
||||
|
||||
|
||||
static WOLFSSL_CTX* cipherSuiteCtx = NULL;
|
||||
static char nonblockFlag[] = "-N";
|
||||
static char noVerifyFlag[] = "-d";
|
||||
static char portFlag[] = "-p";
|
||||
static char flagSep[] = " ";
|
||||
static char svrPort[] = "0";
|
||||
|
||||
|
||||
#ifdef NO_OLD_TLS
|
||||
/* if the protocol version is less than tls 1.2 return 1, else 0 */
|
||||
static int IsOldTlsVersion(const char* line)
|
||||
{
|
||||
const char* find = "-v ";
|
||||
char* begin = strstr(line, find);
|
||||
|
||||
if (begin) {
|
||||
int version = -1;
|
||||
|
||||
begin += 3;
|
||||
|
||||
version = atoi(begin);
|
||||
|
||||
if (version < 3)
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif /* NO_OLD_TLS */
|
||||
|
||||
|
||||
/* if the cipher suite on line is valid store in suite and return 1, else 0 */
|
||||
static int IsValidCipherSuite(const char* line, char* suite)
|
||||
{
|
||||
int found = 0;
|
||||
int valid = 0;
|
||||
|
||||
const char* find = "-l ";
|
||||
const char* begin = strstr(line, find);
|
||||
const char* end;
|
||||
|
||||
suite[0] = '\0';
|
||||
|
||||
if (begin) {
|
||||
begin += 3;
|
||||
|
||||
end = strstr(begin, " ");
|
||||
|
||||
if (end) {
|
||||
long len = end - begin;
|
||||
if (len > MAX_SUITE_SZ) {
|
||||
printf("suite too long!\n");
|
||||
return 0;
|
||||
}
|
||||
memcpy(suite, begin, len);
|
||||
suite[len] = '\0';
|
||||
}
|
||||
else
|
||||
strncpy(suite, begin, MAX_SUITE_SZ);
|
||||
|
||||
suite[MAX_SUITE_SZ] = '\0';
|
||||
found = 1;
|
||||
}
|
||||
|
||||
if (found) {
|
||||
if (wolfSSL_CTX_set_cipher_list(cipherSuiteCtx, suite) == SSL_SUCCESS)
|
||||
valid = 1;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
||||
static int execute_test_case(int svr_argc, char** svr_argv,
|
||||
int cli_argc, char** cli_argv,
|
||||
int addNoVerify, int addNonBlocking)
|
||||
{
|
||||
#ifdef WOLFSSL_TIRTOS
|
||||
func_args cliArgs = {0};
|
||||
func_args svrArgs = {0};
|
||||
cliArgs.argc = cli_argc;
|
||||
cliArgs.argv = cli_argv;
|
||||
svrArgs.argc = svr_argc;
|
||||
svrArgs.argv = svr_argv;
|
||||
#else
|
||||
func_args cliArgs = {cli_argc, cli_argv, 0, NULL, NULL};
|
||||
func_args svrArgs = {svr_argc, svr_argv, 0, NULL, NULL};
|
||||
#endif
|
||||
|
||||
tcp_ready ready;
|
||||
THREAD_TYPE serverThread;
|
||||
char commandLine[MAX_COMMAND_SZ];
|
||||
char cipherSuite[MAX_SUITE_SZ+1];
|
||||
int i;
|
||||
size_t added = 0;
|
||||
static int tests = 1;
|
||||
|
||||
commandLine[0] = '\0';
|
||||
for (i = 0; i < svr_argc; i++) {
|
||||
added += strlen(svr_argv[i]) + 2;
|
||||
if (added >= MAX_COMMAND_SZ) {
|
||||
printf("server command line too long\n");
|
||||
break;
|
||||
}
|
||||
strcat(commandLine, svr_argv[i]);
|
||||
strcat(commandLine, flagSep);
|
||||
}
|
||||
|
||||
if (IsValidCipherSuite(commandLine, cipherSuite) == 0) {
|
||||
#ifdef DEBUG_SUITE_TESTS
|
||||
printf("cipher suite %s not supported in build\n", cipherSuite);
|
||||
#endif
|
||||
return NOT_BUILT_IN;
|
||||
}
|
||||
|
||||
#ifdef NO_OLD_TLS
|
||||
if (IsOldTlsVersion(commandLine) == 1) {
|
||||
#ifdef DEBUG_SUITE_TESTS
|
||||
printf("protocol version on line %s is too old\n", commandLine);
|
||||
#endif
|
||||
return VERSION_TOO_OLD;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (addNoVerify) {
|
||||
printf("repeating test with client cert request off\n");
|
||||
added += 4; /* -d plus space plus terminator */
|
||||
if (added >= MAX_COMMAND_SZ || svr_argc >= MAX_ARGS)
|
||||
printf("server command line too long\n");
|
||||
else {
|
||||
svr_argv[svr_argc++] = noVerifyFlag;
|
||||
svrArgs.argc = svr_argc;
|
||||
strcat(commandLine, noVerifyFlag);
|
||||
strcat(commandLine, flagSep);
|
||||
}
|
||||
}
|
||||
if (addNonBlocking) {
|
||||
printf("repeating test with non blocking on\n");
|
||||
added += 4; /* -N plus terminator */
|
||||
if (added >= MAX_COMMAND_SZ || svr_argc >= MAX_ARGS)
|
||||
printf("server command line too long\n");
|
||||
else {
|
||||
svr_argv[svr_argc++] = nonblockFlag;
|
||||
svrArgs.argc = svr_argc;
|
||||
strcat(commandLine, nonblockFlag);
|
||||
strcat(commandLine, flagSep);
|
||||
}
|
||||
}
|
||||
#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_TIRTOS)
|
||||
/* add port 0 */
|
||||
if (svr_argc + 2 > MAX_ARGS)
|
||||
printf("cannot add the magic port number flag to server\n");
|
||||
else
|
||||
{
|
||||
svr_argv[svr_argc++] = portFlag;
|
||||
svr_argv[svr_argc++] = svrPort;
|
||||
svrArgs.argc = svr_argc;
|
||||
}
|
||||
#endif
|
||||
printf("trying server command line[%d]: %s\n", tests, commandLine);
|
||||
|
||||
commandLine[0] = '\0';
|
||||
added = 0;
|
||||
for (i = 0; i < cli_argc; i++) {
|
||||
added += strlen(cli_argv[i]) + 2;
|
||||
if (added >= MAX_COMMAND_SZ) {
|
||||
printf("client command line too long\n");
|
||||
break;
|
||||
}
|
||||
strcat(commandLine, cli_argv[i]);
|
||||
strcat(commandLine, flagSep);
|
||||
}
|
||||
if (addNonBlocking) {
|
||||
added += 4; /* -N plus space plus terminator */
|
||||
if (added >= MAX_COMMAND_SZ)
|
||||
printf("client command line too long\n");
|
||||
else {
|
||||
cli_argv[cli_argc++] = nonblockFlag;
|
||||
strcat(commandLine, nonblockFlag);
|
||||
strcat(commandLine, flagSep);
|
||||
cliArgs.argc = cli_argc;
|
||||
}
|
||||
}
|
||||
printf("trying client command line[%d]: %s\n", tests++, commandLine);
|
||||
|
||||
InitTcpReady(&ready);
|
||||
|
||||
#ifdef WOLFSSL_TIRTOS
|
||||
fdOpenSession(Task_self());
|
||||
#endif
|
||||
|
||||
/* start server */
|
||||
svrArgs.signal = &ready;
|
||||
start_thread(server_test, &svrArgs, &serverThread);
|
||||
wait_tcp_ready(&svrArgs);
|
||||
#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_TIRTOS)
|
||||
if (ready.port != 0)
|
||||
{
|
||||
if (cli_argc + 2 > MAX_ARGS)
|
||||
printf("cannot add the magic port number flag to client\n");
|
||||
else {
|
||||
char portNumber[8];
|
||||
snprintf(portNumber, sizeof(portNumber), "%d", ready.port);
|
||||
cli_argv[cli_argc++] = portFlag;
|
||||
cli_argv[cli_argc++] = portNumber;
|
||||
cliArgs.argc = cli_argc;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
/* start client */
|
||||
client_test(&cliArgs);
|
||||
|
||||
/* verify results */
|
||||
if (cliArgs.return_code != 0) {
|
||||
printf("client_test failed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
join_thread(serverThread);
|
||||
if (svrArgs.return_code != 0) {
|
||||
printf("server_test failed\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_TIRTOS
|
||||
fdCloseSession(Task_self());
|
||||
#endif
|
||||
FreeTcpReady(&ready);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void test_harness(void* vargs)
|
||||
{
|
||||
func_args* args = (func_args*)vargs;
|
||||
char* script;
|
||||
long sz, len;
|
||||
int cliMode = 0; /* server or client command flag, server first */
|
||||
int ret;
|
||||
FILE* file;
|
||||
char* svrArgs[MAX_ARGS];
|
||||
int svrArgsSz;
|
||||
char* cliArgs[MAX_ARGS];
|
||||
int cliArgsSz;
|
||||
char* cursor;
|
||||
char* comment;
|
||||
const char* fname = "tests/test.conf";
|
||||
|
||||
if (args->argc == 1) {
|
||||
printf("notice: using default file %s\n", fname);
|
||||
}
|
||||
else if(args->argc != 2) {
|
||||
printf("usage: harness [FILE]\n");
|
||||
args->return_code = 1;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
fname = args->argv[1];
|
||||
}
|
||||
|
||||
file = fopen(fname, "r");
|
||||
if (file == NULL) {
|
||||
fprintf(stderr, "unable to open %s\n", fname);
|
||||
args->return_code = 1;
|
||||
return;
|
||||
}
|
||||
fseek(file, 0, SEEK_END);
|
||||
sz = ftell(file);
|
||||
rewind(file);
|
||||
if (sz <= 0) {
|
||||
fprintf(stderr, "%s is empty\n", fname);
|
||||
fclose(file);
|
||||
args->return_code = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
script = (char*)malloc(sz+1);
|
||||
if (script == 0) {
|
||||
fprintf(stderr, "unable to allocte script buffer\n");
|
||||
fclose(file);
|
||||
args->return_code = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
len = fread(script, 1, sz, file);
|
||||
if (len != sz) {
|
||||
fprintf(stderr, "read error\n");
|
||||
fclose(file);
|
||||
free(script);
|
||||
args->return_code = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
script[sz] = 0;
|
||||
|
||||
cursor = script;
|
||||
svrArgsSz = 1;
|
||||
svrArgs[0] = args->argv[0];
|
||||
cliArgsSz = 1;
|
||||
cliArgs[0] = args->argv[0];
|
||||
|
||||
while (*cursor != 0) {
|
||||
int do_it = 0;
|
||||
|
||||
switch (*cursor) {
|
||||
case '\n':
|
||||
/* A blank line triggers test case execution or switches
|
||||
to client mode if we don't have the client command yet */
|
||||
if (cliMode == 0)
|
||||
cliMode = 1; /* switch to client mode processing */
|
||||
else
|
||||
do_it = 1; /* Do It, we have server and client */
|
||||
cursor++;
|
||||
break;
|
||||
case '#':
|
||||
/* Ignore lines that start with a #. */
|
||||
comment = strsep(&cursor, "\n");
|
||||
#ifdef DEBUG_SUITE_TESTS
|
||||
printf("%s\n", comment);
|
||||
#else
|
||||
(void)comment;
|
||||
#endif
|
||||
break;
|
||||
case '-':
|
||||
/* Parameters start with a -. They end in either a newline
|
||||
* or a space. Capture until either, save in Args list. */
|
||||
if (cliMode)
|
||||
cliArgs[cliArgsSz++] = strsep(&cursor, " \n");
|
||||
else
|
||||
svrArgs[svrArgsSz++] = strsep(&cursor, " \n");
|
||||
break;
|
||||
default:
|
||||
/* Anything from cursor until end of line that isn't the above
|
||||
* is data for a paramter. Just up until the next newline in
|
||||
* the Args list. */
|
||||
if (cliMode)
|
||||
cliArgs[cliArgsSz++] = strsep(&cursor, "\n");
|
||||
else
|
||||
svrArgs[svrArgsSz++] = strsep(&cursor, "\n");
|
||||
if (*cursor == 0) /* eof */
|
||||
do_it = 1;
|
||||
}
|
||||
|
||||
if (svrArgsSz == MAX_ARGS || cliArgsSz == MAX_ARGS) {
|
||||
fprintf(stderr, "too many arguments, forcing test run\n");
|
||||
do_it = 1;
|
||||
}
|
||||
|
||||
if (do_it) {
|
||||
ret = execute_test_case(svrArgsSz, svrArgs, cliArgsSz, cliArgs,0,0);
|
||||
/* don't repeat if not supported in build */
|
||||
if (ret == 0) {
|
||||
execute_test_case(svrArgsSz, svrArgs, cliArgsSz, cliArgs, 0, 1);
|
||||
execute_test_case(svrArgsSz, svrArgs, cliArgsSz, cliArgs, 1, 0);
|
||||
execute_test_case(svrArgsSz, svrArgs, cliArgsSz, cliArgs, 1, 1);
|
||||
}
|
||||
svrArgsSz = 1;
|
||||
cliArgsSz = 1;
|
||||
cliMode = 0;
|
||||
}
|
||||
}
|
||||
|
||||
free(script);
|
||||
args->return_code = 0;
|
||||
}
|
||||
|
||||
|
||||
int SuiteTest(void)
|
||||
{
|
||||
func_args args;
|
||||
char argv0[2][80];
|
||||
char* myArgv[2];
|
||||
|
||||
printf(" Begin Cipher Suite Tests\n");
|
||||
|
||||
/* setup */
|
||||
myArgv[0] = argv0[0];
|
||||
myArgv[1] = argv0[1];
|
||||
args.argv = myArgv;
|
||||
strcpy(argv0[0], "SuiteTest");
|
||||
|
||||
(void)test_harness;
|
||||
|
||||
cipherSuiteCtx = wolfSSL_CTX_new(wolfTLSv1_2_client_method());
|
||||
if (cipherSuiteCtx == NULL) {
|
||||
printf("can't get cipher suite ctx\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* default case */
|
||||
args.argc = 1;
|
||||
printf("starting default cipher suite tests\n");
|
||||
test_harness(&args);
|
||||
if (args.return_code != 0) {
|
||||
printf("error from script %d\n", args.return_code);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* any extra cases will need another argument */
|
||||
args.argc = 2;
|
||||
|
||||
#ifdef WOLFSSL_DTLS
|
||||
/* add dtls extra suites */
|
||||
strcpy(argv0[1], "tests/test-dtls.conf");
|
||||
printf("starting dtls extra cipher suite tests\n");
|
||||
test_harness(&args);
|
||||
if (args.return_code != 0) {
|
||||
printf("error from script %d\n", args.return_code);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
printf(" End Cipher Suite Tests\n");
|
||||
|
||||
wolfSSL_CTX_free(cipherSuiteCtx);
|
||||
wolfSSL_Cleanup();
|
||||
|
||||
return args.return_code;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,908 @@
|
||||
# server DTLSv1 DHE-RSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 2
|
||||
-l DHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# client DTLSv1 DHE-RSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 2
|
||||
-l DHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# server DTLSv1 ECDHE-RSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# client DTLSv1 ECDHE-RSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# server DTLSv1 ECDHE-EDCSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1 ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 DHE-RSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 3
|
||||
-l DHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# client DTLSv1.2 DHE-RSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 3
|
||||
-l DHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-CHACHA20-POLY1305
|
||||
|
||||
# server DTLSv1.2 ECDHE-EDCSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-CHACHA20-POLY1305
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1 RC4-SHA
|
||||
-u
|
||||
-v 2
|
||||
-l RC4-SHA
|
||||
|
||||
# client DTLSv1 RC4-SHA
|
||||
-u
|
||||
-v 2
|
||||
-l RC4-SHA
|
||||
|
||||
# server DTLSv1.2 RC4-SHA
|
||||
-u
|
||||
-v 3
|
||||
-l RC4-SHA
|
||||
|
||||
# client DTLSv1.2 RC4-SHA
|
||||
-u
|
||||
-v 3
|
||||
-l RC4-SHA
|
||||
|
||||
# server DTLSv1 DES-CBC3-SHA
|
||||
-u
|
||||
-v 2
|
||||
-l DES-CBC3-SHA
|
||||
|
||||
# client DTLSv1 DES-CBC3-SHA
|
||||
-u
|
||||
-v 2
|
||||
-l DES-CBC3-SHA
|
||||
|
||||
# server DTLSv1.2 DES-CBC3-SHA
|
||||
-u
|
||||
-v 3
|
||||
-l DES-CBC3-SHA
|
||||
|
||||
# client DTLSv1.2 DES-CBC3-SHA
|
||||
-u
|
||||
-v 3
|
||||
-l DES-CBC3-SHA
|
||||
|
||||
# server DTLSv1 AES128-SHA
|
||||
-u
|
||||
-v 2
|
||||
-l AES128-SHA
|
||||
|
||||
# client DTLSv1 AES128-SHA
|
||||
-u
|
||||
-v 2
|
||||
-l AES128-SHA
|
||||
|
||||
# server DTLSv1.2 AES128-SHA
|
||||
-u
|
||||
-v 3
|
||||
-l AES128-SHA
|
||||
|
||||
# client DTLSv1.2 AES128-SHA
|
||||
-u
|
||||
-v 3
|
||||
-l AES128-SHA
|
||||
|
||||
# server DTLSv1 AES256-SHA
|
||||
-u
|
||||
-v 2
|
||||
-l AES256-SHA
|
||||
|
||||
# client DTLSv1 AES256-SHA
|
||||
-u
|
||||
-v 2
|
||||
-l AES256-SHA
|
||||
|
||||
# server DTLSv1.2 AES256-SHA
|
||||
-u
|
||||
-v 3
|
||||
-l AES256-SHA
|
||||
|
||||
# client DTLSv1.2 AES256-SHA
|
||||
-u
|
||||
-v 3
|
||||
-l AES256-SHA
|
||||
|
||||
# server DTLSv1 AES128-SHA256
|
||||
-u
|
||||
-v 2
|
||||
-l AES128-SHA256
|
||||
|
||||
# client DTLSv1 AES128-SHA256
|
||||
-u
|
||||
-v 2
|
||||
-l AES128-SHA256
|
||||
|
||||
# server DTLSv1.2 AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l AES128-SHA256
|
||||
|
||||
# client DTLSv1.2 AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l AES128-SHA256
|
||||
|
||||
# server DTLSv1 AES256-SHA256
|
||||
-u
|
||||
-v 2
|
||||
-l AES256-SHA256
|
||||
|
||||
# client DTLSv1 AES256-SHA256
|
||||
-u
|
||||
-v 2
|
||||
-l AES256-SHA256
|
||||
|
||||
# server DTLSv1.2 AES256-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l AES256-SHA256
|
||||
|
||||
# client DTLSv1.2 AES256-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l AES256-SHA256
|
||||
|
||||
# server DTLSv1 ECDHE-RSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-RC4-SHA
|
||||
|
||||
# client DTLSv1 ECDHE-RSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-RC4-SHA
|
||||
|
||||
# server DTLSv1.1 ECDHE-RSA-DES3
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-DES-CBC3-SHA
|
||||
|
||||
# client DTLSv1.1 ECDHE-RSA-DES3
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-DES-CBC3-SHA
|
||||
|
||||
# server DTLSv1.1 ECDHE-RSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
|
||||
# client DTLSv1.1 ECDHE-RSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
|
||||
# server DTLSv1.1 ECDHE-RSA-AES256
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-AES256-SHA
|
||||
|
||||
# client DTLSv1.1 ECDHE-RSA-AES256
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-RSA-AES256-SHA
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-RC4-SHA
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-RC4-SHA
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-DES3
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-DES-CBC3-SHA
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-DES3
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-DES-CBC3-SHA
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA256
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-SHA256
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-AES256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES256-SHA
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-AES256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES256-SHA
|
||||
|
||||
# server DTLSv1.1 ECDHE-EDCSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-RC4-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDHE-ECDSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-RC4-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.1 ECDHE-ECDSA-DES3
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-DES-CBC3-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDHE-ECDSA-DES3
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.1 ECDHE-ECDSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDHE-ECDSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.1 ECDHE-ECDSA-AES256
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-AES256-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDHE-ECDSA-AES256
|
||||
-u
|
||||
-v 2
|
||||
-l ECDHE-ECDSA-AES256-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-RC4-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-RC4-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-DES3
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-DES-CBC3-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-DES3
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-SHA256
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-SHA256
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-AES256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES256-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-AES256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES256-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.1 ECDH-RSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-RSA-RC4-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDH-RSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-RSA-RC4-SHA
|
||||
|
||||
# server DTLSv1.1 ECDH-RSA-DES3
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-RSA-DES-CBC3-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDH-RSA-DES3
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-RSA-DES-CBC3-SHA
|
||||
|
||||
# server DTLSv1.1 ECDH-RSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDH-RSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
|
||||
# server DTLSv1.1 ECDH-RSA-AES256
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-RSA-AES256-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDH-RSA-AES256
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-RSA-AES256-SHA
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-RC4-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-RSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-RC4-SHA
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-DES3
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-DES-CBC3-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-RSA-DES3
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-DES-CBC3-SHA
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-RSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-SHA
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-SHA256
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-RSA-AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-SHA256
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-AES256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES256-SHA
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-RSA-AES256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES256-SHA
|
||||
|
||||
# server DTLSv1.1 ECDH-EDCSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-ECDSA-RC4-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDH-ECDSA-RC4
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-ECDSA-RC4-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.1 ECDH-ECDSA-DES3
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-ECDSA-DES-CBC3-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDH-ECDSA-DES3
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.1 ECDH-ECDSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDH-ECDSA-AES128
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.1 ECDH-ECDSA-AES256
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-ECDSA-AES256-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.1 ECDH-ECDSA-AES256
|
||||
-u
|
||||
-v 2
|
||||
-l ECDH-ECDSA-AES256-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-RC4-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-ECDSA-RC4
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-RC4-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDH-ECDSA-DES3
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-DES-CBC3-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-ECDSA-DES3
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-DES-CBC3-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDH-ECDSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES128
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDH-ECDSA-AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-SHA256
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES128-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-SHA256
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDH-ECDSA-AES256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES256-SHA
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES256-SHA
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-AES256-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES256-SHA384
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-AES256-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES256-SHA384
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-AES256-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES256-SHA384
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-AES256-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES256-SHA384
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-AES256-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES256-SHA384
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-RSA-AES256-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES256-SHA384
|
||||
|
||||
# server DTLSv1.2 ECDH-ECDSA-AES256-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES256-SHA384
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES256-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES256-SHA384
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1 PSK-AES128
|
||||
-s
|
||||
-u
|
||||
-v 2
|
||||
-l PSK-AES128-CBC-SHA
|
||||
|
||||
# client DTLSv1 PSK-AES128
|
||||
-s
|
||||
-u
|
||||
-v 2
|
||||
-l PSK-AES128-CBC-SHA
|
||||
|
||||
# server DTLSv1 PSK-AES256
|
||||
-s
|
||||
-u
|
||||
-v 2
|
||||
-l PSK-AES256-CBC-SHA
|
||||
|
||||
# client DTLSv1 PSK-AES256
|
||||
-s
|
||||
-u
|
||||
-v 2
|
||||
-l PSK-AES256-CBC-SHA
|
||||
|
||||
# server DTLSv1.2 PSK-AES128
|
||||
-s
|
||||
-u
|
||||
-v 3
|
||||
-l PSK-AES128-CBC-SHA
|
||||
|
||||
# client DTLSv1.2 PSK-AES128
|
||||
-s
|
||||
-u
|
||||
-v 3
|
||||
-l PSK-AES128-CBC-SHA
|
||||
|
||||
# server DTLSv1.2 PSK-AES256
|
||||
-s
|
||||
-u
|
||||
-v 3
|
||||
-l PSK-AES256-CBC-SHA
|
||||
|
||||
# client DTLSv1.2 PSK-AES256
|
||||
-s
|
||||
-u
|
||||
-v 3
|
||||
-l PSK-AES256-CBC-SHA
|
||||
|
||||
# server DTLSv1.2 PSK-AES128-SHA256
|
||||
-s
|
||||
-u
|
||||
-v 3
|
||||
-l PSK-AES128-CBC-SHA256
|
||||
|
||||
# client DTLSv1.2 PSK-AES128-SHA256
|
||||
-s
|
||||
-u
|
||||
-v 3
|
||||
-l PSK-AES128-CBC-SHA256
|
||||
|
||||
# server DTLSv1.2 PSK-AES256-SHA384
|
||||
-s
|
||||
-u
|
||||
-v 3
|
||||
-l PSK-AES256-CBC-SHA384
|
||||
|
||||
# client DTLSv1.2 PSK-AES256-SHA384
|
||||
-s
|
||||
-u
|
||||
-v 3
|
||||
-l PSK-AES256-CBC-SHA384
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-GCM-SHA256
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES256-GCM-SHA384
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-AES256-GCM-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES256-GCM-SHA384
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDH-ECDSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-GCM-SHA256
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES128-GCM-SHA256
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDH-ECDSA-AES256-GCM-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES256-GCM-SHA384
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-ECDSA-AES256-GCM-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-ECDSA-AES256-GCM-SHA384
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-GCM-SHA256
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES128-GCM-SHA256
|
||||
|
||||
# server DTLSv1.2 ECDHE-RSA-AES256-GCM-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES256-GCM-SHA384
|
||||
|
||||
# client DTLSv1.2 ECDHE-RSA-AES256-GCM-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-RSA-AES256-GCM-SHA384
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-GCM-SHA256
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-RSA-AES128-GCM-SHA256
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES128-GCM-SHA256
|
||||
|
||||
# server DTLSv1.2 ECDH-RSA-AES256-GCM-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES256-GCM-SHA384
|
||||
-c ./certs/server-ecc-rsa.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDH-RSA-AES256-GCM-SHA384
|
||||
-u
|
||||
-v 3
|
||||
-l ECDH-RSA-AES256-GCM-SHA384
|
||||
|
||||
# server DTLSv1.2 PSK-AES128-GCM-SHA256
|
||||
-u
|
||||
-s
|
||||
-v 3
|
||||
-l PSK-AES128-GCM-SHA256
|
||||
|
||||
# client DTLSv1.2 PSK-AES128-GCM-SHA256
|
||||
-u
|
||||
-s
|
||||
-v 3
|
||||
-l PSK-AES128-GCM-SHA256
|
||||
|
||||
# server DTLSv1.2 PSK-AES256-GCM-SHA384
|
||||
-u
|
||||
-s
|
||||
-v 3
|
||||
-l PSK-AES256-GCM-SHA384
|
||||
|
||||
# client DTLSv1.2 PSK-AES256-GCM-SHA384
|
||||
-u
|
||||
-s
|
||||
-v 3
|
||||
-l PSK-AES256-GCM-SHA384
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-AES128-CCM-8
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-CCM-8
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-AES128-CCM-8
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES128-CCM-8
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ECDHE-ECDSA-AES256-CCM-8
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES256-CCM-8
|
||||
-c ./certs/server-ecc.pem
|
||||
-k ./certs/ecc-key.pem
|
||||
|
||||
# client DTLSv1.2 ECDHE-ECDSA-AES256-CCM-8
|
||||
-u
|
||||
-v 3
|
||||
-l ECDHE-ECDSA-AES256-CCM-8
|
||||
-A ./certs/server-ecc.pem
|
||||
|
||||
# server DTLSv1.2 ADH-AES128-SHA
|
||||
-u
|
||||
-a
|
||||
-v 3
|
||||
-l ADH-AES128-SHA
|
||||
|
||||
# client DTLSv1.2 ADH-AES128-SHA
|
||||
-u
|
||||
-a
|
||||
-v 3
|
||||
-l ADH-AES128-SHA
|
||||
|
||||
# server DTLSv1.0 ADH-AES128-SHA
|
||||
-u
|
||||
-a
|
||||
-v 2
|
||||
-l ADH-AES128-SHA
|
||||
|
||||
# client DTLSv1.0 ADH-AES128-SHA
|
||||
-u
|
||||
-a
|
||||
-v 2
|
||||
-l ADH-AES128-SHA
|
||||
|
2035
FreeRTOSv10.2.1/FreeRTOS-Plus/Source/WolfSSL/tests/test.conf
Normal file
2035
FreeRTOSv10.2.1/FreeRTOS-Plus/Source/WolfSSL/tests/test.conf
Normal file
File diff suppressed because it is too large
Load Diff
160
FreeRTOSv10.2.1/FreeRTOS-Plus/Source/WolfSSL/tests/unit.c
Normal file
160
FreeRTOSv10.2.1/FreeRTOS-Plus/Source/WolfSSL/tests/unit.c
Normal file
@ -0,0 +1,160 @@
|
||||
/* unit.c unit tests driver */
|
||||
|
||||
/* Name change compatibility layer no longer need to be included here */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <wolfssl/wolfcrypt/settings.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <tests/unit.h>
|
||||
|
||||
|
||||
int myoptind = 0;
|
||||
char* myoptarg = NULL;
|
||||
int unit_test(int argc, char** argv);
|
||||
|
||||
#ifndef NO_TESTSUITE_MAIN_DRIVER
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
return unit_test(argc, argv);
|
||||
}
|
||||
#endif
|
||||
|
||||
int unit_test(int argc, char** argv)
|
||||
{
|
||||
int ret;
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
printf("starting unit tests...\n");
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
|
||||
if (ret != 0)
|
||||
err_sys("Cavium OpenNitroxDevice failed");
|
||||
#endif /* HAVE_CAVIUM */
|
||||
|
||||
#ifndef WOLFSSL_TIRTOS
|
||||
if (CurrentDir("tests") || CurrentDir("_build"))
|
||||
ChangeDirBack(1);
|
||||
else if (CurrentDir("Debug") || CurrentDir("Release"))
|
||||
ChangeDirBack(3);
|
||||
#endif
|
||||
|
||||
ApiTest();
|
||||
|
||||
if ( (ret = HashTest()) != 0){
|
||||
printf("hash test failed with %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#ifndef SINGLE_THREADED
|
||||
if ( (ret = SuiteTest()) != 0){
|
||||
printf("suite test failed with %d\n", ret);
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_CAVIUM
|
||||
CspShutdown(CAVIUM_DEV_ID);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void wait_tcp_ready(func_args* args)
|
||||
{
|
||||
#ifdef SINGLE_THREADED
|
||||
(void)args;
|
||||
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
||||
pthread_mutex_lock(&args->signal->mutex);
|
||||
|
||||
if (!args->signal->ready)
|
||||
pthread_cond_wait(&args->signal->cond, &args->signal->mutex);
|
||||
args->signal->ready = 0; /* reset */
|
||||
|
||||
pthread_mutex_unlock(&args->signal->mutex);
|
||||
#else
|
||||
(void)args;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void start_thread(THREAD_FUNC fun, func_args* args, THREAD_TYPE* thread)
|
||||
{
|
||||
#ifdef SINGLE_THREADED
|
||||
(void)fun;
|
||||
(void)args;
|
||||
(void)thread;
|
||||
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
||||
pthread_create(thread, 0, fun, args);
|
||||
return;
|
||||
#elif defined (WOLFSSL_TIRTOS)
|
||||
/* Initialize the defaults and set the parameters. */
|
||||
Task_Params taskParams;
|
||||
Task_Params_init(&taskParams);
|
||||
taskParams.arg0 = (UArg)args;
|
||||
taskParams.stackSize = 65535;
|
||||
*thread = Task_create((Task_FuncPtr)fun, &taskParams, NULL);
|
||||
if (*thread == NULL) {
|
||||
printf("Failed to create new Task\n");
|
||||
}
|
||||
Task_yield();
|
||||
#else
|
||||
*thread = (THREAD_TYPE)_beginthreadex(0, 0, fun, args, 0, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void join_thread(THREAD_TYPE thread)
|
||||
{
|
||||
#ifdef SINGLE_THREADED
|
||||
(void)thread;
|
||||
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
||||
pthread_join(thread, 0);
|
||||
#elif defined (WOLFSSL_TIRTOS)
|
||||
while(1) {
|
||||
if (Task_getMode(thread) == Task_Mode_TERMINATED) {
|
||||
Task_sleep(5);
|
||||
break;
|
||||
}
|
||||
Task_yield();
|
||||
}
|
||||
#else
|
||||
int res = WaitForSingleObject((HANDLE)thread, INFINITE);
|
||||
assert(res == WAIT_OBJECT_0);
|
||||
res = CloseHandle((HANDLE)thread);
|
||||
assert(res);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void InitTcpReady(tcp_ready* ready)
|
||||
{
|
||||
ready->ready = 0;
|
||||
ready->port = 0;
|
||||
#ifdef SINGLE_THREADED
|
||||
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
||||
pthread_mutex_init(&ready->mutex, 0);
|
||||
pthread_cond_init(&ready->cond, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void FreeTcpReady(tcp_ready* ready)
|
||||
{
|
||||
#ifdef SINGLE_THREADED
|
||||
(void)ready;
|
||||
#elif defined(_POSIX_THREADS) && !defined(__MINGW32__)
|
||||
pthread_mutex_destroy(&ready->mutex);
|
||||
pthread_cond_destroy(&ready->cond);
|
||||
#else
|
||||
(void)ready;
|
||||
#endif
|
||||
}
|
||||
|
65
FreeRTOSv10.2.1/FreeRTOS-Plus/Source/WolfSSL/tests/unit.h
Normal file
65
FreeRTOSv10.2.1/FreeRTOS-Plus/Source/WolfSSL/tests/unit.h
Normal file
@ -0,0 +1,65 @@
|
||||
/* unit.h unit tests driver */
|
||||
|
||||
#ifndef CyaSSL_UNIT_H
|
||||
#define CyaSSL_UNIT_H
|
||||
|
||||
#include <wolfssl/ssl.h>
|
||||
#include <wolfssl/test.h> /* thread and tcp stuff */
|
||||
|
||||
#define Fail(description, result) do { \
|
||||
printf("\nERROR - %s line %d failed with:", __FILE__, __LINE__); \
|
||||
printf("\n\n test: "); printf description; \
|
||||
printf("\n\n result: "); printf result; \
|
||||
abort(); \
|
||||
} while(0)
|
||||
|
||||
#define Assert(test, description, result) if (!(test)) Fail(description, result)
|
||||
|
||||
#define AssertTrue(x) Assert( (x), ("%s is true", #x), (#x " => FALSE"))
|
||||
#define AssertFalse(x) Assert(!(x), ("%s is false", #x), (#x " => TRUE"))
|
||||
#define AssertNotNull(x) Assert( (x), ("%s is not null", #x), (#x " => NULL"))
|
||||
|
||||
#define AssertNull(x) do { \
|
||||
void* _x = (void *) (x); \
|
||||
\
|
||||
Assert(!_x, ("%s is null", #x), (#x " => %p", _x)); \
|
||||
} while(0)
|
||||
|
||||
#define AssertInt(x, y, op, er) do { \
|
||||
int _x = x; \
|
||||
int _y = y; \
|
||||
\
|
||||
Assert(_x op _y, ("%s " #op " %s", #x, #y), ("%d " #er " %d", _x, _y)); \
|
||||
} while(0)
|
||||
|
||||
#define AssertIntEQ(x, y) AssertInt(x, y, ==, !=)
|
||||
#define AssertIntNE(x, y) AssertInt(x, y, !=, ==)
|
||||
#define AssertIntGT(x, y) AssertInt(x, y, >, <=)
|
||||
#define AssertIntLT(x, y) AssertInt(x, y, <, >=)
|
||||
#define AssertIntGE(x, y) AssertInt(x, y, >=, <)
|
||||
#define AssertIntLE(x, y) AssertInt(x, y, <=, >)
|
||||
|
||||
#define AssertStr(x, y, op, er) do { \
|
||||
const char* _x = x; \
|
||||
const char* _y = y; \
|
||||
int _z = strcmp(_x, _y); \
|
||||
\
|
||||
Assert(_z op 0, ("%s " #op " %s", #x, #y), \
|
||||
("\"%s\" " #er " \"%s\"", _x, _y));\
|
||||
} while(0)
|
||||
|
||||
#define AssertStrEQ(x, y) AssertStr(x, y, ==, !=)
|
||||
#define AssertStrNE(x, y) AssertStr(x, y, !=, ==)
|
||||
#define AssertStrGT(x, y) AssertStr(x, y, >, <=)
|
||||
#define AssertStrLT(x, y) AssertStr(x, y, <, >=)
|
||||
#define AssertStrGE(x, y) AssertStr(x, y, >=, <)
|
||||
#define AssertStrLE(x, y) AssertStr(x, y, <=, >)
|
||||
|
||||
|
||||
void ApiTest(void);
|
||||
int SuiteTest(void);
|
||||
int HashTest(void);
|
||||
|
||||
|
||||
#endif /* CyaSSL_UNIT_H */
|
||||
|
Reference in New Issue
Block a user