From a53d05c8bd06d795c860b0de9a81cfa617482969 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Thu, 10 Sep 2015 11:06:48 -0700 Subject: [PATCH 01/77] updated sniffer statistics for missed sessions and reassembly buffer usage --- src/sniffer.c | 67 +++++++++++++++++++++++++++++++++++----- wolfssl/sniffer_error.h | 1 + wolfssl/sniffer_error.rc | 1 + 3 files changed, 61 insertions(+), 8 deletions(-) diff --git a/src/sniffer.c b/src/sniffer.c index d28b91599..8f6942673 100644 --- a/src/sniffer.c +++ b/src/sniffer.c @@ -243,7 +243,8 @@ static const char* const msgTable[] = "Secure Renegotiation Not Supported", /* 76 */ - "Get Session Stats Failure" + "Get Session Stats Failure", + "Reassembly Buffer Size Exceeded" }; @@ -345,6 +346,8 @@ typedef struct SnifferSession { time_t lastUsed; /* last used ticks */ PacketBuffer* cliReassemblyList; /* client out of order packets */ PacketBuffer* srvReassemblyList; /* server out of order packets */ + word32 cliReassemblyMemory; /* client packet memory used */ + word32 srvReassemblyMemory; /* server packet memory used */ struct SnifferSession* next; /* for hash table list */ byte* ticketID; /* mac ID of session ticket */ } SnifferSession; @@ -365,7 +368,14 @@ static wolfSSL_Mutex RecoveryMutex; /* for stats */ static int RecoveryEnabled = 0; /* global switch */ static int MaxRecoveryMemory = -1; /* per session max recovery memory */ static word32 MissedDataSessions = 0; /* # of sessions with missed data */ -static word32 ReassemblyMemory = 0; /* total reassembly memory in use */ + + +static void UpdateMissedDataSessions(void) +{ + LockMutex(&RecoveryMutex); + MissedDataSessions += 1; + UnLockMutex(&RecoveryMutex); +} /* Initialize overall Sniffer */ @@ -566,6 +576,8 @@ static void InitSession(SnifferSession* session) session->lastUsed = 0; session->cliReassemblyList = 0; session->srvReassemblyList = 0; + session->cliReassemblyMemory = 0; + session->srvReassemblyMemory = 0; session->next = 0; session->ticketID = 0; @@ -2326,18 +2338,26 @@ static int AddToReassembly(byte from, word32 seq, const byte* sslFrame, PacketBuffer* curr = *front; PacketBuffer* prev = curr; + word32* reassemblyMemory = (from == WOLFSSL_SERVER_END) ? + &session->cliReassemblyMemory : &session->srvReassemblyMemory; word32 startSeq = seq; word32 added; int bytesLeft = sslBytes; /* could be overlapping fragment */ /* if list is empty add full frame to front */ if (!curr) { + if (MaxRecoveryMemory != -1 && + (int)(*reassemblyMemory + sslBytes) > MaxRecoveryMemory) { + SetError(REASSEMBLY_MAX_STR, error, session, FATAL_ERROR_STATE); + return -1; + } add = CreateBuffer(&seq, seq + sslBytes - 1, sslFrame, &bytesLeft); if (add == NULL) { SetError(MEMORY_STR, error, session, FATAL_ERROR_STATE); return -1; } *front = add; + *reassemblyMemory += sslBytes; return 1; } @@ -2348,6 +2368,11 @@ static int AddToReassembly(byte from, word32 seq, const byte* sslFrame, if (end >= curr->begin) end = curr->begin - 1; + if (MaxRecoveryMemory -1 && + (int)(*reassemblyMemory + sslBytes) > MaxRecoveryMemory) { + SetError(REASSEMBLY_MAX_STR, error, session, FATAL_ERROR_STATE); + return -1; + } add = CreateBuffer(&seq, end, sslFrame, &bytesLeft); if (add == NULL) { SetError(MEMORY_STR, error, session, FATAL_ERROR_STATE); @@ -2355,6 +2380,7 @@ static int AddToReassembly(byte from, word32 seq, const byte* sslFrame, } add->next = curr; *front = add; + *reassemblyMemory += sslBytes; } /* while we have bytes left, try to find a gap to fill */ @@ -2384,6 +2410,11 @@ static int AddToReassembly(byte from, word32 seq, const byte* sslFrame, if (added == 0) continue; + if (MaxRecoveryMemory != -1 && + (int)(*reassemblyMemory + added) > MaxRecoveryMemory) { + SetError(REASSEMBLY_MAX_STR, error, session, FATAL_ERROR_STATE); + return -1; + } add = CreateBuffer(&seq, seq + added - 1, &sslFrame[seq - startSeq], &bytesLeft); if (add == NULL) { @@ -2392,6 +2423,7 @@ static int AddToReassembly(byte from, word32 seq, const byte* sslFrame, } add->next = prev->next; prev->next = add; + *reassemblyMemory += added; } return 1; } @@ -2557,6 +2589,7 @@ static int CheckSequence(IpInfo* ipInfo, TcpInfo* tcpInfo, TraceSequence(tcpInfo->sequence, *sslBytes); if (CheckAck(tcpInfo, session) < 0) { + UpdateMissedDataSessions(); SetError(ACK_MISSED_STR, error, session, FATAL_ERROR_STATE); return -1; } @@ -2664,6 +2697,8 @@ static int HaveMoreInput(SnifferSession* session, const byte** sslFrame, &session->sslClient->buffers.inputBuffer.bufferSize; SSL* ssl = (session->flags.side == WOLFSSL_SERVER_END) ? session->sslServer : session->sslClient; + word32* reassemblyMemory = (session->flags.side == WOLFSSL_SERVER_END) ? + &session->cliReassemblyMemory : &session->srvReassemblyMemory; while (*front && ((*front)->begin == *expected) ) { word32 room = *bufferSize - *length; @@ -2687,6 +2722,8 @@ static int HaveMoreInput(SnifferSession* session, const byte** sslFrame, /* remove used packet */ *front = (*front)->next; + + *reassemblyMemory -= packetLen; FreePacketBuffer(del); moreInput = 1; @@ -3016,14 +3053,28 @@ int ssl_GetSessionStats(unsigned int* active, unsigned int* total, { int ret; - LockMutex(&RecoveryMutex); - - if (missedData) + if (missedData) { + LockMutex(&RecoveryMutex); *missedData = MissedDataSessions; - if (reassemblyMem) - *reassemblyMem = ReassemblyMemory; + UnLockMutex(&RecoveryMutex); + } - UnLockMutex(&RecoveryMutex); + if (reassemblyMem) { + SnifferSession* session; + int i; + + *reassemblyMem = 0; + LockMutex(&SessionMutex); + for (i = 0; i < HASH_SIZE; i++) { + session = SessionTable[i]; + while (session) { + *reassemblyMem += session->cliReassemblyMemory; + *reassemblyMem += session->srvReassemblyMemory; + session = session->next; + } + } + UnLockMutex(&SessionMutex); + } ret = wolfSSL_get_session_stats(active, total, peak, maxSessions); diff --git a/wolfssl/sniffer_error.h b/wolfssl/sniffer_error.h index e459ec858..2277c32bf 100644 --- a/wolfssl/sniffer_error.h +++ b/wolfssl/sniffer_error.h @@ -110,6 +110,7 @@ #define NO_SECURE_RENEGOTIATION 75 #define BAD_SESSION_STATS 76 +#define REASSEMBLY_MAX_STR 77 /* !!!! also add to msgTable in sniffer.c and .rc file !!!! */ diff --git a/wolfssl/sniffer_error.rc b/wolfssl/sniffer_error.rc index 8b942b257..bba88271b 100644 --- a/wolfssl/sniffer_error.rc +++ b/wolfssl/sniffer_error.rc @@ -92,5 +92,6 @@ STRINGTABLE 75, "Secure Renegotiation Not Supported" 76, "Get Session Stats Failure" + 77, "Reassembly Buffer Size Exceeded" } From f68400da40578eb94c1538c75e849b448b071fbd Mon Sep 17 00:00:00 2001 From: Ludovic FLAMENT Date: Wed, 23 Sep 2015 16:16:39 +0200 Subject: [PATCH 02/77] add IDEA cipher (ECB and CBC mode) add support of SSL_RSA_WITH_IDEA_CBC_SHA cipher suite (SSLv3, TLS v1.0 and TLSv1.1) --- configure.ac | 17 +++ src/include.am | 4 + src/internal.c | 42 ++++++ src/keys.c | 66 +++++++++ src/sniffer.c | 6 + src/ssl.c | 65 +++++++- tests/test-dtls.conf | 10 ++ tests/test-qsh.conf | 24 +++ tests/test.conf | 24 +++ wolfcrypt/src/idea.c | 279 +++++++++++++++++++++++++++++++++++ wolfcrypt/test/test.c | 185 +++++++++++++++++++++++ wolfssl/internal.h | 17 +++ wolfssl/openssl/evp.h | 6 + wolfssl/wolfcrypt/idea.h | 65 ++++++++ wolfssl/wolfcrypt/include.am | 1 + 15 files changed, 808 insertions(+), 3 deletions(-) create mode 100644 wolfcrypt/src/idea.c create mode 100644 wolfssl/wolfcrypt/idea.h diff --git a/configure.ac b/configure.ac index 37f1657be..1334f99b0 100644 --- a/configure.ac +++ b/configure.ac @@ -1149,6 +1149,22 @@ fi AM_CONDITIONAL([BUILD_DES3], [test "x$ENABLED_DES3" = "xyes"]) +# IDEA +AC_ARG_ENABLE([idea], +[ --enable-idea Enable IDEA (default: disabled)], +[ ENABLED_IDEA=$enableval ], +[ ENABLED_IDEA=no ] +) + +if test "x$ENABLED_IDEA" = "xyes" +then +AM_CFLAGS="$AM_CFLAGS -DHAVE_IDEA" +fi + +AM_CONDITIONAL([BUILD_IDEA], [test "x$ENABLED_IDEA" = "xyes"]) + + + # ARC4 AC_ARG_ENABLE([arc4], [ --enable-arc4 Enable ARC4 (default: disabled)], @@ -2401,6 +2417,7 @@ echo " * AES-NI: $ENABLED_AESNI" echo " * AES-GCM: $ENABLED_AESGCM" echo " * AES-CCM: $ENABLED_AESCCM" echo " * DES3: $ENABLED_DES3" +echo " * IDEA: $ENABLED_IDEA" echo " * Camellia: $ENABLED_CAMELLIA" echo " * NULL Cipher: $ENABLED_NULL_CIPHER" echo " * MD5: $ENABLED_MD5" diff --git a/src/include.am b/src/include.am index f594b1cf9..d2605a797 100644 --- a/src/include.am +++ b/src/include.am @@ -205,6 +205,10 @@ if BUILD_SRP src_libwolfssl_la_SOURCES += wolfcrypt/src/srp.c endif +if BUILD_IDEA +src_libwolfssl_la_SOURCES += wolfcrypt/src/idea.c +endif + if !BUILD_CRYPTONLY # ssl files src_libwolfssl_la_SOURCES += \ diff --git a/src/internal.c b/src/internal.c index 5eca2264e..bc48149fc 100644 --- a/src/internal.c +++ b/src/internal.c @@ -611,6 +611,10 @@ void InitCiphers(WOLFSSL* ssl) #ifdef HAVE_ONE_TIME_AUTH ssl->auth.setup = 0; #endif +#ifdef HAVE_IDEA + ssl->encrypt.idea = NULL; + ssl->decrypt.idea = NULL; +#endif } @@ -667,6 +671,10 @@ void FreeCiphers(WOLFSSL* ssl) #ifdef HAVE_POLY1305 XFREE(ssl->auth.poly1305, ssl->heap, DYNAMIC_TYPE_CIPHER); #endif +#ifdef HAVE_IDEA + XFREE(ssl->encrypt.idea, ssl->heap, DYNAMIC_TYPE_CIPHER); + XFREE(ssl->decrypt.idea, ssl->heap, DYNAMIC_TYPE_CIPHER); +#endif } @@ -1461,6 +1469,13 @@ void InitSuites(Suites* suites, ProtocolVersion pv, word16 haveRSA, } #endif +#ifdef BUILD_SSL_RSA_WITH_IDEA_CBC_SHA + if (haveRSA) { + suites->suites[idx++] = 0; + suites->suites[idx++] = SSL_RSA_WITH_IDEA_CBC_SHA; + } +#endif + suites->suiteSz = idx; InitSuitesHashSigAlgo(suites, haveECDSAsig, haveRSAsig, 0); @@ -3784,6 +3799,11 @@ static int BuildFinished(WOLFSSL* ssl, Hashes* hashes, const byte* sender) if (requirement == REQUIRES_NTRU) return 1; break; + + case SSL_RSA_WITH_IDEA_CBC_SHA : + if (requirement == REQUIRES_RSA) + return 1; + break; #endif case TLS_PSK_WITH_AES_128_GCM_SHA256 : @@ -5920,6 +5940,12 @@ static INLINE int Encrypt(WOLFSSL* ssl, byte* out, const byte* input, word16 sz) break; #endif + #ifdef HAVE_IDEA + case wolfssl_idea: + wc_IdeaCbcEncrypt(ssl->encrypt.idea, out, input, sz); + break; + #endif + default: WOLFSSL_MSG("wolfSSL Encrypt programming error"); ret = ENCRYPT_ERROR; @@ -6075,6 +6101,12 @@ static INLINE int Decrypt(WOLFSSL* ssl, byte* plain, const byte* input, break; #endif + #ifdef HAVE_IDEA + case wolfssl_idea: + wc_IdeaCbcDecrypt(ssl->decrypt.idea, plain, input, sz); + break; + #endif + default: WOLFSSL_MSG("wolfSSL Decrypt programming error"); ret = DECRYPT_ERROR; @@ -6814,6 +6846,7 @@ int ProcessReply(WOLFSSL* ssl) ssl->buffers.inputBuffer.idx, ssl->curSize); if (ret < 0) { + WOLFSSL_MSG("Decrypt failed"); WOLFSSL_ERROR(ret); return DECRYPT_ERROR; } @@ -6830,6 +6863,7 @@ int ProcessReply(WOLFSSL* ssl) &ssl->keys.padSz); } if (ret < 0) { + WOLFSSL_MSG("VerifyMac failed"); WOLFSSL_ERROR(ret); return DECRYPT_ERROR; } @@ -8874,6 +8908,10 @@ static const char* const cipher_names[] = #ifdef HAVE_RENEGOTIATION_INDICATION "RENEGOTIATION-INFO", #endif + +#ifdef BUILD_SSL_RSA_WITH_IDEA_CBC_SHA + "IDEA-CBC-SHA", +#endif }; @@ -9272,6 +9310,10 @@ static int cipher_name_idx[] = #ifdef HAVE_RENEGOTIATION_INDICATION TLS_EMPTY_RENEGOTIATION_INFO_SCSV, #endif + +#ifdef BUILD_SSL_RSA_WITH_IDEA_CBC_SHA + SSL_RSA_WITH_IDEA_CBC_SHA, +#endif }; diff --git a/src/keys.c b/src/keys.c index 41b5a941f..5ca1b72f7 100644 --- a/src/keys.c +++ b/src/keys.c @@ -1757,6 +1757,23 @@ int SetCipherSpecs(WOLFSSL* ssl) break; #endif +#ifdef BUILD_SSL_RSA_WITH_IDEA_CBC_SHA + case SSL_RSA_WITH_IDEA_CBC_SHA : + ssl->specs.bulk_cipher_algorithm = wolfssl_idea; + ssl->specs.cipher_type = block; + ssl->specs.mac_algorithm = sha_mac; + ssl->specs.kea = rsa_kea; + ssl->specs.sig_algo = rsa_sa_algo; + ssl->specs.hash_size = SHA_DIGEST_SIZE; + ssl->specs.pad_size = PAD_SHA; + ssl->specs.static_ecdh = 0; + ssl->specs.key_size = IDEA_KEY_SIZE; + ssl->specs.block_size = IDEA_BLOCK_SIZE; + ssl->specs.iv_size = IDEA_IV_SIZE; + + break; +#endif + default: WOLFSSL_MSG("Unsupported cipher suite, SetCipherSpecs"); return UNSUPPORTED_SUITE; @@ -2279,6 +2296,55 @@ static int SetKeys(Ciphers* enc, Ciphers* dec, Keys* keys, CipherSpecs* specs, } #endif +#ifdef HAVE_IDEA + if (specs->bulk_cipher_algorithm == wolfssl_idea) { + int ideaRet; + + if (enc && enc->idea == NULL) + enc->idea = (Idea*)XMALLOC(sizeof(Idea), heap, DYNAMIC_TYPE_CIPHER); + if (enc && enc->idea == NULL) + return MEMORY_E; + + if (dec && dec->idea == NULL) + dec->idea = (Idea*)XMALLOC(sizeof(Idea), heap, DYNAMIC_TYPE_CIPHER); + if (dec && dec->idea == NULL) + return MEMORY_E; + + if (side == WOLFSSL_CLIENT_END) { + if (enc) { + ideaRet = wc_IdeaSetKey(enc->idea, keys->client_write_key, + specs->key_size, keys->client_write_IV, + IDEA_ENCRYPTION); + if (ideaRet != 0) return ideaRet; + } + if (dec) { + ideaRet = wc_IdeaSetKey(dec->idea, keys->server_write_key, + specs->key_size, keys->server_write_IV, + IDEA_DECRYPTION); + if (ideaRet != 0) return ideaRet; + } + } + else { + if (enc) { + ideaRet = wc_IdeaSetKey(enc->idea, keys->server_write_key, + specs->key_size, keys->server_write_IV, + IDEA_ENCRYPTION); + if (ideaRet != 0) return ideaRet; + } + if (dec) { + ideaRet = wc_IdeaSetKey(dec->idea, keys->client_write_key, + specs->key_size, keys->client_write_IV, + IDEA_DECRYPTION); + if (ideaRet != 0) return ideaRet; + } + } + if (enc) + enc->setup = 1; + if (dec) + dec->setup = 1; + } +#endif + #ifdef HAVE_NULL_CIPHER if (specs->bulk_cipher_algorithm == wolfssl_cipher_null) { if (enc) diff --git a/src/sniffer.c b/src/sniffer.c index fa371ca2b..dc02b6aea 100644 --- a/src/sniffer.c +++ b/src/sniffer.c @@ -1939,6 +1939,12 @@ static int Decrypt(SSL* ssl, byte* output, const byte* input, word32 sz) break; #endif + #ifdef HAVE_IDEA + case wolfssl_idea: + wc_IdeaCbcDecrypt(ssl->decrypt.idea, output, input, sz); + break; + #endif + default: Trace(BAD_DECRYPT_TYPE); ret = -1; diff --git a/src/ssl.c b/src/ssl.c index 7ad1ba83d..8bf5c867a 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -76,6 +76,7 @@ #include #include #include + #include #include #include #ifdef HAVE_STUNNEL @@ -1614,6 +1615,10 @@ static const int EVP_DES_SIZE = 7; static const char *EVP_DES_EDE3_CBC = "DES-EDE3-CBC"; static const int EVP_DES_EDE3_SIZE = 12; +#ifdef HAVE_IDEA +static const char *EVP_IDEA_CBC = "IDEA-CBC"; +static const int EVP_IDEA_SIZE = 8; +#endif /* our KeyPemToDer password callback, password in userData */ static INLINE int OurPasswordCb(char* passwd, int sz, int rw, void* userdata) @@ -8119,7 +8124,13 @@ int wolfSSL_set_compression(WOLFSSL* ssl) return type; } - +#ifdef HAVE_IDEA + const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_idea_cbc(void) + { + WOLFSSL_ENTER("wolfSSL_EVP_idea_cbc"); + return EVP_IDEA_CBC; + } +#endif const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_enc_null(void) { static const char* type = "NULL"; @@ -8166,7 +8177,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl) const WOLFSSL_EVP_CIPHER* type, byte* key, byte* iv, int enc) { -#if defined(NO_AES) && defined(NO_DES3) +#if defined(NO_AES) && defined(NO_DES3) && !defined(HAVE_IDEA) (void)iv; (void)enc; #else @@ -8354,6 +8365,25 @@ int wolfSSL_set_compression(WOLFSSL* ssl) wc_Arc4SetKey(&ctx->cipher.arc4, key, ctx->keyLen); } #endif /* NO_RC4 */ +#ifdef HAVE_IDEA + else if (ctx->cipherType == IDEA_CBC_TYPE || + (type && XSTRNCMP(type, EVP_IDEA_CBC, EVP_IDEA_SIZE) == 0)) { + WOLFSSL_MSG(EVP_IDEA_CBC); + ctx->cipherType = IDEA_CBC_TYPE; + ctx->keyLen = IDEA_KEY_SIZE; + if (enc == 0 || enc == 1) + ctx->enc = enc ? 1 : 0; + if (key) { + ret = wc_IdeaSetKey(&ctx->cipher.idea, key, ctx->keyLen, iv, + ctx->enc ? IDEA_ENCRYPTION : IDEA_DECRYPTION); + if (ret != 0) + return ret; + } + + if (iv && key == NULL) + wc_IdeaSetIV(&ctx->cipher.idea, iv); + } +#endif /* HAVE_IDEA */ else if (ctx->cipherType == NULL_CIPHER_TYPE || (type && XSTRNCMP(type, "NULL", 4) == 0)) { WOLFSSL_MSG("NULL cipher"); @@ -8455,6 +8485,14 @@ int wolfSSL_set_compression(WOLFSSL* ssl) break; #endif +#ifdef HAVE_IDEA + case IDEA_CBC_TYPE : + if (ctx->enc) + wc_IdeaCbcEncrypt(&ctx->cipher.idea, dst, src, len); + else + wc_IdeaCbcDecrypt(&ctx->cipher.idea, dst, src, len); + break; +#endif case NULL_CIPHER_TYPE : XMEMCPY(dst, src, len); break; @@ -8518,6 +8556,12 @@ int wolfSSL_set_compression(WOLFSSL* ssl) break; #endif +#ifdef HAVE_IDEA + case IDEA_CBC_TYPE : + WOLFSSL_MSG("IDEA CBC"); + memcpy(ctx->iv, &ctx->cipher.idea.reg, IDEA_BLOCK_SIZE); + break; +#endif case ARC4_TYPE : WOLFSSL_MSG("ARC4"); break; @@ -8579,6 +8623,12 @@ int wolfSSL_set_compression(WOLFSSL* ssl) break; #endif +#ifdef HAVE_IDEA + case IDEA_CBC_TYPE : + WOLFSSL_MSG("IDEA CBC"); + memcpy(&ctx->cipher.idea.reg, ctx->iv, IDEA_BLOCK_SIZE); + break; +#endif case ARC4_TYPE : WOLFSSL_MSG("ARC4"); break; @@ -10003,6 +10053,11 @@ const char* wolfSSL_CIPHER_get_name(const WOLFSSL_CIPHER* cipher) case SSL_RSA_WITH_3DES_EDE_CBC_SHA : return "SSL_RSA_WITH_3DES_EDE_CBC_SHA"; #endif + #ifdef HAVE_IDEA + case SSL_RSA_WITH_IDEA_CBC_SHA : + return "SSL_RSA_WITH_IDEA_CBC_SHA"; + #endif + case TLS_RSA_WITH_AES_128_CBC_SHA : return "TLS_RSA_WITH_AES_128_CBC_SHA"; case TLS_RSA_WITH_AES_256_CBC_SHA : @@ -13509,7 +13564,11 @@ int wolfSSL_EVP_CIPHER_CTX_iv_length(const WOLFSSL_EVP_CIPHER_CTX* ctx) case DES_EDE3_CBC_TYPE : WOLFSSL_MSG("DES EDE3 CBC"); return DES_BLOCK_SIZE; - +#ifdef HAVE_IDEA + case IDEA_CBC_TYPE : + WOLFSSL_MSG("IDEA CBC"); + return IDEA_BLOCK_SIZE; +#endif case ARC4_TYPE : WOLFSSL_MSG("ARC4"); return 0; diff --git a/tests/test-dtls.conf b/tests/test-dtls.conf index 7a9c041e5..7a821fa04 100644 --- a/tests/test-dtls.conf +++ b/tests/test-dtls.conf @@ -84,6 +84,16 @@ -v 3 -l RC4-SHA +# server DTLSv1 IDEA-CBC-SHA +-u +-v 2 +-l IDEA-CBC-SHA + +# client DTLSv1 IDEA-CBC-SHA +-u +-v 2 +-l IDEA-CBC-SHA + # server DTLSv1 DES-CBC3-SHA -u -v 2 diff --git a/tests/test-qsh.conf b/tests/test-qsh.conf index 0f59c428f..c465531bb 100644 --- a/tests/test-qsh.conf +++ b/tests/test-qsh.conf @@ -103,6 +103,14 @@ -v 0 -l QSH:DES-CBC3-SHA +# server SSLv3 IDEA-CBC-SHA +-v 0 +-l QSH:IDEA-CBC-SHA + +# client SSLv3 IDEA-CBC-SHA +-v 0 +-l QSH:IDEA-CBC-SHA + # server TLSv1 RC4-SHA -v 1 -l QSH:RC4-SHA @@ -127,6 +135,14 @@ -v 1 -l QSH:DES-CBC3-SHA +# server TLSv1 IDEA-CBC-SHA +-v 1 +-l QSH:IDEA-CBC-SHA + +# client TLSv1 IDEA-CBC-SHA +-v 1 +-l QSH:IDEA-CBC-SHA + # server TLSv1 AES128-SHA -v 1 -l QSH:AES128-SHA @@ -175,6 +191,14 @@ -v 2 -l QSH:RC4-MD5 +# server TLSv1.1 IDEA-CBC-SHA +-v 2 +-l QSH:IDEA-CBC-SHA + +# client TLSv1.1 IDEA-CBC-SHA +-v 2 +-l QSH:IDEA-CBC-SHA + # server TLSv1.1 DES-CBC3-SHA -v 2 -l QSH:DES-CBC3-SHA diff --git a/tests/test.conf b/tests/test.conf index 9e6d0674a..5dda708b3 100644 --- a/tests/test.conf +++ b/tests/test.conf @@ -103,6 +103,14 @@ -v 0 -l DES-CBC3-SHA +# server SSLv3 IDEA-CBC-SHA +-v 0 +-l IDEA-CBC-SHA + +# client SSLv3 IDEA-CBC-SHA +-v 0 +-l IDEA-CBC-SHA + # server TLSv1 RC4-SHA -v 1 -l RC4-SHA @@ -127,6 +135,14 @@ -v 1 -l DES-CBC3-SHA +# server TLSv1 IDEA-CBC-SHA +-v 1 +-l IDEA-CBC-SHA + +# client TLSv1 IDEA-CBC-SHA +-v 1 +-l IDEA-CBC-SHA + # server TLSv1 AES128-SHA -v 1 -l AES128-SHA @@ -175,6 +191,14 @@ -v 2 -l RC4-MD5 +# server TLSv1.1 IDEA-CBC-SHA +-v 2 +-l IDEA-CBC-SHA + +# client TLSv1.1 IDEA-CBC-SHA +-v 2 +-l IDEA-CBC-SHA + # server TLSv1.1 DES-CBC3-SHA -v 2 -l DES-CBC3-SHA diff --git a/wolfcrypt/src/idea.c b/wolfcrypt/src/idea.c new file mode 100644 index 000000000..3daee1a10 --- /dev/null +++ b/wolfcrypt/src/idea.c @@ -0,0 +1,279 @@ +/* idea.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 +#endif + +#include + +#include + +#ifdef HAVE_IDEA + +#include + +#include +#include + +#ifdef NO_INLINE + #include +#else + #include +#endif + +/* multiplication of x and y modulo 2^16+1 + * IDEA specify a special case when an entry value is 0 ( x or y) + * then it must be replaced by 2^16 + */ +static INLINE word16 idea_mult(word16 x, word16 y) +{ + word32 mul, res; + + mul = (word32)x * (word32)y; + if (mul) { + res = (mul & IDEA_MASK) - (mul >> 16); + res -= (res >> 16); + return (word16) ((res <=0 ? res+IDEA_MODULO : res) & IDEA_MASK); + } + + /* x == 0 or y == 0 */ + return (-x -y + 1); +} + +/* compute 1/a modulo 2^16+1 using Extended euclidean algorithm + * adapted from fp_invmod */ +static INLINE word16 idea_invmod(word16 x) +{ + int u, v, b, d; + + if (x <= 1) + return x; + + u = IDEA_MODULO; + v = x; + d = 1; + b = 0; + + do { + while (!(u & 1)) { + u >>= 1; + if (b & 1) + b -= IDEA_MODULO; + b >>= 1; + } + + while (!(v & 1)) { + v >>= 1; + if (d & 1) { + d -= IDEA_MODULO; + } + d >>= 1; + } + + if (u >= v) { + u -= v; + b -= d; + } else { + v -= u; + d -= b; + } + } while (u); + + /* d is now the inverse, put positive value if required */ + if (d < 0) + d += IDEA_MODULO; + + return (word16)(d & IDEA_MASK); +} + +/* generate the 52 16-bits key sub-blocks from the 128 key */ +int wc_IdeaSetKey(Idea *idea, const byte* key, word16 keySz, + const byte *iv, int dir) +{ + word16 idx = 0; + word32 t; + short i; + + if (idea == NULL || key == NULL || keySz != IDEA_KEY_SIZE || + (dir != IDEA_ENCRYPTION && dir != IDEA_DECRYPTION)) + return BAD_FUNC_ARG; + + /* initial key schedule for 0 -> 7 */ + for (i = 0; i < IDEA_ROUNDS; i++) { + idea->skey[i] = (word16)key[idx++] << 8; + idea->skey[i] |= (word16)key[idx++]; + } + + /* shift phase key schedule for 8 -> 51 */ + for (i = IDEA_ROUNDS; i < IDEA_SK_NUM; i++) { + t = (word32)idea->skey[((i+1) & 7) ? i-7 : i-15] << 9; + t |= (word32)idea->skey[((i+2) & 7) < 2 ? i-14 : i-6] >> 7; + idea->skey[i] = (word16)(t & IDEA_MASK); + } + + /* compute decryption key from encryption key */ + if (dir == IDEA_DECRYPTION) { + word16 enckey[IDEA_SK_NUM]; + + /* put encryption key in tmp buffer */ + memcpy(enckey, idea->skey, sizeof(idea->skey)); + + idx = 0; + + idea->skey[6*IDEA_ROUNDS] = idea_invmod(enckey[idx++]); + idea->skey[6*IDEA_ROUNDS+1] = (IDEA_2EXP16 - enckey[idx++]) & IDEA_MASK; + idea->skey[6*IDEA_ROUNDS+2] = (IDEA_2EXP16 - enckey[idx++]) & IDEA_MASK; + idea->skey[6*IDEA_ROUNDS+3] = idea_invmod(enckey[idx++]); + + for (i = 6*(IDEA_ROUNDS-1); i >= 0; i -= 6) { + idea->skey[i+4] = enckey[idx++]; + idea->skey[i+5] = enckey[idx++]; + + idea->skey[i] = idea_invmod(enckey[idx++]); + if (i) { + idea->skey[i+2] = (IDEA_2EXP16 - enckey[idx++]) & IDEA_MASK; + idea->skey[i+1] = (IDEA_2EXP16 - enckey[idx++]) & IDEA_MASK; + } + else { + idea->skey[1] = (IDEA_2EXP16 - enckey[idx++]) & IDEA_MASK; + idea->skey[2] = (IDEA_2EXP16 - enckey[idx++]) & IDEA_MASK; + } + + idea->skey[i+3] = idea_invmod(enckey[idx++]); + } + + /* erase temporary buffer */ + ForceZero(enckey, sizeof(enckey)); + } + + /* set the iv */ + return wc_IdeaSetIV(idea, iv); +} + +/* set the IV in the Idea key structuve */ +int wc_IdeaSetIV(Idea *idea, const byte* iv) +{ + if (idea == NULL) + return BAD_FUNC_ARG; + + if (iv != NULL) + XMEMCPY(idea->reg, iv, IDEA_BLOCK_SIZE); + else + XMEMSET(idea->reg, 0, IDEA_BLOCK_SIZE); + + return 0; +} + +/* encryption/decryption for a block (64 bits) + */ +void wc_IdeaCipher(Idea *idea, byte* out, const byte* in) +{ + word32 t1, t2; + word16 i, skey_idx = 0, idx = 0; + word16 x[4]; + + /* put input byte block in word16 */ + for (i = 0; i < IDEA_BLOCK_SIZE/2; i++) { + x[i] = (word16)in[idx++] << 8; + x[i] |= (word16)in[idx++]; + } + + for (i = 0; i < IDEA_ROUNDS; i++) { + x[0] = idea_mult(x[0], idea->skey[skey_idx++]); + x[1] = ((word32)x[1] + (word32)idea->skey[skey_idx++]) & IDEA_MASK; + x[2] = ((word32)x[2] + (word32)idea->skey[skey_idx++]) & IDEA_MASK; + x[3] = idea_mult(x[3], idea->skey[skey_idx++]); + + t2 = x[0] ^ x[2]; + t2 = idea_mult(t2, idea->skey[skey_idx++]); + t1 = (t2 + (x[1] ^ x[3])) & IDEA_MASK; + t1 = idea_mult(t1, idea->skey[skey_idx++]); + t2 = (t1 + t2) & IDEA_MASK; + + x[0] ^= t1; + x[3] ^= t2; + + t2 ^= x[1]; + x[1] = x[2] ^ t1; + x[2] = t2; + } + + x[0] = idea_mult(x[0], idea->skey[skey_idx++]); + out[0] = (x[0] >> 8) & 0xFF; + out[1] = x[0] & 0xFF; + + x[2] = ((word32)x[2] + (word32)idea->skey[skey_idx++]) & IDEA_MASK; + out[2] = (x[2] >> 8) & 0xFF; + out[3] = x[2] & 0xFF; + + x[1] = ((word32)x[1] + (word32)idea->skey[skey_idx++]) & IDEA_MASK; + out[4] = (x[1] >> 8) & 0xFF; + out[5] = x[1] & 0xFF; + + x[3] = idea_mult(x[3], idea->skey[skey_idx++]); + out[6] = (x[3] >> 8) & 0xFF; + out[7] = x[3] & 0xFF; +} + +int wc_IdeaCbcEncrypt(Idea *idea, byte* out, const byte* in, word32 len) +{ + int blocks; + + if (idea == NULL || out == NULL || in == NULL) + return BAD_FUNC_ARG; + + blocks = len / IDEA_BLOCK_SIZE; + while (blocks--) { + xorbuf(idea->reg, in, IDEA_BLOCK_SIZE); + wc_IdeaCipher(idea, idea->reg, idea->reg); + XMEMCPY(out, idea->reg, IDEA_BLOCK_SIZE); + + out += IDEA_BLOCK_SIZE; + in += IDEA_BLOCK_SIZE; + } + + return 0; +} + +int wc_IdeaCbcDecrypt(Idea *idea, byte* out, const byte* in, word32 len) +{ + int blocks; + byte tmp[IDEA_BLOCK_SIZE]; + + if (idea == NULL || out == NULL || in == NULL) + return BAD_FUNC_ARG; + + blocks = len / IDEA_BLOCK_SIZE; + while (blocks--) { + XMEMCPY(tmp, in, IDEA_BLOCK_SIZE); + wc_IdeaCipher(idea, out, tmp); + xorbuf(out, idea->reg, IDEA_BLOCK_SIZE); + XMEMCPY(idea->reg, tmp, IDEA_BLOCK_SIZE); + + out += IDEA_BLOCK_SIZE; + in += IDEA_BLOCK_SIZE; + } + + return 0; +} + +#endif /* HAVE_IDEA */ diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index ca60d3f42..5a234c4bb 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -54,6 +54,7 @@ #include #include #include +#include #include #include #include @@ -211,6 +212,9 @@ int pbkdf2_test(void); #if defined(WOLFSSL_CERT_EXT) && defined(WOLFSSL_TEST_CERT) int certext_test(void); #endif +#ifdef HAVE_IDEA +int idea_test(void); +#endif /* General big buffer size for many tests. */ #define FOURK_BUF 4096 @@ -475,6 +479,13 @@ int wolfcrypt_test(void* args) printf( "CAMELLIA test passed!\n"); #endif +#ifdef HAVE_IDEA + if ( (ret = idea_test()) != 0) + return err_sys("IDEA test failed!\n", ret); + else + printf( "IDEA test passed!\n"); +#endif + if ( (ret = random_test()) != 0) return err_sys("RANDOM test failed!\n", ret); else @@ -3178,6 +3189,180 @@ int camellia_test(void) } #endif /* HAVE_CAMELLIA */ +#ifdef HAVE_IDEA +int idea_test(void) +{ + int ret; + word16 i, j; + + Idea idea; + byte data[IDEA_BLOCK_SIZE]; + + /* Project NESSIE test vectors */ +#define IDEA_NB_TESTS 6 +#define IDEA_NB_TESTS_EXTRA 4 + + const byte v_key[IDEA_NB_TESTS][IDEA_KEY_SIZE] = { + { 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, + 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37 }, + { 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, + 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57 }, + { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, + { 0x2B, 0xD6, 0x45, 0x9F, 0x82, 0xC5, 0xB3, 0x00, + 0x95, 0x2C, 0x49, 0x10, 0x48, 0x81, 0xFF, 0x48 }, + { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, + 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, + { 0x2B, 0xD6, 0x45, 0x9F, 0x82, 0xC5, 0xB3, 0x00, + 0x95, 0x2C, 0x49, 0x10, 0x48, 0x81, 0xFF, 0x48 }, + }; + + const byte v1_plain[IDEA_NB_TESTS][IDEA_BLOCK_SIZE] = { + { 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37, 0x37 }, + { 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57, 0x57 }, + { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }, + { 0xEA, 0x02, 0x47, 0x14, 0xAD, 0x5C, 0x4D, 0x84 }, + { 0xDB, 0x2D, 0x4A, 0x92, 0xAA, 0x68, 0x27, 0x3F }, + { 0xF1, 0x29, 0xA6, 0x60, 0x1E, 0xF6, 0x2A, 0x47 }, + }; + + byte v1_cipher[IDEA_NB_TESTS][IDEA_BLOCK_SIZE] = { + { 0x54, 0xCF, 0x21, 0xE3, 0x89, 0xD8, 0x73, 0xEC }, + { 0x85, 0x52, 0x4D, 0x41, 0x0E, 0xB4, 0x28, 0xAE }, + { 0xF5, 0x26, 0xAB, 0x9A, 0x62, 0xC0, 0xD2, 0x58 }, + { 0xC8, 0xFB, 0x51, 0xD3, 0x51, 0x66, 0x27, 0xA8 }, + { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 }, + { 0xEA, 0x02, 0x47, 0x14, 0xAD, 0x5C, 0x4D, 0x84 }, + }; + + byte v1_cipher_100[IDEA_NB_TESTS_EXTRA][IDEA_BLOCK_SIZE] = { + { 0x12, 0x46, 0x2F, 0xD0, 0xFB, 0x3A, 0x63, 0x39 }, + { 0x15, 0x61, 0xE8, 0xC9, 0x04, 0x54, 0x8B, 0xE9 }, + { 0x42, 0x12, 0x2A, 0x94, 0xB0, 0xF6, 0xD2, 0x43 }, + { 0x53, 0x4D, 0xCD, 0x48, 0xDD, 0xD5, 0xF5, 0x9C }, + }; + + byte v1_cipher_1000[IDEA_NB_TESTS_EXTRA][IDEA_BLOCK_SIZE] = { + { 0x44, 0x1B, 0x38, 0x5C, 0x77, 0x29, 0x75, 0x34 }, + { 0xF0, 0x4E, 0x58, 0x88, 0x44, 0x99, 0x22, 0x2D }, + { 0xB3, 0x5F, 0x93, 0x7F, 0x6A, 0xA0, 0xCD, 0x1F }, + { 0x9A, 0xEA, 0x46, 0x8F, 0x42, 0x9B, 0xBA, 0x15 }, + }; + + /* CBC test */ + const char *message = "International Data Encryption Algorithm"; + byte msg_enc[40], msg_dec[40]; + + for (i = 0; i < IDEA_NB_TESTS; i++) { + /* Set encryption key */ + memset(&idea, 0, sizeof(Idea)); + ret = wc_IdeaSetKey(&idea, v_key[i], IDEA_KEY_SIZE, + NULL, IDEA_ENCRYPTION); + if (ret != 0) { + printf("wc_IdeaSetKey (enc) failed\n"); + return -1; + } + + /* Data encryption */ + wc_IdeaCipher(&idea, data, v1_plain[i]); + if (XMEMCMP(&v1_cipher[i], data, IDEA_BLOCK_SIZE)) { + printf("Bad encryption\n"); + return -1; + } + + /* Set decryption key */ + memset(&idea, 0, sizeof(Idea)); + ret = wc_IdeaSetKey(&idea, v_key[i], IDEA_KEY_SIZE, + NULL, IDEA_DECRYPTION); + if (ret != 0) { + printf("wc_IdeaSetKey (dec) failed\n"); + return -1; + } + + /* Data decryption */ + wc_IdeaCipher(&idea, data, data); + if (XMEMCMP(v1_plain[i], data, IDEA_BLOCK_SIZE)) { + printf("Bad decryption\n"); + return -1; + } + + /* Set encryption key */ + memset(&idea, 0, sizeof(Idea)); + ret = wc_IdeaSetKey(&idea, v_key[i], IDEA_KEY_SIZE, + v_key[i], IDEA_ENCRYPTION); + if (ret != 0) { + printf("wc_IdeaSetKey (enc) failed\n"); + return -1; + } + + memset(msg_enc, 0, sizeof(msg_enc)); + ret = wc_IdeaCbcEncrypt(&idea, msg_enc, (byte *)message, + (word32)strlen(message)+1); + if (ret != 0) { + printf("wc_IdeaCbcEncrypt failed\n"); + return -1; + } + + /* Set decryption key */ + memset(&idea, 0, sizeof(Idea)); + ret = wc_IdeaSetKey(&idea, v_key[i], IDEA_KEY_SIZE, + v_key[i], IDEA_DECRYPTION); + if (ret != 0) { + printf("wc_IdeaSetKey (dec) failed\n"); + return -1; + } + + memset(msg_dec, 0, sizeof(msg_dec)); + ret = wc_IdeaCbcDecrypt(&idea, msg_dec, msg_enc, + (word32)strlen(message)+1); + if (ret != 0) { + printf("wc_IdeaCbcDecrypt failed\n"); + return -1; + } + + if (XMEMCMP(message, msg_dec, (word32)strlen(message))) { + printf("Bad CBC decryption\n"); + return -1; + } + } + + for (i = 0; i < IDEA_NB_TESTS_EXTRA; i++) { + /* Set encryption key */ + memset(&idea, 0, sizeof(Idea)); + ret = wc_IdeaSetKey(&idea, v_key[i], IDEA_KEY_SIZE, + NULL, IDEA_ENCRYPTION); + if (ret != 0) { + printf("wc_IdeaSetKey (enc) failed\n"); + return -1; + } + + /* 100 times data encryption */ + XMEMCPY(data, v1_plain[i], IDEA_BLOCK_SIZE); + for (j = 0; j < 100; j++) { + wc_IdeaCipher(&idea, data, data); + } + + if (XMEMCMP(v1_cipher_100[i], data, IDEA_BLOCK_SIZE)) { + printf("Bad encryption (100 times)\n"); + return -1; + } + + /* 1000 times data encryption */ + XMEMCPY(data, v1_plain[i], IDEA_BLOCK_SIZE); + for (j = 0; j < 1000; j++) { + wc_IdeaCipher(&idea, data, data); + } + + if (XMEMCMP(v1_cipher_1000[i], data, IDEA_BLOCK_SIZE)) { + printf("Bad encryption (100 times)\n"); + return -1; + } + } + + return 0; +} +#endif /* HAVE_IDEA */ + #if defined(HAVE_HASHDRBG) || defined(NO_RC4) diff --git a/wolfssl/internal.h b/wolfssl/internal.h index bb7437e68..74c8ddd9a 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -88,6 +88,10 @@ #include #endif +#ifdef HAVE_IDEA + #include +#endif + #include #ifdef WOLFSSL_CALLBACKS @@ -241,6 +245,12 @@ typedef byte word24[3]; #endif #endif + #if !defined(NO_RSA) && defined(HAVE_IDEA) + #if !defined(NO_SHA) && defined(WOLFSSL_STATIC_RSA) + #define BUILD_SSL_RSA_WITH_IDEA_CBC_SHA + #endif + #endif + #if !defined(NO_RSA) && !defined(NO_AES) && !defined(NO_TLS) #if !defined(NO_SHA) #if defined(WOLFSSL_STATIC_RSA) @@ -642,6 +652,9 @@ typedef byte word24[3]; #define HAVE_PFS #endif +#if defined(BUILD_SSL_RSA_WITH_IDEA_CBC_SHA) + #define BUILD_IDEA +#endif /* actual cipher values, 2nd byte */ enum { @@ -661,6 +674,7 @@ enum { SSL_RSA_WITH_RC4_128_SHA = 0x05, SSL_RSA_WITH_RC4_128_MD5 = 0x04, SSL_RSA_WITH_3DES_EDE_CBC_SHA = 0x0A, + SSL_RSA_WITH_IDEA_CBC_SHA = 0x07, /* ECC suites, first byte is 0xC0 (ECC_BYTE) */ TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA = 0x14, @@ -1841,6 +1855,9 @@ typedef struct Ciphers { #endif #ifdef BUILD_RABBIT Rabbit* rabbit; +#endif +#ifdef HAVE_IDEA + Idea* idea; #endif byte setup; /* have we set it up flag for detection */ } Ciphers; diff --git a/wolfssl/openssl/evp.h b/wolfssl/openssl/evp.h index bc6b2baf3..6d3449f07 100644 --- a/wolfssl/openssl/evp.h +++ b/wolfssl/openssl/evp.h @@ -73,6 +73,7 @@ WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_aes_256_ctr(void); WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_des_cbc(void); WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_des_ede3_cbc(void); WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_rc4(void); +WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_idea_cbc(void); WOLFSSL_API const WOLFSSL_EVP_CIPHER* wolfSSL_EVP_enc_null(void); @@ -109,6 +110,9 @@ typedef union { Des3 des3; #endif Arc4 arc4; +#ifdef HAVE_IDEA + Idea idea; +#endif } WOLFSSL_Cipher; @@ -126,6 +130,7 @@ enum { EVP_PKEY_RSA = 11, EVP_PKEY_DSA = 12, EVP_PKEY_EC = 13, + IDEA_CBC_TYPE = 14, NID_sha1 = 64, NID_md5 = 4 }; @@ -224,6 +229,7 @@ typedef WOLFSSL_EVP_CIPHER_CTX EVP_CIPHER_CTX; #define EVP_des_cbc wolfSSL_EVP_des_cbc #define EVP_des_ede3_cbc wolfSSL_EVP_des_ede3_cbc #define EVP_rc4 wolfSSL_EVP_rc4 +#define EVP_idea_cbc wolfSSL_EVP_idea_cbc #define EVP_enc_null wolfSSL_EVP_enc_null #define EVP_MD_size wolfSSL_EVP_MD_size diff --git a/wolfssl/wolfcrypt/idea.h b/wolfssl/wolfcrypt/idea.h new file mode 100644 index 000000000..c3e70c16b --- /dev/null +++ b/wolfssl/wolfcrypt/idea.h @@ -0,0 +1,65 @@ +/* idea.h + * + * 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 + */ + +#ifndef WOLF_CRYPT_IDEA_H +#define WOLF_CRYPT_IDEA_H + +#include + +#ifdef HAVE_IDEA + +#ifdef __cplusplus + extern "C" { +#endif + +enum { + IDEA_MODULO = 0x10001, /* 2^16+1 */ + IDEA_2EXP16 = 0x10000, /* 2^16 */ + IDEA_MASK = 0xFFFF, /* 16 bits set to one */ + IDEA_ROUNDS = 8, /* number of rounds for IDEA */ + IDEA_SK_NUM = (6*IDEA_ROUNDS + 4), /* number of subkeys */ + IDEA_KEY_SIZE = 16, /* size of key in bytes */ + IDEA_BLOCK_SIZE = 8, /* size of IDEA blocks in bytes */ + IDEA_IV_SIZE = 8, /* size of IDEA IV in bytes */ + IDEA_ENCRYPTION = 0, + IDEA_DECRYPTION = 1 +}; + +/* IDEA encryption and decryption */ +typedef struct Idea { + byte reg[IDEA_BLOCK_SIZE]; /* for CBC mode */ + word16 skey[IDEA_SK_NUM]; /* 832 bits expanded key */ +} Idea; + +WOLFSSL_API int wc_IdeaSetKey(Idea *idea, const byte* key, word16 keySz, + const byte *iv, int dir); +WOLFSSL_API int wc_IdeaSetIV(Idea *idea, const byte* iv); +WOLFSSL_API void wc_IdeaCipher(Idea *idea, byte* out, const byte* in); +WOLFSSL_API int wc_IdeaCbcEncrypt(Idea *idea, byte* out, + const byte* in, word32 len); +WOLFSSL_API int wc_IdeaCbcDecrypt(Idea *idea, byte* out, + const byte* in, word32 len); +#ifdef __cplusplus + } /* extern "C" */ +#endif + +#endif /* HAVE_IDEA */ +#endif /* WOLF_CRYPT_IDEA_H */ diff --git a/wolfssl/wolfcrypt/include.am b/wolfssl/wolfcrypt/include.am index 8387ed7df..452fe8f18 100644 --- a/wolfssl/wolfcrypt/include.am +++ b/wolfssl/wolfcrypt/include.am @@ -47,6 +47,7 @@ nobase_include_HEADERS+= \ wolfssl/wolfcrypt/blake2-impl.h \ wolfssl/wolfcrypt/tfm.h \ wolfssl/wolfcrypt/srp.h \ + wolfssl/wolfcrypt/idea.h \ wolfssl/wolfcrypt/types.h \ wolfssl/wolfcrypt/visibility.h \ wolfssl/wolfcrypt/logging.h \ From d669fc28c2b6423ce18f639ead40bd583135cec7 Mon Sep 17 00:00:00 2001 From: toddouska Date: Wed, 23 Sep 2015 14:42:48 -0700 Subject: [PATCH 03/77] add idea benchmark, cleanup --- configure.ac | 2 +- tests/unit.c | 3 +++ wolfcrypt/benchmark/benchmark.c | 42 +++++++++++++++++++++++++++++++++ wolfcrypt/src/idea.c | 2 -- 4 files changed, 46 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 1725877cd..0d3f00560 100644 --- a/configure.ac +++ b/configure.ac @@ -1155,7 +1155,7 @@ AM_CONDITIONAL([BUILD_DES3], [test "x$ENABLED_DES3" = "xyes"]) # IDEA AC_ARG_ENABLE([idea], -[ --enable-idea Enable IDEA (default: disabled)], +[AS_HELP_STRING([--enable-idea],[Enable IDEA Cipher (default: disabled)])], [ ENABLED_IDEA=$enableval ], [ ENABLED_IDEA=no ] ) diff --git a/tests/unit.c b/tests/unit.c index 3a7f2452c..a05ae3ccd 100644 --- a/tests/unit.c +++ b/tests/unit.c @@ -50,6 +50,9 @@ int unit_test(int argc, char** argv) (void)argv; printf("starting unit tests...\n"); +#if defined(DEBUG_WOLFSSL) && !defined(HAVE_VALGRIND) + wolfSSL_Debugging_ON(); +#endif #ifdef HAVE_CAVIUM ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); if (ret != 0) diff --git a/wolfcrypt/benchmark/benchmark.c b/wolfcrypt/benchmark/benchmark.c index 938a4a641..5695a60df 100644 --- a/wolfcrypt/benchmark/benchmark.c +++ b/wolfcrypt/benchmark/benchmark.c @@ -61,6 +61,9 @@ #ifdef HAVE_ECC #include #endif +#ifdef HAVE_IDEA + #include +#endif #ifdef HAVE_CURVE25519 #include #endif @@ -121,6 +124,7 @@ void bench_des(void); +void bench_idea(void); void bench_arc4(void); void bench_hc128(void); void bench_rabbit(void); @@ -303,6 +307,9 @@ int benchmark_test(void *args) #ifndef NO_DES3 bench_des(); #endif +#ifdef HAVE_IDEA + bench_idea(); +#endif printf("\n"); @@ -661,6 +668,41 @@ void bench_des(void) #endif +#ifdef HAVE_IDEA +void bench_idea(void) +{ + Idea enc; + double start, total, persec; + int i, ret; + + ret = wc_IdeaSetKey(&enc, key, IDEA_KEY_SIZE, iv, IDEA_ENCRYPTION); + if (ret != 0) { + printf("Des3_SetKey failed, ret = %d\n", ret); + return; + } + start = current_time(1); + BEGIN_INTEL_CYCLES + + for(i = 0; i < numBlocks; i++) + wc_IdeaCbcEncrypt(&enc, plain, cipher, sizeof(plain)); + + END_INTEL_CYCLES + total = current_time(0) - start; + + persec = 1 / total * numBlocks; +#ifdef BENCH_EMBEDDED + /* since using kB, convert to MB/s */ + persec = persec / 1024; +#endif + + printf("IDEA %d %s took %5.3f seconds, %8.3f MB/s", numBlocks, + blockType, total, persec); + SHOW_INTEL_CYCLES + printf("\n"); +} +#endif /* HAVE_IDEA */ + + #ifndef NO_RC4 void bench_arc4(void) { diff --git a/wolfcrypt/src/idea.c b/wolfcrypt/src/idea.c index 3daee1a10..7214af120 100644 --- a/wolfcrypt/src/idea.c +++ b/wolfcrypt/src/idea.c @@ -23,8 +23,6 @@ #include #endif -#include - #include #ifdef HAVE_IDEA From 86d74efc37d5a83a1fea2be5589753e8130cf93e Mon Sep 17 00:00:00 2001 From: Ludovic FLAMENT Date: Thu, 24 Sep 2015 08:13:43 +0200 Subject: [PATCH 04/77] return IdeaCbc{Encrypt/Decrypt} error code --- src/internal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/internal.c b/src/internal.c index bc48149fc..9c574a50c 100644 --- a/src/internal.c +++ b/src/internal.c @@ -5942,8 +5942,8 @@ static INLINE int Encrypt(WOLFSSL* ssl, byte* out, const byte* input, word16 sz) #ifdef HAVE_IDEA case wolfssl_idea: - wc_IdeaCbcEncrypt(ssl->encrypt.idea, out, input, sz); - break; + ret = wc_IdeaCbcEncrypt(ssl->encrypt.idea, out, input, sz); + break; #endif default: @@ -6103,7 +6103,7 @@ static INLINE int Decrypt(WOLFSSL* ssl, byte* plain, const byte* input, #ifdef HAVE_IDEA case wolfssl_idea: - wc_IdeaCbcDecrypt(ssl->decrypt.idea, plain, input, sz); + ret = wc_IdeaCbcDecrypt(ssl->decrypt.idea, plain, input, sz); break; #endif From ae6b4be1355adc84d18303b214608dc3d1c12df6 Mon Sep 17 00:00:00 2001 From: Ludovic FLAMENT Date: Thu, 24 Sep 2015 22:55:11 +0200 Subject: [PATCH 05/77] fix idea_mult move reg and tmp buffer to word32 --- wolfcrypt/src/idea.c | 27 ++++++++++++++------------- wolfssl/wolfcrypt/idea.h | 5 +++-- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/wolfcrypt/src/idea.c b/wolfcrypt/src/idea.c index 3daee1a10..0f411c532 100644 --- a/wolfcrypt/src/idea.c +++ b/wolfcrypt/src/idea.c @@ -46,17 +46,19 @@ */ static INLINE word16 idea_mult(word16 x, word16 y) { - word32 mul, res; + long mul, res; - mul = (word32)x * (word32)y; + mul = x * y; if (mul) { res = (mul & IDEA_MASK) - (mul >> 16); - res -= (res >> 16); return (word16) ((res <=0 ? res+IDEA_MODULO : res) & IDEA_MASK); } - /* x == 0 or y == 0 */ - return (-x -y + 1); + if (!x) + return (IDEA_MODULO - y); + + /* !y */ + return (IDEA_MODULO - x); } /* compute 1/a modulo 2^16+1 using Extended euclidean algorithm @@ -97,7 +99,7 @@ static INLINE word16 idea_invmod(word16 x) d -= b; } } while (u); - + /* d is now the inverse, put positive value if required */ if (d < 0) d += IDEA_MODULO; @@ -243,8 +245,8 @@ int wc_IdeaCbcEncrypt(Idea *idea, byte* out, const byte* in, word32 len) blocks = len / IDEA_BLOCK_SIZE; while (blocks--) { - xorbuf(idea->reg, in, IDEA_BLOCK_SIZE); - wc_IdeaCipher(idea, idea->reg, idea->reg); + xorbuf((byte*)idea->reg, in, IDEA_BLOCK_SIZE); + wc_IdeaCipher(idea, (byte*)idea->reg, (byte*)idea->reg); XMEMCPY(out, idea->reg, IDEA_BLOCK_SIZE); out += IDEA_BLOCK_SIZE; @@ -257,17 +259,16 @@ int wc_IdeaCbcEncrypt(Idea *idea, byte* out, const byte* in, word32 len) int wc_IdeaCbcDecrypt(Idea *idea, byte* out, const byte* in, word32 len) { int blocks; - byte tmp[IDEA_BLOCK_SIZE]; if (idea == NULL || out == NULL || in == NULL) return BAD_FUNC_ARG; blocks = len / IDEA_BLOCK_SIZE; while (blocks--) { - XMEMCPY(tmp, in, IDEA_BLOCK_SIZE); - wc_IdeaCipher(idea, out, tmp); - xorbuf(out, idea->reg, IDEA_BLOCK_SIZE); - XMEMCPY(idea->reg, tmp, IDEA_BLOCK_SIZE); + XMEMCPY((byte*)idea->tmp, in, IDEA_BLOCK_SIZE); + wc_IdeaCipher(idea, out, (byte*)idea->tmp); + xorbuf(out, (byte*)idea->reg, IDEA_BLOCK_SIZE); + XMEMCPY(idea->reg, idea->tmp, IDEA_BLOCK_SIZE); out += IDEA_BLOCK_SIZE; in += IDEA_BLOCK_SIZE; diff --git a/wolfssl/wolfcrypt/idea.h b/wolfssl/wolfcrypt/idea.h index c3e70c16b..7fcd2c051 100644 --- a/wolfssl/wolfcrypt/idea.h +++ b/wolfssl/wolfcrypt/idea.h @@ -45,8 +45,9 @@ enum { /* IDEA encryption and decryption */ typedef struct Idea { - byte reg[IDEA_BLOCK_SIZE]; /* for CBC mode */ - word16 skey[IDEA_SK_NUM]; /* 832 bits expanded key */ + word32 reg[IDEA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */ + word32 tmp[IDEA_BLOCK_SIZE / sizeof(word32)]; /* for CBC mode */ + word16 skey[IDEA_SK_NUM]; /* 832 bits expanded key */ } Idea; WOLFSSL_API int wc_IdeaSetKey(Idea *idea, const byte* key, word16 keySz, From 0c95a5e940ddf88aa37145689e7b5e14441aa45b Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Fri, 25 Sep 2015 10:51:35 +0900 Subject: [PATCH 06/77] Adding FreeRTOS TCP support, FREERTOS_TCP option --- src/io.c | 13 +++++++++++++ wolfcrypt/src/wc_port.c | 2 +- wolfssl/internal.h | 2 +- wolfssl/wolfcrypt/settings.h | 26 +++++++++++++++++++++++++- wolfssl/wolfcrypt/types.h | 4 ++-- wolfssl/wolfcrypt/wc_port.h | 8 ++++++-- 6 files changed, 48 insertions(+), 7 deletions(-) diff --git a/src/io.c b/src/io.c index e296a2ed9..42b2fb090 100644 --- a/src/io.c +++ b/src/io.c @@ -77,6 +77,8 @@ static int errno; #elif defined(WOLFSSL_TIRTOS) #include + #elif defined(FREERTOS_TCP) + #include "FreeRTOS_Sockets.h" #elif defined(WOLFSSL_IAR_ARM) /* nothing */ #else @@ -178,6 +180,14 @@ #define SOCKET_EPIPE PICO_ERR_EIO #define SOCKET_ECONNREFUSED PICO_ERR_ECONNREFUSED #define SOCKET_ECONNABORTED PICO_ERR_ESHUTDOWN +#elif defined(FREERTOS_TCP) + #define SOCKET_EWOULDBLOCK FREERTOS_EWOULDBLOCK + #define SOCKET_EAGAIN FREERTOS_EWOULDBLOCK + #define SOCKET_ECONNRESET FREERTOS_SOCKET_ERROR + #define SOCKET_EINTR FREERTOS_SOCKET_ERROR + #define SOCKET_EPIPE FREERTOS_SOCKET_ERROR + #define SOCKET_ECONNREFUSED FREERTOS_SOCKET_ERROR + #define SOCKET_ECONNABORTED FREERTOS_SOCKET_ERROR #else #define SOCKET_EWOULDBLOCK EWOULDBLOCK #define SOCKET_EAGAIN EAGAIN @@ -201,6 +211,9 @@ #elif defined(WOLFSSL_PICOTCP) #define SEND_FUNCTION pico_send #define RECV_FUNCTION pico_recv +#elif defined(FREERTOS_TCP) + #define RECV_FUNCTION(a,b,c,d) FreeRTOS_recv((Socket_t)(a),(void*)(b), (size_t)(c), (BaseType_t)(d)) + #define SEND_FUNCTION(a,b,c,d) FreeRTOS_send((Socket_t)(a),(void*)(b), (size_t)(c), (BaseType_t)(d)) #else #define SEND_FUNCTION send #define RECV_FUNCTION recv diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index 775195c55..94967ceb1 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -66,7 +66,7 @@ int UnLockMutex(wolfSSL_Mutex *m) #else /* MULTI_THREAD */ - #if defined(FREERTOS) + #if defined(FREERTOS) || defined(FREERTOS_TCP) int InitMutex(wolfSSL_Mutex* m) { diff --git a/wolfssl/internal.h b/wolfssl/internal.h index bb7437e68..7dec30244 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -111,7 +111,7 @@ #endif #elif defined(MICRIUM) /* do nothing, just don't pick Unix */ -#elif defined(FREERTOS) || defined(WOLFSSL_SAFERTOS) +#elif defined(FREERTOS) || defined(FREERTOS_TCP) || defined(WOLFSSL_SAFERTOS) /* do nothing */ #elif defined(EBSNET) /* do nothing */ diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 1421b73fc..5800918ad 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -57,6 +57,9 @@ /* Uncomment next line if using FreeRTOS */ /* #define FREERTOS */ +/* Uncomment next line if using FreeRTOS-Plus TCP */ +/* #define FREERTOS_TCP */ + /* Uncomment next line if using FreeRTOS Windows Simulator */ /* #define FREERTOS_WINSIM */ @@ -305,7 +308,7 @@ /* Micrium will use Visual Studio for compilation but not the Win32 API */ -#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \ +#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && !defined(FREERTOS_TCP)\ && !defined(EBSNET) && !defined(WOLFSSL_EROAD) #define USE_WINDOWS_API #endif @@ -406,6 +409,27 @@ static char *fgets(char *buff, int sz, FILE *fp) #endif #endif +#ifdef FREERTOS_TCP + +#if !defined(NO_WOLFSSL_MEMORY) && !defined(XMALLOC_USER) +#define XMALLOC(s, h, type) pvPortMalloc((s)) +#define XFREE(p, h, type) vPortFree((p)) +#endif + +#define CUSTOM_RAND_GENERATE testRandGen /* for test use only */ +static int testRandGen(void) { + return 0; +} + +#define NO_WOLFSSL_DIR +#define NO_WRITEV +#define WOLFSSL_HAVE_MIN +#define USE_FAST_MATH +#define TFM_TIMING_REGISTANT +#define NO_MAIN_DRIVER + +#endif + #ifdef WOLFSSL_TIRTOS #define SIZEOF_LONG_LONG 8 #define NO_WRITEV diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index dfe15d488..6c02013d9 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -155,7 +155,7 @@ /* Micrium will use Visual Studio for compilation but not the Win32 API */ - #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \ + #if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) && !defined(FREERTOS_TCP) \ && !defined(EBSNET) #define USE_WINDOWS_API #endif @@ -180,7 +180,7 @@ #elif !defined(MICRIUM_MALLOC) && !defined(EBSNET) \ && !defined(WOLFSSL_SAFERTOS) && !defined(FREESCALE_MQX) \ && !defined(FREESCALE_KSDK_MQX) && !defined(FREESCALE_FREE_RTOS) \ - && !defined(WOLFSSL_LEANPSK) && !defined(FREERTOS) \ + && !defined(WOLFSSL_LEANPSK) && !defined(FREERTOS) && !defined(FREERTOS_TCP)\ && !defined(WOLFSSL_uITRON4) && !defined(WOLFSSL_uTKERNEL2) /* default C runtime, can install different routines at runtime via cbs */ #include diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index 2056b7cde..4989d19f1 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -49,7 +49,7 @@ #endif #elif defined(MICRIUM) /* do nothing, just don't pick Unix */ -#elif defined(FREERTOS) || defined(WOLFSSL_SAFERTOS) +#elif defined(FREERTOS) || defined(FREERTOS_TCP) || defined(WOLFSSL_SAFERTOS) /* do nothing */ #elif defined(EBSNET) /* do nothing */ @@ -87,8 +87,12 @@ typedef int wolfSSL_Mutex; #else /* MULTI_THREADED */ /* FREERTOS comes first to enable use of FreeRTOS Windows simulator only */ - #ifdef FREERTOS + #if defined(FREERTOS) typedef xSemaphoreHandle wolfSSL_Mutex; + #elif defined(FREERTOS_TCP) + #include "FreeRTOS.h" + #include "semphr.h" + typedef SemaphoreHandle_t wolfSSL_Mutex; #elif defined(WOLFSSL_SAFERTOS) typedef struct wolfSSL_Mutex { signed char mutexBuffer[portQUEUE_OVERHEAD_BYTES]; From 71576aef142adb8ac2c859dd27a7d5cd77405619 Mon Sep 17 00:00:00 2001 From: Ludovic FLAMENT Date: Fri, 25 Sep 2015 23:52:08 +0200 Subject: [PATCH 07/77] fix bad computed values --- wolfcrypt/src/idea.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/wolfcrypt/src/idea.c b/wolfcrypt/src/idea.c index 0f411c532..449a3e4d0 100644 --- a/wolfcrypt/src/idea.c +++ b/wolfcrypt/src/idea.c @@ -48,17 +48,20 @@ static INLINE word16 idea_mult(word16 x, word16 y) { long mul, res; - mul = x * y; + mul = (long)x * (long)y; if (mul) { res = (mul & IDEA_MASK) - (mul >> 16); - return (word16) ((res <=0 ? res+IDEA_MODULO : res) & IDEA_MASK); + if (res <= 0) + res += IDEA_MODULO; + + return (word16) (res & IDEA_MASK); } if (!x) - return (IDEA_MODULO - y); + return ((IDEA_MODULO - y) & IDEA_MASK); /* !y */ - return (IDEA_MODULO - x); + return ((IDEA_MODULO - x) & IDEA_MASK); } /* compute 1/a modulo 2^16+1 using Extended euclidean algorithm @@ -98,10 +101,10 @@ static INLINE word16 idea_invmod(word16 x) v -= u; d -= b; } - } while (u); + } while (u != 0); /* d is now the inverse, put positive value if required */ - if (d < 0) + while (d < 0) d += IDEA_MODULO; return (word16)(d & IDEA_MASK); From f450ac068414a30258158bbd6863449626f6ecfb Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Sat, 26 Sep 2015 08:03:49 +0900 Subject: [PATCH 08/77] settings.h: GenSeed for test only option --- wolfcrypt/src/random.c | 2 +- wolfssl/wolfcrypt/settings.h | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 53aa093c7..61e5faab9 100644 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -102,7 +102,7 @@ int wc_RNG_GenerateByte(WC_RNG* rng, byte* b) #include #else #if !defined(NO_DEV_RANDOM) && !defined(CUSTOM_RAND_GENERATE) && \ - !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM) + !defined(WOLFSSL_GENSEED_FORTEST) && !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM) #include #ifndef EBSNET #include diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 5800918ad..726bb117c 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -57,7 +57,7 @@ /* Uncomment next line if using FreeRTOS */ /* #define FREERTOS */ -/* Uncomment next line if using FreeRTOS-Plus TCP */ +/* Uncomment next line if using FreeRTOS+ TCP */ /* #define FREERTOS_TCP */ /* Uncomment next line if using FreeRTOS Windows Simulator */ @@ -416,10 +416,7 @@ static char *fgets(char *buff, int sz, FILE *fp) #define XFREE(p, h, type) vPortFree((p)) #endif -#define CUSTOM_RAND_GENERATE testRandGen /* for test use only */ -static int testRandGen(void) { - return 0; -} +#define WOLFSSL_GENSEED_FORTEST #define NO_WOLFSSL_DIR #define NO_WRITEV From 0a530c1b70d609a4a7834b1946837b4058353e9c Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Sat, 26 Sep 2015 08:49:03 +0900 Subject: [PATCH 09/77] #pragma worning for Visual Studio --- wolfcrypt/src/random.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 61e5faab9..7ba6069b6 100644 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -1185,7 +1185,11 @@ int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) || defined(WOLFSSL_uITRON4) || defined(WOLFSSL_uTKERNEL2)\ || defined(WOLFSSL_GENSEED_FORTEST) +#ifndef _MSC_VER #warning "write a real random seed!!!!, just for testing now" +#else +#pragma message("Warning: write a real random seed!!!!, just for testing now") +#endif int wc_GenerateSeed(OS_Seed* os, byte* output, word32 sz) { From c7193672a5fd798286c4e9e79e19f7af17bc8b6f Mon Sep 17 00:00:00 2001 From: Ludovic FLAMENT Date: Sun, 27 Sep 2015 15:05:01 +0200 Subject: [PATCH 10/77] fix IDEA modular inverse, add CBC tests with random values --- wolfcrypt/src/idea.c | 3 ++ wolfcrypt/test/test.c | 68 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+) diff --git a/wolfcrypt/src/idea.c b/wolfcrypt/src/idea.c index 449a3e4d0..5c28d0ca6 100644 --- a/wolfcrypt/src/idea.c +++ b/wolfcrypt/src/idea.c @@ -107,6 +107,9 @@ static INLINE word16 idea_invmod(word16 x) while (d < 0) d += IDEA_MODULO; + /* d must be < IDEA_MODULO */ + d %= IDEA_MODULO; + return (word16)(d & IDEA_MASK); } diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 5a234c4bb..503107bc1 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -3358,6 +3358,74 @@ int idea_test(void) return -1; } } + + /* random test for CBC */ + { + WC_RNG rng; + byte key[IDEA_KEY_SIZE], iv[IDEA_BLOCK_SIZE], + rnd[1000], enc[1000], dec[1000]; + + /* random values */ + ret = wc_InitRng(&rng); + if (ret != 0) + return -39; + + for (i = 0; i < 1000; i++) { + /* random key */ + ret = wc_RNG_GenerateBlock(&rng, key, sizeof(key)); + if (ret != 0) + return -40; + + /* random iv */ + ret = wc_RNG_GenerateBlock(&rng, iv, sizeof(iv)); + if (ret != 0) + return -40; + + /* random data */ + ret = wc_RNG_GenerateBlock(&rng, rnd, sizeof(rnd)); + if (ret != 0) + return -41; + + /* Set encryption key */ + memset(&idea, 0, sizeof(Idea)); + ret = wc_IdeaSetKey(&idea, key, IDEA_KEY_SIZE, iv, IDEA_ENCRYPTION); + if (ret != 0) { + printf("wc_IdeaSetKey (enc) failed\n"); + return -42; + } + + /* Data encryption */ + memset(enc, 0, sizeof(enc)); + ret = wc_IdeaCbcEncrypt(&idea, enc, rnd, sizeof(rnd)); + if (ret != 0) { + printf("wc_IdeaCbcEncrypt failed\n"); + return -43; + } + + /* Set decryption key */ + memset(&idea, 0, sizeof(Idea)); + ret = wc_IdeaSetKey(&idea, key, IDEA_KEY_SIZE, iv, IDEA_DECRYPTION); + if (ret != 0) { + printf("wc_IdeaSetKey (enc) failed\n"); + return -44; + } + + /* Data decryption */ + memset(dec, 0, sizeof(dec)); + ret = wc_IdeaCbcDecrypt(&idea, dec, enc, sizeof(enc)); + if (ret != 0) { + printf("wc_IdeaCbcDecrypt failed\n"); + return -45; + } + + if (XMEMCMP(rnd, dec, sizeof(rnd))) { + printf("Bad CBC decryption\n"); + return -46; + } + } + + wc_FreeRng(&rng); + } return 0; } From a8b5c57dd2be6bdea699e026eb72ea9dfd86d407 Mon Sep 17 00:00:00 2001 From: toddouska Date: Mon, 28 Sep 2015 09:47:59 -0700 Subject: [PATCH 11/77] make sure external tests have a valid cipher --- examples/client/client.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/client/client.c b/examples/client/client.c index 0dd4190b0..e4f815102 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -508,6 +508,11 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) } #endif + #if !defined(HAVE_AESGCM) && defined(NO_AES) && \ + !(defined(HAVE_CHACHA) && defined(HAVE_POLY1305)) + done = 1; /* need at least on of these for external tests */ + #endif + if (done) { printf("external test can't be run in this mode"); From 292e05dc751d5202dc78dd41a89ee836b80cf2c1 Mon Sep 17 00:00:00 2001 From: toddouska Date: Mon, 28 Sep 2015 11:37:00 -0700 Subject: [PATCH 12/77] switch memset / memcpy to XMEM in src and wolfcrypt/src proper --- src/ssl.c | 30 +++++++++++++++--------------- wolfcrypt/src/asn.c | 2 +- wolfcrypt/src/camellia.c | 10 +++++----- wolfcrypt/src/idea.c | 2 +- wolfcrypt/src/wc_port.c | 4 ++-- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index 6edbdb791..bb2bd9276 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -8549,7 +8549,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl) case AES_192_CBC_TYPE : case AES_256_CBC_TYPE : WOLFSSL_MSG("AES CBC"); - memcpy(ctx->iv, &ctx->cipher.aes.reg, AES_BLOCK_SIZE); + XMEMCPY(ctx->iv, &ctx->cipher.aes.reg, AES_BLOCK_SIZE); break; #ifdef WOLFSSL_AES_COUNTER @@ -8557,7 +8557,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl) case AES_192_CTR_TYPE : case AES_256_CTR_TYPE : WOLFSSL_MSG("AES CTR"); - memcpy(ctx->iv, &ctx->cipher.aes.reg, AES_BLOCK_SIZE); + XMEMCPY(ctx->iv, &ctx->cipher.aes.reg, AES_BLOCK_SIZE); break; #endif /* WOLFSSL_AES_COUNTER */ @@ -8566,19 +8566,19 @@ int wolfSSL_set_compression(WOLFSSL* ssl) #ifndef NO_DES3 case DES_CBC_TYPE : WOLFSSL_MSG("DES CBC"); - memcpy(ctx->iv, &ctx->cipher.des.reg, DES_BLOCK_SIZE); + XMEMCPY(ctx->iv, &ctx->cipher.des.reg, DES_BLOCK_SIZE); break; case DES_EDE3_CBC_TYPE : WOLFSSL_MSG("DES EDE3 CBC"); - memcpy(ctx->iv, &ctx->cipher.des3.reg, DES_BLOCK_SIZE); + XMEMCPY(ctx->iv, &ctx->cipher.des3.reg, DES_BLOCK_SIZE); break; #endif #ifdef HAVE_IDEA case IDEA_CBC_TYPE : WOLFSSL_MSG("IDEA CBC"); - memcpy(ctx->iv, &ctx->cipher.idea.reg, IDEA_BLOCK_SIZE); + XMEMCPY(ctx->iv, &ctx->cipher.idea.reg, IDEA_BLOCK_SIZE); break; #endif case ARC4_TYPE : @@ -8616,7 +8616,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl) case AES_192_CBC_TYPE : case AES_256_CBC_TYPE : WOLFSSL_MSG("AES CBC"); - memcpy(&ctx->cipher.aes.reg, ctx->iv, AES_BLOCK_SIZE); + XMEMCPY(&ctx->cipher.aes.reg, ctx->iv, AES_BLOCK_SIZE); break; #ifdef WOLFSSL_AES_COUNTER @@ -8624,7 +8624,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl) case AES_192_CTR_TYPE : case AES_256_CTR_TYPE : WOLFSSL_MSG("AES CTR"); - memcpy(&ctx->cipher.aes.reg, ctx->iv, AES_BLOCK_SIZE); + XMEMCPY(&ctx->cipher.aes.reg, ctx->iv, AES_BLOCK_SIZE); break; #endif @@ -8633,19 +8633,19 @@ int wolfSSL_set_compression(WOLFSSL* ssl) #ifndef NO_DES3 case DES_CBC_TYPE : WOLFSSL_MSG("DES CBC"); - memcpy(&ctx->cipher.des.reg, ctx->iv, DES_BLOCK_SIZE); + XMEMCPY(&ctx->cipher.des.reg, ctx->iv, DES_BLOCK_SIZE); break; case DES_EDE3_CBC_TYPE : WOLFSSL_MSG("DES EDE3 CBC"); - memcpy(&ctx->cipher.des3.reg, ctx->iv, DES_BLOCK_SIZE); + XMEMCPY(&ctx->cipher.des3.reg, ctx->iv, DES_BLOCK_SIZE); break; #endif #ifdef HAVE_IDEA case IDEA_CBC_TYPE : WOLFSSL_MSG("IDEA CBC"); - memcpy(&ctx->cipher.idea.reg, ctx->iv, IDEA_BLOCK_SIZE); + XMEMCPY(&ctx->cipher.idea.reg, ctx->iv, IDEA_BLOCK_SIZE); break; #endif case ARC4_TYPE : @@ -13500,7 +13500,7 @@ void wolfSSL_3des_iv(WOLFSSL_EVP_CIPHER_CTX* ctx, int doset, if (doset) wc_Des3_SetIV(&ctx->cipher.des3, iv); /* OpenSSL compat, no ret */ else - memcpy(iv, &ctx->cipher.des3.reg, DES_BLOCK_SIZE); + XMEMCPY(iv, &ctx->cipher.des3.reg, DES_BLOCK_SIZE); } #endif /* NO_DES3 */ @@ -13523,7 +13523,7 @@ void wolfSSL_aes_ctr_iv(WOLFSSL_EVP_CIPHER_CTX* ctx, int doset, if (doset) wc_AesSetIV(&ctx->cipher.aes, iv); /* OpenSSL compat, no ret */ else - memcpy(iv, &ctx->cipher.aes.reg, AES_BLOCK_SIZE); + XMEMCPY(iv, &ctx->cipher.aes.reg, AES_BLOCK_SIZE); } #endif /* NO_AES */ @@ -13832,7 +13832,7 @@ int wolfSSL_PEM_write_mem_RSAPrivateKey(RSA* rsa, const EVP_CIPHER* cipher, XMEMSET(*pem, 0, (*plen)+1); if (XMEMCPY(*pem, tmp, *plen) == NULL) { - WOLFSSL_MSG("memcpy failed"); + WOLFSSL_MSG("XMEMCPY failed"); XFREE(pem, NULL, DYNAMIC_TYPE_OUT_BUFFER); XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER); return SSL_FAILURE; @@ -15210,7 +15210,7 @@ int wolfSSL_PEM_write_mem_ECPrivateKey(WOLFSSL_EC_KEY* ecc, XMEMSET(*pem, 0, (*plen)+1); if (XMEMCPY(*pem, tmp, *plen) == NULL) { - WOLFSSL_MSG("memcpy failed"); + WOLFSSL_MSG("XMEMCPY failed"); XFREE(pem, NULL, DYNAMIC_TYPE_OUT_BUFFER); XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER); return SSL_FAILURE; @@ -15385,7 +15385,7 @@ int wolfSSL_PEM_write_mem_DSAPrivateKey(WOLFSSL_DSA* dsa, XMEMSET(*pem, 0, (*plen)+1); if (XMEMCPY(*pem, tmp, *plen) == NULL) { - WOLFSSL_MSG("memcpy failed"); + WOLFSSL_MSG("XMEMCPY failed"); XFREE(pem, NULL, DYNAMIC_TYPE_OUT_BUFFER); XFREE(tmp, NULL, DYNAMIC_TYPE_TMP_BUFFER); return SSL_FAILURE; diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index a1a42e12d..0b41d5d58 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -6218,7 +6218,7 @@ static int SetCertificatePolicies(byte *output, for (i = 0; i < nb_certpol; i++) { oidSz = sizeof(oid); - memset(oid, 0, oidSz); + XMEMSET(oid, 0, oidSz); ret = EncodePolicyOID(oid, &oidSz, input[i]); if (ret != 0) diff --git a/wolfcrypt/src/camellia.c b/wolfcrypt/src/camellia.c index 071019c6c..7d4caed92 100644 --- a/wolfcrypt/src/camellia.c +++ b/wolfcrypt/src/camellia.c @@ -1029,13 +1029,13 @@ static int camellia_setup192(const unsigned char *key, u32 *subkey) unsigned char kk[32]; u32 krll, krlr, krrl,krrr; - memcpy(kk, key, 24); - memcpy((unsigned char *)&krll, key+16,4); - memcpy((unsigned char *)&krlr, key+20,4); + XMEMCPY(kk, key, 24); + XMEMCPY((unsigned char *)&krll, key+16,4); + XMEMCPY((unsigned char *)&krlr, key+20,4); krrl = ~krll; krrr = ~krlr; - memcpy(kk+24, (unsigned char *)&krrl, 4); - memcpy(kk+28, (unsigned char *)&krrr, 4); + XMEMCPY(kk+24, (unsigned char *)&krrl, 4); + XMEMCPY(kk+28, (unsigned char *)&krrr, 4); return camellia_setup256(kk, subkey); } diff --git a/wolfcrypt/src/idea.c b/wolfcrypt/src/idea.c index 8762bfc29..f7284c8ee 100644 --- a/wolfcrypt/src/idea.c +++ b/wolfcrypt/src/idea.c @@ -141,7 +141,7 @@ int wc_IdeaSetKey(Idea *idea, const byte* key, word16 keySz, word16 enckey[IDEA_SK_NUM]; /* put encryption key in tmp buffer */ - memcpy(enckey, idea->skey, sizeof(idea->skey)); + XMEMCPY(enckey, idea->skey, sizeof(idea->skey)); idx = 0; diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index 775195c55..dbbea9d06 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -461,7 +461,7 @@ int UnLockMutex(wolfSSL_Mutex *m) if(p) { ercd = get_mpl(ID_wolfssl_MPOOL, sz, (VP)&newp); if (ercd == E_OK) { - memcpy(newp, p, sz) ; + XMEMCPY(newp, p, sz) ; ercd = rel_mpl(ID_wolfssl_MPOOL, (VP)p); if (ercd == E_OK) { return newp; @@ -552,7 +552,7 @@ int UnLockMutex(wolfSSL_Mutex *m) if(p) { ercd = tk_get_mpl(ID_wolfssl_MPOOL, sz, (VP)&newp, TMO_FEVR); if (ercd == E_OK) { - memcpy(newp, p, sz) ; + XMEMCPY(newp, p, sz) ; ercd = tk_rel_mpl(ID_wolfssl_MPOOL, (VP)p); if (ercd == E_OK) { return newp; From 28912621ec3e6c8988cd4b66f85f3affed472b15 Mon Sep 17 00:00:00 2001 From: toddouska Date: Mon, 28 Sep 2015 15:24:32 -0700 Subject: [PATCH 13/77] switch idea invmod too big to subtraction --- wolfcrypt/src/idea.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wolfcrypt/src/idea.c b/wolfcrypt/src/idea.c index f7284c8ee..d7ab766d7 100644 --- a/wolfcrypt/src/idea.c +++ b/wolfcrypt/src/idea.c @@ -106,7 +106,8 @@ static INLINE word16 idea_invmod(word16 x) d += IDEA_MODULO; /* d must be < IDEA_MODULO */ - d %= IDEA_MODULO; + while (d >= (int)IDEA_MODULO) + d -= IDEA_MODULO; return (word16)(d & IDEA_MASK); } From 3c2712da312fa13d23ecb1f838abc7e6da44cfba Mon Sep 17 00:00:00 2001 From: lchristina26 Date: Tue, 29 Sep 2015 12:12:35 -0600 Subject: [PATCH 14/77] vxworks compatibility additions --- src/io.c | 3 +++ wolfssl/test.h | 18 +++++++++++++++++- wolfssl/wolfcrypt/types.h | 6 +++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/io.c b/src/io.c index e296a2ed9..5ca5ce103 100644 --- a/src/io.c +++ b/src/io.c @@ -79,6 +79,9 @@ #include #elif defined(WOLFSSL_IAR_ARM) /* nothing */ + #elif defined(WOLFSSL_VXWORKS) + #include + #include #else #include #include diff --git a/wolfssl/test.h b/wolfssl/test.h index add257133..d247f7c73 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -49,6 +49,19 @@ char **h_addr_list; /* list of addresses from name server */ }; #define SOCKET_T int +#elif defined(WOLFSSL_VXWORKS) + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #define SOCKET_T int #else #include #include @@ -419,6 +432,8 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer, struct hostent* entry = gethostbyname(peer, &err); #elif defined(WOLFSSL_TIRTOS) struct hostent* entry = DNSGetHostByName(peer); + #elif defined(WOLFSSL_VXWORKS) + struct hostent* entry = (struct hostent*)hostGetByName(peer); #else struct hostent* entry = gethostbyname(peer); #endif @@ -774,7 +789,8 @@ static INLINE void tcp_set_nonblocking(SOCKET_T* sockfd) int ret = ioctlsocket(*sockfd, FIONBIO, &blocking); if (ret == SOCKET_ERROR) err_sys("ioctlsocket failed"); - #elif defined(WOLFSSL_MDK_ARM) || defined (WOLFSSL_TIRTOS) + #elif defined(WOLFSSL_MDK_ARM) || defined (WOLFSSL_TIRTOS) \ + || defined(WOLFSSL_VXWORKS) /* non blocking not suppported, for now */ #else int flags = fcntl(*sockfd, F_GETFL, 0); diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index dfe15d488..a4f10ffd7 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -111,7 +111,11 @@ #ifdef _MSC_VER #define INLINE __inline #elif defined(__GNUC__) - #define INLINE inline + #ifdef WOLFSSL_VXWORKS + #define INLINE __inline__ + #else + #define INLINE inline + #endif #elif defined(__IAR_SYSTEMS_ICC__) #define INLINE inline #elif defined(THREADX) From 7c9490844a54c787ccb09296863104d0a153c774 Mon Sep 17 00:00:00 2001 From: lchristina26 Date: Tue, 29 Sep 2015 12:22:03 -0600 Subject: [PATCH 15/77] fix formatting for vxworks commits --- src/io.c | 6 +++--- wolfssl/wolfcrypt/types.h | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/io.c b/src/io.c index 5ca5ce103..9752bcd80 100644 --- a/src/io.c +++ b/src/io.c @@ -79,9 +79,9 @@ #include #elif defined(WOLFSSL_IAR_ARM) /* nothing */ - #elif defined(WOLFSSL_VXWORKS) - #include - #include + #elif defined(WOLFSSL_VXWORKS) + #include + #include #else #include #include diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index a4f10ffd7..b9c721fbf 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -111,11 +111,11 @@ #ifdef _MSC_VER #define INLINE __inline #elif defined(__GNUC__) - #ifdef WOLFSSL_VXWORKS - #define INLINE __inline__ - #else - #define INLINE inline - #endif + #ifdef WOLFSSL_VXWORKS + #define INLINE __inline__ + #else + #define INLINE inline + #endif #elif defined(__IAR_SYSTEMS_ICC__) #define INLINE inline #elif defined(THREADX) From 208f0eeb8e9844e6c55b04b9efa3ba49319aa952 Mon Sep 17 00:00:00 2001 From: toddouska Date: Tue, 29 Sep 2015 11:48:46 -0700 Subject: [PATCH 16/77] fix trailing whitespace --- wolfssl/wolfcrypt/types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h index 8b3b743f3..55969ee23 100644 --- a/wolfssl/wolfcrypt/types.h +++ b/wolfssl/wolfcrypt/types.h @@ -112,7 +112,7 @@ #define INLINE __inline #elif defined(__GNUC__) #ifdef WOLFSSL_VXWORKS - #define INLINE __inline__ + #define INLINE __inline__ #else #define INLINE inline #endif From 46cd3a915bbe0b669531fe595d58e3107687ecd0 Mon Sep 17 00:00:00 2001 From: lchristina26 Date: Tue, 29 Sep 2015 12:49:24 -0600 Subject: [PATCH 17/77] VxWorks README --- IDE/WORKBENCH/README.md | 67 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 IDE/WORKBENCH/README.md diff --git a/IDE/WORKBENCH/README.md b/IDE/WORKBENCH/README.md new file mode 100644 index 000000000..066e2f3e6 --- /dev/null +++ b/IDE/WORKBENCH/README.md @@ -0,0 +1,67 @@ +## Wind River Workbench using VxWorks with wolfSSL +###SETUP: +####Steps (There is many ways to set this up, this is one example) +1. Open WorkBench and go to File > Import > Existing Projects Into Workspace +2. Make sure the correct path to wolfSSL header files(wolfssl/wolfssl) is +selected by right clicking the project and going to Properties > Build +Properties > Paths. If you need to change this to a different path, do so now. +3. Right click on the project and go to Import > Filesystem. Choose your path +to the wolfSSL library here. Uncheck everything except the src and wolfcrypt +directories. Only keep wolfcrypt/test/test.h, not test.c. Also uncheck test +and benchmark directories and aes\_asm.asm and aes\_asm.s files from wolfcrypt/src. +4. In wolfSSL/test.h, make sure certs are in the proper directory, or move. +5. The wolfcrypt source files, namely misc.c, may need to be moved directly under +a wolfcrypt folder within the project. It will be \/wolfcrypt/src/misc.c. +Alnternatively, add wolfssl to the include path, #include +\. +6. Make sure TFM\_X86 is undefined. +####Necessary Files +You will need the following files to replicate this build: +* vxsim\_linux\_1\_0\_2\_2 (directory) +* Includes + * compilers/gnu-4.8.1.5/include/c++/4.8 + * compilers/gnu-4.8.1.5/include/c++/4.8/i586-wrs-vxworks + * compilers/gnu-4.8.1.5/lib/gcc/i586-wrs-vxworks/4.8.1/include + * compilers/gnu-4.8.1.5/lib/gcc/i586-wrs-vxworks/4.8.1/include-fixed + * vsb\_vxsim\_linux/share/h + * vsb\_vxsim\_linux/krnl/h/system + * vsb\_vxsim\_linux/krnl/h/public + * vsb\_vxsim\_linux/krnl/configlette + * vsb\_vxsim\_linux/h +* usrAppInit.c (should be created when you create a new VxWorks image) + * Include this at the top: + #include + #include + #include /* name change portability layer */ + #include + extern int benchmark_test(void* args); + extern THREAD\_RETURN WOLFSSL\_THREAD client\_test(void* args); + extern THREAD\_RETURN WOLFSSL\_THREAD server\_test(void* args); + * Inside main function UsrAppInit (void): + func\_args args = { 0 }; + tcp\_ready ready; + InitTcpReady(&ready); + args.signal = &ready; + benchmark\_test(NULL); + wolfcrypt\_test(NULL); + /* client\_test(NULL); */ + /*server\_test(&args);*/ +* usrRtpAppInit.c (should be created when you create a new VxWorks image) + Leave unchanged +* This project was tested with a pre-built image in the VxWorks distribution +called vsb\_vxsim\_linux. $(VSB\_DIR) line in the .wpj file may need to be +changed according to the VxWorks package being used. + +###VXWORKS SIMULATOR: +In "Open Connection Details" under VxWorks Simulator which is in the connections +dropdown. Choose IDE/WORKBENCH/wolfssl-vxworks-image/default/vxWorks as the +kernel image after building the project. Select simnetd from the dropdown and +enter 192.168.200.1 as the IP address. + +To connect to a server running on the VxWorks Simulator, enter these commands +into the host terminal (for Ubuntu 14.04): + sudo openvpn --mktun --dev tap0 +In Wind River directory: + vxworks-7/host/x86-linux2/bin/vxsimnetd +This will start the vxsimnetd application. Leave it open. The IP address to +connect to the server is the same as above. From 389bbc94ebb433edd8f7c67c68860914b2cccc8b Mon Sep 17 00:00:00 2001 From: Leah Date: Tue, 29 Sep 2015 12:51:03 -0600 Subject: [PATCH 18/77] Update README.md --- IDE/WORKBENCH/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/IDE/WORKBENCH/README.md b/IDE/WORKBENCH/README.md index 066e2f3e6..7e7f3e54c 100644 --- a/IDE/WORKBENCH/README.md +++ b/IDE/WORKBENCH/README.md @@ -1,6 +1,6 @@ ## Wind River Workbench using VxWorks with wolfSSL ###SETUP: -####Steps (There is many ways to set this up, this is one example) +####Steps (There are many ways to set this up, this is one example) 1. Open WorkBench and go to File > Import > Existing Projects Into Workspace 2. Make sure the correct path to wolfSSL header files(wolfssl/wolfssl) is selected by right clicking the project and going to Properties > Build @@ -15,6 +15,7 @@ a wolfcrypt folder within the project. It will be \/wolfcryp Alnternatively, add wolfssl to the include path, #include \. 6. Make sure TFM\_X86 is undefined. + ####Necessary Files You will need the following files to replicate this build: * vxsim\_linux\_1\_0\_2\_2 (directory) From 914ed31ff2c7553e3e665a419ab355882deab0af Mon Sep 17 00:00:00 2001 From: Leah Date: Tue, 29 Sep 2015 12:53:10 -0600 Subject: [PATCH 19/77] Update README.md --- IDE/WORKBENCH/README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/IDE/WORKBENCH/README.md b/IDE/WORKBENCH/README.md index 7e7f3e54c..a84731677 100644 --- a/IDE/WORKBENCH/README.md +++ b/IDE/WORKBENCH/README.md @@ -50,14 +50,12 @@ You will need the following files to replicate this build: * usrRtpAppInit.c (should be created when you create a new VxWorks image) Leave unchanged * This project was tested with a pre-built image in the VxWorks distribution -called vsb\_vxsim\_linux. $(VSB\_DIR) line in the .wpj file may need to be +called vsb\_vxsim\_linux. \ \$(VSB\_DIR) line in the .wpj file may need to be changed according to the VxWorks package being used. ###VXWORKS SIMULATOR: In "Open Connection Details" under VxWorks Simulator which is in the connections -dropdown. Choose IDE/WORKBENCH/wolfssl-vxworks-image/default/vxWorks as the -kernel image after building the project. Select simnetd from the dropdown and -enter 192.168.200.1 as the IP address. +dropdown. After the project has been build, choose the corresponding kernel image, typically called project/default/VxWorks. Select simnetd from the dropdown and enter 192.168.200.1 as the IP address. To connect to a server running on the VxWorks Simulator, enter these commands into the host terminal (for Ubuntu 14.04): From 350fe922b942aac473f66c8d2d44f0975d4d7a73 Mon Sep 17 00:00:00 2001 From: Leah Date: Tue, 29 Sep 2015 12:53:43 -0600 Subject: [PATCH 20/77] Update README.md --- IDE/WORKBENCH/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IDE/WORKBENCH/README.md b/IDE/WORKBENCH/README.md index a84731677..486b90b04 100644 --- a/IDE/WORKBENCH/README.md +++ b/IDE/WORKBENCH/README.md @@ -50,7 +50,7 @@ You will need the following files to replicate this build: * usrRtpAppInit.c (should be created when you create a new VxWorks image) Leave unchanged * This project was tested with a pre-built image in the VxWorks distribution -called vsb\_vxsim\_linux. \ \$(VSB\_DIR) line in the .wpj file may need to be +called vsb\_vxsim\_linux. \ $(VSB\_DIR) line in the .wpj file may need to be changed according to the VxWorks package being used. ###VXWORKS SIMULATOR: From 3d110516f42f99151dce26391171be3e9a887242 Mon Sep 17 00:00:00 2001 From: toddouska Date: Tue, 29 Sep 2015 11:57:52 -0700 Subject: [PATCH 21/77] fixup WORKBENCH autoconf --- IDE/WORKBENCH/include.am | 5 +++++ IDE/include.am | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 IDE/WORKBENCH/include.am diff --git a/IDE/WORKBENCH/include.am b/IDE/WORKBENCH/include.am new file mode 100644 index 000000000..58c00922a --- /dev/null +++ b/IDE/WORKBENCH/include.am @@ -0,0 +1,5 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + +EXTRA_DIST+= IDE/WORKBENCH/README.md diff --git a/IDE/include.am b/IDE/include.am index 7fe6e6a60..f6caad332 100644 --- a/IDE/include.am +++ b/IDE/include.am @@ -2,7 +2,8 @@ # included from Top Level Makefile.am # All paths should be given relative to the root -include IDE/WIN/include.am include IDE/iOS/include.am +include IDE/WIN/include.am +include IDE/WORKBENCH/include.am EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL From dd262fe9396ae1f1023f5c5eacd3a3d41a0f3524 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Thu, 1 Oct 2015 17:42:03 -0600 Subject: [PATCH 22/77] fix on AES CCM nonce size --- wolfcrypt/src/aes.c | 40 ++++++++++++++++++++++++++++++++++------ 1 file changed, 34 insertions(+), 6 deletions(-) diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 9382edaf9..02558fc6b 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -3565,9 +3565,20 @@ void wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, byte B[AES_BLOCK_SIZE]; byte lenSz; word32 i; + byte mask = 0xFF; + word32 wordSz = (word32)sizeof(word32); #ifdef FREESCALE_MMCAU - byte* key = (byte*)aes->key; + byte* key; + #endif + + /* sanity check on arugments */ + if (aes == NULL || out == NULL || in == NULL || nonce == NULL + || authTag == NULL || nonceSz < 7 || nonceSz > 13) + return; + + #ifdef FREESCALE_MMCAU + key = (byte*)aes->key; #endif XMEMCPY(B+1, nonce, nonceSz); @@ -3575,8 +3586,11 @@ void wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, B[0] = (authInSz > 0 ? 64 : 0) + (8 * (((byte)authTagSz - 2) / 2)) + (lenSz - 1); - for (i = 0; i < lenSz; i++) - B[AES_BLOCK_SIZE - 1 - i] = (inSz >> (8 * i)) & 0xFF; + for (i = 0; i < lenSz; i++) { + if (mask && i >= wordSz) + mask = 0x00; + B[AES_BLOCK_SIZE - 1 - i] = (inSz >> ((8 * i) & mask)) & mask; + } #ifdef FREESCALE_MMCAU cau_aes_encrypt(B, key, aes->rounds, A); @@ -3640,9 +3654,20 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz, byte lenSz; word32 i, oSz; int result = 0; + byte mask = 0xFF; + word32 wordSz = (word32)sizeof(word32); #ifdef FREESCALE_MMCAU - byte* key = (byte*)aes->key; + byte* key; + #endif + + /* sanity check on arugments */ + if (aes == NULL || out == NULL || in == NULL || nonce == NULL + || authTag == NULL || nonceSz < 7 || nonceSz > 13) + return BAD_FUNC_ARG; + + #ifdef FREESCALE_MMCAU + key = (byte*)aes->key; #endif o = out; @@ -3693,8 +3718,11 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz, B[0] = (authInSz > 0 ? 64 : 0) + (8 * (((byte)authTagSz - 2) / 2)) + (lenSz - 1); - for (i = 0; i < lenSz; i++) - B[AES_BLOCK_SIZE - 1 - i] = (inSz >> (8 * i)) & 0xFF; + for (i = 0; i < lenSz; i++) { + if (mask && i >= wordSz) + mask = 0x00; + B[AES_BLOCK_SIZE - 1 - i] = (inSz >> ((8 * i) & mask)) & mask; + } #ifdef FREESCALE_MMCAU cau_aes_encrypt(B, key, aes->rounds, A); From 67e08e48c51ade64c865531649297bc08daf4b7c Mon Sep 17 00:00:00 2001 From: kaleb-himes Date: Fri, 2 Oct 2015 10:56:19 -0600 Subject: [PATCH 23/77] Github Issue #130 (XMALLOC_USER, NO_WOLFSSL_MEMORY) with FREERTOS --- wolfssl/wolfcrypt/settings.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 726bb117c..431c70d7d 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -381,9 +381,13 @@ static char *fgets(char *buff, int sz, FILE *fp) #ifdef FREERTOS #include "FreeRTOS.h" + /* FreeRTOS pvPortRealloc() only in AVR32_UC3 port */ - #define XMALLOC(s, h, type) pvPortMalloc((s)) - #define XFREE(p, h, type) vPortFree((p)) + #if !defined(XMALLOC_USER) && !defined(NO_WOLFSSL_MEMORY) + #define XMALLOC(s, h, type) pvPortMalloc((s)) + #define XFREE(p, h, type) vPortFree((p)) + #endif + #ifndef NO_WRITEV #define NO_WRITEV #endif From 10276944d3245ea495676c757ecd70d521601937 Mon Sep 17 00:00:00 2001 From: Jacob Barthelmeh Date: Fri, 2 Oct 2015 11:40:47 -0600 Subject: [PATCH 24/77] return value on AES CCM encrypt --- src/internal.c | 4 +++- wolfcrypt/src/aes.c | 15 ++++++++++++--- wolfcrypt/src/port/ti/ti-aes.c | 4 ++-- wolfcrypt/test/test.c | 4 +++- wolfssl/wolfcrypt/aes.h | 2 +- 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/internal.c b/src/internal.c index 9c574a50c..bda99c84a 100644 --- a/src/internal.c +++ b/src/internal.c @@ -5895,13 +5895,15 @@ static INLINE int Encrypt(WOLFSSL* ssl, byte* out, const byte* input, word16 sz) ssl->keys.aead_enc_imp_IV, AEAD_IMP_IV_SZ); XMEMCPY(nonce + AEAD_IMP_IV_SZ, ssl->keys.aead_exp_IV, AEAD_EXP_IV_SZ); - wc_AesCcmEncrypt(ssl->encrypt.aes, + ret = wc_AesCcmEncrypt(ssl->encrypt.aes, out + AEAD_EXP_IV_SZ, input + AEAD_EXP_IV_SZ, sz - AEAD_EXP_IV_SZ - ssl->specs.aead_mac_size, nonce, AEAD_NONCE_SZ, out + sz - ssl->specs.aead_mac_size, ssl->specs.aead_mac_size, additional, AEAD_AUTH_DATA_SZ); + if (ret != 0) + return ret; AeadIncrementExpIV(ssl); ForceZero(nonce, AEAD_NONCE_SZ); } diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 02558fc6b..9487132d0 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -134,13 +134,19 @@ void wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz) } -void wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, +int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, const byte* nonce, word32 nonceSz, byte* authTag, word32 authTagSz, const byte* authIn, word32 authInSz) { + /* sanity check on arugments */ + if (aes == NULL || out == NULL || in == NULL || nonce == NULL + || authTag == NULL || nonceSz < 7 || nonceSz > 13) + return BAD_FUNC_ARG; + AesCcmEncrypt(aes, out, in, inSz, nonce, nonceSz, authTag, authTagSz, authIn, authInSz); + return 0; } @@ -3556,7 +3562,8 @@ static INLINE void AesCcmCtrInc(byte* B, word32 lenSz) } -void wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, +/* return 0 on success */ +int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, const byte* nonce, word32 nonceSz, byte* authTag, word32 authTagSz, const byte* authIn, word32 authInSz) @@ -3575,7 +3582,7 @@ void wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, /* sanity check on arugments */ if (aes == NULL || out == NULL || in == NULL || nonce == NULL || authTag == NULL || nonceSz < 7 || nonceSz > 13) - return; + return BAD_FUNC_ARG; #ifdef FREESCALE_MMCAU key = (byte*)aes->key; @@ -3640,6 +3647,8 @@ void wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, ForceZero(A, AES_BLOCK_SIZE); ForceZero(B, AES_BLOCK_SIZE); + + return 0; } diff --git a/wolfcrypt/src/port/ti/ti-aes.c b/wolfcrypt/src/port/ti/ti-aes.c index 91d11a590..857f9c4d7 100644 --- a/wolfcrypt/src/port/ti/ti-aes.c +++ b/wolfcrypt/src/port/ti/ti-aes.c @@ -522,12 +522,12 @@ WOLFSSL_API void wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz) AesAuthSetKey(aes, key, keySz) ; } -WOLFSSL_API void wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, +WOLFSSL_API int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, const byte* nonce, word32 nonceSz, byte* authTag, word32 authTagSz, const byte* authIn, word32 authInSz) { - AesAuthEncrypt(aes, out, in, inSz, nonce, nonceSz, authTag, authTagSz, + return AesAuthEncrypt(aes, out, in, inSz, nonce, nonceSz, authTag, authTagSz, authIn, authInSz, AES_CFG_MODE_CCM) ; } diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index 503107bc1..e3e89a73e 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -2955,8 +2955,10 @@ int aesccm_test(void) wc_AesCcmSetKey(&enc, k, sizeof(k)); /* AES-CCM encrypt and decrypt both use AES encrypt internally */ - wc_AesCcmEncrypt(&enc, c2, p, sizeof(c2), iv, sizeof(iv), + result = wc_AesCcmEncrypt(&enc, c2, p, sizeof(c2), iv, sizeof(iv), t2, sizeof(t2), a, sizeof(a)); + if (result != 0) + return -106; if (memcmp(c, c2, sizeof(c2))) return -107; if (memcmp(t, t2, sizeof(t2))) diff --git a/wolfssl/wolfcrypt/aes.h b/wolfssl/wolfcrypt/aes.h index 29e18f088..480412a21 100644 --- a/wolfssl/wolfcrypt/aes.h +++ b/wolfssl/wolfcrypt/aes.h @@ -166,7 +166,7 @@ WOLFSSL_API int wc_AesCbcDecrypt(Aes* aes, byte* out, #endif /* HAVE_AESGCM */ #ifdef HAVE_AESCCM WOLFSSL_API void wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz); - WOLFSSL_API void wc_AesCcmEncrypt(Aes* aes, byte* out, + WOLFSSL_API int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, const byte* nonce, word32 nonceSz, byte* authTag, word32 authTagSz, From 27450aca7d51adaac40978db276c61028e275280 Mon Sep 17 00:00:00 2001 From: toddouska Date: Fri, 2 Oct 2015 11:24:32 -0700 Subject: [PATCH 25/77] increment explicit iv and zero nonce even on GCM/CCM failure --- src/internal.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/internal.c b/src/internal.c index bda99c84a..9321a840e 100644 --- a/src/internal.c +++ b/src/internal.c @@ -5857,8 +5857,7 @@ static INLINE int Encrypt(WOLFSSL* ssl, byte* out, const byte* input, word16 sz) out + sz - ssl->specs.aead_mac_size, ssl->specs.aead_mac_size, additional, AEAD_AUTH_DATA_SZ); - if (ret == 0) - AeadIncrementExpIV(ssl); + AeadIncrementExpIV(ssl); ForceZero(nonce, AEAD_NONCE_SZ); } break; @@ -5902,8 +5901,6 @@ static INLINE int Encrypt(WOLFSSL* ssl, byte* out, const byte* input, word16 sz) out + sz - ssl->specs.aead_mac_size, ssl->specs.aead_mac_size, additional, AEAD_AUTH_DATA_SZ); - if (ret != 0) - return ret; AeadIncrementExpIV(ssl); ForceZero(nonce, AEAD_NONCE_SZ); } From 1237b35bb82bb446c7ccff2bf6434079a6e262bb Mon Sep 17 00:00:00 2001 From: John Safranek Date: Fri, 2 Oct 2015 11:26:45 -0700 Subject: [PATCH 26/77] add option to sniffer to try to restart decoding after an ACK fault --- src/sniffer.c | 186 ++++++++++++++++++++++++-- sslSniffer/sslSnifferTest/snifftest.c | 1 + wolfssl/sniffer_error.h | 2 + wolfssl/sniffer_error.rc | 2 + 4 files changed, 181 insertions(+), 10 deletions(-) diff --git a/src/sniffer.c b/src/sniffer.c index 8f6942673..ba59a7fb7 100644 --- a/src/sniffer.c +++ b/src/sniffer.c @@ -244,7 +244,9 @@ static const char* const msgTable[] = /* 76 */ "Get Session Stats Failure", - "Reassembly Buffer Size Exceeded" + "Reassembly Buffer Size Exceeded", + "Dropping Lost Fragment", + "Clear ACK Fault" }; @@ -316,6 +318,10 @@ typedef struct Flags { byte clientHello; /* processed client hello yet, for SSLv2 */ byte finCount; /* get both FINs before removing */ byte fatalError; /* fatal error state */ + byte cliAckFault; /* client acked unseen data from server */ + byte srvAckFault; /* server acked unseen data from client */ + byte cliSkipPartial; /* client skips partial data to catch up */ + byte srvSkipPartial; /* server skips partial data to catch up */ } Flags; @@ -546,6 +552,10 @@ static void InitFlags(Flags* flags) flags->clientHello = 0; flags->finCount = 0; flags->fatalError = 0; + flags->cliAckFault = 0; + flags->srvAckFault = 0; + flags->cliSkipPartial = 0; + flags->srvSkipPartial = 0; } @@ -2457,6 +2467,9 @@ static int AdjustSequence(TcpInfo* tcpInfo, SnifferSession* session, &session->cliExpected : &session->srvExpected; PacketBuffer* reassemblyList = (session->flags.side == WOLFSSL_SERVER_END) ? session->cliReassemblyList : session->srvReassemblyList; + byte skipPartial = (session->flags.side == WOLFSSL_SERVER_END) ? + session->flags.srvSkipPartial : + session->flags.cliSkipPartial; /* handle rollover of sequence */ if (tcpInfo->sequence < seqStart) @@ -2502,9 +2515,16 @@ static int AdjustSequence(TcpInfo* tcpInfo, SnifferSession* session, } else if (real > *expected) { Trace(OUT_OF_ORDER_STR); - if (*sslBytes > 0) - return AddToReassembly(session->flags.side, real, *sslFrame, - *sslBytes, session, error); + if (*sslBytes > 0) { + int addResult = AddToReassembly(session->flags.side, real, + *sslFrame, *sslBytes, session, error); + if (skipPartial) { + *sslBytes = 0; + return 0; + } + else + return addResult; + } else if (tcpInfo->fin) return AddFinCapture(session, real); } @@ -2512,7 +2532,16 @@ static int AdjustSequence(TcpInfo* tcpInfo, SnifferSession* session, /* The following conditional block is duplicated above. It is the * same action but for a different setup case. If changing this * block be sure to also update the block above. */ - if (reassemblyList) { + if (skipPartial) { + AddToReassembly(session->flags.side, real, + *sslFrame, *sslBytes, session, error); + *expected += *sslBytes; + *sslBytes = 0; + if (tcpInfo->fin) + *expected += 1; + return 0; + } + else if (reassemblyList) { word32 newEnd = *expected + *sslBytes; if (newEnd > reassemblyList->begin) { @@ -2541,6 +2570,112 @@ static int AdjustSequence(TcpInfo* tcpInfo, SnifferSession* session, } +static int FindNextRecordInAssembly(SnifferSession* session, + const byte** sslFrame, int* sslBytes, + const byte** end, char* error) +{ + PacketBuffer** front = (session->flags.side == WOLFSSL_SERVER_END) ? + &session->cliReassemblyList : + &session->srvReassemblyList; + PacketBuffer* curr = *front; + PacketBuffer* prev = NULL; + byte* skipPartial = (session->flags.side == WOLFSSL_SERVER_END) ? + &session->flags.srvSkipPartial : + &session->flags.cliSkipPartial; + word32* reassemblyMemory = (session->flags.side == WOLFSSL_SERVER_END) ? + &session->cliReassemblyMemory : + &session->srvReassemblyMemory; + SSL* ssl = (session->flags.side == WOLFSSL_SERVER_END) ? + session->sslServer : + session->sslClient; + ProtocolVersion pv = ssl->version; + word32* expected = (session->flags.side == WOLFSSL_SERVER_END) ? + &session->cliExpected : + &session->srvExpected; + + while (curr != NULL) { + *expected = curr->end + 1; + + if (curr->data[0] == application_data && + curr->data[1] == pv.major && + curr->data[2] == pv.minor) { + + word32 length; + + *sslBytes = curr->end - curr->begin + 1; + length = ssl->buffers.inputBuffer.length; + if ( (word32)*sslBytes > ssl->buffers.inputBuffer.bufferSize) { + if (GrowInputBuffer(ssl, *sslBytes, length) < 0) { + SetError(MEMORY_STR, error, session, FATAL_ERROR_STATE); + return -1; + } + } + + XMEMCPY(&ssl->buffers.inputBuffer.buffer[length], + curr->data, *sslBytes); + + *front = curr->next; + *reassemblyMemory -= *sslBytes; + FreePacketBuffer(curr); + + *sslBytes += length; + ssl->buffers.inputBuffer.length = *sslBytes; + *sslFrame = ssl->buffers.inputBuffer.buffer; + *end = *sslFrame + *sslBytes; + *skipPartial = 0; + + return 0; + } + else if (ssl->specs.cipher_type == block) { + if (ssl->specs.bulk_cipher_algorithm == wolfssl_aes) + wc_AesSetIV(ssl->decrypt.aes, + curr->data + curr->end - curr->begin + - ssl->specs.block_size + 1); + else if (ssl->specs.bulk_cipher_algorithm == wolfssl_triple_des) + wc_Des3_SetIV(ssl->decrypt.des3, + curr->data + curr->end - curr->begin + - ssl->specs.block_size + 1); + } + + Trace(DROPPING_LOST_FRAG_STR); + prev = curr; + curr = curr->next; + *reassemblyMemory -= (prev->end - prev->begin + 1); + FreePacketBuffer(prev); + } + + *front = curr; + + return 0; +} + + +static int FixSequence(TcpInfo* tcpInfo, SnifferSession* session) +{ + word32* expected = (session->flags.side == WOLFSSL_SERVER_END) ? + &session->srvExpected : &session->cliExpected; + PacketBuffer* list = (session->flags.side == WOLFSSL_SERVER_END) ? + session->srvReassemblyList : + session->cliReassemblyList; + byte* skipPartial = (session->flags.side != WOLFSSL_SERVER_END) ? + &session->flags.srvSkipPartial : + &session->flags.cliSkipPartial; + + *skipPartial = 1; + if (list != NULL) + *expected = list->begin; + else { + word32 seqStart = (session->flags.side == WOLFSSL_SERVER_END) ? + session->srvSeqStart : session->cliSeqStart; + word32 real = tcpInfo->ackNumber - seqStart; + + *expected = real; + } + + return 1; +} + + /* Check latest ack number for missing packets return 0 ok, <0 on error */ static int CheckAck(TcpInfo* tcpInfo, SnifferSession* session) @@ -2572,7 +2707,10 @@ static int CheckSequence(IpInfo* ipInfo, TcpInfo* tcpInfo, const byte** sslFrame, char* error) { int actualLen; - + byte* ackFault = (session->flags.side == WOLFSSL_SERVER_END) ? + &session->flags.cliAckFault : + &session->flags.srvAckFault; + /* init SEQ from server to client */ if (tcpInfo->syn && tcpInfo->ack) { session->srvSeqStart = tcpInfo->sequence; @@ -2589,11 +2727,26 @@ static int CheckSequence(IpInfo* ipInfo, TcpInfo* tcpInfo, TraceSequence(tcpInfo->sequence, *sslBytes); if (CheckAck(tcpInfo, session) < 0) { - UpdateMissedDataSessions(); - SetError(ACK_MISSED_STR, error, session, FATAL_ERROR_STATE); - return -1; + if (!RecoveryEnabled) { + UpdateMissedDataSessions(); + SetError(ACK_MISSED_STR, error, session, FATAL_ERROR_STATE); + return -1; + } + else { + SetError(ACK_MISSED_STR, error, session, 0); + if (*ackFault == 0) { + *ackFault = 1; + UpdateMissedDataSessions(); + } + return FixSequence(tcpInfo, session); + } } + if (*ackFault) { + Trace(CLEAR_ACK_FAULT); + *ackFault = 0; + } + return AdjustSequence(tcpInfo, session, sslBytes, sslFrame, error); } @@ -2607,6 +2760,9 @@ static int CheckPreRecord(IpInfo* ipInfo, TcpInfo* tcpInfo, word32 length; SSL* ssl = ((*session)->flags.side == WOLFSSL_SERVER_END) ? (*session)->sslServer : (*session)->sslClient; + byte skipPartial = ((*session)->flags.side == WOLFSSL_SERVER_END) ? + (*session)->flags.srvSkipPartial : + (*session)->flags.cliSkipPartial; /* remove SnifferSession on 2nd FIN or RST */ if (tcpInfo->fin || tcpInfo->rst) { /* flag FIN and RST */ @@ -2627,13 +2783,22 @@ static int CheckPreRecord(IpInfo* ipInfo, TcpInfo* tcpInfo, return -1; } + if (skipPartial) { + if (FindNextRecordInAssembly(*session, + sslFrame, sslBytes, end, error) < 0) { + return -1; + } + } + if (*sslBytes == 0) { Trace(NO_DATA_STR); return 1; } /* if current partial data, add to end of partial */ - if ( (length = ssl->buffers.inputBuffer.length) ) { + /* if skipping, the data is alread at the end of partial */ + if ( !skipPartial && + (length = ssl->buffers.inputBuffer.length) ) { Trace(PARTIAL_ADD_STR); if ( (*sslBytes + length) > ssl->buffers.inputBuffer.bufferSize) { @@ -2878,6 +3043,7 @@ doPart: } } else { + printf("JOHN: ret = %d\n", ret); SetError(BAD_APP_DATA_STR, error,session,FATAL_ERROR_STATE); return -1; } diff --git a/sslSniffer/sslSnifferTest/snifftest.c b/sslSniffer/sslSnifferTest/snifftest.c index 155a14954..0a21e3958 100755 --- a/sslSniffer/sslSnifferTest/snifftest.c +++ b/sslSniffer/sslSnifferTest/snifftest.c @@ -143,6 +143,7 @@ int main(int argc, char** argv) ssl_InitSniffer(); /* dll load on Windows */ #endif ssl_Trace("./tracefile.txt", err); + ssl_EnableRecovery(1, -1, err); if (argc == 1) { /* normal case, user chooses device and port */ diff --git a/wolfssl/sniffer_error.h b/wolfssl/sniffer_error.h index 2277c32bf..e96ad18dd 100644 --- a/wolfssl/sniffer_error.h +++ b/wolfssl/sniffer_error.h @@ -111,6 +111,8 @@ #define BAD_SESSION_STATS 76 #define REASSEMBLY_MAX_STR 77 +#define DROPPING_LOST_FRAG_STR 78 +#define CLEAR_ACK_FAULT 79 /* !!!! also add to msgTable in sniffer.c and .rc file !!!! */ diff --git a/wolfssl/sniffer_error.rc b/wolfssl/sniffer_error.rc index bba88271b..1a0a87ba9 100644 --- a/wolfssl/sniffer_error.rc +++ b/wolfssl/sniffer_error.rc @@ -93,5 +93,7 @@ STRINGTABLE 76, "Get Session Stats Failure" 77, "Reassembly Buffer Size Exceeded" + 78, "Dropping Lost Fragment" + 79, "Clear ACK Fault" } From 9fe5401630671c6683df9d28100a20c7d38dca55 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Fri, 2 Oct 2015 15:13:02 -0700 Subject: [PATCH 27/77] sniffer skips partially received record when fixing an ACK fault --- src/sniffer.c | 19 +++++++++---------- wolfssl/sniffer_error.h | 3 ++- wolfssl/sniffer_error.rc | 3 ++- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/sniffer.c b/src/sniffer.c index ba59a7fb7..9fa0bff7a 100644 --- a/src/sniffer.c +++ b/src/sniffer.c @@ -246,6 +246,7 @@ static const char* const msgTable[] = "Get Session Stats Failure", "Reassembly Buffer Size Exceeded", "Dropping Lost Fragment", + "Dropping Partial Record", "Clear ACK Fault" }; @@ -2528,10 +2529,7 @@ static int AdjustSequence(TcpInfo* tcpInfo, SnifferSession* session, else if (tcpInfo->fin) return AddFinCapture(session, real); } - else { - /* The following conditional block is duplicated above. It is the - * same action but for a different setup case. If changing this - * block be sure to also update the block above. */ + else if (*sslBytes > 0) { if (skipPartial) { AddToReassembly(session->flags.side, real, *sslFrame, *sslBytes, session, error); @@ -2541,6 +2539,9 @@ static int AdjustSequence(TcpInfo* tcpInfo, SnifferSession* session, *expected += 1; return 0; } + /* The following conditional block is duplicated above. It is the + * same action but for a different setup case. If changing this + * block be sure to also update the block above. */ else if (reassemblyList) { word32 newEnd = *expected + *sslBytes; @@ -2600,25 +2601,23 @@ static int FindNextRecordInAssembly(SnifferSession* session, curr->data[1] == pv.major && curr->data[2] == pv.minor) { - word32 length; + if (ssl->buffers.inputBuffer.length > 0) + Trace(DROPPING_PARTIAL_RECORD); *sslBytes = curr->end - curr->begin + 1; - length = ssl->buffers.inputBuffer.length; if ( (word32)*sslBytes > ssl->buffers.inputBuffer.bufferSize) { - if (GrowInputBuffer(ssl, *sslBytes, length) < 0) { + if (GrowInputBuffer(ssl, *sslBytes, 0) < 0) { SetError(MEMORY_STR, error, session, FATAL_ERROR_STATE); return -1; } } - XMEMCPY(&ssl->buffers.inputBuffer.buffer[length], - curr->data, *sslBytes); + XMEMCPY(ssl->buffers.inputBuffer.buffer, curr->data, *sslBytes); *front = curr->next; *reassemblyMemory -= *sslBytes; FreePacketBuffer(curr); - *sslBytes += length; ssl->buffers.inputBuffer.length = *sslBytes; *sslFrame = ssl->buffers.inputBuffer.buffer; *end = *sslFrame + *sslBytes; diff --git a/wolfssl/sniffer_error.h b/wolfssl/sniffer_error.h index e96ad18dd..53acf6a10 100644 --- a/wolfssl/sniffer_error.h +++ b/wolfssl/sniffer_error.h @@ -112,7 +112,8 @@ #define BAD_SESSION_STATS 76 #define REASSEMBLY_MAX_STR 77 #define DROPPING_LOST_FRAG_STR 78 -#define CLEAR_ACK_FAULT 79 +#define DROPPING_PARTIAL_RECORD 79 +#define CLEAR_ACK_FAULT 80 /* !!!! also add to msgTable in sniffer.c and .rc file !!!! */ diff --git a/wolfssl/sniffer_error.rc b/wolfssl/sniffer_error.rc index 1a0a87ba9..40bfac84a 100644 --- a/wolfssl/sniffer_error.rc +++ b/wolfssl/sniffer_error.rc @@ -94,6 +94,7 @@ STRINGTABLE 76, "Get Session Stats Failure" 77, "Reassembly Buffer Size Exceeded" 78, "Dropping Lost Fragment" - 79, "Clear ACK Fault" + 79, "Dropping Partial Record" + 80, "Clear ACK Fault" } From ad51d4ba096a55ac09af8c81b85660a40db730ae Mon Sep 17 00:00:00 2001 From: toddouska Date: Mon, 28 Sep 2015 15:56:27 -0700 Subject: [PATCH 28/77] make sure fast invmod lowers result in too big case --- wolfcrypt/src/integer.c | 6 ++++++ wolfcrypt/src/tfm.c | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/wolfcrypt/src/integer.c b/wolfcrypt/src/integer.c index 49b3fe195..fa967a6ef 100644 --- a/wolfcrypt/src/integer.c +++ b/wolfcrypt/src/integer.c @@ -989,6 +989,12 @@ top: goto LBL_ERR; } } + /* too big */ + while (mp_cmp_mag(&D, b) != MP_LT) { + if ((res = mp_sub(&D, b, &D)) != MP_OKAY) { + goto LBL_ERR; + } + } mp_exch (&D, c); c->sign = neg; res = MP_OKAY; diff --git a/wolfcrypt/src/tfm.c b/wolfcrypt/src/tfm.c index 18de2e6d3..6963ed022 100644 --- a/wolfcrypt/src/tfm.c +++ b/wolfcrypt/src/tfm.c @@ -950,6 +950,10 @@ top: while (D.sign == FP_NEG) { fp_add (&D, b, &D); } + /* too big */ + while (fp_cmp_mag(&D, b) != FP_LT) { + fp_sub(&D, b, &D); + } fp_copy (&D, c); c->sign = neg; return FP_OKAY; From 0f6f4049386f246f4df19774c200cb12b689ca60 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Fri, 2 Oct 2015 15:55:40 -0700 Subject: [PATCH 29/77] delete debugging breadcrumb --- src/sniffer.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sniffer.c b/src/sniffer.c index 9fa0bff7a..7428feab2 100644 --- a/src/sniffer.c +++ b/src/sniffer.c @@ -3042,7 +3042,6 @@ doPart: } } else { - printf("JOHN: ret = %d\n", ret); SetError(BAD_APP_DATA_STR, error,session,FATAL_ERROR_STATE); return -1; } From b1c5f3b299020d1783cf688a03a83e3cb08d99e6 Mon Sep 17 00:00:00 2001 From: toddouska Date: Fri, 2 Oct 2015 16:25:17 -0700 Subject: [PATCH 30/77] add show every cipher suite to examples/client --- examples/client/client.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/examples/client/client.c b/examples/client/client.c index e4f815102..b37fd4cd3 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -117,6 +117,17 @@ static void NonBlockingSSL_Connect(WOLFSSL* ssl) } +static void ShowCiphers(void) +{ + char ciphers[4096]; + + int ret = wolfSSL_get_ciphers(ciphers, (int)sizeof(ciphers)); + + if (ret == SSL_SUCCESS) + printf("%s\n", ciphers); +} + + static void Usage(void) { printf("client " LIBWOLFSSL_VERSION_STRING @@ -139,6 +150,7 @@ static void Usage(void) printf("-t Track wolfSSL memory use\n"); printf("-d Disable peer checks\n"); printf("-D Override Date Errors example\n"); + printf("-e List Every cipher suite available, \n"); printf("-g Send server HTTP GET\n"); printf("-u Use UDP DTLS," " add -v 2 for DTLSv1 (default), -v 3 for DTLSv1.2\n"); @@ -281,7 +293,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) StackTrap(); while ((ch = mygetopt(argc, argv, - "?gdDusmNrwRitfxXUPCh:p:v:l:A:c:k:Z:b:zS:L:ToO:a")) + "?gdeDusmNrwRitfxXUPCh:p:v:l:A:c:k:Z:b:zS:L:ToO:a")) != -1) { switch (ch) { case '?' : @@ -296,6 +308,10 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) doPeerCheck = 0; break; + case 'e' : + ShowCiphers(); + exit(EXIT_SUCCESS); + case 'D' : overrideDateErrors = 1; break; From f06c08718c0e2cca0cfb12082d09b0a4c50669c7 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Mon, 5 Oct 2015 10:14:07 -0700 Subject: [PATCH 31/77] bump version for sniffer release --- README | 21 ++++++++++++++++++++- README.md | 20 ++++++++++++++++++++ configure.ac | 2 +- support/wolfssl.pc | 2 +- wolfssl/version.h | 4 ++-- 5 files changed, 44 insertions(+), 5 deletions(-) diff --git a/README b/README index ea646a390..9cfcbf97d 100644 --- a/README +++ b/README @@ -32,7 +32,26 @@ before calling wolfSSL_new(); Though it's not recommended. *** end Notes *** -wolfSSL (Formerly CyaSSL) Release 3.6.8 (09/17/2015) +wolfSSL (Formerly CyaSSL) Release 3.6.9 (10/05/2015) + +Release 3.6.9 of wolfSSL has bug fixes and new features including: + +- New option for the sniffer where it will try to pick up decoding after a + sequence number acknowldgement fault. Also includes some additional stats. +- AES-GCM/CCM fixes. +- FreeRTOS support updates. +- VXWorks support updates. +- Added the IDEA cipher and support in wolfSSL. +- Update wolfSSL website CA. +- CFLAGS is usable when configuring source. + +- No high level security fixes that requires an update though we always + recommend updating to the latest + +See INSTALL file for build instructions. +More info can be found on-line at //http://wolfssl.com/yaSSL/Docs.html + + ********* wolfSSL (Formerly CyaSSL) Release 3.6.8 (09/17/2015) Release 3.6.8 of wolfSSL fixes two high severity vulnerabilities. It also includes bug fixes and new features including: diff --git a/README.md b/README.md index 5fe25e3c1..38f1bc112 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,26 @@ before calling wolfSSL_new(); Though it's not recommended. ``` +# wolfSSL (Formerly CyaSSL) Release 3.6.9 (10/05/2015) + +##Release 3.6.9 of wolfSSL has bug fixes and new features including: + +- New option for the sniffer where it will try to pick up decoding after a + sequence number acknowldgement fault. Also includes some additional stats. +- AES-GCM/CCM fixes. +- FreeRTOS support updates. +- VXWorks support updates. +- Added the IDEA cipher and support in wolfSSL. +- Update wolfSSL website CA. +- CFLAGS is usable when configuring source. + +- No high level security fixes that requires an update though we always + recommend updating to the latest + +See INSTALL file for build instructions. +More info can be found on-line at //http://wolfssl.com/yaSSL/Docs.html + + #wolfSSL (Formerly CyaSSL) Release 3.6.8 (09/17/2015) ##Release 3.6.8 of wolfSSL fixes two high severity vulnerabilities. diff --git a/configure.ac b/configure.ac index a239a89de..bbf5205f9 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ # # -AC_INIT([wolfssl],[3.6.8],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[http://www.wolfssl.com]) +AC_INIT([wolfssl],[3.6.9],[https://github.com/wolfssl/wolfssl/issues],[wolfssl],[http://www.wolfssl.com]) AC_CONFIG_AUX_DIR([build-aux]) diff --git a/support/wolfssl.pc b/support/wolfssl.pc index 761b674ca..7116f5acf 100644 --- a/support/wolfssl.pc +++ b/support/wolfssl.pc @@ -5,6 +5,6 @@ includedir=${prefix}/include Name: wolfssl Description: wolfssl C library. -Version: 3.6.8 +Version: 3.6.9 Libs: -L${libdir} -lwolfssl Cflags: -I${includedir} diff --git a/wolfssl/version.h b/wolfssl/version.h index c0b1a99fa..b8aa49372 100644 --- a/wolfssl/version.h +++ b/wolfssl/version.h @@ -26,8 +26,8 @@ extern "C" { #endif -#define LIBWOLFSSL_VERSION_STRING "3.6.8" -#define LIBWOLFSSL_VERSION_HEX 0x03006008 +#define LIBWOLFSSL_VERSION_STRING "3.6.9" +#define LIBWOLFSSL_VERSION_HEX 0x03006009 #ifdef __cplusplus } From d6a5bfb53dd96c3f691ebdfbedeed989ad6b079e Mon Sep 17 00:00:00 2001 From: John Safranek Date: Mon, 5 Oct 2015 15:31:39 -0700 Subject: [PATCH 32/77] Revert "revert defragment of handshake messages in TLS" This reverts commit 6d21d328fb2e7e2c2b3e93bc521b4af111830c64. --- src/internal.c | 63 ++++++++++++++++++++++++++++++++++++++++++---- wolfssl/internal.h | 3 +++ 2 files changed, 61 insertions(+), 5 deletions(-) diff --git a/src/internal.c b/src/internal.c index 9321a840e..09c6d23f7 100644 --- a/src/internal.c +++ b/src/internal.c @@ -1956,6 +1956,10 @@ void FreeArrays(WOLFSSL* ssl, int keep) XMEMCPY(ssl->session.sessionID, ssl->arrays->sessionID, ID_LEN); ssl->session.sessionIDSz = ssl->arrays->sessionIDSz; } + if (ssl->arrays) { + XFREE(ssl->arrays->pendingMsg, ssl->heap, DYNAMIC_TYPE_ARRAYS); + ssl->arrays->pendingMsg = NULL; + } XFREE(ssl->arrays, ssl->heap, DYNAMIC_TYPE_CERT); ssl->arrays = NULL; } @@ -5259,16 +5263,65 @@ static int DoHandShakeMsgType(WOLFSSL* ssl, byte* input, word32* inOutIdx, static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx, word32 totalSz) { - byte type; - word32 size; int ret = 0; WOLFSSL_ENTER("DoHandShakeMsg()"); - if (GetHandShakeHeader(ssl, input, inOutIdx, &type, &size, totalSz) != 0) - return PARSE_ERROR; + /* If there is a pending fragmented handshake message, pending message size + * will be non-zero. */ + if (ssl->arrays->pendingMsgSz == 0) { + byte type; + word32 size; - ret = DoHandShakeMsgType(ssl, input, inOutIdx, type, size, totalSz); + if (GetHandShakeHeader(ssl,input, inOutIdx, &type, &size, totalSz) != 0) + return PARSE_ERROR; + + /* size is the size of the certificate message payload */ + if (totalSz - HANDSHAKE_HEADER_SZ < size) { + ssl->arrays->pendingMsgType = type; + ssl->arrays->pendingMsgSz = size + HANDSHAKE_HEADER_SZ; + ssl->arrays->pendingMsg = (byte*)XMALLOC(size + HANDSHAKE_HEADER_SZ, + ssl->heap, + DYNAMIC_TYPE_ARRAYS); + if (ssl->arrays->pendingMsg == NULL) + return MEMORY_E; + XMEMCPY(ssl->arrays->pendingMsg, + input + *inOutIdx - HANDSHAKE_HEADER_SZ, totalSz); + ssl->arrays->pendingMsgOffset = totalSz; + *inOutIdx += totalSz - HANDSHAKE_HEADER_SZ; + return 0; + } + + ret = DoHandShakeMsgType(ssl, input, inOutIdx, type, size, totalSz); + } + else { + if (totalSz + ssl->arrays->pendingMsgOffset + > ssl->arrays->pendingMsgSz) { + + return BUFFER_ERROR; + } + else { + XMEMCPY(ssl->arrays->pendingMsg + ssl->arrays->pendingMsgOffset, + input + *inOutIdx, totalSz); + ssl->arrays->pendingMsgOffset += totalSz; + *inOutIdx += totalSz; + } + + if (ssl->arrays->pendingMsgOffset == ssl->arrays->pendingMsgSz) + { + word32 idx = 0; + ret = DoHandShakeMsgType(ssl, + ssl->arrays->pendingMsg + + HANDSHAKE_HEADER_SZ, + &idx, ssl->arrays->pendingMsgType, + ssl->arrays->pendingMsgSz + - HANDSHAKE_HEADER_SZ, + ssl->arrays->pendingMsgSz); + XFREE(ssl->arrays->pendingMsg, ssl->heap, DYNAMIC_TYPE_ARRAYS); + ssl->arrays->pendingMsg = NULL; + ssl->arrays->pendingMsgSz = 0; + } + } WOLFSSL_LEAVE("DoHandShakeMsg()", ret); return ret; diff --git a/wolfssl/internal.h b/wolfssl/internal.h index 99831e599..420c0f677 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -2098,7 +2098,10 @@ typedef struct Options { } Options; typedef struct Arrays { + byte* pendingMsg; /* defrag buffer */ word32 preMasterSz; /* differs for DH, actual size */ + word32 pendingMsgSz; /* defrag buffer size */ + word32 pendingMsgOffset; /* current offset into defrag buffer */ #ifndef NO_PSK word32 psk_keySz; /* acutal size */ char client_identity[MAX_PSK_ID_LEN]; From 236df9257bd902e527c29355e11f5908da4e1784 Mon Sep 17 00:00:00 2001 From: toddouska Date: Mon, 5 Oct 2015 12:56:17 -0700 Subject: [PATCH 33/77] add openssl script suite test switch to bash for 'read -ra <<<' for now --- scripts/include.am | 1 + scripts/openssl.test | 120 +++++++++++++++++++++++++++++++++++++++++++ src/ssl.c | 2 + 3 files changed, 123 insertions(+) create mode 100755 scripts/openssl.test diff --git a/scripts/include.am b/scripts/include.am index 4b1b105c5..34a49bbba 100644 --- a/scripts/include.am +++ b/scripts/include.am @@ -10,6 +10,7 @@ endif if BUILD_EXAMPLES dist_noinst_SCRIPTS+= scripts/resume.test +dist_noinst_SCRIPTS+= scripts/openssl.test if BUILD_CRL # make revoked test rely on completion of resume test diff --git a/scripts/openssl.test b/scripts/openssl.test new file mode 100755 index 000000000..7b4dc2da4 --- /dev/null +++ b/scripts/openssl.test @@ -0,0 +1,120 @@ +#!/bin/bash + +#openssl.test + +# need a unique port since may run the same time as testsuite +openssl_port=11114 +no_pid=-1 +server_pid=$no_pid +wolf_suites_tested=0 +wolf_suites_total=0 +counter=0 + +do_cleanup() { + echo "in cleanup" + + if [ $server_pid != $no_pid ] + then + echo "killing server" + kill -9 $server_pid + fi +} + +do_trap() { + echo "got trap" + do_cleanup + exit -1 +} + +trap do_trap INT TERM + +echo -e "\nTesting existence of openssl command...\n" +command -v openssl >/dev/null 2>&1 || { echo >&2 "Requires openssl command, but it's not installed. Ending."; exit 0; } + + +echo -e "\nTesting for _build directory as part of distcheck, different paths" +currentDir=`pwd` +if [ $currentDir == *"_build" ] +then + echo -e "_build directory detected, moving a directory back" + cd .. +fi + +echo -e "\nStarting openssl server...\n" + +openssl s_server -accept $openssl_port -cert ./certs/server-cert.pem -key ./certs/server-key.pem -quiet -www -dhparam ./certs/dh2048.pem -dcert ./certs/server-ecc.pem -dkey ./certs/ecc-key.pem & +server_pid=$! + + +# get openssl ciphers +open_ciphers=`openssl ciphers` +IFS=':' read -ra opensslArray <<< "$open_ciphers" + +# get wolfssl ciphers +wolf_ciphers=`./examples/client/client -e` +IFS=':' read -ra wolfsslArray <<< "$wolf_ciphers" + +# server should be ready, let's make sure +server_ready=0 +while [ "$counter" -lt 20 ]; do + echo -e "waiting for openssl s_server ready..." + nc -z localhost $openssl_port + nc_result=$? + if [ $nc_result == 0 ] + then + echo -e "openssl s_server ready!" + server_ready=1 + break + fi + sleep 0.1 + counter=$((counter+ 1)) +done + + +if [ $server_ready == 0 ] +then + echo -e "Couldn't verify openssl server is running, timeout error" + do_cleanup + exit -1 +fi + +for wolfSuite in "${wolfsslArray[@]}"; do + + echo -e "trying wolfSSL cipher suite $wolfSuite" + matchSuite=0 + wolf_suites_total=$((wolf_suites_total + 1)) + + for openSuite in "${opensslArray[@]}"; do + if [ $openSuite == $wolfSuite ] + then + echo -e "Matched to OpenSSL suite support" + matchSuite=1 + fi + done + + if [ $matchSuite == 0 ] + then + echo -e "Couldn't match suite, continuing..." + continue + fi + + ./examples/client/client -p $openssl_port -g -l $wolfSuite + client_result=$? + + if [ $client_result != 0 ] + then + echo -e "client failed!" + do_cleanup + exit 1 + fi + wolf_suites_tested=$((wolf_suites_tested+1)) + +done + +kill -9 $server_pid + +echo -e "wolfSSL total suites $wolf_suites_total" +echo -e "wolfSSL suites tested $wolf_suites_tested" +echo -e "\nSuccess!\n" + +exit 0 diff --git a/src/ssl.c b/src/ssl.c index bb2bd9276..fdbe8ce5d 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -295,6 +295,8 @@ int wolfSSL_get_ciphers(char* buf, int len) if (i < size - 1) *buf++ = delim; + else + *buf++ = '\0'; } else return BUFFER_E; From 3dda2965bd304f7789deaebcf3cb7e89f0f1c5fd Mon Sep 17 00:00:00 2001 From: toddouska Date: Mon, 5 Oct 2015 15:43:38 -0700 Subject: [PATCH 34/77] fix bash bracket string contains --- scripts/openssl.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/openssl.test b/scripts/openssl.test index 7b4dc2da4..159214881 100755 --- a/scripts/openssl.test +++ b/scripts/openssl.test @@ -34,7 +34,7 @@ command -v openssl >/dev/null 2>&1 || { echo >&2 "Requires openssl command, but echo -e "\nTesting for _build directory as part of distcheck, different paths" currentDir=`pwd` -if [ $currentDir == *"_build" ] +if [[ $currentDir == *"_build" ]] then echo -e "_build directory detected, moving a directory back" cd .. From 16ba3138a14fa5f6e0603538cebf48f93ff103eb Mon Sep 17 00:00:00 2001 From: David Garske Date: Tue, 6 Oct 2015 10:45:46 -0700 Subject: [PATCH 35/77] Added support for the Rowley CrossWorks for ARM IDE. Added new "WOLFSSL_ROWLEY_ARM" setting define. Added a sample solution (wolfssl.hzp) for building the WolfSSL library and sample test/benchmark applications. The sample applications are written for the Freescale Kinetis K64, but easily be customized for any Kinetis or further extended to support other ARM micro-controllers. --- .../Kinetis_FlashPlacement.xml | 29 ++ .../Kinetis_MemoryMap.xml | 11 + IDE/ROWLEY-CROSSWORKS-ARM/README.md | 45 +++ IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c | 198 +++++++++++ IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c | 69 ++++ IDE/ROWLEY-CROSSWORKS-ARM/hw.h | 13 + IDE/ROWLEY-CROSSWORKS-ARM/include.am | 15 + IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c | 213 ++++++++++++ IDE/ROWLEY-CROSSWORKS-ARM/test_main.c | 76 +++++ IDE/ROWLEY-CROSSWORKS-ARM/user_libc.c | 106 ++++++ IDE/ROWLEY-CROSSWORKS-ARM/user_settings.h | 28 ++ IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp | 317 ++++++++++++++++++ wolfcrypt/src/random.c | 3 +- wolfssl/ssl.h | 3 +- wolfssl/test.h | 3 +- wolfssl/wolfcrypt/settings.h | 7 +- 16 files changed, 1131 insertions(+), 5 deletions(-) create mode 100644 IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_FlashPlacement.xml create mode 100644 IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_MemoryMap.xml create mode 100644 IDE/ROWLEY-CROSSWORKS-ARM/README.md create mode 100644 IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c create mode 100644 IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c create mode 100644 IDE/ROWLEY-CROSSWORKS-ARM/hw.h create mode 100644 IDE/ROWLEY-CROSSWORKS-ARM/include.am create mode 100644 IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c create mode 100644 IDE/ROWLEY-CROSSWORKS-ARM/test_main.c create mode 100644 IDE/ROWLEY-CROSSWORKS-ARM/user_libc.c create mode 100644 IDE/ROWLEY-CROSSWORKS-ARM/user_settings.h create mode 100644 IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_FlashPlacement.xml b/IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_FlashPlacement.xml new file mode 100644 index 000000000..0d63056b2 --- /dev/null +++ b/IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_FlashPlacement.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_MemoryMap.xml b/IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_MemoryMap.xml new file mode 100644 index 000000000..562fdb70f --- /dev/null +++ b/IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_MemoryMap.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/README.md b/IDE/ROWLEY-CROSSWORKS-ARM/README.md new file mode 100644 index 000000000..5209dc074 --- /dev/null +++ b/IDE/ROWLEY-CROSSWORKS-ARM/README.md @@ -0,0 +1,45 @@ +# Rowley CrossWorks ARM Project for wolfSSL and wolfCrypt + +This directory contains a CrossWorks solution named wolfssl.hzp. + +Inside are three projects: + +1. libwolfssl: +This generates a library file named "libwolfssl_ARM_Debug/libwolfssl_v7em_t_le_eabi.a" +2. benchmark: +This is a sample benchmark application. It runs the "benchmark_test" suite repeatedly until a failure occurs. +3. test: +This is a sample test application. It runs "wolfcrypt_test" suite suite repeatedly until a failure occurs. + +# Prerequisits + +You will need to install the "Freescale Kinetis CPU Support Package" in the +Rowley Package Manager under Tools -> Pacakge Manager. + +# Harware Support + +All hardware functions are defined in `kinetis_hw.c` and are currently setup for a Freescale Kinetis K64 Coretx-M4 microcontroller. This file can be customized to work with other Kinetis microcontrollers by editing the top part of the file. Testing for this project was done with the Freescale Kinetis `MK64FN1M0xxx12` using the `TWR-K64F120M`. + +To create support for a new ARM microcontroller the functions in `hw.h` will need to be implemented. + +Also you will need to configure the ARM Architecture and ARM Core Type in the "Solution Properties" -> "ARM". +Also the "Target Processor" in each of the projects ("Project Properties" -> "Target Processor") + +## Hardware Crypto Acceleration + +To enable Freescale MMCAU: + +1. [Download the MMCAU library](http://www.freescale.com/products/arm-processors/kinetis-cortex-m/k-series/k7x-glcd-mcus/crypto-acceleration-unit-cau-and-mmcau-software-library:CAUAP). +2. Copy the `lib_mmcau.a` and `cau_api.h` files into the project. +3. Add `-L $(ProjectDir) -l lib_mmcau.a` to project "Additional Linker Options" OR goto "Build Configuration" and check "MMCAU". +4. Enable the "FREESCALE_MMCAU" define in "user_settings.h" and make sure its value is 1. + +# Project Files + +* `arm_startup.c`: Handles startup from `reset_handler`. Disabled watchdog, initializes sections, initializes heap, starts harware and starts main. +* `benchmark_main.c`: The main function entrypoint for benchmark application. +* `hw.h`: The hardware API interface. These hardware interface functions are required for all platforms. +* `kinetis_hw.c`: The most basic hardware implementation required for Kinetis. +* `test_main.c`: The main function entrypoint for test application. +* `user_libc.c`: Defines stubs for functions required by libc. It also wraps hardware functions for UART, RTC and Random Number Generator (RNG). +* `user_settings.h`: This is the custom user configuration file for WolfSSL. diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c b/IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c new file mode 100644 index 000000000..faab65705 --- /dev/null +++ b/IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c @@ -0,0 +1,198 @@ +/* arm_startup.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "hw.h" +#include + +// Memory initialization +extern uint32_t __data_load_start__[]; +extern uint32_t __data_start__[]; +extern uint32_t __data_end__[]; + +extern uint32_t __bss_start__[]; +extern uint32_t __bss_end__[]; + +extern uint32_t __fast_load_start__[]; +extern uint32_t __fast_start__[]; +extern uint32_t __fast_end__[]; + +extern uint32_t __stack_process_end__[]; + +extern uint32_t __heap_start__[]; +extern uint32_t __heap_end__[]; + +// Copy memory: src=Source, dst_beg=Destination Begin, dst_end=Destination End +void memcpy32(uint32_t* src, uint32_t* dst_beg, uint32_t* dst_end) +{ + while (dst_beg < dst_end) { + *dst_beg++ = *src++; + } +} +// Zero address in range +void meminit32(uint32_t* start, uint32_t* end) +{ + while (start < end) { + *start++ = 0; + } +} + +// Entry Point +void reset_handler(void) +{ + // Disable Watchdog + hw_watchdog_disable(); + + // Init sections + memcpy32(__data_load_start__, __data_start__, __data_end__); + meminit32(__bss_start__, __bss_end__); + memcpy32(__fast_load_start__, __fast_start__, __fast_end__); + + // Init heap + __heap_start__[0] = 0; + __heap_start__[1] = ((uint32_t)__heap_end__ - (uint32_t)__heap_start__); + + // Init hardware + hw_init(); + + // Start main + extern void main(void); + main(); + + // Application has ended, so busy wait + while(1); +} + +// Vector Exception/Interrupt Handlers +static void Default_Handler(void) +{ +} + +void HardFault_HandlerC( uint32_t *hardfault_args ) +{ + /* These are volatile to try and prevent the compiler/linker optimizing them + away as the variables never actually get used. If the debugger won't show the + values of the variables, make them global my moving their declaration outside + of this function. */ + volatile uint32_t stacked_r0; + volatile uint32_t stacked_r1; + volatile uint32_t stacked_r2; + volatile uint32_t stacked_r3; + volatile uint32_t stacked_r12; + volatile uint32_t stacked_lr; + volatile uint32_t stacked_pc; + volatile uint32_t stacked_psr; + volatile uint32_t _CFSR; + volatile uint32_t _HFSR; + volatile uint32_t _DFSR; + volatile uint32_t _AFSR; + volatile uint32_t _BFAR; + volatile uint32_t _MMAR; + + stacked_r0 = ((uint32_t)hardfault_args[0]); + stacked_r1 = ((uint32_t)hardfault_args[1]); + stacked_r2 = ((uint32_t)hardfault_args[2]); + stacked_r3 = ((uint32_t)hardfault_args[3]); + stacked_r12 = ((uint32_t)hardfault_args[4]); + stacked_lr = ((uint32_t)hardfault_args[5]); + stacked_pc = ((uint32_t)hardfault_args[6]); + stacked_psr = ((uint32_t)hardfault_args[7]); + + // Configurable Fault Status Register + // Consists of MMSR, BFSR and UFSR + _CFSR = (*((volatile uint32_t *)(0xE000ED28))); + + // Hard Fault Status Register + _HFSR = (*((volatile uint32_t *)(0xE000ED2C))); + + // Debug Fault Status Register + _DFSR = (*((volatile uint32_t *)(0xE000ED30))); + + // Auxiliary Fault Status Register + _AFSR = (*((volatile uint32_t *)(0xE000ED3C))); + + // Read the Fault Address Registers. These may not contain valid values. + // Check BFARVALID/MMARVALID to see if they are valid values + // MemManage Fault Address Register + _MMAR = (*((volatile uint32_t *)(0xE000ED34))); + // Bus Fault Address Register + _BFAR = (*((volatile uint32_t *)(0xE000ED38))); + + printf ("\n\nHard fault handler (all numbers in hex):\n"); + printf ("R0 = %x\n", stacked_r0); + printf ("R1 = %x\n", stacked_r1); + printf ("R2 = %x\n", stacked_r2); + printf ("R3 = %x\n", stacked_r3); + printf ("R12 = %x\n", stacked_r12); + printf ("LR [R14] = %x subroutine call return address\n", stacked_lr); + printf ("PC [R15] = %x program counter\n", stacked_pc); + printf ("PSR = %x\n", stacked_psr); + printf ("CFSR = %x\n", _CFSR); + printf ("HFSR = %x\n", _HFSR); + printf ("DFSR = %x\n", _DFSR); + printf ("AFSR = %x\n", _AFSR); + printf ("MMAR = %x\n", _MMAR); + printf ("BFAR = %x\n", _BFAR); + + // Break into the debugger + __asm("BKPT #0\n"); +} + +__attribute__( ( naked ) ) +void HardFault_Handler(void) +{ + __asm volatile + ( + " tst lr, #4 \n" + " ite eq \n" + " mrseq r0, msp \n" + " mrsne r0, psp \n" + " ldr r1, [r0, #24] \n" + " ldr r2, handler2_address_const \n" + " bx r2 \n" + " handler2_address_const: .word HardFault_HandlerC \n" + ); +} + +// Vectors +typedef void (*vector_entry)(void); +const vector_entry vectors[] __attribute__ ((section(".vectors"),used)) = +{ + /* Interrupt Vector Table Function Pointers */ + // Address Vector IRQ Source module Source description + (vector_entry)__stack_process_end__, // ARM core Initial Supervisor SP + reset_handler, // 0x0000_0004 1 - ARM core Initial Program Counter + Default_Handler, // 0x0000_0008 2 - ARM core Non-maskable Interrupt (NMI) + HardFault_Handler, // 0x0000_000C 3 - ARM core Hard Fault + Default_Handler, // 0x0000_0010 4 - + HardFault_Handler, // 0x0000_0014 5 - ARM core Bus Fault + HardFault_Handler, // 0x0000_0018 6 - ARM core Usage Fault + Default_Handler, // 0x0000_001C 7 - + Default_Handler, // 0x0000_0020 8 - + Default_Handler, // 0x0000_0024 9 - + Default_Handler, // 0x0000_0028 10 - + Default_Handler, // 0x0000_002C 11 - ARM core Supervisor call (SVCall) + Default_Handler, // 0x0000_0030 12 - ARM core Debug Monitor + Default_Handler, // 0x0000_0034 13 - + Default_Handler, // 0x0000_0038 14 - ARM core Pendable request for system service (PendableSrvReq) + Default_Handler, // 0x0000_003C 15 - ARM core System tick timer (SysTick) + + // Add specific driver interrupt handlers below +}; diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c b/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c new file mode 100644 index 000000000..584acf933 --- /dev/null +++ b/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c @@ -0,0 +1,69 @@ +/* benchmark_main.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#ifdef HAVE_CONFIG_H + #include +#endif + +#include +#include + +typedef struct func_args { + int argc; + char** argv; + int return_code; +} func_args; + +static func_args args = { 0 } ; + +extern double current_time(int reset) ; +extern int benchmark_test(void *args) ; + +void main(void) +{ + int test_num = 0; + + do + { + printf("\nBenchmark Test %d:\n", test_num); + benchmark_test(&args); + printf("Benchmark Test %d: Return code %d\n", test_num, args.return_code); + + test_num++; + } while(args.return_code == 0); +} + +/* +SAMPLE OUTPUT: Freescale K64 running at 96MHz with no MMCAU: +Benchmark Test 1: +AES 25 kB took 0.073 seconds, 0.334 MB/s +ARC4 25 kB took 0.033 seconds, 0.740 MB/s +RABBIT 25 kB took 0.027 seconds, 0.904 MB/s +3DES 25 kB took 0.375 seconds, 0.065 MB/s +MD5 25 kB took 0.016 seconds, 1.526 MB/s +SHA 25 kB took 0.044 seconds, 0.555 MB/s +SHA-256 25 kB took 0.119 seconds, 0.205 MB/s +RSA 1024 encryption took 91.000 milliseconds, avg over 1 iterations +RSA 1024 decryption took 573.000 milliseconds, avg over 1 iterations +DH 1024 key generation 253.000 milliseconds, avg over 1 iterations +DH 1024 key agreement 311.000 milliseconds, avg over 1 iterations +Benchmark Test 1: Return code 0 +*/ diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/hw.h b/IDE/ROWLEY-CROSSWORKS-ARM/hw.h new file mode 100644 index 000000000..3a9bea546 --- /dev/null +++ b/IDE/ROWLEY-CROSSWORKS-ARM/hw.h @@ -0,0 +1,13 @@ +#pragma once + +#include <__cross_studio_io.h> +#include <__libc.h> +#include + +// Generic HW API +void hw_init(void); +uint32_t hw_get_time_sec(void); +uint32_t hw_get_time_msec(void); +void hw_uart_printchar(int c); +void hw_watchdog_disable(void); +int hw_rand(void); diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/include.am b/IDE/ROWLEY-CROSSWORKS-ARM/include.am new file mode 100644 index 000000000..2ff200b42 --- /dev/null +++ b/IDE/ROWLEY-CROSSWORKS-ARM/include.am @@ -0,0 +1,15 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + +EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/arm_startup.c +EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c +EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/hw.h +EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c +EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_MemoryMap.xml +EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_FlashPlacement.xml +EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/README.md +EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/test_main.c +EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/user_lib.c +EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/user_settings.h +EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c b/IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c new file mode 100644 index 000000000..f8fe62441 --- /dev/null +++ b/IDE/ROWLEY-CROSSWORKS-ARM/kinetis_hw.c @@ -0,0 +1,213 @@ +/* kinetis_hw.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "hw.h" + +#if defined(FREESCALE) && defined(K_SERIES) + + +/********************************************** + * NOTE: Customize for actual hardware + **********************************************/ + +// CPU include for Rowley CrossWorks packages +// $(TargetsDir) location: +// On Mac OS/X: Users/USERNAME/Library/Rowley Associates Limited/CrossWorks for ARM/packages/targets/ +// On Windows: C:/Users/USERNAME/Application Data/Local/Rowley Associates Limited/CrossWorks for ARM/packages/targets/ +#include // Located in $(TargetsDir)/Kinetis/CMSIS/ + +// System clock +#define SYS_CLK_KHZ 96000ul /* Core system clock in KHz */ +#define SYS_CLK_DRS MCG_C4_DRST_DRS(0x03) /* DRS 0=24MHz, 1=48MHz, 2=72MHz, 3=96MHz */ +#define SYS_CLK_DMX MCG_C4_DMX32_MASK /* 0=Disable DMX32 (lower actual speed), MCG_C4_DMX32_MASK=Enable DMX32 */ +#define SYS_CLK_DIV 1 /* System clock divisor */ +#define BUS_CLK_DIV 2 /* Bus clock divisor */ +#define BUS_CLK_KHZ (SYS_CLK_KHZ/BUS_CLK_DIV) /* Helper to calculate bus speed for UART */ +#define FLASH_CLK_DIV 4 /* Flash clock divisor */ + +// UART TX Port, Pin, Mux and Baud +#define UART_PORT UART5 /* UART Port */ +#define UART_TX_PORT PORTE /* UART TX Port */ +#define UART_TX_PIN 8 /* UART TX Pin */ +#define UART_TX_MUX 0x3 /* Kinetis UART pin mux */ +#define UART_BAUD 115200 /* UART Baud Rate */ +/* Note: You will also need to update the UART clock gate in hw_uart_init (SIM_SCGC1_UART5_MASK) */ +/* Note: TWR-K60 is UART3, PTC17 */ + +/***********************************************/ + +// Private functions +static void hw_mcg_init(void) +{ + /* Adjust clock dividers (core/system=div/1, bus=div/2, flex bus=div/2, flash=div/4) */ + SIM->CLKDIV1 = SIM_CLKDIV1_OUTDIV1(SYS_CLK_DIV-1) | SIM_CLKDIV1_OUTDIV2(BUS_CLK_DIV-1) | + SIM_CLKDIV1_OUTDIV3(BUS_CLK_DIV-1) | SIM_CLKDIV1_OUTDIV4(FLASH_CLK_DIV-1); + + /* Configure FEI internal clock speed */ + MCG->C4 = (SYS_CLK_DMX | SYS_CLK_DRS); + while((MCG->C4 & (MCG_C4_DRST_DRS_MASK | MCG_C4_DMX32_MASK)) != (SYS_CLK_DMX | SYS_CLK_DRS)); +} + +static void hw_gpio_init(void) +{ + /* Enable clocks to all GPIO ports */ + SIM->SCGC5 |= (SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK +#ifdef SIM_SCGC5_PORTC_MASK + | SIM_SCGC5_PORTC_MASK +#endif +#ifdef SIM_SCGC5_PORTD_MASK + | SIM_SCGC5_PORTD_MASK +#endif +#ifdef SIM_SCGC5_PORTE_MASK + | SIM_SCGC5_PORTE_MASK +#endif + ); +} + +static void hw_uart_init(void) +{ + register uint16_t sbr, brfa; + uint8_t temp; + + /* Enable UART core clock */ + SIM->SCGC1 |= SIM_SCGC1_UART5_MASK; + + /* Configure UART TX pin */ + UART_TX_PORT->PCR[UART_TX_PIN] = PORT_PCR_MUX(UART_TX_MUX); + + /* Disable transmitter and receiver while we change settings. */ + UART_PORT->C2 &= ~(UART_C2_TE_MASK | UART_C2_RE_MASK ); + + /* Configure the UART for 8-bit mode, no parity */ + UART_PORT->C1 = 0; + + /* Calculate baud settings */ + sbr = (uint16_t)((BUS_CLK_KHZ * 1000)/(UART_BAUD * 16)); + temp = UART_PORT->BDH & ~(UART_BDH_SBR(0x1F)); + UART_PORT->BDH = temp | UART_BDH_SBR(((sbr & 0x1F00) >> 8)); + UART_PORT->BDL = (uint8_t)(sbr & UART_BDL_SBR_MASK); + + /* Determine if a fractional divider is needed to get closer to the baud rate */ + brfa = (((BUS_CLK_KHZ * 32000)/(UART_BAUD * 16)) - (sbr * 32)); + temp = UART_PORT->C4 & ~(UART_C4_BRFA(0x1F)); + UART_PORT->C4 = temp | UART_C4_BRFA(brfa); + + /* Enable receiver and transmitter */ + UART_PORT->C2 |= (UART_C2_TE_MASK | UART_C2_RE_MASK); +} + +static void hw_rtc_init(void) +{ + /* Enable RTC clock and oscillator */ + SIM->SCGC6 |= SIM_SCGC6_RTC_MASK; + RTC->CR |= RTC_CR_OSCE_MASK; +} + +static void hw_rand_init(void) +{ + /* Enable RNG clocks */ + SIM->SCGC6 |= SIM_SCGC6_RNGA_MASK; + SIM->SCGC3 |= SIM_SCGC3_RNGA_MASK; + + /* Wake up RNG to normal mode (take out of sleep) */ + RNG->CR &= ~RNG_CR_SLP_MASK; + + /* Enable High Assurance mode (Enables notification of security violations via SR[SECV]) */ + RNG->CR |= RNG_CR_HA_MASK; + + /* Enable RNG generation to RANDOUT FIFO */ + RNG->CR |= RNG_CR_GO_MASK; +} + + +/* Public Functions */ +void hw_init(void) +{ + hw_mcg_init(); + hw_gpio_init(); + hw_uart_init(); + hw_rtc_init(); + hw_rand_init(); +} + +uint32_t hw_get_time_sec(void) +{ + /* Return RTC seconds */ + return RTC->TSR; +} + +uint32_t hw_get_time_msec(void) +{ + /* RTC TPR precision register increments every 32.768 kHz clock cycle */ + /* Convert with rounding crystal count (32768 or (1 << 15)) to milliseconds */ + return ( ((uint32_t)RTC->TPR * 1000) + ((1 << 15) / 2) ) / (1 << 15); +} + +void hw_uart_printchar(int c) +{ + while(!(UART_PORT->S1 & UART_S1_TDRE_MASK)); /* Wait until space is available in the FIFO */ + UART_PORT->D = (uint8_t)c; /* Send the character */ +} + +int hw_rand(void) +{ + while((RNG->SR & RNG_SR_OREG_LVL(0xF)) == 0) {}; /* Wait until FIFO has a value available */ + return RNG->OR; /* Return next value in FIFO output register */ +} + +// Watchdog +void hw_watchdog_disable(void) +{ + WDOG->UNLOCK = 0xC520; + WDOG->UNLOCK = 0xD928; + WDOG->STCTRLH = WDOG_STCTRLH_ALLOWUPDATE_MASK; +} + +// Flash configuration +#define FSEC_UNSECURE 2 +#define FSEC_SECURE 0 +#define FSEC_FSLACC_DENIED 2 +#define FSEC_FSLACC_GRANTED 3 +#define FSEC_KEY_ENABLED 2 +#define FSEC_KEY_DISABLED 3 +#define FSEC_MASS_ERASE_DISABLE 2 +#define FSEC_MASS_ERASE_ENABLE 3 + +struct flash_conf { + uint8_t backdoor_key[8]; /* Backdoor Comparison Key */ + uint8_t fprot[4]; /* Program flash protection bytes */ + uint8_t fsec; /* Flash security byte */ + uint8_t fopt; /* Flash nonvolatile option byte */ + uint8_t feprot; /* FlexNVM: EEPROM protection byte */ + uint8_t fdprot; /* FlexNVM: Data flash protection byte */ +}; +const struct flash_conf flash_conf __attribute__ ((section (".flashconf"),used)) = +{ + .backdoor_key = { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }, + .fprot = { 0xFF, 0xFF, 0xFF, 0xFF }, + .fsec = NV_FSEC_SEC(FSEC_UNSECURE) | NV_FSEC_FSLACC(FSEC_FSLACC_GRANTED) | + NV_FSEC_MEEN(FSEC_MASS_ERASE_ENABLE) | NV_FSEC_KEYEN(FSEC_KEY_DISABLED), + .fopt = 0xFF, + .feprot = 0xFF, + .fdprot = 0xFF +}; + +#endif /* FREESCALE && K_SERIES */ diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/test_main.c b/IDE/ROWLEY-CROSSWORKS-ARM/test_main.c new file mode 100644 index 000000000..632adcb98 --- /dev/null +++ b/IDE/ROWLEY-CROSSWORKS-ARM/test_main.c @@ -0,0 +1,76 @@ +/* test_main.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + + +#ifdef HAVE_CONFIG_H + #include +#endif + +#include +#include +#include + +typedef struct func_args { + int argc; + char** argv; + int return_code; +} func_args; + +static func_args args = { 0 } ; + + +void main(void) +{ + int test_num = 0; + + do + { + printf("\nCrypt Test %d:\n", test_num); + wolfcrypt_test(&args); + printf("Crypt Test %d: Return code %d\n", test_num, args.return_code); + + test_num++; + } while(args.return_code == 0); +} + + +/* SAMPLE OUTPUT: +Crypt Test 1: +MD5 test passed! +MD4 test passed! +SHA test passed! +SHA-256 test passed! +HMAC-MD5 test passed! +HMAC-SHA test passed! +HMAC-SHA256 test passed! +ARC4 test passed! +HC-128 test passed! +Rabbit test passed! +DES test passed! +DES3 test passed! +AES test passed! +RANDOM test passed! +RSA test passed! +DH test passed! +DSA test passed! +PWDBASED test passed! +Crypt Test 1: Return code 0 +*/ diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/user_libc.c b/IDE/ROWLEY-CROSSWORKS-ARM/user_libc.c new file mode 100644 index 000000000..562f153c6 --- /dev/null +++ b/IDE/ROWLEY-CROSSWORKS-ARM/user_libc.c @@ -0,0 +1,106 @@ +/* user_libc.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + */ + +#include "hw.h" + +double current_time(int reset) +{ + double time; + time = hw_get_time_sec(); + time += (double)hw_get_time_msec() / 1000; + return time; +} + +int custom_rand_generate(void) +{ + return hw_rand(); +} + +// Debug print handler +int __putchar(int c, __printf_tag_ptr ctx) +{ + hw_uart_printchar(c); +} + + +// Rowley CrossWorks, runtime support. +// +// Copyright (c) 2001-2015 Rowley Associates Limited. +// +// This file may be distributed under the terms of the License Agreement +// provided with this software. +// +// THIS FILE IS PROVIDED AS IS WITH NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. + +#include <__libc.h> + +#if defined(__CROSSWORKS_ARM) || defined(__SES_ARM) + +extern unsigned char __stack_process_start__[]; + +unsigned char * __aeabi_read_tp(void) +{ + // thread-local storage addressing refers to the thread pointer + // This is returning start address of stack process + return (__stack_process_start__); +} + +#elif defined(__CROSSWORKS_AVR) || defined(__CROSSWORKS_MSP430) + +unsigned char * __RAL_read_tp(void) +{ + return 0; +} + +#endif + +void __heap_lock(void) +{ +} + +void __heap_unlock(void) +{ +} + +void __printf_lock(void) +{ +} + +void __printf_unlock(void) +{ +} + +void __scanf_lock(void) +{ +} + +void __scanf_unlock(void) +{ +} + +void __debug_io_lock(void) +{ +} + +void __debug_io_unlock(void) +{ +} diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/user_settings.h b/IDE/ROWLEY-CROSSWORKS-ARM/user_settings.h new file mode 100644 index 000000000..77ae6dbd4 --- /dev/null +++ b/IDE/ROWLEY-CROSSWORKS-ARM/user_settings.h @@ -0,0 +1,28 @@ +/* Configuration */ +#define SINGLE_THREADED +#define WOLFSSL_SMALL_STACK +#define WOLFSSL_GENERAL_ALIGNMENT 4 +#define NO_MAIN_DRIVER +#define NO_FILESYSTEM +#define NO_WRITEV +#define NO_DEV_RANDOM +#define NO_WOLFSSL_MEMORY + +/* HW Crypto Acceleration */ +// See README.md for instructions +//#define FREESCALE_MMCAU 1 + +/* Benchmark */ +#define BENCH_EMBEDDED +#define USE_CERT_BUFFERS_2048 + +/* Custom functions */ +extern int custom_rand_generate(void); +#define CUSTOM_RAND_GENERATE custom_rand_generate +#define WOLFSSL_USER_CURRTIME + +/* Debugging - Optional */ +#if 0 +#define fprintf(file, format, ...) printf(format, ##__VA_ARGS__) +#define DEBUG_WOLFSSL +#endif diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp b/IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp new file mode 100644 index 000000000..4ec9e06d3 --- /dev/null +++ b/IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp @@ -0,0 +1,317 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wolfcrypt/src/random.c b/wolfcrypt/src/random.c index 7ba6069b6..044a77021 100644 --- a/wolfcrypt/src/random.c +++ b/wolfcrypt/src/random.c @@ -102,7 +102,8 @@ int wc_RNG_GenerateByte(WC_RNG* rng, byte* b) #include #else #if !defined(NO_DEV_RANDOM) && !defined(CUSTOM_RAND_GENERATE) && \ - !defined(WOLFSSL_GENSEED_FORTEST) && !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM) + !defined(WOLFSSL_GENSEED_FORTEST) && !defined(WOLFSSL_MDK_ARM) && \ + !defined(WOLFSSL_IAR_ARM) && !defined(WOLFSSL_ROWLEY_ARM) #include #ifndef EBSNET #include diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h index 8df18bd37..19a7b2cf5 100644 --- a/wolfssl/ssl.h +++ b/wolfssl/ssl.h @@ -946,7 +946,8 @@ WOLFSSL_API int wolfSSL_make_eap_keys(WOLFSSL*, void* key, unsigned int len, #ifdef __PPU #include #include - #elif !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM) && !defined(WOLFSSL_PICOTCP) + #elif !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM) && \ + !defined(WOLFSSL_PICOTCP) && !defined(WOLFSSL_ROWLEY_ARM) #include #endif /* allow writev style writing */ diff --git a/wolfssl/test.h b/wolfssl/test.h index e488f9128..f0196a323 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -109,7 +109,8 @@ /* HPUX doesn't use socklent_t for third parameter to accept, unless _XOPEN_SOURCE_EXTENDED is defined */ -#if !defined(__hpux__) && !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM) +#if !defined(__hpux__) && !defined(WOLFSSL_MDK_ARM) && \ + !defined(WOLFSSL_IAR_ARM) && !defined(WOLFSSL_ROWLEY_ARM) typedef socklen_t* ACCEPT_THIRD_T; #else #if defined _XOPEN_SOURCE_EXTENDED diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 431c70d7d..6d38dfc2e 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -102,6 +102,9 @@ /* Uncomment next line if building for IAR EWARM */ /* #define WOLFSSL_IAR_ARM */ +/* Uncomment next line if building for Rowley CrossWorks ARM */ +/* #define WOLFSSL_ROWLEY_ARM */ + /* Uncomment next line if using TI-RTOS settings */ /* #define WOLFSSL_TIRTOS */ @@ -180,7 +183,7 @@ #define NO_FILESYSTEM #endif -#if defined(WOLFSSL_IAR_ARM) +#if defined(WOLFSSL_IAR_ARM) || defined(WOLFSSL_ROWLEY_ARM) #define NO_MAIN_DRIVER #define SINGLE_THREADED #define USE_CERT_BUFFERS_1024 @@ -188,7 +191,7 @@ #define NO_FILESYSTEM #define NO_WRITEV #define WOLFSSL_USER_IO - #define BENCH_EMBEDDED + #define BENCH_EMBEDDED #endif #ifdef MICROCHIP_PIC32 From adb9d27e9eb896e8842724b57f20d38b9cdb9e38 Mon Sep 17 00:00:00 2001 From: David Garske Date: Tue, 6 Oct 2015 16:11:28 -0700 Subject: [PATCH 36/77] Fixed release distribution of the Rowley IDE example. Added section in README for required library functions. --- IDE/ROWLEY-CROSSWORKS-ARM/README.md | 7 +++++++ IDE/ROWLEY-CROSSWORKS-ARM/include.am | 2 +- IDE/include.am | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/README.md b/IDE/ROWLEY-CROSSWORKS-ARM/README.md index 5209dc074..14bf47c3b 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/README.md +++ b/IDE/ROWLEY-CROSSWORKS-ARM/README.md @@ -43,3 +43,10 @@ To enable Freescale MMCAU: * `test_main.c`: The main function entrypoint for test application. * `user_libc.c`: Defines stubs for functions required by libc. It also wraps hardware functions for UART, RTC and Random Number Generator (RNG). * `user_settings.h`: This is the custom user configuration file for WolfSSL. + +# Functions required by the WolfSSL Library + +If you are writting your own application, the following functions need to be implemented to support the WolfSSL library: + +* `double current_time(int reset)`: Returns a doulbe as seconds.milliseconds. +* `int custom_rand_generate(void)`: Returns a 32-bit randomly generated number. diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/include.am b/IDE/ROWLEY-CROSSWORKS-ARM/include.am index 2ff200b42..d7b17a037 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/include.am +++ b/IDE/ROWLEY-CROSSWORKS-ARM/include.am @@ -10,6 +10,6 @@ EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_MemoryMap.xml EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/Kinetis_FlashPlacement.xml EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/README.md EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/test_main.c -EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/user_lib.c +EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/user_libc.c EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/user_settings.h EXTRA_DIST+= IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp diff --git a/IDE/include.am b/IDE/include.am index f6caad332..008e6ddda 100644 --- a/IDE/include.am +++ b/IDE/include.am @@ -5,5 +5,6 @@ include IDE/iOS/include.am include IDE/WIN/include.am include IDE/WORKBENCH/include.am +include IDE/ROWLEY-CROSSWORKS-ARM/include.am EXTRA_DIST+= IDE/IAR-EWARM IDE/MDK-ARM IDE/MDK5-ARM IDE/MYSQL From 6d49c308b72484a14aebd4eb0b97f77b452019b1 Mon Sep 17 00:00:00 2001 From: toddouska Date: Tue, 6 Oct 2015 17:02:31 -0700 Subject: [PATCH 37/77] require WOLFSSL_OPENSSL_TEST set for scripts/openssl.test to run, also disable in ipv6 test case because openssl s_server doesn't accept ipv6 --- scripts/include.am | 2 +- scripts/openssl.test | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/include.am b/scripts/include.am index 34a49bbba..915baf63a 100644 --- a/scripts/include.am +++ b/scripts/include.am @@ -10,7 +10,6 @@ endif if BUILD_EXAMPLES dist_noinst_SCRIPTS+= scripts/resume.test -dist_noinst_SCRIPTS+= scripts/openssl.test if BUILD_CRL # make revoked test rely on completion of resume test @@ -21,6 +20,7 @@ endif if !BUILD_IPV6 dist_noinst_SCRIPTS+= scripts/external.test dist_noinst_SCRIPTS+= scripts/google.test +dist_noinst_SCRIPTS+= scripts/openssl.test endif endif diff --git a/scripts/openssl.test b/scripts/openssl.test index 159214881..708186ab2 100755 --- a/scripts/openssl.test +++ b/scripts/openssl.test @@ -28,6 +28,13 @@ do_trap() { trap do_trap INT TERM +if test -n "$WOLFSSL_OPENSSL_TEST"; then + echo "WOLFSSL_OPENSSL_TEST set, running test..." +else + echo "WOLFSSL_OPENSSL_TEST NOT set, won't run" + exit 0 +fi + echo -e "\nTesting existence of openssl command...\n" command -v openssl >/dev/null 2>&1 || { echo >&2 "Requires openssl command, but it's not installed. Ending."; exit 0; } From a7ae5155cee469a5a28150426087eadad0f3643a Mon Sep 17 00:00:00 2001 From: John Safranek Date: Tue, 6 Oct 2015 20:18:55 -0700 Subject: [PATCH 38/77] fix defragment of handshake messages in TLS --- src/internal.c | 31 +++++++++++++++++++++---------- wolfssl/error-ssl.h | 1 + wolfssl/internal.h | 13 +++++++++++++ 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/src/internal.c b/src/internal.c index 09c6d23f7..5c9ede255 100644 --- a/src/internal.c +++ b/src/internal.c @@ -5267,8 +5267,8 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx, WOLFSSL_ENTER("DoHandShakeMsg()"); - /* If there is a pending fragmented handshake message, pending message size - * will be non-zero. */ + /* If there is a pending fragmented handshake message, + * pending message size will be non-zero. */ if (ssl->arrays->pendingMsgSz == 0) { byte type; word32 size; @@ -5276,8 +5276,16 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx, if (GetHandShakeHeader(ssl,input, inOutIdx, &type, &size, totalSz) != 0) return PARSE_ERROR; + /* Cap the maximum size of a handshake message to something reasonable. + * By default is the maximum size of a certificate message assuming + * nine 2048-bit RSA certificates in the chain. */ + if (size > MAX_HANDSHAKE_SZ) { + WOLFSSL_MSG("Handshake message too large"); + return HANDSHAKE_SIZE_ERROR; + } + /* size is the size of the certificate message payload */ - if (totalSz - HANDSHAKE_HEADER_SZ < size) { + if (ssl->curSize < size) { ssl->arrays->pendingMsgType = type; ssl->arrays->pendingMsgSz = size + HANDSHAKE_HEADER_SZ; ssl->arrays->pendingMsg = (byte*)XMALLOC(size + HANDSHAKE_HEADER_SZ, @@ -5286,25 +5294,25 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx, if (ssl->arrays->pendingMsg == NULL) return MEMORY_E; XMEMCPY(ssl->arrays->pendingMsg, - input + *inOutIdx - HANDSHAKE_HEADER_SZ, totalSz); - ssl->arrays->pendingMsgOffset = totalSz; - *inOutIdx += totalSz - HANDSHAKE_HEADER_SZ; + input + *inOutIdx - HANDSHAKE_HEADER_SZ, ssl->curSize); + ssl->arrays->pendingMsgOffset = ssl->curSize; + *inOutIdx += ssl->curSize - HANDSHAKE_HEADER_SZ; return 0; } ret = DoHandShakeMsgType(ssl, input, inOutIdx, type, size, totalSz); } else { - if (totalSz + ssl->arrays->pendingMsgOffset + if (ssl->curSize + ssl->arrays->pendingMsgOffset > ssl->arrays->pendingMsgSz) { return BUFFER_ERROR; } else { XMEMCPY(ssl->arrays->pendingMsg + ssl->arrays->pendingMsgOffset, - input + *inOutIdx, totalSz); - ssl->arrays->pendingMsgOffset += totalSz; - *inOutIdx += totalSz; + input + *inOutIdx, ssl->curSize); + ssl->arrays->pendingMsgOffset += ssl->curSize; + *inOutIdx += ssl->curSize; } if (ssl->arrays->pendingMsgOffset == ssl->arrays->pendingMsgSz) @@ -8553,6 +8561,9 @@ const char* wolfSSL_ERR_reason_error_string(unsigned long e) case RSA_SIGN_FAULT: return "RSA Signature Fault Error"; + case HANDSHAKE_SIZE_ERROR: + return "Handshake message too large Error"; + default : return "unknown error number"; } diff --git a/wolfssl/error-ssl.h b/wolfssl/error-ssl.h index 309be9eca..c3ff047fc 100644 --- a/wolfssl/error-ssl.h +++ b/wolfssl/error-ssl.h @@ -136,6 +136,7 @@ enum wolfSSL_ErrorCodes { DH_KEY_SIZE_E = -401, /* DH Key too small */ SNI_ABSENT_ERROR = -402, /* No SNI request. */ RSA_SIGN_FAULT = -403, /* RSA Sign fault */ + HANDSHAKE_SIZE_ERROR = -404, /* Handshake message too large */ /* add strings to SetErrorString !!!!! */ diff --git a/wolfssl/internal.h b/wolfssl/internal.h index 420c0f677..85afad61c 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -1016,6 +1016,19 @@ enum Misc { #define MAX_CHAIN_DEPTH 9 #endif +/* max size of a certificate message payload */ +/* assumes MAX_CHAIN_DEPTH number of certificates at 2kb per certificate */ +#ifndef MAX_CERTIFICATE_SZ + #define MAX_CERTIFICATE_SZ \ + CERT_HEADER_SZ + \ + (MAX_X509_SIZE + CERT_HEADER_SZ) * MAX_CHAIN_DEPTH +#endif + +/* max size of a handshake message, currently set to the certificate */ +#ifndef MAX_HANDSHAKE_SZ + #define MAX_HANDSHAKE_SZ MAX_CERTIFICATE_SZ +#endif + #ifndef SESSION_TICKET_LEN #define SESSION_TICKET_LEN 256 #endif From cdc3d61b97e66981b1fe4d4ebd27f05742b8da77 Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Wed, 7 Oct 2015 14:06:19 +0900 Subject: [PATCH 39/77] Refactoring WOLFSSL_MDK, MDK5 to KEIL_TCP_NET, KEIL_FS --- src/io.c | 18 ++++++++---------- src/ssl.c | 9 +-------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/src/io.c b/src/io.c index c78883836..d7065df9e 100644 --- a/src/io.c +++ b/src/io.c @@ -61,18 +61,16 @@ #include #elif defined(FREESCALE_KSDK_MQX) #include - #elif defined(WOLFSSL_MDK_ARM) - #if defined(WOLFSSL_MDK5) + #elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) + #if defined(WOLFSSL_MDK5) || defined(WOLFSSL_KEIL_TCP_NET) #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" + #include "rl_net.h" #else #include #endif - #undef RNG - #include "WOLFSSL_MDK_ARM.h" - #undef RNG - #define RNG wolfSSL_RNG + static int errno; + #define SOCKET_T int + #include "rl_net.h" /* for avoiding name conflict in "stm32f2xx.h" */ static int errno; #elif defined(WOLFSSL_TIRTOS) @@ -157,8 +155,8 @@ #define SOCKET_ECONNREFUSED NIO_ECONNREFUSED #define SOCKET_ECONNABORTED NIO_ECONNABORTED #endif -#elif defined(WOLFSSL_MDK_ARM) - #if defined(WOLFSSL_MDK5) +#elif defined(WOLFSSL_MDK_ARM)|| defined(WOLFSSL_KEIL_TCP_NET) + #if defined(WOLFSSL_MDK5)|| defined(WOLFSSL_KEIL_TCP_NET) #define SOCKET_EWOULDBLOCK BSD_ERROR_WOULDBLOCK #define SOCKET_EAGAIN BSD_ERROR_LOCKED #define SOCKET_ECONNRESET BSD_ERROR_CLOSED diff --git a/src/ssl.c b/src/ssl.c index fdbe8ce5d..60b199944 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -3492,13 +3492,6 @@ int wolfSSL_CTX_SetOCSP_Cb(WOLFSSL_CTX* ctx, CbOCSPIO ioCb, #ifndef NO_FILESYSTEM - #if defined(WOLFSSL_MDK_ARM) - extern FILE * wolfSSL_fopen(const char *name, const char *mode) ; - #define XFOPEN wolfSSL_fopen - #else - #define XFOPEN fopen - #endif - /* process a file with name fname into ctx of format and type userChain specifies a user certificate chain to pass during handshake */ int ProcessFile(WOLFSSL_CTX* ctx, const char* fname, int format, int type, @@ -7578,7 +7571,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl) #ifdef USE_WINDOWS_API #define CloseSocket(s) closesocket(s) -#elif defined(WOLFSSL_MDK_ARM) +#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #define CloseSocket(s) closesocket(s) extern int closesocket(int) ; #else From cc2460b4a07fe9599635e5f4c0244e5a722277ec Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Wed, 7 Oct 2015 14:39:23 +0900 Subject: [PATCH 40/77] refactor options in test.h, eliminate cyassl_MDK_ARM.[ch] coupler functions, cert_data.[ch] --- IDE/MDK5-ARM/Inc/cert_data.h | 39 --- IDE/MDK5-ARM/Inc/config.h | 41 ++- IDE/MDK5-ARM/Inc/cyassl_MDK_ARM.h | 106 -------- IDE/MDK5-ARM/Projects/CryptTest/cert_data.c | 28 -- IDE/MDK5-ARM/Projects/CyaSSL-Full/cert_data.c | 28 -- IDE/MDK5-ARM/Src/cert_data.c | 28 -- IDE/MDK5-ARM/Src/cyassl_MDK_ARM.c | 247 ------------------ wolfssl/test.h | 77 ++++-- 8 files changed, 76 insertions(+), 518 deletions(-) delete mode 100644 IDE/MDK5-ARM/Inc/cert_data.h delete mode 100644 IDE/MDK5-ARM/Inc/cyassl_MDK_ARM.h delete mode 100644 IDE/MDK5-ARM/Projects/CryptTest/cert_data.c delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/cert_data.c delete mode 100644 IDE/MDK5-ARM/Src/cert_data.c delete mode 100644 IDE/MDK5-ARM/Src/cyassl_MDK_ARM.c diff --git a/IDE/MDK5-ARM/Inc/cert_data.h b/IDE/MDK5-ARM/Inc/cert_data.h deleted file mode 100644 index 6629ee051..000000000 --- a/IDE/MDK5-ARM/Inc/cert_data.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef CYASSL_CERT_DATA_H -#define CYASSL_CERT_DATA_H - -#ifdef USE_CERT_BUFFERS_1024 -extern const unsigned char client_key_der_1024[] ; -extern int sizeof_client_key_der_1024 ; -/* ./certs/1024/client-cert.der, 1024-bit */ -extern const unsigned char client_cert_der_1024[] ; -extern int sizeof_client_cert_der_1024 ; -/* ./certs/1024/dh1024.der, 1024-bit */ -extern const unsigned char dh_key_der_1024[] ; -extern int sizeof_dh_key_der_1024 ; -/* ./certs/1024/dsa1024.der, 1024-bit */ -extern const unsigned char dsa_key_der_1024[] ; -extern int sizeof_dsa_key_der_1024 ; -/* ./certs/1024/rsa1024.der, 1024-bit */ -extern const unsigned char rsa_key_der_1024[] ; -extern int sizeof_rsa_key_der_1024 ; - -#elif defined(USE_CERT_BUFFERS_2048) -/* ./certs/client-key.der, 2048-bit */ -extern const unsigned char client_key_der_2048[] ; -extern int sizeof_client_key_der_2048 ; -/* ./certs/client-cert.der, 2048-bit */ -extern const unsigned char client_cert_der_2048[] ; -extern int sizeof_client_cert_der_2048 ; -/* ./certs/dh2048.der, 2048-bit */ -extern const unsigned char dh_key_der_2048[] ; -extern int sizeof_dh_key_der_2048 ; -/* ./certs/dsa2048.der, 2048-bit */ -extern const unsigned char dsa_key_der_2048[] ; -extern int sizeof_dsa_key_der_2048; -/* ./certs/rsa2048.der, 2048-bit */ -extern const unsigned char rsa_key_der_2048[] ; -extern int sizeof_rsa_key_der_2048 ; -#endif - -#endif - diff --git a/IDE/MDK5-ARM/Inc/config.h b/IDE/MDK5-ARM/Inc/config.h index 6fbc07d06..39986dd95 100644 --- a/IDE/MDK5-ARM/Inc/config.h +++ b/IDE/MDK5-ARM/Inc/config.h @@ -20,43 +20,38 @@ */ #define __CORTEX_M3__ -#define CYASSL_MDK_ARM -#define CYASSL_MDK5 -#define CYASSL_CMSIS_RTOS -#define NO_WRITEV -#define NO_CYASSL_DIR -#define BENCH_EMBEDDED - -#define CYASSL_DER_LOAD -#define HAVE_NULL_CIPHER -#define NO_MAIN_DRIVER - -#if defined(MDK_CONF_CYASSL) -#define CYASSL_MDK_SHELL +#if defined(MDK_CONF_full) #include "config-Crypt.h" -#include "config-CyaSSL.h" +#include "config-wolfSSL.h" + #elif defined(MDK_CONF_SimpleClient) #include "config-Crypt.h" -#include "config-CyaSSL.h" +#include "config-wolfSSL.h" + #elif defined(MDK_CONF_SimpleServer) #include "config-Crypt.h" -#include "config-CyaSSL.h" +#include "config-wolfSSL.h" + #elif defined(MDK_CONF_EchoClient) #include "config-Crypt.h" -#include "config-CyaSSL.h" +#include "config-wolfSSL.h" + #elif defined(MDK_CONF_EchoServer) #include "config-Crypt.h" -#include "config-CyaSSL.h" +#include "config-wolfSSL.h" + #elif defined(MDK_CONF_Benchmark) #define SINGLE_THREADED -#define NO_INLINE -#include "config-Crypt.h" -#elif defined(MDK_CONF_CryptTest) -#define SINGLE_THREADED -#define NO_INLINE #include "config-Crypt.h" +#elif defined(MDK_CONF_CryptTest) +#define SINGLE_THREADED +#include "config-Crypt.h" + +#elif defined(MDK_CONF_wolfSSL_lib) +#include "config-Crypt.h" +#include "config-wolfSSL.h" #endif diff --git a/IDE/MDK5-ARM/Inc/cyassl_MDK_ARM.h b/IDE/MDK5-ARM/Inc/cyassl_MDK_ARM.h deleted file mode 100644 index 43c5c5ade..000000000 --- a/IDE/MDK5-ARM/Inc/cyassl_MDK_ARM.h +++ /dev/null @@ -1,106 +0,0 @@ -/* cyassl_KEIL_RL.h - * - * 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 - */ - -/******************************************************************************/ -/** This file is for defining types, values for specific to KEIL-MDK-ARM. **/ -/******************************************************************************/ -#ifndef CYASSL_KEIL_RL_H -#define CYASSL_KEIL_RL_H - - - -#include - -/* Go to STDIN */ -#define fgets(buff, sz, fd) Cyassl_fgets(buff, sz, fd) -extern char * Cyassl_fgets ( char * str, int num, FILE * f ) ; - -#define SOCKET_T int - -/*** #include ***/ -#define NUMBITSPERBYTE 8 -#define FD_SETSIZE 10 - -typedef long fd_mask; -#define NFDBITS (sizeof(fd_mask) * NUMBITSPERBYTE) /* bits per mask */ - -typedef struct fd_set { - fd_mask fds_bits[(FD_SETSIZE + NFDBITS - 1) / NFDBITS]; -} fd_set; - -/*** #include ***/ -struct timeval { - long tv_sec; /* seconds */ - long tv_usec; /* microseconds */ -}; - - -#if defined(CYASSL_KEIL_TCP_NET) - - -#if defined(CYASSL_MDK5) -#define SCK_EWOULDBLOCK BSD_ERROR_WOULDBLOCK -#define SCK_ETIMEOUT BSD_ERROR_TIMEOUT -#include "rl_net.h" -#endif - -typedef int socklen_t ; - -/* for avoiding conflict with KEIL-TCPnet BSD socket */ -/* Bodies are in cyassl_KEIL_RL.c */ -#define connect Cyassl_connect -#define accept Cyassl_accept -#define recv Cyassl_recv -#define send Cyassl_send -#define sleep Cyassl_sleep - -/* for avoiding conflicting with KEIL-TCPnet TCP socket */ -/* Bodies are in test.h */ -#define tcp_connect Cyassl_tcp_connect -#define tcp_socket Cyassl_tcp_soket -#define tcp_listen Cyassl_tcp_listen -#define tcp_select Cyassl_tcp_select - -extern int Cyassl_connect(int sd, const struct sockaddr * sa, int sz) ; -extern int Cyassl_accept(int sd, struct sockaddr *addr, socklen_t *addrlen); -extern int Cyassl_recv(int sd, void *buf, size_t len, int flags); -extern int Cyassl_send(int sd, const void *buf, size_t len, int flags); -extern void Cyassl_sleep(int sec) ; -extern int Cyassl_tcp_select(int sd, int timeout) ; - -/** KEIL-RL TCPnet ****/ -/* TCPnet BSD socket does not have following functions. */ -extern char *inet_ntoa(struct in_addr in); -extern unsigned long inet_addr(const char *cp); -extern int setsockopt(int sockfd, int level, int optname, - const void *optval, socklen_t optlen); -extern int select(int nfds, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, const struct timeval *timeout); - -#endif /* CYASSL_KEIL_TCP_NET */ - - -/* CyaSSL MDK-ARM time functions */ -#include -struct tm *Cyassl_MDK_gmtime(const time_t *c) ; -extern double current_time(void) ; - -#endif /* CYASSL_KEIL_RL_H */ diff --git a/IDE/MDK5-ARM/Projects/CryptTest/cert_data.c b/IDE/MDK5-ARM/Projects/CryptTest/cert_data.c deleted file mode 100644 index d6cef016d..000000000 --- a/IDE/MDK5-ARM/Projects/CryptTest/cert_data.c +++ /dev/null @@ -1,28 +0,0 @@ -/* certs_test.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 -#endif - -/* Define initial data for cert buffers */ -#include - diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/cert_data.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/cert_data.c deleted file mode 100644 index d6cef016d..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/cert_data.c +++ /dev/null @@ -1,28 +0,0 @@ -/* certs_test.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 -#endif - -/* Define initial data for cert buffers */ -#include - diff --git a/IDE/MDK5-ARM/Src/cert_data.c b/IDE/MDK5-ARM/Src/cert_data.c deleted file mode 100644 index d6cef016d..000000000 --- a/IDE/MDK5-ARM/Src/cert_data.c +++ /dev/null @@ -1,28 +0,0 @@ -/* certs_test.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 -#endif - -/* Define initial data for cert buffers */ -#include - diff --git a/IDE/MDK5-ARM/Src/cyassl_MDK_ARM.c b/IDE/MDK5-ARM/Src/cyassl_MDK_ARM.c deleted file mode 100644 index 5a2776cc0..000000000 --- a/IDE/MDK5-ARM/Src/cyassl_MDK_ARM.c +++ /dev/null @@ -1,247 +0,0 @@ -/* cyassl_KEIL_RL.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 - */ - - -/***************************************************************************************/ -/** This file is for defining functions for specific to KEIL-RL. **/ -/***************************************************************************************/ -#ifdef HAVE_CONFIG_H - #include -#endif - -#include -#if defined (CYASSL_MDK5) - #include "cmsis_os.h" - #if defined(CYASSL_KEIL_TCP_NET) - #include "rl_net.h" - #endif -#else - #include -#endif - -#include "cyassl_MDK_ARM.h" - -#include -#include - -#if defined (CYASSL_CMSIS_RTOS) - #define os_dly_wait(t) osDelay(10*t) -#endif - - -/** KEIL-RL TCPnet ****/ -/** TCPnet BSD socket does not have following functions. **/ - -#if defined(CYASSL_KEIL_TCP_NET) -char *inet_ntoa(struct in_addr in) -{ - #define NAMESIZE 16 - static char name[NAMESIZE] ; - sprintf(name, "%d.%d.%d.%d", (in.s_addr>>24)&0xff, (in.s_addr>>16)&0xff, (in.s_addr>>8)&0xff, in.s_addr&0xff) ; - return name ; -} - -unsigned long inet_addr(const char *cp) -{ - unsigned int a[4] ; unsigned long ret ; - sscanf(cp, "%d.%d.%d.%d", &a[0], &a[1], &a[2], &a[3]) ; - ret = ((a[3]<<24) + (a[2]<<16) + (a[1]<<8) + a[0]) ; - return(ret) ; -} - - -/*** tcp_connect is actually associated with following syassl_tcp_connect. ***/ -int Cyassl_connect(int sd, const struct sockaddr* sa, int sz) -{ - int ret = 0 ; - #if defined(CYASSL_KEIL_TCP_NET) - - SOCKADDR_IN addr ; - - addr = *(SOCKADDR_IN *)sa ; - - do { - #undef connect /* Go to KEIL TCPnet connect */ - ret = connect(sd, (SOCKADDR *)&addr, sizeof(addr)) ; - os_dly_wait(50); - } while(ret == SCK_EWOULDBLOCK) ; - #ifdef DEBUG_CYASSL - { - char msg[50] ; - sprintf(msg, "BSD Connect return code: %d\n", ret) ; - CYASSL_MSG(msg) ; - } - #endif - - #endif /* CYASSL_KEIL_TCP_NET */ - return(ret ) ; -} - - -int Cyassl_accept(int sd, struct sockaddr *addr, int *addrlen) -{ - int ret = 0 ; - - #if defined(CYASSL_KEIL_TCP_NET) - while(1) { - #undef accept /* Go to KEIL TCPnet accept */ - ret = accept(sd, addr, addrlen) ; - if(ret != SCK_EWOULDBLOCK) break ; - os_dly_wait(1); - } - #ifdef DEBUG_CYASSL - { - char msg[50] ; - sprintf(msg, "BSD Accept return code: %d\n", ret) ; - CYASSL_MSG(msg) ; - } - #endif - - #endif /* CYASSL_KEIL_TCP_NET */ - return(ret ) ; - -} - -int Cyassl_recv(int sd, void *buf, size_t len, int flags) -{ - int ret = 0; - #if defined(CYASSL_KEIL_TCP_NET) - while(1) { - #undef recv /* Go to KEIL TCPnet recv */ - ret = recv(sd, buf, len, flags) ; - if((ret != SCK_EWOULDBLOCK) &&( ret != SCK_ETIMEOUT)) break ; - os_dly_wait(1); - } - #ifdef DEBUG_CYASSL - { - char msg[50] ; - sprintf(msg, "BSD Recv return code: %d\n", ret) ; - CYASSL_MSG(msg) ; - } - #endif - - #endif /* CYASSL_KEIL_TCP_NET */ - return(ret ) ; -} - -int Cyassl_send(int sd, const void *buf, size_t len, int flags) -{ - int ret = 0 ; - - #if defined(CYASSL_KEIL_TCP_NET) - while(1) { - #undef send /* Go to KEIL TCPnet send */ - ret = send(sd, buf, len, flags) ; - if(ret != SCK_EWOULDBLOCK) break ; - os_dly_wait(1); - } - #ifdef DEBUG_CYASSL - { - char msg[50] ; - sprintf(msg, "BSD Send return code: %d\n", ret) ; - CYASSL_MSG(msg) ; - } - #endif - -#endif /* CYASSL_KEIL_TCP_NET */ - return(ret) ; - -} - -#endif /* CYASSL_KEIL_TCP_NET */ - -#if defined(CYASSL_KEIL_TCP_NET) -void Cyassl_sleep(int t) -{ - #if defined(HAVE_KEIL_RTX) - os_dly_wait(t/1000+1) ; - #endif -} - -int Cyassl_tcp_select(int sd, int timeout) -{ - - return 0 ; - -} -#endif - -extern int strlen(const char *s) ; - -FILE * CyaSSL_fopen(const char *name, const char *openmode) -{ - int i ; FILE * ret ; - #define PATHSIZE 100 - char path[PATHSIZE] ; char *p ; - - if(strlen(name) > PATHSIZE)return(NULL) ; - - for(i = 0; i<= strlen(name); i++) { - if(name[i] == '/')path[i] = '\\' ; - else path[i] = name[i] ; - } - if(path[0] == '.' && path[1] == '\\') p = path + 2 ; - else p = path ; - - ret = fopen (p, openmode) ; - - return(ret) ; -} - -#if defined (CYASSL_MDK5) -#define getkey getchar -#define sendchar putchar -#else -extern int getkey(void) ; -extern int sendchar(int c) ; -#endif - -char * Cyassl_fgets ( char * str, int num, FILE * f ) -{ - int i ; - - for(i = 0 ; i< num ; i++) { - while((str[i] = getkey()) == 0) { - #if defined (HAVE_KEIL_RTX) && !defined(CYASSL_CMSIS_RTOS) - os_tsk_pass (); - #else - osThreadYield (); - #endif - } - if(str[i] == '\n' || str[i] == '\012' || str[i] == '\015') { - sendchar('\n') ; - str[i++] = '\n' ; - str[i] = '\0' ; - break ; - } else if(str[i] == '\010') { /* BS */ - if(i) { /* erace one char */ - sendchar('\010') ; sendchar(' ') ; sendchar('\010') ; - i = (i>0 ? (i-2) : -1 ) ; - continue ; - } - } else if(str[i] == '\033' || str[i] == '\004' ) { /* ESC or ^D */ - str[i] = '\0' ; - return(0) ; - } - sendchar(str[i]) ; - } - return(str) ; -} diff --git a/wolfssl/test.h b/wolfssl/test.h index f0196a323..6de6fb225 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -32,8 +32,27 @@ #endif #define SOCKET_T SOCKET #define SNPRINTF _snprintf -#elif defined(WOLFSSL_MDK_ARM) +#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #include + #include "rl_net.h" + #define SOCKET_T int + typedef int socklen_t ; + static unsigned long inet_addr(const char *cp) + { + unsigned int a[4] ; unsigned long ret ; + sscanf(cp, "%d.%d.%d.%d", &a[0], &a[1], &a[2], &a[3]) ; + ret = ((a[3]<<24) + (a[2]<<16) + (a[1]<<8) + a[0]) ; + return(ret) ; + } + #if defined(HAVE_KEIL_RTX) + #define sleep(t) os_dly_wait(t/1000+1) ; + #elif defined (WOLFSSL_CMSIS_RTOS) + #define sleep(t) osDelay(t/1000+1) ; + #endif + + static int wolfssl_tcp_select(int sd, int timeout) + { return 0 ; } + #define tcp_select(sd,t) wolfssl_tcp_select(sd, t) /* avoid conflicting Keil TCP tcp_select */ #elif defined(WOLFSSL_TIRTOS) #include #include @@ -109,8 +128,8 @@ /* HPUX doesn't use socklent_t for third parameter to accept, unless _XOPEN_SOURCE_EXTENDED is defined */ -#if !defined(__hpux__) && !defined(WOLFSSL_MDK_ARM) && \ - !defined(WOLFSSL_IAR_ARM) && !defined(WOLFSSL_ROWLEY_ARM) +#if !defined(__hpux__) && !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM)\ + && !defined(WOLFSSL_ROWLEY_ARM) && !defined(WOLFSSL_KEIL_TCP_NET) typedef socklen_t* ACCEPT_THIRD_T; #else #if defined _XOPEN_SOURCE_EXTENDED @@ -124,12 +143,12 @@ #ifdef USE_WINDOWS_API #define CloseSocket(s) closesocket(s) #define StartTCP() { WSADATA wsd; WSAStartup(0x0002, &wsd); } -#elif defined(WOLFSSL_MDK_ARM) +#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #define CloseSocket(s) closesocket(s) - #define StartTCP() + #define StartTCP() #else #define CloseSocket(s) close(s) - #define StartTCP() + #define StartTCP() #endif @@ -144,7 +163,7 @@ #define WOLFSSL_THREAD #define INFINITE -1 #define WAIT_OBJECT_0 0L - #elif defined(WOLFSSL_MDK_ARM) + #elif defined(WOLFSSL_MDK_ARM)|| defined(WOLFSSL_KEIL_TCP_NET) typedef unsigned int THREAD_RETURN; typedef int THREAD_TYPE; #define WOLFSSL_THREAD @@ -182,6 +201,21 @@ #endif /* all certs relative to wolfSSL home directory now */ +#if defined(WOLFSSL_NO_CURRDIR) || defined(WOLFSSL_MDK_SHELL) +#define caCert "certs/ca-cert.pem" +#define eccCert "certs/server-ecc.pem" +#define eccKey "certs/ecc-key.pem" +#define svrCert "certs/server-cert.pem" +#define svrKey "certs/server-key.pem" +#define cliCert "certs/client-cert.pem" +#define cliKey "certs/client-key.pem" +#define ntruCert "certs/ntru-cert.pem" +#define ntruKey "certs/ntru-key.raw" +#define dhParam "certs/dh2048.pem" +#define cliEccKey "certs/ecc-client-key.pem" +#define cliEccCert "certs/client-ecc-cert.pem" +#define crlPemDir "certs/crl" +#else #define caCert "./certs/ca-cert.pem" #define eccCert "./certs/server-ecc.pem" #define eccKey "./certs/ecc-key.pem" @@ -195,6 +229,7 @@ #define cliEccKey "./certs/ecc-client-key.pem" #define cliEccCert "./certs/client-ecc-cert.pem" #define crlPemDir "./certs/crl" +#endif typedef struct tcp_ready { word16 ready; /* predicate */ @@ -429,7 +464,7 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer, #ifndef TEST_IPV6 /* peer could be in human readable form */ if ( (peer != INADDR_ANY) && isalpha((int)peer[0])) { - #ifdef WOLFSSL_MDK_ARM + #if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) int err; struct hostent* entry = gethostbyname(peer, &err); #elif defined(WOLFSSL_TIRTOS) @@ -452,7 +487,7 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer, #ifndef TEST_IPV6 - #if defined(WOLFSSL_MDK_ARM) + #if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) addr->sin_family = PF_INET; #else addr->sin_family = AF_INET_V; @@ -527,7 +562,8 @@ static INLINE void tcp_socket(SOCKET_T* sockfd, int udp) if (res < 0) err_sys("setsockopt SO_NOSIGPIPE failed\n"); } -#elif defined(WOLFSSL_MDK_ARM) || defined (WOLFSSL_TIRTOS) +#elif defined(WOLFSSL_MDK_ARM) || defined (WOLFSSL_TIRTOS) ||\ + defined(WOLFSSL_KEIL_TCP_NET) /* nothing to define */ #else /* no S_NOSIGPIPE */ signal(SIGPIPE, SIG_IGN); @@ -575,7 +611,8 @@ enum { }; -#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_TIRTOS) +#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_TCP_NET) && \ + !defined(WOLFSSL_TIRTOS) static INLINE int tcp_select(SOCKET_T socketfd, int to_sec) { fd_set recvfds, errfds; @@ -619,7 +656,8 @@ static INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr, build_addr(&addr, (useAnyAddr ? INADDR_ANY : wolfSSLIP), *port, udp); tcp_socket(sockfd, udp); -#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_MDK_ARM) +#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_MDK_ARM)\ + && !defined(WOLFSSL_KEIL_TCP_NET) { int res, on = 1; socklen_t len = sizeof(on); @@ -682,7 +720,8 @@ static INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, tcp_socket(sockfd, 1); -#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_MDK_ARM) +#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_MDK_ARM) \ + && !defined(WOLFSSL_KEIL_TCP_NET) { int res, on = 1; socklen_t len = sizeof(on); @@ -788,14 +827,14 @@ static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, static INLINE void tcp_set_nonblocking(SOCKET_T* sockfd) { - #ifdef USE_WINDOWS_API + #ifdef USE_WINDOWS_API unsigned long blocking = 1; int ret = ioctlsocket(*sockfd, FIONBIO, &blocking); if (ret == SOCKET_ERROR) err_sys("ioctlsocket failed"); - #elif defined(WOLFSSL_MDK_ARM) || defined (WOLFSSL_TIRTOS) \ - || defined(WOLFSSL_VXWORKS) - /* non blocking not suppported, for now */ + #elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) \ + || defined (WOLFSSL_TIRTOS)|| defined(WOLFSSL_VXWORKS) + /* non blocking not suppported, for now */ #else int flags = fcntl(*sockfd, F_GETFL, 0); if (flags < 0) @@ -881,7 +920,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity, extern double current_time(); #else -#if !defined(WOLFSSL_MDK_ARM) +#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_TCP_NET) #include static INLINE double current_time(void) @@ -1134,7 +1173,7 @@ static INLINE int CurrentDir(const char* str) return 0; } -#elif defined(WOLFSSL_MDK_ARM) +#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_FS) /* KEIL-RL File System does not support relative directry */ #elif defined(WOLFSSL_TIRTOS) #else From 504d3337de83042a5fbf645e771cac367cb4b0ed Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Wed, 7 Oct 2015 14:46:11 +0900 Subject: [PATCH 41/77] Catching up updated mMDK middleware packs --- IDE/MDK5-ARM/Conf/config-Crypt.h | 198 ++- IDE/MDK5-ARM/Conf/config-CyaSSL.h | 144 -- IDE/MDK5-ARM/Conf/user_settings.h | 34 + .../CryptBenchmark/CryptBenchmark.uvoptx | 722 +-------- .../CryptBenchmark/CryptBenchmark.uvprojx | 546 +++---- .../Projects/CryptBenchmark/benchmark.c | 1313 ----------------- .../Projects/CryptTest/CryptTest.uvoptx | 731 +-------- .../Projects/CryptTest/CryptTest.uvprojx | 544 +++---- .../Projects/EchoClient/EchoClient.uvoptx | 988 +------------ .../Projects/EchoClient/EchoClient.uvprojx | 864 ++++------- .../Projects/EchoServer/EchoServer.uvoptx | 1027 +------------ .../Projects/EchoServer/EchoServer.uvprojx | 868 ++++------- .../Projects/SimpleClient/SimpleClient.uvoptx | 995 +------------ .../Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx | 314 ++++ .../Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx | 782 ++++++++++ 15 files changed, 2562 insertions(+), 7508 deletions(-) delete mode 100644 IDE/MDK5-ARM/Conf/config-CyaSSL.h create mode 100644 IDE/MDK5-ARM/Conf/user_settings.h delete mode 100644 IDE/MDK5-ARM/Projects/CryptBenchmark/benchmark.c create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx diff --git a/IDE/MDK5-ARM/Conf/config-Crypt.h b/IDE/MDK5-ARM/Conf/config-Crypt.h index 2004294cf..baaf43f2e 100644 --- a/IDE/MDK5-ARM/Conf/config-Crypt.h +++ b/IDE/MDK5-ARM/Conf/config-Crypt.h @@ -1,4 +1,4 @@ -/* config-FS.h +/* config-Crypt.h * * Copyright (C) 2006-2015 wolfSSL Inc. * @@ -26,7 +26,7 @@ // Cert/Key Strage // Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes) -#define MDK_CONF_CERT_BUFF 0 +#define MDK_CONF_CERT_BUFF 2 #if MDK_CONF_CERT_BUFF== 1 #define USE_CERT_BUFFERS_1024 #elif MDK_CONF_CERT_BUFF == 2 @@ -36,13 +36,10 @@ // Crypt Algrithm -// MD5, SHA, SHA-256, AES, RC4, ASN, RSA -// - // MD2 -#define MDK_CONF_MD2 0 +#define MDK_CONF_MD2 1 #if MDK_CONF_MD2 == 1 -#define CYASSL_MD2 +#define WOLFSSL_MD2 #endif // // MD4 @@ -51,23 +48,46 @@ #define NO_MD4 #endif // +// MD5 +#define MDK_CONF_MD5 1 +#if MDK_CONF_MD5 == 0 +#define NO_MD5 +#endif +// +// SHA +#define MDK_CONF_SHA 1 +#if MDK_CONF_SHA == 0 +#define NO_SHA +#endif +// +// SHA-256 +#define MDK_CONF_SHA256 1 +#if MDK_CONF_SHA256 == 0 +#define NO_SHA256 +#endif +// // SHA-384 -// This has to be with SHA512 -#define MDK_CONF_SHA384 0 +#define MDK_CONF_SHA384 1 #if MDK_CONF_SHA384 == 1 -#define CYASSL_SHA384 +#define WOLFSSL_SHA384 #endif // // SHA-512 -#define MDK_CONF_SHA512 0 +#define MDK_CONF_SHA512 1 #if MDK_CONF_SHA512 == 1 -#define CYASSL_SHA512 +#define WOLFSSL_SHA512 #endif // // RIPEMD -#define MDK_CONF_RIPEMD 0 +#define MDK_CONF_RIPEMD 1 #if MDK_CONF_RIPEMD == 1 -#define CYASSL_RIPEMD +#define WOLFSSL_RIPEMD +#endif +// +// BLAKE2 +#define MDK_CONF_BLAKE2 0 +#if MDK_CONF_BLAKE2 == 1 +#define HAVE_BLAKE2 #endif // // HMAC @@ -76,40 +96,83 @@ #define NO_HMAC #endif // -// HC128 -#define MDK_CONF_HC128 0 -#if MDK_CONF_HC128 == 1 -#define HAVE_HC128 +// HMAC KDF +#define MDK_CONF_HKDF 1 +#if MDK_CONF_HKDF == 1 +#define HAVE_HKDF #endif // -// RABBIT + +// AES CCM +#define MDK_CONF_AESCCM 1 +#if MDK_CONF_AESCCM == 1 +#define HAVE_AESCCM +#endif +// +// AES GCM +#define MDK_CONF_AESGCM 1 +#if MDK_CONF_AESGCM == 1 +#define HAVE_AESGCM +#endif +// + +// RC4 +#define MDK_CONF_RC4 1 +#if MDK_CONF_RC4 == 0 +#define NO_RC4 +#endif +// + +// HC128 +#define MDK_CONF_HC128 1 +#if MDK_CONF_AESGCM == 0 +#define NO_HC128 +#endif +// + +// RABBIT #define MDK_CONF_RABBIT 1 -#if MDK_CONF_RABBI == 0 +#if MDK_CONF_RABBIT == 0 #define NO_RABBIT #endif // -// AEAD -#define MDK_CONF_AEAD 0 -#if MDK_CONF_AEAD == 1 -#define HAVE_AEAD +// CHACHA +#define MDK_CONF_CHACHA 1 +#if MDK_CONF_CHACHA == 1 +#define HAVE_CHACHA #endif // + +// POLY1305 +#define MDK_CONF_POLY1305 1 +#if MDK_CONF_POLY1305 == 0 +#define HAVE_POLY1305 +#endif +// + // DES3 #define MDK_CONF_DES3 1 #if MDK_CONF_DES3 == 0 #define NO_DES3 #endif // + +// AES +#define MDK_CONF_AES 1 +#if MDK_CONF_AES == 0 +#define NO_AES +#endif +// + // CAMELLIA -#define MDK_CONF_CAMELLIA 0 +#define MDK_CONF_CAMELLIA 1 #if MDK_CONF_CAMELLIA == 1 #define HAVE_CAMELLIA #endif // // DH -// need this for CYASSL_SERVER, OPENSSL_EXTRA #define MDK_CONF_DH 1 #if MDK_CONF_DH == 0 #define NO_DH @@ -121,6 +184,14 @@ #define NO_DSA #endif // + +// SRP +#define MDK_CONF_SRP 1 +#if MDK_CONF_SRP == 1 +#define HAVE_SRP +#endif +// + // PWDBASED #define MDK_CONF_PWDBASED 1 #if MDK_CONF_PWDBASED == 0 @@ -129,30 +200,35 @@ // // ECC -#define MDK_CONF_ECC 0 +#define MDK_CONF_ECC 1 #if MDK_CONF_ECC == 1 #define HAVE_ECC #endif // -// PSK -#define MDK_CONF_PSK 1 -#if MDK_CONF_PSK == 0 -#define NO_PSK + +// CURVE25519 +#define MDK_CONF_CURVE25519 1 +#if MDK_CONF_CURVE25519 == 1 +#define HAVE_CURVE25519 +#define CURVED25519_SMALL +//#define TFM_ECC256 #endif // -// AESCCM (Turn off Hardware Crypt) -#define MDK_CONF_AESCCM 0 -#if MDK_CONF_AESCCM == 1 -#define HAVE_AESCCM + +// ED25519 +#define MDK_CONF_ED25519 1 +#if MDK_CONF_ED25519 == 1 +#define HAVE_ED25519 #endif // -// AESGCM (Turn off Hardware Crypt) -#define MDK_CONF_AESGCM 0 -#if MDK_CONF_AESGCM == 1 -#define HAVE_AESGCM -#define BUILD_AESGCM + +// PKCS7 +#define MDK_CONF_PKCS7 0 +#if MDK_CONF_PKCS7 == 1 +#define HAVE_PKCS7 #endif // + // NTRU (need License, "crypto_ntru.h") #define MDK_CONF_NTRU 0 #if MDK_CONF_NTRU == 1 @@ -179,6 +255,48 @@ // +// Other Settings + +// Use Fast Math +#define MDK_CONF_FASTMATH 1 +#if MDK_CONF_FASTMATH == 1 +#define USE_FAST_MATH +#define TFM_TIMING_RESISTANT +#endif +// +// Small Stack +#define MDK_CONF_SmallStack 0 +#if MDK_CONF_SmallStack == 0 +#define NO_WOLFSSL_SMALL_STACK +#endif +// +// ErrNo.h +#define MDK_CONF_ErrNo 1 +#if MDK_CONF_ErrNo == 1 +#define HAVE_ERRNO +#endif +// +// Error Strings +#define MDK_CONF_ErrorStrings 1 +#if MDK_CONF_ErrorStrings == 0 +#define NO_ERROR_STRINGS +#endif +// +// zlib (need "zlib.h") +#define MDK_CONF_LIBZ 0 +#if MDK_CONF_LIBZ == 1 +#define HAVE_LIBZ +#endif +// +// CAVIUM (need CAVIUM headers) +#define MDK_CONF_CAVIUM 0 +#if MDK_CONF_CAVIUM == 1 +#define HAVE_CAVIUM +#endif +// + +// + // diff --git a/IDE/MDK5-ARM/Conf/config-CyaSSL.h b/IDE/MDK5-ARM/Conf/config-CyaSSL.h deleted file mode 100644 index 9e9d13844..000000000 --- a/IDE/MDK5-ARM/Conf/config-CyaSSL.h +++ /dev/null @@ -1,144 +0,0 @@ -/* config-RTX-TCP-FS.h - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - - -/**** CyaSSL for KEIL-RL Configuration ****/ - -#define __CORTEX_M3__ -#define CYASSL_MDK_ARM -#define NO_WRITEV -#define NO_CYASSL_DIR -#define NO_MAIN_DRIVER - - -#define CYASSL_DER_LOAD -#define HAVE_NULL_CIPHER - -#define HAVE_KEIL_RTX -#define CYASSL_CMSIS_RTOS -#define CYASSL_KEIL_TCP_NET - - -// <<< Use Configuration Wizard in Context Menu >>> -// CyaSSL Configuration - -// SSL (Included by default) -// - -// TLS -#define MDK_CONF_TLS 1 -#if MDK_CONF_TLS == 0 -#define NO_TLS -#endif -// - -// CRL -#define MDK_CONF_DER_LOAD 0 -#if MDK_CONF_DER_LOAD == 1 -#define CYASSL_DER_LOAD -#endif -// -// OpenSSL Extra -#define MDK_CONF_OPENSSL_EXTRA 1 -#if MDK_CONF_OPENSSL_EXTRA == 1 -#define OPENSSL_EXTRA -#endif -// -// - -// Cert/Key Generation -// CertGen -#define MDK_CONF_CERT_GEN 0 -#if MDK_CONF_CERT_GEN == 1 -#define CYASSL_CERT_GEN -#endif -// -// KeyGen -#define MDK_CONF_KEY_GEN 0 -#if MDK_CONF_KEY_GEN == 1 -#define CYASSL_KEY_GEN -#endif -// -// - -// Others - -// Inline -#define MDK_CONF_INLINE 0 -#if MDK_CONF_INLINE == 0 -#define NO_INLINE -#endif -// -// Debug -// Debug Message -#define MDK_CONF_DebugMessage 0 -#if MDK_CONF_DebugMessage == 1 -#define DEBUG_CYASSL -#endif -// -// Check malloc -#define MDK_CONF_CheckMalloc 1 -#if MDK_CONF_CheckMalloc == 1 -#define CYASSL_MALLOC_CHECK -#endif -// - - -// -// ErrNo.h -#define MDK_CONF_ErrNo 0 -#if MDK_CONF_ErrNo == 1 -#define HAVE_ERRNO -#endif -// -// Error Strings -#define MDK_CONF_ErrorStrings 1 -#if MDK_CONF_ErrorStrings == 0 -#define NO_ERROR_STRINGS -#endif -// -// zlib (need "zlib.h") -#define MDK_CONF_LIBZ 0 -#if MDK_CONF_LIBZ == 1 -#define HAVE_LIBZ -#endif -// -// CAVIUM (need CAVIUM headers) -#define MDK_CONF_CAVIUM 0 -#if MDK_CONF_CAVIUM == 1 -#define HAVE_CAVIUM -#endif -// -// Small Stack -#define MDK_CONF_SmallStack 1 -#if MDK_CONF_SmallStack == 0 -#define NO_CYASSL_SMALL_STACK -#endif -// -// Use Fast Math -#define MDK_CONF_FASTMATH 0 -#if MDK_CONF_FASTMATH == 1 -#define USE_FAST_MATH -#endif -// -// - -// <<< end of configuration section >>> diff --git a/IDE/MDK5-ARM/Conf/user_settings.h b/IDE/MDK5-ARM/Conf/user_settings.h new file mode 100644 index 000000000..05cbd7425 --- /dev/null +++ b/IDE/MDK5-ARM/Conf/user_settings.h @@ -0,0 +1,34 @@ +#define NO_WRITEV +#define NO_MAIN_DRIVER +#define WOLFSSL_MDK_SHELL + +/* #define SINGLE_THREADED or define RTOS option */ +#define WOLFSSL_CMSIS_RTOS + +/* #define NO_FILESYSTEM or define Filesystem option */ +#define WOLFSSL_KEIL_FS +#define NO_WOLFSSL_DIR +#define WOLFSSL_NO_CURRDIR + +/* #define WOLFSSL_USER_IO or use BSD incompatible TCP stack */ +#define WOLFSSL_KEIL_TCP_NET /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */ + +#define NO_DEV_RANDOM +/* define your Rand gen for the operational use */ +#define WOLFSSL_GENSEED_FORTEST + +#define USE_WOLFSSL_MEMORY +#define WOLFSSL_MALLOC_CHECK + +#define USER_TIME +#define TIME_OVERRIDES +#define XTIME time_dummy /* Have to be replaced with operational function */ +static long time_dummy(long *t) { return (365*24*60*60*(2016-1970)) ; } +#define WOLFSSL_USER_CURRTIME + +#define USE_FAST_MATH +#define TFM_TIMING_RESISTANT +#define BENCH_EMBEDDED + + + diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx index 2100471cf..cf8773119 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx @@ -13,6 +13,7 @@ *.txt; *.h; *.inc *.plm *.cpp + 0 @@ -25,12 +26,13 @@ 0x4 ARM-ADS - 120000000 + 12000000 1 1 0 1 + 0 1 @@ -75,17 +77,17 @@ 0 1 - 255 + 18 0 Schematics (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf 1 User Manual (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm 2 @@ -113,10 +115,9 @@ 1 1 1 - 1 0 0 - 8 + 1 @@ -127,9 +128,14 @@ .\STM32_SWO.ini - BIN\ULP2CM3.DLL + BIN\UL2CM3.DLL + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + 0 DLGTARM @@ -143,17 +149,17 @@ 0 ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) + -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) 0 DLGUARM - + (105=-1,-1,-1,-1,0) 0 UL2CM3 - UL2CM3(-S0 -C0 -P0 ) -FN1 -FC1000 -FD20000000 -FF0STM32F2xx_1024 -FL0100000 -FS08000000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.FLM) + -UM1020ADE -O206 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) @@ -162,6 +168,7 @@ 1 8 0x20000408 + 0 @@ -169,6 +176,7 @@ 2 8 0x8004dc8 + 0 @@ -232,8 +240,8 @@ 0 0 0 - .\benchmark.c - benchmark.c + .\time-CortexM3-4.c + time-CortexM3-4.c 0 0 @@ -266,8 +274,8 @@ 0 0 0 - .\RTE\wolfSSL\settings.h - settings.h + .\RTE\wolfSSL\user_settings.h + user_settings.h 0 0 @@ -294,72 +302,28 @@ - - Devices - 1 - 0 - 0 - 0 - - 4 - 6 - 1 - 0 - 0 - 0 - 0 - .\time-CortexM3-4.c - time-CortexM3-4.c - 0 - 0 - - - 4 - 7 - 1 - 0 - 0 - 0 - 0 - .\time-dummy.c - time-dummy.c - 0 - 0 - - - ::CMSIS 1 0 0 1 - - 5 - 8 - 1 - 0 - 0 - 0 - 0 - RTE\CMSIS\RTX_Conf_CM.c - RTX_Conf_CM.c - 1 - 0 - - - 5 - 9 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - RTX_CM3.lib - 1 - 0 - + + + + ::CMSIS Driver + 1 + 0 + 0 + 1 + + + + ::Compiler + 1 + 0 + 0 + 1 @@ -368,628 +332,22 @@ 0 0 1 - - 6 - 10 - 5 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\RTE_Device.h - RTE_Device.h - 1 - 0 - - - 6 - 11 - 2 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - startup_stm32f2xx.s - 1 - 0 - - - 6 - 12 - 1 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\system_stm32f2xx.c - system_stm32f2xx.c - 1 - 0 - - - 6 - 13 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - DMA_STM32F2xx.c - 1 - 0 - - - 6 - 14 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - GPIO_STM32F2xx.c - 1 - 0 - - - - - ::Drivers - 0 - 0 - 0 - 1 - - 7 - 15 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - MCI_STM32F2xx.c - 1 - 0 - ::File System - 0 + 1 0 0 1 - - 8 - 16 - 1 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config.c - FS_Config.c - 1 - 0 - - - 8 - 17 - 5 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config_MC_0.h - FS_Config_MC_0.h - 1 - 0 - - - 8 - 18 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - FS_LFN_CM3_L.lib - 1 - 0 - ::wolfSSL - 0 + 1 0 0 1 - - 9 - 19 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 1 - 0 - - - 9 - 20 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\settings.h - settings.h - 1 - 0 - - - 9 - 21 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - cyassl_MDK_ARM.c - 1 - 0 - - - 9 - 22 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\ssl-dummy.c - ssl-dummy.c - 1 - 0 - - - 9 - 23 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - aes.c - 1 - 0 - - - 9 - 24 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - arc4.c - 1 - 0 - - - 9 - 25 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - asm.c - 1 - 0 - - - 9 - 26 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - asn.c - 1 - 0 - - - 9 - 27 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - blake2b.c - 1 - 0 - - - 9 - 28 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - camellia.c - 1 - 0 - - - 9 - 29 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - coding.c - 1 - 0 - - - 9 - 30 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - compress.c - 1 - 0 - - - 9 - 31 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - des3.c - 1 - 0 - - - 9 - 32 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - dh.c - 1 - 0 - - - 9 - 33 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - dsa.c - 1 - 0 - - - 9 - 34 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - ecc.c - 1 - 0 - - - 9 - 35 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - ecc_fp.c - 1 - 0 - - - 9 - 36 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - error.c - 1 - 0 - - - 9 - 37 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - hc128.c - 1 - 0 - - - 9 - 38 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - hmac.c - 1 - 0 - - - 9 - 39 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - integer.c - 1 - 0 - - - 9 - 40 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - logging.c - 1 - 0 - - - 9 - 41 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - md2.c - 1 - 0 - - - 9 - 42 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - md4.c - 1 - 0 - - - 9 - 43 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - md5.c - 1 - 0 - - - 9 - 44 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - memory.c - 1 - 0 - - - 9 - 45 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - misc.c - 1 - 0 - - - 9 - 46 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - pwdbased.c - 1 - 0 - - - 9 - 47 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - rabbit.c - 1 - 0 - - - 9 - 48 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - random.c - 1 - 0 - - - 9 - 49 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - ripemd.c - 1 - 0 - - - 9 - 50 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - rsa.c - 1 - 0 - - - 9 - 51 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - sha.c - 1 - 0 - - - 9 - 52 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - sha256.c - 1 - 0 - - - 9 - 53 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - sha512.c - 1 - 0 - - - 9 - 54 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - tfm.c - 1 - 0 - - - 9 - 55 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - wc_port.c - 1 - 0 - diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx index 02f337fd2..caf784195 100644 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx +++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx @@ -12,14 +12,16 @@ ARM-ADS - STM32F207IG + STM32F207IGHx STMicroelectronics - IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE + Keil.STM32F2xx_DFP.2.2.0 + http://www.keil.com/pack + IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) 0 - $$Device:STM32F207IG$Device\Include\stm32f2xx.h + $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h @@ -29,7 +31,7 @@ - $$Device:STM32F207IG$SVD\STM32F20x.svd + $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd 0 0 @@ -143,10 +145,9 @@ 1 1 1 - 1 0 - 8 + 1 @@ -160,7 +161,7 @@ .\STM32_SWO.ini - BIN\ULP2CM3.DLL + BIN\UL2CM3.DLL @@ -173,8 +174,8 @@ 4100 1 - BIN\ULP2CM3.DLL - "" () + BIN\UL2CM3.DLL + @@ -362,7 +363,7 @@ 0 - HAVE_CONFIG_H MDK_CONF_Benchmark + HAVE_CONFIG_H MDK_CONF_Benchmark WOLFSSL_USER_SETTINGS @@ -413,9 +414,9 @@ .\main.c - benchmark.c + time-CortexM3-4.c 1 - .\benchmark.c + .\time-CortexM3-4.c @@ -428,9 +429,9 @@ .\RTE\wolfSSL\config-Crypt.h - settings.h + user_settings.h 5 - .\RTE\wolfSSL\settings.h + .\RTE\wolfSSL\user_settings.h @@ -445,395 +446,166 @@ - Devices - - - time-CortexM3-4.c - 1 - .\time-CortexM3-4.c - - - time-dummy.c - 1 - .\time-dummy.c - - + ::CMSIS - ::CMSIS - - - RTX_Conf_CM.c - 1 - RTE\CMSIS\RTX_Conf_CM.c - - - RTX_CM3.lib - 4 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - - + ::CMSIS Driver + + + ::Compiler ::Device - - - RTE_Device.h - 5 - RTE\Device\STM32F207IG\RTE_Device.h - - - startup_stm32f2xx.s - 2 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - system_stm32f2xx.c - 1 - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - DMA_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - - - GPIO_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - - - - - ::Drivers - - - MCI_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - - ::File System - - - FS_Config.c - 1 - RTE\File_System\FS_Config.c - - - FS_Config_MC_0.h - 5 - RTE\File_System\FS_Config_MC_0.h - - - FS_LFN_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - - ::wolfSSL - - - config-Crypt.h - 5 - RTE\wolfSSL\config-Crypt.h - - - settings.h - 5 - RTE\wolfSSL\settings.h - - - cyassl_MDK_ARM.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - - - ssl-dummy.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\ssl-dummy.c - - - aes.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - - - arc4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - - - asm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - - - asn.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - - - blake2b.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - - - camellia.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - - - coding.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - - - compress.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - - - des3.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - - - dh.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - - - dsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - - - ecc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - - - ecc_fp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - - - error.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - - - hc128.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - - - hmac.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - - - integer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - - - logging.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - - - md2.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - - - md4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - - - md5.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - - - memory.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - - - misc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - - - pwdbased.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - - - rabbit.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - - - random.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - - - ripemd.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - - - rsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - - - sha.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - - - sha256.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - - - sha512.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - - - tfm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - - - wc_port.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + RTE\CMSIS\RTX_Conf_CM.c @@ -841,42 +613,80 @@ - - RTE\Device\STM32F207IG\RTE_Device.h - - + + RTE\Device\STM32F207IGHx\RTE_Device.h + + + + RTE\Device\STM32F207IGHx\startup_stm32f207xx.s + + + + + + + + RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h + + + + + + + + RTE\Device\STM32F207IGHx\system_stm32f2xx.c + + + + + + + + RTE\Device\STM32F207IG\RTE_Device.h + + + + + + RTE\Device\STM32F207IG\startup_stm32f207xx.s + + + + - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - + RTE\Device\STM32F207IG\startup_stm32f2xx.s + + + - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - + + RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h + + + - + + RTE\Device\STM32F207IG\system_stm32f2xx.c + + + + + RTE\File_System\FS_Config.c - - + + - + RTE\File_System\FS_Config_MC_0.h - - + + @@ -947,24 +757,30 @@ - + RTE\wolfSSL\config-Crypt.h - - + + RTE\wolfSSL\config.h - + - - RTE\wolfSSL\settings.h - - + + RTE\wolfSSL\settings.h + + + + + + RTE\wolfSSL\user_settings.h + + diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/benchmark.c b/IDE/MDK5-ARM/Projects/CryptBenchmark/benchmark.c deleted file mode 100644 index 9ee281329..000000000 --- a/IDE/MDK5-ARM/Projects/CryptBenchmark/benchmark.c +++ /dev/null @@ -1,1313 +0,0 @@ -/* benchmark.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 - */ - -/* CTaoCrypt benchmark */ - -#ifdef HAVE_CONFIG_H - #include -#endif - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#ifdef HAVE_CAVIUM - #include "cavium_sysdep.h" - #include "cavium_common.h" - #include "cavium_ioctl.h" -#endif -#ifdef HAVE_NTRU - #include "libntruencrypt/ntru_crypto.h" -#endif - -#if defined(CYASSL_MDK_ARM) - extern FILE * CyaSSL_fopen(const char *fname, const char *mode) ; - #define fopen CyaSSL_fopen -#endif - -#if defined(USE_CERT_BUFFERS_1024) || defined(USE_CERT_BUFFERS_2048) - /* include test cert and key buffers for use with NO_FILESYSTEM */ - #if defined(CYASSL_MDK_ARM) - #include "cert_data.h" /* use certs_test.c for initial data, - so other commands can share the data. */ - #else - #include - #endif -#endif - - -#ifdef HAVE_BLAKE2 - #include - void bench_blake2(void); -#endif - -#ifdef _MSC_VER - /* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */ - #pragma warning(disable: 4996) -#endif - -void bench_des(void); -void bench_arc4(void); -void bench_hc128(void); -void bench_rabbit(void); -void bench_aes(int); -void bench_aesgcm(void); -void bench_aesccm(void); -void bench_aesctr(void); -void bench_camellia(void); - -void bench_md5(void); -void bench_sha(void); -void bench_sha256(void); -void bench_sha512(void); -void bench_ripemd(void); - -void bench_rsa(void); -void bench_rsaKeyGen(void); -void bench_dh(void); -#ifdef HAVE_ECC -void bench_eccKeyGen(void); -void bench_eccKeyAgree(void); -#endif -#ifdef HAVE_NTRU -void bench_ntruKeyGen(void); -#endif - -double current_time(int); - - -#ifdef HAVE_CAVIUM - -static int OpenNitroxDevice(int dma_mode,int dev_id) -{ - Csp1CoreAssignment core_assign; - Uint32 device; - - if (CspInitialize(CAVIUM_DIRECT,CAVIUM_DEV_ID)) - return -1; - if (Csp1GetDevType(&device)) - return -1; - if (device != NPX_DEVICE) { - if (ioctl(gpkpdev_hdlr[CAVIUM_DEV_ID], IOCTL_CSP1_GET_CORE_ASSIGNMENT, - (Uint32 *)&core_assign)!= 0) - return -1; - } - CspShutdown(CAVIUM_DEV_ID); - - return CspInitialize(dma_mode, dev_id); -} - -#endif - -#if defined(DEBUG_CYASSL) && !defined(HAVE_VALGRIND) - CYASSL_API int CyaSSL_Debugging_ON(); -#endif - -/* so embedded projects can pull in tests on their own */ -#if !defined(NO_MAIN_DRIVER) - -int main(int argc, char** argv) - -{ - (void)argc; - (void)argv; -#else -int benchmark_test(void *args) -{ -#endif - - #if defined(DEBUG_CYASSL) && !defined(HAVE_VALGRIND) - CyaSSL_Debugging_ON(); - #endif - - #ifdef HAVE_CAVIUM - int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); - if (ret != 0) { - printf("Cavium OpenNitroxDevice failed\n"); - exit(-1); - } -#endif /* HAVE_CAVIUM */ -#ifndef NO_AES - bench_aes(0); - bench_aes(1); -#endif -#ifdef HAVE_AESGCM - bench_aesgcm(); -#endif - -#ifdef CYASSL_AES_COUNTER - bench_aesctr(); -#endif - -#ifdef HAVE_AESCCM - bench_aesccm(); -#endif -#ifdef HAVE_CAMELLIA - bench_camellia(); -#endif -#ifndef NO_RC4 - bench_arc4(); -#endif -#ifdef HAVE_HC128 - bench_hc128(); -#endif -#ifndef NO_RABBIT - bench_rabbit(); -#endif -#ifndef NO_DES3 - bench_des(); -#endif - - printf("\n"); - -#ifndef NO_MD5 - bench_md5(); -#endif -#ifndef NO_SHA - bench_sha(); -#endif -#ifndef NO_SHA256 - bench_sha256(); -#endif -#ifdef CYASSL_SHA512 - bench_sha512(); -#endif -#ifdef CYASSL_RIPEMD - bench_ripemd(); -#endif -#ifdef HAVE_BLAKE2 - bench_blake2(); -#endif - - printf("\n"); - -#ifndef NO_RSA - bench_rsa(); -#endif - -#ifndef NO_DH - bench_dh(); -#endif - -#if defined(CYASSL_KEY_GEN) && !defined(NO_RSA) - bench_rsaKeyGen(); -#endif - -#ifdef HAVE_NTRU - bench_ntruKeyGen(); -#endif - -#ifdef HAVE_ECC - bench_eccKeyGen(); - bench_eccKeyAgree(); -#endif - - return 0; -} - - -#ifdef BENCH_EMBEDDED -enum BenchmarkBounds { - numBlocks = 25, /* how many kB to test (en/de)cryption */ - ntimes = 1, - genTimes = 5, /* public key iterations */ - agreeTimes = 5 -}; -static const char blockType[] = "kB"; /* used in printf output */ -#else -enum BenchmarkBounds { - numBlocks = 5, /* how many megs to test (en/de)cryption */ - ntimes = 100, - genTimes = 100, - agreeTimes = 100 -}; -static const char blockType[] = "megs"; /* used in printf output */ -#endif - - -/* use kB instead of mB for embedded benchmarking */ -#ifdef BENCH_EMBEDDED -static byte plain [1024]; -#else -static byte plain [1024*1024]; -#endif - - -#ifndef NO_AES - -static const byte key[] = -{ - 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef, - 0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10, - 0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 -}; - -static const byte iv[] = -{ - 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef, - 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, - 0x11,0x21,0x31,0x41,0x51,0x61,0x71,0x81 - -}; - - -/* use kB instead of mB for embedded benchmarking */ -#ifdef BENCH_EMBEDDED -static byte cipher[1024]; -#else -static byte cipher[1024*1024]; -#endif - - -void bench_aes(int show) -{ - Aes enc; - double start, total, persec; - int i; - int ret; - -#ifdef HAVE_CAVIUM - if (AesInitCavium(&enc, CAVIUM_DEV_ID) != 0) { - printf("aes init cavium failed\n"); - return; - } -#endif - - ret = AesSetKey(&enc, key, 16, iv, AES_ENCRYPTION); - if (ret != 0) { - printf("AesSetKey failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - AesCbcEncrypt(&enc, plain, cipher, sizeof(plain)); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - if (show) - printf("AES %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -#ifdef HAVE_CAVIUM - AesFreeCavium(&enc); -#endif -} -#endif - - -#if defined(HAVE_AESGCM) || defined(HAVE_AESCCM) - static byte additional[13]; - static byte tag[16]; -#endif - - -#ifdef HAVE_AESGCM -void bench_aesgcm(void) -{ - Aes enc; - double start, total, persec; - int i; - - AesGcmSetKey(&enc, key, 16); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - AesGcmEncrypt(&enc, cipher, plain, sizeof(plain), iv, 12, - tag, 16, additional, 13); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("AES-GCM %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - -#ifdef CYASSL_AES_COUNTER -void bench_aesctr(void) -{ - Aes enc; - double start, total, persec; - int i; - - AesSetKeyDirect(&enc, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - AesCtrEncrypt(&enc, plain, cipher, sizeof(plain)); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("AES-CTR %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - - -#ifdef HAVE_AESCCM -void bench_aesccm(void) -{ - Aes enc; - double start, total, persec; - int i; - - AesCcmSetKey(&enc, key, 16); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - AesCcmEncrypt(&enc, cipher, plain, sizeof(plain), iv, 12, - tag, 16, additional, 13); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("AES-CCM %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - -#ifdef HAVE_CAMELLIA -void bench_camellia(void) -{ - Camellia cam; - double start, total, persec; - int i, ret; - - ret = CamelliaSetKey(&cam, key, 16, iv); - if (ret != 0) { - printf("CamelliaSetKey failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - CamelliaCbcEncrypt(&cam, plain, cipher, sizeof(plain)); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("Camellia %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - -#ifndef NO_DES3 -void bench_des(void) -{ - Des3 enc; - double start, total, persec; - int i, ret; - -#ifdef HAVE_CAVIUM - if (Des3_InitCavium(&enc, CAVIUM_DEV_ID) != 0) - printf("des3 init cavium failed\n"); -#endif - ret = Des3_SetKey(&enc, key, iv, DES_ENCRYPTION); - if (ret != 0) { - printf("Des3_SetKey failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - Des3_CbcEncrypt(&enc, plain, cipher, sizeof(plain)); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("3DES %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -#ifdef HAVE_CAVIUM - Des3_FreeCavium(&enc); -#endif -} -#endif - - -#ifndef NO_RC4 -void bench_arc4(void) -{ - Arc4 enc; - double start, total, persec; - int i; - -#ifdef HAVE_CAVIUM - if (Arc4InitCavium(&enc, CAVIUM_DEV_ID) != 0) - printf("arc4 init cavium failed\n"); -#endif - - Arc4SetKey(&enc, key, 16); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - Arc4Process(&enc, cipher, plain, sizeof(plain)); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("ARC4 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -#ifdef HAVE_CAVIUM - Arc4FreeCavium(&enc); -#endif -} -#endif - - -#ifdef HAVE_HC128 -void bench_hc128(void) -{ - HC128 enc; - double start, total, persec; - int i; - - Hc128_SetKey(&enc, key, iv); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - Hc128_Process(&enc, cipher, plain, sizeof(plain)); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("HC128 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif /* HAVE_HC128 */ - - -#ifndef NO_RABBIT -void bench_rabbit(void) -{ - Rabbit enc; - double start, total, persec; - int i; - - RabbitSetKey(&enc, key, iv); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - RabbitProcess(&enc, cipher, plain, sizeof(plain)); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("RABBIT %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif /* NO_RABBIT */ - - -#ifndef NO_MD5 -void bench_md5(void) -{ - Md5 hash; - byte digest[MD5_DIGEST_SIZE]; - double start, total, persec; - int i; - - InitMd5(&hash); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - Md5Update(&hash, plain, sizeof(plain)); - - Md5Final(&hash, digest); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("MD5 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif /* NO_MD5 */ - - -#ifndef NO_SHA -void bench_sha(void) -{ - Sha hash; - byte digest[SHA_DIGEST_SIZE]; - double start, total, persec; - int i, ret; - - ret = InitSha(&hash); - if (ret != 0) { - printf("InitSha failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - ShaUpdate(&hash, plain, sizeof(plain)); - - ShaFinal(&hash, digest); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("SHA %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif /* NO_SHA */ - - -#ifndef NO_SHA256 -void bench_sha256(void) -{ - Sha256 hash; - byte digest[SHA256_DIGEST_SIZE]; - double start, total, persec; - int i, ret; - - ret = InitSha256(&hash); - if (ret != 0) { - printf("InitSha256 failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) { - ret = Sha256Update(&hash, plain, sizeof(plain)); - if (ret != 0) { - printf("Sha256Update failed, ret = %d\n", ret); - return; - } - } - - ret = Sha256Final(&hash, digest); - if (ret != 0) { - printf("Sha256Final failed, ret = %d\n", ret); - return; - } - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("SHA-256 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - -#ifdef CYASSL_SHA512 -void bench_sha512(void) -{ - Sha512 hash; - byte digest[SHA512_DIGEST_SIZE]; - double start, total, persec; - int i, ret; - - ret = InitSha512(&hash); - if (ret != 0) { - printf("InitSha512 failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) { - ret = Sha512Update(&hash, plain, sizeof(plain)); - if (ret != 0) { - printf("Sha512Update failed, ret = %d\n", ret); - return; - } - } - - ret = Sha512Final(&hash, digest); - if (ret != 0) { - printf("Sha512Final failed, ret = %d\n", ret); - return; - } - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("SHA-512 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - -#ifdef CYASSL_RIPEMD -void bench_ripemd(void) -{ - RipeMd hash; - byte digest[RIPEMD_DIGEST_SIZE]; - double start, total, persec; - int i; - - InitRipeMd(&hash); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - RipeMdUpdate(&hash, plain, sizeof(plain)); - - RipeMdFinal(&hash, digest); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("RIPEMD %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - -#ifdef HAVE_BLAKE2 -void bench_blake2(void) -{ - Blake2b b2b; - byte digest[64]; - double start, total, persec; - int i, ret; - - ret = InitBlake2b(&b2b, 64); - if (ret != 0) { - printf("InitBlake2b failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) { - ret = Blake2bUpdate(&b2b, plain, sizeof(plain)); - if (ret != 0) { - printf("Blake2bUpdate failed, ret = %d\n", ret); - return; - } - } - - ret = Blake2bFinal(&b2b, digest, 64); - if (ret != 0) { - printf("Blake2bFinal failed, ret = %d\n", ret); - return; - } - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("BLAKE2b %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - -#if !defined(NO_RSA) || !defined(NO_DH) \ - || defined(CYASSL_KEYGEN) || defined(HAVE_ECC) -static WC_RNG rng; -#endif - -#ifndef NO_RSA - - -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) - #if defined(CYASSL_MDK_SHELL) - static char *certRSAname = "certs/rsa2048.der"; - /* set by shell command */ - static void set_Bench_RSA_File(char * cert) { certRSAname = cert ; } - #else - static const char *certRSAname = "certs/rsa2048.der"; - #endif -#endif - -void bench_rsa(void) -{ - int i; - int ret; - byte tmp[3072]; - size_t bytes; - word32 idx = 0; - - byte message[] = "Everyone gets Friday off."; - byte enc[512]; /* for up to 4096 bit */ - const int len = (int)strlen((char*)message); - double start, total, each, milliEach; - - RsaKey rsaKey; - int rsaKeySz = 2048; /* used in printf */ - -#ifdef USE_CERT_BUFFERS_1024 - XMEMCPY(tmp, rsa_key_der_1024, sizeof_rsa_key_der_1024); - bytes = sizeof_rsa_key_der_1024; - rsaKeySz = 1024; -#elif defined(USE_CERT_BUFFERS_2048) - XMEMCPY(tmp, rsa_key_der_2048, sizeof_rsa_key_der_2048); - bytes = sizeof_rsa_key_der_2048; -#else - FILE* file = fopen(certRSAname, "rb"); - - if (!file) { - printf("can't find %s, Please run from CyaSSL home dir\n", certRSAname); - return; - } - - bytes = fread(tmp, 1, sizeof(tmp), file); - fclose(file); -#endif /* USE_CERT_BUFFERS */ - - -#ifdef HAVE_CAVIUM - if (RsaInitCavium(&rsaKey, CAVIUM_DEV_ID) != 0) - printf("RSA init cavium failed\n"); -#endif - ret = InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } - ret = InitRsaKey(&rsaKey, 0); - if (ret < 0) { - printf("InitRsaKey failed\n"); - return; - } - ret = RsaPrivateKeyDecode(tmp, &idx, &rsaKey, (word32)bytes); - - start = current_time(1); - - for (i = 0; i < ntimes; i++) - ret = RsaPublicEncrypt(message,len,enc,sizeof(enc), &rsaKey, &rng); - - total = current_time(0) - start; - each = total / ntimes; /* per second */ - milliEach = each * 1000; /* milliseconds */ - - printf("RSA %d encryption took %6.3f milliseconds, avg over %d" - " iterations\n", rsaKeySz, milliEach, ntimes); - - if (ret < 0) { - printf("Rsa Public Encrypt failed\n"); - return; - } - - start = current_time(1); - - for (i = 0; i < ntimes; i++) { - byte out[512]; /* for up to 4096 bit */ - RsaPrivateDecrypt(enc, (word32)ret, out, sizeof(out), &rsaKey); - } - - total = current_time(0) - start; - each = total / ntimes; /* per second */ - milliEach = each * 1000; /* milliseconds */ - - printf("RSA %d decryption took %6.3f milliseconds, avg over %d" - " iterations\n", rsaKeySz, milliEach, ntimes); - - FreeRsaKey(&rsaKey); -#ifdef HAVE_CAVIUM - RsaFreeCavium(&rsaKey); -#endif -} -#endif - - -#ifndef NO_DH - - -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) - #if defined(CYASSL_MDK_SHELL) - static char *certDHname = "certs/dh2048.der"; - /* set by shell command */ - void set_Bench_DH_File(char * cert) { certDHname = cert ; } - #else - static const char *certDHname = "certs/dh2048.der"; - #endif -#endif - -void bench_dh(void) -{ -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) - int ret; -#endif - int i ; - byte tmp[1024]; - size_t bytes; - word32 idx = 0, pubSz, privSz = 0, pubSz2, privSz2, agreeSz; - - byte pub[256]; /* for 2048 bit */ - byte priv[256]; /* for 2048 bit */ - byte pub2[256]; /* for 2048 bit */ - byte priv2[256]; /* for 2048 bit */ - byte agree[256]; /* for 2048 bit */ - - double start, total, each, milliEach; - DhKey dhKey; - int dhKeySz = 2048; /* used in printf */ - - -#ifdef USE_CERT_BUFFERS_1024 - XMEMCPY(tmp, dh_key_der_1024, sizeof_dh_key_der_1024); - bytes = sizeof_dh_key_der_1024; - dhKeySz = 1024; -#elif defined(USE_CERT_BUFFERS_2048) - XMEMCPY(tmp, dh_key_der_2048, sizeof_dh_key_der_2048); - bytes = sizeof_dh_key_der_2048; -#else - FILE* file = fopen(certDHname, "rb"); - - if (!file) { - printf("can't find %s, Please run from CyaSSL home dir\n", certDHname); - return; - } - - ret = InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } - bytes = fread(tmp, 1, sizeof(tmp), file); -#endif /* USE_CERT_BUFFERS */ - - - InitDhKey(&dhKey); - bytes = DhKeyDecode(tmp, &idx, &dhKey, (word32)bytes); - if (bytes != 0) { - printf("dhekydecode failed, can't benchmark\n"); - #if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) - fclose(file); - #endif - return; - } - - start = current_time(1); - - for (i = 0; i < ntimes; i++) - DhGenerateKeyPair(&dhKey, &rng, priv, &privSz, pub, &pubSz); - - total = current_time(0) - start; - each = total / ntimes; /* per second */ - milliEach = each * 1000; /* milliseconds */ - - printf("DH %d key generation %6.3f milliseconds, avg over %d" - " iterations\n", dhKeySz, milliEach, ntimes); - - DhGenerateKeyPair(&dhKey, &rng, priv2, &privSz2, pub2, &pubSz2); - start = current_time(1); - - for (i = 0; i < ntimes; i++) - DhAgree(&dhKey, agree, &agreeSz, priv, privSz, pub2, pubSz2); - - total = current_time(0) - start; - each = total / ntimes; /* per second */ - milliEach = each * 1000; /* milliseconds */ - - printf("DH %d key agreement %6.3f milliseconds, avg over %d" - " iterations\n", dhKeySz, milliEach, ntimes); - -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) - fclose(file); -#endif - FreeDhKey(&dhKey); -} -#endif - -#if defined(CYASSL_KEY_GEN) && !defined(NO_RSA) -void bench_rsaKeyGen(void) -{ - RsaKey genKey; - double start, total, each, milliEach; - int i; - - /* 1024 bit */ - start = current_time(1); - - for(i = 0; i < genTimes; i++) { - InitRsaKey(&genKey, 0); - MakeRsaKey(&genKey, 1024, 65537, &rng); - FreeRsaKey(&genKey); - } - - total = current_time(0) - start; - each = total / genTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("\n"); - printf("RSA 1024 key generation %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, genTimes); - - /* 2048 bit */ - start = current_time(1); - - for(i = 0; i < genTimes; i++) { - InitRsaKey(&genKey, 0); - MakeRsaKey(&genKey, 2048, 65537, &rng); - FreeRsaKey(&genKey); - } - - total = current_time(0) - start; - each = total / genTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("RSA 2048 key generation %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, genTimes); -} -#endif /* CYASSL_KEY_GEN */ -#ifdef HAVE_NTRU -byte GetEntropy(ENTROPY_CMD cmd, byte* out); - -byte GetEntropy(ENTROPY_CMD cmd, byte* out) -{ - if (cmd == INIT) - return (InitRng(&rng) == 0) ? 1 : 0; - - if (out == NULL) - return 0; - - if (cmd == GET_BYTE_OF_ENTROPY) - return (RNG_GenerateBlock(&rng, out, 1) == 0) ? 1 : 0; - - if (cmd == GET_NUM_BYTES_PER_BYTE_OF_ENTROPY) { - *out = 1; - return 1; - } - - return 0; -} -void bench_ntruKeyGen(void) -{ - double start, total, each, milliEach; - int i; - - byte public_key[557]; /* 2048 key equivalent to rsa */ - word16 public_key_len = sizeof(public_key); - byte private_key[607]; - word16 private_key_len = sizeof(private_key); - - DRBG_HANDLE drbg; - static uint8_t const pers_str[] = { - 'C', 'y', 'a', 'S', 'S', 'L', ' ', 't', 'e', 's', 't' - }; - - word32 rc = ntru_crypto_drbg_instantiate(112, pers_str, sizeof(pers_str), - GetEntropy, &drbg); - if(rc != DRBG_OK) { - printf("NTRU drbg instantiate failed\n"); - return; - } - - start = current_time(1); - - for(i = 0; i < genTimes; i++) { - ntru_crypto_ntru_encrypt_keygen(drbg, NTRU_EES401EP2, &public_key_len, - public_key, &private_key_len, private_key); - } - - total = current_time(0) - start; - - rc = ntru_crypto_drbg_uninstantiate(drbg); - - if (rc != NTRU_OK) { - printf("NTRU drbg uninstantiate failed\n"); - return; - } - - each = total / genTimes; - milliEach = each * 1000; - - printf("\n"); - printf("NTRU 112 key generation %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, genTimes); - -} -#endif - -#ifdef HAVE_ECC -void bench_eccKeyGen(void) -{ - ecc_key genKey; - double start, total, each, milliEach; - int i, ret; - - ret = InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } - /* 256 bit */ - start = current_time(1); - - for(i = 0; i < genTimes; i++) { - ecc_make_key(&rng, 32, &genKey); - ecc_free(&genKey); - } - - total = current_time(0) - start; - each = total / genTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("\n"); - printf("ECC 256 key generation %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, genTimes); -} - - -void bench_eccKeyAgree(void) -{ - ecc_key genKey, genKey2; - double start, total, each, milliEach; - int i, ret; - byte shared[1024]; - byte sig[1024]; - byte digest[32]; - word32 x = 0; - - ecc_init(&genKey); - ecc_init(&genKey2); - - ret = InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } - - ret = ecc_make_key(&rng, 32, &genKey); - if (ret != 0) { - printf("ecc_make_key failed\n"); - return; - } - ret = ecc_make_key(&rng, 32, &genKey2); - if (ret != 0) { - printf("ecc_make_key failed\n"); - return; - } - - /* 256 bit */ - start = current_time(1); - - for(i = 0; i < agreeTimes; i++) { - x = sizeof(shared); - ret = ecc_shared_secret(&genKey, &genKey2, shared, &x); - if (ret != 0) { - printf("ecc_shared_secret failed\n"); - return; - } - } - - total = current_time(0) - start; - each = total / agreeTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("EC-DHE key agreement %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, agreeTimes); - - /* make dummy digest */ - for (i = 0; i < (int)sizeof(digest); i++) - digest[i] = (byte)i; - - - start = current_time(1); - - for(i = 0; i < agreeTimes; i++) { - x = sizeof(sig); - ret = ecc_sign_hash(digest, sizeof(digest), sig, &x, &rng, &genKey); - if (ret != 0) { - printf("ecc_sign_hash failed\n"); - return; - } - } - - total = current_time(0) - start; - each = total / agreeTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("EC-DSA sign time %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, agreeTimes); - - start = current_time(1); - - for(i = 0; i < agreeTimes; i++) { - int verify = 0; - ret = ecc_verify_hash(sig, x, digest, sizeof(digest), &verify, &genKey); - if (ret != 0) { - printf("ecc_verify_hash failed\n"); - return; - } - } - - total = current_time(0) - start; - each = total / agreeTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("EC-DSA verify time %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, agreeTimes); - - ecc_free(&genKey2); - ecc_free(&genKey); -} -#endif /* HAVE_ECC */ - -#ifdef _WIN32 - - #define WIN32_LEAN_AND_MEAN - #include - - double current_time(int reset) - { - static int init = 0; - static LARGE_INTEGER freq; - - LARGE_INTEGER count; - - (void)reset; - - if (!init) { - QueryPerformanceFrequency(&freq); - init = 1; - } - - QueryPerformanceCounter(&count); - - return (double)count.QuadPart / freq.QuadPart; - } - -#elif defined MICROCHIP_PIC32 - #if defined(CYASSL_MICROCHIP_PIC32MZ) - #define CLOCK 80000000.0 - #else - #include - #define CLOCK 40000000.0 - #endif - - double current_time(int reset) - { - unsigned int ns; - - if (reset) { - WriteCoreTimer(0); - } - - /* get timer in ns */ - ns = ReadCoreTimer(); - - /* return seconds as a double */ - return ( ns / CLOCK * 2.0); - } - -#elif defined(CYASSL_IAR_ARM) || defined (CYASSL_MDK_ARM) - -#elif defined FREERTOS - - double current_time(int reset) - { - (void) reset; - - portTickType tickCount; - - /* tick count == ms, if configTICK_RATE_HZ is set to 1000 */ - tickCount = xTaskGetTickCount(); - return (double)tickCount / 1000; - } - -#else - - #include - - double current_time(int reset) - { - struct timeval tv; - - (void)reset; - - gettimeofday(&tv, 0); - - return (double)tv.tv_sec + (double)tv.tv_usec / 1000000; - } - -#endif /* _WIN32 */ diff --git a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx index d308da438..f0f9517f4 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx +++ b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx @@ -13,6 +13,7 @@ *.txt; *.h; *.inc *.plm *.cpp + 0 @@ -25,12 +26,13 @@ 0x4 ARM-ADS - 120000000 + 12000000 1 1 0 1 + 0 1 @@ -75,17 +77,17 @@ 0 1 - 255 + 18 0 Schematics (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf 1 User Manual (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm 2 @@ -113,10 +115,9 @@ 1 1 1 - 1 0 0 - 8 + 1 @@ -127,13 +128,18 @@ .\STM32_SWO.ini - BIN\ULP2CM3.DLL + BIN\UL2CM3.DLL + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + 0 DLGUARM - + (105=-1,-1,-1,-1,0) 0 @@ -148,12 +154,12 @@ 0 ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO3 -TC10000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) + -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO7 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) 0 UL2CM3 - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) @@ -161,7 +167,8 @@ 1 8 - 0x20000408 + clientKey + 0 @@ -169,6 +176,7 @@ 2 8 0x8004dc8 + 0 @@ -224,45 +232,6 @@ 0 0 - - 1 - 2 - 1 - 0 - 0 - 0 - 0 - .\test.c - test.c - 0 - 0 - - - 1 - 3 - 1 - 0 - 0 - 0 - 0 - .\cert_data.c - cert_data.c - 0 - 0 - - - 1 - 4 - 1 - 0 - 0 - 0 - 0 - .\time-dummy.c - time-dummy.c - 0 - 0 - @@ -273,7 +242,7 @@ 0 2 - 5 + 2 5 0 0 @@ -286,14 +255,14 @@ 2 - 6 + 3 5 0 0 0 0 - .\RTE\wolfSSL\settings.h - settings.h + .\RTE\wolfSSL\user_settings.h + user_settings.h 0 0 @@ -301,13 +270,13 @@ Documentation - 0 + 1 0 0 0 3 - 7 + 4 5 0 0 @@ -326,32 +295,22 @@ 0 0 1 - - 4 - 8 - 1 - 0 - 0 - 0 - 0 - RTE\CMSIS\RTX_Conf_CM.c - RTX_Conf_CM.c - 1 - 0 - - - 4 - 9 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - RTX_CM3.lib - 1 - 0 - + + + + ::CMSIS Driver + 1 + 0 + 0 + 1 + + + + ::Compiler + 1 + 0 + 0 + 1 @@ -360,92 +319,6 @@ 0 0 1 - - 5 - 10 - 5 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\RTE_Device.h - RTE_Device.h - 1 - 0 - - - 5 - 11 - 2 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - startup_stm32f2xx.s - 1 - 0 - - - 5 - 12 - 1 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\system_stm32f2xx.c - system_stm32f2xx.c - 1 - 0 - - - 5 - 13 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - DMA_STM32F2xx.c - 1 - 0 - - - 5 - 14 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - GPIO_STM32F2xx.c - 1 - 0 - - - - - ::Drivers - 1 - 0 - 0 - 1 - - 6 - 15 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - MCI_STM32F2xx.c - 1 - 0 - @@ -454,534 +327,14 @@ 0 0 1 - - 7 - 16 - 1 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config.c - FS_Config.c - 1 - 0 - - - 7 - 17 - 5 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config_MC_0.h - FS_Config_MC_0.h - 1 - 0 - - - 7 - 18 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - FS_LFN_CM3_L.lib - 1 - 0 - ::wolfSSL - 0 + 1 0 0 1 - - 8 - 19 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 1 - 0 - - - 8 - 20 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\settings.h - settings.h - 1 - 0 - - - 8 - 21 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - cyassl_MDK_ARM.c - 1 - 0 - - - 8 - 22 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\ssl-dummy.c - ssl-dummy.c - 1 - 0 - - - 8 - 23 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - aes.c - 1 - 0 - - - 8 - 24 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - arc4.c - 1 - 0 - - - 8 - 25 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - asm.c - 1 - 0 - - - 8 - 26 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - asn.c - 1 - 0 - - - 8 - 27 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - blake2b.c - 1 - 0 - - - 8 - 28 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - camellia.c - 1 - 0 - - - 8 - 29 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - coding.c - 1 - 0 - - - 8 - 30 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - compress.c - 1 - 0 - - - 8 - 31 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - des3.c - 1 - 0 - - - 8 - 32 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - dh.c - 1 - 0 - - - 8 - 33 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - dsa.c - 1 - 0 - - - 8 - 34 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - ecc.c - 1 - 0 - - - 8 - 35 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - ecc_fp.c - 1 - 0 - - - 8 - 36 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - error.c - 1 - 0 - - - 8 - 37 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - hc128.c - 1 - 0 - - - 8 - 38 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - hmac.c - 1 - 0 - - - 8 - 39 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - integer.c - 1 - 0 - - - 8 - 40 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - logging.c - 1 - 0 - - - 8 - 41 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - md2.c - 1 - 0 - - - 8 - 42 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - md4.c - 1 - 0 - - - 8 - 43 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - md5.c - 1 - 0 - - - 8 - 44 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - memory.c - 1 - 0 - - - 8 - 45 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - misc.c - 1 - 0 - - - 8 - 46 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - pwdbased.c - 1 - 0 - - - 8 - 47 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - rabbit.c - 1 - 0 - - - 8 - 48 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - random.c - 1 - 0 - - - 8 - 49 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - ripemd.c - 1 - 0 - - - 8 - 50 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - rsa.c - 1 - 0 - - - 8 - 51 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - sha.c - 1 - 0 - - - 8 - 52 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - sha256.c - 1 - 0 - - - 8 - 53 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - sha512.c - 1 - 0 - - - 8 - 54 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - tfm.c - 1 - 0 - - - 8 - 55 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - wc_port.c - 1 - 0 - diff --git a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx index 677c74e3e..214951a09 100644 --- a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx +++ b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx @@ -12,14 +12,16 @@ ARM-ADS - STM32F207IG + STM32F207IGHx STMicroelectronics - IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE + Keil.STM32F2xx_DFP.2.2.0 + http://www.keil.com/pack + IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) 0 - $$Device:STM32F207IG$Device\Include\stm32f2xx.h + $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h @@ -29,7 +31,7 @@ - $$Device:STM32F207IG$SVD\STM32F20x.svd + $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd 0 0 @@ -104,11 +106,11 @@ SARMCM3.DLL - -REMAP -MPU + -REMAP -MPU DCM.DLL -pCM3 SARMCM3.DLL - -REMAP -MPU + -MPU TCM.DLL -pCM3 @@ -143,10 +145,9 @@ 1 1 1 - 1 0 - 8 + 1 @@ -160,7 +161,7 @@ .\STM32_SWO.ini - BIN\ULP2CM3.DLL + BIN\UL2CM3.DLL @@ -173,8 +174,8 @@ 4100 1 - BIN\ULP2CM3.DLL - "" () + BIN\UL2CM3.DLL + @@ -362,7 +363,7 @@ 0 - HAVE_CONFIG_H MDK_CONF_CryptTest + HAVE_CONFIG_H WOLFSSL_USER_SETTINGS MDK_CONF_CryptTest @@ -412,21 +413,6 @@ 1 .\main.c - - test.c - 1 - .\test.c - - - cert_data.c - 1 - .\cert_data.c - - - time-dummy.c - 1 - .\time-dummy.c - @@ -438,9 +424,9 @@ .\RTE\wolfSSL\config-Crypt.h - settings.h + user_settings.h 5 - .\RTE\wolfSSL\settings.h + .\RTE\wolfSSL\user_settings.h @@ -456,268 +442,21 @@ ::CMSIS - - - RTX_Conf_CM.c - 1 - RTE\CMSIS\RTX_Conf_CM.c - - - RTX_CM3.lib - 4 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - - + + + ::CMSIS Driver + + + ::Compiler ::Device - - - RTE_Device.h - 5 - RTE\Device\STM32F207IG\RTE_Device.h - - - startup_stm32f2xx.s - 2 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - system_stm32f2xx.c - 1 - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - DMA_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - - - GPIO_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - - - - - ::Drivers - - - MCI_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - - ::File System - - - FS_Config.c - 1 - RTE\File_System\FS_Config.c - - - FS_Config_MC_0.h - 5 - RTE\File_System\FS_Config_MC_0.h - - - FS_LFN_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - - ::wolfSSL - - - config-Crypt.h - 5 - RTE\wolfSSL\config-Crypt.h - - - settings.h - 5 - RTE\wolfSSL\settings.h - - - cyassl_MDK_ARM.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - - - ssl-dummy.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\ssl-dummy.c - - - aes.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - - - arc4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - - - asm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - - - asn.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - - - blake2b.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - - - camellia.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - - - coding.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - - - compress.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - - - des3.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - - - dh.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - - - dsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - - - ecc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - - - ecc_fp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - - - error.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - - - hc128.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - - - hmac.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - - - integer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - - - logging.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - - - md2.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - - - md4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - - - md5.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - - - memory.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - - - misc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - - - pwdbased.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - - - rabbit.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - - - random.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - - - ripemd.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - - - rsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - - - sha.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - - - sha256.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - - - sha512.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - - - tfm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - - - wc_port.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - - @@ -725,110 +464,179 @@ - + + + + - + - + - + - + - + - + - + - + - + - - + + - - + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + RTE\CMSIS\RTX_Conf_CM.c @@ -836,42 +644,92 @@ - - RTE\Device\STM32F207IG\RTE_Device.h - - + + RTE\Device\STM32F207IGHx\RTE_Device.h + + + + RTE\Device\STM32F207IGHx\startup_stm32f207xx.s + + + + + + + + RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h + + + + + + + + RTE\Device\STM32F207IGHx\system_stm32f2xx.c + + + + + + + + RTE\Device\STM32F207IGTx\RTE_Device.h + + + + + + RTE\Device\STM32F207IGTx\startup_stm32f207xx.s + + + + + + RTE\Device\STM32F207IGTx\stm32f2xx_hal_conf.h + + + + + + RTE\Device\STM32F207IGTx\system_stm32f2xx.c + + + + + + RTE\Device\STM32F207IG\RTE_Device.h + + + + - RTE\Device\STM32F207IG\startup_stm32f2xx.s + RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - + - RTE\Device\STM32F207IG\system_stm32f2xx.c + RTE\Device\STM32F207IG\system_stm32f2xx.c - - - + - + RTE\File_System\FS_Config.c - - + + - + RTE\File_System\FS_Config_MC_0.h - - + + @@ -942,10 +800,10 @@ - + RTE\wolfSSL\config-Crypt.h - - + + @@ -957,9 +815,15 @@ - RTE\wolfSSL\settings.h + RTE\wolfSSL\settings.h + + + + RTE\wolfSSL\user_settings.h + + diff --git a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx index 660fd4507..1645ff076 100644 --- a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx +++ b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx @@ -13,6 +13,7 @@ *.txt; *.h; *.inc *.plm *.cpp + 0 @@ -21,16 +22,17 @@ - EchoClient + STM32F207 Flash 0x4 ARM-ADS - 120000000 + 12000000 1 1 0 1 + 0 1 @@ -75,17 +77,17 @@ 0 1 - 255 + 18 0 Schematics (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf 1 User Manual (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm 2 @@ -113,10 +115,9 @@ 1 1 1 - 1 0 0 - 8 + 1 @@ -127,9 +128,14 @@ .\STM32_SWO.ini - BIN\ULP2CM3.DLL + BIN\UL2CM3.DLL + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + 0 DLGTARM @@ -143,17 +149,17 @@ 0 ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) + -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) 0 DLGUARM - + (105=-1,-1,-1,-1,0) 0 UL2CM3 - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) @@ -161,7 +167,8 @@ 1 8 - ((func_args*)args)->signal->port + port + 0 @@ -169,6 +176,7 @@ 2 8 0x8004dc8 + 0 @@ -195,7 +203,7 @@ 0 0 1 - 0 + 1 0 0 0 @@ -224,19 +232,6 @@ 0 0 - - 1 - 2 - 1 - 0 - 0 - 0 - 0 - .\echoclient.c - echoclient.c - 0 - 0 - @@ -247,20 +242,7 @@ 0 2 - 3 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 0 - 0 - - - 2 - 4 + 2 5 0 0 @@ -273,14 +255,27 @@ 2 - 5 + 3 5 0 0 0 0 - .\RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h + .\RTE\wolfSSL\config-wolfSSL.h + config-wolfSSL.h + 0 + 0 + + + 2 + 4 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\user_settings.h + user_settings.h 0 0 @@ -294,7 +289,7 @@ 0 3 - 6 + 5 5 0 0 @@ -307,59 +302,28 @@ - - Devices - 1 - 0 - 0 - 0 - - 4 - 7 - 1 - 0 - 0 - 0 - 0 - .\time-dummy.c - time-dummy.c - 0 - 0 - - - ::CMSIS 1 0 0 1 - - 5 - 8 - 1 - 0 - 0 - 0 - 0 - RTE\CMSIS\RTX_Conf_CM.c - RTX_Conf_CM.c - 1 - 0 - - - 5 - 9 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - RTX_CM3.lib - 1 - 0 - + + + + ::CMSIS Driver + 1 + 0 + 0 + 1 + + + + ::Compiler + 1 + 0 + 0 + 1 @@ -368,118 +332,6 @@ 0 0 1 - - 6 - 10 - 5 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\RTE_Device.h - RTE_Device.h - 1 - 0 - - - 6 - 11 - 2 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - startup_stm32f2xx.s - 1 - 0 - - - 6 - 12 - 1 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\system_stm32f2xx.c - system_stm32f2xx.c - 1 - 0 - - - 6 - 13 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - DMA_STM32F2xx.c - 1 - 0 - - - 6 - 14 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - GPIO_STM32F2xx.c - 1 - 0 - - - - - ::Drivers - 0 - 0 - 0 - 1 - - 7 - 15 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - EMAC_STM32F2xx.c - 1 - 0 - - - 7 - 16 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - MCI_STM32F2xx.c - 1 - 0 - - - 7 - 17 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - PHY_ST802RT1.c - 1 - 0 - @@ -488,45 +340,6 @@ 0 0 1 - - 8 - 18 - 1 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config.c - FS_Config.c - 1 - 0 - - - 8 - 19 - 5 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config_MC_0.h - FS_Config_MC_0.h - 1 - 0 - - - 8 - 20 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - FS_LFN_CM3_L.lib - 1 - 0 - @@ -535,703 +348,14 @@ 0 0 1 - - 9 - 21 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config.c - Net_Config.c - 1 - 0 - - - 9 - 22 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_BSD.h - Net_Config_BSD.h - 1 - 0 - - - 9 - 23 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_DNS_Client.h - Net_Config_DNS_Client.h - 1 - 0 - - - 9 - 24 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h - 1 - 0 - - - 9 - 25 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_TCP.h - Net_Config_TCP.h - 1 - 0 - - - 9 - 26 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_UDP.h - Net_Config_UDP.h - 1 - 0 - - - 9 - 27 - 1 - 1 - 0 - 0 - 0 - RTE\Network\Net_Debug.c - Net_Debug.c - 1 - 0 - - - 9 - 28 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - Net_Dbg_CM3_L.lib - 1 - 0 - ::wolfSSL - 0 + 1 0 0 1 - - 10 - 29 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 1 - 0 - - - 10 - 30 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 1 - 0 - - - 10 - 31 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\settings.h - settings.h - 1 - 0 - - - 10 - 32 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - cyassl_MDK_ARM.c - 1 - 0 - - - 10 - 33 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - aes.c - 1 - 0 - - - 10 - 34 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - arc4.c - 1 - 0 - - - 10 - 35 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - asm.c - 1 - 0 - - - 10 - 36 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - asn.c - 1 - 0 - - - 10 - 37 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - blake2b.c - 1 - 0 - - - 10 - 38 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - camellia.c - 1 - 0 - - - 10 - 39 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - coding.c - 1 - 0 - - - 10 - 40 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - compress.c - 1 - 0 - - - 10 - 41 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - des3.c - 1 - 0 - - - 10 - 42 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - dh.c - 1 - 0 - - - 10 - 43 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - dsa.c - 1 - 0 - - - 10 - 44 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - ecc.c - 1 - 0 - - - 10 - 45 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - ecc_fp.c - 1 - 0 - - - 10 - 46 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - error.c - 1 - 0 - - - 10 - 47 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - hc128.c - 1 - 0 - - - 10 - 48 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - hmac.c - 1 - 0 - - - 10 - 49 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - integer.c - 1 - 0 - - - 10 - 50 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - logging.c - 1 - 0 - - - 10 - 51 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - md2.c - 1 - 0 - - - 10 - 52 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - md4.c - 1 - 0 - - - 10 - 53 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - md5.c - 1 - 0 - - - 10 - 54 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - memory.c - 1 - 0 - - - 10 - 55 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - misc.c - 1 - 0 - - - 10 - 56 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - pwdbased.c - 1 - 0 - - - 10 - 57 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - rabbit.c - 1 - 0 - - - 10 - 58 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - random.c - 1 - 0 - - - 10 - 59 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - ripemd.c - 1 - 0 - - - 10 - 60 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - rsa.c - 1 - 0 - - - 10 - 61 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - sha.c - 1 - 0 - - - 10 - 62 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - sha256.c - 1 - 0 - - - 10 - 63 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - sha512.c - 1 - 0 - - - 10 - 64 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - tfm.c - 1 - 0 - - - 10 - 65 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - wc_port.c - 1 - 0 - - - 10 - 66 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - crl.c - 1 - 0 - - - 10 - 67 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - internal.c - 1 - 0 - - - 10 - 68 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - io.c - 1 - 0 - - - 10 - 69 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - keys.c - 1 - 0 - - - 10 - 70 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - ocsp.c - 1 - 0 - - - 10 - 71 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - sniffer.c - 1 - 0 - - - 10 - 72 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - ssl.c - 1 - 0 - - - 10 - 73 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - tls.c - 1 - 0 - diff --git a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx index 4ea465518..8815b7c69 100644 --- a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx +++ b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx @@ -7,19 +7,21 @@ - EchoClient + STM32F207 Flash 0x4 ARM-ADS - STM32F207IG + STM32F207IGHx STMicroelectronics - IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE + Keil.STM32F2xx_DFP.2.2.0 + http://www.keil.com/pack + IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) 0 - $$Device:STM32F207IG$Device\Include\stm32f2xx.h + $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h @@ -29,7 +31,7 @@ - $$Device:STM32F207IG$SVD\STM32F20x.svd + $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd 0 0 @@ -104,11 +106,11 @@ SARMCM3.DLL - -REMAP -MPU + -REMAP -MPU DCM.DLL -pCM3 SARMCM3.DLL - -REMAP -MPU + -MPU TCM.DLL -pCM3 @@ -143,10 +145,9 @@ 1 1 1 - 1 0 - 8 + 1 @@ -160,7 +161,7 @@ .\STM32_SWO.ini - BIN\ULP2CM3.DLL + BIN\UL2CM3.DLL @@ -173,8 +174,8 @@ 4100 1 - BIN\ULP2CM3.DLL - "" () + BIN\UL2CM3.DLL + @@ -355,14 +356,14 @@ 0 0 0 - 0 + 2 0 0 - 0 + 1 0 - - HAVE_CONFIG_H MDK_CONF_EchoClient + --diag_suppress=1293 + HSE_VALUE=25000000 HAVE_CONFIG_H MDK_CONF_EchoClient WOLFSSL_USER_SETTINGS @@ -412,30 +413,25 @@ 1 .\main.c - - echoclient.c - 1 - .\echoclient.c - Configuration - - config-CyaSSL.h - 5 - .\RTE\wolfSSL\config-CyaSSL.h - config-Crypt.h 5 .\RTE\wolfSSL\config-Crypt.h - Net_Config_ETH_0.h + config-wolfSSL.h 5 - .\RTE\Network\Net_Config_ETH_0.h + .\RTE\wolfSSL\config-wolfSSL.h + + + user_settings.h + 5 + .\RTE\wolfSSL\user_settings.h @@ -450,647 +446,397 @@ - Devices - - - time-dummy.c - 1 - .\time-dummy.c - - + ::CMSIS - ::CMSIS - - - RTX_Conf_CM.c - 1 - RTE\CMSIS\RTX_Conf_CM.c - - - RTX_CM3.lib - 4 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - - + ::CMSIS Driver + + + ::Compiler ::Device - - - RTE_Device.h - 5 - RTE\Device\STM32F207IG\RTE_Device.h - - - startup_stm32f2xx.s - 2 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - system_stm32f2xx.c - 1 - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - DMA_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - - - GPIO_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - - - - - ::Drivers - - - EMAC_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - - - MCI_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - - - PHY_ST802RT1.c - 1 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - - ::File System - - - FS_Config.c - 1 - RTE\File_System\FS_Config.c - - - FS_Config_MC_0.h - 5 - RTE\File_System\FS_Config_MC_0.h - - - FS_LFN_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - - ::Network - - - Net_Config.c - 1 - RTE\Network\Net_Config.c - - - Net_Config_BSD.h - 5 - RTE\Network\Net_Config_BSD.h - - - Net_Config_DNS_Client.h - 5 - RTE\Network\Net_Config_DNS_Client.h - - - Net_Config_ETH_0.h - 5 - RTE\Network\Net_Config_ETH_0.h - - - Net_Config_TCP.h - 5 - RTE\Network\Net_Config_TCP.h - - - Net_Config_UDP.h - 5 - RTE\Network\Net_Config_UDP.h - - - Net_Debug.c - 1 - RTE\Network\Net_Debug.c - - - Net_Dbg_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - - ::wolfSSL - - - config-Crypt.h - 5 - RTE\wolfSSL\config-Crypt.h - - - config-CyaSSL.h - 5 - RTE\wolfSSL\config-CyaSSL.h - - - settings.h - 5 - RTE\wolfSSL\settings.h - - - cyassl_MDK_ARM.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - - - aes.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - - - arc4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - - - asm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - - - asn.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - - - blake2b.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - - - camellia.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - - - coding.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - - - compress.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - - - des3.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - - - dh.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - - - dsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - - - ecc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - - - ecc_fp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - - - error.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - - - hc128.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - - - hmac.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - - - integer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - - - logging.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - - - md2.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - - - md4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - - - md5.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - - - memory.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - - - misc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - - - pwdbased.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - - - rabbit.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - - - random.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - - - ripemd.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - - - rsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - - - sha.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - - - sha256.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - - - sha512.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - - - tfm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - - - wc_port.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - - - crl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - - - internal.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - - - io.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - - - keys.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - - - ocsp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - - - sniffer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - - - ssl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - - - tls.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + - - + + - - - - - - - - - - - - - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + RTE\CMSIS\RTX_Conf_CM.c - - + + - + + + + + RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s + + + + + + RTE\Device\MK70FN1M0xxx12\system_MK70F12.c + + + + + + RTE\Device\STM32F207IGHx\RTE_Device.h + + + + + + + + RTE\Device\STM32F207IGHx\startup_stm32f207xx.s + + + + + + + + RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h + + + + + + + + RTE\Device\STM32F207IGHx\system_stm32f2xx.c + + + + - RTE\Device\STM32F207IG\RTE_Device.h - - - - - + RTE\Device\STM32F207IG\RTE_Device.h + + + + + + RTE\Device\STM32F207IG\startup_stm32f207xx.s + + + - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - + RTE\Device\STM32F207IG\startup_stm32f2xx.s + + + - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - + + RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h + + + - + + RTE\Device\STM32F207IG\system_stm32f2xx.c + + + + + + RTE\Device\TM4C129ENCPDT\startup_TM4C129.s + + + + + + RTE\Device\TM4C129ENCPDT\system_tm4c129.c + + + + + RTE\File_System\FS_Config.c - - + + - + - + RTE\File_System\FS_Config_MC_0.h - - + + - + - + RTE\Network\Net_Config.c - - + + - + - + RTE\Network\Net_Config_BSD.h - - + + - + - + RTE\Network\Net_Config_DNS_Client.h - - + + - + - + RTE\Network\Net_Config_ETH_0.h - - + + - + - + RTE\Network\Net_Config_TCP.h - - + + - + - + RTE\Network\Net_Config_UDP.h - - + + - + - - RTE\Network\Net_Debug.c - - - - - + + RTE\Network\Net_Debug.c + + + RTE\Other\config-Crypt.h @@ -1116,20 +862,26 @@ - + RTE\wolfSSL\config-Crypt.h - - + + - + - RTE\wolfSSL\config-CyaSSL.h + RTE\wolfSSL\config-CyaSSL.h + + + + RTE\wolfSSL\config-wolfSSL.h + + - + @@ -1138,12 +890,18 @@ - - RTE\wolfSSL\settings.h - - + + RTE\wolfSSL\settings.h + + + + + + RTE\wolfSSL\user_settings.h + + - + diff --git a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx index ae9dc9356..1645ff076 100644 --- a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx +++ b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx @@ -13,6 +13,7 @@ *.txt; *.h; *.inc *.plm *.cpp + 0 @@ -21,16 +22,17 @@ - EchoServer + STM32F207 Flash 0x4 ARM-ADS - 120000000 + 12000000 1 1 0 1 + 0 1 @@ -75,17 +77,17 @@ 0 1 - 255 + 18 0 Schematics (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf 1 User Manual (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm 2 @@ -113,10 +115,9 @@ 1 1 1 - 1 0 0 - 8 + 1 @@ -127,9 +128,14 @@ .\STM32_SWO.ini - BIN\ULP2CM3.DLL + BIN\UL2CM3.DLL + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + 0 DLGTARM @@ -143,58 +149,26 @@ 0 ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) + -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) 0 DLGUARM - + (105=-1,-1,-1,-1,0) 0 UL2CM3 - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) - - - 0 - 0 - 96 - 1 -
134218906
- 0 - 0 - 0 - 0 - 0 - 1 - .\main.c - - -
- - 1 - 0 - 85 - 1 -
134218858
- 0 - 0 - 0 - 0 - 0 - 1 - .\main.c - - -
-
+ 1 8 - 0x20000408 + port + 0 @@ -202,6 +176,7 @@ 2 8 0x8004dc8 + 0 @@ -228,7 +203,7 @@ 0 0 1 - 0 + 1 0 0 0 @@ -257,19 +232,6 @@ 0 0 - - 1 - 2 - 1 - 0 - 0 - 0 - 0 - .\echoserver.c - echoserver.c - 0 - 0 - @@ -280,20 +242,7 @@ 0 2 - 3 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 0 - 0 - - - 2 - 4 + 2 5 0 0 @@ -306,28 +255,41 @@ 2 - 5 + 3 5 0 0 0 0 - .\RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h + .\RTE\wolfSSL\config-wolfSSL.h + config-wolfSSL.h + 0 + 0 + + + 2 + 4 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\user_settings.h + user_settings.h 0 0 - Documentation + Dcumentation 1 0 0 0 3 - 6 + 5 5 0 0 @@ -340,179 +302,36 @@ - - Devices - 1 - 0 - 0 - 0 - - 4 - 7 - 1 - 0 - 0 - 0 - 0 - .\time-dummy.c - time-dummy.c - 0 - 0 - - - ::CMSIS 1 0 0 1 - - 5 - 8 - 1 - 0 - 0 - 0 - 0 - RTE\CMSIS\RTX_Conf_CM.c - RTX_Conf_CM.c - 1 - 0 - - - 5 - 9 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - RTX_CM3.lib - 1 - 0 - + + + + ::CMSIS Driver + 1 + 0 + 0 + 1 + + + + ::Compiler + 1 + 0 + 0 + 1 ::Device - 0 + 1 0 0 1 - - 6 - 10 - 5 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\RTE_Device.h - RTE_Device.h - 1 - 0 - - - 6 - 11 - 2 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - startup_stm32f2xx.s - 1 - 0 - - - 6 - 12 - 1 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\system_stm32f2xx.c - system_stm32f2xx.c - 1 - 0 - - - 6 - 13 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - DMA_STM32F2xx.c - 1 - 0 - - - 6 - 14 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - GPIO_STM32F2xx.c - 1 - 0 - - - - - ::Drivers - 0 - 0 - 0 - 1 - - 7 - 15 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - EMAC_STM32F2xx.c - 1 - 0 - - - 7 - 16 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - MCI_STM32F2xx.c - 1 - 0 - - - 7 - 17 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - PHY_ST802RT1.c - 1 - 0 - @@ -521,157 +340,14 @@ 0 0 1 - - 8 - 18 - 1 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config.c - FS_Config.c - 1 - 0 - - - 8 - 19 - 5 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config_MC_0.h - FS_Config_MC_0.h - 1 - 0 - - - 8 - 20 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - FS_LFN_CM3_L.lib - 1 - 0 - ::Network - 0 + 1 0 0 1 - - 9 - 21 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config.c - Net_Config.c - 1 - 0 - - - 9 - 22 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_BSD.h - Net_Config_BSD.h - 1 - 0 - - - 9 - 23 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_DNS_Client.h - Net_Config_DNS_Client.h - 1 - 0 - - - 9 - 24 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h - 1 - 0 - - - 9 - 25 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_TCP.h - Net_Config_TCP.h - 1 - 0 - - - 9 - 26 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_UDP.h - Net_Config_UDP.h - 1 - 0 - - - 9 - 27 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Debug.c - Net_Debug.c - 1 - 0 - - - 9 - 28 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - Net_Dbg_CM3_L.lib - 1 - 0 - @@ -680,591 +356,6 @@ 0 0 1 - - 10 - 29 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 1 - 0 - - - 10 - 30 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 1 - 0 - - - 10 - 31 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\settings.h - settings.h - 1 - 0 - - - 10 - 32 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - cyassl_MDK_ARM.c - 1 - 0 - - - 10 - 33 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - aes.c - 1 - 0 - - - 10 - 34 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - arc4.c - 1 - 0 - - - 10 - 35 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - asm.c - 1 - 0 - - - 10 - 36 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - asn.c - 1 - 0 - - - 10 - 37 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - blake2b.c - 1 - 0 - - - 10 - 38 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - camellia.c - 1 - 0 - - - 10 - 39 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - coding.c - 1 - 0 - - - 10 - 40 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - compress.c - 1 - 0 - - - 10 - 41 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - des3.c - 1 - 0 - - - 10 - 42 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - dh.c - 1 - 0 - - - 10 - 43 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - dsa.c - 1 - 0 - - - 10 - 44 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - ecc.c - 1 - 0 - - - 10 - 45 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - ecc_fp.c - 1 - 0 - - - 10 - 46 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - error.c - 1 - 0 - - - 10 - 47 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - hc128.c - 1 - 0 - - - 10 - 48 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - hmac.c - 1 - 0 - - - 10 - 49 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - integer.c - 1 - 0 - - - 10 - 50 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - logging.c - 1 - 0 - - - 10 - 51 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - md2.c - 1 - 0 - - - 10 - 52 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - md4.c - 1 - 0 - - - 10 - 53 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - md5.c - 1 - 0 - - - 10 - 54 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - memory.c - 1 - 0 - - - 10 - 55 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - misc.c - 1 - 0 - - - 10 - 56 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - pwdbased.c - 1 - 0 - - - 10 - 57 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - rabbit.c - 1 - 0 - - - 10 - 58 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - random.c - 1 - 0 - - - 10 - 59 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - ripemd.c - 1 - 0 - - - 10 - 60 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - rsa.c - 1 - 0 - - - 10 - 61 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - sha.c - 1 - 0 - - - 10 - 62 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - sha256.c - 1 - 0 - - - 10 - 63 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - sha512.c - 1 - 0 - - - 10 - 64 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - tfm.c - 1 - 0 - - - 10 - 65 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - wc_port.c - 1 - 0 - - - 10 - 66 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - crl.c - 1 - 0 - - - 10 - 67 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - internal.c - 1 - 0 - - - 10 - 68 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - io.c - 1 - 0 - - - 10 - 69 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - keys.c - 1 - 0 - - - 10 - 70 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - ocsp.c - 1 - 0 - - - 10 - 71 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - sniffer.c - 1 - 0 - - - 10 - 72 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - ssl.c - 1 - 0 - - - 10 - 73 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - tls.c - 1 - 0 - diff --git a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx index 646373a09..f1c972b75 100644 --- a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx +++ b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx @@ -7,19 +7,21 @@ - EchoServer + STM32F207 Flash 0x4 ARM-ADS - STM32F207IG + STM32F207IGHx STMicroelectronics - IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE + Keil.STM32F2xx_DFP.2.2.0 + http://www.keil.com/pack + IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) 0 - $$Device:STM32F207IG$Device\Include\stm32f2xx.h + $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h @@ -29,7 +31,7 @@ - $$Device:STM32F207IG$SVD\STM32F20x.svd + $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd 0 0 @@ -45,7 +47,7 @@ 1 .\Object\ - EchoServer + EchoClient 1 0 0 @@ -104,11 +106,11 @@ SARMCM3.DLL - -REMAP -MPU + -REMAP -MPU DCM.DLL -pCM3 SARMCM3.DLL - -REMAP -MPU + -MPU TCM.DLL -pCM3 @@ -143,10 +145,9 @@ 1 1 1 - 1 0 - 8 + 1 @@ -160,7 +161,7 @@ .\STM32_SWO.ini - BIN\ULP2CM3.DLL + BIN\UL2CM3.DLL @@ -173,8 +174,8 @@ 4100 1 - BIN\ULP2CM3.DLL - "" () + BIN\UL2CM3.DLL + @@ -355,14 +356,14 @@ 0 0 0 - 0 + 2 0 0 - 0 + 1 0 - - HAVE_CONFIG_H MDK_CONF_SimpleClient + --diag_suppress=1293 + HSE_VALUE=25000000 HAVE_CONFIG_H MDK_CONF_EchoClient WOLFSSL_USER_SETTINGS @@ -412,35 +413,30 @@ 1 .\main.c - - echoserver.c - 1 - .\echoserver.c - Configuration - - config-CyaSSL.h - 5 - .\RTE\wolfSSL\config-CyaSSL.h - config-Crypt.h 5 .\RTE\wolfSSL\config-Crypt.h - Net_Config_ETH_0.h + config-wolfSSL.h 5 - .\RTE\Network\Net_Config_ETH_0.h + .\RTE\wolfSSL\config-wolfSSL.h + + + user_settings.h + 5 + .\RTE\wolfSSL\user_settings.h - Documentation + Dcumentation Abstract.txt @@ -450,647 +446,397 @@ - Devices - - - time-dummy.c - 1 - .\time-dummy.c - - + ::CMSIS - ::CMSIS - - - RTX_Conf_CM.c - 1 - RTE\CMSIS\RTX_Conf_CM.c - - - RTX_CM3.lib - 4 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - - + ::CMSIS Driver + + + ::Compiler ::Device - - - RTE_Device.h - 5 - RTE\Device\STM32F207IG\RTE_Device.h - - - startup_stm32f2xx.s - 2 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - system_stm32f2xx.c - 1 - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - DMA_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - - - GPIO_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - - - - - ::Drivers - - - EMAC_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - - - MCI_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - - - PHY_ST802RT1.c - 1 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - - ::File System - - - FS_Config.c - 1 - RTE\File_System\FS_Config.c - - - FS_Config_MC_0.h - 5 - RTE\File_System\FS_Config_MC_0.h - - - FS_LFN_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - - ::Network - - - Net_Config.c - 1 - RTE\Network\Net_Config.c - - - Net_Config_BSD.h - 5 - RTE\Network\Net_Config_BSD.h - - - Net_Config_DNS_Client.h - 5 - RTE\Network\Net_Config_DNS_Client.h - - - Net_Config_ETH_0.h - 5 - RTE\Network\Net_Config_ETH_0.h - - - Net_Config_TCP.h - 5 - RTE\Network\Net_Config_TCP.h - - - Net_Config_UDP.h - 5 - RTE\Network\Net_Config_UDP.h - - - Net_Debug.c - 1 - RTE\Network\Net_Debug.c - - - Net_Dbg_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - - ::wolfSSL - - - config-Crypt.h - 5 - RTE\wolfSSL\config-Crypt.h - - - config-CyaSSL.h - 5 - RTE\wolfSSL\config-CyaSSL.h - - - settings.h - 5 - RTE\wolfSSL\settings.h - - - cyassl_MDK_ARM.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - - - aes.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - - - arc4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - - - asm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - - - asn.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - - - blake2b.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - - - camellia.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - - - coding.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - - - compress.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - - - des3.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - - - dh.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - - - dsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - - - ecc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - - - ecc_fp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - - - error.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - - - hc128.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - - - hmac.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - - - integer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - - - logging.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - - - md2.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - - - md4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - - - md5.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - - - memory.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - - - misc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - - - pwdbased.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - - - rabbit.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - - - random.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - - - ripemd.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - - - rsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - - - sha.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - - - sha256.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - - - sha512.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - - - tfm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - - - wc_port.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - - - crl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - - - internal.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - - - io.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - - - keys.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - - - ocsp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - - - sniffer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - - - ssl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - - - tls.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + - - + + - - - - - - - - - - - - - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + RTE\CMSIS\RTX_Conf_CM.c - - + + - + + + + + RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s + + + + + + RTE\Device\MK70FN1M0xxx12\system_MK70F12.c + + + + + + RTE\Device\STM32F207IGHx\RTE_Device.h + + + + + + + + RTE\Device\STM32F207IGHx\startup_stm32f207xx.s + + + + + + + + RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h + + + + + + + + RTE\Device\STM32F207IGHx\system_stm32f2xx.c + + + + - RTE\Device\STM32F207IG\RTE_Device.h - - - - - + RTE\Device\STM32F207IG\RTE_Device.h + + + + + + RTE\Device\STM32F207IG\startup_stm32f207xx.s + + + - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - + RTE\Device\STM32F207IG\startup_stm32f2xx.s + + + - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - + + RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h + + + - + + RTE\Device\STM32F207IG\system_stm32f2xx.c + + + + + + RTE\Device\TM4C129ENCPDT\startup_TM4C129.s + + + + + + RTE\Device\TM4C129ENCPDT\system_tm4c129.c + + + + + RTE\File_System\FS_Config.c - - + + - + - + RTE\File_System\FS_Config_MC_0.h - - + + - + - + RTE\Network\Net_Config.c - - + + - + - + RTE\Network\Net_Config_BSD.h - - + + - + - + RTE\Network\Net_Config_DNS_Client.h - - + + - + - + RTE\Network\Net_Config_ETH_0.h - - + + - + - + RTE\Network\Net_Config_TCP.h - - + + - + - + RTE\Network\Net_Config_UDP.h - - + + - + - - RTE\Network\Net_Debug.c - - - - - + + RTE\Network\Net_Debug.c + + + RTE\Other\config-Crypt.h @@ -1116,20 +862,26 @@ - + RTE\wolfSSL\config-Crypt.h - - + + - + - RTE\wolfSSL\config-CyaSSL.h + RTE\wolfSSL\config-CyaSSL.h + + + + RTE\wolfSSL\config-wolfSSL.h + + - + @@ -1138,12 +890,18 @@ - - RTE\wolfSSL\settings.h - - + + RTE\wolfSSL\settings.h + + + + + + RTE\wolfSSL\user_settings.h + + - + diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx index 46654d1ce..92b94982a 100644 --- a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx +++ b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx @@ -13,6 +13,7 @@ *.txt; *.h; *.inc *.plm *.cpp + 0 @@ -21,16 +22,17 @@ - SimpleClient + STM32F207 Flash 0x4 ARM-ADS - 120000000 + 12000000 1 1 0 1 + 0 1 @@ -75,17 +77,17 @@ 0 1 - 255 + 18 0 Schematics (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf 1 User Manual (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm 2 @@ -113,10 +115,9 @@ 1 1 1 - 1 0 0 - 8 + 1 @@ -127,9 +128,14 @@ .\STM32_SWO.ini - BIN\ULP2CM3.DLL + BIN\UL2CM3.DLL + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + 0 DLGTARM @@ -143,25 +149,43 @@ 0 ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) + -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) 0 DLGUARM - + (105=-1,-1,-1,-1,0) 0 UL2CM3 - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) - + + + 0 + 0 + 109 + 1 +
0
+ 0 + 0 + 0 + 0 + 0 + 0 + .\main.c + + +
+
1 8 - 0x20000408 + port + 0 @@ -169,6 +193,7 @@ 2 8 0x8004dc8 + 0 @@ -195,7 +220,7 @@ 0 0 1 - 0 + 1 0 0 0 @@ -232,8 +257,8 @@ 0 0 0 - .\client.c - client.c + .\time-CortexM3-4.c + time-CortexM3-4.c 0 0 @@ -253,8 +278,8 @@ 0 0 0 - .\config-SimpleClient.h - config-SimpleClient.h + .\RTE\wolfSSL\config-Crypt.h + config-Crypt.h 0 0 @@ -266,8 +291,8 @@ 0 0 0 - .\RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h + .\RTE\wolfSSL\config-wolfSSL.h + config-wolfSSL.h 0 0 @@ -279,8 +304,8 @@ 0 0 0 - .\RTE\wolfSSL\config-Crypt.h - config-Crypt.h + .\RTE\wolfSSL\user_settings.h + user_settings.h 0 0 @@ -292,15 +317,15 @@ 0 0 0 - .\RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h + .\config-SimpleClient.h + config-SimpleClient.h 0 0 - Documentation + Dcumentation 1 0 0 @@ -320,192 +345,36 @@ - - Devices - 1 - 0 - 0 - 0 - - 4 - 8 - 1 - 0 - 0 - 0 - 0 - .\time-dummy.c - time-dummy.c - 0 - 0 - - - 4 - 9 - 1 - 0 - 0 - 0 - 0 - .\time-CortexM3-4.c - time-CortexM3-4.c - 0 - 0 - - - ::CMSIS 1 0 0 1 - - 5 - 10 - 1 - 0 - 0 - 0 - 0 - RTE\CMSIS\RTX_Conf_CM.c - RTX_Conf_CM.c - 1 - 0 - - - 5 - 11 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - RTX_CM3.lib - 1 - 0 - + + + + ::CMSIS Driver + 1 + 0 + 0 + 1 + + + + ::Compiler + 1 + 0 + 0 + 1 ::Device - 0 + 1 0 0 1 - - 6 - 12 - 5 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\RTE_Device.h - RTE_Device.h - 1 - 0 - - - 6 - 13 - 2 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - startup_stm32f2xx.s - 1 - 0 - - - 6 - 14 - 1 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\system_stm32f2xx.c - system_stm32f2xx.c - 1 - 0 - - - 6 - 15 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - DMA_STM32F2xx.c - 1 - 0 - - - 6 - 16 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - GPIO_STM32F2xx.c - 1 - 0 - - - - - ::Drivers - 0 - 0 - 0 - 1 - - 7 - 17 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - EMAC_STM32F2xx.c - 1 - 0 - - - 7 - 18 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - MCI_STM32F2xx.c - 1 - 0 - - - 7 - 19 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - PHY_ST802RT1.c - 1 - 0 - @@ -514,157 +383,14 @@ 0 0 1 - - 8 - 20 - 1 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config.c - FS_Config.c - 1 - 0 - - - 8 - 21 - 5 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config_MC_0.h - FS_Config_MC_0.h - 1 - 0 - - - 8 - 22 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - FS_LFN_CM3_L.lib - 1 - 0 - ::Network - 0 + 1 0 0 1 - - 9 - 23 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config.c - Net_Config.c - 1 - 0 - - - 9 - 24 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_BSD.h - Net_Config_BSD.h - 1 - 0 - - - 9 - 25 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_DNS_Client.h - Net_Config_DNS_Client.h - 1 - 0 - - - 9 - 26 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h - 1 - 0 - - - 9 - 27 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_TCP.h - Net_Config_TCP.h - 1 - 0 - - - 9 - 28 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_UDP.h - Net_Config_UDP.h - 1 - 0 - - - 9 - 29 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Debug.c - Net_Debug.c - 1 - 0 - - - 9 - 30 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - Net_Dbg_CM3_L.lib - 1 - 0 - @@ -673,591 +399,6 @@ 0 0 1 - - 10 - 31 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 1 - 0 - - - 10 - 32 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 1 - 0 - - - 10 - 33 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\settings.h - settings.h - 1 - 0 - - - 10 - 34 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - cyassl_MDK_ARM.c - 1 - 0 - - - 10 - 35 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - aes.c - 1 - 0 - - - 10 - 36 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - arc4.c - 1 - 0 - - - 10 - 37 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - asm.c - 1 - 0 - - - 10 - 38 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - asn.c - 1 - 0 - - - 10 - 39 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - blake2b.c - 1 - 0 - - - 10 - 40 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - camellia.c - 1 - 0 - - - 10 - 41 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - coding.c - 1 - 0 - - - 10 - 42 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - compress.c - 1 - 0 - - - 10 - 43 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - des3.c - 1 - 0 - - - 10 - 44 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - dh.c - 1 - 0 - - - 10 - 45 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - dsa.c - 1 - 0 - - - 10 - 46 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - ecc.c - 1 - 0 - - - 10 - 47 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - ecc_fp.c - 1 - 0 - - - 10 - 48 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - error.c - 1 - 0 - - - 10 - 49 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - hc128.c - 1 - 0 - - - 10 - 50 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - hmac.c - 1 - 0 - - - 10 - 51 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - integer.c - 1 - 0 - - - 10 - 52 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - logging.c - 1 - 0 - - - 10 - 53 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - md2.c - 1 - 0 - - - 10 - 54 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - md4.c - 1 - 0 - - - 10 - 55 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - md5.c - 1 - 0 - - - 10 - 56 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - memory.c - 1 - 0 - - - 10 - 57 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - misc.c - 1 - 0 - - - 10 - 58 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - pwdbased.c - 1 - 0 - - - 10 - 59 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - rabbit.c - 1 - 0 - - - 10 - 60 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - random.c - 1 - 0 - - - 10 - 61 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - ripemd.c - 1 - 0 - - - 10 - 62 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - rsa.c - 1 - 0 - - - 10 - 63 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - sha.c - 1 - 0 - - - 10 - 64 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - sha256.c - 1 - 0 - - - 10 - 65 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - sha512.c - 1 - 0 - - - 10 - 66 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - tfm.c - 1 - 0 - - - 10 - 67 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - wc_port.c - 1 - 0 - - - 10 - 68 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - crl.c - 1 - 0 - - - 10 - 69 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - internal.c - 1 - 0 - - - 10 - 70 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - io.c - 1 - 0 - - - 10 - 71 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - keys.c - 1 - 0 - - - 10 - 72 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - ocsp.c - 1 - 0 - - - 10 - 73 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - sniffer.c - 1 - 0 - - - 10 - 74 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - ssl.c - 1 - 0 - - - 10 - 75 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - tls.c - 1 - 0 - diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx new file mode 100644 index 000000000..5308bcfa7 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx @@ -0,0 +1,314 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + wolfSSL-Lib + 0x4 + ARM-ADS + + 120000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\Object\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + + 0 + Schematics (MCBSTM32F200) + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf + + + 1 + User Manual (MCBSTM32F200) + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm + + + 2 + MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) + http://www.keil.com/mcbstm32f200/ + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 7 + + + + + + + + + + + BIN\ULP2CM3.DLL + + + + 0 + DLGUARM + + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + ULP2CM3 + -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO3 -TC10000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + + + + + + 1 + 8 + 0x20000408 + 0 + + + + + 2 + 8 + 0x8004dc8 + 0 + + + + 0 + + + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + + + + + + + + Configuration + 1 + 0 + 0 + 0 + + 1 + 1 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\config-Crypt.h + config-Crypt.h + 0 + 0 + + + 1 + 2 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\config-wolfSSL.h + config-wolfSSL.h + 0 + 0 + + + 1 + 3 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\user_settings.h + user_settings.h + 0 + 0 + + + + + Documentation + 1 + 0 + 0 + 0 + + + + wolfSSL-lib + 1 + 0 + 0 + 0 + + + + ::CMSIS + 0 + 0 + 0 + 1 + + + + ::CMSIS Driver + 0 + 0 + 0 + 1 + + + + ::Device + 0 + 0 + 0 + 1 + + + + ::Network + 0 + 0 + 0 + 1 + + + + ::wolfSSL + 1 + 0 + 0 + 1 + + +
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx new file mode 100644 index 000000000..92e12d017 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx @@ -0,0 +1,782 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + wolfSSL-Lib + 0x4 + ARM-ADS + + + STM32F207IG + STMicroelectronics + Keil.STM32F2xx_DFP.2.2.0 + http://www.keil.com/pack + IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + 0 + $$Device:STM32F207IG$Device\Include\stm32f2xx.h + + + + + + + + + + $$Device:STM32F207IG$SVD\STM32F20x.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\Object\ + wolfSSL + 0 + 1 + 0 + 0 + 0 + .\Object\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM3 + SARMCM3.DLL + -REMAP -MPU + TCM.DLL + -pCM3 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + + + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + + 0 + 7 + + + + + + + + + + + + + + BIN\ULP2CM3.DLL + + + + + 1 + 0 + 0 + 1 + 1 + 4100 + + 1 + BIN\ULP2CM3.DLL + "" () + + + wolfSSL-lib + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M3" + + 1 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 8 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 1 + 0x8000000 + 0x100000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x100000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + --diag_suppress=1293 + HAVE_CONFIG_H MDK_CONF_WOLFLIB WOLFSSL_USER_SETTINGS + + + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + + + + + + + + + + + + Configuration + + + config-Crypt.h + 5 + .\RTE\wolfSSL\config-Crypt.h + + + config-wolfSSL.h + 5 + .\RTE\wolfSSL\config-wolfSSL.h + + + user_settings.h + 5 + .\RTE\wolfSSL\user_settings.h + + + + + Documentation + + + wolfSSL-lib + + + ::CMSIS + + + ::CMSIS Driver + + + ::Device + + + ::Network + + + ::wolfSSL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RTE\CMSIS\RTX_Conf_CM.c + + + + + + + + RTE\Device\STM32F207IG\RTE_Device.h + + + + + + RTE\Device\STM32F207IG\startup_stm32f207xx.s + + + + + + + + RTE\Device\STM32F207IG\startup_stm32f2xx.s + + + + + + RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h + + + + + + + + RTE\Device\STM32F207IG\system_stm32f2xx.c + + + + + + + + RTE\File_System\FS_Config.c + + + + + + RTE\File_System\FS_Config_MC_0.h + + + + + + RTE\Network\Net_Config.c + + + + + + + + RTE\Network\Net_Config_BSD.h + + + + + + + + RTE\Network\Net_Config_DNS_Client.h + + + + + + + + RTE\Network\Net_Config_ETH_0.h + + + + + + + + RTE\Network\Net_Config_TCP.h + + + + + + + + RTE\Network\Net_Config_UDP.h + + + + + + + + RTE\Network\Net_Debug.c + + + + + + RTE\Other\config-Crypt.h + + + + + + RTE\Other\config-FS.h + + + + + + RTE\Other\config-RTX-TCP-FS.h + + + + + + RTE\Other\config.h + + + + + + RTE\wolfSSL\config-Crypt.h + + + + + + + + RTE\wolfSSL\config-wolfSSL.h + + + + + + + + RTE\wolfSSL\config.h + + + + + + RTE\wolfSSL\settings.h + + + + + + RTE\wolfSSL\user_settings.h + + + + + + + + + +
From a80653f4644b0148470886bfea50f79ec2318a15 Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Wed, 7 Oct 2015 14:52:18 +0900 Subject: [PATCH 42/77] Eliminate local copies of examples/test/benchmark fro example projects --- IDE/MDK5-ARM/Projects/CryptTest/test.c | 4863 ----------------- IDE/MDK5-ARM/Projects/EchoClient/echoclient.c | 282 - IDE/MDK5-ARM/Projects/EchoServer/echoserver.c | 368 -- IDE/MDK5-ARM/Projects/SimpleClient/client.c | 862 --- .../SimpleClient/simpleClient.uvprojx | 890 ++- .../Projects/SimpleServer/SimpleServer.uvoptx | 992 +--- .../SimpleServer/SimpleServer.uvprojx | 871 ++- IDE/MDK5-ARM/Projects/SimpleServer/server.c | 605 -- 8 files changed, 714 insertions(+), 9019 deletions(-) delete mode 100644 IDE/MDK5-ARM/Projects/CryptTest/test.c delete mode 100644 IDE/MDK5-ARM/Projects/EchoClient/echoclient.c delete mode 100644 IDE/MDK5-ARM/Projects/EchoServer/echoserver.c delete mode 100644 IDE/MDK5-ARM/Projects/SimpleClient/client.c delete mode 100644 IDE/MDK5-ARM/Projects/SimpleServer/server.c diff --git a/IDE/MDK5-ARM/Projects/CryptTest/test.c b/IDE/MDK5-ARM/Projects/CryptTest/test.c deleted file mode 100644 index 9b9bf3537..000000000 --- a/IDE/MDK5-ARM/Projects/CryptTest/test.c +++ /dev/null @@ -1,4863 +0,0 @@ -/* test.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 -#endif - -#include - -#ifdef XMALLOC_USER - #include /* we're using malloc / free direct here */ -#endif - -#ifndef NO_CRYPT_TEST - -#ifdef CYASSL_TEST_CERT - #include -#else - #include -#endif -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_ECC - #include -#endif -#ifdef HAVE_BLAKE2 - #include -#endif -#ifdef HAVE_LIBZ - #include -#endif -#ifdef HAVE_PKCS7 - #include -#endif - -#ifdef _MSC_VER - /* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */ - #pragma warning(disable: 4996) -#endif - -#ifdef OPENSSL_EXTRA - #include - #include - #include - #include -#endif - - -#if defined(USE_CERT_BUFFERS_1024) || defined(USE_CERT_BUFFERS_2048) - /* include test cert and key buffers for use with NO_FILESYSTEM */ - #if defined(CYASSL_MDK_ARM) - #include "cert_data.h" - /* use certs_test.c for initial data, so other - commands can share the data. */ - #else - #include - #endif -#endif - -#if defined(CYASSL_MDK_ARM) - #include - #include - extern FILE * CyaSSL_fopen(const char *fname, const char *mode) ; - #define fopen CyaSSL_fopen -#endif - -#ifdef HAVE_NTRU - #include "libntruencrypt/ntru_crypto.h" -#endif -#ifdef HAVE_CAVIUM - #include "cavium_sysdep.h" - #include "cavium_common.h" - #include "cavium_ioctl.h" -#endif - -#ifdef FREESCALE_MQX - #include - #include - #include -#else - #include -#endif - - -#ifdef THREADX - /* since just testing, use THREADX log printf instead */ - int dc_log_printf(char*, ...); - #undef printf - #define printf dc_log_printf -#endif - -#include "ctaocrypt/test/test.h" - - -typedef struct testVector { - const char* input; - const char* output; - size_t inLen; - size_t outLen; -} testVector; - -int md2_test(void); -int md5_test(void); -int md4_test(void); -int sha_test(void); -int sha256_test(void); -int sha512_test(void); -int sha384_test(void); -int hmac_md5_test(void); -int hmac_sha_test(void); -int hmac_sha256_test(void); -int hmac_sha384_test(void); -int hmac_sha512_test(void); -int hmac_blake2b_test(void); -int hkdf_test(void); -int arc4_test(void); -int hc128_test(void); -int rabbit_test(void); -int des_test(void); -int des3_test(void); -int aes_test(void); -int aesgcm_test(void); -int gmac_test(void); -int aesccm_test(void); -int camellia_test(void); -int rsa_test(void); -int dh_test(void); -int dsa_test(void); -int random_test(void); -int pwdbased_test(void); -int ripemd_test(void); -int openssl_test(void); /* test mini api */ -int pbkdf1_test(void); -int pkcs12_test(void); -int pbkdf2_test(void); -#ifdef HAVE_ECC - int ecc_test(void); - #ifdef HAVE_ECC_ENCRYPT - int ecc_encrypt_test(void); - #endif -#endif -#ifdef HAVE_BLAKE2 - int blake2b_test(void); -#endif -#ifdef HAVE_LIBZ - int compress_test(void); -#endif -#ifdef HAVE_PKCS7 - int pkcs7enveloped_test(void); - int pkcs7signed_test(void); -#endif - - - -static void err_sys(const char* msg, int es) -{ - printf("%s error = %d\n", msg, es); - #if !defined(THREADX) && !defined(CYASSL_MDK_ARM) - if (msg) - exit(es); - #endif - return; -} - -/* func_args from test.h, so don't have to pull in other junk */ -typedef struct func_args { - int argc; - char** argv; - int return_code; -} func_args; - - - -void ctaocrypt_test(void* args) -{ - int ret = 0; - - ((func_args*)args)->return_code = -1; /* error state */ - -#if !defined(NO_BIG_INT) - if (CheckCtcSettings() != 1) - err_sys("Build vs runtime math mismatch\n", -1234); - -#ifdef USE_FAST_MATH - if (CheckFastMathSettings() != 1) - err_sys("Build vs runtime fastmath FP_MAX_BITS mismatch\n", -1235); -#endif /* USE_FAST_MATH */ -#endif /* !NO_BIG_INT */ - - -#ifndef NO_MD5 - if ( (ret = md5_test()) != 0) - err_sys("MD5 test failed!\n", ret); - else - printf( "MD5 test passed!\n"); -#endif - -#ifdef CYASSL_MD2 - if ( (ret = md2_test()) != 0) - err_sys("MD2 test failed!\n", ret); - else - printf( "MD2 test passed!\n"); -#endif - -#ifndef NO_MD4 - if ( (ret = md4_test()) != 0) - err_sys("MD4 test failed!\n", ret); - else - printf( "MD4 test passed!\n"); -#endif - -#ifndef NO_SHA - if ( (ret = sha_test()) != 0) - err_sys("SHA test failed!\n", ret); - else - printf( "SHA test passed!\n"); -#endif - -#ifndef NO_SHA256 - if ( (ret = sha256_test()) != 0) - err_sys("SHA-256 test failed!\n", ret); - else - printf( "SHA-256 test passed!\n"); -#endif - -#ifdef CYASSL_SHA384 - if ( (ret = sha384_test()) != 0) - err_sys("SHA-384 test failed!\n", ret); - else - printf( "SHA-384 test passed!\n"); -#endif - -#ifdef CYASSL_SHA512 - if ( (ret = sha512_test()) != 0) - err_sys("SHA-512 test failed!\n", ret); - else - printf( "SHA-512 test passed!\n"); -#endif - -#ifdef CYASSL_RIPEMD - if ( (ret = ripemd_test()) != 0) - err_sys("RIPEMD test failed!\n", ret); - else - printf( "RIPEMD test passed!\n"); -#endif - -#ifdef HAVE_BLAKE2 - if ( (ret = blake2b_test()) != 0) - err_sys("BLAKE2b test failed!\n", ret); - else - printf( "BLAKE2b test passed!\n"); -#endif - -#ifndef NO_HMAC - #ifndef NO_MD5 - if ( (ret = hmac_md5_test()) != 0) - err_sys("HMAC-MD5 test failed!\n", ret); - else - printf( "HMAC-MD5 test passed!\n"); - #endif - - #ifndef NO_SHA - if ( (ret = hmac_sha_test()) != 0) - err_sys("HMAC-SHA test failed!\n", ret); - else - printf( "HMAC-SHA test passed!\n"); - #endif - - #ifndef NO_SHA256 - if ( (ret = hmac_sha256_test()) != 0) - err_sys("HMAC-SHA256 test failed!\n", ret); - else - printf( "HMAC-SHA256 test passed!\n"); - #endif - - #ifdef CYASSL_SHA384 - if ( (ret = hmac_sha384_test()) != 0) - err_sys("HMAC-SHA384 test failed!\n", ret); - else - printf( "HMAC-SHA384 test passed!\n"); - #endif - - #ifdef CYASSL_SHA512 - if ( (ret = hmac_sha512_test()) != 0) - err_sys("HMAC-SHA512 test failed!\n", ret); - else - printf( "HMAC-SHA512 test passed!\n"); - #endif - - #ifdef HAVE_BLAKE2 - if ( (ret = hmac_blake2b_test()) != 0) - err_sys("HMAC-BLAKE2 test failed!\n", ret); - else - printf( "HMAC-BLAKE2 test passed!\n"); - #endif - - #ifdef HAVE_HKDF - if ( (ret = hkdf_test()) != 0) - err_sys("HMAC-KDF test failed!\n", ret); - else - printf( "HMAC-KDF test passed!\n"); - #endif - -#endif - -#ifdef HAVE_AESGCM - if ( (ret = gmac_test()) != 0) - err_sys("GMAC test passed!\n", ret); - else - printf( "GMAC test passed!\n"); -#endif - -#ifndef NO_RC4 - if ( (ret = arc4_test()) != 0) - err_sys("ARC4 test failed!\n", ret); - else - printf( "ARC4 test passed!\n"); -#endif - -#ifndef NO_HC128 - if ( (ret = hc128_test()) != 0) - err_sys("HC-128 test failed!\n", ret); - else - printf( "HC-128 test passed!\n"); -#endif - -#ifndef NO_RABBIT - if ( (ret = rabbit_test()) != 0) - err_sys("Rabbit test failed!\n", ret); - else - printf( "Rabbit test passed!\n"); -#endif - -#ifndef NO_DES3 - if ( (ret = des_test()) != 0) - err_sys("DES test failed!\n", ret); - else - printf( "DES test passed!\n"); -#endif - -#ifndef NO_DES3 - if ( (ret = des3_test()) != 0) - err_sys("DES3 test failed!\n", ret); - else - printf( "DES3 test passed!\n"); -#endif - -#ifndef NO_AES - if ( (ret = aes_test()) != 0) - err_sys("AES test failed!\n", ret); - else - printf( "AES test passed!\n"); - -#ifdef HAVE_AESGCM - if ( (ret = aesgcm_test()) != 0) - err_sys("AES-GCM test failed!\n", ret); - else - printf( "AES-GCM test passed!\n"); -#endif - -#ifdef HAVE_AESCCM - if ( (ret = aesccm_test()) != 0) - err_sys("AES-CCM test failed!\n", ret); - else - printf( "AES-CCM test passed!\n"); -#endif -#endif - -#ifdef HAVE_CAMELLIA - if ( (ret = camellia_test()) != 0) - err_sys("CAMELLIA test failed!\n", ret); - else - printf( "CAMELLIA test passed!\n"); -#endif - - if ( (ret = random_test()) != 0) - err_sys("RANDOM test failed!\n", ret); - else - printf( "RANDOM test passed!\n"); - -#ifndef NO_RSA - if ( (ret = rsa_test()) != 0) - err_sys("RSA test failed!\n", ret); - else - printf( "RSA test passed!\n"); -#endif - -#ifndef NO_DH - if ( (ret = dh_test()) != 0) - err_sys("DH test failed!\n", ret); - else - printf( "DH test passed!\n"); -#endif - -#ifndef NO_DSA - if ( (ret = dsa_test()) != 0) - err_sys("DSA test failed!\n", ret); - else - printf( "DSA test passed!\n"); -#endif - -#ifndef NO_PWDBASED - if ( (ret = pwdbased_test()) != 0) - err_sys("PWDBASED test failed!\n", ret); - else - printf( "PWDBASED test passed!\n"); -#endif - -#ifdef OPENSSL_EXTRA - if ( (ret = openssl_test()) != 0) - err_sys("OPENSSL test failed!\n", ret); - else - printf( "OPENSSL test passed!\n"); -#endif - -#ifdef HAVE_ECC - if ( (ret = ecc_test()) != 0) - err_sys("ECC test failed!\n", ret); - else - printf( "ECC test passed!\n"); - #ifdef HAVE_ECC_ENCRYPT - if ( (ret = ecc_encrypt_test()) != 0) - err_sys("ECC Enc test failed!\n", ret); - else - printf( "ECC Enc test passed!\n"); - #endif -#endif - -#ifdef HAVE_LIBZ - if ( (ret = compress_test()) != 0) - err_sys("COMPRESS test failed!\n", ret); - else - printf( "COMPRESS test passed!\n"); -#endif - -#ifdef HAVE_PKCS7 - if ( (ret = pkcs7enveloped_test()) != 0) - err_sys("PKCS7enveloped test failed!\n", ret); - else - printf( "PKCS7enveloped test passed!\n"); - - if ( (ret = pkcs7signed_test()) != 0) - err_sys("PKCS7signed test failed!\n", ret); - else - printf( "PKCS7signed test passed!\n"); -#endif - - ((func_args*)args)->return_code = ret; -} - - -#ifndef NO_MAIN_DRIVER - -#ifdef HAVE_CAVIUM - -static int OpenNitroxDevice(int dma_mode,int dev_id) -{ - Csp1CoreAssignment core_assign; - Uint32 device; - - if (CspInitialize(CAVIUM_DIRECT,CAVIUM_DEV_ID)) - return -1; - if (Csp1GetDevType(&device)) - return -1; - if (device != NPX_DEVICE) { - if (ioctl(gpkpdev_hdlr[CAVIUM_DEV_ID], IOCTL_CSP1_GET_CORE_ASSIGNMENT, - (Uint32 *)&core_assign)!= 0) - return -1; - } - CspShutdown(CAVIUM_DEV_ID); - - return CspInitialize(dma_mode, dev_id); -} - -#endif /* HAVE_CAVIUM */ - - /* so overall tests can pull in test function */ - - int main(int argc, char** argv) - { - - func_args args; - - -#ifdef HAVE_CAVIUM - int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); - if (ret != 0) - err_sys("Cavium OpenNitroxDevice failed", -1236); -#endif /* HAVE_CAVIUM */ - - args.argc = argc; - args.argv = argv; - - ctaocrypt_test(&args); - -#ifdef HAVE_CAVIUM - CspShutdown(CAVIUM_DEV_ID); -#endif - - return args.return_code; - } - -#endif /* NO_MAIN_DRIVER */ - - -#ifdef CYASSL_MD2 -int md2_test() -{ - Md2 md2; - byte hash[MD2_DIGEST_SIZE]; - - testVector a, b, c, d, e, f, g; - testVector test_md2[7]; - int times = sizeof(test_md2) / sizeof(testVector), i; - - a.input = ""; - a.output = "\x83\x50\xe5\xa3\xe2\x4c\x15\x3d\xf2\x27\x5c\x9f\x80\x69" - "\x27\x73"; - a.inLen = strlen(a.input); - a.outLen = MD2_DIGEST_SIZE; - - b.input = "a"; - b.output = "\x32\xec\x01\xec\x4a\x6d\xac\x72\xc0\xab\x96\xfb\x34\xc0" - "\xb5\xd1"; - b.inLen = strlen(b.input); - b.outLen = MD2_DIGEST_SIZE; - - c.input = "abc"; - c.output = "\xda\x85\x3b\x0d\x3f\x88\xd9\x9b\x30\x28\x3a\x69\xe6\xde" - "\xd6\xbb"; - c.inLen = strlen(c.input); - c.outLen = MD2_DIGEST_SIZE; - - d.input = "message digest"; - d.output = "\xab\x4f\x49\x6b\xfb\x2a\x53\x0b\x21\x9f\xf3\x30\x31\xfe" - "\x06\xb0"; - d.inLen = strlen(d.input); - d.outLen = MD2_DIGEST_SIZE; - - e.input = "abcdefghijklmnopqrstuvwxyz"; - e.output = "\x4e\x8d\xdf\xf3\x65\x02\x92\xab\x5a\x41\x08\xc3\xaa\x47" - "\x94\x0b"; - e.inLen = strlen(e.input); - e.outLen = MD2_DIGEST_SIZE; - - f.input = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345" - "6789"; - f.output = "\xda\x33\xde\xf2\xa4\x2d\xf1\x39\x75\x35\x28\x46\xc3\x03" - "\x38\xcd"; - f.inLen = strlen(f.input); - f.outLen = MD2_DIGEST_SIZE; - - g.input = "1234567890123456789012345678901234567890123456789012345678" - "9012345678901234567890"; - g.output = "\xd5\x97\x6f\x79\xd8\x3d\x3a\x0d\xc9\x80\x6c\x3c\x66\xf3" - "\xef\xd8"; - g.inLen = strlen(g.input); - g.outLen = MD2_DIGEST_SIZE; - - test_md2[0] = a; - test_md2[1] = b; - test_md2[2] = c; - test_md2[3] = d; - test_md2[4] = e; - test_md2[5] = f; - test_md2[6] = g; - - InitMd2(&md2); - - for (i = 0; i < times; ++i) { - Md2Update(&md2, (byte*)test_md2[i].input, (word32)test_md2[i].inLen); - Md2Final(&md2, hash); - - if (memcmp(hash, test_md2[i].output, MD2_DIGEST_SIZE) != 0) - return -155 - i; - } - - return 0; -} -#endif - -#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 = MD5_DIGEST_SIZE; - - 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 = MD5_DIGEST_SIZE; - - 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 = MD5_DIGEST_SIZE; - - 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 = MD5_DIGEST_SIZE; - - 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 = MD5_DIGEST_SIZE; - - test_md5[0] = a; - test_md5[1] = b; - test_md5[2] = c; - test_md5[3] = d; - test_md5[4] = e; - - InitMd5(&md5); - - for (i = 0; i < times; ++i) { - Md5Update(&md5, (byte*)test_md5[i].input, (word32)test_md5[i].inLen); - Md5Final(&md5, hash); - - if (memcmp(hash, test_md5[i].output, MD5_DIGEST_SIZE) != 0) - return -5 - i; - } - - return 0; -} -#endif /* NO_MD5 */ - - -#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 = MD4_DIGEST_SIZE; - - 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 = MD4_DIGEST_SIZE; - - 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 = MD4_DIGEST_SIZE; - - 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 = MD4_DIGEST_SIZE; - - 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 = MD4_DIGEST_SIZE; - - 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 = MD4_DIGEST_SIZE; - - 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 = MD4_DIGEST_SIZE; - - 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; - - InitMd4(&md4); - - for (i = 0; i < times; ++i) { - Md4Update(&md4, (byte*)test_md4[i].input, (word32)test_md4[i].inLen); - Md4Final(&md4, hash); - - if (memcmp(hash, test_md4[i].output, MD4_DIGEST_SIZE) != 0) - return -205 - i; - } - - return 0; -} - -#endif /* NO_MD4 */ - -#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; - 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 = SHA_DIGEST_SIZE; - - 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 = SHA_DIGEST_SIZE; - - 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 = SHA_DIGEST_SIZE; - - 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 = SHA_DIGEST_SIZE; - - test_sha[0] = a; - test_sha[1] = b; - test_sha[2] = c; - test_sha[3] = d; - - ret = InitSha(&sha); - if (ret != 0) - return -4001; - - for (i = 0; i < times; ++i) { - ShaUpdate(&sha, (byte*)test_sha[i].input, (word32)test_sha[i].inLen); - ShaFinal(&sha, hash); - - if (memcmp(hash, test_sha[i].output, SHA_DIGEST_SIZE) != 0) - return -10 - i; - } - - return 0; -} - -#endif /* NO_SHA */ - -#ifdef CYASSL_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 = RIPEMD_DIGEST_SIZE; - - 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 = RIPEMD_DIGEST_SIZE; - - 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 = RIPEMD_DIGEST_SIZE; - - 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 = RIPEMD_DIGEST_SIZE; - - test_ripemd[0] = a; - test_ripemd[1] = b; - test_ripemd[2] = c; - test_ripemd[3] = d; - - InitRipeMd(&ripemd); - - for (i = 0; i < times; ++i) { - RipeMdUpdate(&ripemd, (byte*)test_ripemd[i].input, - (word32)test_ripemd[i].inLen); - RipeMdFinal(&ripemd, hash); - - if (memcmp(hash, test_ripemd[i].output, RIPEMD_DIGEST_SIZE) != 0) - return -10 - i; - } - - return 0; -} -#endif /* CYASSL_RIPEMD */ - - -#ifdef HAVE_BLAKE2 - - -#define BLAKE2_TESTS 3 - -static const byte blake2b_vec[BLAKE2_TESTS][BLAKE2B_OUTBYTES] = -{ - { - 0x78, 0x6A, 0x02, 0xF7, 0x42, 0x01, 0x59, 0x03, - 0xC6, 0xC6, 0xFD, 0x85, 0x25, 0x52, 0xD2, 0x72, - 0x91, 0x2F, 0x47, 0x40, 0xE1, 0x58, 0x47, 0x61, - 0x8A, 0x86, 0xE2, 0x17, 0xF7, 0x1F, 0x54, 0x19, - 0xD2, 0x5E, 0x10, 0x31, 0xAF, 0xEE, 0x58, 0x53, - 0x13, 0x89, 0x64, 0x44, 0x93, 0x4E, 0xB0, 0x4B, - 0x90, 0x3A, 0x68, 0x5B, 0x14, 0x48, 0xB7, 0x55, - 0xD5, 0x6F, 0x70, 0x1A, 0xFE, 0x9B, 0xE2, 0xCE - }, - { - 0x2F, 0xA3, 0xF6, 0x86, 0xDF, 0x87, 0x69, 0x95, - 0x16, 0x7E, 0x7C, 0x2E, 0x5D, 0x74, 0xC4, 0xC7, - 0xB6, 0xE4, 0x8F, 0x80, 0x68, 0xFE, 0x0E, 0x44, - 0x20, 0x83, 0x44, 0xD4, 0x80, 0xF7, 0x90, 0x4C, - 0x36, 0x96, 0x3E, 0x44, 0x11, 0x5F, 0xE3, 0xEB, - 0x2A, 0x3A, 0xC8, 0x69, 0x4C, 0x28, 0xBC, 0xB4, - 0xF5, 0xA0, 0xF3, 0x27, 0x6F, 0x2E, 0x79, 0x48, - 0x7D, 0x82, 0x19, 0x05, 0x7A, 0x50, 0x6E, 0x4B - }, - { - 0x1C, 0x08, 0x79, 0x8D, 0xC6, 0x41, 0xAB, 0xA9, - 0xDE, 0xE4, 0x35, 0xE2, 0x25, 0x19, 0xA4, 0x72, - 0x9A, 0x09, 0xB2, 0xBF, 0xE0, 0xFF, 0x00, 0xEF, - 0x2D, 0xCD, 0x8E, 0xD6, 0xF8, 0xA0, 0x7D, 0x15, - 0xEA, 0xF4, 0xAE, 0xE5, 0x2B, 0xBF, 0x18, 0xAB, - 0x56, 0x08, 0xA6, 0x19, 0x0F, 0x70, 0xB9, 0x04, - 0x86, 0xC8, 0xA7, 0xD4, 0x87, 0x37, 0x10, 0xB1, - 0x11, 0x5D, 0x3D, 0xEB, 0xBB, 0x43, 0x27, 0xB5 - } -}; - - - -int blake2b_test(void) -{ - Blake2b b2b; - byte digest[64]; - byte input[64]; - int i, ret; - - for (i = 0; i < (int)sizeof(input); i++) - input[i] = (byte)i; - - for (i = 0; i < BLAKE2_TESTS; i++) { - ret = InitBlake2b(&b2b, 64); - if (ret != 0) - return -4002; - - ret = Blake2bUpdate(&b2b, input, i); - if (ret != 0) - return -4003; - - ret = Blake2bFinal(&b2b, digest, 64); - if (ret != 0) - return -4004; - - if (memcmp(digest, blake2b_vec[i], 64) != 0) { - return -300 - i; - } - } - - return 0; -} -#endif /* HAVE_BLAKE2 */ - - -#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 = SHA256_DIGEST_SIZE; - - 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 = SHA256_DIGEST_SIZE; - - test_sha[0] = a; - test_sha[1] = b; - - ret = InitSha256(&sha); - if (ret != 0) - return -4005; - - for (i = 0; i < times; ++i) { - ret = Sha256Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen); - if (ret != 0) - return -4006; - ret = Sha256Final(&sha, hash); - if (ret != 0) - return -4007; - - if (memcmp(hash, test_sha[i].output, SHA256_DIGEST_SIZE) != 0) - return -10 - i; - } - - return 0; -} -#endif - - -#ifdef CYASSL_SHA512 -int sha512_test(void) -{ - Sha512 sha; - byte hash[SHA512_DIGEST_SIZE]; - int ret; - - testVector a, b; - testVector test_sha[2]; - int times = sizeof(test_sha) / sizeof(struct testVector), i; - - 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 = SHA512_DIGEST_SIZE; - - 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 = SHA512_DIGEST_SIZE; - - test_sha[0] = a; - test_sha[1] = b; - - ret = InitSha512(&sha); - if (ret != 0) - return -4009; - - for (i = 0; i < times; ++i) { - ret = Sha512Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen); - if (ret != 0) - return -4010; - - ret = Sha512Final(&sha, hash); - if (ret != 0) - return -4011; - - if (memcmp(hash, test_sha[i].output, SHA512_DIGEST_SIZE) != 0) - return -10 - i; - } - - return 0; -} -#endif - - -#ifdef CYASSL_SHA384 -int sha384_test(void) -{ - Sha384 sha; - byte hash[SHA384_DIGEST_SIZE]; - int ret; - - testVector a, b; - testVector test_sha[2]; - int times = sizeof(test_sha) / sizeof(struct testVector), i; - - 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 = SHA384_DIGEST_SIZE; - - 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 = SHA384_DIGEST_SIZE; - - test_sha[0] = a; - test_sha[1] = b; - - ret = InitSha384(&sha); - if (ret != 0) - return -4012; - - for (i = 0; i < times; ++i) { - ret = Sha384Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen); - if (ret != 0) - return -4013; - - ret = Sha384Final(&sha, hash); - if (ret != 0) - return -4014; - - if (memcmp(hash, test_sha[i].output, SHA384_DIGEST_SIZE) != 0) - return -10 - i; - } - - return 0; -} -#endif /* CYASSL_SHA384 */ - - -#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 = MD5_DIGEST_SIZE; - - 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 = MD5_DIGEST_SIZE; - - 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 = MD5_DIGEST_SIZE; - - test_hmac[0] = a; - test_hmac[1] = b; - test_hmac[2] = c; - - for (i = 0; i < times; ++i) { -#if defined(HAVE_FIPS) || defined(HAVE_CAVIUM) - if (i == 1) - continue; /* cavium can't handle short keys, fips not allowed */ -#endif -#ifdef HAVE_CAVIUM - if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0) - return -20009; -#endif - ret = HmacSetKey(&hmac, MD5, (byte*)keys[i], (word32)strlen(keys[i])); - if (ret != 0) - return -4015; - ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input, - (word32)test_hmac[i].inLen); - if (ret != 0) - return -4016; - ret = HmacFinal(&hmac, hash); - if (ret != 0) - return -4017; - - if (memcmp(hash, test_hmac[i].output, MD5_DIGEST_SIZE) != 0) - return -20 - i; -#ifdef HAVE_CAVIUM - HmacFreeCavium(&hmac); -#endif - } - - return 0; -} -#endif /* NO_HMAC && NO_MD5 */ - -#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 = SHA_DIGEST_SIZE; - - 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 = SHA_DIGEST_SIZE; - - 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 = SHA_DIGEST_SIZE; - - test_hmac[0] = a; - test_hmac[1] = b; - test_hmac[2] = c; - - for (i = 0; i < times; ++i) { -#if defined(HAVE_FIPS) || defined(HAVE_CAVIUM) - if (i == 1) - continue; /* cavium can't handle short keys, fips not allowed */ -#endif -#ifdef HAVE_CAVIUM - if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0) - return -20010; -#endif - ret = HmacSetKey(&hmac, SHA, (byte*)keys[i], (word32)strlen(keys[i])); - if (ret != 0) - return -4018; - ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input, - (word32)test_hmac[i].inLen); - if (ret != 0) - return -4019; - ret = HmacFinal(&hmac, hash); - if (ret != 0) - return -4020; - - if (memcmp(hash, test_hmac[i].output, SHA_DIGEST_SIZE) != 0) - return -20 - i; -#ifdef HAVE_CAVIUM - HmacFreeCavium(&hmac); -#endif - } - - 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 = SHA256_DIGEST_SIZE; - - 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 = SHA256_DIGEST_SIZE; - - 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 = SHA256_DIGEST_SIZE; - - test_hmac[0] = a; - test_hmac[1] = b; - test_hmac[2] = c; - - for (i = 0; i < times; ++i) { -#if defined(HAVE_FIPS) || defined(HAVE_CAVIUM) - if (i == 1) - continue; /* cavium can't handle short keys, fips not allowed */ -#endif -#ifdef HAVE_CAVIUM - if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0) - return -20011; -#endif - ret = HmacSetKey(&hmac, SHA256, (byte*)keys[i],(word32)strlen(keys[i])); - if (ret != 0) - return -4021; - ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input, - (word32)test_hmac[i].inLen); - if (ret != 0) - return -4022; - ret = HmacFinal(&hmac, hash); - if (ret != 0) - return -4023; - - if (memcmp(hash, test_hmac[i].output, SHA256_DIGEST_SIZE) != 0) - return -20 - i; -#ifdef HAVE_CAVIUM - HmacFreeCavium(&hmac); -#endif - } - - return 0; -} -#endif - - -#if !defined(NO_HMAC) && defined(HAVE_BLAKE2) -int hmac_blake2b_test(void) -{ - Hmac hmac; - byte hash[BLAKE2B_256]; - - 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 = "\x72\x93\x0d\xdd\xf5\xf7\xe1\x78\x38\x07\x44\x18\x0b\x3f\x51" - "\x37\x25\xb5\x82\xc2\x08\x83\x2f\x1c\x99\xfd\x03\xa0\x16\x75" - "\xac\xfd"; - a.inLen = strlen(a.input); - a.outLen = BLAKE2B_256; - - b.input = "what do ya want for nothing?"; - b.output = "\x3d\x20\x50\x71\x05\xc0\x8c\x0c\x38\x44\x1e\xf7\xf9\xd1\x67" - "\x21\xff\x64\xf5\x94\x00\xcf\xf9\x75\x41\xda\x88\x61\x9d\x7c" - "\xda\x2b"; - b.inLen = strlen(b.input); - b.outLen = BLAKE2B_256; - - 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 = "\xda\xfe\x2a\x24\xfc\xe7\xea\x36\x34\xbe\x41\x92\xc7\x11\xa7" - "\x00\xae\x53\x9c\x11\x9c\x80\x74\x55\x22\x25\x4a\xb9\x55\xd3" - "\x0f\x87"; - c.inLen = strlen(c.input); - c.outLen = BLAKE2B_256; - - test_hmac[0] = a; - test_hmac[1] = b; - test_hmac[2] = c; - - for (i = 0; i < times; ++i) { -#if defined(HAVE_FIPS) || defined(HAVE_CAVIUM) - if (i == 1) - continue; /* cavium can't handle short keys, fips not allowed */ -#endif -#ifdef HAVE_CAVIUM - if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0) - return -20011; -#endif - ret = HmacSetKey(&hmac, BLAKE2B_ID, (byte*)keys[i], - (word32)strlen(keys[i])); - if (ret != 0) - return -4024; - ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input, - (word32)test_hmac[i].inLen); - if (ret != 0) - return -4025; - ret = HmacFinal(&hmac, hash); - if (ret != 0) - return -4026; - - if (memcmp(hash, test_hmac[i].output, BLAKE2B_256) != 0) - return -20 - i; -#ifdef HAVE_CAVIUM - HmacFreeCavium(&hmac); -#endif - } - - return 0; -} -#endif - - -#if !defined(NO_HMAC) && defined(CYASSL_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 = SHA384_DIGEST_SIZE; - - 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 = SHA384_DIGEST_SIZE; - - 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 = SHA384_DIGEST_SIZE; - - 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 = HmacSetKey(&hmac, SHA384, (byte*)keys[i],(word32)strlen(keys[i])); - if (ret != 0) - return -4027; - ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input, - (word32)test_hmac[i].inLen); - if (ret != 0) - return -4028; - ret = HmacFinal(&hmac, hash); - if (ret != 0) - return -4029; - - if (memcmp(hash, test_hmac[i].output, SHA384_DIGEST_SIZE) != 0) - return -20 - i; - } - - return 0; -} -#endif - - -#if !defined(NO_HMAC) && defined(CYASSL_SHA512) -int hmac_sha512_test(void) -{ - Hmac hmac; - byte hash[SHA512_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 = "\x87\xaa\x7c\xde\xa5\xef\x61\x9d\x4f\xf0\xb4\x24\x1a\x1d\x6c" - "\xb0\x23\x79\xf4\xe2\xce\x4e\xc2\x78\x7a\xd0\xb3\x05\x45\xe1" - "\x7c\xde\xda\xa8\x33\xb7\xd6\xb8\xa7\x02\x03\x8b\x27\x4e\xae" - "\xa3\xf4\xe4\xbe\x9d\x91\x4e\xeb\x61\xf1\x70\x2e\x69\x6c\x20" - "\x3a\x12\x68\x54"; - a.inLen = strlen(a.input); - a.outLen = SHA512_DIGEST_SIZE; - - b.input = "what do ya want for nothing?"; - b.output = "\x16\x4b\x7a\x7b\xfc\xf8\x19\xe2\xe3\x95\xfb\xe7\x3b\x56\xe0" - "\xa3\x87\xbd\x64\x22\x2e\x83\x1f\xd6\x10\x27\x0c\xd7\xea\x25" - "\x05\x54\x97\x58\xbf\x75\xc0\x5a\x99\x4a\x6d\x03\x4f\x65\xf8" - "\xf0\xe6\xfd\xca\xea\xb1\xa3\x4d\x4a\x6b\x4b\x63\x6e\x07\x0a" - "\x38\xbc\xe7\x37"; - b.inLen = strlen(b.input); - b.outLen = SHA512_DIGEST_SIZE; - - 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 = "\xfa\x73\xb0\x08\x9d\x56\xa2\x84\xef\xb0\xf0\x75\x6c\x89\x0b" - "\xe9\xb1\xb5\xdb\xdd\x8e\xe8\x1a\x36\x55\xf8\x3e\x33\xb2\x27" - "\x9d\x39\xbf\x3e\x84\x82\x79\xa7\x22\xc8\x06\xb4\x85\xa4\x7e" - "\x67\xc8\x07\xb9\x46\xa3\x37\xbe\xe8\x94\x26\x74\x27\x88\x59" - "\xe1\x32\x92\xfb"; - c.inLen = strlen(c.input); - c.outLen = SHA512_DIGEST_SIZE; - - 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 = HmacSetKey(&hmac, SHA512, (byte*)keys[i],(word32)strlen(keys[i])); - if (ret != 0) - return -4030; - ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input, - (word32)test_hmac[i].inLen); - if (ret != 0) - return -4031; - ret = HmacFinal(&hmac, hash); - if (ret != 0) - return -4032; - - if (memcmp(hash, test_hmac[i].output, SHA512_DIGEST_SIZE) != 0) - return -20 - i; - } - - return 0; -} -#endif - - -#ifndef NO_RC4 -int arc4_test(void) -{ - byte cipher[16]; - byte plain[16]; - - const char* keys[] = - { - "\x01\x23\x45\x67\x89\xab\xcd\xef", - "\x01\x23\x45\x67\x89\xab\xcd\xef", - "\x00\x00\x00\x00\x00\x00\x00\x00", - "\xef\x01\x23\x45" - }; - - testVector a, b, c, d; - testVector test_arc4[4]; - - int times = sizeof(test_arc4) / sizeof(testVector), i; - - a.input = "\x01\x23\x45\x67\x89\xab\xcd\xef"; - a.output = "\x75\xb7\x87\x80\x99\xe0\xc5\x96"; - a.inLen = 8; - a.outLen = 8; - - b.input = "\x00\x00\x00\x00\x00\x00\x00\x00"; - b.output = "\x74\x94\xc2\xe7\x10\x4b\x08\x79"; - b.inLen = 8; - b.outLen = 8; - - c.input = "\x00\x00\x00\x00\x00\x00\x00\x00"; - c.output = "\xde\x18\x89\x41\xa3\x37\x5d\x3a"; - c.inLen = 8; - c.outLen = 8; - - d.input = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; - d.output = "\xd6\xa1\x41\xa7\xec\x3c\x38\xdf\xbd\x61"; - d.inLen = 10; - d.outLen = 10; - - test_arc4[0] = a; - test_arc4[1] = b; - test_arc4[2] = c; - test_arc4[3] = d; - - for (i = 0; i < times; ++i) { - Arc4 enc; - Arc4 dec; - int keylen = 8; /* strlen with key 0x00 not good */ - if (i == 3) - keylen = 4; - -#ifdef HAVE_CAVIUM - if (Arc4InitCavium(&enc, CAVIUM_DEV_ID) != 0) - return -20001; - if (Arc4InitCavium(&dec, CAVIUM_DEV_ID) != 0) - return -20002; -#endif - - Arc4SetKey(&enc, (byte*)keys[i], keylen); - Arc4SetKey(&dec, (byte*)keys[i], keylen); - - Arc4Process(&enc, cipher, (byte*)test_arc4[i].input, - (word32)test_arc4[i].outLen); - Arc4Process(&dec, plain, cipher, (word32)test_arc4[i].outLen); - - if (memcmp(plain, test_arc4[i].input, test_arc4[i].outLen)) - return -20 - i; - - if (memcmp(cipher, test_arc4[i].output, test_arc4[i].outLen)) - return -20 - 5 - i; - -#ifdef HAVE_CAVIUM - Arc4FreeCavium(&enc); - Arc4FreeCavium(&dec); -#endif - } - - return 0; -} -#endif - - -int hc128_test(void) -{ -#ifdef HAVE_HC128 - byte cipher[16]; - byte plain[16]; - - const char* keys[] = - { - "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", - "\x00\x53\xA6\xF9\x4C\x9F\xF2\x45\x98\xEB\x3E\x91\xE4\x37\x8A\xDD", - "\x0F\x62\xB5\x08\x5B\xAE\x01\x54\xA7\xFA\x4D\xA0\xF3\x46\x99\xEC" - }; - - const char* ivs[] = - { - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", - "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", - "\x0D\x74\xDB\x42\xA9\x10\x77\xDE\x45\xAC\x13\x7A\xE1\x48\xAF\x16", - "\x28\x8F\xF6\x5D\xC4\x2B\x92\xF9\x60\xC7\x2E\x95\xFC\x63\xCA\x31" - }; - - - testVector a, b, c, d; - testVector test_hc128[4]; - - int times = sizeof(test_hc128) / sizeof(testVector), i; - - a.input = "\x00\x00\x00\x00\x00\x00\x00\x00"; - a.output = "\x37\x86\x02\xB9\x8F\x32\xA7\x48"; - a.inLen = 8; - a.outLen = 8; - - b.input = "\x00\x00\x00\x00\x00\x00\x00\x00"; - b.output = "\x33\x7F\x86\x11\xC6\xED\x61\x5F"; - b.inLen = 8; - b.outLen = 8; - - c.input = "\x00\x00\x00\x00\x00\x00\x00\x00"; - c.output = "\x2E\x1E\xD1\x2A\x85\x51\xC0\x5A"; - c.inLen = 8; - c.outLen = 8; - - d.input = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; - d.output = "\x1C\xD8\xAE\xDD\xFE\x52\xE2\x17\xE8\x35\xD0\xB7\xE8\x4E\x29"; - d.inLen = 15; - d.outLen = 15; - - test_hc128[0] = a; - test_hc128[1] = b; - test_hc128[2] = c; - test_hc128[3] = d; - - for (i = 0; i < times; ++i) { - HC128 enc; - HC128 dec; - - /* align keys/ivs in plain/cipher buffers */ - memcpy(plain, keys[i], 16); - memcpy(cipher, ivs[i], 16); - - Hc128_SetKey(&enc, plain, cipher); - Hc128_SetKey(&dec, plain, cipher); - - /* align input */ - memcpy(plain, test_hc128[i].input, test_hc128[i].outLen); - Hc128_Process(&enc, cipher, plain, (word32)test_hc128[i].outLen); - Hc128_Process(&dec, plain, cipher, (word32)test_hc128[i].outLen); - - if (memcmp(plain, test_hc128[i].input, test_hc128[i].outLen)) - return -120 - i; - - if (memcmp(cipher, test_hc128[i].output, test_hc128[i].outLen)) - return -120 - 5 - i; - } - -#endif /* HAVE_HC128 */ - return 0; -} - - -#ifndef NO_RABBIT -int rabbit_test(void) -{ - byte cipher[16]; - byte plain[16]; - - const char* keys[] = - { - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", - "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", - "\xAC\xC3\x51\xDC\xF1\x62\xFC\x3B\xFE\x36\x3D\x2E\x29\x13\x28\x91" - }; - - const char* ivs[] = - { - "\x00\x00\x00\x00\x00\x00\x00\x00", - "\x59\x7E\x26\xC1\x75\xF5\x73\xC3", - 0 - }; - - testVector a, b, c; - testVector test_rabbit[3]; - - int times = sizeof(test_rabbit) / sizeof(testVector), i; - - a.input = "\x00\x00\x00\x00\x00\x00\x00\x00"; - a.output = "\xED\xB7\x05\x67\x37\x5D\xCD\x7C"; - a.inLen = 8; - a.outLen = 8; - - b.input = "\x00\x00\x00\x00\x00\x00\x00\x00"; - b.output = "\x6D\x7D\x01\x22\x92\xCC\xDC\xE0"; - b.inLen = 8; - b.outLen = 8; - - c.input = "\x00\x00\x00\x00\x00\x00\x00\x00"; - c.output = "\x04\xCE\xCA\x7A\x1A\x86\x6E\x77"; - c.inLen = 8; - c.outLen = 8; - - test_rabbit[0] = a; - test_rabbit[1] = b; - test_rabbit[2] = c; - - for (i = 0; i < times; ++i) { - Rabbit enc; - Rabbit dec; - byte* iv; - - /* align keys/ivs in plain/cipher buffers */ - memcpy(plain, keys[i], 16); - if (ivs[i]) { - memcpy(cipher, ivs[i], 8); - iv = cipher; - } else - iv = NULL; - RabbitSetKey(&enc, plain, iv); - RabbitSetKey(&dec, plain, iv); - - /* align input */ - memcpy(plain, test_rabbit[i].input, test_rabbit[i].outLen); - RabbitProcess(&enc, cipher, plain, (word32)test_rabbit[i].outLen); - RabbitProcess(&dec, plain, cipher, (word32)test_rabbit[i].outLen); - - if (memcmp(plain, test_rabbit[i].input, test_rabbit[i].outLen)) - return -130 - i; - - if (memcmp(cipher, test_rabbit[i].output, test_rabbit[i].outLen)) - return -130 - 5 - i; - } - - return 0; -} -#endif /* NO_RABBIT */ - - -#ifndef NO_DES3 -int des_test(void) -{ - const byte vector[] = { /* "now is the time for all " w/o trailing 0 */ - 0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74, - 0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20, - 0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20 - }; - - byte plain[24]; - byte cipher[24]; - - Des enc; - Des dec; - - const byte key[] = - { - 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef - }; - - const byte iv[] = - { - 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef - }; - - const byte verify[] = - { - 0x8b,0x7c,0x52,0xb0,0x01,0x2b,0x6c,0xb8, - 0x4f,0x0f,0xeb,0xf3,0xfb,0x5f,0x86,0x73, - 0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b - }; - - int ret; - - ret = Des_SetKey(&enc, key, iv, DES_ENCRYPTION); - if (ret != 0) - return -31; - - Des_CbcEncrypt(&enc, cipher, vector, sizeof(vector)); - ret = Des_SetKey(&dec, key, iv, DES_DECRYPTION); - if (ret != 0) - return -32; - Des_CbcDecrypt(&dec, plain, cipher, sizeof(cipher)); - - if (memcmp(plain, vector, sizeof(plain))) - return -33; - - if (memcmp(cipher, verify, sizeof(cipher))) - return -34; - - return 0; -} -#endif /* NO_DES3 */ - - -#ifndef NO_DES3 -int des3_test(void) -{ - const byte vector[] = { /* "Now is the time for all " w/o trailing 0 */ - 0x4e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74, - 0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20, - 0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20 - }; - - byte plain[24]; - byte cipher[24]; - - Des3 enc; - Des3 dec; - - const byte key3[] = - { - 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef, - 0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10, - 0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 - }; - const byte iv3[] = - { - 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef, - 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, - 0x11,0x21,0x31,0x41,0x51,0x61,0x71,0x81 - - }; - - const byte verify3[] = - { - 0x43,0xa0,0x29,0x7e,0xd1,0x84,0xf8,0x0e, - 0x89,0x64,0x84,0x32,0x12,0xd5,0x08,0x98, - 0x18,0x94,0x15,0x74,0x87,0x12,0x7d,0xb0 - }; - - int ret; - - -#ifdef HAVE_CAVIUM - if (Des3_InitCavium(&enc, CAVIUM_DEV_ID) != 0) - return -20005; - if (Des3_InitCavium(&dec, CAVIUM_DEV_ID) != 0) - return -20006; -#endif - ret = Des3_SetKey(&enc, key3, iv3, DES_ENCRYPTION); - if (ret != 0) - return -31; - ret = Des3_SetKey(&dec, key3, iv3, DES_DECRYPTION); - if (ret != 0) - return -32; - ret = Des3_CbcEncrypt(&enc, cipher, vector, sizeof(vector)); - if (ret != 0) - return -33; - ret = Des3_CbcDecrypt(&dec, plain, cipher, sizeof(cipher)); - if (ret != 0) - return -34; - - if (memcmp(plain, vector, sizeof(plain))) - return -35; - - if (memcmp(cipher, verify3, sizeof(cipher))) - return -36; - -#ifdef HAVE_CAVIUM - Des3_FreeCavium(&enc); - Des3_FreeCavium(&dec); -#endif - return 0; -} -#endif /* NO_DES */ - - -#ifndef NO_AES -int aes_test(void) -{ - Aes enc; - Aes dec; - - const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */ - 0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74, - 0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20, - 0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20 - }; - - const byte verify[] = - { - 0x95,0x94,0x92,0x57,0x5f,0x42,0x81,0x53, - 0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb - }; - - byte key[] = "0123456789abcdef "; /* align */ - byte iv[] = "1234567890abcdef "; /* align */ - - byte cipher[AES_BLOCK_SIZE * 4]; - byte plain [AES_BLOCK_SIZE * 4]; - int ret; - -#ifdef HAVE_CAVIUM - if (AesInitCavium(&enc, CAVIUM_DEV_ID) != 0) - return -20003; - if (AesInitCavium(&dec, CAVIUM_DEV_ID) != 0) - return -20004; -#endif - ret = AesSetKey(&enc, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION); - if (ret != 0) - return -1001; - ret = AesSetKey(&dec, key, AES_BLOCK_SIZE, iv, AES_DECRYPTION); - if (ret != 0) - return -1002; - - ret = AesCbcEncrypt(&enc, cipher, msg, AES_BLOCK_SIZE); - if (ret != 0) - return -1005; - ret = AesCbcDecrypt(&dec, plain, cipher, AES_BLOCK_SIZE); - if (ret != 0) - return -1006; - - if (memcmp(plain, msg, AES_BLOCK_SIZE)) - return -60; - - if (memcmp(cipher, verify, AES_BLOCK_SIZE)) - return -61; - -#ifdef HAVE_CAVIUM - AesFreeCavium(&enc); - AesFreeCavium(&dec); -#endif -#ifdef CYASSL_AES_COUNTER - { - const byte ctrKey[] = - { - 0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6, - 0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c - }; - - const byte ctrIv[] = - { - 0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7, - 0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff - }; - - - const byte ctrPlain[] = - { - 0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96, - 0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a, - 0xae,0x2d,0x8a,0x57,0x1e,0x03,0xac,0x9c, - 0x9e,0xb7,0x6f,0xac,0x45,0xaf,0x8e,0x51, - 0x30,0xc8,0x1c,0x46,0xa3,0x5c,0xe4,0x11, - 0xe5,0xfb,0xc1,0x19,0x1a,0x0a,0x52,0xef, - 0xf6,0x9f,0x24,0x45,0xdf,0x4f,0x9b,0x17, - 0xad,0x2b,0x41,0x7b,0xe6,0x6c,0x37,0x10 - }; - - const byte ctrCipher[] = - { - 0x87,0x4d,0x61,0x91,0xb6,0x20,0xe3,0x26, - 0x1b,0xef,0x68,0x64,0x99,0x0d,0xb6,0xce, - 0x98,0x06,0xf6,0x6b,0x79,0x70,0xfd,0xff, - 0x86,0x17,0x18,0x7b,0xb9,0xff,0xfd,0xff, - 0x5a,0xe4,0xdf,0x3e,0xdb,0xd5,0xd3,0x5e, - 0x5b,0x4f,0x09,0x02,0x0d,0xb0,0x3e,0xab, - 0x1e,0x03,0x1d,0xda,0x2f,0xbe,0x03,0xd1, - 0x79,0x21,0x70,0xa0,0xf3,0x00,0x9c,0xee - }; - - const byte oddCipher[] = - { - 0xb9,0xd7,0xcb,0x08,0xb0,0xe1,0x7b,0xa0, - 0xc2 - }; - - AesSetKeyDirect(&enc, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION); - /* Ctr only uses encrypt, even on key setup */ - AesSetKeyDirect(&dec, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION); - - AesCtrEncrypt(&enc, cipher, ctrPlain, AES_BLOCK_SIZE*4); - AesCtrEncrypt(&dec, plain, cipher, AES_BLOCK_SIZE*4); - - if (memcmp(plain, ctrPlain, AES_BLOCK_SIZE*4)) - return -66; - - if (memcmp(cipher, ctrCipher, AES_BLOCK_SIZE*4)) - return -67; - - /* let's try with just 9 bytes, non block size test */ - AesSetKeyDirect(&enc, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION); - /* Ctr only uses encrypt, even on key setup */ - AesSetKeyDirect(&dec, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION); - - AesCtrEncrypt(&enc, cipher, ctrPlain, 9); - AesCtrEncrypt(&dec, plain, cipher, 9); - - if (memcmp(plain, ctrPlain, 9)) - return -68; - - if (memcmp(cipher, ctrCipher, 9)) - return -69; - - /* and an additional 9 bytes to reuse tmp left buffer */ - AesCtrEncrypt(&enc, cipher, ctrPlain, 9); - AesCtrEncrypt(&dec, plain, cipher, 9); - - if (memcmp(plain, ctrPlain, 9)) - return -70; - - if (memcmp(cipher, oddCipher, 9)) - return -71; - } -#endif /* CYASSL_AES_COUNTER */ - -#if defined(CYASSL_AESNI) && defined(CYASSL_AES_DIRECT) - { - const byte niPlain[] = - { - 0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96, - 0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a - }; - - const byte niCipher[] = - { - 0xf3,0xee,0xd1,0xbd,0xb5,0xd2,0xa0,0x3c, - 0x06,0x4b,0x5a,0x7e,0x3d,0xb1,0x81,0xf8 - }; - - const byte niKey[] = - { - 0x60,0x3d,0xeb,0x10,0x15,0xca,0x71,0xbe, - 0x2b,0x73,0xae,0xf0,0x85,0x7d,0x77,0x81, - 0x1f,0x35,0x2c,0x07,0x3b,0x61,0x08,0xd7, - 0x2d,0x98,0x10,0xa3,0x09,0x14,0xdf,0xf4 - }; - - XMEMSET(cipher, 0, AES_BLOCK_SIZE); - ret = AesSetKey(&enc, niKey, sizeof(niKey), cipher, AES_ENCRYPTION); - if (ret != 0) - return -1003; - AesEncryptDirect(&enc, cipher, niPlain); - if (XMEMCMP(cipher, niCipher, AES_BLOCK_SIZE) != 0) - return -20006; - - XMEMSET(plain, 0, AES_BLOCK_SIZE); - ret = AesSetKey(&dec, niKey, sizeof(niKey), plain, AES_DECRYPTION); - if (ret != 0) - return -1004; - AesDecryptDirect(&dec, plain, niCipher); - if (XMEMCMP(plain, niPlain, AES_BLOCK_SIZE) != 0) - return -20007; - } -#endif /* CYASSL_AESNI && CYASSL_AES_DIRECT */ - - return 0; -} - -#ifdef HAVE_AESGCM -int aesgcm_test(void) -{ - Aes enc; - - /* - * This is Test Case 16 from the document Galois/ - * Counter Mode of Operation (GCM) by McGrew and - * Viega. - */ - const byte k[] = - { - 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, - 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08, - 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c, - 0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08 - }; - - const byte iv[] = - { - 0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad, - 0xde, 0xca, 0xf8, 0x88 - }; - - const byte p[] = - { - 0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5, - 0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a, - 0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda, - 0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72, - 0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53, - 0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25, - 0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57, - 0xba, 0x63, 0x7b, 0x39 - }; - - const byte a[] = - { - 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, - 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, - 0xab, 0xad, 0xda, 0xd2 - }; - - const byte c[] = - { - 0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07, - 0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d, - 0x64, 0x3a, 0x8c, 0xdc, 0xbf, 0xe5, 0xc0, 0xc9, - 0x75, 0x98, 0xa2, 0xbd, 0x25, 0x55, 0xd1, 0xaa, - 0x8c, 0xb0, 0x8e, 0x48, 0x59, 0x0d, 0xbb, 0x3d, - 0xa7, 0xb0, 0x8b, 0x10, 0x56, 0x82, 0x88, 0x38, - 0xc5, 0xf6, 0x1e, 0x63, 0x93, 0xba, 0x7a, 0x0a, - 0xbc, 0xc9, 0xf6, 0x62 - }; - - const byte t[] = - { - 0x76, 0xfc, 0x6e, 0xce, 0x0f, 0x4e, 0x17, 0x68, - 0xcd, 0xdf, 0x88, 0x53, 0xbb, 0x2d, 0x55, 0x1b - }; - - byte t2[sizeof(t)]; - byte p2[sizeof(c)]; - byte c2[sizeof(p)]; - - int result; - - memset(t2, 0, sizeof(t2)); - memset(c2, 0, sizeof(c2)); - memset(p2, 0, sizeof(p2)); - - AesGcmSetKey(&enc, k, sizeof(k)); - /* AES-GCM encrypt and decrypt both use AES encrypt internally */ - AesGcmEncrypt(&enc, c2, p, sizeof(c2), iv, sizeof(iv), - t2, sizeof(t2), a, sizeof(a)); - if (memcmp(c, c2, sizeof(c2))) - return -68; - if (memcmp(t, t2, sizeof(t2))) - return -69; - - result = AesGcmDecrypt(&enc, p2, c2, sizeof(p2), iv, sizeof(iv), - t2, sizeof(t2), a, sizeof(a)); - if (result != 0) - return -70; - if (memcmp(p, p2, sizeof(p2))) - return -71; - - return 0; -} - -int gmac_test(void) -{ - Gmac gmac; - - const byte k1[] = - { - 0x89, 0xc9, 0x49, 0xe9, 0xc8, 0x04, 0xaf, 0x01, - 0x4d, 0x56, 0x04, 0xb3, 0x94, 0x59, 0xf2, 0xc8 - }; - const byte iv1[] = - { - 0xd1, 0xb1, 0x04, 0xc8, 0x15, 0xbf, 0x1e, 0x94, - 0xe2, 0x8c, 0x8f, 0x16 - }; - const byte a1[] = - { - 0x82, 0xad, 0xcd, 0x63, 0x8d, 0x3f, 0xa9, 0xd9, - 0xf3, 0xe8, 0x41, 0x00, 0xd6, 0x1e, 0x07, 0x77 - }; - const byte t1[] = - { - 0x88, 0xdb, 0x9d, 0x62, 0x17, 0x2e, 0xd0, 0x43, - 0xaa, 0x10, 0xf1, 0x6d, 0x22, 0x7d, 0xc4, 0x1b - }; - - const byte k2[] = - { - 0x40, 0xf7, 0xec, 0xb2, 0x52, 0x6d, 0xaa, 0xd4, - 0x74, 0x25, 0x1d, 0xf4, 0x88, 0x9e, 0xf6, 0x5b - }; - const byte iv2[] = - { - 0xee, 0x9c, 0x6e, 0x06, 0x15, 0x45, 0x45, 0x03, - 0x1a, 0x60, 0x24, 0xa7 - }; - const byte a2[] = - { - 0x94, 0x81, 0x2c, 0x87, 0x07, 0x4e, 0x15, 0x18, - 0x34, 0xb8, 0x35, 0xaf, 0x1c, 0xa5, 0x7e, 0x56 - }; - const byte t2[] = - { - 0xc6, 0x81, 0x79, 0x8e, 0x3d, 0xda, 0xb0, 0x9f, - 0x8d, 0x83, 0xb0, 0xbb, 0x14, 0xb6, 0x91 - }; - - const byte k3[] = - { - 0xb8, 0xe4, 0x9a, 0x5e, 0x37, 0xf9, 0x98, 0x2b, - 0xb9, 0x6d, 0xd0, 0xc9, 0xb6, 0xab, 0x26, 0xac - }; - const byte iv3[] = - { - 0xe4, 0x4a, 0x42, 0x18, 0x8c, 0xae, 0x94, 0x92, - 0x6a, 0x9c, 0x26, 0xb0 - }; - const byte a3[] = - { - 0x9d, 0xb9, 0x61, 0x68, 0xa6, 0x76, 0x7a, 0x31, - 0xf8, 0x29, 0xe4, 0x72, 0x61, 0x68, 0x3f, 0x8a - }; - const byte t3[] = - { - 0x23, 0xe2, 0x9f, 0x66, 0xe4, 0xc6, 0x52, 0x48 - }; - - byte tag[16]; - - memset(tag, 0, sizeof(tag)); - GmacSetKey(&gmac, k1, sizeof(k1)); - GmacUpdate(&gmac, iv1, sizeof(iv1), a1, sizeof(a1), tag, sizeof(t1)); - if (memcmp(t1, tag, sizeof(t1)) != 0) - return -126; - - memset(tag, 0, sizeof(tag)); - GmacSetKey(&gmac, k2, sizeof(k2)); - GmacUpdate(&gmac, iv2, sizeof(iv2), a2, sizeof(a2), tag, sizeof(t2)); - if (memcmp(t2, tag, sizeof(t2)) != 0) - return -127; - - memset(tag, 0, sizeof(tag)); - GmacSetKey(&gmac, k3, sizeof(k3)); - GmacUpdate(&gmac, iv3, sizeof(iv3), a3, sizeof(a3), tag, sizeof(t3)); - if (memcmp(t3, tag, sizeof(t3)) != 0) - return -128; - - return 0; -} -#endif /* HAVE_AESGCM */ - -#ifdef HAVE_AESCCM -int aesccm_test(void) -{ - Aes enc; - - /* key */ - const byte k[] = - { - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf - }; - - /* nonce */ - const byte iv[] = - { - 0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0, - 0xa1, 0xa2, 0xa3, 0xa4, 0xa5 - }; - - /* plaintext */ - const byte p[] = - { - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e - }; - - const byte a[] = - { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07 - }; - - const byte c[] = - { - 0x58, 0x8c, 0x97, 0x9a, 0x61, 0xc6, 0x63, 0xd2, - 0xf0, 0x66, 0xd0, 0xc2, 0xc0, 0xf9, 0x89, 0x80, - 0x6d, 0x5f, 0x6b, 0x61, 0xda, 0xc3, 0x84 - }; - - const byte t[] = - { - 0x17, 0xe8, 0xd1, 0x2c, 0xfd, 0xf9, 0x26, 0xe0 - }; - - byte t2[sizeof(t)]; - byte p2[sizeof(p)]; - byte c2[sizeof(c)]; - - int result; - - memset(t2, 0, sizeof(t2)); - memset(c2, 0, sizeof(c2)); - memset(p2, 0, sizeof(p2)); - - AesCcmSetKey(&enc, k, sizeof(k)); - /* AES-CCM encrypt and decrypt both use AES encrypt internally */ - AesCcmEncrypt(&enc, c2, p, sizeof(c2), iv, sizeof(iv), - t2, sizeof(t2), a, sizeof(a)); - if (memcmp(c, c2, sizeof(c2))) - return -107; - if (memcmp(t, t2, sizeof(t2))) - return -108; - - result = AesCcmDecrypt(&enc, p2, c2, sizeof(p2), iv, sizeof(iv), - t2, sizeof(t2), a, sizeof(a)); - if (result != 0) - return -109; - if (memcmp(p, p2, sizeof(p2))) - return -110; - - /* Test the authentication failure */ - t2[0]++; /* Corrupt the authentication tag. */ - result = AesCcmDecrypt(&enc, p2, c, sizeof(p2), iv, sizeof(iv), - t2, sizeof(t2), a, sizeof(a)); - if (result == 0) - return -111; - - /* Clear c2 to compare against p2. p2 should be set to zero in case of - * authentication fail. */ - memset(c2, 0, sizeof(c2)); - if (memcmp(p2, c2, sizeof(p2))) - return -112; - - return 0; -} -#endif /* HAVE_AESCCM */ - - -#endif /* NO_AES */ - - -#ifdef HAVE_CAMELLIA - -enum { - CAM_ECB_ENC, CAM_ECB_DEC, CAM_CBC_ENC, CAM_CBC_DEC -}; - -typedef struct { - int type; - const byte* plaintext; - const byte* iv; - const byte* ciphertext; - const byte* key; - word32 keySz; - int errorCode; -} test_vector_t; - -int camellia_test(void) -{ - /* Camellia ECB Test Plaintext */ - static const byte pte[] = - { - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, - 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 - }; - - /* Camellia ECB Test Initialization Vector */ - static const byte ive[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; - - /* Test 1: Camellia ECB 128-bit key */ - static const byte k1[] = - { - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, - 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10 - }; - static const byte c1[] = - { - 0x67, 0x67, 0x31, 0x38, 0x54, 0x96, 0x69, 0x73, - 0x08, 0x57, 0x06, 0x56, 0x48, 0xea, 0xbe, 0x43 - }; - - /* Test 2: Camellia ECB 192-bit key */ - static const byte k2[] = - { - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, - 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 - }; - static const byte c2[] = - { - 0xb4, 0x99, 0x34, 0x01, 0xb3, 0xe9, 0x96, 0xf8, - 0x4e, 0xe5, 0xce, 0xe7, 0xd7, 0x9b, 0x09, 0xb9 - }; - - /* Test 3: Camellia ECB 256-bit key */ - static const byte k3[] = - { - 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef, - 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10, - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff - }; - static const byte c3[] = - { - 0x9a, 0xcc, 0x23, 0x7d, 0xff, 0x16, 0xd7, 0x6c, - 0x20, 0xef, 0x7c, 0x91, 0x9e, 0x3a, 0x75, 0x09 - }; - - /* Camellia CBC Test Plaintext */ - static const byte ptc[] = - { - 0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96, - 0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A - }; - - /* Camellia CBC Test Initialization Vector */ - static const byte ivc[] = - { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F - }; - - /* Test 4: Camellia-CBC 128-bit key */ - static const byte k4[] = - { - 0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6, - 0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C - }; - static const byte c4[] = - { - 0x16, 0x07, 0xCF, 0x49, 0x4B, 0x36, 0xBB, 0xF0, - 0x0D, 0xAE, 0xB0, 0xB5, 0x03, 0xC8, 0x31, 0xAB - }; - - /* Test 5: Camellia-CBC 192-bit key */ - static const byte k5[] = - { - 0x8E, 0x73, 0xB0, 0xF7, 0xDA, 0x0E, 0x64, 0x52, - 0xC8, 0x10, 0xF3, 0x2B, 0x80, 0x90, 0x79, 0xE5, - 0x62, 0xF8, 0xEA, 0xD2, 0x52, 0x2C, 0x6B, 0x7B - }; - static const byte c5[] = - { - 0x2A, 0x48, 0x30, 0xAB, 0x5A, 0xC4, 0xA1, 0xA2, - 0x40, 0x59, 0x55, 0xFD, 0x21, 0x95, 0xCF, 0x93 - }; - - /* Test 6: CBC 256-bit key */ - static const byte k6[] = - { - 0x60, 0x3D, 0xEB, 0x10, 0x15, 0xCA, 0x71, 0xBE, - 0x2B, 0x73, 0xAE, 0xF0, 0x85, 0x7D, 0x77, 0x81, - 0x1F, 0x35, 0x2C, 0x07, 0x3B, 0x61, 0x08, 0xD7, - 0x2D, 0x98, 0x10, 0xA3, 0x09, 0x14, 0xDF, 0xF4 - }; - static const byte c6[] = - { - 0xE6, 0xCF, 0xA3, 0x5F, 0xC0, 0x2B, 0x13, 0x4A, - 0x4D, 0x2C, 0x0B, 0x67, 0x37, 0xAC, 0x3E, 0xDA - }; - - byte out[CAMELLIA_BLOCK_SIZE]; - Camellia cam; - int i, testsSz; - const test_vector_t testVectors[] = - { - {CAM_ECB_ENC, pte, ive, c1, k1, sizeof(k1), -114}, - {CAM_ECB_ENC, pte, ive, c2, k2, sizeof(k2), -115}, - {CAM_ECB_ENC, pte, ive, c3, k3, sizeof(k3), -116}, - {CAM_ECB_DEC, pte, ive, c1, k1, sizeof(k1), -117}, - {CAM_ECB_DEC, pte, ive, c2, k2, sizeof(k2), -118}, - {CAM_ECB_DEC, pte, ive, c3, k3, sizeof(k3), -119}, - {CAM_CBC_ENC, ptc, ivc, c4, k4, sizeof(k4), -120}, - {CAM_CBC_ENC, ptc, ivc, c5, k5, sizeof(k5), -121}, - {CAM_CBC_ENC, ptc, ivc, c6, k6, sizeof(k6), -122}, - {CAM_CBC_DEC, ptc, ivc, c4, k4, sizeof(k4), -123}, - {CAM_CBC_DEC, ptc, ivc, c5, k5, sizeof(k5), -124}, - {CAM_CBC_DEC, ptc, ivc, c6, k6, sizeof(k6), -125} - }; - - testsSz = sizeof(testVectors)/sizeof(test_vector_t); - for (i = 0; i < testsSz; i++) { - if (CamelliaSetKey(&cam, testVectors[i].key, testVectors[i].keySz, - testVectors[i].iv) != 0) - return testVectors[i].errorCode; - - switch (testVectors[i].type) { - case CAM_ECB_ENC: - CamelliaEncryptDirect(&cam, out, testVectors[i].plaintext); - if (memcmp(out, testVectors[i].ciphertext, CAMELLIA_BLOCK_SIZE)) - return testVectors[i].errorCode; - break; - case CAM_ECB_DEC: - CamelliaDecryptDirect(&cam, out, testVectors[i].ciphertext); - if (memcmp(out, testVectors[i].plaintext, CAMELLIA_BLOCK_SIZE)) - return testVectors[i].errorCode; - break; - case CAM_CBC_ENC: - CamelliaCbcEncrypt(&cam, out, testVectors[i].plaintext, - CAMELLIA_BLOCK_SIZE); - if (memcmp(out, testVectors[i].ciphertext, CAMELLIA_BLOCK_SIZE)) - return testVectors[i].errorCode; - break; - case CAM_CBC_DEC: - CamelliaCbcDecrypt(&cam, out, testVectors[i].ciphertext, - CAMELLIA_BLOCK_SIZE); - if (memcmp(out, testVectors[i].plaintext, CAMELLIA_BLOCK_SIZE)) - return testVectors[i].errorCode; - break; - default: - break; - } - } - - /* Setting the IV and checking it was actually set. */ - CamelliaSetIV(&cam, ivc); - if (XMEMCMP(cam.reg, ivc, CAMELLIA_BLOCK_SIZE)) - return -1; - - /* Setting the IV to NULL should be same as all zeros IV */ - if (CamelliaSetIV(&cam, NULL) != 0 || - XMEMCMP(cam.reg, ive, CAMELLIA_BLOCK_SIZE)) - return -1; - - /* First parameter should never be null */ - if (CamelliaSetIV(NULL, NULL) == 0) - return -1; - - /* First parameter should never be null, check it fails */ - if (CamelliaSetKey(NULL, k1, sizeof(k1), NULL) == 0) - return -1; - - /* Key should have a size of 16, 24, or 32 */ - if (CamelliaSetKey(&cam, k1, 0, NULL) == 0) - return -1; - - return 0; -} -#endif /* HAVE_CAMELLIA */ - - -#if defined(HAVE_HASHDRBG) || defined(NO_RC4) - -int random_test(void) -{ - const byte test1Entropy[] = - { - 0xa6, 0x5a, 0xd0, 0xf3, 0x45, 0xdb, 0x4e, 0x0e, 0xff, 0xe8, 0x75, 0xc3, - 0xa2, 0xe7, 0x1f, 0x42, 0xc7, 0x12, 0x9d, 0x62, 0x0f, 0xf5, 0xc1, 0x19, - 0xa9, 0xef, 0x55, 0xf0, 0x51, 0x85, 0xe0, 0xfb, 0x85, 0x81, 0xf9, 0x31, - 0x75, 0x17, 0x27, 0x6e, 0x06, 0xe9, 0x60, 0x7d, 0xdb, 0xcb, 0xcc, 0x2e - }; - const byte test1Output[] = - { - 0xd3, 0xe1, 0x60, 0xc3, 0x5b, 0x99, 0xf3, 0x40, 0xb2, 0x62, 0x82, 0x64, - 0xd1, 0x75, 0x10, 0x60, 0xe0, 0x04, 0x5d, 0xa3, 0x83, 0xff, 0x57, 0xa5, - 0x7d, 0x73, 0xa6, 0x73, 0xd2, 0xb8, 0xd8, 0x0d, 0xaa, 0xf6, 0xa6, 0xc3, - 0x5a, 0x91, 0xbb, 0x45, 0x79, 0xd7, 0x3f, 0xd0, 0xc8, 0xfe, 0xd1, 0x11, - 0xb0, 0x39, 0x13, 0x06, 0x82, 0x8a, 0xdf, 0xed, 0x52, 0x8f, 0x01, 0x81, - 0x21, 0xb3, 0xfe, 0xbd, 0xc3, 0x43, 0xe7, 0x97, 0xb8, 0x7d, 0xbb, 0x63, - 0xdb, 0x13, 0x33, 0xde, 0xd9, 0xd1, 0xec, 0xe1, 0x77, 0xcf, 0xa6, 0xb7, - 0x1f, 0xe8, 0xab, 0x1d, 0xa4, 0x66, 0x24, 0xed, 0x64, 0x15, 0xe5, 0x1c, - 0xcd, 0xe2, 0xc7, 0xca, 0x86, 0xe2, 0x83, 0x99, 0x0e, 0xea, 0xeb, 0x91, - 0x12, 0x04, 0x15, 0x52, 0x8b, 0x22, 0x95, 0x91, 0x02, 0x81, 0xb0, 0x2d, - 0xd4, 0x31, 0xf4, 0xc9, 0xf7, 0x04, 0x27, 0xdf - }; - const byte test2EntropyA[] = - { - 0x63, 0x36, 0x33, 0x77, 0xe4, 0x1e, 0x86, 0x46, 0x8d, 0xeb, 0x0a, 0xb4, - 0xa8, 0xed, 0x68, 0x3f, 0x6a, 0x13, 0x4e, 0x47, 0xe0, 0x14, 0xc7, 0x00, - 0x45, 0x4e, 0x81, 0xe9, 0x53, 0x58, 0xa5, 0x69, 0x80, 0x8a, 0xa3, 0x8f, - 0x2a, 0x72, 0xa6, 0x23, 0x59, 0x91, 0x5a, 0x9f, 0x8a, 0x04, 0xca, 0x68 - }; - const byte test2EntropyB[] = - { - 0xe6, 0x2b, 0x8a, 0x8e, 0xe8, 0xf1, 0x41, 0xb6, 0x98, 0x05, 0x66, 0xe3, - 0xbf, 0xe3, 0xc0, 0x49, 0x03, 0xda, 0xd4, 0xac, 0x2c, 0xdf, 0x9f, 0x22, - 0x80, 0x01, 0x0a, 0x67, 0x39, 0xbc, 0x83, 0xd3 - }; - const byte test2Output[] = - { - 0x04, 0xee, 0xc6, 0x3b, 0xb2, 0x31, 0xdf, 0x2c, 0x63, 0x0a, 0x1a, 0xfb, - 0xe7, 0x24, 0x94, 0x9d, 0x00, 0x5a, 0x58, 0x78, 0x51, 0xe1, 0xaa, 0x79, - 0x5e, 0x47, 0x73, 0x47, 0xc8, 0xb0, 0x56, 0x62, 0x1c, 0x18, 0xbd, 0xdc, - 0xdd, 0x8d, 0x99, 0xfc, 0x5f, 0xc2, 0xb9, 0x20, 0x53, 0xd8, 0xcf, 0xac, - 0xfb, 0x0b, 0xb8, 0x83, 0x12, 0x05, 0xfa, 0xd1, 0xdd, 0xd6, 0xc0, 0x71, - 0x31, 0x8a, 0x60, 0x18, 0xf0, 0x3b, 0x73, 0xf5, 0xed, 0xe4, 0xd4, 0xd0, - 0x71, 0xf9, 0xde, 0x03, 0xfd, 0x7a, 0xea, 0x10, 0x5d, 0x92, 0x99, 0xb8, - 0xaf, 0x99, 0xaa, 0x07, 0x5b, 0xdb, 0x4d, 0xb9, 0xaa, 0x28, 0xc1, 0x8d, - 0x17, 0x4b, 0x56, 0xee, 0x2a, 0x01, 0x4d, 0x09, 0x88, 0x96, 0xff, 0x22, - 0x82, 0xc9, 0x55, 0xa8, 0x19, 0x69, 0xe0, 0x69, 0xfa, 0x8c, 0xe0, 0x07, - 0xa1, 0x80, 0x18, 0x3a, 0x07, 0xdf, 0xae, 0x17 - }; - int ret; - - ret = RNG_HealthTest(0, test1Entropy, sizeof(test1Entropy), NULL, 0, - test1Output, sizeof(test1Output)); - if (ret != 0) return -39; - - ret = RNG_HealthTest(1, test2EntropyA, sizeof(test2EntropyA), - test2EntropyB, sizeof(test2EntropyB), - test2Output, sizeof(test2Output)); - if (ret != 0) return -40; - - return 0; -} - -#else /* HAVE_HASHDRBG || NO_RC4 */ - -int random_test(void) -{ - WC_RNG rng; - byte block[32]; - int ret; - -#ifdef HAVE_CAVIUM - ret = InitRngCavium(&rng, CAVIUM_DEV_ID); - if (ret != 0) return -2007; -#endif - ret = InitRng(&rng); - if (ret != 0) return -39; - - ret = RNG_GenerateBlock(&rng, block, sizeof(block)); - if (ret != 0) return -40; - - return 0; -} - -#endif /* HAVE_HASHDRBG || NO_RC4 */ - - -#ifdef HAVE_NTRU - -byte GetEntropy(ENTROPY_CMD cmd, byte* out); - -byte GetEntropy(ENTROPY_CMD cmd, byte* out) -{ - static WC_RNG rng; - - if (cmd == INIT) - return (InitRng(&rng) == 0) ? 1 : 0; - - if (out == NULL) - return 0; - - if (cmd == GET_BYTE_OF_ENTROPY) - return (RNG_GenerateBlock(&rng, out, 1) == 0) ? 1 : 0; - - if (cmd == GET_NUM_BYTES_PER_BYTE_OF_ENTROPY) { - *out = 1; - return 1; - } - - return 0; -} - -#endif /* HAVE_NTRU */ - -#ifndef NO_RSA - -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) - #ifdef FREESCALE_MQX - static const char* clientKey = "a:\\certs\\client-key.der"; - static const char* clientCert = "a:\\certs\\client-cert.der"; - #ifdef CYASSL_CERT_GEN - static const char* caKeyFile = "a:\\certs\\ca-key.der"; - static const char* caCertFile = "a:\\certs\\ca-cert.pem"; - #ifdef HAVE_ECC - static const char* eccCaKeyFile = "a:\\certs\\ecc-key.der"; - static const char* eccCaCertFile = "a:\\certs\\server-ecc.pem"; - #endif - #endif - #elif defined(CYASSL_MKD_SHELL) - static char* clientKey = "certs/client-key.der"; - static char* clientCert = "certs/client-cert.der"; - void set_clientKey(char *key) { clientKey = key ; } - void set_clientCert(char *cert) { clientCert = cert ; } - #ifdef CYASSL_CERT_GEN - static char* caKeyFile = "certs/ca-key.der"; - static char* caCertFile = "certs/ca-cert.pem"; - void set_caKeyFile (char * key) { caKeyFile = key ; } - void set_caCertFile(char * cert) { caCertFile = cert ; } - #ifdef HAVE_ECC - static const char* eccCaKeyFile = "certs/ecc-key.der"; - static const char* eccCaCertFile = "certs/server-ecc.pem"; - void set_eccCaKeyFile (char * key) { eccCaKeyFile = key ; } - void set_eccCaCertFile(char * cert) { eccCaCertFile = cert ; } - #endif - #endif - #else - static const char* clientKey = "./certs/client-key.der"; - static const char* clientCert = "./certs/client-cert.der"; - #ifdef CYASSL_CERT_GEN - static const char* caKeyFile = "./certs/ca-key.der"; - static const char* caCertFile = "./certs/ca-cert.pem"; - #ifdef HAVE_ECC - static const char* eccCaKeyFile = "./certs/ecc-key.der"; - static const char* eccCaCertFile = "./certs/server-ecc.pem"; - #endif - #endif - #endif -#endif - - - -#define FOURK_BUF 4096 - -int rsa_test(void) -{ - byte* tmp; - size_t bytes; - RsaKey key; - WC_RNG rng; - word32 idx = 0; - int ret; - byte in[] = "Everyone gets Friday off."; - word32 inLen = (word32)strlen((char*)in); - byte out[256]; - byte plain[256]; -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) - FILE* file, * file2; -#endif -#ifdef CYASSL_TEST_CERT - DecodedCert cert; -#endif - - tmp = (byte*)malloc(FOURK_BUF); - if (tmp == NULL) - return -40; - -#ifdef USE_CERT_BUFFERS_1024 - XMEMCPY(tmp, client_key_der_1024, sizeof_client_key_der_1024); - bytes = sizeof_client_key_der_1024; -#elif defined(USE_CERT_BUFFERS_2048) - XMEMCPY(tmp, client_key_der_2048, sizeof_client_key_der_2048); - bytes = sizeof_client_key_der_2048; -#else - file = fopen(clientKey, "rb"); - - if (!file) - err_sys("can't open ./certs/client-key.der, " - "Please run from CyaSSL home dir", -40); - - bytes = fread(tmp, 1, FOURK_BUF, file); - fclose(file); -#endif /* USE_CERT_BUFFERS */ - -#ifdef HAVE_CAVIUM - RsaInitCavium(&key, CAVIUM_DEV_ID); -#endif - ret = InitRsaKey(&key, 0); - if (ret != 0) return -39; - ret = RsaPrivateKeyDecode(tmp, &idx, &key, (word32)bytes); - if (ret != 0) return -41; - - ret = InitRng(&rng); - if (ret != 0) return -42; - - ret = RsaPublicEncrypt(in, inLen, out, sizeof(out), &key, &rng); - if (ret < 0) return -43; - - ret = RsaPrivateDecrypt(out, ret, plain, sizeof(plain), &key); - if (ret < 0) return -44; - - if (memcmp(plain, in, inLen)) return -45; - - ret = RsaSSL_Sign(in, inLen, out, sizeof(out), &key, &rng); - if (ret < 0) return -46; - - memset(plain, 0, sizeof(plain)); - ret = RsaSSL_Verify(out, ret, plain, sizeof(plain), &key); - if (ret < 0) return -47; - - if (memcmp(plain, in, ret)) return -48; - -#if defined(CYASSL_MDK_ARM) - #define sizeof(s) strlen((char *)(s)) -#endif - -#ifdef USE_CERT_BUFFERS_1024 - XMEMCPY(tmp, client_cert_der_1024, sizeof_client_cert_der_1024); - bytes = sizeof_client_cert_der_1024; -#elif defined(USE_CERT_BUFFERS_2048) - XMEMCPY(tmp, client_cert_der_2048, sizeof_client_cert_der_2048); - bytes = sizeof_client_cert_der_2048; -#else - file2 = fopen(clientCert, "rb"); - if (!file2) - return -49; - - bytes = fread(tmp, 1, FOURK_BUF, file2); - fclose(file2); -#endif - -#ifdef sizeof - #undef sizeof -#endif - -#ifdef CYASSL_TEST_CERT - InitDecodedCert(&cert, tmp, (word32)bytes, 0); - - ret = ParseCert(&cert, CERT_TYPE, NO_VERIFY, 0); - if (ret != 0) return -491; - - FreeDecodedCert(&cert); -#else - (void)bytes; -#endif - - -#ifdef CYASSL_KEY_GEN - { - byte* der; - byte* pem; - int derSz = 0; - int pemSz = 0; - RsaKey derIn; - RsaKey genKey; - FILE* keyFile; - FILE* pemFile; - - ret = InitRsaKey(&genKey, 0); - if (ret != 0) - return -300; - ret = MakeRsaKey(&genKey, 1024, 65537, &rng); - if (ret != 0) - return -301; - - der = (byte*)malloc(FOURK_BUF); - if (der == NULL) { - FreeRsaKey(&genKey); - return -307; - } - pem = (byte*)malloc(FOURK_BUF); - if (pem == NULL) { - free(der); - FreeRsaKey(&genKey); - return -308; - } - - derSz = RsaKeyToDer(&genKey, der, FOURK_BUF); - if (derSz < 0) { - free(der); - free(pem); - return -302; - } - - keyFile = fopen("./key.der", "wb"); - if (!keyFile) { - free(der); - free(pem); - FreeRsaKey(&genKey); - return -303; - } - ret = (int)fwrite(der, 1, derSz, keyFile); - fclose(keyFile); - if (ret != derSz) { - free(der); - free(pem); - FreeRsaKey(&genKey); - return -313; - } - - pemSz = DerToPem(der, derSz, pem, FOURK_BUF, PRIVATEKEY_TYPE); - if (pemSz < 0) { - free(der); - free(pem); - FreeRsaKey(&genKey); - return -304; - } - - pemFile = fopen("./key.pem", "wb"); - if (!pemFile) { - free(der); - free(pem); - FreeRsaKey(&genKey); - return -305; - } - ret = (int)fwrite(pem, 1, pemSz, pemFile); - fclose(pemFile); - if (ret != pemSz) { - free(der); - free(pem); - FreeRsaKey(&genKey); - return -314; - } - - ret = InitRsaKey(&derIn, 0); - if (ret != 0) { - free(der); - free(pem); - FreeRsaKey(&genKey); - return -3060; - } - idx = 0; - ret = RsaPrivateKeyDecode(der, &idx, &derIn, derSz); - if (ret != 0) { - free(der); - free(pem); - FreeRsaKey(&derIn); - FreeRsaKey(&genKey); - return -306; - } - - FreeRsaKey(&derIn); - FreeRsaKey(&genKey); - free(pem); - free(der); - } -#endif /* CYASSL_KEY_GEN */ - - -#ifdef CYASSL_CERT_GEN - /* self signed */ - { - Cert myCert; - byte* derCert; - byte* pem; - FILE* derFile; - FILE* pemFile; - int certSz; - int pemSz; -#ifdef CYASSL_TEST_CERT - DecodedCert decode; -#endif - - derCert = (byte*)malloc(FOURK_BUF); - if (derCert == NULL) - return -309; - pem = (byte*)malloc(FOURK_BUF); - if (pem == NULL) { - free(derCert); - return -310; - } - - InitCert(&myCert); - - strncpy(myCert.subject.country, "US", CTC_NAME_SIZE); - strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE); - strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE); - strncpy(myCert.subject.org, "yaSSL", CTC_NAME_SIZE); - strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE); - strncpy(myCert.subject.commonName, "www.yassl.com", CTC_NAME_SIZE); - strncpy(myCert.subject.email, "info@yassl.com", CTC_NAME_SIZE); - myCert.isCA = 1; - myCert.sigType = CTC_SHA256wRSA; - - certSz = MakeSelfCert(&myCert, derCert, FOURK_BUF, &key, &rng); - if (certSz < 0) { - free(derCert); - free(pem); - return -401; - } - -#ifdef CYASSL_TEST_CERT - InitDecodedCert(&decode, derCert, certSz, 0); - ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0); - if (ret != 0) { - free(derCert); - free(pem); - return -402; - } - FreeDecodedCert(&decode); -#endif - derFile = fopen("./cert.der", "wb"); - if (!derFile) { - free(derCert); - free(pem); - return -403; - } - ret = (int)fwrite(derCert, 1, certSz, derFile); - fclose(derFile); - if (ret != certSz) { - free(derCert); - free(pem); - return -414; - } - - pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE); - if (pemSz < 0) { - free(derCert); - free(pem); - return -404; - } - - pemFile = fopen("./cert.pem", "wb"); - if (!pemFile) { - free(derCert); - free(pem); - return -405; - } - ret = (int)fwrite(pem, 1, pemSz, pemFile); - fclose(pemFile); - if (ret != pemSz) { - free(derCert); - free(pem); - return -406; - } - free(pem); - free(derCert); - } - /* CA style */ - { - RsaKey caKey; - Cert myCert; - byte* derCert; - byte* pem; - FILE* derFile; - FILE* pemFile; - int certSz; - int pemSz; - size_t bytes3; - word32 idx3 = 0; - FILE* file3 ; -#ifdef CYASSL_TEST_CERT - DecodedCert decode; -#endif - - derCert = (byte*)malloc(FOURK_BUF); - if (derCert == NULL) - return -311; - pem = (byte*)malloc(FOURK_BUF); - if (pem == NULL) { - free(derCert); - return -312; - } - - file3 = fopen(caKeyFile, "rb"); - - if (!file3) { - free(derCert); - free(pem); - return -412; - } - - bytes3 = fread(tmp, 1, FOURK_BUF, file3); - fclose(file3); - - ret = InitRsaKey(&caKey, 0); - if (ret != 0) { - free(derCert); - free(pem); - return -411; - } - ret = RsaPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes3); - if (ret != 0) { - free(derCert); - free(pem); - FreeRsaKey(&caKey); - return -413; - } - - InitCert(&myCert); - - strncpy(myCert.subject.country, "US", CTC_NAME_SIZE); - strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE); - strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE); - strncpy(myCert.subject.org, "yaSSL", CTC_NAME_SIZE); - strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE); - strncpy(myCert.subject.commonName, "www.yassl.com", CTC_NAME_SIZE); - strncpy(myCert.subject.email, "info@yassl.com", CTC_NAME_SIZE); - - ret = SetIssuer(&myCert, caCertFile); - if (ret < 0) { - free(derCert); - free(pem); - FreeRsaKey(&caKey); - return -405; - } - - certSz = MakeCert(&myCert, derCert, FOURK_BUF, &key, NULL, &rng); - if (certSz < 0) { - free(derCert); - free(pem); - FreeRsaKey(&caKey); - return -407; - } - - certSz = SignCert(myCert.bodySz, myCert.sigType, derCert, FOURK_BUF, - &caKey, NULL, &rng); - if (certSz < 0) { - free(derCert); - free(pem); - FreeRsaKey(&caKey); - return -408; - } - - -#ifdef CYASSL_TEST_CERT - InitDecodedCert(&decode, derCert, certSz, 0); - ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0); - if (ret != 0) { - free(derCert); - free(pem); - FreeRsaKey(&caKey); - return -409; - } - FreeDecodedCert(&decode); -#endif - - derFile = fopen("./othercert.der", "wb"); - if (!derFile) { - free(derCert); - free(pem); - FreeRsaKey(&caKey); - return -410; - } - ret = (int)fwrite(derCert, 1, certSz, derFile); - fclose(derFile); - if (ret != certSz) { - free(derCert); - free(pem); - FreeRsaKey(&caKey); - return -416; - } - - pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE); - if (pemSz < 0) { - free(derCert); - free(pem); - FreeRsaKey(&caKey); - return -411; - } - - pemFile = fopen("./othercert.pem", "wb"); - if (!pemFile) { - free(derCert); - free(pem); - FreeRsaKey(&caKey); - return -412; - } - ret = (int)fwrite(pem, 1, pemSz, pemFile); - if (ret != pemSz) { - free(derCert); - free(pem); - FreeRsaKey(&caKey); - return -415; - } - fclose(pemFile); - free(pem); - free(derCert); - FreeRsaKey(&caKey); - } -#ifdef HAVE_ECC - /* ECC CA style */ - { - ecc_key caKey; - Cert myCert; - byte* derCert; - byte* pem; - FILE* derFile; - FILE* pemFile; - int certSz; - int pemSz; - size_t bytes3; - word32 idx3 = 0; - FILE* file3; -#ifdef CYASSL_TEST_CERT - DecodedCert decode; -#endif - - derCert = (byte*)malloc(FOURK_BUF); - if (derCert == NULL) - return -5311; - pem = (byte*)malloc(FOURK_BUF); - if (pem == NULL) { - free(derCert); - return -5312; - } - - file3 = fopen(eccCaKeyFile, "rb"); - - if (!file3) { - free(derCert); - free(pem); - return -5412; - } - - bytes3 = fread(tmp, 1, FOURK_BUF, file3); - fclose(file3); - - ecc_init(&caKey); - ret = EccPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes3); - if (ret != 0) { - free(derCert); - free(pem); - return -5413; - } - - InitCert(&myCert); - myCert.sigType = CTC_SHA256wECDSA; - - strncpy(myCert.subject.country, "US", CTC_NAME_SIZE); - strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE); - strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE); - strncpy(myCert.subject.org, "wolfSSL", CTC_NAME_SIZE); - strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE); - strncpy(myCert.subject.commonName, "www.wolfssl.com", CTC_NAME_SIZE); - strncpy(myCert.subject.email, "info@wolfssl.com", CTC_NAME_SIZE); - - ret = SetIssuer(&myCert, eccCaCertFile); - if (ret < 0) { - free(pem); - free(derCert); - ecc_free(&caKey); - return -5405; - } - - certSz = MakeCert(&myCert, derCert, FOURK_BUF, NULL, &caKey, &rng); - if (certSz < 0) { - free(pem); - free(derCert); - ecc_free(&caKey); - return -5407; - } - - certSz = SignCert(myCert.bodySz, myCert.sigType, derCert, FOURK_BUF, - NULL, &caKey, &rng); - if (certSz < 0) { - free(pem); - free(derCert); - ecc_free(&caKey); - return -5408; - } - -#ifdef CYASSL_TEST_CERT - InitDecodedCert(&decode, derCert, certSz, 0); - ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0); - if (ret != 0) { - free(pem); - free(derCert); - ecc_free(&caKey); - return -5409; - } - FreeDecodedCert(&decode); -#endif - - derFile = fopen("./certecc.der", "wb"); - if (!derFile) { - free(pem); - free(derCert); - ecc_free(&caKey); - return -5410; - } - ret = (int)fwrite(derCert, 1, certSz, derFile); - fclose(derFile); - if (ret != certSz) { - free(pem); - free(derCert); - ecc_free(&caKey); - return -5414; - } - - pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE); - if (pemSz < 0) { - free(pem); - free(derCert); - ecc_free(&caKey); - return -5411; - } - - pemFile = fopen("./certecc.pem", "wb"); - if (!pemFile) { - free(pem); - free(derCert); - ecc_free(&caKey); - return -5412; - } - ret = (int)fwrite(pem, 1, pemSz, pemFile); - if (ret != pemSz) { - free(pem); - free(derCert); - ecc_free(&caKey); - return -5415; - } - fclose(pemFile); - free(pem); - free(derCert); - ecc_free(&caKey); - } -#endif /* HAVE_ECC */ -#ifdef HAVE_NTRU - { - RsaKey caKey; - Cert myCert; - byte* derCert; - byte* pem; - FILE* derFile; - FILE* pemFile; - FILE* caFile; - FILE* ntruPrivFile; - int certSz; - int pemSz; - word32 idx3; -#ifdef CYASSL_TEST_CERT - DecodedCert decode; -#endif - derCert = (byte*)malloc(FOURK_BUF); - if (derCert == NULL) - return -311; - pem = (byte*)malloc(FOURK_BUF); - if (pem == NULL) { - free(derCert); - return -312; - } - - byte public_key[557]; /* sized for EES401EP2 */ - word16 public_key_len; /* no. of octets in public key */ - byte private_key[607]; /* sized for EES401EP2 */ - word16 private_key_len; /* no. of octets in private key */ - DRBG_HANDLE drbg; - static uint8_t const pers_str[] = { - 'C', 'y', 'a', 'S', 'S', 'L', ' ', 't', 'e', 's', 't' - }; - word32 rc = ntru_crypto_drbg_instantiate(112, pers_str, - sizeof(pers_str), GetEntropy, &drbg); - if (rc != DRBG_OK) { - free(derCert); - free(pem); - return -448; - } - - rc = ntru_crypto_ntru_encrypt_keygen(drbg, NTRU_EES401EP2, - &public_key_len, NULL, - &private_key_len, NULL); - if (rc != NTRU_OK) { - free(derCert); - free(pem); - return -449; - } - - rc = ntru_crypto_ntru_encrypt_keygen(drbg, NTRU_EES401EP2, - &public_key_len, public_key, - &private_key_len, private_key); - if (rc != NTRU_OK) { - free(derCert); - free(pem); - return -450; - } - - rc = ntru_crypto_drbg_uninstantiate(drbg); - - if (rc != NTRU_OK) { - free(derCert); - free(pem); - return -451; - } - - caFile = fopen(caKeyFile, "rb"); - - if (!caFile) { - free(derCert); - free(pem); - return -452; - } - - bytes = fread(tmp, 1, FOURK_BUF, caFile); - fclose(caFile); - - ret = InitRsaKey(&caKey, 0); - if (ret != 0) { - free(derCert); - free(pem); - return -453; - } - ret = RsaPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes); - if (ret != 0) { - free(derCert); - free(pem); - return -454; - } - - InitCert(&myCert); - - strncpy(myCert.subject.country, "US", CTC_NAME_SIZE); - strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE); - strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE); - strncpy(myCert.subject.org, "yaSSL", CTC_NAME_SIZE); - strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE); - strncpy(myCert.subject.commonName, "www.yassl.com", CTC_NAME_SIZE); - strncpy(myCert.subject.email, "info@yassl.com", CTC_NAME_SIZE); - - ret = SetIssuer(&myCert, caCertFile); - if (ret < 0) { - free(derCert); - free(pem); - FreeRsaKey(&caKey); - return -455; - } - - certSz = MakeNtruCert(&myCert, derCert, FOURK_BUF, public_key, - public_key_len, &rng); - if (certSz < 0) { - free(derCert); - free(pem); - FreeRsaKey(&caKey); - return -456; - } - - certSz = SignCert(myCert.bodySz, myCert.sigType, derCert, FOURK_BUF, - &caKey, NULL, &rng); - FreeRsaKey(&caKey); - if (certSz < 0) { - free(derCert); - free(pem); - return -457; - } - - -#ifdef CYASSL_TEST_CERT - InitDecodedCert(&decode, derCert, certSz, 0); - ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0); - if (ret != 0) { - free(derCert); - free(pem); - return -458; - } - FreeDecodedCert(&decode); -#endif - derFile = fopen("./ntru-cert.der", "wb"); - if (!derFile) { - free(derCert); - free(pem); - return -459; - } - ret = (int)fwrite(derCert, 1, certSz, derFile); - fclose(derFile); - if (ret != certSz) { - free(derCert); - free(pem); - return -473; - } - - pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE); - if (pemSz < 0) { - free(derCert); - free(pem); - return -460; - } - - pemFile = fopen("./ntru-cert.pem", "wb"); - if (!pemFile) { - free(derCert); - free(pem); - return -461; - } - ret = (int)fwrite(pem, 1, pemSz, pemFile); - fclose(pemFile); - if (ret != pemSz) { - free(derCert); - free(pem); - return -474; - } - - ntruPrivFile = fopen("./ntru-key.raw", "wb"); - if (!ntruPrivFile) { - free(derCert); - free(pem); - return -462; - } - ret = (int)fwrite(private_key, 1, private_key_len, ntruPrivFile); - fclose(ntruPrivFile); - if (ret != private_key_len) { - free(pem); - free(derCert); - return -475; - } - free(pem); - free(derCert); - } -#endif /* HAVE_NTRU */ -#ifdef CYASSL_CERT_REQ - { - Cert req; - byte* der; - byte* pem; - int derSz; - int pemSz; - FILE* reqFile; - - der = (byte*)malloc(FOURK_BUF); - if (der == NULL) - return -463; - pem = (byte*)malloc(FOURK_BUF); - if (pem == NULL) { - free(der); - return -464; - } - - InitCert(&req); - - req.version = 0; - req.isCA = 1; - strncpy(req.challengePw, "yassl123", CTC_NAME_SIZE); - strncpy(req.subject.country, "US", CTC_NAME_SIZE); - strncpy(req.subject.state, "OR", CTC_NAME_SIZE); - strncpy(req.subject.locality, "Portland", CTC_NAME_SIZE); - strncpy(req.subject.org, "yaSSL", CTC_NAME_SIZE); - strncpy(req.subject.unit, "Development", CTC_NAME_SIZE); - strncpy(req.subject.commonName, "www.yassl.com", CTC_NAME_SIZE); - strncpy(req.subject.email, "info@yassl.com", CTC_NAME_SIZE); - req.sigType = CTC_SHA256wRSA; - - derSz = MakeCertReq(&req, der, FOURK_BUF, &key, NULL); - if (derSz < 0) { - free(pem); - free(der); - return -465; - } - - derSz = SignCert(req.bodySz, req.sigType, der, FOURK_BUF, - &key, NULL, &rng); - if (derSz < 0) { - free(pem); - free(der); - return -466; - } - - pemSz = DerToPem(der, derSz, pem, FOURK_BUF, CERTREQ_TYPE); - if (pemSz < 0) { - free(pem); - free(der); - return -467; - } - - reqFile = fopen("./certreq.der", "wb"); - if (!reqFile) { - free(pem); - free(der); - return -468; - } - - ret = (int)fwrite(der, 1, derSz, reqFile); - fclose(reqFile); - if (ret != derSz) { - free(pem); - free(der); - return -471; - } - - reqFile = fopen("./certreq.pem", "wb"); - if (!reqFile) { - free(pem); - free(der); - return -469; - } - ret = (int)fwrite(pem, 1, pemSz, reqFile); - fclose(reqFile); - if (ret != pemSz) { - free(pem); - free(der); - return -470; - } - - free(pem); - free(der); - } -#endif /* CYASSL_CERT_REQ */ -#endif /* CYASSL_CERT_GEN */ - - FreeRsaKey(&key); -#ifdef HAVE_CAVIUM - RsaFreeCavium(&key); -#endif - free(tmp); - - return 0; -} - -#endif - - -#ifndef NO_DH - -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) - #ifdef FREESCALE_MQX - static const char* dhKey = "a:\certs\\dh2048.der"; - #else - static const char* dhKey = "./certs/dh2048.der"; - #endif -#endif - -int dh_test(void) -{ - int ret; - word32 bytes; - word32 idx = 0, privSz, pubSz, privSz2, pubSz2, agreeSz, agreeSz2; - byte tmp[1024]; - byte priv[256]; - byte pub[256]; - byte priv2[256]; - byte pub2[256]; - byte agree[256]; - byte agree2[256]; - DhKey key; - DhKey key2; - WC_RNG rng; - - -#ifdef USE_CERT_BUFFERS_1024 - XMEMCPY(tmp, dh_key_der_1024, sizeof_dh_key_der_1024); - bytes = sizeof_dh_key_der_1024; -#elif defined(USE_CERT_BUFFERS_2048) - XMEMCPY(tmp, dh_key_der_2048, sizeof_dh_key_der_2048); - bytes = sizeof_dh_key_der_2048; -#else - FILE* file = fopen(dhKey, "rb"); - - if (!file) - return -50; - - bytes = (word32) fread(tmp, 1, sizeof(tmp), file); - fclose(file); -#endif /* USE_CERT_BUFFERS */ - - InitDhKey(&key); - InitDhKey(&key2); - ret = DhKeyDecode(tmp, &idx, &key, bytes); - if (ret != 0) - return -51; - - idx = 0; - ret = DhKeyDecode(tmp, &idx, &key2, bytes); - if (ret != 0) - return -52; - - ret = InitRng(&rng); - if (ret != 0) - return -53; - - ret = DhGenerateKeyPair(&key, &rng, priv, &privSz, pub, &pubSz); - ret += DhGenerateKeyPair(&key2, &rng, priv2, &privSz2, pub2, &pubSz2); - if (ret != 0) - return -54; - - ret = DhAgree(&key, agree, &agreeSz, priv, privSz, pub2, pubSz2); - ret += DhAgree(&key2, agree2, &agreeSz2, priv2, privSz2, pub, pubSz); - if (ret != 0) - return -55; - - if (memcmp(agree, agree2, agreeSz)) - return -56; - - FreeDhKey(&key); - FreeDhKey(&key2); - - return 0; -} - -#endif /* NO_DH */ - - -#ifndef NO_DSA - -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) - #ifdef FREESCALE_MQX - static const char* dsaKey = "a:\\certs\\dsa2048.der"; - #else - static const char* dsaKey = "./certs/dsa2048.der"; - #endif -#endif - -int dsa_test(void) -{ - int ret, answer; - word32 bytes; - word32 idx = 0; - byte tmp[1024]; - DsaKey key; - WC_RNG rng; - Sha sha; - byte hash[SHA_DIGEST_SIZE]; - byte signature[40]; - - -#ifdef USE_CERT_BUFFERS_1024 - XMEMCPY(tmp, dsa_key_der_1024, sizeof_dsa_key_der_1024); - bytes = sizeof_dsa_key_der_1024; -#elif defined(USE_CERT_BUFFERS_2048) - XMEMCPY(tmp, dsa_key_der_2048, sizeof_dsa_key_der_2048); - bytes = sizeof_dsa_key_der_2048; -#else - FILE* file = fopen(dsaKey, "rb"); - - if (!file) - return -60; - - bytes = (word32) fread(tmp, 1, sizeof(tmp), file); - fclose(file); -#endif /* USE_CERT_BUFFERS */ - - ret = InitSha(&sha); - if (ret != 0) - return -4002; - ShaUpdate(&sha, tmp, bytes); - ShaFinal(&sha, hash); - - InitDsaKey(&key); - ret = DsaPrivateKeyDecode(tmp, &idx, &key, bytes); - if (ret != 0) return -61; - - ret = InitRng(&rng); - if (ret != 0) return -62; - - ret = DsaSign(hash, signature, &key, &rng); - if (ret != 0) return -63; - - ret = DsaVerify(hash, signature, &key, &answer); - if (ret != 0) return -64; - if (answer != 1) return -65; - - FreeDsaKey(&key); - - return 0; -} - -#endif /* NO_DSA */ - - -#ifdef OPENSSL_EXTRA - -int openssl_test(void) -{ - EVP_MD_CTX md_ctx; - testVector a, b, c, d, e, f; - byte hash[SHA_DIGEST_SIZE*4]; /* max size */ - - (void)e; - (void)f; - - a.input = "1234567890123456789012345678901234567890123456789012345678" - "9012345678901234567890"; - a.output = "\x57\xed\xf4\xa2\x2b\xe3\xc9\x55\xac\x49\xda\x2e\x21\x07\xb6" - "\x7a"; - a.inLen = strlen(a.input); - a.outLen = MD5_DIGEST_SIZE; - - EVP_MD_CTX_init(&md_ctx); - EVP_DigestInit(&md_ctx, EVP_md5()); - - EVP_DigestUpdate(&md_ctx, a.input, (unsigned long)a.inLen); - EVP_DigestFinal(&md_ctx, hash, 0); - - if (memcmp(hash, a.output, MD5_DIGEST_SIZE) != 0) - return -71; - - b.input = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - "aaaaaaaaaa"; - b.output = "\xAD\x5B\x3F\xDB\xCB\x52\x67\x78\xC2\x83\x9D\x2F\x15\x1E\xA7" - "\x53\x99\x5E\x26\xA0"; - b.inLen = strlen(b.input); - b.outLen = SHA_DIGEST_SIZE; - - EVP_MD_CTX_init(&md_ctx); - EVP_DigestInit(&md_ctx, EVP_sha1()); - - EVP_DigestUpdate(&md_ctx, b.input, (unsigned long)b.inLen); - EVP_DigestFinal(&md_ctx, hash, 0); - - if (memcmp(hash, b.output, SHA_DIGEST_SIZE) != 0) - return -72; - - - d.input = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"; - d.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"; - d.inLen = strlen(d.input); - d.outLen = SHA256_DIGEST_SIZE; - - EVP_MD_CTX_init(&md_ctx); - EVP_DigestInit(&md_ctx, EVP_sha256()); - - EVP_DigestUpdate(&md_ctx, d.input, (unsigned long)d.inLen); - EVP_DigestFinal(&md_ctx, hash, 0); - - if (memcmp(hash, d.output, SHA256_DIGEST_SIZE) != 0) - return -78; - -#ifdef CYASSL_SHA384 - - e.input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi" - "jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; - e.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"; - e.inLen = strlen(e.input); - e.outLen = SHA384_DIGEST_SIZE; - - EVP_MD_CTX_init(&md_ctx); - EVP_DigestInit(&md_ctx, EVP_sha384()); - - EVP_DigestUpdate(&md_ctx, e.input, e.inLen); - EVP_DigestFinal(&md_ctx, hash, 0); - - if (memcmp(hash, e.output, SHA384_DIGEST_SIZE) != 0) - return -79; - -#endif /* CYASSL_SHA384 */ - - -#ifdef CYASSL_SHA512 - - f.input = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi" - "jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu"; - f.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"; - f.inLen = strlen(f.input); - f.outLen = SHA512_DIGEST_SIZE; - - EVP_MD_CTX_init(&md_ctx); - EVP_DigestInit(&md_ctx, EVP_sha512()); - - EVP_DigestUpdate(&md_ctx, f.input, (unsigned long)f.inLen); - EVP_DigestFinal(&md_ctx, hash, 0); - - if (memcmp(hash, f.output, SHA512_DIGEST_SIZE) != 0) - return -80; - -#endif /* CYASSL_SHA512 */ - - - if (RAND_bytes(hash, sizeof(hash)) != 1) - return -73; - - c.input = "what do ya want for nothing?"; - c.output = "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7" - "\x38"; - c.inLen = strlen(c.input); - c.outLen = MD5_DIGEST_SIZE; - - HMAC(EVP_md5(), "Jefe", 4, (byte*)c.input, (int)c.inLen, hash, 0); - - if (memcmp(hash, c.output, MD5_DIGEST_SIZE) != 0) - return -74; - - { /* des test */ - const byte vector[] = { /* "now is the time for all " w/o trailing 0 */ - 0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74, - 0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20, - 0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20 - }; - - byte plain[24]; - byte cipher[24]; - - const_DES_cblock key = - { - 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef - }; - - DES_cblock iv = - { - 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef - }; - - DES_key_schedule sched; - - const byte verify[] = - { - 0x8b,0x7c,0x52,0xb0,0x01,0x2b,0x6c,0xb8, - 0x4f,0x0f,0xeb,0xf3,0xfb,0x5f,0x86,0x73, - 0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b - }; - - DES_key_sched(&key, &sched); - - DES_cbc_encrypt(vector, cipher, sizeof(vector), &sched, &iv, DES_ENCRYPT); - DES_cbc_encrypt(cipher, plain, sizeof(vector), &sched, &iv, DES_DECRYPT); - - if (memcmp(plain, vector, sizeof(vector)) != 0) - return -75; - - if (memcmp(cipher, verify, sizeof(verify)) != 0) - return -76; - - /* test changing iv */ - DES_ncbc_encrypt(vector, cipher, 8, &sched, &iv, DES_ENCRYPT); - DES_ncbc_encrypt(vector + 8, cipher + 8, 16, &sched, &iv, DES_ENCRYPT); - - if (memcmp(cipher, verify, sizeof(verify)) != 0) - return -77; - - } /* end des test */ - - { /* evp_cipher test */ - EVP_CIPHER_CTX ctx; - - - const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */ - 0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74, - 0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20, - 0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20 - }; - - const byte verify[] = - { - 0x95,0x94,0x92,0x57,0x5f,0x42,0x81,0x53, - 0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb - }; - - byte key[] = "0123456789abcdef "; /* align */ - byte iv[] = "1234567890abcdef "; /* align */ - - byte cipher[AES_BLOCK_SIZE * 4]; - byte plain [AES_BLOCK_SIZE * 4]; - - EVP_CIPHER_CTX_init(&ctx); - if (EVP_CipherInit(&ctx, EVP_aes_128_cbc(), key, iv, 1) == 0) - return -81; - - if (EVP_Cipher(&ctx, cipher, (byte*)msg, 16) == 0) - return -82; - - if (memcmp(cipher, verify, AES_BLOCK_SIZE)) - return -83; - - EVP_CIPHER_CTX_init(&ctx); - if (EVP_CipherInit(&ctx, EVP_aes_128_cbc(), key, iv, 0) == 0) - return -84; - - if (EVP_Cipher(&ctx, plain, cipher, 16) == 0) - return -85; - - if (memcmp(plain, msg, AES_BLOCK_SIZE)) - return -86; - - - } /* end evp_cipher test */ - - return 0; -} - -#endif /* OPENSSL_EXTRA */ - - -#ifndef NO_PWDBASED - -int pkcs12_test(void) -{ - const byte passwd[] = { 0x00, 0x73, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x67, - 0x00, 0x00 }; - const byte salt[] = { 0x0a, 0x58, 0xCF, 0x64, 0x53, 0x0d, 0x82, 0x3f }; - - const byte passwd2[] = { 0x00, 0x71, 0x00, 0x75, 0x00, 0x65, 0x00, 0x65, - 0x00, 0x67, 0x00, 0x00 }; - const byte salt2[] = { 0x16, 0x82, 0xC0, 0xfC, 0x5b, 0x3f, 0x7e, 0xc5 }; - byte derived[64]; - - const byte verify[] = { - 0x8A, 0xAA, 0xE6, 0x29, 0x7B, 0x6C, 0xB0, 0x46, - 0x42, 0xAB, 0x5B, 0x07, 0x78, 0x51, 0x28, 0x4E, - 0xB7, 0x12, 0x8F, 0x1A, 0x2A, 0x7F, 0xBC, 0xA3 - }; - - const byte verify2[] = { - 0x48, 0x3D, 0xD6, 0xE9, 0x19, 0xD7, 0xDE, 0x2E, - 0x8E, 0x64, 0x8B, 0xA8, 0xF8, 0x62, 0xF3, 0xFB, - 0xFB, 0xDC, 0x2B, 0xCB, 0x2C, 0x02, 0x95, 0x7F - }; - - int id = 1; - int kLen = 24; - int iterations = 1; - int ret = PKCS12_PBKDF(derived, passwd, sizeof(passwd), salt, 8, iterations, - kLen, SHA, id); - - if (ret < 0) - return -103; - - if ( (ret = memcmp(derived, verify, kLen)) != 0) - return -104; - - iterations = 1000; - ret = PKCS12_PBKDF(derived, passwd2, sizeof(passwd2), salt2, 8, iterations, - kLen, SHA, id); - if (ret < 0) - return -105; - - if ( (ret = memcmp(derived, verify2, 24)) != 0) - return -106; - - return 0; -} - - -int pbkdf2_test(void) -{ - char passwd[] = "password"; - const byte salt[] = { 0x78, 0x57, 0x8E, 0x5a, 0x5d, 0x63, 0xcb, 0x06 }; - int iterations = 2048; - int kLen = 24; - byte derived[64]; - - const byte verify[] = { - 0xBF, 0xDE, 0x6B, 0xE9, 0x4D, 0xF7, 0xE1, 0x1D, 0xD4, 0x09, 0xBC, 0xE2, - 0x0A, 0x02, 0x55, 0xEC, 0x32, 0x7C, 0xB9, 0x36, 0xFF, 0xE9, 0x36, 0x43 - - }; - - int ret = PBKDF2(derived, (byte*)passwd, (int)strlen(passwd), salt, 8, - iterations, kLen, SHA); - if (ret != 0) - return ret; - - if (memcmp(derived, verify, sizeof(verify)) != 0) - return -102; - - return 0; -} - - -int pbkdf1_test(void) -{ - char passwd[] = "password"; - const byte salt[] = { 0x78, 0x57, 0x8E, 0x5a, 0x5d, 0x63, 0xcb, 0x06 }; - int iterations = 1000; - int kLen = 16; - byte derived[16]; - - const byte verify[] = { - 0xDC, 0x19, 0x84, 0x7E, 0x05, 0xC6, 0x4D, 0x2F, 0xAF, 0x10, 0xEB, 0xFB, - 0x4A, 0x3D, 0x2A, 0x20 - }; - - PBKDF1(derived, (byte*)passwd, (int)strlen(passwd), salt, 8, iterations, - kLen, SHA); - - if (memcmp(derived, verify, sizeof(verify)) != 0) - return -101; - - return 0; -} - - -int pwdbased_test(void) -{ - int ret = pbkdf1_test(); - ret += pbkdf2_test(); - - return ret + pkcs12_test(); -} - -#endif /* NO_PWDBASED */ - -#if defined(HAVE_HKDF) && (!defined(NO_SHA) || !defined(NO_SHA256)) - -int hkdf_test(void) -{ - int ret; - int L = 42; - byte okm1[42]; - byte ikm1[22] = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b }; - byte salt1[13] ={ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c }; - byte info1[10] ={ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, - 0xf8, 0xf9 }; - byte res1[42] = { 0x0a, 0xc1, 0xaf, 0x70, 0x02, 0xb3, 0xd7, 0x61, - 0xd1, 0xe5, 0x52, 0x98, 0xda, 0x9d, 0x05, 0x06, - 0xb9, 0xae, 0x52, 0x05, 0x72, 0x20, 0xa3, 0x06, - 0xe0, 0x7b, 0x6b, 0x87, 0xe8, 0xdf, 0x21, 0xd0, - 0xea, 0x00, 0x03, 0x3d, 0xe0, 0x39, 0x84, 0xd3, - 0x49, 0x18 }; - byte res2[42] = { 0x08, 0x5a, 0x01, 0xea, 0x1b, 0x10, 0xf3, 0x69, - 0x33, 0x06, 0x8b, 0x56, 0xef, 0xa5, 0xad, 0x81, - 0xa4, 0xf1, 0x4b, 0x82, 0x2f, 0x5b, 0x09, 0x15, - 0x68, 0xa9, 0xcd, 0xd4, 0xf1, 0x55, 0xfd, 0xa2, - 0xc2, 0x2e, 0x42, 0x24, 0x78, 0xd3, 0x05, 0xf3, - 0xf8, 0x96 }; - byte res3[42] = { 0x8d, 0xa4, 0xe7, 0x75, 0xa5, 0x63, 0xc1, 0x8f, - 0x71, 0x5f, 0x80, 0x2a, 0x06, 0x3c, 0x5a, 0x31, - 0xb8, 0xa1, 0x1f, 0x5c, 0x5e, 0xe1, 0x87, 0x9e, - 0xc3, 0x45, 0x4e, 0x5f, 0x3c, 0x73, 0x8d, 0x2d, - 0x9d, 0x20, 0x13, 0x95, 0xfa, 0xa4, 0xb6, 0x1a, - 0x96, 0xc8 }; - byte res4[42] = { 0x3c, 0xb2, 0x5f, 0x25, 0xfa, 0xac, 0xd5, 0x7a, - 0x90, 0x43, 0x4f, 0x64, 0xd0, 0x36, 0x2f, 0x2a, - 0x2d, 0x2d, 0x0a, 0x90, 0xcf, 0x1a, 0x5a, 0x4c, - 0x5d, 0xb0, 0x2d, 0x56, 0xec, 0xc4, 0xc5, 0xbf, - 0x34, 0x00, 0x72, 0x08, 0xd5, 0xb8, 0x87, 0x18, - 0x58, 0x65 }; - - (void)res1; - (void)res2; - (void)res3; - (void)res4; - (void)salt1; - (void)info1; - -#ifndef NO_SHA - ret = HKDF(SHA, ikm1, 22, NULL, 0, NULL, 0, okm1, L); - if (ret != 0) - return -2001; - - if (memcmp(okm1, res1, L) != 0) - return -2002; - -#ifndef HAVE_FIPS - /* fips can't have key size under 14 bytes, salt is key too */ - ret = HKDF(SHA, ikm1, 11, salt1, 13, info1, 10, okm1, L); - if (ret != 0) - return -2003; - - if (memcmp(okm1, res2, L) != 0) - return -2004; -#endif /* HAVE_FIPS */ -#endif /* NO_SHA */ - -#ifndef NO_SHA256 - ret = HKDF(SHA256, ikm1, 22, NULL, 0, NULL, 0, okm1, L); - if (ret != 0) - return -2005; - - if (memcmp(okm1, res3, L) != 0) - return -2006; - -#ifndef HAVE_FIPS - /* fips can't have key size under 14 bytes, salt is key too */ - ret = HKDF(SHA256, ikm1, 22, salt1, 13, info1, 10, okm1, L); - if (ret != 0) - return -2007; - - if (memcmp(okm1, res4, L) != 0) - return -2007; -#endif /* HAVE_FIPS */ -#endif /* NO_SHA256 */ - - return 0; -} - -#endif /* HAVE_HKDF */ - - -#ifdef HAVE_ECC - -int ecc_test(void) -{ - WC_RNG rng; - byte sharedA[1024]; - byte sharedB[1024]; - byte sig[1024]; - byte digest[20]; - byte exportBuf[1024]; - word32 x, y; - int i, verify, ret; - ecc_key userA, userB, pubKey; - - ret = InitRng(&rng); - if (ret != 0) - return -1001; - - ecc_init(&userA); - ecc_init(&userB); - ecc_init(&pubKey); - - ret = ecc_make_key(&rng, 32, &userA); - - if (ret != 0) - return -1014; - - ret = ecc_make_key(&rng, 32, &userB); - - if (ret != 0) - return -1002; - - x = sizeof(sharedA); - ret = ecc_shared_secret(&userA, &userB, sharedA, &x); - - if (ret != 0) - return -1015; - - y = sizeof(sharedB); - ret = ecc_shared_secret(&userB, &userA, sharedB, &y); - - if (ret != 0) - return -1003; - - if (y != x) - return -1004; - - if (memcmp(sharedA, sharedB, x)) - return -1005; - - x = sizeof(exportBuf); - ret = ecc_export_x963(&userA, exportBuf, &x); - if (ret != 0) - return -1006; - - ret = ecc_import_x963(exportBuf, x, &pubKey); - - if (ret != 0) - return -1007; - - y = sizeof(sharedB); - ret = ecc_shared_secret(&userB, &pubKey, sharedB, &y); - - if (ret != 0) - return -1008; - - if (memcmp(sharedA, sharedB, y)) - return -1010; - - /* test DSA sign hash */ - for (i = 0; i < (int)sizeof(digest); i++) - digest[i] = (byte)i; - - x = sizeof(sig); - ret = ecc_sign_hash(digest, sizeof(digest), sig, &x, &rng, &userA); - - if (ret != 0) - return -1016; - - verify = 0; - ret = ecc_verify_hash(sig, x, digest, sizeof(digest), &verify, &userA); - - if (ret != 0) - return -1011; - - if (verify != 1) - return -1012; - - x = sizeof(exportBuf); - ret = ecc_export_private_only(&userA, exportBuf, &x); - if (ret != 0) - return -1013; - - ecc_free(&pubKey); - ecc_free(&userB); - ecc_free(&userA); - - return 0; -} - -#ifdef HAVE_ECC_ENCRYPT - -int ecc_encrypt_test(void) -{ - WC_RNG rng; - int ret; - ecc_key userA, userB; - byte msg[48]; - byte plain[48]; - byte out[80]; - word32 outSz = sizeof(out); - word32 plainSz = sizeof(plain); - int i; - - ret = InitRng(&rng); - if (ret != 0) - return -3001; - - ecc_init(&userA); - ecc_init(&userB); - - ret = ecc_make_key(&rng, 32, &userA); - ret += ecc_make_key(&rng, 32, &userB); - - if (ret != 0) - return -3002; - - for (i = 0; i < 48; i++) - msg[i] = i; - - /* encrypt msg to B */ - ret = ecc_encrypt(&userA, &userB, msg, sizeof(msg), out, &outSz, NULL); - if (ret != 0) - return -3003; - - /* decrypt msg from A */ - ret = ecc_decrypt(&userB, &userA, out, outSz, plain, &plainSz, NULL); - if (ret != 0) - return -3004; - - if (memcmp(plain, msg, sizeof(msg)) != 0) - return -3005; - - - { /* let's verify message exchange works, A is client, B is server */ - ecEncCtx* cliCtx = ecc_ctx_new(REQ_RESP_CLIENT, &rng); - ecEncCtx* srvCtx = ecc_ctx_new(REQ_RESP_SERVER, &rng); - - byte cliSalt[EXCHANGE_SALT_SZ]; - byte srvSalt[EXCHANGE_SALT_SZ]; - const byte* tmpSalt; - - if (cliCtx == NULL || srvCtx == NULL) - return -3006; - - /* get salt to send to peer */ - tmpSalt = ecc_ctx_get_own_salt(cliCtx); - if (tmpSalt == NULL) - return -3007; - memcpy(cliSalt, tmpSalt, EXCHANGE_SALT_SZ); - - tmpSalt = ecc_ctx_get_own_salt(srvCtx); - if (tmpSalt == NULL) - return -3007; - memcpy(srvSalt, tmpSalt, EXCHANGE_SALT_SZ); - - /* in actual use, we'd get the peer's salt over the transport */ - ret = ecc_ctx_set_peer_salt(cliCtx, srvSalt); - ret += ecc_ctx_set_peer_salt(srvCtx, cliSalt); - - ret += ecc_ctx_set_info(cliCtx, (byte*)"CyaSSL MSGE", 11); - ret += ecc_ctx_set_info(srvCtx, (byte*)"CyaSSL MSGE", 11); - - if (ret != 0) - return -3008; - - /* get encrypted msg (request) to send to B */ - outSz = sizeof(out); - ret = ecc_encrypt(&userA, &userB, msg, sizeof(msg), out, &outSz,cliCtx); - if (ret != 0) - return -3009; - - /* B decrypts msg (request) from A */ - plainSz = sizeof(plain); - ret = ecc_decrypt(&userB, &userA, out, outSz, plain, &plainSz, srvCtx); - if (ret != 0) - return -3010; - - if (memcmp(plain, msg, sizeof(msg)) != 0) - return -3011; - - { - /* msg2 (response) from B to A */ - byte msg2[48]; - byte plain2[48]; - byte out2[80]; - word32 outSz2 = sizeof(out2); - word32 plainSz2 = sizeof(plain2); - - for (i = 0; i < 48; i++) - msg2[i] = i+48; - - /* get encrypted msg (response) to send to B */ - ret = ecc_encrypt(&userB, &userA, msg2, sizeof(msg2), out2, - &outSz2, srvCtx); - if (ret != 0) - return -3012; - - /* A decrypts msg (response) from B */ - ret = ecc_decrypt(&userA, &userB, out2, outSz2, plain2, &plainSz2, - cliCtx); - if (ret != 0) - return -3013; - - if (memcmp(plain2, msg2, sizeof(msg2)) != 0) - return -3014; - } - - /* cleanup */ - ecc_ctx_free(srvCtx); - ecc_ctx_free(cliCtx); - } - - /* cleanup */ - ecc_free(&userB); - ecc_free(&userA); - - return 0; -} - -#endif /* HAVE_ECC_ENCRYPT */ -#endif /* HAVE_ECC */ - -#ifdef HAVE_LIBZ - -const byte sample_text[] = - "Biodiesel cupidatat marfa, cliche aute put a bird on it incididunt elit\n" - "polaroid. Sunt tattooed bespoke reprehenderit. Sint twee organic id\n" - "marfa. Commodo veniam ad esse gastropub. 3 wolf moon sartorial vero,\n" - "plaid delectus biodiesel squid +1 vice. Post-ironic keffiyeh leggings\n" - "selfies cray fap hoodie, forage anim. Carles cupidatat shoreditch, VHS\n" - "small batch meggings kogi dolore food truck bespoke gastropub.\n" - "\n" - "Terry richardson adipisicing actually typewriter tumblr, twee whatever\n" - "four loko you probably haven't heard of them high life. Messenger bag\n" - "whatever tattooed deep v mlkshk. Brooklyn pinterest assumenda chillwave\n" - "et, banksy ullamco messenger bag umami pariatur direct trade forage.\n" - "Typewriter culpa try-hard, pariatur sint brooklyn meggings. Gentrify\n" - "food truck next level, tousled irony non semiotics PBR ethical anim cred\n" - "readymade. Mumblecore brunch lomo odd future, portland organic terry\n" - "richardson elit leggings adipisicing ennui raw denim banjo hella. Godard\n" - "mixtape polaroid, pork belly readymade organic cray typewriter helvetica\n" - "four loko whatever street art yr farm-to-table.\n" - "\n" - "Vinyl keytar vice tofu. Locavore you probably haven't heard of them pug\n" - "pickled, hella tonx labore truffaut DIY mlkshk elit cosby sweater sint\n" - "et mumblecore. Elit swag semiotics, reprehenderit DIY sartorial nisi ugh\n" - "nesciunt pug pork belly wayfarers selfies delectus. Ethical hoodie\n" - "seitan fingerstache kale chips. Terry richardson artisan williamsburg,\n" - "eiusmod fanny pack irony tonx ennui lo-fi incididunt tofu YOLO\n" - "readymade. 8-bit sed ethnic beard officia. Pour-over iphone DIY butcher,\n" - "ethnic art party qui letterpress nisi proident jean shorts mlkshk\n" - "locavore.\n" - "\n" - "Narwhal flexitarian letterpress, do gluten-free voluptate next level\n" - "banh mi tonx incididunt carles DIY. Odd future nulla 8-bit beard ut\n" - "cillum pickled velit, YOLO officia you probably haven't heard of them\n" - "trust fund gastropub. Nisi adipisicing tattooed, Austin mlkshk 90's\n" - "small batch american apparel. Put a bird on it cosby sweater before they\n" - "sold out pork belly kogi hella. Street art mollit sustainable polaroid,\n" - "DIY ethnic ea pug beard dreamcatcher cosby sweater magna scenester nisi.\n" - "Sed pork belly skateboard mollit, labore proident eiusmod. Sriracha\n" - "excepteur cosby sweater, anim deserunt laborum eu aliquip ethical et\n" - "neutra PBR selvage.\n" - "\n" - "Raw denim pork belly truffaut, irony plaid sustainable put a bird on it\n" - "next level jean shorts exercitation. Hashtag keytar whatever, nihil\n" - "authentic aliquip disrupt laborum. Tattooed selfies deserunt trust fund\n" - "wayfarers. 3 wolf moon synth church-key sartorial, gastropub leggings\n" - "tattooed. Labore high life commodo, meggings raw denim fingerstache pug\n" - "trust fund leggings seitan forage. Nostrud ullamco duis, reprehenderit\n" - "incididunt flannel sustainable helvetica pork belly pug banksy you\n" - "probably haven't heard of them nesciunt farm-to-table. Disrupt nostrud\n" - "mollit magna, sriracha sartorial helvetica.\n" - "\n" - "Nulla kogi reprehenderit, skateboard sustainable duis adipisicing viral\n" - "ad fanny pack salvia. Fanny pack trust fund you probably haven't heard\n" - "of them YOLO vice nihil. Keffiyeh cray lo-fi pinterest cardigan aliqua,\n" - "reprehenderit aute. Culpa tousled williamsburg, marfa lomo actually anim\n" - "skateboard. Iphone aliqua ugh, semiotics pariatur vero readymade\n" - "organic. Marfa squid nulla, in laborum disrupt laboris irure gastropub.\n" - "Veniam sunt food truck leggings, sint vinyl fap.\n" - "\n" - "Hella dolore pork belly, truffaut carles you probably haven't heard of\n" - "them PBR helvetica in sapiente. Fashion axe ugh bushwick american\n" - "apparel. Fingerstache sed iphone, jean shorts blue bottle nisi bushwick\n" - "flexitarian officia veniam plaid bespoke fap YOLO lo-fi. Blog\n" - "letterpress mumblecore, food truck id cray brooklyn cillum ad sed.\n" - "Assumenda chambray wayfarers vinyl mixtape sustainable. VHS vinyl\n" - "delectus, culpa williamsburg polaroid cliche swag church-key synth kogi\n" - "magna pop-up literally. Swag thundercats ennui shoreditch vegan\n" - "pitchfork neutra truffaut etsy, sed single-origin coffee craft beer.\n" - "\n" - "Odio letterpress brooklyn elit. Nulla single-origin coffee in occaecat\n" - "meggings. Irony meggings 8-bit, chillwave lo-fi adipisicing cred\n" - "dreamcatcher veniam. Put a bird on it irony umami, trust fund bushwick\n" - "locavore kale chips. Sriracha swag thundercats, chillwave disrupt\n" - "tousled beard mollit mustache leggings portland next level. Nihil esse\n" - "est, skateboard art party etsy thundercats sed dreamcatcher ut iphone\n" - "swag consectetur et. Irure skateboard banjo, nulla deserunt messenger\n" - "bag dolor terry richardson sapiente.\n"; - - -int compress_test(void) -{ - int ret = 0; - word32 dSz = sizeof(sample_text); - word32 cSz = (dSz + (word32)(dSz * 0.001) + 12); - byte *c = NULL; - byte *d = NULL; - - c = calloc(cSz, sizeof(byte)); - d = calloc(dSz, sizeof(byte)); - - if (c == NULL || d == NULL) - ret = -300; - - if (ret == 0 && (ret = Compress(c, cSz, sample_text, dSz, 0)) < 0) - ret = -301; - - if (ret > 0) { - cSz = (word32)ret; - ret = 0; - } - - if (ret == 0 && DeCompress(d, dSz, c, cSz) != (int)dSz) - ret = -302; - - if (ret == 0 && memcmp(d, sample_text, dSz)) - ret = -303; - - if (c) free(c); - if (d) free(d); - - return ret; -} - -#endif /* HAVE_LIBZ */ - -#ifdef HAVE_PKCS7 - -int pkcs7enveloped_test(void) -{ - int ret = 0; - - int cipher = DES3b; - int envelopedSz, decodedSz; - PKCS7 pkcs7; - byte* cert; - byte* privKey; - byte enveloped[2048]; - byte decoded[2048]; - - size_t certSz; - size_t privKeySz; - FILE* certFile; - FILE* keyFile; - FILE* pkcs7File; - const char* pkcs7OutFile = "pkcs7envelopedData.der"; - - const byte data[] = { /* Hello World */ - 0x48,0x65,0x6c,0x6c,0x6f,0x20,0x57,0x6f, - 0x72,0x6c,0x64 - }; - - /* read client cert and key in DER format */ - cert = (byte*)malloc(FOURK_BUF); - if (cert == NULL) - return -201; - - privKey = (byte*)malloc(FOURK_BUF); - if (privKey == NULL) { - free(cert); - return -202; - } - - certFile = fopen(clientCert, "rb"); - if (!certFile) { - free(cert); - free(privKey); - err_sys("can't open ./certs/client-cert.der, " - "Please run from CyaSSL home dir", -42); - } - - certSz = fread(cert, 1, FOURK_BUF, certFile); - fclose(certFile); - - keyFile = fopen(clientKey, "rb"); - if (!keyFile) { - free(cert); - free(privKey); - err_sys("can't open ./certs/client-key.der, " - "Please run from CyaSSL home dir", -43); - } - - privKeySz = fread(privKey, 1, FOURK_BUF, keyFile); - fclose(keyFile); - - PKCS7_InitWithCert(&pkcs7, cert, (word32)certSz); - pkcs7.content = (byte*)data; - pkcs7.contentSz = (word32)sizeof(data); - pkcs7.contentOID = DATA; - pkcs7.encryptOID = cipher; - pkcs7.privateKey = privKey; - pkcs7.privateKeySz = (word32)privKeySz; - - /* encode envelopedData */ - envelopedSz = PKCS7_EncodeEnvelopedData(&pkcs7, enveloped, - sizeof(enveloped)); - if (envelopedSz <= 0) { - free(cert); - free(privKey); - return -203; - } - - /* decode envelopedData */ - decodedSz = PKCS7_DecodeEnvelopedData(&pkcs7, enveloped, envelopedSz, - decoded, sizeof(decoded)); - if (decodedSz <= 0) { - free(cert); - free(privKey); - return -204; - } - - /* test decode result */ - if (memcmp(decoded, data, sizeof(data)) != 0) { - free(cert); - free(privKey); - return -205; - } - - /* output pkcs7 envelopedData for external testing */ - pkcs7File = fopen(pkcs7OutFile, "wb"); - if (!pkcs7File) { - free(cert); - free(privKey); - return -206; - } - - ret = (int)fwrite(enveloped, envelopedSz, 1, pkcs7File); - fclose(pkcs7File); - - free(cert); - free(privKey); - PKCS7_Free(&pkcs7); - - if (ret > 0) - return 0; - - return ret; -} - -int pkcs7signed_test(void) -{ - int ret = 0; - - FILE* file; - byte* certDer; - byte* keyDer; - byte* out; - char data[] = "Hello World"; - word32 dataSz, outSz, certDerSz, keyDerSz; - PKCS7 msg; - WC_RNG rng; - - byte transIdOid[] = - { 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01, - 0x09, 0x07 }; - byte messageTypeOid[] = - { 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01, - 0x09, 0x02 }; - byte senderNonceOid[] = - { 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01, - 0x09, 0x05 }; - byte transId[(SHA_DIGEST_SIZE + 1) * 2 + 1]; - byte messageType[] = { 0x13, 2, '1', '9' }; - byte senderNonce[PKCS7_NONCE_SZ + 2]; - - PKCS7Attrib attribs[] = - { - { transIdOid, sizeof(transIdOid), - transId, sizeof(transId) - 1 }, /* take off the null */ - { messageTypeOid, sizeof(messageTypeOid), - messageType, sizeof(messageType) }, - { senderNonceOid, sizeof(senderNonceOid), - senderNonce, sizeof(senderNonce) } - }; - - dataSz = (word32) strlen(data); - outSz = FOURK_BUF; - - certDer = (byte*)malloc(FOURK_BUF); - if (certDer == NULL) - return -207; - keyDer = (byte*)malloc(FOURK_BUF); - if (keyDer == NULL) { - free(certDer); - return -208; - } - out = (byte*)malloc(FOURK_BUF); - if (out == NULL) { - free(certDer); - free(keyDer); - return -209; - } - - /* read in DER cert of recipient, into cert of size certSz */ - file = fopen(clientCert, "rb"); - if (!file) { - free(certDer); - free(keyDer); - free(out); - err_sys("can't open ./certs/client-cert.der, " - "Please run from CyaSSL home dir", -44); - } - certDerSz = (word32)fread(certDer, 1, FOURK_BUF, file); - fclose(file); - - file = fopen(clientKey, "rb"); - if (!file) { - free(certDer); - free(keyDer); - free(out); - err_sys("can't open ./certs/client-key.der, " - "Please run from CyaSSL home dir", -45); - } - keyDerSz = (word32)fread(keyDer, 1, FOURK_BUF, file); - fclose(file); - - ret = InitRng(&rng); - if (ret != 0) { - free(certDer); - free(keyDer); - free(out); - return -210; - } - - senderNonce[0] = 0x04; - senderNonce[1] = PKCS7_NONCE_SZ; - - ret = RNG_GenerateBlock(&rng, &senderNonce[2], PKCS7_NONCE_SZ); - if (ret != 0) { - free(certDer); - free(keyDer); - free(out); - return -211; - } - - PKCS7_InitWithCert(&msg, certDer, certDerSz); - msg.privateKey = keyDer; - msg.privateKeySz = keyDerSz; - msg.content = (byte*)data; - msg.contentSz = dataSz; - msg.hashOID = SHAh; - msg.encryptOID = RSAk; - msg.signedAttribs = attribs; - msg.signedAttribsSz = sizeof(attribs)/sizeof(PKCS7Attrib); - msg.rng = &rng; - { - Sha sha; - byte digest[SHA_DIGEST_SIZE]; - int i,j; - - transId[0] = 0x13; - transId[1] = SHA_DIGEST_SIZE * 2; - - ret = InitSha(&sha); - if (ret != 0) { - free(certDer); - free(keyDer); - free(out); - return -4003; - } - ShaUpdate(&sha, msg.publicKey, msg.publicKeySz); - ShaFinal(&sha, digest); - - for (i = 0, j = 2; i < SHA_DIGEST_SIZE; i++, j += 2) { - snprintf((char*)&transId[j], 3, "%02x", digest[i]); - } - } - ret = PKCS7_EncodeSignedData(&msg, out, outSz); - if (ret < 0) { - free(certDer); - free(keyDer); - free(out); - PKCS7_Free(&msg); - return -212; - } - else - outSz = ret; - - /* write PKCS#7 to output file for more testing */ - file = fopen("./pkcs7signedData.der", "wb"); - if (!file) { - free(certDer); - free(keyDer); - free(out); - PKCS7_Free(&msg); - return -213; - } - ret = (int)fwrite(out, 1, outSz, file); - fclose(file); - if (ret != (int)outSz) { - free(certDer); - free(keyDer); - free(out); - PKCS7_Free(&msg); - return -218; - } - - PKCS7_Free(&msg); - PKCS7_InitWithCert(&msg, NULL, 0); - - ret = PKCS7_VerifySignedData(&msg, out, outSz); - if (ret < 0) { - free(certDer); - free(keyDer); - free(out); - PKCS7_Free(&msg); - return -214; - } - - if (msg.singleCert == NULL || msg.singleCertSz == 0) { - free(certDer); - free(keyDer); - free(out); - PKCS7_Free(&msg); - return -215; - } - - file = fopen("./pkcs7cert.der", "wb"); - if (!file) { - free(certDer); - free(keyDer); - free(out); - PKCS7_Free(&msg); - return -216; - } - ret = (int)fwrite(msg.singleCert, 1, msg.singleCertSz, file); - fclose(file); - - free(certDer); - free(keyDer); - free(out); - PKCS7_Free(&msg); - - if (ret > 0) - return 0; - - return ret; -} - -#endif /* HAVE_PKCS7 */ - -#endif /* NO_CRYPT_TEST */ diff --git a/IDE/MDK5-ARM/Projects/EchoClient/echoclient.c b/IDE/MDK5-ARM/Projects/EchoClient/echoclient.c deleted file mode 100644 index 73c46ab18..000000000 --- a/IDE/MDK5-ARM/Projects/EchoClient/echoclient.c +++ /dev/null @@ -1,282 +0,0 @@ -/* echoclient.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 -#endif - -#include - -#include - -#if defined(CYASSL_MDK_ARM) - #include - #include - - #if defined(CYASSL_MDK5) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #endif - - #include "cyassl_MDK_ARM.h" -#endif - -#include - -#include "examples/echoclient/echoclient.h" - -void echoclient_test(void* args) -{ - SOCKET_T sockfd = 0; - - FILE* fin = stdin ; - FILE* fout = stdout; - - int inCreated = 0; - int outCreated = 0; - - char msg[1024]; - char reply[1024+1]; - - SSL_METHOD* method = 0; - SSL_CTX* ctx = 0; - SSL* ssl = 0; - - int doDTLS = 0; - int doPSK = 0; - int sendSz; - int argc = 0; - char** argv = 0; - word16 port = yasslPort; - - ((func_args*)args)->return_code = -1; /* error state */ - -#ifndef CYASSL_MDK_SHELL - argc = ((func_args*)args)->argc; - argv = ((func_args*)args)->argv; -#endif - - if (argc >= 2) { - fin = fopen(argv[1], "r"); - inCreated = 1; - } - if (argc >= 3) { - fout = fopen(argv[2], "w"); - outCreated = 1; - } - - if (!fin) err_sys("can't open input file"); - if (!fout) err_sys("can't open output file"); - -#ifdef CYASSL_DTLS - doDTLS = 1; -#endif - -#ifdef CYASSL_LEANPSK - doPSK = 1; -#endif - -#if defined(NO_RSA) && !defined(HAVE_ECC) - doPSK = 1; -#endif - -#if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && !defined(CYASSL_MDK_SHELL) - port = ((func_args*)args)->signal->port; -#endif - -#if defined(CYASSL_DTLS) - method = DTLSv1_client_method(); -#elif !defined(NO_TLS) - method = CyaSSLv23_client_method(); -#else - method = SSLv3_client_method(); -#endif - ctx = SSL_CTX_new(method); - -#ifndef NO_FILESYSTEM - #ifndef NO_RSA - if (SSL_CTX_load_verify_locations(ctx, caCert, 0) != SSL_SUCCESS) - err_sys("can't load ca file, Please run from CyaSSL home dir"); - #endif - #ifdef HAVE_ECC - if (SSL_CTX_load_verify_locations(ctx, eccCert, 0) != SSL_SUCCESS) - err_sys("can't load ca file, Please run from CyaSSL home dir"); - #endif -#elif !defined(NO_CERTS) - if (!doPSK) - load_buffer(ctx, caCert, CYASSL_CA); -#endif - -#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC) - /* don't use EDH, can't sniff tmp keys */ - SSL_CTX_set_cipher_list(ctx, "AES256-SHA"); -#endif - if (doPSK) { -#ifndef NO_PSK - const char *defaultCipherList; - - CyaSSL_CTX_set_psk_client_callback(ctx, my_psk_client_cb); - #ifdef HAVE_NULL_CIPHER - defaultCipherList = "PSK-NULL-SHA256"; - #else - defaultCipherList = "PSK-AES128-CBC-SHA256"; - #endif - if (CyaSSL_CTX_set_cipher_list(ctx,defaultCipherList) !=SSL_SUCCESS) - err_sys("client can't set cipher list 2"); -#endif - } - -#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) - SSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack); -#endif - - #if defined(CYASSL_MDK_ARM) - CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); - #endif - - ssl = SSL_new(ctx); - - - if (doDTLS) { - SOCKADDR_IN_T addr; - build_addr(&addr, yasslIP, port, 1); - CyaSSL_dtls_set_peer(ssl, &addr, sizeof(addr)); - tcp_socket(&sockfd, 1); - } - else { - tcp_connect(&sockfd, yasslIP, port, 0); - } - - SSL_set_fd(ssl, sockfd); -#if defined(USE_WINDOWS_API) && defined(CYASSL_DTLS) && defined(NO_MAIN_DRIVER) - /* let echoserver bind first, TODO: add Windows signal like pthreads does */ - Sleep(100); -#endif - - if (SSL_connect(ssl) != SSL_SUCCESS) err_sys("SSL_connect failed"); - - while (fgets(msg, sizeof(msg), fin) != 0) { - - sendSz = (int)strlen(msg); - - if (SSL_write(ssl, msg, sendSz) != sendSz) - err_sys("SSL_write failed"); - - if (strncmp(msg, "quit", 4) == 0) { - fputs("sending server shutdown command: quit!\n", fout); - break; - } - - if (strncmp(msg, "break", 5) == 0) { - fputs("sending server session close: break!\n", fout); - break; - } - - #ifndef CYASSL_MDK_SHELL - while (sendSz) { - int got; - if ( (got = SSL_read(ssl, reply, sizeof(reply)-1)) > 0) { - reply[got] = 0; - fputs(reply, fout); - fflush(fout) ; - sendSz -= got; - } - else - break; - } - #else - { - int got; - if ( (got = SSL_read(ssl, reply, sizeof(reply)-1)) > 0) { - reply[got] = 0; - fputs(reply, fout); - fflush(fout) ; - sendSz -= got; - } - } - #endif - } - - -#ifdef CYASSL_DTLS - strncpy(msg, "break", 6); - sendSz = (int)strlen(msg); - /* try to tell server done */ - SSL_write(ssl, msg, sendSz); -#else - SSL_shutdown(ssl); -#endif - - SSL_free(ssl); - SSL_CTX_free(ctx); - - fflush(fout); - if (inCreated) fclose(fin); - if (outCreated) fclose(fout); - - CloseSocket(sockfd); - ((func_args*)args)->return_code = 0; -} - - -/* so overall tests can pull in test function */ -#ifndef NO_MAIN_DRIVER - - int main(int argc, char** argv) - { - func_args args; - -#ifdef HAVE_CAVIUM - int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); - if (ret != 0) - err_sys("Cavium OpenNitroxDevice failed"); -#endif /* HAVE_CAVIUM */ - - StartTCP(); - - args.argc = argc; - args.argv = argv; - - CyaSSL_Init(); -#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL) - CyaSSL_Debugging_ON(); -#endif - - if (CurrentDir("echoclient")) - ChangeDirBack(2); - else if (CurrentDir("Debug") || CurrentDir("Release")) - ChangeDirBack(3); - echoclient_test(&args); - - CyaSSL_Cleanup(); - -#ifdef HAVE_CAVIUM - CspShutdown(CAVIUM_DEV_ID); -#endif - return args.return_code; - } - -#endif /* NO_MAIN_DRIVER */ - - diff --git a/IDE/MDK5-ARM/Projects/EchoServer/echoserver.c b/IDE/MDK5-ARM/Projects/EchoServer/echoserver.c deleted file mode 100644 index 407018964..000000000 --- a/IDE/MDK5-ARM/Projects/EchoServer/echoserver.c +++ /dev/null @@ -1,368 +0,0 @@ -/* echoserver.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 -#endif - -#include - -#if defined(CYASSL_MDK_ARM) - #include - #include - - #if defined(CYASSL_MDK5) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #endif - - #include "cyassl_MDK_ARM.h" -#endif - -#include -#include - -#ifndef NO_MAIN_DRIVER - #define ECHO_OUT -#endif - -#include "examples/echoserver/echoserver.h" - - -#ifdef SESSION_STATS - CYASSL_API void PrintSessionStats(void); -#endif - -#define SVR_COMMAND_SIZE 256 - -static void SignalReady(void* args, word16 port) -{ -#if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER) && !defined(__MINGW32__) - /* signal ready to tcp_accept */ - func_args* server_args = (func_args*)args; - tcp_ready* ready = server_args->signal; - pthread_mutex_lock(&ready->mutex); - ready->ready = 1; - ready->port = port; - pthread_cond_signal(&ready->cond); - pthread_mutex_unlock(&ready->mutex); -#endif - (void)args; - (void)port; -} - - -THREAD_RETURN CYASSL_THREAD echoserver_test(void* args) -{ - SOCKET_T sockfd = 0; - CYASSL_METHOD* method = 0; - CYASSL_CTX* ctx = 0; - - int doDTLS = 0; - int doPSK = 0; - int outCreated = 0; - int shutDown = 0; - int useAnyAddr = 0; - word16 port = yasslPort; - int argc = ((func_args*)args)->argc; - char** argv = ((func_args*)args)->argv; - -#ifdef ECHO_OUT - FILE* fout = stdout; - if (argc >= 2) { - fout = fopen(argv[1], "w"); - outCreated = 1; - } - if (!fout) err_sys("can't open output file"); -#endif - (void)outCreated; - (void)argc; - (void)argv; - - ((func_args*)args)->return_code = -1; /* error state */ - -#ifdef CYASSL_DTLS - doDTLS = 1; -#endif - -#ifdef CYASSL_LEANPSK - doPSK = 1; -#endif - -#if defined(NO_RSA) && !defined(HAVE_ECC) - doPSK = 1; -#endif - - #if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && \ - !defined(CYASSL_SNIFFER) && !defined(CYASSL_MDK_ARM) - port = 0; - #endif - #if defined(USE_ANY_ADDR) - useAnyAddr = 1; - #endif - tcp_listen(&sockfd, &port, useAnyAddr, doDTLS); - -#if defined(CYASSL_DTLS) - method = CyaDTLSv1_server_method(); -#elif !defined(NO_TLS) - method = CyaSSLv23_server_method(); -#else - method = wolfSSLv3_server_method(); -#endif - ctx = CyaSSL_CTX_new(method); - /* CyaSSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF); */ - -#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) - CyaSSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack); -#endif - -#ifndef NO_FILESYSTEM - if (doPSK == 0) { - #ifdef HAVE_NTRU - /* ntru */ - if (CyaSSL_CTX_use_certificate_file(ctx, ntruCert, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load ntru cert file, " - "Please run from CyaSSL home dir"); - - if (CyaSSL_CTX_use_NTRUPrivateKey_file(ctx, ntruKey) - != SSL_SUCCESS) - err_sys("can't load ntru key file, " - "Please run from CyaSSL home dir"); - #elif defined(HAVE_ECC) - /* ecc */ - if (CyaSSL_CTX_use_certificate_file(ctx, eccCert, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server cert file, " - "Please run from CyaSSL home dir"); - - if (CyaSSL_CTX_use_PrivateKey_file(ctx, eccKey, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server key file, " - "Please run from CyaSSL home dir"); - #elif defined(NO_CERTS) - /* do nothing, just don't load cert files */ - #else - /* normal */ - if (CyaSSL_CTX_use_certificate_file(ctx, svrCert, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server cert file, " - "Please run from CyaSSL home dir"); - - if (CyaSSL_CTX_use_PrivateKey_file(ctx, svrKey, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server key file, " - "Please run from CyaSSL home dir"); - #endif - } /* doPSK */ -#elif !defined(NO_CERTS) - if (!doPSK) { - load_buffer(ctx, svrCert, CYASSL_CERT); - load_buffer(ctx, svrKey, CYASSL_KEY); - } -#endif - -#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC) - /* don't use EDH, can't sniff tmp keys */ - CyaSSL_CTX_set_cipher_list(ctx, "AES256-SHA"); -#endif - - if (doPSK) { -#ifndef NO_PSK - const char *defaultCipherList; - - CyaSSL_CTX_set_psk_server_callback(ctx, my_psk_server_cb); - CyaSSL_CTX_use_psk_identity_hint(ctx, "cyassl server"); - #ifdef HAVE_NULL_CIPHER - defaultCipherList = "PSK-NULL-SHA256"; - #else - defaultCipherList = "PSK-AES128-CBC-SHA256"; - #endif - if (CyaSSL_CTX_set_cipher_list(ctx, defaultCipherList) != SSL_SUCCESS) - err_sys("server can't set cipher list 2"); -#endif - } - - SignalReady(args, port); - - while (!shutDown) { - CYASSL* ssl = 0; - char command[SVR_COMMAND_SIZE+1]; - int echoSz = 0; - int clientfd; - int firstRead = 1; - int gotFirstG = 0; - -#ifndef CYASSL_DTLS - SOCKADDR_IN_T client; - socklen_t client_len = sizeof(client); - clientfd = accept(sockfd, (struct sockaddr*)&client, - (ACCEPT_THIRD_T)&client_len); -#else - clientfd = udp_read_connect(sockfd); -#endif - if (clientfd == -1) err_sys("tcp accept failed"); - - ssl = CyaSSL_new(ctx); - if (ssl == NULL) err_sys("SSL_new failed"); - CyaSSL_set_fd(ssl, clientfd); - #if !defined(NO_FILESYSTEM) && !defined(NO_DH) - CyaSSL_SetTmpDH_file(ssl, dhParam, SSL_FILETYPE_PEM); - #elif !defined(NO_DH) - SetDH(ssl); /* will repick suites with DHE, higher than PSK */ - #endif - if (CyaSSL_accept(ssl) != SSL_SUCCESS) { - printf("SSL_accept failed\n"); - CyaSSL_free(ssl); - CloseSocket(clientfd); - continue; - } -#if defined(PEER_INFO) - showPeer(ssl); -#endif - - while ( (echoSz = CyaSSL_read(ssl, command, sizeof(command)-1)) > 0) { - - if (firstRead == 1) { - firstRead = 0; /* browser may send 1 byte 'G' to start */ - if (echoSz == 1 && command[0] == 'G') { - gotFirstG = 1; - continue; - } - } - else if (gotFirstG == 1 && strncmp(command, "ET /", 4) == 0) { - strncpy(command, "GET", 4); - /* fall through to normal GET */ - } - - if ( strncmp(command, "quit", 4) == 0) { - printf("client sent quit command: shutting down!\n"); - shutDown = 1; - break; - } - if ( strncmp(command, "break", 5) == 0) { - printf("client sent break command: closing session!\n"); - break; - } -#ifdef SESSION_STATS - if ( strncmp(command, "printstats", 10) == 0) { - PrintSessionStats(); - break; - } -#endif - if ( strncmp(command, "GET", 3) == 0) { - char type[] = "HTTP/1.0 200 ok\r\nContent-type:" - " text/html\r\n\r\n"; - char header[] = "\n
\n";
-                char body[]   = "greetings from CyaSSL\n";
-                char footer[] = "\r\n\r\n";
-            
-                strncpy(command, type, sizeof(type));
-                echoSz = sizeof(type) - 1;
-
-                strncpy(&command[echoSz], header, sizeof(header));
-                echoSz += (int)sizeof(header) - 1;
-                strncpy(&command[echoSz], body, sizeof(body));
-                echoSz += (int)sizeof(body) - 1;
-                strncpy(&command[echoSz], footer, sizeof(footer));
-                echoSz += (int)sizeof(footer);
-
-                if (CyaSSL_write(ssl, command, echoSz) != echoSz)
-                    err_sys("SSL_write failed");
-                break;
-            }
-            command[echoSz] = 0;
-
-            #ifdef ECHO_OUT
-                fputs(command, fout);
-            #endif
-
-            if (CyaSSL_write(ssl, command, echoSz) != echoSz)
-                err_sys("SSL_write failed");
-        }
-#ifndef CYASSL_DTLS
-        CyaSSL_shutdown(ssl);
-#endif
-        CyaSSL_free(ssl);
-        CloseSocket(clientfd);
-#ifdef CYASSL_DTLS
-        tcp_listen(&sockfd, &port, useAnyAddr, doDTLS);
-        SignalReady(args, port);
-#endif
-    }
-
-    CloseSocket(sockfd);
-    CyaSSL_CTX_free(ctx);
-
-#ifdef ECHO_OUT
-    if (outCreated)
-        fclose(fout);
-#endif
-
-    ((func_args*)args)->return_code = 0;
-    return 0;
-}
-
-
-/* so overall tests can pull in test function */
-#ifndef NO_MAIN_DRIVER
-
-    int main(int argc, char** argv)
-    {
-        func_args args;
-
-#ifdef HAVE_CAVIUM
-        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
-        if (ret != 0)
-            err_sys("Cavium OpenNitroxDevice failed");
-#endif /* HAVE_CAVIUM */
-
-        StartTCP();
-
-        args.argc = argc;
-        args.argv = argv;
-
-        CyaSSL_Init();
-#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL)
-        CyaSSL_Debugging_ON();
-#endif
-        if (CurrentDir("echoserver"))
-            ChangeDirBack(2);
-        else if (CurrentDir("Debug") || CurrentDir("Release"))
-            ChangeDirBack(3);
-        echoserver_test(&args);
-        CyaSSL_Cleanup();
-
-#ifdef HAVE_CAVIUM
-        CspShutdown(CAVIUM_DEV_ID);
-#endif
-        return args.return_code;
-    }
-
-        
-#endif /* NO_MAIN_DRIVER */
-
-
-
-
diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/client.c b/IDE/MDK5-ARM/Projects/SimpleClient/client.c
deleted file mode 100644
index 8382a540f..000000000
--- a/IDE/MDK5-ARM/Projects/SimpleClient/client.c
+++ /dev/null
@@ -1,862 +0,0 @@
-/* client.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 
-#endif
-
-#if defined(CYASSL_MDK_ARM)
-        #include 
-        #include 
-
-        #if defined(CYASSL_MDK5)
-            #include "cmsis_os.h"
-            #include "rl_fs.h" 
-            #include "rl_net.h" 
-        #else
-            #include "rtl.h"
-        #endif
-
-        #include "cyassl_MDK_ARM.h"
-#endif
-
-#include 
-
-#if !defined(CYASSL_TRACK_MEMORY) && !defined(NO_MAIN_DRIVER)
-    /* in case memory tracker wants stats */
-    #define CYASSL_TRACK_MEMORY
-#endif
-
-#include 
-
-#include 
-
-#include "examples/client/client.h"
-
-
-#ifdef CYASSL_CALLBACKS
-    int handShakeCB(HandShakeInfo*);
-    int timeoutCB(TimeoutInfo*);
-    Timeval timeout;
-#endif
-
-
-static void NonBlockingSSL_Connect(CYASSL* ssl)
-{
-#ifndef CYASSL_CALLBACKS
-    int ret = CyaSSL_connect(ssl);
-#else
-    int ret = CyaSSL_connect_ex(ssl, handShakeCB, timeoutCB, timeout);
-#endif
-    int error = CyaSSL_get_error(ssl, 0);
-    SOCKET_T sockfd = (SOCKET_T)CyaSSL_get_fd(ssl);
-    int select_ret;
-
-    while (ret != SSL_SUCCESS && (error == SSL_ERROR_WANT_READ ||
-                                  error == SSL_ERROR_WANT_WRITE)) {
-        int currTimeout = 1;
-
-        if (error == SSL_ERROR_WANT_READ)
-            printf("... client would read block\n");
-        else
-            printf("... client would write block\n");
-
-#ifdef CYASSL_DTLS
-        currTimeout = CyaSSL_dtls_get_current_timeout(ssl);
-#endif
-        select_ret = tcp_select(sockfd, currTimeout);
-
-        if ((select_ret == TEST_RECV_READY) ||
-                                        (select_ret == TEST_ERROR_READY)) {
-            #ifndef CYASSL_CALLBACKS
-                    ret = CyaSSL_connect(ssl);
-            #else
-                ret = CyaSSL_connect_ex(ssl,handShakeCB,timeoutCB,timeout);
-            #endif
-            error = CyaSSL_get_error(ssl, 0);
-        }
-        else if (select_ret == TEST_TIMEOUT && !CyaSSL_dtls(ssl)) {
-            error = SSL_ERROR_WANT_READ;
-        }
-#ifdef CYASSL_DTLS
-        else if (select_ret == TEST_TIMEOUT && CyaSSL_dtls(ssl) &&
-                                            CyaSSL_dtls_got_timeout(ssl) >= 0) {
-            error = SSL_ERROR_WANT_READ;
-        }
-#endif
-        else {
-            error = SSL_FATAL_ERROR;
-        }
-    }
-    if (ret != SSL_SUCCESS)
-        err_sys("SSL_connect failed");
-}
-
-
-static void Usage(void)
-{
-    printf("client "    LIBCYASSL_VERSION_STRING
-           " NOTE: All files relative to CyaSSL home dir\n");
-    printf("-?          Help, print this usage\n");
-    printf("-h    Host to connect to, default %s\n", yasslIP);
-    printf("-p     Port to connect on, not 0, default %d\n", yasslPort);
-    printf("-v     SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n",
-                                 CLIENT_DEFAULT_VERSION);
-    printf("-l     Cipher list\n");
-    printf("-c    Certificate file,           default %s\n", cliCert);
-    printf("-k    Key file,                   default %s\n", cliKey);
-    printf("-A    Certificate Authority file, default %s\n", caCert);
-    printf("-b     Benchmark  connections and print stats\n");
-    printf("-s          Use pre Shared keys\n");
-    printf("-t          Track CyaSSL memory use\n");
-    printf("-d          Disable peer checks\n");
-    printf("-D          Override Date Errors example\n");
-    printf("-g          Send server HTTP GET\n");
-    printf("-u          Use UDP DTLS,"
-           " add -v 2 for DTLSv1 (default), -v 3 for DTLSv1.2\n");
-    printf("-m          Match domain name in cert\n");
-    printf("-N          Use Non-blocking sockets\n");
-    printf("-r          Resume session\n");
-    printf("-f          Fewer packets/group messages\n");
-    printf("-x          Disable client cert/key loading\n");
-#ifdef SHOW_SIZES
-    printf("-z          Print structure sizes\n");
-#endif
-#ifdef HAVE_SNI
-    printf("-S     Use Host Name Indication\n");
-#endif
-#ifdef HAVE_MAX_FRAGMENT
-    printf("-L     Use Maximum Fragment Length [1-5]\n");
-#endif
-#ifdef HAVE_TRUNCATED_HMAC
-    printf("-T          Use Truncated HMAC\n");
-#endif
-#ifdef HAVE_OCSP
-    printf("-o          Perform OCSP lookup on peer certificate\n");
-    printf("-O     Perform OCSP lookup using  as responder\n");
-#endif
-#ifdef ATOMIC_USER
-    printf("-U          Atomic User Record Layer Callbacks\n");
-#endif
-#ifdef HAVE_PK_CALLBACKS 
-    printf("-P          Public Key Callbacks\n");
-#endif
-}
-
-THREAD_RETURN CYASSL_THREAD client_test(void* args)
-{
-    SOCKET_T sockfd = 0;
-
-    CYASSL_METHOD*  method  = 0;
-    CYASSL_CTX*     ctx     = 0;
-    CYASSL*         ssl     = 0;
-    
-    CYASSL*         sslResume = 0;
-    CYASSL_SESSION* session = 0;
-    char         resumeMsg[] = "resuming cyassl!";
-    int          resumeSz    = sizeof(resumeMsg);
-
-    char msg[32] = "hello cyassl!";   /* GET may make bigger */
-    char reply[80];
-    int  input;
-    int  msgSz = (int)strlen(msg);
-
-    word16 port   = yasslPort;
-    char* host   = (char*)yasslIP;
-    const char* domain = "www.yassl.com";
-
-    int    ch;
-    int    version = CLIENT_INVALID_VERSION;
-    int    usePsk   = 0;
-    int    sendGET  = 0;
-    int    benchmark = 0;
-    int    doDTLS    = 0;
-    int    matchName = 0;
-    int    doPeerCheck = 1;
-    int    nonBlocking = 0;
-    int    resumeSession = 0;
-    int    trackMemory   = 0;
-    int    useClientCert = 1;
-    int    fewerPackets  = 0;
-    int    atomicUser    = 0;
-    int    pkCallbacks   = 0;
-    int    overrideDateErrors = 0;
-    char*  cipherList = NULL;
-    const char* verifyCert = caCert;
-    const char* ourCert    = cliCert;
-    const char* ourKey     = cliKey;
-
-#ifdef HAVE_SNI
-    char*  sniHostName = NULL;
-#endif
-#ifdef HAVE_MAX_FRAGMENT
-    byte maxFragment = 0;
-#endif
-#ifdef HAVE_TRUNCATED_HMAC
-    byte  truncatedHMAC = 0;
-#endif
-
-
-#ifdef HAVE_OCSP
-    int    useOcsp  = 0;
-    char*  ocspUrl  = NULL;
-#endif
-
-    int     argc = ((func_args*)args)->argc;
-    char**  argv = ((func_args*)args)->argv;
-
-    ((func_args*)args)->return_code = -1; /* error state */
-
-#ifdef NO_RSA
-    verifyCert = (char*)eccCert;
-    ourCert    = (char*)cliEccCert;
-    ourKey     = (char*)cliEccKey;
-#endif
-    (void)resumeSz;
-    (void)session;
-    (void)sslResume;
-    (void)trackMemory;
-    (void)atomicUser;
-    (void)pkCallbacks;
-
-    StackTrap();
-
-    while ((ch = mygetopt(argc, argv,
-                          "?gdDusmNrtfxUPh:p:v:l:A:c:k:b:zS:L:ToO:")) != -1) {
-        switch (ch) {
-            case '?' :
-                Usage();
-                exit(EXIT_SUCCESS);
-
-            case 'g' :
-                sendGET = 1;
-                break;
-
-            case 'd' :
-                doPeerCheck = 0;
-                break;
-
-            case 'D' :
-                overrideDateErrors = 1;
-                break;
-
-            case 'u' :
-                doDTLS  = 1;
-                break;
-
-            case 's' :
-                usePsk = 1;
-                break;
-
-            case 't' :
-            #ifdef USE_CYASSL_MEMORY
-                trackMemory = 1;
-            #endif
-                break;
-
-            case 'm' :
-                matchName = 1;
-                break;
-
-            case 'x' :
-                useClientCert = 0;
-                break;
-
-            case 'f' :
-                fewerPackets = 1;
-                break;
-
-            case 'U' :
-            #ifdef ATOMIC_USER
-                atomicUser = 1;
-            #endif
-                break;
-
-            case 'P' :
-            #ifdef HAVE_PK_CALLBACKS 
-                pkCallbacks = 1;
-            #endif
-                break;
-
-            case 'h' :
-                host   = myoptarg;
-                domain = myoptarg;
-                break;
-
-            case 'p' :
-                port = (word16)atoi(myoptarg);
-                #if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API)
-                    if (port == 0)
-                        err_sys("port number cannot be 0");
-                #endif
-                break;
-
-            case 'v' :
-                version = atoi(myoptarg);
-                if (version < 0 || version > 3) {
-                    Usage();
-                    exit(MY_EX_USAGE);
-                }
-                break;
-
-            case 'l' :
-                cipherList = myoptarg;
-                break;
-
-            case 'A' :
-                verifyCert = myoptarg;
-                break;
-
-            case 'c' :
-                ourCert = myoptarg;
-                break;
-
-            case 'k' :
-                ourKey = myoptarg;
-                break;
-
-            case 'b' :
-                benchmark = atoi(myoptarg);
-                if (benchmark < 0 || benchmark > 1000000) {
-                    Usage();
-                    exit(MY_EX_USAGE);
-                }
-                break;
-
-            case 'N' :
-                nonBlocking = 1;
-                break;
-
-            case 'r' :
-                resumeSession = 1;
-                break;
-
-            case 'z' :
-                #ifndef CYASSL_LEANPSK
-                    CyaSSL_GetObjectSize();
-                #endif
-                break;
-
-            case 'S' :
-                #ifdef HAVE_SNI
-                    sniHostName = myoptarg;
-                #endif
-                break;
-
-            case 'L' :
-                #ifdef HAVE_MAX_FRAGMENT
-                    maxFragment = atoi(myoptarg);
-                    if (maxFragment < CYASSL_MFL_2_9 ||
-                                                maxFragment > CYASSL_MFL_2_13) {
-                        Usage();
-                        exit(MY_EX_USAGE);
-                    }
-                #endif
-                break;
-
-            case 'T' :
-                #ifdef HAVE_TRUNCATED_HMAC
-                    truncatedHMAC = 1;
-                #endif
-                break;
-
-            case 'o' :
-                #ifdef HAVE_OCSP
-                    useOcsp = 1;
-                #endif
-                break;
-
-            case 'O' :
-                #ifdef HAVE_OCSP
-                    useOcsp = 1;
-                    ocspUrl = myoptarg;
-                #endif
-                break;
-
-            default:
-                Usage();
-                exit(MY_EX_USAGE);
-        }
-    }
-
-    myoptind = 0;      /* reset for test cases */
-
-    /* sort out DTLS versus TLS versions */
-    if (version == CLIENT_INVALID_VERSION) {
-        if (doDTLS)
-            version = CLIENT_DTLS_DEFAULT_VERSION;
-        else
-            version = CLIENT_DEFAULT_VERSION;
-    }
-    else {
-        if (doDTLS) {
-            if (version == 3)
-                version = -2;
-            else
-                version = -1;
-        }
-    }
-
-#ifdef USE_CYASSL_MEMORY
-    if (trackMemory)
-        InitMemoryTracker(); 
-#endif
-
-    switch (version) {
-#ifndef NO_OLD_TLS
-        case 0:
-            method = wolfSSLv3_client_method();
-            break;
-                
-                
-    #ifndef NO_TLS
-        case 1:
-            method = CyaTLSv1_client_method();
-            break;
-
-        case 2:
-            method = CyaTLSv1_1_client_method();
-            break;
-    #endif /* NO_TLS */
-                
-#endif  /* NO_OLD_TLS */
-                
-#ifndef NO_TLS
-        case 3:
-            method = CyaTLSv1_2_client_method();
-            break;
-#endif
-
-#ifdef CYASSL_DTLS
-        case -1:
-            method = CyaDTLSv1_client_method();
-            break;
-
-        case -2:
-            method = CyaDTLSv1_2_client_method();
-            break;
-#endif
-
-        default:
-            err_sys("Bad SSL version");
-            break;
-    }
-
-    if (method == NULL)
-        err_sys("unable to get method");
-
-    ctx = CyaSSL_CTX_new(method);
-    if (ctx == NULL)
-        err_sys("unable to get ctx");
-
-    if (cipherList)
-        if (CyaSSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS)
-            err_sys("client can't set cipher list 1");
-
-#ifdef CYASSL_LEANPSK
-    usePsk = 1;
-#endif
-
-#if defined(NO_RSA) && !defined(HAVE_ECC)
-    usePsk = 1;
-#endif
-
-    if (fewerPackets)
-        CyaSSL_CTX_set_group_messages(ctx);
-
-    if (usePsk) {
-#ifndef NO_PSK
-        CyaSSL_CTX_set_psk_client_callback(ctx, my_psk_client_cb);
-        if (cipherList == NULL) {
-            const char *defaultCipherList;
-            #ifdef HAVE_NULL_CIPHER
-                defaultCipherList = "PSK-NULL-SHA256";
-            #else
-                defaultCipherList = "PSK-AES128-CBC-SHA256";
-            #endif
-            if (CyaSSL_CTX_set_cipher_list(ctx,defaultCipherList) !=SSL_SUCCESS)
-                err_sys("client can't set cipher list 2");
-        }
-#endif
-        useClientCert = 0;
-    }
-
-#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
-    CyaSSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack);
-#endif
-
-#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC)
-    if (cipherList == NULL) {
-        /* don't use EDH, can't sniff tmp keys */
-        if (CyaSSL_CTX_set_cipher_list(ctx, "AES256-SHA256") != SSL_SUCCESS) {
-            err_sys("client can't set cipher list 3");
-        }
-    }
-#endif
-
-#ifdef HAVE_OCSP
-    if (useOcsp) {
-        if (ocspUrl != NULL) {
-            CyaSSL_CTX_SetOCSP_OverrideURL(ctx, ocspUrl);
-            CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE
-                                                    | CYASSL_OCSP_URL_OVERRIDE);
-        }
-        else
-            CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE);
-    }
-#endif
-
-#ifdef USER_CA_CB
-    CyaSSL_CTX_SetCACb(ctx, CaCb);
-#endif
-
-#ifdef VERIFY_CALLBACK
-    CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, myVerify);
-#endif
-#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
-    if (useClientCert){
-        if (CyaSSL_CTX_use_certificate_chain_file(ctx, ourCert) != SSL_SUCCESS)
-            err_sys("can't load client cert file, check file and run from"
-                    " CyaSSL home dir");
-
-        if (CyaSSL_CTX_use_PrivateKey_file(ctx, ourKey, SSL_FILETYPE_PEM)
-                                         != SSL_SUCCESS)
-            err_sys("can't load client private key file, check file and run "
-                    "from CyaSSL home dir");
-    }
-
-    if (!usePsk) {
-        if (CyaSSL_CTX_load_verify_locations(ctx, verifyCert, 0) != SSL_SUCCESS)
-                err_sys("can't load ca file, Please run from CyaSSL home dir");
-    }
-#endif
-#if !defined(NO_CERTS)
-    if (!usePsk && doPeerCheck == 0)
-        CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
-    if (!usePsk && overrideDateErrors == 1)
-        CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, myDateCb);
-#endif
-
-#ifdef HAVE_CAVIUM
-    CyaSSL_CTX_UseCavium(ctx, CAVIUM_DEV_ID);
-#endif
-
-#ifdef HAVE_SNI
-    if (sniHostName)
-        if (CyaSSL_CTX_UseSNI(ctx, 0, sniHostName, XSTRLEN(sniHostName))
-                                                                 != SSL_SUCCESS)
-            err_sys("UseSNI failed");
-#endif
-#ifdef HAVE_MAX_FRAGMENT
-    if (maxFragment)
-        if (CyaSSL_CTX_UseMaxFragment(ctx, maxFragment) != SSL_SUCCESS)
-            err_sys("UseMaxFragment failed");
-#endif
-#ifdef HAVE_TRUNCATED_HMAC
-    if (truncatedHMAC)
-        if (CyaSSL_CTX_UseTruncatedHMAC(ctx) != SSL_SUCCESS)
-            err_sys("UseTruncatedHMAC failed");
-#endif
-
-    if (benchmark) {
-        /* time passed in number of connects give average */
-        int times = benchmark;
-        int i = 0;
-
-        double start = current_time(), avg;
-
-        for (i = 0; i < times; i++) {
-            tcp_connect(&sockfd, host, port, doDTLS);
-
-            ssl = CyaSSL_new(ctx);
-            CyaSSL_set_fd(ssl, sockfd);
-            if (CyaSSL_connect(ssl) != SSL_SUCCESS)
-                err_sys("SSL_connect failed");
-
-            CyaSSL_shutdown(ssl);
-            CyaSSL_free(ssl);
-            CloseSocket(sockfd);
-        }
-        avg = current_time() - start;
-        avg /= times;
-        avg *= 1000;   /* milliseconds */
-        printf("CyaSSL_connect avg took: %8.3f milliseconds\n", avg);
-
-        CyaSSL_CTX_free(ctx);
-        ((func_args*)args)->return_code = 0;
-
-        exit(EXIT_SUCCESS);
-    }
-    
-    #if defined(CYASSL_MDK_ARM)
-    CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
-    #endif
-    
-    ssl = CyaSSL_new(ctx);
-    if (ssl == NULL)
-        err_sys("unable to get SSL object");
-    if (doDTLS) {
-        SOCKADDR_IN_T addr;
-        build_addr(&addr, host, port, 1);
-        CyaSSL_dtls_set_peer(ssl, &addr, sizeof(addr));
-        tcp_socket(&sockfd, 1);
-    }
-    else {
-        tcp_connect(&sockfd, host, port, 0);
-    }
-    CyaSSL_set_fd(ssl, sockfd);
-#ifdef HAVE_CRL
-    if (CyaSSL_EnableCRL(ssl, CYASSL_CRL_CHECKALL) != SSL_SUCCESS)
-        err_sys("can't enable crl check");
-    if (CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, 0) != SSL_SUCCESS)
-        err_sys("can't load crl, check crlfile and date validity");
-    if (CyaSSL_SetCRL_Cb(ssl, CRL_CallBack) != SSL_SUCCESS)
-        err_sys("can't set crl callback");
-#endif
-#ifdef ATOMIC_USER
-    if (atomicUser)
-        SetupAtomicUser(ctx, ssl);
-#endif
-#ifdef HAVE_PK_CALLBACKS
-    if (pkCallbacks)
-        SetupPkCallbacks(ctx, ssl);
-#endif
-    if (matchName && doPeerCheck)
-        CyaSSL_check_domain_name(ssl, domain);
-#ifndef CYASSL_CALLBACKS
-    if (nonBlocking) {
-        CyaSSL_set_using_nonblock(ssl, 1);
-        tcp_set_nonblocking(&sockfd);
-        NonBlockingSSL_Connect(ssl);
-    }
-    else if (CyaSSL_connect(ssl) != SSL_SUCCESS) {
-        /* see note at top of README */
-        int  err = CyaSSL_get_error(ssl, 0);
-        char buffer[CYASSL_MAX_ERROR_SZ];
-        printf("err = %d, %s\n", err,
-                                CyaSSL_ERR_error_string(err, buffer));
-        err_sys("SSL_connect failed");
-        /* if you're getting an error here  */
-    }
-#else
-    timeout.tv_sec  = 2;
-    timeout.tv_usec = 0;
-    NonBlockingSSL_Connect(ssl);  /* will keep retrying on timeout */
-#endif
-    showPeer(ssl);
-
-    if (sendGET) {
-        printf("SSL connect ok, sending GET...\n");
-        msgSz = 28;
-        strncpy(msg, "GET /index.html HTTP/1.0\r\n\r\n", msgSz);
-        msg[msgSz] = '\0';
-    }
-    if (CyaSSL_write(ssl, msg, msgSz) != msgSz)
-        err_sys("SSL_write failed");
-
-    input = CyaSSL_read(ssl, reply, sizeof(reply)-1);
-    if (input > 0) {
-        reply[input] = 0;
-        printf("Server response: %s\n", reply);
-
-        if (sendGET) {  /* get html */
-            while (1) {
-                input = CyaSSL_read(ssl, reply, sizeof(reply)-1);
-                if (input > 0) {
-                    reply[input] = 0;
-                    printf("%s\n", reply);
-                }
-                else
-                    break;
-            }
-        }
-    }
-    else if (input < 0) {
-        int readErr = CyaSSL_get_error(ssl, 0);
-        if (readErr != SSL_ERROR_WANT_READ)
-            err_sys("CyaSSL_read failed");
-    }
-
-#ifndef NO_SESSION_CACHE
-    if (resumeSession) {
-        if (doDTLS) {
-            strncpy(msg, "break", 6);
-            msgSz = (int)strlen(msg);
-            /* try to send session close */
-            CyaSSL_write(ssl, msg, msgSz);
-        }
-        session   = CyaSSL_get_session(ssl);
-        sslResume = CyaSSL_new(ctx);
-    }
-#endif
-
-    if (doDTLS == 0)            /* don't send alert after "break" command */
-        CyaSSL_shutdown(ssl);  /* echoserver will interpret as new conn */
-#ifdef ATOMIC_USER
-    if (atomicUser)
-        FreeAtomicUser(ssl);
-#endif
-    CyaSSL_free(ssl);
-    CloseSocket(sockfd);
-
-#ifndef NO_SESSION_CACHE
-    if (resumeSession) {
-        if (doDTLS) {
-            SOCKADDR_IN_T addr;
-            #ifdef USE_WINDOWS_API 
-                Sleep(500);
-            #else
-                sleep(1);
-            #endif
-            build_addr(&addr, host, port, 1);
-            CyaSSL_dtls_set_peer(sslResume, &addr, sizeof(addr));
-            tcp_socket(&sockfd, 1);
-        }
-        else {
-            tcp_connect(&sockfd, host, port, 0);
-        }
-        CyaSSL_set_fd(sslResume, sockfd);
-        CyaSSL_set_session(sslResume, session);
-       
-        showPeer(sslResume);
-#ifndef CYASSL_CALLBACKS
-        if (nonBlocking) {
-            CyaSSL_set_using_nonblock(sslResume, 1);
-            tcp_set_nonblocking(&sockfd);
-            NonBlockingSSL_Connect(sslResume);
-        }
-        else if (CyaSSL_connect(sslResume) != SSL_SUCCESS)
-            err_sys("SSL resume failed");
-#else
-        timeout.tv_sec  = 2;
-        timeout.tv_usec = 0;
-        NonBlockingSSL_Connect(ssl);  /* will keep retrying on timeout */
-#endif
-
-        if (CyaSSL_session_reused(sslResume))
-            printf("reused session id\n");
-        else
-            printf("didn't reuse session id!!!\n");
-
-        if (CyaSSL_write(sslResume, resumeMsg, resumeSz) != resumeSz)
-            err_sys("SSL_write failed");
-
-        if (nonBlocking) {
-            /* give server a chance to bounce a message back to client */
-            #ifdef USE_WINDOWS_API
-                Sleep(500);
-            #else
-                sleep(1);
-            #endif
-        }
-
-        input = CyaSSL_read(sslResume, reply, sizeof(reply)-1);
-        if (input > 0) {
-            reply[input] = 0;
-            printf("Server resume response: %s\n", reply);
-        }
-
-        /* try to send session break */
-        CyaSSL_write(sslResume, msg, msgSz); 
-
-        CyaSSL_shutdown(sslResume);
-        CyaSSL_free(sslResume);
-        CloseSocket(sockfd);
-    }
-#endif /* NO_SESSION_CACHE */
-
-    CyaSSL_CTX_free(ctx);
-
-    ((func_args*)args)->return_code = 0;
-
-#ifdef USE_CYASSL_MEMORY
-    if (trackMemory)
-        ShowMemoryTracker();
-#endif /* USE_CYASSL_MEMORY */
-
-    return 0;
-}
-
-
-/* so overall tests can pull in test function */
-#ifndef NO_MAIN_DRIVER
-
-    int main(int argc, char** argv)
-    {
-        func_args args;
-
-#ifdef HAVE_CAVIUM
-        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
-        if (ret != 0)
-            err_sys("Cavium OpenNitroxDevice failed");
-#endif /* HAVE_CAVIUM */
-
-        StartTCP();
-
-        args.argc = argc;
-        args.argv = argv;
-
-        CyaSSL_Init();
-#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL) && !defined(STACK_TRAP)
-        CyaSSL_Debugging_ON();
-#endif
-        if (CurrentDir("client"))
-            ChangeDirBack(2);
-        else if (CurrentDir("Debug") || CurrentDir("Release"))
-            ChangeDirBack(3);
-  
-#ifdef HAVE_STACK_SIZE
-        StackSizeCheck(&args, client_test);
-#else 
-        client_test(&args);
-#endif
-        CyaSSL_Cleanup();
-
-#ifdef HAVE_CAVIUM
-        CspShutdown(CAVIUM_DEV_ID);
-#endif
-        return args.return_code;
-    }
-
-    int myoptind = 0;
-    char* myoptarg = NULL;
-
-#endif /* NO_MAIN_DRIVER */
-
-
-
-#ifdef CYASSL_CALLBACKS
-
-    int handShakeCB(HandShakeInfo* info)
-    {
-        (void)info;
-        return 0;
-    }
-
-
-    int timeoutCB(TimeoutInfo* info)
-    {
-        (void)info;
-        return 0;
-    }
-
-#endif
-
diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/simpleClient.uvprojx b/IDE/MDK5-ARM/Projects/SimpleClient/simpleClient.uvprojx
index 26744456f..9eefd4c71 100644
--- a/IDE/MDK5-ARM/Projects/SimpleClient/simpleClient.uvprojx
+++ b/IDE/MDK5-ARM/Projects/SimpleClient/simpleClient.uvprojx
@@ -7,19 +7,21 @@
 
   
     
-      SimpleClient
+      STM32F207 Flash
       0x4
       ARM-ADS
       
         
-          STM32F207IG
+          STM32F207IGHx
           STMicroelectronics
-          IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE
+          Keil.STM32F2xx_DFP.2.2.0
+          http://www.keil.com/pack
+          IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE
           
           
-          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm))
+          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM))
           0
-          $$Device:STM32F207IG$Device\Include\stm32f2xx.h
+          $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h
           
           
           
@@ -29,7 +31,7 @@
           
           
           
-          $$Device:STM32F207IG$SVD\STM32F20x.svd
+          $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd
           0
           0
           
@@ -45,7 +47,7 @@
             1
           
           .\Object\
-          SimpleClient
+          EchoClient
           1
           0
           0
@@ -104,11 +106,11 @@
         
         
           SARMCM3.DLL
-          -REMAP -MPU
+           -REMAP -MPU
           DCM.DLL
           -pCM3
           SARMCM3.DLL
-          -REMAP -MPU
+           -MPU
           TCM.DLL
           -pCM3
         
@@ -143,10 +145,9 @@
             1
             1
             1
-            1
           
           0
-          8
+          1
           
             
             
@@ -160,7 +161,7 @@
             
             
             .\STM32_SWO.ini
-            BIN\ULP2CM3.DLL
+            BIN\UL2CM3.DLL
           
         
         
@@ -173,8 +174,8 @@
             4100
           
           1
-          BIN\ULP2CM3.DLL
-          "" ()
+          BIN\UL2CM3.DLL
+          
           
           
           
@@ -355,14 +356,14 @@
             0
             0
             0
-            0
+            2
             0
             0
-            0
+            1
             0
             
-              
-              HAVE_CONFIG_H  MDK_CONF_SimpleClient
+              --diag_suppress=1293
+              HSE_VALUE=25000000 HAVE_CONFIG_H  MDK_CONF_SimpleClient WOLFSSL_USER_SETTINGS
               
               
             
@@ -413,39 +414,39 @@
               .\main.c
             
             
-              client.c
+              time-CortexM3-4.c
               1
-              .\client.c
+              .\time-CortexM3-4.c
             
           
         
         
           Configuration
           
-            
-              config-SimpleClient.h
-              5
-              .\config-SimpleClient.h
-            
-            
-              config-CyaSSL.h
-              5
-              .\RTE\wolfSSL\config-CyaSSL.h
-            
             
               config-Crypt.h
               5
               .\RTE\wolfSSL\config-Crypt.h
             
             
-              Net_Config_ETH_0.h
+              config-wolfSSL.h
               5
-              .\RTE\Network\Net_Config_ETH_0.h
+              .\RTE\wolfSSL\config-wolfSSL.h
+            
+            
+              user_settings.h
+              5
+              .\RTE\wolfSSL\user_settings.h
+            
+            
+              config-SimpleClient.h
+              5
+              .\config-SimpleClient.h
             
           
         
         
-          Documentation
+          Dcumentation
           
             
               Abstract.txt
@@ -455,652 +456,397 @@
           
         
         
-          Devices
-          
-            
-              time-dummy.c
-              1
-              .\time-dummy.c
-            
-            
-              time-CortexM3-4.c
-              1
-              .\time-CortexM3-4.c
-            
-          
+          ::CMSIS
         
         
-          ::CMSIS
-          
-            
-              RTX_Conf_CM.c
-              1
-              RTE\CMSIS\RTX_Conf_CM.c
-            
-            
-              RTX_CM3.lib
-              4
-              C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib
-            
-          
+          ::CMSIS Driver
+        
+        
+          ::Compiler
         
         
           ::Device
-          
-            
-              RTE_Device.h
-              5
-              RTE\Device\STM32F207IG\RTE_Device.h
-            
-            
-              startup_stm32f2xx.s
-              2
-              RTE\Device\STM32F207IG\startup_stm32f2xx.s
-            
-            
-              system_stm32f2xx.c
-              1
-              RTE\Device\STM32F207IG\system_stm32f2xx.c
-            
-            
-              DMA_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c
-            
-            
-              GPIO_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c
-            
-          
-        
-        
-          ::Drivers
-          
-            
-              EMAC_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c
-            
-            
-              MCI_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c
-            
-            
-              PHY_ST802RT1.c
-              1
-              C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c
-            
-          
         
         
           ::File System
-          
-            
-              FS_Config.c
-              1
-              RTE\File_System\FS_Config.c
-            
-            
-              FS_Config_MC_0.h
-              5
-              RTE\File_System\FS_Config_MC_0.h
-            
-            
-              FS_LFN_CM3_L.lib
-              4
-              C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib
-            
-          
         
         
           ::Network
-          
-            
-              Net_Config.c
-              1
-              RTE\Network\Net_Config.c
-            
-            
-              Net_Config_BSD.h
-              5
-              RTE\Network\Net_Config_BSD.h
-            
-            
-              Net_Config_DNS_Client.h
-              5
-              RTE\Network\Net_Config_DNS_Client.h
-            
-            
-              Net_Config_ETH_0.h
-              5
-              RTE\Network\Net_Config_ETH_0.h
-            
-            
-              Net_Config_TCP.h
-              5
-              RTE\Network\Net_Config_TCP.h
-            
-            
-              Net_Config_UDP.h
-              5
-              RTE\Network\Net_Config_UDP.h
-            
-            
-              Net_Debug.c
-              1
-              RTE\Network\Net_Debug.c
-            
-            
-              Net_Dbg_CM3_L.lib
-              4
-              C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib
-            
-          
         
         
           ::wolfSSL
-          
-            
-              config-Crypt.h
-              5
-              RTE\wolfSSL\config-Crypt.h
-            
-            
-              config-CyaSSL.h
-              5
-              RTE\wolfSSL\config-CyaSSL.h
-            
-            
-              settings.h
-              5
-              RTE\wolfSSL\settings.h
-            
-            
-              cyassl_MDK_ARM.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c
-            
-            
-              aes.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c
-            
-            
-              arc4.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c
-            
-            
-              asm.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c
-            
-            
-              asn.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c
-            
-            
-              blake2b.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c
-            
-            
-              camellia.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c
-            
-            
-              coding.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c
-            
-            
-              compress.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c
-            
-            
-              des3.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c
-            
-            
-              dh.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c
-            
-            
-              dsa.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c
-            
-            
-              ecc.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c
-            
-            
-              ecc_fp.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c
-            
-            
-              error.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c
-            
-            
-              hc128.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c
-            
-            
-              hmac.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c
-            
-            
-              integer.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c
-            
-            
-              logging.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c
-            
-            
-              md2.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c
-            
-            
-              md4.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c
-            
-            
-              md5.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c
-            
-            
-              memory.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c
-            
-            
-              misc.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c
-            
-            
-              pwdbased.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c
-            
-            
-              rabbit.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c
-            
-            
-              random.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c
-            
-            
-              ripemd.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c
-            
-            
-              rsa.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c
-            
-            
-              sha.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c
-            
-            
-              sha256.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c
-            
-            
-              sha512.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c
-            
-            
-              tfm.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c
-            
-            
-              wc_port.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c
-            
-            
-              crl.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c
-            
-            
-              internal.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c
-            
-            
-              io.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c
-            
-            
-              keys.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c
-            
-            
-              ocsp.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c
-            
-            
-              sniffer.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c
-            
-            
-              ssl.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c
-            
-            
-              tls.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c
-            
-          
         
       
     
   
 
   
-    
-      
-        
-          
-        
-      
-      
-        
-          
-        
-      
-      
-        
-          
-        
-      
-      
-        
-          
-        
-      
-      
-        
-          
-        
-      
-    
     
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
       
         
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
-        
-      
-      
-        
-        
-          
-        
-      
-      
-        
-        
-          
+          
         
       
     
     
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
         
       
     
     
-      
+      
         RTE\CMSIS\RTX_Conf_CM.c
-        
-        
+        
+        
         
-          
+          
+        
+      
+      
+        RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s
+        
+        
+        
+      
+      
+        RTE\Device\MK70FN1M0xxx12\system_MK70F12.c
+        
+        
+        
+      
+      
+        RTE\Device\STM32F207IGHx\RTE_Device.h
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGHx\startup_stm32f207xx.s
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGHx\system_stm32f2xx.c
+        
+        
+        
+          
         
       
       
-        RTE\Device\STM32F207IG\RTE_Device.h
-        
-        
-        
-          
-        
+        RTE\Device\STM32F207IG\RTE_Device.h
+        
+        
+        
+      
+      
+        RTE\Device\STM32F207IG\startup_stm32f207xx.s
+        
+        
+        
       
       
-        RTE\Device\STM32F207IG\startup_stm32f2xx.s
-        
-        
-        
-          
-        
+        RTE\Device\STM32F207IG\startup_stm32f2xx.s
+        
+        
+        
       
-      
-        RTE\Device\STM32F207IG\system_stm32f2xx.c
-        
-        
-        
-          
-        
+      
+        RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h
+        
+        
+        
       
-      
+      
+        RTE\Device\STM32F207IG\system_stm32f2xx.c
+        
+        
+        
+      
+      
+        RTE\Device\TM4C129ENCPDT\startup_TM4C129.s
+        
+        
+        
+      
+      
+        RTE\Device\TM4C129ENCPDT\system_tm4c129.c
+        
+        
+        
+      
+      
         RTE\File_System\FS_Config.c
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\File_System\FS_Config_MC_0.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config.c
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_BSD.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_DNS_Client.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_ETH_0.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_TCP.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_UDP.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
-        RTE\Network\Net_Debug.c
-        
-        
-        
-          
-        
+      
+        RTE\Network\Net_Debug.c
+        
+        
+        
       
       
         RTE\Other\config-Crypt.h
@@ -1126,34 +872,46 @@
         
         
       
-      
+      
         RTE\wolfSSL\config-Crypt.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
-        RTE\wolfSSL\config-CyaSSL.h
+      
+        RTE\wolfSSL\config-CyaSSL.h
         
-        
+        
+        
+      
+      
+        RTE\wolfSSL\config-wolfSSL.h
+        
+        
         
-          
+          
         
       
       
         RTE\wolfSSL\config.h
-        
-        
+        
+        
         
       
-      
-        RTE\wolfSSL\settings.h
-        
-        
+      
+        RTE\wolfSSL\settings.h
+        
+        
+        
+      
+      
+        RTE\wolfSSL\user_settings.h
+        
+        
         
-          
+          
         
       
     
diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx
index e58d8495e..ff25d6393 100644
--- a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx
+++ b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx
@@ -13,6 +13,7 @@
     *.txt; *.h; *.inc
     *.plm
     *.cpp
+    0
   
 
   
@@ -21,16 +22,17 @@
   
 
   
-    SimpleServer
+    STM32F207 Flash
     0x4
     ARM-ADS
     
-      120000000
+      12000000
       
         1
         1
         0
         1
+        0
       
       
         1
@@ -75,17 +77,17 @@
         0
         1
       
-      255
+      18
       
         
           0
           Schematics (MCBSTM32F200)
-          C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf
+          C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf
         
         
           1
           User Manual (MCBSTM32F200)
-          C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm
+          C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm
         
         
           2
@@ -113,10 +115,9 @@
         1
         1
         1
-        1
         0
         0
-        8
+        1
         
         
         
@@ -127,9 +128,14 @@
         
         
         .\STM32_SWO.ini
-        BIN\ULP2CM3.DLL
+        BIN\UL2CM3.DLL
       
       
+        
+          0
+          ARMRTXEVENTFLAGS
+          -L70 -Z18 -C0 -M0 -T1
+        
         
           0
           DLGTARM
@@ -143,17 +149,17 @@
         
           0
           ULP2CM3
-          -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)
+          -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM)
         
         
           0
           DLGUARM
-          
+          (105=-1,-1,-1,-1,0)
         
         
           0
           UL2CM3
-          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm))
+          -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)
         
       
       
@@ -161,7 +167,8 @@
         
           1
           8
-          0x20000408
+          port
+          0
         
       
       
@@ -169,6 +176,7 @@
           2
           8
           0x8004dc8
+          0
         
       
       
@@ -195,7 +203,7 @@
         0
         0
         1
-        0
+        1
         0
         0
         0
@@ -207,7 +215,7 @@
 
   
     Source
-    0
+    1
     0
     0
     0
@@ -224,19 +232,6 @@
       0
       0
     
-    
-      1
-      2
-      1
-      0
-      0
-      0
-      0
-      .\server.c
-      server.c
-      0
-      0
-    
   
 
   
@@ -247,20 +242,7 @@
     0
     
       2
-      3
-      5
-      0
-      0
-      0
-      0
-      .\RTE\wolfSSL\config-CyaSSL.h
-      config-CyaSSL.h
-      0
-      0
-    
-    
-      2
-      4
+      2
       5
       0
       0
@@ -273,20 +255,33 @@
     
     
       2
-      5
+      3
       5
       0
       0
       0
       0
-      .\RTE\Network\Net_Config_ETH_0.h
-      Net_Config_ETH_0.h
+      .\RTE\wolfSSL\config-wolfSSL.h
+      config-wolfSSL.h
       0
       0
     
     
       2
-      6
+      4
+      5
+      0
+      0
+      0
+      0
+      .\RTE\wolfSSL\user_settings.h
+      user_settings.h
+      0
+      0
+    
+    
+      2
+      5
       5
       0
       0
@@ -300,14 +295,14 @@
   
 
   
-    Documentation
-    0
+    Dcumentation
+    1
     0
     0
     0
     
       3
-      7
+      6
       5
       0
       0
@@ -321,178 +316,35 @@
   
 
   
-    Devices
+    ::CMSIS
     1
     0
     0
-    0
-    
-      4
-      8
-      1
-      0
-      0
-      0
-      0
-      .\time-dummy.c
-      time-dummy.c
-      0
-      0
-    
+    1
   
 
   
-    ::CMSIS
-    0
+    ::CMSIS Driver
+    1
+    0
+    0
+    1
+  
+
+  
+    ::Compiler
+    1
     0
     0
     1
-    
-      5
-      9
-      1
-      0
-      0
-      0
-      0
-      RTE\CMSIS\RTX_Conf_CM.c
-      RTX_Conf_CM.c
-      1
-      0
-    
-    
-      5
-      10
-      4
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib
-      RTX_CM3.lib
-      1
-      0
-    
   
 
   
     ::Device
-    0
+    1
     0
     0
     1
-    
-      6
-      11
-      5
-      0
-      0
-      0
-      0
-      RTE\Device\STM32F207IG\RTE_Device.h
-      RTE_Device.h
-      1
-      0
-    
-    
-      6
-      12
-      2
-      0
-      0
-      0
-      0
-      RTE\Device\STM32F207IG\startup_stm32f2xx.s
-      startup_stm32f2xx.s
-      1
-      0
-    
-    
-      6
-      13
-      1
-      0
-      0
-      0
-      0
-      RTE\Device\STM32F207IG\system_stm32f2xx.c
-      system_stm32f2xx.c
-      1
-      0
-    
-    
-      6
-      14
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c
-      DMA_STM32F2xx.c
-      1
-      0
-    
-    
-      6
-      15
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c
-      GPIO_STM32F2xx.c
-      1
-      0
-    
-  
-
-  
-    ::Drivers
-    0
-    0
-    0
-    1
-    
-      7
-      16
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c
-      EMAC_STM32F2xx.c
-      1
-      0
-    
-    
-      7
-      17
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c
-      MCI_STM32F2xx.c
-      1
-      0
-    
-    
-      7
-      18
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c
-      PHY_ST802RT1.c
-      1
-      0
-    
   
 
   
@@ -501,750 +353,22 @@
     0
     0
     1
-    
-      8
-      19
-      1
-      0
-      0
-      0
-      0
-      RTE\File_System\FS_Config.c
-      FS_Config.c
-      1
-      0
-    
-    
-      8
-      20
-      5
-      0
-      0
-      0
-      0
-      RTE\File_System\FS_Config_MC_0.h
-      FS_Config_MC_0.h
-      1
-      0
-    
-    
-      8
-      21
-      4
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib
-      FS_LFN_CM3_L.lib
-      1
-      0
-    
   
 
   
     ::Network
-    0
+    1
     0
     0
     1
-    
-      9
-      22
-      1
-      0
-      0
-      0
-      0
-      RTE\Network\Net_Config.c
-      Net_Config.c
-      1
-      0
-    
-    
-      9
-      23
-      5
-      0
-      0
-      0
-      0
-      RTE\Network\Net_Config_BSD.h
-      Net_Config_BSD.h
-      1
-      0
-    
-    
-      9
-      24
-      5
-      0
-      0
-      0
-      0
-      RTE\Network\Net_Config_DNS_Client.h
-      Net_Config_DNS_Client.h
-      1
-      0
-    
-    
-      9
-      25
-      5
-      0
-      0
-      0
-      0
-      RTE\Network\Net_Config_ETH_0.h
-      Net_Config_ETH_0.h
-      1
-      0
-    
-    
-      9
-      26
-      5
-      0
-      0
-      0
-      0
-      RTE\Network\Net_Config_TCP.h
-      Net_Config_TCP.h
-      1
-      0
-    
-    
-      9
-      27
-      5
-      0
-      0
-      0
-      0
-      RTE\Network\Net_Config_UDP.h
-      Net_Config_UDP.h
-      1
-      0
-    
-    
-      9
-      28
-      1
-      0
-      0
-      0
-      0
-      RTE\Network\Net_Debug.c
-      Net_Debug.c
-      1
-      0
-    
-    
-      9
-      29
-      4
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib
-      Net_Dbg_CM3_L.lib
-      1
-      0
-    
   
 
   
     ::wolfSSL
-    0
+    1
     0
     0
     1
-    
-      10
-      30
-      5
-      0
-      0
-      0
-      0
-      RTE\wolfSSL\config-Crypt.h
-      config-Crypt.h
-      1
-      0
-    
-    
-      10
-      31
-      5
-      0
-      0
-      0
-      0
-      RTE\wolfSSL\config-CyaSSL.h
-      config-CyaSSL.h
-      1
-      0
-    
-    
-      10
-      32
-      5
-      0
-      0
-      0
-      0
-      RTE\wolfSSL\settings.h
-      settings.h
-      1
-      0
-    
-    
-      10
-      33
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c
-      cyassl_MDK_ARM.c
-      1
-      0
-    
-    
-      10
-      34
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c
-      aes.c
-      1
-      0
-    
-    
-      10
-      35
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c
-      arc4.c
-      1
-      0
-    
-    
-      10
-      36
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c
-      asm.c
-      1
-      0
-    
-    
-      10
-      37
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c
-      asn.c
-      1
-      0
-    
-    
-      10
-      38
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c
-      blake2b.c
-      1
-      0
-    
-    
-      10
-      39
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c
-      camellia.c
-      1
-      0
-    
-    
-      10
-      40
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c
-      coding.c
-      1
-      0
-    
-    
-      10
-      41
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c
-      compress.c
-      1
-      0
-    
-    
-      10
-      42
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c
-      des3.c
-      1
-      0
-    
-    
-      10
-      43
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c
-      dh.c
-      1
-      0
-    
-    
-      10
-      44
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c
-      dsa.c
-      1
-      0
-    
-    
-      10
-      45
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c
-      ecc.c
-      1
-      0
-    
-    
-      10
-      46
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c
-      ecc_fp.c
-      1
-      0
-    
-    
-      10
-      47
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c
-      error.c
-      1
-      0
-    
-    
-      10
-      48
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c
-      hc128.c
-      1
-      0
-    
-    
-      10
-      49
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c
-      hmac.c
-      1
-      0
-    
-    
-      10
-      50
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c
-      integer.c
-      1
-      0
-    
-    
-      10
-      51
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c
-      logging.c
-      1
-      0
-    
-    
-      10
-      52
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c
-      md2.c
-      1
-      0
-    
-    
-      10
-      53
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c
-      md4.c
-      1
-      0
-    
-    
-      10
-      54
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c
-      md5.c
-      1
-      0
-    
-    
-      10
-      55
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c
-      memory.c
-      1
-      0
-    
-    
-      10
-      56
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c
-      misc.c
-      1
-      0
-    
-    
-      10
-      57
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c
-      pwdbased.c
-      1
-      0
-    
-    
-      10
-      58
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c
-      rabbit.c
-      1
-      0
-    
-    
-      10
-      59
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c
-      random.c
-      1
-      0
-    
-    
-      10
-      60
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c
-      ripemd.c
-      1
-      0
-    
-    
-      10
-      61
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c
-      rsa.c
-      1
-      0
-    
-    
-      10
-      62
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c
-      sha.c
-      1
-      0
-    
-    
-      10
-      63
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c
-      sha256.c
-      1
-      0
-    
-    
-      10
-      64
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c
-      sha512.c
-      1
-      0
-    
-    
-      10
-      65
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c
-      tfm.c
-      1
-      0
-    
-    
-      10
-      66
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c
-      wc_port.c
-      1
-      0
-    
-    
-      10
-      67
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c
-      crl.c
-      1
-      0
-    
-    
-      10
-      68
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c
-      internal.c
-      1
-      0
-    
-    
-      10
-      69
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c
-      io.c
-      1
-      0
-    
-    
-      10
-      70
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c
-      keys.c
-      1
-      0
-    
-    
-      10
-      71
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c
-      ocsp.c
-      1
-      0
-    
-    
-      10
-      72
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c
-      sniffer.c
-      1
-      0
-    
-    
-      10
-      73
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c
-      ssl.c
-      1
-      0
-    
-    
-      10
-      74
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c
-      tls.c
-      1
-      0
-    
   
 
 
diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx
index 6480847b4..3a6c23fb5 100644
--- a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx
+++ b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx
@@ -7,19 +7,21 @@
 
   
     
-      SimpleServer
+      STM32F207 Flash
       0x4
       ARM-ADS
       
         
-          STM32F207IG
+          STM32F207IGHx
           STMicroelectronics
-          IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE
+          Keil.STM32F2xx_DFP.2.2.0
+          http://www.keil.com/pack
+          IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE
           
           
-          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm))
+          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM))
           0
-          $$Device:STM32F207IG$Device\Include\stm32f2xx.h
+          $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h
           
           
           
@@ -29,7 +31,7 @@
           
           
           
-          $$Device:STM32F207IG$SVD\STM32F20x.svd
+          $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd
           0
           0
           
@@ -45,7 +47,7 @@
             1
           
           .\Object\
-          SimpleServer
+          EchoClient
           1
           0
           0
@@ -104,11 +106,11 @@
         
         
           SARMCM3.DLL
-          -REMAP -MPU
+           -REMAP -MPU
           DCM.DLL
           -pCM3
           SARMCM3.DLL
-          -REMAP -MPU
+           -MPU
           TCM.DLL
           -pCM3
         
@@ -143,10 +145,9 @@
             1
             1
             1
-            1
           
           0
-          8
+          1
           
             
             
@@ -160,7 +161,7 @@
             
             
             .\STM32_SWO.ini
-            BIN\ULP2CM3.DLL
+            BIN\UL2CM3.DLL
           
         
         
@@ -173,8 +174,8 @@
             4100
           
           1
-          BIN\ULP2CM3.DLL
-          "" ()
+          BIN\UL2CM3.DLL
+          
           
           
           
@@ -355,14 +356,14 @@
             0
             0
             0
-            0
+            2
             0
             0
-            0
+            1
             0
             
-              
-              HAVE_CONFIG_H  MDK_CONF_SimpleServer
+              --diag_suppress=1293
+              HSE_VALUE=25000000 HAVE_CONFIG_H  MDK_CONF_EchoClient WOLFSSL_USER_SETTINGS
               
               
             
@@ -412,30 +413,25 @@
               1
               .\main.c
             
-            
-              server.c
-              1
-              .\server.c
-            
           
         
         
           Configuration
           
-            
-              config-CyaSSL.h
-              5
-              .\RTE\wolfSSL\config-CyaSSL.h
-            
             
               config-Crypt.h
               5
               .\RTE\wolfSSL\config-Crypt.h
             
             
-              Net_Config_ETH_0.h
+              config-wolfSSL.h
               5
-              .\RTE\Network\Net_Config_ETH_0.h
+              .\RTE\wolfSSL\config-wolfSSL.h
+            
+            
+              user_settings.h
+              5
+              .\RTE\wolfSSL\user_settings.h
             
             
               config-SimpleServer.h
@@ -445,7 +441,7 @@
           
         
         
-          Documentation
+          Dcumentation
           
             
               Abstract.txt
@@ -455,374 +451,25 @@
           
         
         
-          Devices
-          
-            
-              time-dummy.c
-              1
-              .\time-dummy.c
-            
-          
+          ::CMSIS
         
         
-          ::CMSIS
-          
-            
-              RTX_Conf_CM.c
-              1
-              RTE\CMSIS\RTX_Conf_CM.c
-            
-            
-              RTX_CM3.lib
-              4
-              C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib
-            
-          
+          ::CMSIS Driver
+        
+        
+          ::Compiler
         
         
           ::Device
-          
-            
-              RTE_Device.h
-              5
-              RTE\Device\STM32F207IG\RTE_Device.h
-            
-            
-              startup_stm32f2xx.s
-              2
-              RTE\Device\STM32F207IG\startup_stm32f2xx.s
-            
-            
-              system_stm32f2xx.c
-              1
-              RTE\Device\STM32F207IG\system_stm32f2xx.c
-            
-            
-              DMA_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c
-            
-            
-              GPIO_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c
-            
-          
-        
-        
-          ::Drivers
-          
-            
-              EMAC_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c
-            
-            
-              MCI_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c
-            
-            
-              PHY_ST802RT1.c
-              1
-              C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c
-            
-          
         
         
           ::File System
-          
-            
-              FS_Config.c
-              1
-              RTE\File_System\FS_Config.c
-            
-            
-              FS_Config_MC_0.h
-              5
-              RTE\File_System\FS_Config_MC_0.h
-            
-            
-              FS_LFN_CM3_L.lib
-              4
-              C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib
-            
-          
         
         
           ::Network
-          
-            
-              Net_Config.c
-              1
-              RTE\Network\Net_Config.c
-            
-            
-              Net_Config_BSD.h
-              5
-              RTE\Network\Net_Config_BSD.h
-            
-            
-              Net_Config_DNS_Client.h
-              5
-              RTE\Network\Net_Config_DNS_Client.h
-            
-            
-              Net_Config_ETH_0.h
-              5
-              RTE\Network\Net_Config_ETH_0.h
-            
-            
-              Net_Config_TCP.h
-              5
-              RTE\Network\Net_Config_TCP.h
-            
-            
-              Net_Config_UDP.h
-              5
-              RTE\Network\Net_Config_UDP.h
-            
-            
-              Net_Debug.c
-              1
-              RTE\Network\Net_Debug.c
-            
-            
-              Net_Dbg_CM3_L.lib
-              4
-              C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib
-            
-          
         
         
           ::wolfSSL
-          
-            
-              config-Crypt.h
-              5
-              RTE\wolfSSL\config-Crypt.h
-            
-            
-              config-CyaSSL.h
-              5
-              RTE\wolfSSL\config-CyaSSL.h
-            
-            
-              settings.h
-              5
-              RTE\wolfSSL\settings.h
-            
-            
-              cyassl_MDK_ARM.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c
-            
-            
-              aes.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c
-            
-            
-              arc4.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c
-            
-            
-              asm.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c
-            
-            
-              asn.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c
-            
-            
-              blake2b.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c
-            
-            
-              camellia.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c
-            
-            
-              coding.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c
-            
-            
-              compress.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c
-            
-            
-              des3.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c
-            
-            
-              dh.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c
-            
-            
-              dsa.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c
-            
-            
-              ecc.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c
-            
-            
-              ecc_fp.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c
-            
-            
-              error.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c
-            
-            
-              hc128.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c
-            
-            
-              hmac.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c
-            
-            
-              integer.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c
-            
-            
-              logging.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c
-            
-            
-              md2.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c
-            
-            
-              md4.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c
-            
-            
-              md5.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c
-            
-            
-              memory.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c
-            
-            
-              misc.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c
-            
-            
-              pwdbased.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c
-            
-            
-              rabbit.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c
-            
-            
-              random.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c
-            
-            
-              ripemd.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c
-            
-            
-              rsa.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c
-            
-            
-              sha.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c
-            
-            
-              sha256.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c
-            
-            
-              sha512.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c
-            
-            
-              tfm.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c
-            
-            
-              wc_port.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c
-            
-            
-              crl.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c
-            
-            
-              internal.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c
-            
-            
-              io.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c
-            
-            
-              keys.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c
-            
-            
-              ocsp.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c
-            
-            
-              sniffer.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c
-            
-            
-              ssl.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c
-            
-            
-              tls.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c
-            
-          
         
       
     
@@ -830,272 +477,406 @@
 
   
     
-      
+      
+        
+      
+      
         
-          
+          
         
       
-      
+      
         
-          
+          
         
       
-      
+      
         
-          
+          
         
       
-      
+      
         
-          
+          
         
       
-      
+      
         
-          
+          
+        
+      
+      
+        
+          
         
       
     
     
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
       
         
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
-        
-      
-      
-        
-        
-          
-        
-      
-      
-        
-        
-          
+          
         
       
     
     
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
         
       
     
     
-      
+      
         RTE\CMSIS\RTX_Conf_CM.c
-        
-        
+        
+        
         
-          
+          
+        
+      
+      
+        RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s
+        
+        
+        
+      
+      
+        RTE\Device\MK70FN1M0xxx12\system_MK70F12.c
+        
+        
+        
+      
+      
+        RTE\Device\STM32F207IGHx\RTE_Device.h
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGHx\startup_stm32f207xx.s
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGHx\system_stm32f2xx.c
+        
+        
+        
+          
         
       
       
-        RTE\Device\STM32F207IG\RTE_Device.h
-        
-        
-        
-          
-        
+        RTE\Device\STM32F207IG\RTE_Device.h
+        
+        
+        
+      
+      
+        RTE\Device\STM32F207IG\startup_stm32f207xx.s
+        
+        
+        
       
       
-        RTE\Device\STM32F207IG\startup_stm32f2xx.s
-        
-        
-        
-          
-        
+        RTE\Device\STM32F207IG\startup_stm32f2xx.s
+        
+        
+        
       
-      
-        RTE\Device\STM32F207IG\system_stm32f2xx.c
-        
-        
-        
-          
-        
+      
+        RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h
+        
+        
+        
       
-      
+      
+        RTE\Device\STM32F207IG\system_stm32f2xx.c
+        
+        
+        
+      
+      
+        RTE\Device\TM4C129ENCPDT\startup_TM4C129.s
+        
+        
+        
+      
+      
+        RTE\Device\TM4C129ENCPDT\system_tm4c129.c
+        
+        
+        
+      
+      
         RTE\File_System\FS_Config.c
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\File_System\FS_Config_MC_0.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config.c
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_BSD.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_DNS_Client.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_ETH_0.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_TCP.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_UDP.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
-        RTE\Network\Net_Debug.c
-        
-        
-        
-          
-        
+      
+        RTE\Network\Net_Debug.c
+        
+        
+        
       
       
         RTE\Other\config-Crypt.h
@@ -1121,20 +902,26 @@
         
         
       
-      
+      
         RTE\wolfSSL\config-Crypt.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
-        RTE\wolfSSL\config-CyaSSL.h
+      
+        RTE\wolfSSL\config-CyaSSL.h
         
         
+        
+      
+      
+        RTE\wolfSSL\config-wolfSSL.h
+        
+        
         
-          
+          
         
       
       
@@ -1143,12 +930,18 @@
         
         
       
-      
-        RTE\wolfSSL\settings.h
-        
-        
+      
+        RTE\wolfSSL\settings.h
+        
+        
+        
+      
+      
+        RTE\wolfSSL\user_settings.h
+        
+        
         
-          
+          
         
       
     
diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/server.c b/IDE/MDK5-ARM/Projects/SimpleServer/server.c
deleted file mode 100644
index b1a694400..000000000
--- a/IDE/MDK5-ARM/Projects/SimpleServer/server.c
+++ /dev/null
@@ -1,605 +0,0 @@
-/* server.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 
-#endif
-
-#include 
-
-#if !defined(CYASSL_TRACK_MEMORY) && !defined(NO_MAIN_DRIVER)
-    /* in case memory tracker wants stats */
-    #define CYASSL_TRACK_MEMORY
-#endif
-
-#if defined(CYASSL_MDK_ARM)
-        #include 
-        #include 
-
-        #if defined(CYASSL_MDK5)
-            #include "cmsis_os.h"
-            #include "rl_fs.h" 
-            #include "rl_net.h" 
-        #else
-            #include "rtl.h"
-        #endif
-
-        #include "cyassl_MDK_ARM.h"
-#endif
-#include 
-#include 
-
-#include "examples/server/server.h"
-
-
-#ifdef CYASSL_CALLBACKS
-    int srvHandShakeCB(HandShakeInfo*);
-    int srvTimeoutCB(TimeoutInfo*);
-    Timeval srvTo;
-#endif
-
-static void NonBlockingSSL_Accept(SSL* ssl)
-{
-#ifndef CYASSL_CALLBACKS
-    int ret = SSL_accept(ssl);
-#else
-    int ret = CyaSSL_accept_ex(ssl, srvHandShakeCB, srvTimeoutCB, srvTo);
-#endif
-    int error = SSL_get_error(ssl, 0);
-    SOCKET_T sockfd = (SOCKET_T)CyaSSL_get_fd(ssl);
-    int select_ret;
-
-    while (ret != SSL_SUCCESS && (error == SSL_ERROR_WANT_READ ||
-                                  error == SSL_ERROR_WANT_WRITE)) {
-        int currTimeout = 1;
-
-        if (error == SSL_ERROR_WANT_READ)
-            printf("... server would read block\n");
-        else
-            printf("... server would write block\n");
-
-#ifdef CYASSL_DTLS
-        currTimeout = CyaSSL_dtls_get_current_timeout(ssl);
-#endif
-        select_ret = tcp_select(sockfd, currTimeout);
-
-        if ((select_ret == TEST_RECV_READY) ||
-                                        (select_ret == TEST_ERROR_READY)) {
-            #ifndef CYASSL_CALLBACKS
-                ret = SSL_accept(ssl);
-            #else
-                ret = CyaSSL_accept_ex(ssl,
-                                    srvHandShakeCB, srvTimeoutCB, srvTo);
-            #endif
-            error = SSL_get_error(ssl, 0);
-        }
-        else if (select_ret == TEST_TIMEOUT && !CyaSSL_dtls(ssl)) {
-            error = SSL_ERROR_WANT_READ;
-        }
-#ifdef CYASSL_DTLS
-        else if (select_ret == TEST_TIMEOUT && CyaSSL_dtls(ssl) &&
-                                            CyaSSL_dtls_got_timeout(ssl) >= 0) {
-            error = SSL_ERROR_WANT_READ;
-        }
-#endif
-        else {
-            error = SSL_FATAL_ERROR;
-        }
-    }
-    if (ret != SSL_SUCCESS)
-        err_sys("SSL_accept failed");
-}
-
-
-static void Usage(void)
-{
-    printf("server "    LIBCYASSL_VERSION_STRING
-           " NOTE: All files relative to CyaSSL home dir\n");
-    printf("-?          Help, print this usage\n");
-    printf("-p     Port to listen on, not 0, default %d\n", yasslPort);
-    printf("-v     SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n",
-                                 SERVER_DEFAULT_VERSION);
-    printf("-l     Cipher list\n");
-    printf("-c    Certificate file,           default %s\n", svrCert);
-    printf("-k    Key file,                   default %s\n", svrKey);
-    printf("-A    Certificate Authority file, default %s\n", cliCert);
-    printf("-d          Disable client cert check\n");
-    printf("-b          Bind to any interface instead of localhost only\n");
-    printf("-s          Use pre Shared keys\n");
-    printf("-t          Track CyaSSL memory use\n");
-    printf("-u          Use UDP DTLS,"
-           " add -v 2 for DTLSv1 (default), -v 3 for DTLSv1.2\n");
-    printf("-f          Fewer packets/group messages\n");
-    printf("-N          Use Non-blocking sockets\n");
-    printf("-S     Use Host Name Indication\n");
-#ifdef HAVE_OCSP
-    printf("-o          Perform OCSP lookup on peer certificate\n");
-    printf("-O     Perform OCSP lookup using  as responder\n");
-#endif
-#ifdef HAVE_PK_CALLBACKS 
-    printf("-P          Public Key Callbacks\n");
-#endif
-}
-
-THREAD_RETURN CYASSL_THREAD server_test(void* args)
-{
-    SOCKET_T sockfd   = 0;
-    SOCKET_T clientfd = 0;
-
-    SSL_METHOD* method = 0;
-    SSL_CTX*    ctx    = 0;
-    SSL*        ssl    = 0;
-
-    char   msg[] = "I hear you fa shizzle!";
-    char   input[80];
-    int    idx;
-    int    ch;
-    int    version = SERVER_DEFAULT_VERSION;
-    int    doCliCertCheck = 1;
-    int    useAnyAddr = 0;
-    word16 port = yasslPort;
-    int    usePsk = 0;
-    int    doDTLS = 0;
-    int    useNtruKey   = 0;
-    int    nonBlocking  = 0;
-    int    trackMemory  = 0;
-    int    fewerPackets = 0;
-    int    pkCallbacks  = 0;
-    char*  cipherList = NULL;
-    const char* verifyCert = cliCert;
-    const char* ourCert    = svrCert;
-    const char* ourKey     = svrKey;
-    int    argc = ((func_args*)args)->argc;
-    char** argv = ((func_args*)args)->argv;
-
-#ifdef HAVE_SNI
-    char*  sniHostName = NULL;
-#endif
-
-#ifdef HAVE_OCSP
-    int    useOcsp  = 0;
-    char*  ocspUrl  = NULL;
-#endif
-
-    ((func_args*)args)->return_code = -1; /* error state */
-
-#ifdef NO_RSA
-    verifyCert = (char*)cliEccCert;
-    ourCert    = (char*)eccCert;
-    ourKey     = (char*)eccKey;
-#endif
-    (void)trackMemory;
-    (void)pkCallbacks;
-
-    while ((ch = mygetopt(argc, argv, "?dbstnNufPp:v:l:A:c:k:S:oO:")) != -1) {
-        switch (ch) {
-            case '?' :
-                Usage();
-                exit(EXIT_SUCCESS);
-
-            case 'd' :
-                doCliCertCheck = 0;
-                break;
-
-            case 'b' :
-                useAnyAddr = 1;
-                break;
-
-            case 's' :
-                usePsk = 1;
-                break;
-
-            case 't' :
-            #ifdef USE_CYASSL_MEMORY
-                trackMemory = 1;
-            #endif
-                break;
-
-            case 'n' :
-                useNtruKey = 1;
-                break;
-
-            case 'u' :
-                doDTLS  = 1;
-                break;
-
-            case 'f' :
-                fewerPackets = 1;
-                break;
-
-            case 'P' :
-            #ifdef HAVE_PK_CALLBACKS 
-                pkCallbacks = 1;
-            #endif
-                break;
-
-            case 'p' :
-                port = (word16)atoi(myoptarg);
-                #if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API)
-                    if (port == 0)
-                        err_sys("port number cannot be 0");
-                #endif
-                break;
-
-            case 'v' :
-                version = atoi(myoptarg);
-                if (version < 0 || version > 3) {
-                    Usage();
-                    exit(MY_EX_USAGE);
-                }
-                break;
-
-            case 'l' :
-                cipherList = myoptarg;
-                break;
-
-            case 'A' :
-                verifyCert = myoptarg;
-                break;
-
-            case 'c' :
-                ourCert = myoptarg;
-                break;
-
-            case 'k' :
-                ourKey = myoptarg;
-                break;
-
-            case 'N':
-                nonBlocking = 1;
-                break;
-
-            case 'S' :
-                #ifdef HAVE_SNI
-                    sniHostName = myoptarg;
-                #endif
-                break;
-
-            case 'o' :
-                #ifdef HAVE_OCSP
-                    useOcsp = 1;
-                #endif
-                break;
-
-            case 'O' :
-                #ifdef HAVE_OCSP
-                    useOcsp = 1;
-                    ocspUrl = myoptarg;
-                #endif
-                break;
-
-            default:
-                Usage();
-                exit(MY_EX_USAGE);
-        }
-    }
-
-    myoptind = 0;      /* reset for test cases */
-
-    /* sort out DTLS versus TLS versions */
-    if (version == CLIENT_INVALID_VERSION) {
-        if (doDTLS)
-            version = CLIENT_DTLS_DEFAULT_VERSION;
-        else
-            version = CLIENT_DEFAULT_VERSION;
-    }
-    else {
-        if (doDTLS) {
-            if (version == 3)
-                version = -2;
-            else
-                version = -1;
-        }
-    }
-
-#ifdef USE_CYASSL_MEMORY
-    if (trackMemory)
-        InitMemoryTracker(); 
-#endif
-
-    switch (version) {
-#ifndef NO_OLD_TLS
-        case 0:
-            method = SSLv3_server_method();
-            break;
-
-    #ifndef NO_TLS
-        case 1:
-            method = TLSv1_server_method();
-            break;
-
-
-        case 2:
-            method = TLSv1_1_server_method();
-            break;
-
-        #endif
-#endif
-
-#ifndef NO_TLS
-        case 3:
-            method = TLSv1_2_server_method();
-            break;
-#endif
-                
-#ifdef CYASSL_DTLS
-        case -1:
-            method = DTLSv1_server_method();
-            break;
-
-        case -2:
-            method = DTLSv1_2_server_method();
-            break;
-#endif
-
-        default:
-            err_sys("Bad SSL version");
-    }
-
-    if (method == NULL)
-        err_sys("unable to get method");
-
-    ctx = SSL_CTX_new(method);
-    if (ctx == NULL)
-        err_sys("unable to get ctx");
-
-    if (cipherList)
-        if (SSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS)
-            err_sys("server can't set cipher list 1");
-
-#ifdef CYASSL_LEANPSK
-    usePsk = 1;
-#endif
-
-#if defined(NO_RSA) && !defined(HAVE_ECC)
-    usePsk = 1;
-#endif
-
-    if (fewerPackets)
-        CyaSSL_CTX_set_group_messages(ctx);
-
-#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
-    SSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack);
-#endif
-
-#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
-    if (!usePsk) {
-        if (SSL_CTX_use_certificate_file(ctx, ourCert, SSL_FILETYPE_PEM)
-                                         != SSL_SUCCESS)
-            err_sys("can't load server cert file, check file and run from"
-                    " CyaSSL home dir");
-    }
-#endif
-
-#ifdef HAVE_NTRU
-    if (useNtruKey) {
-        if (CyaSSL_CTX_use_NTRUPrivateKey_file(ctx, ourKey)
-                                               != SSL_SUCCESS)
-            err_sys("can't load ntru key file, "
-                    "Please run from CyaSSL home dir");
-    }
-#endif
-
-#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
-    if (!useNtruKey && !usePsk) {
-        if (SSL_CTX_use_PrivateKey_file(ctx, ourKey, SSL_FILETYPE_PEM)
-                                         != SSL_SUCCESS)
-            err_sys("can't load server private key file, check file and run "
-                "from CyaSSL home dir");
-    }
-#endif
-
-    if (usePsk) {
-#ifndef NO_PSK
-        SSL_CTX_set_psk_server_callback(ctx, my_psk_server_cb);
-        SSL_CTX_use_psk_identity_hint(ctx, "cyassl server");
-        if (cipherList == NULL) {
-            const char *defaultCipherList;
-            #ifdef HAVE_NULL_CIPHER
-                defaultCipherList = "PSK-NULL-SHA256";
-            #else
-                defaultCipherList = "PSK-AES128-CBC-SHA256";
-            #endif
-            if (SSL_CTX_set_cipher_list(ctx, defaultCipherList) != SSL_SUCCESS)
-                err_sys("server can't set cipher list 2");
-        }
-#endif
-    }
-
-#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
-    /* if not using PSK, verify peer with certs */
-    if (doCliCertCheck && usePsk == 0) {
-        SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER |
-                                SSL_VERIFY_FAIL_IF_NO_PEER_CERT,0);
-        if (SSL_CTX_load_verify_locations(ctx, verifyCert, 0) != SSL_SUCCESS)
-            err_sys("can't load ca file, Please run from CyaSSL home dir");
-    }
-#endif
-
-#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC)
-    /* don't use EDH, can't sniff tmp keys */
-    if (cipherList == NULL) {
-        if (SSL_CTX_set_cipher_list(ctx, "AES256-SHA256") != SSL_SUCCESS)
-            err_sys("server can't set cipher list 3");
-    }
-#endif
-
-#ifdef HAVE_SNI
-    if (sniHostName)
-        if (CyaSSL_CTX_UseSNI(ctx, CYASSL_SNI_HOST_NAME, sniHostName,
-                                           XSTRLEN(sniHostName)) != SSL_SUCCESS)
-            err_sys("UseSNI failed");
-#endif
-
-    ssl = SSL_new(ctx);
-    if (ssl == NULL)
-        err_sys("unable to get SSL");
-
-#ifdef HAVE_CRL
-    CyaSSL_EnableCRL(ssl, 0);
-    CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, CYASSL_CRL_MONITOR |
-                                                     CYASSL_CRL_START_MON);
-    CyaSSL_SetCRL_Cb(ssl, CRL_CallBack);
-#endif
-#ifdef HAVE_OCSP
-    if (useOcsp) {
-        if (ocspUrl != NULL) {
-            CyaSSL_CTX_SetOCSP_OverrideURL(ctx, ocspUrl);
-            CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE
-                                                    | CYASSL_OCSP_URL_OVERRIDE);
-        }
-        else
-            CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE);
-    }
-#endif
-#ifdef HAVE_PK_CALLBACKS
-    if (pkCallbacks)
-        SetupPkCallbacks(ctx, ssl);
-#endif
-
-    tcp_accept(&sockfd, &clientfd, (func_args*)args, port, useAnyAddr, doDTLS,
-               0);
-    if (!doDTLS) 
-        CloseSocket(sockfd);
-
-    SSL_set_fd(ssl, clientfd);
-    if (usePsk == 0 || cipherList != NULL) {
-        #if !defined(NO_FILESYSTEM) && !defined(NO_DH)
-            CyaSSL_SetTmpDH_file(ssl, dhParam, SSL_FILETYPE_PEM);
-        #elif !defined(NO_DH)
-            SetDH(ssl);  /* repick suites with DHE, higher priority than PSK */
-        #endif
-    }
-
-#ifndef CYASSL_CALLBACKS
-    if (nonBlocking) {
-        CyaSSL_set_using_nonblock(ssl, 1);
-        tcp_set_nonblocking(&clientfd);
-        NonBlockingSSL_Accept(ssl);
-    } else if (SSL_accept(ssl) != SSL_SUCCESS) {
-        int err = SSL_get_error(ssl, 0);
-        char buffer[CYASSL_MAX_ERROR_SZ];
-        printf("error = %d, %s\n", err, ERR_error_string(err, buffer));
-        err_sys("SSL_accept failed");
-    }
-#else
-    NonBlockingSSL_Accept(ssl);
-#endif
-    showPeer(ssl);
-
-    idx = SSL_read(ssl, input, sizeof(input)-1);
-    if (idx > 0) {
-        input[idx] = 0;
-        printf("Client message: %s\n", input);
-
-    }
-    else if (idx < 0) {
-        int readErr = SSL_get_error(ssl, 0);
-        if (readErr != SSL_ERROR_WANT_READ)
-            err_sys("SSL_read failed");
-    }
-
-    if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg))
-        err_sys("SSL_write failed");
-        
-    #if defined(CYASSL_MDK_SHELL) && defined(HAVE_MDK_RTX)
-        os_dly_wait(500) ;
-    #endif
-
-    SSL_shutdown(ssl);
-    SSL_free(ssl);
-    SSL_CTX_free(ctx);
-    
-    CloseSocket(clientfd);
-    ((func_args*)args)->return_code = 0;
-
-#ifdef USE_CYASSL_MEMORY
-    if (trackMemory)
-        ShowMemoryTracker();
-#endif /* USE_CYASSL_MEMORY */
-
-    return 0;
-}
-
-
-/* so overall tests can pull in test function */
-#ifndef NO_MAIN_DRIVER
-
-    int main(int argc, char** argv)
-    {
-        func_args args;
-
-#ifdef HAVE_CAVIUM
-        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
-        if (ret != 0)
-            err_sys("Cavium OpenNitroxDevice failed");
-#endif /* HAVE_CAVIUM */
-
-        StartTCP();
-
-        args.argc = argc;
-        args.argv = argv;
-
-        CyaSSL_Init();
-#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL)
-        CyaSSL_Debugging_ON();
-#endif
-        if (CurrentDir("server"))
-            ChangeDirBack(2);
-        else if (CurrentDir("Debug") || CurrentDir("Release"))
-            ChangeDirBack(3);
-   
-#ifdef HAVE_STACK_SIZE
-        StackSizeCheck(&args, server_test);
-#else 
-        server_test(&args);
-#endif
-        CyaSSL_Cleanup();
-
-#ifdef HAVE_CAVIUM
-        CspShutdown(CAVIUM_DEV_ID);
-#endif
-        return args.return_code;
-    }
-
-    int myoptind = 0;
-    char* myoptarg = NULL;
-
-#endif /* NO_MAIN_DRIVER */
-
-
-#ifdef CYASSL_CALLBACKS
-
-    int srvHandShakeCB(HandShakeInfo* info)
-    {
-        (void)info;
-        return 0;
-    }
-
-
-    int srvTimeoutCB(TimeoutInfo* info)
-    {
-        (void)info;
-        return 0;
-    }
-
-#endif
-

From e242d3eea36935df60be6f7275db86512b222e5d Mon Sep 17 00:00:00 2001
From: Takashi Kojo 
Date: Wed, 7 Oct 2015 14:55:34 +0900
Subject: [PATCH 43/77] Change project name cyassl to wolfssl

---
 .../Projects/wolfSSL-Full/Abstract.txt        |  85 ++
 IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c     | 128 +++
 IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c    | 697 +++++++++++++
 .../Projects/wolfSSL-Full/time-CortexM3-4.c   |  43 +
 .../Projects/wolfSSL-Full/wolfsslFull.uvoptx  | 387 +++++++
 .../Projects/wolfSSL-Full/wolfsslFull.uvprojx | 950 ++++++++++++++++++
 6 files changed, 2290 insertions(+)
 create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/Abstract.txt
 create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c
 create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c
 create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c
 create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx
 create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx

diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/Abstract.txt b/IDE/MDK5-ARM/Projects/wolfSSL-Full/Abstract.txt
new file mode 100644
index 000000000..dde67ce4f
--- /dev/null
+++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/Abstract.txt
@@ -0,0 +1,85 @@
+This program gives  wolfCrypt and CyaSSL library demo.
+
+In order to run the demo,
+Copy {PACK}\wolfSSL\CyaSSL\{version}\cyassl\certs folder and files to the SD memory.
+For demo configuration, refer config-Crypt.h and config-CyaSSL.h.
+
+After download and start the execution, you can type in commands through the
+Debug(printf) viewer. 
+
+test                                wolfCrypt Simple test suite
+benchmark                      wolfCrypt Simple benchmark
+server&                          simple server in background mode
+client                             simple client
+echoserver&                   echo server in background mode
+echoclient                      echo client
+server/client -h              help for server/client command
+
+
+=== Typical Command Usage Scenario ===
+
+Starting Shell
+>test
+MD5      test passed!
+MD4      test passed!
+SHA      test passed!
+...
+
+>benchmark
+AES      25 kB took 0.025 seconds,   0.96 MB/s
+ARC4     25 kB took 0.006 seconds,   3.83 MB/s
+...
+
+DH  2048 key agreement   685.93 milliseconds, avg over 1 iterations
+
+>echoserver&
+"echoserver" is running with the background mode.
+
+>echoclient
+ABCDEFG
+ABCDEFG
+WXYZ
+WXYZ
+quit
+sending server shutdown command: quit!
+client sent quit command: shutting down!
+
+>server&
+"server" is running with the background mode.
+
+>client
+peer's cert info:
+ issuer : /C=...
+ subject: /C=...
+ serial number:02 
+SSL version is TLSv1.2
+SSL cipher suite is TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
+peer's cert info:
+ issuer : /C=...
+ subject: /C=...
+ serial number:... 
+SSL version is TLSv1.2
+SSL cipher suite is TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
+Client message: hello cyassl!
+Server response: I hear you fa shizzle!
+
+>client -h 192.168.2.100 -p 443 -g -v 0
+peer's cert info:
+ issuer : /CN=...
+ subject: /CN=...
+ serial number:44:39:... 
+SSL version is SSLv3
+SSL cipher suite is SSL_RSA_WITH_RC4_128_SHA
+SSL connect ok, sending GET...
+...
+===
+
+For the hardware crypt on config-Crypt.h, download 
+STSW-STM32062: STM32F2xx standard peripherals library at 
+http://www.st.com/. Copy Libraries\STM32F2xx_StdPeriph_Driver\{inc,src} to 
+ {PACK}\cyassl\IDE\MDK5-ARM\STM32F2xx_StdPeriph_Lib
+
+
+Support
+-------
+Please send questions or comments to support@wolfssl.com
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c
new file mode 100644
index 000000000..2ee3de735
--- /dev/null
+++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c
@@ -0,0 +1,128 @@
+/* main.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 
+#endif
+
+#include 
+
+#include 
+#include 
+#define __CORTEX_M3__
+
+#include 
+#include "wolfcrypt/src/misc.c"
+#include "stm32f2xx_hal.h"
+#include "cmsis_os.h"
+#include "rl_net.h" 
+#include 
+
+#include 
+
+
+/*-----------------------------------------------------------------------------
+ *        Initialize Clock Configuration
+ *----------------------------------------------------------------------------*/
+void SystemClock_Config(void) {
+  RCC_OscInitTypeDef RCC_OscInitStruct;
+  RCC_ClkInitTypeDef RCC_ClkInitStruct;
+
+  /* Enable HSE Oscillator and activate PLL with HSE as source */
+  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
+  RCC_OscInitStruct.HSEState = RCC_HSE_ON;
+  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
+  RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
+  RCC_OscInitStruct.PLL.PLLM = 25;
+  RCC_OscInitStruct.PLL.PLLN = 240;
+  RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
+  RCC_OscInitStruct.PLL.PLLQ = 5;
+  HAL_RCC_OscConfig(&RCC_OscInitStruct);
+
+  /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2
+     clocks dividers */
+  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK |
+                                RCC_CLOCKTYPE_PCLK1  | RCC_CLOCKTYPE_PCLK2;
+  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
+  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
+  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
+  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
+  HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3);
+}
+
+/*-----------------------------------------------------------------------------
+ *        Initialize a Flash Memory Card
+ *----------------------------------------------------------------------------*/
+#if !defined(NO_FILESYSTEM)
+#include "rl_fs.h"
+static void init_filesystem (void) {
+  int32_t retv;
+
+  retv = finit ("M0:");
+  if (retv == 0) {
+    retv = fmount ("M0:");
+    if (retv == 0) {
+      printf ("Drive M0 ready!\n");
+    }
+    else {
+      printf ("Drive M0 mount failed!\n");
+    }
+  }
+  else {
+    printf ("Drive M0 initialization failed!\n");
+  }
+}
+#endif
+
+typedef struct func_args {
+    int    argc;
+    char** argv;
+} func_args;
+
+
+extern void shell_main(func_args * args) ;
+
+/*-----------------------------------------------------------------------------
+ *       mian entry 
+ *----------------------------------------------------------------------------*/
+int myoptind = 0;
+char* myoptarg = NULL;
+
+int main() 
+{
+    void *arg = NULL ;
+
+	  SystemClock_Config() ;
+	  #if !defined(NO_FILESYSTEM)
+        init_filesystem ();
+	  #endif
+	
+    netInitialize() ;
+    osDelay(300) ;
+ 
+    #if defined(DEBUG_WOLFSSL)
+         printf("Turning ON Debug message\n") ;
+         wolfSSL_Debugging_ON() ;
+    #endif
+
+    shell_main(arg) ;   
+
+}
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c
new file mode 100644
index 000000000..f9550c2a6
--- /dev/null
+++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c
@@ -0,0 +1,697 @@
+/*shell.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
+ */
+ 
+ /*** tiny Shell for wolfSSL apps ***/
+ 
+ #ifdef HAVE_CONFIG_H
+    #include 
+#endif
+
+
+#include "wolfssl/internal.h"
+#include 
+
+#if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET)
+    #include 
+    #include 
+    #include 
+        #if defined(WOLFSSL_MDK5) || defined(WOLFSSL_KEIL_TCP_NET)
+            #include "cmsis_os.h"
+        #include "rl_fs.h" 
+    #else
+            #include 
+        #endif
+#endif
+
+#ifdef WOLFSSL_KEIL_TCP_NET
+#include "wolfssl/test.h"
+#else
+typedef struct func_args {
+    int    argc;
+    char** argv;
+    int    return_code;
+} func_args;
+#endif
+
+#if defined(WOLFSSL_CMSIS_RTOS)
+#define HAVE_KEIL_RTX
+#endif
+
+#ifdef NO_ECHOCLIENT
+#define echoclient_test command_not_found
+#endif
+#ifdef NO_ECHOSERVER
+#define echoserver_test command_not_found
+#endif
+#ifdef NO_SIMPLE_CLIENT
+#define client_test command_not_found
+#endif
+#ifdef NO_SIMPLE_SERVER
+#define server_test command_not_found
+#endif
+#ifdef NO_CRYPT_BENCHMARK
+#define benchmark_test command_not_found
+#endif
+#ifdef NO_CRYPT_TEST
+#define ctaocrypt_test command_not_found
+#endif
+
+#ifndef WOLFSSL_KEIL_TCP_NET
+#define ipaddr_comm command_not_found
+#endif
+
+#if !defined(HAVE_KEIL_RTX)
+#define stack_comm command_not_found
+#endif
+
+
+#if !defined(DEBUG_WOLFSSL)
+#define dbg_comm command_not_found
+#endif
+
+
+void command_not_found(void *argv) {
+        printf("Command not found\n") ;
+}
+
+extern void echoclient_test(void *args) ;
+extern void echoserver_test(void *args) ;
+extern void benchmark_test(void *args) ;
+extern void wolfcrypt_test(void *args) ;
+extern void client_test(void *args) ;
+extern void server_test(void *args) ;
+extern void kill_task(void *args) ;
+extern void ipaddr_comm(void *args) ;
+extern void stack_comm(void *args) ;
+extern void for_command(void *args) ;
+extern void dbg_comm(void *arg) ;
+extern void help_comm(void *arg) ;
+
+#if !defined(NO_CRYPT_TEST)
+
+#ifndef NO_MD5
+extern void md5_test(void *arg) ;
+#endif
+#ifdef WOLFSSL_MD2
+extern void md2_test(void *arg) ;
+#endif
+#ifndef NO_MD4
+extern void md4_test(void *arg) ;
+#endif
+
+extern void sha_test(void *arg) ;
+
+#ifndef NO_SHA256
+extern void sha256_test(void *arg) ;
+#endif
+#ifdef WOLFSSL_SHA384
+extern void sha384_test(void *arg) ;
+#endif
+
+#ifdef WOLFSSL_SHA512
+extern void sha512_test(void *arg) ;
+#endif
+
+#ifdef WOLFSSL_RIPEMD
+extern void ripemd_test(void *arg) ;
+#endif
+#ifndef NO_HMAC
+    #ifndef NO_MD5
+extern void hmac_md5_test(void *arg) ;
+    #endif
+extern void hmac_sha_test(void *arg) ;
+
+    #ifndef NO_SHA256
+extern void hmac_sha256_test(void *arg) ;
+    #endif
+
+    #ifdef WOLFSSL_SHA384
+extern void hmac_sha384_test(void *arg) ;
+    #endif
+#endif
+#ifndef NO_RC4
+extern void arc4_test(void *arg) ;
+#endif
+
+#ifndef NO_HC128
+extern void hc128_test(void *arg) ;
+#endif
+
+#ifndef NO_RABBIT
+extern void rabbit_test(void *arg) ;
+#endif
+
+#ifndef NO_DES3
+extern void des_test(void *arg) ;
+extern void des3_test(void *arg) ;
+#endif
+
+#ifndef NO_AES
+extern void aes_test(void *arg) ;
+#ifdef HAVE_AESGCM
+extern void aesgcm_test(void *arg) ;
+#endif
+
+#ifdef HAVE_AESCCM
+extern void aesccm_test(void *arg) ;
+#endif
+#endif
+
+#ifdef HAVE_CAMELLIA
+extern void camellia_test(void *arg) ;
+#endif
+extern void random_test(void *arg) ;
+
+#ifndef NO_RSA
+extern void rsa_test(void *arg) ;
+#endif
+
+#ifndef NO_DH
+extern void dh_test(void *arg) ;
+#endif
+
+#ifndef NO_DSA
+extern void dsa_test(void *arg) ;
+#endif
+    
+#ifndef NO_PWDBASED
+extern void pwdbased_test(void *arg) ;
+#endif
+
+#ifdef OPENSSL_EXTRA
+extern void openssl_test(void *arg) ;
+#endif
+
+#ifdef HAVE_ECC
+extern void ecc_test(void *arg) ;
+#endif
+
+#endif /* NO_CRYPT_TEST */
+
+static struct {
+  const char *command ;
+    void (*func)(void *args) ;
+}   commandTable[] = {
+    "echoclient", echoclient_test,
+    "echoserver", echoserver_test,
+    "benchmark", benchmark_test,
+    "test", wolfcrypt_test,
+    "client", client_test,
+    "server", server_test,
+    "ipaddr", ipaddr_comm,      /* TBD */
+    "stack", stack_comm,        /* On/Off check stack size */
+    "for", for_command,         /* iterate next command X times */
+    "debug", dbg_comm,          /* On/Off debug message  */
+    "help", help_comm,          /* Breif description about the commands */
+
+    /** short name **/
+    "ec", echoclient_test,
+    "es", echoserver_test,
+    "bm", benchmark_test,
+    "te", wolfcrypt_test,
+    "cl", client_test,
+    "sv", server_test,
+    "ip", ipaddr_comm,
+    "st", stack_comm,
+  "dbg", dbg_comm,
+    "?",    help_comm,
+
+/*** test suites ****/
+#if !defined(NO_CRYPT_TEST)
+#ifndef NO_MD5
+  "md5",  md5_test,
+#endif
+#ifdef WOLFSSL_MD2
+  "md2",  md2_test,
+#endif
+#ifndef NO_MD4
+  "md4",  md4_test,
+#endif
+  "sha",  sha_test,
+#ifndef NO_SHA256
+  "sha256",  sha256_test,
+#endif
+#ifdef WOLFSSL_SHA384
+  "sha384",  sha384_test,
+#endif
+#ifdef WOLFSSL_SHA512
+  "sha512",  sha512_test,
+#endif
+#ifdef WOLFSSL_RIPEMD
+  "ripemd",  ripemd_test,
+#endif
+#ifndef NO_HMAC
+  #ifndef NO_MD5
+  "hmac_md5",  hmac_md5_test,
+    #endif
+  "hmac_sha",  hmac_sha_test,
+    #ifndef NO_SHA256
+  "hmac_sha256",  hmac_sha256_test,
+    #endif
+    #ifdef WOLFSSL_SHA384
+  "hmac_sha384",  hmac_sha384_test,
+  #endif
+#endif
+#ifndef NO_RC4
+    "arc4",  arc4_test,
+#endif
+#ifndef NO_HC128
+  "hc128",  hc128_test,
+#endif
+#ifndef NO_RABBIT
+  "rabbit",  rabbit_test,
+#endif
+#ifndef NO_DES3
+  "des",  des_test,
+  "des3",  des3_test,
+#endif  
+#ifndef NO_AES  
+  "aes",  aes_test,
+    #ifdef HAVE_AESGCM
+  "aesgcm",  aesgcm_test,
+    #endif
+    #ifdef HAVE_AESCCM
+  "aesccm",  aesccm_test,
+    #endif
+#endif
+
+#ifdef HAVE_CAMELLIA
+  "camellia",  camellia_test,
+#endif
+  "random",  random_test,
+#ifndef NO_RSA
+  "rsa",  rsa_test,
+#endif
+#ifndef NO_DH
+  "dh",  dh_test,
+#endif
+#ifndef NO_DSA
+    "dsa",  dsa_test,
+#endif 
+#ifndef NO_PWDBASED
+  "pwdbased",  pwdbased_test,
+#endif  
+#ifdef OPENSSL_EXTRA
+  "openssl",  openssl_test,
+#endif
+#ifdef HAVE_ECC
+  "ecc",  ecc_test,
+#endif
+
+#endif /* NO_CRYPT_TEST */
+
+    "",  NULL
+} ;
+
+enum jobtype { FORGROUND, BACKGROUND }  ;
+
+#define IF_DELIMITER(ch) ((ch) == ' ' || (ch) == '\n')
+
+static int BackGround = 0 ; /* 1: background job is running */
+
+char * wolfssl_fgets ( char * str, int num, FILE * f ) 
+{
+    int i ;
+    
+    for(i = 0 ; i< num ; i++) {
+            while((str[i] = getchar()) == 0) {
+            #if defined (HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS)
+                os_tsk_pass ();
+            #else 
+                osThreadYield ();
+            #endif
+        }
+        if(str[i] == '\n' || str[i] == '\012' || str[i] == '\015')  {
+            putchar('\n') ;
+            str[i++] = '\n' ; 
+            str[i] = '\0' ; 
+            break ;
+        } else if(str[i] == '\010') { /* BS */
+            if(i) { /* erace one char */
+                putchar('\010') ; putchar(' ') ; putchar('\010') ; 
+                i = (i>0 ? (i-2) : -1 ) ;
+                continue ;
+            } 
+        } else if(str[i] == '\033'  || str[i] == '\004' ) {  /* ESC or ^D */
+            str[i] = '\0' ;
+            return(0) ;
+        }
+        putchar(str[i]) ;
+    }
+    return(str) ;
+}
+
+/*******  Get Command Line *****************************/
+static int getline(char * line, int sz, func_args *args, int*bf_flg) 
+{
+    char * ret ;
+    int i ;
+    
+    #define MAXARGS 10
+    #define MAXARGLEN 30
+    static char *argv[MAXARGS] ;
+    args->argv = argv ;
+    
+    putchar('>') ;
+    fflush(stdout) ;
+    ret = wolfssl_fgets(line, sz, stdin) ;
+    
+    #define SHELL_ERROR_FGETS -102
+    if(ret != line) return(SHELL_ERROR_FGETS) ;
+    
+    if(line[strlen(line)-2] == '&') {
+        (*bf_flg) = BACKGROUND ;
+        line[strlen(line)-2] = '\n' ;
+    } else {
+        (*bf_flg) = FORGROUND ;
+    }
+    args->argc = 0 ;
+    for(i=0; iargv[args->argc] = &(line[i]) ;
+        while(!IF_DELIMITER(line[i])) i++ ;
+        args->argc++ ;
+        if(line[i] == '\n') {
+            line[i]  = '\0' ;
+            break ;
+        } else {
+            line[i]  = '\0' ;
+        }
+    }
+    return i ;
+}
+
+
+/************* Embedded Shell Commands **********************************/
+#define IP_SIZE 16
+
+#ifdef WOLFSSL_KEIL_TCP_NET
+static void ipaddr_comm(void *args) 
+{
+    if(((func_args *)args)->argc == 1) {
+            printf("IP addr: %s, port %d\n", wolfSSLIP, wolfSSLPort) ;
+    } else {
+        if(BackGround != 0) {
+        printf("Cannot change IP addr while background server is running\n") ;
+        } else if(((func_args *)args)->argc == 3 && 
+                  ((func_args *)args)->argv[1][0] == '-'&& 
+                  ((func_args *)args)->argv[1][1] == 'a' ) {
+/*          strcpy(yasslIP, ((func_args *)args)->argv[2]) ; */
+        } else if(((func_args *)args)->argc == 3 && 
+                  ((func_args *)args)->argv[1][0] == '-' && 
+                  ((func_args *)args)->argv[1][1] == 'p' ) {
+/*          yasslPort = atoi(((func_args *)args)->argv[2]) ; */
+        } else printf("Invalid argument\n") ; 
+    }
+}
+
+#endif
+
+
+
+#if defined(HAVE_KEIL_RTX)
+static int stack_ck = 0 ;
+
+void stack_comm(void *args) 
+{
+    if(stack_ck) {
+        printf("Stack Check: Off\n") ;
+        stack_ck = 0 ;
+    } else {
+        printf("Stack Check: On\n") ;
+        stack_ck = 1 ;
+    }
+}
+    
+#define FILL_PATTERN 0xa596695a
+void stack_fill(char * stack, int size)
+{
+    int i ;
+
+    if(stack_ck == 0)return ;
+    for(i=1; iargc == 1) {
+        printf("For %d times\n", for_iteration) ;
+    } else if( args == NULL || ((func_args *)args)->argc == 2) {
+        for_iteration = atoi(((func_args *)args)->argv[1]) ;
+    } else printf("Invalid argument\n") ;
+}
+
+
+#if defined(DEBUG_WOLFSSL)
+
+static int wolfsslDebug = 1 ;
+
+static void dbg_comm(void *args) 
+{
+    if(wolfsslDebug == 1) {
+        wolfsslDebug = 0 ;
+        printf("Turning OFF Debug message\n") ;
+        wolfSSL_Debugging_OFF() ;
+    } else {
+        wolfasslDebug = 1 ;
+        printf("Turning ON Debug message\n") ;
+        wolfSSL_Debugging_ON() ;
+    }
+}
+#endif
+
+static void help_comm(void *args) 
+{
+    static char *commands[] = {
+        "test", 
+        "benchmark",
+        "echoserver&            : simple echo server in background mode",
+        "echoclient             : simple echo client followed by any input string, or \"quit\", \"break\"",
+        "server&                : simple server in background mode",
+        "client                 : simple client",
+        "client -g -v [0123] -h xxx.xxx.xxx.xxx -p 443  : usage example",
+        "server/client -h        :  help for server/client command",
+        "help",
+        ""  
+    } ;
+
+    int i ;
+    printf("Commands:\n") ;
+    for(i=0; commands[i][0] ; i++)
+        printf("    %s\n", commands[i]) ;
+
+}
+
+
+
+#define BG_JOB_STACK_SIZE 16000
+#if (!defined(NO_SIMPLE_SERVER) && !defined(NO_ECHOSERVER)) && \
+                                                   defined(HAVE_KEIL_RTX)
+#if !defined(WOLFSSL_CMSIS_RTOS)
+static char bg_job_stack[BG_JOB_STACK_SIZE] ;
+#endif
+
+#endif
+
+#define COMMAND_STACK_SIZE 24000
+#if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS)
+static char command_stack[COMMAND_STACK_SIZE] ;
+#endif
+
+
+#if defined(HAVE_KEIL_RTX) || defined(WOLFSSL_CMSIS_RTOS)
+static   wolfSSL_Mutex command_mutex ;
+#endif
+
+void exit_command(void) {
+	  printf("Command Aborted\n") ;
+    #ifdef WOLFSSL_CMSIS_RTOS
+        osThreadTerminate(osThreadGetId()) ;
+    #else
+        os_tsk_delete_self() ;
+    #endif
+}
+
+
+/***********    Invoke Forground Command  *********************/
+static void command_invoke(void const *args) 
+{
+    void (*func)(void const * ) ;
+    int i,iteration ;
+    
+    func = (void(*)(void const *))((func_args *)args)->argv[0] ; 
+    #if defined(HAVE_KEIL_RTX)
+    LockMutex((wolfSSL_Mutex *)&command_mutex) ;
+    #endif
+    iteration = for_iteration ;
+    for(i=0; i< iteration; i++) {
+        if(iteration > 1) printf("--- Start for %d ---->\n", i) ;
+        #if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS)
+        stack_fill(command_stack, COMMAND_STACK_SIZE) ;
+        #endif
+                
+        func(args) ;        /* invoke command */
+                
+        #if defined(HAVE_KEIL_RTX)&& !defined(WOLFSSL_CMSIS_RTOS)
+        stack_check(command_stack, COMMAND_STACK_SIZE) ;
+        #endif
+    }
+
+    if(iteration > 1) 
+    for_iteration = 1 ;
+    osDelay(20000) ;
+    #ifdef HAVE_KEIL_RTX
+        UnLockMutex((wolfSSL_Mutex *)&command_mutex) ;
+        #ifdef WOLFSSL_CMSIS_RTOS
+            osThreadTerminate(osThreadGetId()) ;
+        #else
+            os_tsk_delete_self() ;
+        #endif
+    #endif
+}
+
+#if defined(HAVE_KEIL_RTX) || defined(WOLFSSL_CMSIS_RTOS)
+/*******  Invoke Background Job   *******************************/
+static void bg_job_invoke(void const *args) 
+{
+    void (*func)(void const * ) ;
+    BackGround = 1 ; 
+    #if defined(HAVE_KEIL_RTX)&& !defined(WOLFSSL_CMSIS_RTOS)
+    stack_fill(bg_job_stack, BG_JOB_STACK_SIZE) ;
+    #endif
+
+    func = (void(*)(void const *))((func_args *)args)->argv[0] ; 
+    func(args) ;        /* invoke command */
+    #if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS)
+    stack_check(bg_job_stack, BG_JOB_STACK_SIZE) ;
+    #endif
+    
+    osDelay(20000) ;
+    BackGround = 0 ;
+
+    #ifdef WOLFSSL_CMSIS_RTOS
+        osThreadTerminate(osThreadGetId()) ;
+    #else   
+        os_tsk_delete_self() ; ;
+    #endif
+}
+#endif
+
+#define LINESIZE 100
+static char line[LINESIZE] ;
+
+#if defined(WOLFSSL_CMSIS_RTOS)
+    osThreadDef (command_invoke, osPriorityAboveNormal , 1, COMMAND_STACK_SIZE) ;
+    osThreadDef (bg_job_invoke, osPriorityNormal , 1 , BG_JOB_STACK_SIZE) ;
+#endif
+/********* SHEULL MAIN LOOP ***********************************/
+void shell_main(void *arg) {
+    int i ; 
+    func_args args ;
+    int bf_flg ;
+    osThreadId 	 cmd ;
+    i = BackGround ; 
+        /* Dummy for avoiding warning: BackGround is defined but not used. */
+    
+ #if defined(HAVE_KEIL_RTX) 
+    InitMutex(&command_mutex) ;
+#endif
+    help_comm(NULL) ;
+    
+    printf("Starting Shell\n") ;
+    while(1) {
+        if(getline(line,  LINESIZE, &args, &bf_flg) > 0) {
+        for(i=0; commandTable[i].func != NULL; i++) {
+            if(strcmp(commandTable[i].command, args.argv[0]) == 0) {
+            args.argv[0] = (char *) commandTable[i].func ;
+                if(bf_flg == FORGROUND) {
+                    #if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS)
+                        UnLockMutex((wolfSSL_Mutex *)&command_mutex) ;
+                        os_tsk_create_user_ex( (void(*)(void *))&command_invoke, 7,
+                                 command_stack, COMMAND_STACK_SIZE, &args) ;
+                        os_tsk_pass ();
+                    #else
+                        #if defined(WOLFSSL_CMSIS_RTOS)
+                             UnLockMutex((wolfSSL_Mutex *)&command_mutex) ;
+                             cmd = osThreadCreate (osThread (command_invoke) , &args); 
+                             if(cmd == NULL) {
+															     printf("Cannon create command thread\n") ;
+														 }
+												     osThreadYield ();
+                        #else
+                              command_invoke(&args) ;
+                        #endif
+                    #endif
+                    #ifdef  HAVE_KEIL_RTX
+                    LockMutex((wolfSSL_Mutex *)&command_mutex) ;
+                    #endif
+                } else {
+                    #if (!defined(NO_SIMPLE_SERVER) && \
+                         !defined(NO_ECHOSERVER)) && \
+                         defined(HAVE_KEIL_RTX)
+                    if(BackGround != 0) {
+                        printf("Multiple background servers not supported.\n") ;
+                    } else {
+                        printf("\"%s\" is running with the background mode.\n", 
+                                                     commandTable[i].command) ;
+                        #if  defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS)
+                             os_tsk_create_user_ex( (void(*)(void *))&bg_job_invoke, 
+                                   6, bg_job_stack, BG_JOB_STACK_SIZE, &args) ;
+                        #else
+                                osThreadCreate (osThread (bg_job_invoke),  &args); 
+                                osDelay (500) ;
+                        #endif
+                    }
+                    #else
+                    printf("Invalid Command: no background job\n") ;
+                    #endif
+                }
+                break ;
+            }
+        }
+        if(commandTable[i].func == NULL)
+            printf("Command not found\n") ;
+        }
+    }
+}
+
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c
new file mode 100644
index 000000000..c825387dd
--- /dev/null
+++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c
@@ -0,0 +1,43 @@
+/* time-STM32F2.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 
+#endif
+
+#include 
+
+#include        
+#define DWT                 ((DWT_Type       *)     (0xE0001000UL)     ) 
+typedef struct
+{
+  uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  Control Register                          */
+  uint32_t CYCCNT;                  /*!< Offset: 0x004 (R/W)  Cycle Count Register                      */
+} DWT_Type;
+
+extern uint32_t SystemCoreClock ;
+
+double current_time(int reset) 
+{
+      if(reset) DWT->CYCCNT = 0 ;
+      return ((double)DWT->CYCCNT/SystemCoreClock) ;
+}
+
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx
new file mode 100644
index 000000000..91b3e7f9a
--- /dev/null
+++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx
@@ -0,0 +1,387 @@
+
+
+
+  1.0
+
+  
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + STM32F207 Flash + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\Object\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + + 0 + Schematics (MCBSTM32F200) + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf + + + 1 + User Manual (MCBSTM32F200) + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm + + + 2 + MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) + http://www.keil.com/mcbstm32f200/ + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + + + + + + + + + + .\STM32_SWO.ini + BIN\UL2CM3.DLL + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + ULP2CM3 + -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) + + + 0 + DLGUARM + (105=-1,-1,-1,-1,0) + + + 0 + UL2CM3 + -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) + + + + + + 1 + 8 + port + 0 + + + + + 2 + 8 + 0x8004dc8 + 0 + + + + 0 + + + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + .\main.c + main.c + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + .\shell.c + shell.c + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + .\time-CortexM3-4.c + time-CortexM3-4.c + 0 + 0 + + + + + Configuration + 1 + 0 + 0 + 0 + + 2 + 4 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\config-Crypt.h + config-Crypt.h + 0 + 0 + + + 2 + 5 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\config-wolfSSL.h + config-wolfSSL.h + 0 + 0 + + + 2 + 6 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\user_settings.h + user_settings.h + 0 + 0 + + + + + Dcumentation + 1 + 0 + 0 + 0 + + 3 + 7 + 5 + 0 + 0 + 0 + 0 + .\Abstract.txt + Abstract.txt + 0 + 0 + + + + + ::CMSIS + 1 + 0 + 0 + 1 + + + + ::CMSIS Driver + 1 + 0 + 0 + 1 + + + + ::Compiler + 1 + 0 + 0 + 1 + + + + ::Device + 1 + 0 + 0 + 1 + + + + ::File System + 1 + 0 + 0 + 1 + + + + ::Network + 1 + 0 + 0 + 1 + + + + ::wolfSSL + 1 + 0 + 0 + 1 + + +
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx new file mode 100644 index 000000000..29b8b698e --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx @@ -0,0 +1,950 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + STM32F207 Flash + 0x4 + ARM-ADS + + + STM32F207IGHx + STMicroelectronics + Keil.STM32F2xx_DFP.2.2.0 + http://www.keil.com/pack + IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) + 0 + $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h + + + + + + + + + + $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\Object\ + wolfssl-Full + 1 + 0 + 0 + 1 + 1 + .\Object\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM3 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM3 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + + + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + + 0 + 1 + + + + + + + + + + + + + .\STM32_SWO.ini + BIN\UL2CM3.DLL + + + + + 1 + 0 + 0 + 1 + 1 + 4100 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M3" + + 1 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 8 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 1 + 0x8000000 + 0x100000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x100000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 0 + + --diag_suppress=1293 + HSE_VALUE=25000000 HAVE_CONFIG_H MDK_CONF_full WOLFSSL_USER_SETTINGS + + + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + + + + + + + + + + + + Source + + + main.c + 1 + .\main.c + + + shell.c + 1 + .\shell.c + + + time-CortexM3-4.c + 1 + .\time-CortexM3-4.c + + + + + Configuration + + + config-Crypt.h + 5 + .\RTE\wolfSSL\config-Crypt.h + + + config-wolfSSL.h + 5 + .\RTE\wolfSSL\config-wolfSSL.h + + + user_settings.h + 5 + .\RTE\wolfSSL\user_settings.h + + + + + Dcumentation + + + Abstract.txt + 5 + .\Abstract.txt + + + + + ::CMSIS + + + ::CMSIS Driver + + + ::Compiler + + + ::Device + + + ::File System + + + ::Network + + + ::wolfSSL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RTE\CMSIS\RTX_Conf_CM.c + + + + + + + + RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s + + + + + + RTE\Device\MK70FN1M0xxx12\system_MK70F12.c + + + + + + RTE\Device\STM32F207IGHx\RTE_Device.h + + + + + + + + RTE\Device\STM32F207IGHx\startup_stm32f207xx.s + + + + + + + + RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h + + + + + + + + RTE\Device\STM32F207IGHx\system_stm32f2xx.c + + + + + + + + RTE\Device\STM32F207IG\RTE_Device.h + + + + + + RTE\Device\STM32F207IG\startup_stm32f207xx.s + + + + + + RTE\Device\STM32F207IG\startup_stm32f2xx.s + + + + + + RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h + + + + + + RTE\Device\STM32F207IG\system_stm32f2xx.c + + + + + + RTE\Device\TM4C129ENCPDT\startup_TM4C129.s + + + + + + RTE\Device\TM4C129ENCPDT\system_tm4c129.c + + + + + + RTE\File_System\FS_Config.c + + + + + + + + RTE\File_System\FS_Config_MC_0.h + + + + + + + + RTE\Network\Net_Config.c + + + + + + + + RTE\Network\Net_Config_BSD.h + + + + + + + + RTE\Network\Net_Config_DNS_Client.h + + + + + + + + RTE\Network\Net_Config_ETH_0.h + + + + + + + + RTE\Network\Net_Config_TCP.h + + + + + + + + RTE\Network\Net_Config_UDP.h + + + + + + + + RTE\Network\Net_Debug.c + + + + + + RTE\Other\config-Crypt.h + + + + + + RTE\Other\config-CyaSSL.h + + + + + + RTE\Other\config-RTX-TCP-FS.h + + + + + + RTE\Other\config.h + + + + + + RTE\wolfSSL\config-Crypt.h + + + + + + + + RTE\wolfSSL\config-CyaSSL.h + + + + + + RTE\wolfSSL\config-wolfSSL.h + + + + + + + + RTE\wolfSSL\config.h + + + + + + RTE\wolfSSL\settings.h + + + + + + RTE\wolfSSL\user_settings.h + + + + + + + + + +
From 78ed5d96df9fc790ea58941e5b6d34eaa1e41d85 Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Thu, 8 Oct 2015 15:39:14 +0900 Subject: [PATCH 44/77] echoclient for MDK fgets --- examples/echoclient/echoclient.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/examples/echoclient/echoclient.c b/examples/echoclient/echoclient.c index 5757fb18d..e855999c1 100644 --- a/examples/echoclient/echoclient.c +++ b/examples/echoclient/echoclient.c @@ -22,28 +22,30 @@ #ifdef HAVE_CONFIG_H #include #endif - + #include /* let's use cyassl layer AND cyassl openssl layer */ #include #include -#if defined(WOLFSSL_MDK_ARM) +#if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #include #include - #if defined(WOLFSSL_MDK5) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" + #if defined(WOLFSSL_MDK5) || defined(WOLFSSL_KEIL_TCP_NET) + #include "cmsis_os.h" + #include "rl_net.h" #else #include "rtl.h" #endif - - #include "wolfssl_MDK_ARM.h" + #if defined(WOLFSSL_MDK_SHELL) + char * wolfssl_fgets ( char * str, int num, FILE * f ) ; + #define fgets wolfssl_fgets + #endif #endif + #include #include "examples/echoclient/echoclient.h" From 7e1d0ccb11845c11e8d6cf883033b9fb2b29c5ba Mon Sep 17 00:00:00 2001 From: Takashi Kojo Date: Thu, 8 Oct 2015 16:10:42 +0900 Subject: [PATCH 45/77] removed CyaSSL-Full project, replaced with wolfSSL-Full --- .../Projects/CyaSSL-Full/Abstract.txt | 85 - .../Projects/CyaSSL-Full/CyaSSL-Full.uvoptx | 1366 ----- .../Projects/CyaSSL-Full/CyaSSL-Full.uvprojx | 1185 ---- .../CyaSSL-Full/RTE/wolfSSL/settings.h | 667 --- IDE/MDK5-ARM/Projects/CyaSSL-Full/benchmark.c | 1222 ----- IDE/MDK5-ARM/Projects/CyaSSL-Full/client.c | 858 --- .../Projects/CyaSSL-Full/echoclient.c | 282 - .../Projects/CyaSSL-Full/echoserver.c | 368 -- IDE/MDK5-ARM/Projects/CyaSSL-Full/main.c | 102 - IDE/MDK5-ARM/Projects/CyaSSL-Full/server.c | 605 --- IDE/MDK5-ARM/Projects/CyaSSL-Full/shell.c | 657 --- IDE/MDK5-ARM/Projects/CyaSSL-Full/test.c | 4758 ----------------- .../Projects/CyaSSL-Full/time-CortexM3-4.c | 41 - .../Projects/CyaSSL-Full/time-dummy.c | 34 - 14 files changed, 12230 deletions(-) delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/Abstract.txt delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvoptx delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvprojx delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/RTE/wolfSSL/settings.h delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/benchmark.c delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/client.c delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/echoclient.c delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/echoserver.c delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/main.c delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/server.c delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/shell.c delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/test.c delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/time-CortexM3-4.c delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/time-dummy.c diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/Abstract.txt b/IDE/MDK5-ARM/Projects/CyaSSL-Full/Abstract.txt deleted file mode 100644 index dde67ce4f..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/Abstract.txt +++ /dev/null @@ -1,85 +0,0 @@ -This program gives wolfCrypt and CyaSSL library demo. - -In order to run the demo, -Copy {PACK}\wolfSSL\CyaSSL\{version}\cyassl\certs folder and files to the SD memory. -For demo configuration, refer config-Crypt.h and config-CyaSSL.h. - -After download and start the execution, you can type in commands through the -Debug(printf) viewer. - -test wolfCrypt Simple test suite -benchmark wolfCrypt Simple benchmark -server& simple server in background mode -client simple client -echoserver& echo server in background mode -echoclient echo client -server/client -h help for server/client command - - -=== Typical Command Usage Scenario === - -Starting Shell ->test -MD5 test passed! -MD4 test passed! -SHA test passed! -... - ->benchmark -AES 25 kB took 0.025 seconds, 0.96 MB/s -ARC4 25 kB took 0.006 seconds, 3.83 MB/s -... - -DH 2048 key agreement 685.93 milliseconds, avg over 1 iterations - ->echoserver& -"echoserver" is running with the background mode. - ->echoclient -ABCDEFG -ABCDEFG -WXYZ -WXYZ -quit -sending server shutdown command: quit! -client sent quit command: shutting down! - ->server& -"server" is running with the background mode. - ->client -peer's cert info: - issuer : /C=... - subject: /C=... - serial number:02 -SSL version is TLSv1.2 -SSL cipher suite is TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 -peer's cert info: - issuer : /C=... - subject: /C=... - serial number:... -SSL version is TLSv1.2 -SSL cipher suite is TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 -Client message: hello cyassl! -Server response: I hear you fa shizzle! - ->client -h 192.168.2.100 -p 443 -g -v 0 -peer's cert info: - issuer : /CN=... - subject: /CN=... - serial number:44:39:... -SSL version is SSLv3 -SSL cipher suite is SSL_RSA_WITH_RC4_128_SHA -SSL connect ok, sending GET... -... -=== - -For the hardware crypt on config-Crypt.h, download -STSW-STM32062: STM32F2xx standard peripherals library at -http://www.st.com/. Copy Libraries\STM32F2xx_StdPeriph_Driver\{inc,src} to - {PACK}\cyassl\IDE\MDK5-ARM\STM32F2xx_StdPeriph_Lib - - -Support -------- -Please send questions or comments to support@wolfssl.com diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvoptx b/IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvoptx deleted file mode 100644 index d3d972b78..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvoptx +++ /dev/null @@ -1,1366 +0,0 @@ - - - - 1.0 - -
### uVision Project, (C) Keil Software
- - - *.c - *.s*; *.src; *.a* - *.obj - *.lib - *.txt; *.h; *.inc - *.plm - *.cpp - - - - 0 - 0 - - - - CyaSSL-Full - 0x4 - ARM-ADS - - 25000000 - - 1 - 1 - 0 - 1 - - - 1 - 65535 - 0 - 0 - 0 - - - 79 - 66 - 8 - .\Object\ - - - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - 0 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - - - 1 - 0 - 1 - - 255 - - - 0 - Schematics (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf - - - 1 - User Manual (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm - - - 2 - MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) - http://www.keil.com/mcbstm32f200/ - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - 8 - - - - - - - - - - .\STM32_SWO.ini - BIN\ULP2CM3.DLL - - - - 0 - DLGUARM - - - - 0 - DLGTARM - (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) - - - 0 - ARMDBGFLAGS - - - - 0 - ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) - - - 0 - UL2CM3 - UL2CM3(-S0 -C0 -P0 ) -FN1 -FC1000 -FD20000000 -FF0STM32F2xx_1024 -FL0100000 -FS08000000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) - - - - - - 0 - 1 - str[i] - - - 1 - 1 - str - - - - - 1 - 3 - 0x20003d9e - - - - - 2 - 8 - 0x8004dc8 - - - - 0 - - - 0 - 1 - 1 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 2 - 0 - 0 - 0 - 1 - 1 - 0 - 0 - 0 - - - - - - - - Source - 1 - 0 - 0 - 0 - - 1 - 1 - 1 - 0 - 0 - 0 - 0 - .\benchmark.c - benchmark.c - 0 - 0 - - - 1 - 2 - 1 - 0 - 0 - 0 - 0 - .\client.c - client.c - 0 - 0 - - - 1 - 3 - 1 - 0 - 0 - 0 - 0 - .\echoclient.c - echoclient.c - 0 - 0 - - - 1 - 4 - 1 - 0 - 0 - 0 - 0 - .\echoserver.c - echoserver.c - 0 - 0 - - - 1 - 5 - 1 - 0 - 0 - 0 - 0 - .\server.c - server.c - 0 - 0 - - - 1 - 6 - 1 - 0 - 0 - 0 - 0 - .\cert_data.c - cert_data.c - 0 - 0 - - - 1 - 7 - 1 - 0 - 0 - 0 - 0 - .\test.c - test.c - 0 - 0 - - - 1 - 8 - 1 - 0 - 0 - 0 - 0 - .\main.c - main.c - 0 - 0 - - - 1 - 9 - 1 - 0 - 0 - 0 - 0 - .\shell.c - shell.c - 0 - 0 - - - - - Configuration - 1 - 0 - 0 - 0 - - 2 - 10 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 0 - 0 - - - 2 - 11 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 0 - 0 - - - 2 - 12 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\settings.h - settings.h - 0 - 0 - - - 2 - 13 - 5 - 0 - 0 - 0 - 0 - .\RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h - 0 - 0 - - - - - Documentation - 1 - 0 - 0 - 0 - - 3 - 14 - 5 - 0 - 0 - 0 - 0 - .\Abstract.txt - Abstract.txt - 0 - 0 - - - - - Devices - 1 - 0 - 0 - 0 - - 4 - 15 - 1 - 0 - 0 - 0 - 0 - .\time-CortexM3-4.c - time-CortexM3-4.c - 0 - 0 - - - 4 - 16 - 1 - 0 - 0 - 0 - 0 - .\time-dummy.c - time-dummy.c - 0 - 0 - - - - - ::CMSIS - 1 - 0 - 0 - 1 - - 5 - 17 - 1 - 0 - 0 - 0 - 0 - RTE\CMSIS\RTX_Conf_CM.c - RTX_Conf_CM.c - 1 - 0 - - - 5 - 18 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - RTX_CM3.lib - 1 - 0 - - - - - ::Device - 0 - 0 - 0 - 1 - - 6 - 19 - 5 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\RTE_Device.h - RTE_Device.h - 1 - 0 - - - 6 - 20 - 2 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - startup_stm32f2xx.s - 1 - 0 - - - 6 - 21 - 1 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\system_stm32f2xx.c - system_stm32f2xx.c - 1 - 0 - - - 6 - 22 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - DMA_STM32F2xx.c - 1 - 0 - - - 6 - 23 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - GPIO_STM32F2xx.c - 1 - 0 - - - - - ::Drivers - 0 - 0 - 0 - 1 - - 7 - 24 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - EMAC_STM32F2xx.c - 1 - 0 - - - 7 - 25 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - MCI_STM32F2xx.c - 1 - 0 - - - 7 - 26 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - PHY_ST802RT1.c - 1 - 0 - - - - - ::File System - 0 - 0 - 0 - 1 - - 8 - 27 - 1 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config.c - FS_Config.c - 1 - 0 - - - 8 - 28 - 5 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config_MC_0.h - FS_Config_MC_0.h - 1 - 0 - - - 8 - 29 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - FS_LFN_CM3_L.lib - 1 - 0 - - - - - ::Network - 0 - 0 - 0 - 1 - - 9 - 30 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config.c - Net_Config.c - 1 - 0 - - - 9 - 31 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_BSD.h - Net_Config_BSD.h - 1 - 0 - - - 9 - 32 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_DNS_Client.h - Net_Config_DNS_Client.h - 1 - 0 - - - 9 - 33 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h - 1 - 0 - - - 9 - 34 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_TCP.h - Net_Config_TCP.h - 1 - 0 - - - 9 - 35 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_UDP.h - Net_Config_UDP.h - 1 - 0 - - - 9 - 36 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Debug.c - Net_Debug.c - 1 - 0 - - - 9 - 37 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - Net_Dbg_CM3_L.lib - 1 - 0 - - - - - ::wolfSSL - 0 - 0 - 0 - 1 - - 10 - 38 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 1 - 0 - - - 10 - 39 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 1 - 0 - - - 10 - 40 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\settings.h - settings.h - 1 - 0 - - - 10 - 41 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - cyassl_MDK_ARM.c - 1 - 0 - - - 10 - 42 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - aes.c - 1 - 0 - - - 10 - 43 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - arc4.c - 1 - 0 - - - 10 - 44 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - asm.c - 1 - 0 - - - 10 - 45 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - asn.c - 1 - 0 - - - 10 - 46 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - blake2b.c - 1 - 0 - - - 10 - 47 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - camellia.c - 1 - 0 - - - 10 - 48 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - coding.c - 1 - 0 - - - 10 - 49 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - compress.c - 1 - 0 - - - 10 - 50 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - des3.c - 1 - 0 - - - 10 - 51 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - dh.c - 1 - 0 - - - 10 - 52 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - dsa.c - 1 - 0 - - - 10 - 53 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - ecc.c - 1 - 0 - - - 10 - 54 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - ecc_fp.c - 1 - 0 - - - 10 - 55 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - error.c - 1 - 0 - - - 10 - 56 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - hc128.c - 1 - 0 - - - 10 - 57 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - hmac.c - 1 - 0 - - - 10 - 58 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - integer.c - 1 - 0 - - - 10 - 59 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - logging.c - 1 - 0 - - - 10 - 60 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - md2.c - 1 - 0 - - - 10 - 61 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - md4.c - 1 - 0 - - - 10 - 62 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - md5.c - 1 - 0 - - - 10 - 63 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - memory.c - 1 - 0 - - - 10 - 64 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - misc.c - 1 - 0 - - - 10 - 65 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - pwdbased.c - 1 - 0 - - - 10 - 66 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - rabbit.c - 1 - 0 - - - 10 - 67 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - random.c - 1 - 0 - - - 10 - 68 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - ripemd.c - 1 - 0 - - - 10 - 69 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - rsa.c - 1 - 0 - - - 10 - 70 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - sha.c - 1 - 0 - - - 10 - 71 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - sha256.c - 1 - 0 - - - 10 - 72 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - sha512.c - 1 - 0 - - - 10 - 73 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - tfm.c - 1 - 0 - - - 10 - 74 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - wc_port.c - 1 - 0 - - - 10 - 75 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - crl.c - 1 - 0 - - - 10 - 76 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - internal.c - 1 - 0 - - - 10 - 77 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - io.c - 1 - 0 - - - 10 - 78 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - keys.c - 1 - 0 - - - 10 - 79 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - ocsp.c - 1 - 0 - - - 10 - 80 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - sniffer.c - 1 - 0 - - - 10 - 81 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - ssl.c - 1 - 0 - - - 10 - 82 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - tls.c - 1 - 0 - - - -
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvprojx b/IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvprojx deleted file mode 100644 index 285caa687..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvprojx +++ /dev/null @@ -1,1185 +0,0 @@ - - - - 2.1 - -
### uVision Project, (C) Keil Software
- - - - CyaSSL-Full - 0x4 - ARM-ADS - - - STM32F207IG - STMicroelectronics - IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE - - - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) - 0 - $$Device:STM32F207IG$Device\Include\stm32f2xx.h - - - - - - - - - - $$Device:STM32F207IG$SVD\STM32F20x.svd - 0 - 0 - - - - - - - 0 - 0 - 0 - 0 - 1 - - .\Object\ - CyaSSL-Full - 1 - 0 - 0 - 1 - 1 - .\Object\ - 1 - 0 - 0 - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - - 0 - - - - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - SARMCM3.DLL - -REMAP -MPU - DCM.DLL - -pCM3 - SARMCM3.DLL - -REMAP -MPU - TCM.DLL - -pCM3 - - - - 1 - 0 - 0 - 0 - 16 - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - 1 - - 0 - 8 - - - - - - - - - - - - - .\STM32_SWO.ini - BIN\ULP2CM3.DLL - - - - - 1 - 0 - 0 - 1 - 1 - 4100 - - 0 - BIN\ULP2CM3.DLL - "" () - - - - - 0 - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - "Cortex-M3" - - 1 - 0 - 0 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - 8 - 0 - 0 - 0 - 3 - 3 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 1 - 0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x20000 - - - 1 - 0x8000000 - 0x100000 - - - 0 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x8000000 - 0x100000 - - - 1 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x20000 - - - 0 - 0x0 - 0x0 - - - - - - 1 - 4 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - HAVE_CONFIG_H MDK_CONF_CYASSL - - - - - - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - 1 - 0 - 0 - 0 - 1 - 0 - 0x08000000 - 0x20000000 - - - - - - - - - - - - - Source - - - benchmark.c - 1 - .\benchmark.c - - - client.c - 1 - .\client.c - - - echoclient.c - 1 - .\echoclient.c - - - echoserver.c - 1 - .\echoserver.c - - - server.c - 1 - .\server.c - - - cert_data.c - 1 - .\cert_data.c - - - test.c - 1 - .\test.c - - - main.c - 1 - .\main.c - - - shell.c - 1 - .\shell.c - - - - - Configuration - - - config-CyaSSL.h - 5 - .\RTE\wolfSSL\config-CyaSSL.h - - - config-Crypt.h - 5 - .\RTE\wolfSSL\config-Crypt.h - - - settings.h - 5 - .\RTE\wolfSSL\settings.h - - - Net_Config_ETH_0.h - 5 - .\RTE\Network\Net_Config_ETH_0.h - - - - - Documentation - - - Abstract.txt - 5 - .\Abstract.txt - - - - - Devices - - - time-CortexM3-4.c - 1 - .\time-CortexM3-4.c - - - time-dummy.c - 1 - .\time-dummy.c - - - - - ::CMSIS - - - RTX_Conf_CM.c - 1 - RTE\CMSIS\RTX_Conf_CM.c - - - RTX_CM3.lib - 4 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - - - - - ::Device - - - RTE_Device.h - 5 - RTE\Device\STM32F207IG\RTE_Device.h - - - startup_stm32f2xx.s - 2 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - system_stm32f2xx.c - 1 - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - DMA_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - - - GPIO_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - - - - - ::Drivers - - - EMAC_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - - - MCI_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - - - PHY_ST802RT1.c - 1 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - - - - - ::File System - - - FS_Config.c - 1 - RTE\File_System\FS_Config.c - - - FS_Config_MC_0.h - 5 - RTE\File_System\FS_Config_MC_0.h - - - FS_LFN_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - - - - - ::Network - - - Net_Config.c - 1 - RTE\Network\Net_Config.c - - - Net_Config_BSD.h - 5 - RTE\Network\Net_Config_BSD.h - - - Net_Config_DNS_Client.h - 5 - RTE\Network\Net_Config_DNS_Client.h - - - Net_Config_ETH_0.h - 5 - RTE\Network\Net_Config_ETH_0.h - - - Net_Config_TCP.h - 5 - RTE\Network\Net_Config_TCP.h - - - Net_Config_UDP.h - 5 - RTE\Network\Net_Config_UDP.h - - - Net_Debug.c - 1 - RTE\Network\Net_Debug.c - - - Net_Dbg_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - - - - - ::wolfSSL - - - config-Crypt.h - 5 - RTE\wolfSSL\config-Crypt.h - - - config-CyaSSL.h - 5 - RTE\wolfSSL\config-CyaSSL.h - - - settings.h - 5 - RTE\wolfSSL\settings.h - - - cyassl_MDK_ARM.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - - - aes.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - - - arc4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - - - asm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - - - asn.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - - - blake2b.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - - - camellia.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - - - coding.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - - - compress.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - - - des3.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - - - dh.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - - - dsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - - - ecc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - - - ecc_fp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - - - error.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - - - hc128.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - - - hmac.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - - - integer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - - - logging.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - - - md2.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - - - md4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - - - md5.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - - - memory.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - - - misc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - - - pwdbased.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - - - rabbit.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - - - random.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - - - ripemd.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - - - rsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - - - sha.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - - - sha256.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - - - sha512.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - - - tfm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - - - wc_port.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - - - crl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - - - internal.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - - - io.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - - - keys.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - - - ocsp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - - - sniffer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - - - ssl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - - - tls.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RTE\CMSIS\RTX_Conf_CM.c - - - - - - - - RTE\Device\STM32F207IG\RTE_Device.h - - - - - - - - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - - - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - - - - RTE\File_System\FS_Config.c - - - - - - - - RTE\File_System\FS_Config_MC_0.h - - - - - - - - RTE\Network\Net_Config.c - - - - - - - - RTE\Network\Net_Config_BSD.h - - - - - - - - RTE\Network\Net_Config_DNS_Client.h - - - - - - - - RTE\Network\Net_Config_ETH_0.h - - - - - - - - RTE\Network\Net_Config_TCP.h - - - - - - - - RTE\Network\Net_Config_UDP.h - - - - - - - - RTE\Network\Net_Debug.c - - - - - - - - RTE\Other\config-RTX-TCP-FS.h - - - - - - RTE\Other\config.h - - - - - - RTE\wolfSSL\config-Crypt.h - - - - - - - - RTE\wolfSSL\config-CyaSSL.h - - - - - - - - RTE\wolfSSL\config.h - - - - - - RTE\wolfSSL\settings.h - - - - - - - - - -
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/RTE/wolfSSL/settings.h b/IDE/MDK5-ARM/Projects/CyaSSL-Full/RTE/wolfSSL/settings.h deleted file mode 100644 index 86a57a0db..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/RTE/wolfSSL/settings.h +++ /dev/null @@ -1,667 +0,0 @@ -/* settings.h - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -/* Place OS specific preprocessor flags, defines, includes here, will be - included into every file because types.h includes it */ - - -#ifndef CTAO_CRYPT_SETTINGS_H -#define CTAO_CRYPT_SETTINGS_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Uncomment next line if using IPHONE */ -/* #define IPHONE */ - -/* Uncomment next line if using ThreadX */ -/* #define THREADX */ - -/* Uncomment next line if using Micrium ucOS */ -/* #define MICRIUM */ - -/* Uncomment next line if using Mbed */ -/* #define MBED */ - -/* Uncomment next line if using Microchip PIC32 ethernet starter kit */ -/* #define MICROCHIP_PIC32 */ - -/* Uncomment next line if using Microchip TCP/IP stack, version 5 */ -/* #define MICROCHIP_TCPIP_V5 */ - -/* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */ -/* #define MICROCHIP_TCPIP */ - -/* Uncomment next line if using PIC32MZ Crypto Engine */ -/* #define CYASSL_MICROCHIP_PIC32MZ */ - -/* Uncomment next line if using FreeRTOS */ -/* #define FREERTOS */ - -/* Uncomment next line if using FreeRTOS Windows Simulator */ -/* #define FREERTOS_WINSIM */ - -/* Uncomment next line if using RTIP */ -/* #define EBSNET */ - -/* Uncomment next line if using lwip */ -/* #define CYASSL_LWIP */ - -/* Uncomment next line if building CyaSSL for a game console */ -/* #define CYASSL_GAME_BUILD */ - -/* Uncomment next line if building CyaSSL for LSR */ -/* #define CYASSL_LSR */ - -/* Uncomment next line if building CyaSSL for Freescale MQX/RTCS/MFS */ -/* #define FREESCALE_MQX */ - -/* Uncomment next line if using STM32F2 */ -/* #define CYASSL_STM32F2 */ - -/* Uncomment next line if using Comverge settings */ -/* #define COMVERGE */ - -/* Uncomment next line if using QL SEP settings */ -/* #define CYASSL_QL */ - -/* Uncomment next line if using LwIP native TCP socket settings */ -/* #define HAVE_LWIP_NATIVE */ - -/* Uncomment next line if building for EROAD */ -/* #define CYASSL_EROAD */ - -#include - -#ifdef IPHONE - #define SIZEOF_LONG_LONG 8 -#endif - - -#ifdef CYASSL_USER_SETTINGS - #include -#endif - - -#ifdef COMVERGE - #define THREADX - #define HAVE_NETX - #define CYASSL_USER_IO - #define NO_WRITEV - #define NO_DEV_RANDOM - #define NO_FILESYSTEM - #define NO_SHA512 - #define NO_DH - #define NO_DSA - #define NO_HC128 - #define NO_RSA - #define NO_SESSION_CACHE - #define HAVE_ECC -#endif - - -#ifdef THREADX - #define SIZEOF_LONG_LONG 8 -#endif - -#ifdef HAVE_NETX - #include "nx_api.h" -#endif - -#if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */ - #define CYASSL_LWIP - #define NO_WRITEV - #define SINGLE_THREADED - #define CYASSL_USER_IO - #define NO_FILESYSTEM -#endif - -#ifdef MICROCHIP_PIC32 - /* #define CYASSL_MICROCHIP_PIC32MZ */ - #define SIZEOF_LONG_LONG 8 - #define SINGLE_THREADED - #define CYASSL_USER_IO - #define NO_WRITEV - #define NO_DEV_RANDOM - #define NO_FILESYSTEM - #define USE_FAST_MATH - #define TFM_TIMING_RESISTANT -#endif - -#ifdef CYASSL_MICROCHIP_PIC32MZ - #define CYASSL_PIC32MZ_CE - #define CYASSL_PIC32MZ_CRYPT - #define HAVE_AES_ENGINE - #define CYASSL_PIC32MZ_RNG - /* #define CYASSL_PIC32MZ_HASH */ - #define CYASSL_AES_COUNTER - #define HAVE_AESGCM - #define NO_BIG_INT - -#endif - -#ifdef MICROCHIP_TCPIP_V5 - /* include timer functions */ - #include "TCPIP Stack/TCPIP.h" -#endif - -#ifdef MICROCHIP_TCPIP - /* include timer, NTP functions */ - #ifdef MICROCHIP_MPLAB_HARMONY - #include "tcpip/tcpip.h" - #else - #include "system/system_services.h" - #include "tcpip/sntp.h" - #endif -#endif - -#ifdef MBED - #define CYASSL_USER_IO - #define NO_FILESYSTEM - #define NO_CERT - #define USE_CERT_BUFFERS_1024 - #define NO_WRITEV - #define NO_DEV_RANDOM - #define NO_SHA512 - #define NO_DH - #define NO_DSA - #define NO_HC128 - #define HAVE_ECC - #define NO_SESSION_CACHE - #define CYASSL_CMSIS_RTOS -#endif - - -#ifdef CYASSL_EROAD - #define FREESCALE_MQX - #define FREESCALE_MMCAU - #define SINGLE_THREADED - #define NO_STDIO_FILESYSTEM - #define CYASSL_LEANPSK - #define HAVE_NULL_CIPHER - #define NO_OLD_TLS - #define NO_ASN - #define NO_BIG_INT - #define NO_RSA - #define NO_DSA - #define NO_DH - #define NO_CERTS - #define NO_PWDBASED - #define NO_DES3 - #define NO_MD4 - #define NO_RC4 - #define NO_MD5 - #define NO_SESSION_CACHE - #define NO_MAIN_DRIVER -#endif - -#ifdef FREERTOS_WINSIM - #define FREERTOS - #define USE_WINDOWS_API -#endif - - -/* Micrium will use Visual Studio for compilation but not the Win32 API */ -#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \ - && !defined(EBSNET) && !defined(CYASSL_EROAD) - #define USE_WINDOWS_API -#endif - - -#if defined(CYASSL_LEANPSK) && !defined(XMALLOC_USER) - #include - #define XMALLOC(s, h, type) malloc((s)) - #define XFREE(p, h, type) free((p)) - #define XREALLOC(p, n, h, t) realloc((p), (n)) -#endif - -#if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL) - #undef XMALLOC - #define XMALLOC yaXMALLOC - #undef XFREE - #define XFREE yaXFREE - #undef XREALLOC - #define XREALLOC yaXREALLOC -#endif - - -#ifdef FREERTOS - #ifndef NO_WRITEV - #define NO_WRITEV - #endif - #ifndef NO_SHA512 - #define NO_SHA512 - #endif - #ifndef NO_DH - #define NO_DH - #endif - #ifndef NO_DSA - #define NO_DSA - #endif - #ifndef NO_HC128 - #define NO_HC128 - #endif - - #ifndef SINGLE_THREADED - #include "FreeRTOS.h" - #include "semphr.h" - #endif -#endif - -#ifdef EBSNET - #include "rtip.h" - - /* #define DEBUG_CYASSL */ - #define NO_CYASSL_DIR /* tbd */ - - #if (POLLOS) - #define SINGLE_THREADED - #endif - - #if (RTPLATFORM) - #if (!RTP_LITTLE_ENDIAN) - #define BIG_ENDIAN_ORDER - #endif - #else - #if (!KS_LITTLE_ENDIAN) - #define BIG_ENDIAN_ORDER - #endif - #endif - - #if (WINMSP3) - #undef SIZEOF_LONG - #define SIZEOF_LONG_LONG 8 - #else - #sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG - #endif - - #define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC)) - #define XFREE(p, h, type) (rtp_free(p)) - #define XREALLOC(p, n, h, t) realloc((p), (n)) - -#endif /* EBSNET */ - -#ifdef CYASSL_GAME_BUILD - #define SIZEOF_LONG_LONG 8 - #if defined(__PPU) || defined(__XENON) - #define BIG_ENDIAN_ORDER - #endif -#endif - -#ifdef CYASSL_LSR - #define HAVE_WEBSERVER - #define SIZEOF_LONG_LONG 8 - #define CYASSL_LOW_MEMORY - #define NO_WRITEV - #define NO_SHA512 - #define NO_DH - #define NO_DSA - #define NO_HC128 - #define NO_DEV_RANDOM - #define NO_CYASSL_DIR - #define NO_RABBIT - #ifndef NO_FILESYSTEM - #define LSR_FS - #include "inc/hw_types.h" - #include "fs.h" - #endif - #define CYASSL_LWIP - #include /* for tcp errno */ - #define CYASSL_SAFERTOS - #if defined(__IAR_SYSTEMS_ICC__) - /* enum uses enum */ - #pragma diag_suppress=Pa089 - #endif -#endif - -#ifdef CYASSL_SAFERTOS - #ifndef SINGLE_THREADED - #include "SafeRTOS/semphr.h" - #endif - - #include "SafeRTOS/heap.h" - #define XMALLOC(s, h, type) pvPortMalloc((s)) - #define XFREE(p, h, type) vPortFree((p)) - #define XREALLOC(p, n, h, t) pvPortRealloc((p), (n)) -#endif - -#ifdef CYASSL_LOW_MEMORY - #undef RSA_LOW_MEM - #define RSA_LOW_MEM - #undef CYASSL_SMALL_STACK - #define CYASSL_SMALL_STACK - #undef TFM_TIMING_RESISTANT - #define TFM_TIMING_RESISTANT -#endif - -#ifdef FREESCALE_MQX - #define SIZEOF_LONG_LONG 8 - #define NO_WRITEV - #define NO_DEV_RANDOM - #define NO_RABBIT - #define NO_CYASSL_DIR - #define USE_FAST_MATH - #define TFM_TIMING_RESISTANT - #define FREESCALE_K70_RNGA - /* #define FREESCALE_K53_RNGB */ - #include "mqx.h" - #ifndef NO_FILESYSTEM - #include "mfs.h" - #include "fio.h" - #endif - #ifndef SINGLE_THREADED - #include "mutex.h" - #endif - - #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s)) - #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));} - /* Note: MQX has no realloc, using fastmath above */ -#endif - -#ifdef CYASSL_STM32F2 - #define SIZEOF_LONG_LONG 8 - #define NO_DEV_RANDOM - #define NO_CYASSL_DIR - #define NO_RABBIT - #define STM32F2_RNG - #define STM32F2_CRYPTO - #define KEIL_INTRINSICS -#endif - -#ifdef MICRIUM - - #include "stdlib.h" - #include "net_cfg.h" - #include "ssl_cfg.h" - #include "net_secure_os.h" - - #define CYASSL_TYPES - - typedef CPU_INT08U byte; - typedef CPU_INT16U word16; - typedef CPU_INT32U word32; - - #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32) - #define SIZEOF_LONG 4 - #undef SIZEOF_LONG_LONG - #else - #undef SIZEOF_LONG - #define SIZEOF_LONG_LONG 8 - #endif - - #define STRING_USER - - #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr))) - #define XSTRNCPY(pstr_dest, pstr_src, len_max) \ - ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \ - (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max))) - #define XSTRNCMP(pstr_1, pstr_2, len_max) \ - ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \ - (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max))) - #define XSTRSTR(pstr, pstr_srch) \ - ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \ - (CPU_CHAR *)(pstr_srch))) - #define XMEMSET(pmem, data_val, size) \ - ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \ - (CPU_SIZE_T)(size))) - #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \ - (void *)(psrc), (CPU_SIZE_T)(size))) - #define XMEMCMP(pmem_1, pmem_2, size) \ - (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \ - (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES) - #define XMEMMOVE XMEMCPY - -#if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED) - #define MICRIUM_MALLOC - #define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \ - (CPU_SIZE_T)(s), (void *)0)) - #define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \ - (p), (void *)0)) - #define XREALLOC(p, n, h, t) realloc((p), (n)) -#endif - - #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED) - #undef NO_FILESYSTEM - #else - #define NO_FILESYSTEM - #endif - - #if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG) - #define DEBUG_CYASSL - #else - #undef DEBUG_CYASSL - #endif - - #if (SSL_CFG_OPENSSL_EN == DEF_ENABLED) - #define OPENSSL_EXTRA - #else - #undef OPENSSL_EXTRA - #endif - - #if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED) - #undef SINGLE_THREADED - #else - #define SINGLE_THREADED - #endif - - #if (SSL_CFG_DH_EN == DEF_ENABLED) - #undef NO_DH - #else - #define NO_DH - #endif - - #if (SSL_CFG_DSA_EN == DEF_ENABLED) - #undef NO_DSA - #else - #define NO_DSA - #endif - - #if (SSL_CFG_PSK_EN == DEF_ENABLED) - #undef NO_PSK - #else - #define NO_PSK - #endif - - #if (SSL_CFG_3DES_EN == DEF_ENABLED) - #undef NO_DES - #else - #define NO_DES - #endif - - #if (SSL_CFG_AES_EN == DEF_ENABLED) - #undef NO_AES - #else - #define NO_AES - #endif - - #if (SSL_CFG_RC4_EN == DEF_ENABLED) - #undef NO_RC4 - #else - #define NO_RC4 - #endif - - #if (SSL_CFG_RABBIT_EN == DEF_ENABLED) - #undef NO_RABBIT - #else - #define NO_RABBIT - #endif - - #if (SSL_CFG_HC128_EN == DEF_ENABLED) - #undef NO_HC128 - #else - #define NO_HC128 - #endif - - #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG) - #define BIG_ENDIAN_ORDER - #else - #undef BIG_ENDIAN_ORDER - #define LITTLE_ENDIAN_ORDER - #endif - - #if (SSL_CFG_MD4_EN == DEF_ENABLED) - #undef NO_MD4 - #else - #define NO_MD4 - #endif - - #if (SSL_CFG_WRITEV_EN == DEF_ENABLED) - #undef NO_WRITEV - #else - #define NO_WRITEV - #endif - - #if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED) - #define NO_DEV_RANDOM - #else - #undef NO_DEV_RANDOM - #endif - - #if (SSL_CFG_USER_IO_EN == DEF_ENABLED) - #define CYASSL_USER_IO - #else - #undef CYASSL_USER_IO - #endif - - #if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED) - #undef LARGE_STATIC_BUFFERS - #undef STATIC_CHUNKS_ONLY - #else - #define LARGE_STATIC_BUFFERS - #define STATIC_CHUNKS_ONLY - #endif - - #if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED) - #define CYASSL_DER_LOAD - #else - #undef CYASSL_DER_LOAD - #endif - - #if (SSL_CFG_DTLS_EN == DEF_ENABLED) - #define CYASSL_DTLS - #else - #undef CYASSL_DTLS - #endif - - #if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED) - #define CYASSL_CALLBACKS - #else - #undef CYASSL_CALLBACKS - #endif - - #if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED) - #define USE_FAST_MATH - #else - #undef USE_FAST_MATH - #endif - - #if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED) - #define TFM_TIMING_RESISTANT - #else - #undef TFM_TIMING_RESISTANT - #endif - -#endif /* MICRIUM */ - - -#ifdef CYASSL_QL - #ifndef CYASSL_SEP - #define CYASSL_SEP - #endif - #ifndef OPENSSL_EXTRA - #define OPENSSL_EXTRA - #endif - #ifndef SESSION_CERTS - #define SESSION_CERTS - #endif - #ifndef HAVE_AESCCM - #define HAVE_AESCCM - #endif - #ifndef ATOMIC_USER - #define ATOMIC_USER - #endif - #ifndef CYASSL_DER_LOAD - #define CYASSL_DER_LOAD - #endif - #ifndef KEEP_PEER_CERT - #define KEEP_PEER_CERT - #endif - #ifndef HAVE_ECC - #define HAVE_ECC - #endif - #ifndef SESSION_INDEX - #define SESSION_INDEX - #endif -#endif /* CYASSL_QL */ - - -#if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \ - !defined(CYASSL_LEANPSK) && !defined(NO_CYASSL_MEMORY) - #define USE_CYASSL_MEMORY -#endif - - -#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) - #undef KEEP_PEER_CERT - #define KEEP_PEER_CERT -#endif - - -/* stream ciphers except arc4 need 32bit alignment, intel ok without */ -#ifndef XSTREAM_ALIGNMENT - #if defined(__x86_64__) || defined(__ia64__) || defined(__i386__) - #define NO_XSTREAM_ALIGNMENT - #else - #define XSTREAM_ALIGNMENT - #endif -#endif - - -/* if using hardware crypto and have alignment requirements, specify the - requirement here. The record header of SSL/TLS will prvent easy alignment. - This hint tries to help as much as possible. */ -#ifndef CYASSL_GENERAL_ALIGNMENT - #ifdef CYASSL_AESNI - #define CYASSL_GENERAL_ALIGNMENT 16 - #elif defined(XSTREAM_ALIGNMENT) - #define CYASSL_GENERAL_ALIGNMENT 4 - #else - #define CYASSL_GENERAL_ALIGNMENT 0 - #endif -#endif - -#ifdef HAVE_CRL - /* not widely supported yet */ - #undef NO_SKID - #define NO_SKID -#endif - -/* Place any other flags or defines here */ - - -#ifdef __cplusplus - } /* extern "C" */ -#endif - - -#endif /* CTAO_CRYPT_SETTINGS_H */ - diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/benchmark.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/benchmark.c deleted file mode 100644 index faf6b7793..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/benchmark.c +++ /dev/null @@ -1,1222 +0,0 @@ -/* benchmark.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 - */ - -/* CTaoCrypt benchmark */ - -#ifdef HAVE_CONFIG_H - #include -#endif - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#ifdef HAVE_CAVIUM - #include "cavium_sysdep.h" - #include "cavium_common.h" - #include "cavium_ioctl.h" -#endif - -#if defined(CYASSL_MDK_ARM) - extern FILE * CyaSSL_fopen(const char *fname, const char *mode) ; - #define fopen CyaSSL_fopen -#endif - -#if defined(USE_CERT_BUFFERS_1024) || defined(USE_CERT_BUFFERS_2048) - /* include test cert and key buffers for use with NO_FILESYSTEM */ - #if defined(CYASSL_MDK_ARM) - #include "cert_data.h" /* use certs_test.c for initial data, - so other commands can share the data. */ - #else - #include - #endif -#endif - - -#ifdef HAVE_BLAKE2 - #include - void bench_blake2(void); -#endif - -#ifdef _MSC_VER - /* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */ - #pragma warning(disable: 4996) -#endif - -void bench_des(void); -void bench_arc4(void); -void bench_hc128(void); -void bench_rabbit(void); -void bench_aes(int); -void bench_aesgcm(void); -void bench_aesccm(void); -void bench_aesctr(void); -void bench_camellia(void); - -void bench_md5(void); -void bench_sha(void); -void bench_sha256(void); -void bench_sha512(void); -void bench_ripemd(void); - -void bench_rsa(void); -void bench_rsaKeyGen(void); -void bench_dh(void); -#ifdef HAVE_ECC -void bench_eccKeyGen(void); -void bench_eccKeyAgree(void); -#endif - -double current_time(int); - - -#ifdef HAVE_CAVIUM - -static int OpenNitroxDevice(int dma_mode,int dev_id) -{ - Csp1CoreAssignment core_assign; - Uint32 device; - - if (CspInitialize(CAVIUM_DIRECT,CAVIUM_DEV_ID)) - return -1; - if (Csp1GetDevType(&device)) - return -1; - if (device != NPX_DEVICE) { - if (ioctl(gpkpdev_hdlr[CAVIUM_DEV_ID], IOCTL_CSP1_GET_CORE_ASSIGNMENT, - (Uint32 *)&core_assign)!= 0) - return -1; - } - CspShutdown(CAVIUM_DEV_ID); - - return CspInitialize(dma_mode, dev_id); -} - -#endif - - -/* so embedded projects can pull in tests on their own */ -#if !defined(NO_MAIN_DRIVER) - -int main(int argc, char** argv) - -{ - (void)argc; - (void)argv; -#else -int benchmark_test(void *args) -{ -#endif - - #ifdef HAVE_CAVIUM - int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); - if (ret != 0) { - printf("Cavium OpenNitroxDevice failed\n"); - exit(-1); - } -#endif /* HAVE_CAVIUM */ -#ifndef NO_AES - bench_aes(0); - bench_aes(1); -#endif -#ifdef HAVE_AESGCM - bench_aesgcm(); -#endif - -#ifdef CYASSL_AES_COUNTER - bench_aesctr(); -#endif - -#ifdef HAVE_AESCCM - bench_aesccm(); -#endif -#ifdef HAVE_CAMELLIA - bench_camellia(); -#endif -#ifndef NO_RC4 - bench_arc4(); -#endif -#ifdef HAVE_HC128 - bench_hc128(); -#endif -#ifndef NO_RABBIT - bench_rabbit(); -#endif -#ifndef NO_DES3 - bench_des(); -#endif - - printf("\n"); - -#ifndef NO_MD5 - bench_md5(); -#endif -#ifndef NO_SHA - bench_sha(); -#endif -#ifndef NO_SHA256 - bench_sha256(); -#endif -#ifdef CYASSL_SHA512 - bench_sha512(); -#endif -#ifdef CYASSL_RIPEMD - bench_ripemd(); -#endif -#ifdef HAVE_BLAKE2 - bench_blake2(); -#endif - - printf("\n"); - -#ifndef NO_RSA - bench_rsa(); -#endif - -#ifndef NO_DH - bench_dh(); -#endif - -#if defined(CYASSL_KEY_GEN) && !defined(NO_RSA) - bench_rsaKeyGen(); -#endif - -#ifdef HAVE_ECC - bench_eccKeyGen(); - bench_eccKeyAgree(); -#endif - - return 0; -} - - -#ifdef BENCH_EMBEDDED -enum BenchmarkBounds { - numBlocks = 25, /* how many kB to test (en/de)cryption */ - ntimes = 1, - genTimes = 5, /* public key iterations */ - agreeTimes = 5 -}; -static const char blockType[] = "kB"; /* used in printf output */ -#else -enum BenchmarkBounds { - numBlocks = 5, /* how many megs to test (en/de)cryption */ - ntimes = 100, - genTimes = 100, - agreeTimes = 100 -}; -static const char blockType[] = "megs"; /* used in printf output */ -#endif - -static const byte key[] = -{ - 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef, - 0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10, - 0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 -}; - -static const byte iv[] = -{ - 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef, - 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, - 0x11,0x21,0x31,0x41,0x51,0x61,0x71,0x81 - -}; - - -/* use kB instead of mB for embedded benchmarking */ -#ifdef BENCH_EMBEDDED -static byte plain [1024]; -static byte cipher[1024]; -#else -static byte plain [1024*1024]; -static byte cipher[1024*1024]; -#endif - - -#ifndef NO_AES -void bench_aes(int show) -{ - Aes enc; - double start, total, persec; - int i; - int ret; - -#ifdef HAVE_CAVIUM - if (AesInitCavium(&enc, CAVIUM_DEV_ID) != 0) { - printf("aes init cavium failed\n"); - return; - } -#endif - - ret = AesSetKey(&enc, key, 16, iv, AES_ENCRYPTION); - if (ret != 0) { - printf("AesSetKey failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - AesCbcEncrypt(&enc, plain, cipher, sizeof(plain)); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - if (show) - printf("AES %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -#ifdef HAVE_CAVIUM - AesFreeCavium(&enc); -#endif -} -#endif - - -#if defined(HAVE_AESGCM) || defined(HAVE_AESCCM) - static byte additional[13]; - static byte tag[16]; -#endif - - -#ifdef HAVE_AESGCM -void bench_aesgcm(void) -{ - Aes enc; - double start, total, persec; - int i; - - AesGcmSetKey(&enc, key, 16); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - AesGcmEncrypt(&enc, cipher, plain, sizeof(plain), iv, 12, - tag, 16, additional, 13); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("AES-GCM %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - -#ifdef CYASSL_AES_COUNTER -void bench_aesctr(void) -{ - Aes enc; - double start, total, persec; - int i; - - AesSetKeyDirect(&enc, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - AesCtrEncrypt(&enc, plain, cipher, sizeof(plain)); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("AES-CTR %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - - -#ifdef HAVE_AESCCM -void bench_aesccm(void) -{ - Aes enc; - double start, total, persec; - int i; - - AesCcmSetKey(&enc, key, 16); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - AesCcmEncrypt(&enc, cipher, plain, sizeof(plain), iv, 12, - tag, 16, additional, 13); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("AES-CCM %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - -#ifdef HAVE_CAMELLIA -void bench_camellia(void) -{ - Camellia cam; - double start, total, persec; - int i, ret; - - ret = CamelliaSetKey(&cam, key, 16, iv); - if (ret != 0) { - printf("CamelliaSetKey failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - CamelliaCbcEncrypt(&cam, plain, cipher, sizeof(plain)); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("Camellia %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - -#ifndef NO_DES3 -void bench_des(void) -{ - Des3 enc; - double start, total, persec; - int i, ret; - -#ifdef HAVE_CAVIUM - if (Des3_InitCavium(&enc, CAVIUM_DEV_ID) != 0) - printf("des3 init cavium failed\n"); -#endif - ret = Des3_SetKey(&enc, key, iv, DES_ENCRYPTION); - if (ret != 0) { - printf("Des3_SetKey failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - Des3_CbcEncrypt(&enc, plain, cipher, sizeof(plain)); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("3DES %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -#ifdef HAVE_CAVIUM - Des3_FreeCavium(&enc); -#endif -} -#endif - - -#ifndef NO_RC4 -void bench_arc4(void) -{ - Arc4 enc; - double start, total, persec; - int i; - -#ifdef HAVE_CAVIUM - if (Arc4InitCavium(&enc, CAVIUM_DEV_ID) != 0) - printf("arc4 init cavium failed\n"); -#endif - - Arc4SetKey(&enc, key, 16); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - Arc4Process(&enc, cipher, plain, sizeof(plain)); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("ARC4 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -#ifdef HAVE_CAVIUM - Arc4FreeCavium(&enc); -#endif -} -#endif - - -#ifdef HAVE_HC128 -void bench_hc128(void) -{ - HC128 enc; - double start, total, persec; - int i; - - Hc128_SetKey(&enc, key, iv); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - Hc128_Process(&enc, cipher, plain, sizeof(plain)); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("HC128 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif /* HAVE_HC128 */ - - -#ifndef NO_RABBIT -void bench_rabbit(void) -{ - Rabbit enc; - double start, total, persec; - int i; - - RabbitSetKey(&enc, key, iv); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - RabbitProcess(&enc, cipher, plain, sizeof(plain)); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("RABBIT %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif /* NO_RABBIT */ - - -#ifndef NO_MD5 -void bench_md5(void) -{ - Md5 hash; - byte digest[MD5_DIGEST_SIZE]; - double start, total, persec; - int i; - - InitMd5(&hash); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - Md5Update(&hash, plain, sizeof(plain)); - - Md5Final(&hash, digest); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("MD5 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif /* NO_MD5 */ - - -#ifndef NO_SHA -void bench_sha(void) -{ - Sha hash; - byte digest[SHA_DIGEST_SIZE]; - double start, total, persec; - int i, ret; - - ret = InitSha(&hash); - if (ret != 0) { - printf("InitSha failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - ShaUpdate(&hash, plain, sizeof(plain)); - - ShaFinal(&hash, digest); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("SHA %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif /* NO_SHA */ - - -#ifndef NO_SHA256 -void bench_sha256(void) -{ - Sha256 hash; - byte digest[SHA256_DIGEST_SIZE]; - double start, total, persec; - int i, ret; - - ret = InitSha256(&hash); - if (ret != 0) { - printf("InitSha256 failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) { - ret = Sha256Update(&hash, plain, sizeof(plain)); - if (ret != 0) { - printf("Sha256Update failed, ret = %d\n", ret); - return; - } - } - - ret = Sha256Final(&hash, digest); - if (ret != 0) { - printf("Sha256Final failed, ret = %d\n", ret); - return; - } - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("SHA-256 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - -#ifdef CYASSL_SHA512 -void bench_sha512(void) -{ - Sha512 hash; - byte digest[SHA512_DIGEST_SIZE]; - double start, total, persec; - int i, ret; - - ret = InitSha512(&hash); - if (ret != 0) { - printf("InitSha512 failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) { - ret = Sha512Update(&hash, plain, sizeof(plain)); - if (ret != 0) { - printf("Sha512Update failed, ret = %d\n", ret); - return; - } - } - - ret = Sha512Final(&hash, digest); - if (ret != 0) { - printf("Sha512Final failed, ret = %d\n", ret); - return; - } - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("SHA-512 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - -#ifdef CYASSL_RIPEMD -void bench_ripemd(void) -{ - RipeMd hash; - byte digest[RIPEMD_DIGEST_SIZE]; - double start, total, persec; - int i; - - InitRipeMd(&hash); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - RipeMdUpdate(&hash, plain, sizeof(plain)); - - RipeMdFinal(&hash, digest); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("RIPEMD %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - -#ifdef HAVE_BLAKE2 -void bench_blake2(void) -{ - Blake2b b2b; - byte digest[64]; - double start, total, persec; - int i, ret; - - ret = InitBlake2b(&b2b, 64); - if (ret != 0) { - printf("InitBlake2b failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) { - ret = Blake2bUpdate(&b2b, plain, sizeof(plain)); - if (ret != 0) { - printf("Blake2bUpdate failed, ret = %d\n", ret); - return; - } - } - - ret = Blake2bFinal(&b2b, digest, 64); - if (ret != 0) { - printf("Blake2bFinal failed, ret = %d\n", ret); - return; - } - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("BLAKE2b %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - -#if !defined(NO_RSA) || !defined(NO_DH) \ - || defined(CYASSL_KEYGEN) || defined(HAVE_ECC) -static WC_RNG rng; -#endif - -#ifndef NO_RSA - - -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) && \ - defined(CYASSL_MDK_SHELL) -static char *certRSAname = "certs/rsa2048.der" ; -static void set_Bench_RSA_File(char * cert) { certRSAname = cert ; } - /* set by shell command */ -#elif defined(CYASSL_MDK_SHELL) - /* nothing */ -#else -static const char *certRSAname = "certs/rsa2048.der" ; -#endif - -void bench_rsa(void) -{ - int i; - int ret; - byte tmp[3072]; - size_t bytes; - word32 idx = 0; - - byte message[] = "Everyone gets Friday off."; - byte enc[512]; /* for up to 4096 bit */ - const int len = (int)strlen((char*)message); - double start, total, each, milliEach; - - RsaKey rsaKey; - int rsaKeySz = 2048; /* used in printf */ - -#ifdef USE_CERT_BUFFERS_1024 - XMEMCPY(tmp, rsa_key_der_1024, sizeof_rsa_key_der_1024); - bytes = sizeof_rsa_key_der_1024; - rsaKeySz = 1024; -#elif defined(USE_CERT_BUFFERS_2048) - XMEMCPY(tmp, rsa_key_der_2048, sizeof_rsa_key_der_2048); - bytes = sizeof_rsa_key_der_2048; -#else - FILE* file = fopen(certRSAname, "rb"); - - if (!file) { - printf("can't find %s, Please run from CyaSSL home dir\n", certRSAname); - return; - } - - bytes = fread(tmp, 1, sizeof(tmp), file); - fclose(file); -#endif /* USE_CERT_BUFFERS */ - - -#ifdef HAVE_CAVIUM - if (RsaInitCavium(&rsaKey, CAVIUM_DEV_ID) != 0) - printf("RSA init cavium failed\n"); -#endif - ret = InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } - ret = InitRsaKey(&rsaKey, 0); - if (ret < 0) { - printf("InitRsaKey failed\n"); - return; - } - ret = RsaPrivateKeyDecode(tmp, &idx, &rsaKey, (word32)bytes); - - start = current_time(1); - - for (i = 0; i < ntimes; i++) - ret = RsaPublicEncrypt(message,len,enc,sizeof(enc), &rsaKey, &rng); - - total = current_time(0) - start; - each = total / ntimes; /* per second */ - milliEach = each * 1000; /* milliseconds */ - - printf("RSA %d encryption took %6.3f milliseconds, avg over %d" - " iterations\n", rsaKeySz, milliEach, ntimes); - - if (ret < 0) { - printf("Rsa Public Encrypt failed\n"); - return; - } - - start = current_time(1); - - for (i = 0; i < ntimes; i++) { - byte out[512]; /* for up to 4096 bit */ - RsaPrivateDecrypt(enc, (word32)ret, out, sizeof(out), &rsaKey); - } - - total = current_time(0) - start; - each = total / ntimes; /* per second */ - milliEach = each * 1000; /* milliseconds */ - - printf("RSA %d decryption took %6.3f milliseconds, avg over %d" - " iterations\n", rsaKeySz, milliEach, ntimes); - - FreeRsaKey(&rsaKey); -#ifdef HAVE_CAVIUM - RsaFreeCavium(&rsaKey); -#endif -} -#endif - - -#ifndef NO_DH - - -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) && \ - defined(CYASSL_MDK_SHELL) -static char *certDHname = "certs/dh2048.der" ; -void set_Bench_DH_File(char * cert) { certDHname = cert ; } - /* set by shell command */ -#elif defined(CYASSL_MDK_SHELL) - /* nothing */ -#else -static const char *certDHname = "certs/dh2048.der" ; -#endif - -void bench_dh(void) -{ - int i, ret; - byte tmp[1024]; - size_t bytes; - word32 idx = 0, pubSz, privSz = 0, pubSz2, privSz2, agreeSz; - - byte pub[256]; /* for 2048 bit */ - byte priv[256]; /* for 2048 bit */ - byte pub2[256]; /* for 2048 bit */ - byte priv2[256]; /* for 2048 bit */ - byte agree[256]; /* for 2048 bit */ - - double start, total, each, milliEach; - DhKey dhKey; - int dhKeySz = 2048; /* used in printf */ - - -#ifdef USE_CERT_BUFFERS_1024 - XMEMCPY(tmp, dh_key_der_1024, sizeof_dh_key_der_1024); - bytes = sizeof_dh_key_der_1024; - dhKeySz = 1024; -#elif defined(USE_CERT_BUFFERS_2048) - XMEMCPY(tmp, dh_key_der_2048, sizeof_dh_key_der_2048); - bytes = sizeof_dh_key_der_2048; -#else - FILE* file = fopen(certDHname, "rb"); - - if (!file) { - printf("can't find %s, Please run from CyaSSL home dir\n", certDHname); - return; - } - - ret = InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } - bytes = fread(tmp, 1, sizeof(tmp), file); -#endif /* USE_CERT_BUFFERS */ - - - InitDhKey(&dhKey); - bytes = DhKeyDecode(tmp, &idx, &dhKey, (word32)bytes); - if (bytes != 0) { - printf("dhekydecode failed, can't benchmark\n"); - #if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) - fclose(file); - #endif - return; - } - - start = current_time(1); - - for (i = 0; i < ntimes; i++) - DhGenerateKeyPair(&dhKey, &rng, priv, &privSz, pub, &pubSz); - - total = current_time(0) - start; - each = total / ntimes; /* per second */ - milliEach = each * 1000; /* milliseconds */ - - printf("DH %d key generation %6.3f milliseconds, avg over %d" - " iterations\n", dhKeySz, milliEach, ntimes); - - DhGenerateKeyPair(&dhKey, &rng, priv2, &privSz2, pub2, &pubSz2); - start = current_time(1); - - for (i = 0; i < ntimes; i++) - DhAgree(&dhKey, agree, &agreeSz, priv, privSz, pub2, pubSz2); - - total = current_time(0) - start; - each = total / ntimes; /* per second */ - milliEach = each * 1000; /* milliseconds */ - - printf("DH %d key agreement %6.3f milliseconds, avg over %d" - " iterations\n", dhKeySz, milliEach, ntimes); - -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) - fclose(file); -#endif - FreeDhKey(&dhKey); -} -#endif - -#if defined(CYASSL_KEY_GEN) && !defined(NO_RSA) -void bench_rsaKeyGen(void) -{ - RsaKey genKey; - double start, total, each, milliEach; - int i; - - /* 1024 bit */ - start = current_time(1); - - for(i = 0; i < genTimes; i++) { - InitRsaKey(&genKey, 0); - MakeRsaKey(&genKey, 1024, 65537, &rng); - FreeRsaKey(&genKey); - } - - total = current_time(0) - start; - each = total / genTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("\n"); - printf("RSA 1024 key generation %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, genTimes); - - /* 2048 bit */ - start = current_time(1); - - for(i = 0; i < genTimes; i++) { - InitRsaKey(&genKey, 0); - MakeRsaKey(&genKey, 2048, 65537, &rng); - FreeRsaKey(&genKey); - } - - total = current_time(0) - start; - each = total / genTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("RSA 2048 key generation %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, genTimes); -} -#endif /* CYASSL_KEY_GEN */ - -#ifdef HAVE_ECC -void bench_eccKeyGen(void) -{ - ecc_key genKey; - double start, total, each, milliEach; - int i, ret; - - ret = InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } - /* 256 bit */ - start = current_time(1); - - for(i = 0; i < genTimes; i++) { - ecc_make_key(&rng, 32, &genKey); - ecc_free(&genKey); - } - - total = current_time(0) - start; - each = total / genTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("\n"); - printf("ECC 256 key generation %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, genTimes); -} - - -void bench_eccKeyAgree(void) -{ - ecc_key genKey, genKey2; - double start, total, each, milliEach; - int i, ret; - byte shared[1024]; - byte sig[1024]; - byte digest[32]; - word32 x = 0; - - ecc_init(&genKey); - ecc_init(&genKey2); - - ret = InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } - - ret = ecc_make_key(&rng, 32, &genKey); - if (ret != 0) { - printf("ecc_make_key failed\n"); - return; - } - ret = ecc_make_key(&rng, 32, &genKey2); - if (ret != 0) { - printf("ecc_make_key failed\n"); - return; - } - - /* 256 bit */ - start = current_time(1); - - for(i = 0; i < agreeTimes; i++) { - x = sizeof(shared); - ret = ecc_shared_secret(&genKey, &genKey2, shared, &x); - if (ret != 0) { - printf("ecc_shared_secret failed\n"); - return; - } - } - - total = current_time(0) - start; - each = total / agreeTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("EC-DHE key agreement %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, agreeTimes); - - /* make dummy digest */ - for (i = 0; i < (int)sizeof(digest); i++) - digest[i] = (byte)i; - - - start = current_time(1); - - for(i = 0; i < agreeTimes; i++) { - x = sizeof(sig); - ret = ecc_sign_hash(digest, sizeof(digest), sig, &x, &rng, &genKey); - if (ret != 0) { - printf("ecc_sign_hash failed\n"); - return; - } - } - - total = current_time(0) - start; - each = total / agreeTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("EC-DSA sign time %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, agreeTimes); - - start = current_time(1); - - for(i = 0; i < agreeTimes; i++) { - int verify = 0; - ret = ecc_verify_hash(sig, x, digest, sizeof(digest), &verify, &genKey); - if (ret != 0) { - printf("ecc_verify_hash failed\n"); - return; - } - } - - total = current_time(0) - start; - each = total / agreeTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("EC-DSA verify time %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, agreeTimes); - - ecc_free(&genKey2); - ecc_free(&genKey); -} -#endif /* HAVE_ECC */ - - -#ifdef _WIN32 - - #define WIN32_LEAN_AND_MEAN - #include - - double current_time(int reset) - { - static int init = 0; - static LARGE_INTEGER freq; - - LARGE_INTEGER count; - - (void)reset; - - if (!init) { - QueryPerformanceFrequency(&freq); - init = 1; - } - - QueryPerformanceCounter(&count); - - return (double)count.QuadPart / freq.QuadPart; - } - -#elif defined MICROCHIP_PIC32 - #if defined(CYASSL_MICROCHIP_PIC32MZ) - #define CLOCK 8000000.0 - #else - #include - #define CLOCK 4000000.0 - #endif - - double current_time(int reset) - { - unsigned int ns; - - if (reset) { - WriteCoreTimer(0); - } - - /* get timer in ns */ - ns = ReadCoreTimer(); - - /* return seconds as a double */ - return ( ns / CLOCK * 2.0); - } - -#elif defined CYASSL_MDK_ARM - - extern double current_time(int reset) ; - -#elif defined FREERTOS - - double current_time(int reset) - { - (void) reset; - - portTickType tickCount; - - /* tick count == ms, if configTICK_RATE_HZ is set to 1000 */ - tickCount = xTaskGetTickCount(); - return (double)tickCount / 1000; - } - -#else - - #include - - double current_time(int reset) - { - struct timeval tv; - - (void)reset; - - gettimeofday(&tv, 0); - - return (double)tv.tv_sec + (double)tv.tv_usec / 1000000; - } - -#endif /* _WIN32 */ diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/client.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/client.c deleted file mode 100644 index bc898cb59..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/client.c +++ /dev/null @@ -1,858 +0,0 @@ -/* client.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 -#endif - #define CYASSL_MDK_ARM -#if defined(CYASSL_MDK_ARM) - #include - #include - - #if defined(CYASSL_MDK5) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #endif - - #include "cyassl_MDK_ARM.h" -#endif - -#include - -#if !defined(CYASSL_TRACK_MEMORY) && !defined(NO_MAIN_DRIVER) - /* in case memory tracker wants stats */ - #define CYASSL_TRACK_MEMORY -#endif - -#include -#include -#include "examples/client/client.h" - - -#ifdef CYASSL_CALLBACKS - int handShakeCB(HandShakeInfo*); - int timeoutCB(TimeoutInfo*); - Timeval timeout; -#endif - - -static void NonBlockingSSL_Connect(CYASSL* ssl) -{ -#ifndef CYASSL_CALLBACKS - int ret = CyaSSL_connect(ssl); -#else - int ret = CyaSSL_connect_ex(ssl, handShakeCB, timeoutCB, timeout); -#endif - int error = CyaSSL_get_error(ssl, 0); - SOCKET_T sockfd = (SOCKET_T)CyaSSL_get_fd(ssl); - int select_ret; - - while (ret != SSL_SUCCESS && (error == SSL_ERROR_WANT_READ || - error == SSL_ERROR_WANT_WRITE)) { - int currTimeout = 1; - - if (error == SSL_ERROR_WANT_READ) - printf("... client would read block\n"); - else - printf("... client would write block\n"); - -#ifdef CYASSL_DTLS - currTimeout = CyaSSL_dtls_get_current_timeout(ssl); -#endif - select_ret = tcp_select(sockfd, currTimeout); - - if ((select_ret == TEST_RECV_READY) || - (select_ret == TEST_ERROR_READY)) { - #ifndef CYASSL_CALLBACKS - ret = CyaSSL_connect(ssl); - #else - ret = CyaSSL_connect_ex(ssl,handShakeCB,timeoutCB,timeout); - #endif - error = CyaSSL_get_error(ssl, 0); - } - else if (select_ret == TEST_TIMEOUT && !CyaSSL_dtls(ssl)) { - error = SSL_ERROR_WANT_READ; - } -#ifdef CYASSL_DTLS - else if (select_ret == TEST_TIMEOUT && CyaSSL_dtls(ssl) && - CyaSSL_dtls_got_timeout(ssl) >= 0) { - error = SSL_ERROR_WANT_READ; - } -#endif - else { - error = SSL_FATAL_ERROR; - } - } - if (ret != SSL_SUCCESS) - err_sys("SSL_connect failed"); -} - - -static void Usage(void) -{ - printf("client " LIBCYASSL_VERSION_STRING - " NOTE: All files relative to CyaSSL home dir\n"); - printf("-? Help, print this usage\n"); - printf("-h Host to connect to, default %s\n", yasslIP); - printf("-p Port to connect on, not 0, default %d\n", yasslPort); - printf("-v SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n", - CLIENT_DEFAULT_VERSION); - printf("-l Cipher list\n"); - printf("-c Certificate file, default %s\n", cliCert); - printf("-k Key file, default %s\n", cliKey); - printf("-A Certificate Authority file, default %s\n", caCert); - printf("-b Benchmark connections and print stats\n"); - printf("-s Use pre Shared keys\n"); - printf("-t Track CyaSSL memory use\n"); - printf("-d Disable peer checks\n"); - printf("-g Send server HTTP GET\n"); - printf("-u Use UDP DTLS," - " add -v 2 for DTLSv1 (default), -v 3 for DTLSv1.2\n"); - printf("-m Match domain name in cert\n"); - printf("-N Use Non-blocking sockets\n"); - printf("-r Resume session\n"); - printf("-f Fewer packets/group messages\n"); - printf("-x Disable client cert/key loading\n"); -#ifdef SHOW_SIZES - printf("-z Print structure sizes\n"); -#endif -#ifdef HAVE_SNI - printf("-S Use Host Name Indication\n"); -#endif -#ifdef HAVE_MAX_FRAGMENT - printf("-L Use Maximum Fragment Length [1-5]\n"); -#endif -#ifdef HAVE_TRUNCATED_HMAC - printf("-T Use Truncated HMAC\n"); -#endif -#ifdef HAVE_OCSP - printf("-o Perform OCSP lookup on peer certificate\n"); - printf("-O Perform OCSP lookup using as responder\n"); -#endif -#ifdef ATOMIC_USER - printf("-U Atomic User Record Layer Callbacks\n"); -#endif -#ifdef HAVE_PK_CALLBACKS - printf("-P Public Key Callbacks\n"); -#endif -} - - -#ifdef CYASSL_MDK_SHELL - #define exit(code) return(code) -#endif - - -THREAD_RETURN CYASSL_THREAD client_test(void* args) -{ - SOCKET_T sockfd = 0; - - CYASSL_METHOD* method = 0; - CYASSL_CTX* ctx = 0; - CYASSL* ssl = 0; - - CYASSL* sslResume = 0; - CYASSL_SESSION* session = 0; - char resumeMsg[] = "resuming cyassl!"; - int resumeSz = sizeof(resumeMsg); - - char msg[32] = "hello cyassl!"; /* GET may make bigger */ - char reply[80]; - int input; - int msgSz = (int)strlen(msg); - - word16 port = yasslPort; - char* host = (char*)yasslIP; - char* domain = (char*)"www.yassl.com"; - - int ch; - int version = CLIENT_INVALID_VERSION; - int usePsk = 0; - int sendGET = 0; - int benchmark = 0; - int doDTLS = 0; - int matchName = 0; - int doPeerCheck = 1; - int nonBlocking = 0; - int resumeSession = 0; - int trackMemory = 0; - int useClientCert = 1; - int fewerPackets = 0; - int atomicUser = 0; - int pkCallbacks = 0; - char* cipherList = NULL; - char* verifyCert = (char*)caCert; - char* ourCert = (char*)cliCert; - char* ourKey = (char*)cliKey; - -#ifdef HAVE_SNI - char* sniHostName = NULL; -#endif -#ifdef HAVE_MAX_FRAGMENT - byte maxFragment = 0; -#endif -#ifdef HAVE_TRUNCATED_HMAC - byte truncatedHMAC = 0; -#endif - - -#ifdef HAVE_OCSP - int useOcsp = 0; - char* ocspUrl = NULL; -#endif - - int argc = ((func_args*)args)->argc; - char** argv = ((func_args*)args)->argv; - - ((func_args*)args)->return_code = -1; /* error state */ - -#ifdef NO_RSA - verifyCert = (char*)eccCert; - ourCert = (char*)cliEccCert; - ourKey = (char*)cliEccKey; -#endif - (void)resumeSz; - (void)session; - (void)sslResume; - (void)trackMemory; - (void)atomicUser; - (void)pkCallbacks; - - StackTrap(); - - while ((ch = mygetopt(argc, argv, - "?gdusmNrtfxUPh:p:v:l:A:c:k:b:zS:L:ToO:")) != -1) { - switch (ch) { - case '?' : - Usage(); - exit(EXIT_SUCCESS); - - case 'g' : - sendGET = 1; - break; - - case 'd' : - doPeerCheck = 0; - break; - - case 'u' : - doDTLS = 1; - break; - - case 's' : - usePsk = 1; - break; - - case 't' : - #ifdef USE_CYASSL_MEMORY - trackMemory = 1; - #endif - break; - - case 'm' : - matchName = 1; - break; - - case 'x' : - useClientCert = 0; - break; - - case 'f' : - fewerPackets = 1; - break; - - case 'U' : - #ifdef ATOMIC_USER - atomicUser = 1; - #endif - break; - - case 'P' : - #ifdef HAVE_PK_CALLBACKS - pkCallbacks = 1; - #endif - break; - - case 'h' : - host = myoptarg; - domain = myoptarg; - break; - - case 'p' : - port = (word16)atoi(myoptarg); - #if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API) - if (port == 0) - err_sys("port number cannot be 0"); - #endif - break; - - case 'v' : - version = atoi(myoptarg); - if (version < 0 || version > 3) { - Usage(); - exit(MY_EX_USAGE); - } - break; - - case 'l' : - cipherList = myoptarg; - break; - - case 'A' : - verifyCert = myoptarg; - break; - - case 'c' : - ourCert = myoptarg; - break; - - case 'k' : - ourKey = myoptarg; - break; - - case 'b' : - benchmark = atoi(myoptarg); - if (benchmark < 0 || benchmark > 1000000) { - Usage(); - exit(MY_EX_USAGE); - } - break; - - case 'N' : - nonBlocking = 1; - break; - - case 'r' : - resumeSession = 1; - break; - - case 'z' : - #ifndef CYASSL_LEANPSK - CyaSSL_GetObjectSize(); - #endif - break; - - case 'S' : - #ifdef HAVE_SNI - sniHostName = myoptarg; - #endif - break; - - case 'L' : - #ifdef HAVE_MAX_FRAGMENT - maxFragment = atoi(myoptarg); - if (maxFragment < CYASSL_MFL_2_9 || - maxFragment > CYASSL_MFL_2_13) { - Usage(); - exit(MY_EX_USAGE); - } - #endif - break; - - case 'T' : - #ifdef HAVE_TRUNCATED_HMAC - truncatedHMAC = 1; - #endif - break; - - case 'o' : - #ifdef HAVE_OCSP - useOcsp = 1; - #endif - break; - - case 'O' : - #ifdef HAVE_OCSP - useOcsp = 1; - ocspUrl = myoptarg; - #endif - break; - - default: - Usage(); - exit(MY_EX_USAGE); - } - } - - myoptind = 0; /* reset for test cases */ - - /* sort out DTLS versus TLS versions */ - if (version == CLIENT_INVALID_VERSION) { - if (doDTLS) - version = CLIENT_DTLS_DEFAULT_VERSION; - else - version = CLIENT_DEFAULT_VERSION; - } - else { - if (doDTLS) { - if (version == 3) - version = -2; - else - version = -1; - } - } - -#ifdef USE_CYASSL_MEMORY - if (trackMemory) - InitMemoryTracker(); -#endif - - switch (version) { -#ifndef NO_OLD_TLS - case 0: - method = wolfSSLv3_client_method(); - break; - - - #ifndef NO_TLS - case 1: - method = CyaTLSv1_client_method(); - break; - - case 2: - method = CyaTLSv1_1_client_method(); - break; - #endif /* NO_TLS */ - -#endif /* NO_OLD_TLS */ - -#ifndef NO_TLS - case 3: - method = CyaTLSv1_2_client_method(); - break; -#endif - -#ifdef CYASSL_DTLS - case -1: - method = CyaDTLSv1_client_method(); - break; - - case -2: - method = CyaDTLSv1_2_client_method(); - break; -#endif - - default: - err_sys("Bad SSL version"); - break; - } - - if (method == NULL) - err_sys("unable to get method"); - - ctx = CyaSSL_CTX_new(method); - if (ctx == NULL) - err_sys("unable to get ctx"); - - if (cipherList) - if (CyaSSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS) - err_sys("client can't set cipher list 1"); - -#ifdef CYASSL_LEANPSK - usePsk = 1; -#endif - -#if defined(NO_RSA) && !defined(HAVE_ECC) - usePsk = 1; -#endif - - if (fewerPackets) - CyaSSL_CTX_set_group_messages(ctx); - - if (usePsk) { -#ifndef NO_PSK - CyaSSL_CTX_set_psk_client_callback(ctx, my_psk_client_cb); - if (cipherList == NULL) { - const char *defaultCipherList; - #ifdef HAVE_NULL_CIPHER - defaultCipherList = "PSK-NULL-SHA256"; - #else - defaultCipherList = "PSK-AES128-CBC-SHA256"; - #endif - if (CyaSSL_CTX_set_cipher_list(ctx,defaultCipherList) !=SSL_SUCCESS) - err_sys("client can't set cipher list 2"); - } -#endif - useClientCert = 0; - } - -#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) - CyaSSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack); -#endif - -#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC) - if (cipherList == NULL) { - /* don't use EDH, can't sniff tmp keys */ - if (CyaSSL_CTX_set_cipher_list(ctx, "AES256-SHA256") != SSL_SUCCESS) { - err_sys("client can't set cipher list 3"); - } - } -#endif - -#ifdef HAVE_OCSP - if (useOcsp) { - if (ocspUrl != NULL) { - CyaSSL_CTX_SetOCSP_OverrideURL(ctx, ocspUrl); - CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE - | CYASSL_OCSP_URL_OVERRIDE); - } - else - CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE); - } -#endif - -#ifdef USER_CA_CB - CyaSSL_CTX_SetCACb(ctx, CaCb); -#endif - -#ifdef VERIFY_CALLBACK - CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, myVerify); -#endif -#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) - if (useClientCert){ - if (CyaSSL_CTX_use_certificate_chain_file(ctx, ourCert) != SSL_SUCCESS) - err_sys("can't load client cert file, check file and run from" - " CyaSSL home dir"); - - if (CyaSSL_CTX_use_PrivateKey_file(ctx, ourKey, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load client private key file, check file and run " - "from CyaSSL home dir"); - } - - if (!usePsk) { - if (CyaSSL_CTX_load_verify_locations(ctx, verifyCert, 0) != SSL_SUCCESS) - err_sys("can't load ca file, Please run from CyaSSL home dir"); - } -#endif -#if !defined(NO_CERTS) - if (!usePsk && doPeerCheck == 0) - CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); -#endif - -#ifdef HAVE_CAVIUM - CyaSSL_CTX_UseCavium(ctx, CAVIUM_DEV_ID); -#endif - -#ifdef HAVE_SNI - if (sniHostName) - if (CyaSSL_CTX_UseSNI(ctx, 0, sniHostName, XSTRLEN(sniHostName)) - != SSL_SUCCESS) - err_sys("UseSNI failed"); -#endif -#ifdef HAVE_MAX_FRAGMENT - if (maxFragment) - if (CyaSSL_CTX_UseMaxFragment(ctx, maxFragment) != SSL_SUCCESS) - err_sys("UseMaxFragment failed"); -#endif -#ifdef HAVE_TRUNCATED_HMAC - if (truncatedHMAC) - if (CyaSSL_CTX_UseTruncatedHMAC(ctx) != SSL_SUCCESS) - err_sys("UseTruncatedHMAC failed"); -#endif - - if (benchmark) { - /* time passed in number of connects give average */ - int times = benchmark; - int i = 0; - - double start = current_time(), avg; - - for (i = 0; i < times; i++) { - tcp_connect(&sockfd, host, port, doDTLS); - - ssl = CyaSSL_new(ctx); - CyaSSL_set_fd(ssl, sockfd); - if (CyaSSL_connect(ssl) != SSL_SUCCESS) - err_sys("SSL_connect failed"); - - CyaSSL_shutdown(ssl); - CyaSSL_free(ssl); - CloseSocket(sockfd); - } - avg = current_time() - start; - avg /= times; - avg *= 1000; /* milliseconds */ - printf("CyaSSL_connect avg took: %8.3f milliseconds\n", avg); - - CyaSSL_CTX_free(ctx); - ((func_args*)args)->return_code = 0; - - exit(EXIT_SUCCESS); - } - - #if defined(CYASSL_MDK_ARM) - CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); - #endif - - ssl = CyaSSL_new(ctx); - if (ssl == NULL) - err_sys("unable to get SSL object"); - if (doDTLS) { - SOCKADDR_IN_T addr; - build_addr(&addr, host, port, 1); - CyaSSL_dtls_set_peer(ssl, &addr, sizeof(addr)); - tcp_socket(&sockfd, 1); - } - else { - tcp_connect(&sockfd, host, port, 0); - } - CyaSSL_set_fd(ssl, sockfd); -#ifdef HAVE_CRL - if (CyaSSL_EnableCRL(ssl, CYASSL_CRL_CHECKALL) != SSL_SUCCESS) - err_sys("can't enable crl check"); - if (CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, 0) != SSL_SUCCESS) - err_sys("can't load crl, check crlfile and date validity"); - if (CyaSSL_SetCRL_Cb(ssl, CRL_CallBack) != SSL_SUCCESS) - err_sys("can't set crl callback"); -#endif -#ifdef ATOMIC_USER - if (atomicUser) - SetupAtomicUser(ctx, ssl); -#endif -#ifdef HAVE_PK_CALLBACKS - if (pkCallbacks) - SetupPkCallbacks(ctx, ssl); -#endif - if (matchName && doPeerCheck) - CyaSSL_check_domain_name(ssl, domain); -#ifndef CYASSL_CALLBACKS - if (nonBlocking) { - CyaSSL_set_using_nonblock(ssl, 1); - tcp_set_nonblocking(&sockfd); - NonBlockingSSL_Connect(ssl); - } - else if (CyaSSL_connect(ssl) != SSL_SUCCESS) { - /* see note at top of README */ - int err = CyaSSL_get_error(ssl, 0); - char buffer[CYASSL_MAX_ERROR_SZ]; - printf("err = %d, %s\n", err, - CyaSSL_ERR_error_string(err, buffer)); - err_sys("SSL_connect failed"); - /* if you're getting an error here */ - } -#else - timeout.tv_sec = 2; - timeout.tv_usec = 0; - NonBlockingSSL_Connect(ssl); /* will keep retrying on timeout */ -#endif - showPeer(ssl); - - if (sendGET) { - printf("SSL connect ok, sending GET...\n"); - msgSz = 28; - strncpy(msg, "GET /index.html HTTP/1.0\r\n\r\n", msgSz); - msg[msgSz] = '\0'; - } - if (CyaSSL_write(ssl, msg, msgSz) != msgSz) - err_sys("SSL_write failed"); - - input = CyaSSL_read(ssl, reply, sizeof(reply)-1); - if (input > 0) { - reply[input] = 0; - printf("Server response: %s\n", reply); - - if (sendGET) { /* get html */ - while (1) { - input = CyaSSL_read(ssl, reply, sizeof(reply)-1); - if (input > 0) { - reply[input] = 0; - printf("%s\n", reply); - } - else - break; - } - } - } - else if (input < 0) { - int readErr = CyaSSL_get_error(ssl, 0); - if (readErr != SSL_ERROR_WANT_READ) - err_sys("CyaSSL_read failed"); - } - -#ifndef NO_SESSION_CACHE - if (resumeSession) { - if (doDTLS) { - strncpy(msg, "break", 6); - msgSz = (int)strlen(msg); - /* try to send session close */ - CyaSSL_write(ssl, msg, msgSz); - } - session = CyaSSL_get_session(ssl); - sslResume = CyaSSL_new(ctx); - } -#endif - - if (doDTLS == 0) /* don't send alert after "break" command */ - CyaSSL_shutdown(ssl); /* echoserver will interpret as new conn */ -#ifdef ATOMIC_USER - if (atomicUser) - FreeAtomicUser(ssl); -#endif - CyaSSL_free(ssl); - CloseSocket(sockfd); - -#ifndef NO_SESSION_CACHE - if (resumeSession) { - if (doDTLS) { - SOCKADDR_IN_T addr; - #ifdef USE_WINDOWS_API - Sleep(500); - #else - sleep(1); - #endif - build_addr(&addr, host, port, 1); - CyaSSL_dtls_set_peer(sslResume, &addr, sizeof(addr)); - tcp_socket(&sockfd, 1); - } - else { - tcp_connect(&sockfd, host, port, 0); - } - CyaSSL_set_fd(sslResume, sockfd); - CyaSSL_set_session(sslResume, session); - - showPeer(sslResume); -#ifndef CYASSL_CALLBACKS - if (nonBlocking) { - CyaSSL_set_using_nonblock(sslResume, 1); - tcp_set_nonblocking(&sockfd); - NonBlockingSSL_Connect(sslResume); - } - else if (CyaSSL_connect(sslResume) != SSL_SUCCESS) - err_sys("SSL resume failed"); -#else - timeout.tv_sec = 2; - timeout.tv_usec = 0; - NonBlockingSSL_Connect(ssl); /* will keep retrying on timeout */ -#endif - - if (CyaSSL_session_reused(sslResume)) - printf("reused session id\n"); - else - printf("didn't reuse session id!!!\n"); - - if (CyaSSL_write(sslResume, resumeMsg, resumeSz) != resumeSz) - err_sys("SSL_write failed"); - - if (nonBlocking) { - /* give server a chance to bounce a message back to client */ - #ifdef USE_WINDOWS_API - Sleep(500); - #else - sleep(1); - #endif - } - - input = CyaSSL_read(sslResume, reply, sizeof(reply)-1); - if (input > 0) { - reply[input] = 0; - printf("Server resume response: %s\n", reply); - } - - /* try to send session break */ - CyaSSL_write(sslResume, msg, msgSz); - - CyaSSL_shutdown(sslResume); - CyaSSL_free(sslResume); - CloseSocket(sockfd); - } -#endif /* NO_SESSION_CACHE */ - - CyaSSL_CTX_free(ctx); - - ((func_args*)args)->return_code = 0; - -#ifdef USE_CYASSL_MEMORY - if (trackMemory) - ShowMemoryTracker(); -#endif /* USE_CYASSL_MEMORY */ - - return 0; -} - - -/* so overall tests can pull in test function */ -#ifndef NO_MAIN_DRIVER - - int main(int argc, char** argv) - { - func_args args; - -#ifdef HAVE_CAVIUM - int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); - if (ret != 0) - err_sys("Cavium OpenNitroxDevice failed"); -#endif /* HAVE_CAVIUM */ - - StartTCP(); - - args.argc = argc; - args.argv = argv; - - CyaSSL_Init(); -#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL) && !defined(STACK_TRAP) - CyaSSL_Debugging_ON(); -#endif - if (CurrentDir("client")) - ChangeDirBack(2); - else if (CurrentDir("Debug") || CurrentDir("Release")) - ChangeDirBack(3); - -#ifdef HAVE_STACK_SIZE - StackSizeCheck(&args, client_test); -#else - client_test(&args); -#endif - CyaSSL_Cleanup(); - -#ifdef HAVE_CAVIUM - CspShutdown(CAVIUM_DEV_ID); -#endif - return args.return_code; - } - - int myoptind = 0; - char* myoptarg = NULL; - -#endif /* NO_MAIN_DRIVER */ - - - -#ifdef CYASSL_CALLBACKS - - int handShakeCB(HandShakeInfo* info) - { - (void)info; - return 0; - } - - - int timeoutCB(TimeoutInfo* info) - { - (void)info; - return 0; - } - -#endif - diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/echoclient.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/echoclient.c deleted file mode 100644 index 73c46ab18..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/echoclient.c +++ /dev/null @@ -1,282 +0,0 @@ -/* echoclient.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 -#endif - -#include - -#include - -#if defined(CYASSL_MDK_ARM) - #include - #include - - #if defined(CYASSL_MDK5) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #endif - - #include "cyassl_MDK_ARM.h" -#endif - -#include - -#include "examples/echoclient/echoclient.h" - -void echoclient_test(void* args) -{ - SOCKET_T sockfd = 0; - - FILE* fin = stdin ; - FILE* fout = stdout; - - int inCreated = 0; - int outCreated = 0; - - char msg[1024]; - char reply[1024+1]; - - SSL_METHOD* method = 0; - SSL_CTX* ctx = 0; - SSL* ssl = 0; - - int doDTLS = 0; - int doPSK = 0; - int sendSz; - int argc = 0; - char** argv = 0; - word16 port = yasslPort; - - ((func_args*)args)->return_code = -1; /* error state */ - -#ifndef CYASSL_MDK_SHELL - argc = ((func_args*)args)->argc; - argv = ((func_args*)args)->argv; -#endif - - if (argc >= 2) { - fin = fopen(argv[1], "r"); - inCreated = 1; - } - if (argc >= 3) { - fout = fopen(argv[2], "w"); - outCreated = 1; - } - - if (!fin) err_sys("can't open input file"); - if (!fout) err_sys("can't open output file"); - -#ifdef CYASSL_DTLS - doDTLS = 1; -#endif - -#ifdef CYASSL_LEANPSK - doPSK = 1; -#endif - -#if defined(NO_RSA) && !defined(HAVE_ECC) - doPSK = 1; -#endif - -#if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && !defined(CYASSL_MDK_SHELL) - port = ((func_args*)args)->signal->port; -#endif - -#if defined(CYASSL_DTLS) - method = DTLSv1_client_method(); -#elif !defined(NO_TLS) - method = CyaSSLv23_client_method(); -#else - method = SSLv3_client_method(); -#endif - ctx = SSL_CTX_new(method); - -#ifndef NO_FILESYSTEM - #ifndef NO_RSA - if (SSL_CTX_load_verify_locations(ctx, caCert, 0) != SSL_SUCCESS) - err_sys("can't load ca file, Please run from CyaSSL home dir"); - #endif - #ifdef HAVE_ECC - if (SSL_CTX_load_verify_locations(ctx, eccCert, 0) != SSL_SUCCESS) - err_sys("can't load ca file, Please run from CyaSSL home dir"); - #endif -#elif !defined(NO_CERTS) - if (!doPSK) - load_buffer(ctx, caCert, CYASSL_CA); -#endif - -#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC) - /* don't use EDH, can't sniff tmp keys */ - SSL_CTX_set_cipher_list(ctx, "AES256-SHA"); -#endif - if (doPSK) { -#ifndef NO_PSK - const char *defaultCipherList; - - CyaSSL_CTX_set_psk_client_callback(ctx, my_psk_client_cb); - #ifdef HAVE_NULL_CIPHER - defaultCipherList = "PSK-NULL-SHA256"; - #else - defaultCipherList = "PSK-AES128-CBC-SHA256"; - #endif - if (CyaSSL_CTX_set_cipher_list(ctx,defaultCipherList) !=SSL_SUCCESS) - err_sys("client can't set cipher list 2"); -#endif - } - -#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) - SSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack); -#endif - - #if defined(CYASSL_MDK_ARM) - CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); - #endif - - ssl = SSL_new(ctx); - - - if (doDTLS) { - SOCKADDR_IN_T addr; - build_addr(&addr, yasslIP, port, 1); - CyaSSL_dtls_set_peer(ssl, &addr, sizeof(addr)); - tcp_socket(&sockfd, 1); - } - else { - tcp_connect(&sockfd, yasslIP, port, 0); - } - - SSL_set_fd(ssl, sockfd); -#if defined(USE_WINDOWS_API) && defined(CYASSL_DTLS) && defined(NO_MAIN_DRIVER) - /* let echoserver bind first, TODO: add Windows signal like pthreads does */ - Sleep(100); -#endif - - if (SSL_connect(ssl) != SSL_SUCCESS) err_sys("SSL_connect failed"); - - while (fgets(msg, sizeof(msg), fin) != 0) { - - sendSz = (int)strlen(msg); - - if (SSL_write(ssl, msg, sendSz) != sendSz) - err_sys("SSL_write failed"); - - if (strncmp(msg, "quit", 4) == 0) { - fputs("sending server shutdown command: quit!\n", fout); - break; - } - - if (strncmp(msg, "break", 5) == 0) { - fputs("sending server session close: break!\n", fout); - break; - } - - #ifndef CYASSL_MDK_SHELL - while (sendSz) { - int got; - if ( (got = SSL_read(ssl, reply, sizeof(reply)-1)) > 0) { - reply[got] = 0; - fputs(reply, fout); - fflush(fout) ; - sendSz -= got; - } - else - break; - } - #else - { - int got; - if ( (got = SSL_read(ssl, reply, sizeof(reply)-1)) > 0) { - reply[got] = 0; - fputs(reply, fout); - fflush(fout) ; - sendSz -= got; - } - } - #endif - } - - -#ifdef CYASSL_DTLS - strncpy(msg, "break", 6); - sendSz = (int)strlen(msg); - /* try to tell server done */ - SSL_write(ssl, msg, sendSz); -#else - SSL_shutdown(ssl); -#endif - - SSL_free(ssl); - SSL_CTX_free(ctx); - - fflush(fout); - if (inCreated) fclose(fin); - if (outCreated) fclose(fout); - - CloseSocket(sockfd); - ((func_args*)args)->return_code = 0; -} - - -/* so overall tests can pull in test function */ -#ifndef NO_MAIN_DRIVER - - int main(int argc, char** argv) - { - func_args args; - -#ifdef HAVE_CAVIUM - int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); - if (ret != 0) - err_sys("Cavium OpenNitroxDevice failed"); -#endif /* HAVE_CAVIUM */ - - StartTCP(); - - args.argc = argc; - args.argv = argv; - - CyaSSL_Init(); -#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL) - CyaSSL_Debugging_ON(); -#endif - - if (CurrentDir("echoclient")) - ChangeDirBack(2); - else if (CurrentDir("Debug") || CurrentDir("Release")) - ChangeDirBack(3); - echoclient_test(&args); - - CyaSSL_Cleanup(); - -#ifdef HAVE_CAVIUM - CspShutdown(CAVIUM_DEV_ID); -#endif - return args.return_code; - } - -#endif /* NO_MAIN_DRIVER */ - - diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/echoserver.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/echoserver.c deleted file mode 100644 index 2ac1f7fdb..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/echoserver.c +++ /dev/null @@ -1,368 +0,0 @@ -/* echoserver.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 -#endif - -#include - -#if defined(CYASSL_MDK_ARM) - #include - #include - - #if defined(CYASSL_MDK5) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #endif - - #include "cyassl_MDK_ARM.h" -#endif - -#include -#include - -#ifndef NO_MAIN_DRIVER - #define ECHO_OUT -#endif - -#include "examples/echoserver/echoserver.h" - - -#ifdef SESSION_STATS - CYASSL_API void PrintSessionStats(void); -#endif - -#define SVR_COMMAND_SIZE 256 - -static void SignalReady(void* args, word16 port) -{ -#if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER) && !defined(__MINGW32__) - /* signal ready to tcp_accept */ - func_args* server_args = (func_args*)args; - tcp_ready* ready = server_args->signal; - pthread_mutex_lock(&ready->mutex); - ready->ready = 1; - ready->port = port; - pthread_cond_signal(&ready->cond); - pthread_mutex_unlock(&ready->mutex); -#endif - (void)args; - (void)port; -} - - -THREAD_RETURN CYASSL_THREAD echoserver_test(void* args) -{ - SOCKET_T sockfd = 0; - CYASSL_METHOD* method = 0; - CYASSL_CTX* ctx = 0; - - int doDTLS = 0; - int doPSK = 0; - int outCreated = 0; - int shutDown = 0; - int useAnyAddr = 0; - word16 port = yasslPort; - int argc = ((func_args*)args)->argc; - char** argv = ((func_args*)args)->argv; - -#ifdef ECHO_OUT - FILE* fout = stdout; - if (argc >= 2) { - fout = fopen(argv[1], "w"); - outCreated = 1; - } - if (!fout) err_sys("can't open output file"); -#endif - (void)outCreated; - (void)argc; - (void)argv; - - ((func_args*)args)->return_code = -1; /* error state */ - -#ifdef CYASSL_DTLS - doDTLS = 1; -#endif - -#ifdef CYASSL_LEANPSK - doPSK = 1; -#endif - -#if defined(NO_RSA) && !defined(HAVE_ECC) - doPSK = 1; -#endif - - #if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && \ - !defined(CYASSL_SNIFFER) && !defined(CYASSL_MDK_SHELL) - port = 0; - #endif - #if defined(USE_ANY_ADDR) - useAnyAddr = 1; - #endif - tcp_listen(&sockfd, &port, useAnyAddr, doDTLS); - -#if defined(CYASSL_DTLS) - method = CyaDTLSv1_server_method(); -#elif !defined(NO_TLS) - method = CyaSSLv23_server_method(); -#else - method = wolfSSLv3_server_method(); -#endif - ctx = CyaSSL_CTX_new(method); - /* CyaSSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF); */ - -#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) - CyaSSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack); -#endif - -#ifndef NO_FILESYSTEM - if (doPSK == 0) { - #ifdef HAVE_NTRU - /* ntru */ - if (CyaSSL_CTX_use_certificate_file(ctx, ntruCert, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load ntru cert file, " - "Please run from CyaSSL home dir"); - - if (CyaSSL_CTX_use_NTRUPrivateKey_file(ctx, ntruKey) - != SSL_SUCCESS) - err_sys("can't load ntru key file, " - "Please run from CyaSSL home dir"); - #elif defined(HAVE_ECC) - /* ecc */ - if (CyaSSL_CTX_use_certificate_file(ctx, eccCert, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server cert file, " - "Please run from CyaSSL home dir"); - - if (CyaSSL_CTX_use_PrivateKey_file(ctx, eccKey, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server key file, " - "Please run from CyaSSL home dir"); - #elif defined(NO_CERTS) - /* do nothing, just don't load cert files */ - #else - /* normal */ - if (CyaSSL_CTX_use_certificate_file(ctx, svrCert, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server cert file, " - "Please run from CyaSSL home dir"); - - if (CyaSSL_CTX_use_PrivateKey_file(ctx, svrKey, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server key file, " - "Please run from CyaSSL home dir"); - #endif - } /* doPSK */ -#elif !defined(NO_CERTS) - if (!doPSK) { - load_buffer(ctx, svrCert, CYASSL_CERT); - load_buffer(ctx, svrKey, CYASSL_KEY); - } -#endif - -#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC) - /* don't use EDH, can't sniff tmp keys */ - CyaSSL_CTX_set_cipher_list(ctx, "AES256-SHA"); -#endif - - if (doPSK) { -#ifndef NO_PSK - const char *defaultCipherList; - - CyaSSL_CTX_set_psk_server_callback(ctx, my_psk_server_cb); - CyaSSL_CTX_use_psk_identity_hint(ctx, "cyassl server"); - #ifdef HAVE_NULL_CIPHER - defaultCipherList = "PSK-NULL-SHA256"; - #else - defaultCipherList = "PSK-AES128-CBC-SHA256"; - #endif - if (CyaSSL_CTX_set_cipher_list(ctx, defaultCipherList) != SSL_SUCCESS) - err_sys("server can't set cipher list 2"); -#endif - } - - SignalReady(args, port); - - while (!shutDown) { - CYASSL* ssl = 0; - char command[SVR_COMMAND_SIZE+1]; - int echoSz = 0; - int clientfd; - int firstRead = 1; - int gotFirstG = 0; - -#ifndef CYASSL_DTLS - SOCKADDR_IN_T client; - socklen_t client_len = sizeof(client); - clientfd = accept(sockfd, (struct sockaddr*)&client, - (ACCEPT_THIRD_T)&client_len); -#else - clientfd = udp_read_connect(sockfd); -#endif - if (clientfd == -1) err_sys("tcp accept failed"); - - ssl = CyaSSL_new(ctx); - if (ssl == NULL) err_sys("SSL_new failed"); - CyaSSL_set_fd(ssl, clientfd); - #if !defined(NO_FILESYSTEM) && defined(OPENSSL_EXTRA) - CyaSSL_SetTmpDH_file(ssl, dhParam, SSL_FILETYPE_PEM); - #elif !defined(NO_CERTS) - SetDH(ssl); /* will repick suites with DHE, higher than PSK */ - #endif - if (CyaSSL_accept(ssl) != SSL_SUCCESS) { - printf("SSL_accept failed\n"); - CyaSSL_free(ssl); - CloseSocket(clientfd); - continue; - } -#if defined(PEER_INFO) - showPeer(ssl); -#endif - - while ( (echoSz = CyaSSL_read(ssl, command, sizeof(command)-1)) > 0) { - - if (firstRead == 1) { - firstRead = 0; /* browser may send 1 byte 'G' to start */ - if (echoSz == 1 && command[0] == 'G') { - gotFirstG = 1; - continue; - } - } - else if (gotFirstG == 1 && strncmp(command, "ET /", 4) == 0) { - strncpy(command, "GET", 4); - /* fall through to normal GET */ - } - - if ( strncmp(command, "quit", 4) == 0) { - printf("client sent quit command: shutting down!\n"); - shutDown = 1; - break; - } - if ( strncmp(command, "break", 5) == 0) { - printf("client sent break command: closing session!\n"); - break; - } -#ifdef SESSION_STATS - if ( strncmp(command, "printstats", 10) == 0) { - PrintSessionStats(); - break; - } -#endif - if ( strncmp(command, "GET", 3) == 0) { - char type[] = "HTTP/1.0 200 ok\r\nContent-type:" - " text/html\r\n\r\n"; - char header[] = "\n
\n";
-                char body[]   = "greetings from CyaSSL\n";
-                char footer[] = "\r\n\r\n";
-            
-                strncpy(command, type, sizeof(type));
-                echoSz = sizeof(type) - 1;
-
-                strncpy(&command[echoSz], header, sizeof(header));
-                echoSz += (int)sizeof(header) - 1;
-                strncpy(&command[echoSz], body, sizeof(body));
-                echoSz += (int)sizeof(body) - 1;
-                strncpy(&command[echoSz], footer, sizeof(footer));
-                echoSz += (int)sizeof(footer);
-
-                if (CyaSSL_write(ssl, command, echoSz) != echoSz)
-                    err_sys("SSL_write failed");
-                break;
-            }
-            command[echoSz] = 0;
-
-            #ifdef ECHO_OUT
-                fputs(command, fout);
-            #endif
-
-            if (CyaSSL_write(ssl, command, echoSz) != echoSz)
-                err_sys("SSL_write failed");
-        }
-#ifndef CYASSL_DTLS
-        CyaSSL_shutdown(ssl);
-#endif
-        CyaSSL_free(ssl);
-        CloseSocket(clientfd);
-#ifdef CYASSL_DTLS
-        tcp_listen(&sockfd, &port, useAnyAddr, doDTLS);
-        SignalReady(args, port);
-#endif
-    }
-
-    CloseSocket(sockfd);
-    CyaSSL_CTX_free(ctx);
-
-#ifdef ECHO_OUT
-    if (outCreated)
-        fclose(fout);
-#endif
-
-    ((func_args*)args)->return_code = 0;
-    return 0;
-}
-
-
-/* so overall tests can pull in test function */
-#ifndef NO_MAIN_DRIVER
-
-    int main(int argc, char** argv)
-    {
-        func_args args;
-
-#ifdef HAVE_CAVIUM
-        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
-        if (ret != 0)
-            err_sys("Cavium OpenNitroxDevice failed");
-#endif /* HAVE_CAVIUM */
-
-        StartTCP();
-
-        args.argc = argc;
-        args.argv = argv;
-
-        CyaSSL_Init();
-#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL)
-        CyaSSL_Debugging_ON();
-#endif
-        if (CurrentDir("echoserver"))
-            ChangeDirBack(2);
-        else if (CurrentDir("Debug") || CurrentDir("Release"))
-            ChangeDirBack(3);
-        echoserver_test(&args);
-        CyaSSL_Cleanup();
-
-#ifdef HAVE_CAVIUM
-        CspShutdown(CAVIUM_DEV_ID);
-#endif
-        return args.return_code;
-    }
-
-        
-#endif /* NO_MAIN_DRIVER */
-
-
-
-
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/main.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/main.c
deleted file mode 100644
index ae487e705..000000000
--- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/main.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* main.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 
-#endif
-
-#include 
-#include 
-
-#include "cmsis_os.h"
-#if !defined(NO_FILESYSTEM)
-#include "rl_fs.h" 
-#endif
-#include "rl_net.h" 
-#include 
-#include "cyassl_MDK_ARM.h"
-#include 
-
-/*-----------------------------------------------------------------------------
- *        Initialize a Flash Memory Card
- *----------------------------------------------------------------------------*/
-#if !defined(NO_FILESYSTEM)
-static void init_filesystem (void) {
-  int32_t retv;
-
-  retv = finit ("M0:");
-  if (retv == 0) {
-    retv = fmount ("M0:");
-    if (retv == 0) {
-      printf ("Drive M0 ready!\n");
-    }
-    else {
-      printf ("Drive M0 mount failed!\n");
-    }
-  }
-  else {
-    printf ("Drive M0 initialization failed!\n");
-  }
-}
-#endif
-
-/*-----------------------------------------------------------------------------
- *        TCP/IP tasks
- *----------------------------------------------------------------------------*/
-void tcp_poll (void const *arg)
-{
-    CYASSL_MSG("TCP polling started.\n") ;
-    while (1) {
-        net_main ();
-        osDelay(1) ;
-    }
-}
-
-extern void shell_main(void * args) ;
-extern void init_time(void) ;
-
-osThreadDef (tcp_poll, osPriorityHigh, 1, 0) ;
-/*-----------------------------------------------------------------------------
- *       mian entry 
- *----------------------------------------------------------------------------*/
-int myoptind = 0;
-char* myoptarg = NULL;
-
-int main() 
-{
-    void *arg = NULL ;
-	
-	#if !defined(NO_FILESYSTEM)
-    init_filesystem ();
-	#endif
-	
-    net_initialize() ;
-    
-    osThreadCreate (osThread (tcp_poll), NULL); 
-    osDelay(10000) ;  /* wait for DHCP */
-    #if defined(DEBUG_CYASSL)
-         printf("Turning ON Debug message\n") ;
-         CyaSSL_Debugging_ON() ;
-    #endif
-
-    shell_main(arg) ;   
-
-}
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/server.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/server.c
deleted file mode 100644
index 4c79540c8..000000000
--- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/server.c
+++ /dev/null
@@ -1,605 +0,0 @@
-/* server.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 
-#endif
-
-#include 
-
-#if !defined(CYASSL_TRACK_MEMORY) && !defined(NO_MAIN_DRIVER)
-    /* in case memory tracker wants stats */
-    #define CYASSL_TRACK_MEMORY
-#endif
-
-#if defined(CYASSL_MDK_ARM)
-        #include 
-        #include 
-
-        #if defined(CYASSL_MDK5)
-            #include "cmsis_os.h"
-            #include "rl_fs.h" 
-            #include "rl_net.h" 
-        #else
-            #include "rtl.h"
-        #endif
-
-        #include "cyassl_MDK_ARM.h"
-#endif
-#include 
-#include 
-
-#include "examples/server/server.h"
-
-
-#ifdef CYASSL_CALLBACKS
-    int srvHandShakeCB(HandShakeInfo*);
-    int srvTimeoutCB(TimeoutInfo*);
-    Timeval srvTo;
-#endif
-
-static void NonBlockingSSL_Accept(SSL* ssl)
-{
-#ifndef CYASSL_CALLBACKS
-    int ret = SSL_accept(ssl);
-#else
-    int ret = CyaSSL_accept_ex(ssl, srvHandShakeCB, srvTimeoutCB, srvTo);
-#endif
-    int error = SSL_get_error(ssl, 0);
-    SOCKET_T sockfd = (SOCKET_T)CyaSSL_get_fd(ssl);
-    int select_ret;
-
-    while (ret != SSL_SUCCESS && (error == SSL_ERROR_WANT_READ ||
-                                  error == SSL_ERROR_WANT_WRITE)) {
-        int currTimeout = 1;
-
-        if (error == SSL_ERROR_WANT_READ)
-            printf("... server would read block\n");
-        else
-            printf("... server would write block\n");
-
-#ifdef CYASSL_DTLS
-        currTimeout = CyaSSL_dtls_get_current_timeout(ssl);
-#endif
-        select_ret = tcp_select(sockfd, currTimeout);
-
-        if ((select_ret == TEST_RECV_READY) ||
-                                        (select_ret == TEST_ERROR_READY)) {
-            #ifndef CYASSL_CALLBACKS
-                ret = SSL_accept(ssl);
-            #else
-                ret = CyaSSL_accept_ex(ssl,
-                                    srvHandShakeCB, srvTimeoutCB, srvTo);
-            #endif
-            error = SSL_get_error(ssl, 0);
-        }
-        else if (select_ret == TEST_TIMEOUT && !CyaSSL_dtls(ssl)) {
-            error = SSL_ERROR_WANT_READ;
-        }
-#ifdef CYASSL_DTLS
-        else if (select_ret == TEST_TIMEOUT && CyaSSL_dtls(ssl) &&
-                                            CyaSSL_dtls_got_timeout(ssl) >= 0) {
-            error = SSL_ERROR_WANT_READ;
-        }
-#endif
-        else {
-            error = SSL_FATAL_ERROR;
-        }
-    }
-    if (ret != SSL_SUCCESS)
-        err_sys("SSL_accept failed");
-}
-
-
-static void Usage(void)
-{
-    printf("server "    LIBCYASSL_VERSION_STRING
-           " NOTE: All files relative to CyaSSL home dir\n");
-    printf("-?          Help, print this usage\n");
-    printf("-p     Port to listen on, not 0, default %d\n", yasslPort);
-    printf("-v     SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n",
-                                 SERVER_DEFAULT_VERSION);
-    printf("-l     Cipher list\n");
-    printf("-c    Certificate file,           default %s\n", svrCert);
-    printf("-k    Key file,                   default %s\n", svrKey);
-    printf("-A    Certificate Authority file, default %s\n", cliCert);
-    printf("-d          Disable client cert check\n");
-    printf("-b          Bind to any interface instead of localhost only\n");
-    printf("-s          Use pre Shared keys\n");
-    printf("-t          Track CyaSSL memory use\n");
-    printf("-u          Use UDP DTLS,"
-           " add -v 2 for DTLSv1 (default), -v 3 for DTLSv1.2\n");
-    printf("-f          Fewer packets/group messages\n");
-    printf("-N          Use Non-blocking sockets\n");
-    printf("-S     Use Host Name Indication\n");
-#ifdef HAVE_OCSP
-    printf("-o          Perform OCSP lookup on peer certificate\n");
-    printf("-O     Perform OCSP lookup using  as responder\n");
-#endif
-#ifdef HAVE_PK_CALLBACKS 
-    printf("-P          Public Key Callbacks\n");
-#endif
-}
-
-THREAD_RETURN CYASSL_THREAD server_test(void* args)
-{
-    SOCKET_T sockfd   = 0;
-    SOCKET_T clientfd = 0;
-
-    SSL_METHOD* method = 0;
-    SSL_CTX*    ctx    = 0;
-    SSL*        ssl    = 0;
-
-    char   msg[] = "I hear you fa shizzle!";
-    char   input[80];
-    int    idx;
-    int    ch;
-    int    version = SERVER_DEFAULT_VERSION;
-    int    doCliCertCheck = 0; /* = 0 for no Realtime Clock environment */
-    int    useAnyAddr = 0;
-    word16 port = yasslPort;
-    int    usePsk = 0;
-    int    doDTLS = 0;
-    int    useNtruKey   = 0;
-    int    nonBlocking  = 0;
-    int    trackMemory  = 0;
-    int    fewerPackets = 0;
-    int    pkCallbacks  = 0;
-    char*  cipherList = NULL;
-    char*  verifyCert = (char*)cliCert;
-    char*  ourCert    = (char*)svrCert;
-    char*  ourKey     = (char*)svrKey;
-    int    argc = ((func_args*)args)->argc;
-    char** argv = ((func_args*)args)->argv;
-
-#ifdef HAVE_SNI
-    char*  sniHostName = NULL;
-#endif
-
-#ifdef HAVE_OCSP
-    int    useOcsp  = 0;
-    char*  ocspUrl  = NULL;
-#endif
-
-    ((func_args*)args)->return_code = -1; /* error state */
-
-#ifdef NO_RSA
-    verifyCert = (char*)cliEccCert;
-    ourCert    = (char*)eccCert;
-    ourKey     = (char*)eccKey;
-#endif
-    (void)trackMemory;
-    (void)pkCallbacks;
-
-    while ((ch = mygetopt(argc, argv, "?dbstnNufPp:v:l:A:c:k:S:oO:")) != -1) {
-        switch (ch) {
-            case '?' :
-                Usage();
-                exit(EXIT_SUCCESS);
-
-            case 'd' :
-                doCliCertCheck = 0;
-                break;
-
-            case 'b' :
-                useAnyAddr = 1;
-                break;
-
-            case 's' :
-                usePsk = 1;
-                break;
-
-            case 't' :
-            #ifdef USE_CYASSL_MEMORY
-                trackMemory = 1;
-            #endif
-                break;
-
-            case 'n' :
-                useNtruKey = 1;
-                break;
-
-            case 'u' :
-                doDTLS  = 1;
-                break;
-
-            case 'f' :
-                fewerPackets = 1;
-                break;
-
-            case 'P' :
-            #ifdef HAVE_PK_CALLBACKS 
-                pkCallbacks = 1;
-            #endif
-                break;
-
-            case 'p' :
-                port = (word16)atoi(myoptarg);
-                #if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API)
-                    if (port == 0)
-                        err_sys("port number cannot be 0");
-                #endif
-                break;
-
-            case 'v' :
-                version = atoi(myoptarg);
-                if (version < 0 || version > 3) {
-                    Usage();
-                    exit(MY_EX_USAGE);
-                }
-                break;
-
-            case 'l' :
-                cipherList = myoptarg;
-                break;
-
-            case 'A' :
-                verifyCert = myoptarg;
-                break;
-
-            case 'c' :
-                ourCert = myoptarg;
-                break;
-
-            case 'k' :
-                ourKey = myoptarg;
-                break;
-
-            case 'N':
-                nonBlocking = 1;
-                break;
-
-            case 'S' :
-                #ifdef HAVE_SNI
-                    sniHostName = myoptarg;
-                #endif
-                break;
-
-            case 'o' :
-                #ifdef HAVE_OCSP
-                    useOcsp = 1;
-                #endif
-                break;
-
-            case 'O' :
-                #ifdef HAVE_OCSP
-                    useOcsp = 1;
-                    ocspUrl = myoptarg;
-                #endif
-                break;
-
-            default:
-                Usage();
-                exit(MY_EX_USAGE);
-        }
-    }
-
-    myoptind = 0;      /* reset for test cases */
-
-    /* sort out DTLS versus TLS versions */
-    if (version == CLIENT_INVALID_VERSION) {
-        if (doDTLS)
-            version = CLIENT_DTLS_DEFAULT_VERSION;
-        else
-            version = CLIENT_DEFAULT_VERSION;
-    }
-    else {
-        if (doDTLS) {
-            if (version == 3)
-                version = -2;
-            else
-                version = -1;
-        }
-    }
-
-#ifdef USE_CYASSL_MEMORY
-    if (trackMemory)
-        InitMemoryTracker(); 
-#endif
-
-    switch (version) {
-#ifndef NO_OLD_TLS
-        case 0:
-            method = SSLv3_server_method();
-            break;
-
-    #ifndef NO_TLS
-        case 1:
-            method = TLSv1_server_method();
-            break;
-
-
-        case 2:
-            method = TLSv1_1_server_method();
-            break;
-
-        #endif
-#endif
-
-#ifndef NO_TLS
-        case 3:
-            method = TLSv1_2_server_method();
-            break;
-#endif
-                
-#ifdef CYASSL_DTLS
-        case -1:
-            method = DTLSv1_server_method();
-            break;
-
-        case -2:
-            method = DTLSv1_2_server_method();
-            break;
-#endif
-
-        default:
-            err_sys("Bad SSL version");
-    }
-
-    if (method == NULL)
-        err_sys("unable to get method");
-
-    ctx = SSL_CTX_new(method);
-    if (ctx == NULL)
-        err_sys("unable to get ctx");
-
-    if (cipherList)
-        if (SSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS)
-            err_sys("server can't set cipher list 1");
-
-#ifdef CYASSL_LEANPSK
-    usePsk = 1;
-#endif
-
-#if defined(NO_RSA) && !defined(HAVE_ECC)
-    usePsk = 1;
-#endif
-
-    if (fewerPackets)
-        CyaSSL_CTX_set_group_messages(ctx);
-
-#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
-    SSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack);
-#endif
-
-#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
-    if (!usePsk) {
-        if (SSL_CTX_use_certificate_file(ctx, ourCert, SSL_FILETYPE_PEM)
-                                         != SSL_SUCCESS)
-            err_sys("can't load server cert file, check file and run from"
-                    " CyaSSL home dir");
-    }
-#endif
-
-#ifdef HAVE_NTRU
-    if (useNtruKey) {
-        if (CyaSSL_CTX_use_NTRUPrivateKey_file(ctx, ourKey)
-                                               != SSL_SUCCESS)
-            err_sys("can't load ntru key file, "
-                    "Please run from CyaSSL home dir");
-    }
-#endif
-
-#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
-    if (!useNtruKey && !usePsk) {
-        if (SSL_CTX_use_PrivateKey_file(ctx, ourKey, SSL_FILETYPE_PEM)
-                                         != SSL_SUCCESS)
-            err_sys("can't load server private key file, check file and run "
-                "from CyaSSL home dir");
-    }
-#endif
-
-    if (usePsk) {
-#ifndef NO_PSK
-        SSL_CTX_set_psk_server_callback(ctx, my_psk_server_cb);
-        SSL_CTX_use_psk_identity_hint(ctx, "cyassl server");
-        if (cipherList == NULL) {
-            const char *defaultCipherList;
-            #ifdef HAVE_NULL_CIPHER
-                defaultCipherList = "PSK-NULL-SHA256";
-            #else
-                defaultCipherList = "PSK-AES128-CBC-SHA256";
-            #endif
-            if (SSL_CTX_set_cipher_list(ctx, defaultCipherList) != SSL_SUCCESS)
-                err_sys("server can't set cipher list 2");
-        }
-#endif
-    }
-
-#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
-    /* if not using PSK, verify peer with certs */
-    if (doCliCertCheck && usePsk == 0) {
-        SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER |
-                                SSL_VERIFY_FAIL_IF_NO_PEER_CERT,0);
-        if (SSL_CTX_load_verify_locations(ctx, verifyCert, 0) != SSL_SUCCESS)
-            err_sys("can't load ca file, Please run from CyaSSL home dir");
-    }
-#endif
-
-#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC)
-    /* don't use EDH, can't sniff tmp keys */
-    if (cipherList == NULL) {
-        if (SSL_CTX_set_cipher_list(ctx, "AES256-SHA256") != SSL_SUCCESS)
-            err_sys("server can't set cipher list 3");
-    }
-#endif
-
-#ifdef HAVE_SNI
-    if (sniHostName)
-        if (CyaSSL_CTX_UseSNI(ctx, CYASSL_SNI_HOST_NAME, sniHostName,
-                                           XSTRLEN(sniHostName)) != SSL_SUCCESS)
-            err_sys("UseSNI failed");
-#endif
-
-    ssl = SSL_new(ctx);
-    if (ssl == NULL)
-        err_sys("unable to get SSL");
-
-#ifdef HAVE_CRL
-    CyaSSL_EnableCRL(ssl, 0);
-    CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, CYASSL_CRL_MONITOR |
-                                                     CYASSL_CRL_START_MON);
-    CyaSSL_SetCRL_Cb(ssl, CRL_CallBack);
-#endif
-#ifdef HAVE_OCSP
-    if (useOcsp) {
-        if (ocspUrl != NULL) {
-            CyaSSL_CTX_SetOCSP_OverrideURL(ctx, ocspUrl);
-            CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE
-                                                    | CYASSL_OCSP_URL_OVERRIDE);
-        }
-        else
-            CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE);
-    }
-#endif
-#ifdef HAVE_PK_CALLBACKS
-    if (pkCallbacks)
-        SetupPkCallbacks(ctx, ssl);
-#endif
-
-    tcp_accept(&sockfd, &clientfd, (func_args*)args, port, useAnyAddr, doDTLS,
-               0);
-    if (!doDTLS) 
-        CloseSocket(sockfd);
-
-    SSL_set_fd(ssl, clientfd);
-    if (usePsk == 0) {
-        #if !defined(NO_FILESYSTEM) && defined(OPENSSL_EXTRA)
-            CyaSSL_SetTmpDH_file(ssl, dhParam, SSL_FILETYPE_PEM);
-        #elif !defined(NO_CERTS)
-            SetDH(ssl);  /* repick suites with DHE, higher priority than PSK */
-        #endif
-    }
-
-#ifndef CYASSL_CALLBACKS
-    if (nonBlocking) {
-        CyaSSL_set_using_nonblock(ssl, 1);
-        tcp_set_nonblocking(&clientfd);
-        NonBlockingSSL_Accept(ssl);
-    } else if (SSL_accept(ssl) != SSL_SUCCESS) {
-        int err = SSL_get_error(ssl, 0);
-        char buffer[CYASSL_MAX_ERROR_SZ];
-        printf("error = %d, %s\n", err, ERR_error_string(err, buffer));
-        err_sys("SSL_accept failed");
-    }
-#else
-    NonBlockingSSL_Accept(ssl);
-#endif
-    showPeer(ssl);
-
-    idx = SSL_read(ssl, input, sizeof(input)-1);
-    if (idx > 0) {
-        input[idx] = 0;
-        printf("Client message: %s\n", input);
-
-    }
-    else if (idx < 0) {
-        int readErr = SSL_get_error(ssl, 0);
-        if (readErr != SSL_ERROR_WANT_READ)
-            err_sys("SSL_read failed");
-    }
-
-    if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg))
-        err_sys("SSL_write failed");
-        
-    #if defined(CYASSL_MDK_SHELL) && defined(HAVE_MDK_RTX)
-        os_dly_wait(500) ;
-    #endif
-
-    SSL_shutdown(ssl);
-    SSL_free(ssl);
-    SSL_CTX_free(ctx);
-    
-    CloseSocket(clientfd);
-    ((func_args*)args)->return_code = 0;
-
-#ifdef USE_CYASSL_MEMORY
-    if (trackMemory)
-        ShowMemoryTracker();
-#endif /* USE_CYASSL_MEMORY */
-
-    return 0;
-}
-
-
-/* so overall tests can pull in test function */
-#ifndef NO_MAIN_DRIVER
-
-    int main(int argc, char** argv)
-    {
-        func_args args;
-
-#ifdef HAVE_CAVIUM
-        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
-        if (ret != 0)
-            err_sys("Cavium OpenNitroxDevice failed");
-#endif /* HAVE_CAVIUM */
-
-        StartTCP();
-
-        args.argc = argc;
-        args.argv = argv;
-
-        CyaSSL_Init();
-#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL)
-        CyaSSL_Debugging_ON();
-#endif
-        if (CurrentDir("server"))
-            ChangeDirBack(2);
-        else if (CurrentDir("Debug") || CurrentDir("Release"))
-            ChangeDirBack(3);
-   
-#ifdef HAVE_STACK_SIZE
-        StackSizeCheck(&args, server_test);
-#else 
-        server_test(&args);
-#endif
-        CyaSSL_Cleanup();
-
-#ifdef HAVE_CAVIUM
-        CspShutdown(CAVIUM_DEV_ID);
-#endif
-        return args.return_code;
-    }
-
-    int myoptind = 0;
-    char* myoptarg = NULL;
-
-#endif /* NO_MAIN_DRIVER */
-
-
-#ifdef CYASSL_CALLBACKS
-
-    int srvHandShakeCB(HandShakeInfo* info)
-    {
-        (void)info;
-        return 0;
-    }
-
-
-    int srvTimeoutCB(TimeoutInfo* info)
-    {
-        (void)info;
-        return 0;
-    }
-
-#endif
-
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/shell.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/shell.c
deleted file mode 100644
index 7103e5731..000000000
--- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/shell.c
+++ /dev/null
@@ -1,657 +0,0 @@
-/*shell.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
- */
- 
- /*** tiny Shell for CyaSSL apps ***/
- 
- #ifdef HAVE_CONFIG_H
-    #include 
-#endif
-
-#include "cyassl/internal.h"
-#undef RNG
-#include 
-
-#if defined(CYASSL_MDK_ARM)
-    #include 
-    #include 
-    #include 
-        #if defined(CYASSL_MDK5)
-            #include "cmsis_os.h"
-        #include "rl_fs.h" 
-    #else
-            #include 
-        #endif
-    #include "cyassl_MDK_ARM.h"
-#endif
-
-#ifdef CYASSL_KEIL_NET
-#include "cyassl/test.h"
-#else
-typedef struct func_args {
-    int    argc;
-    char** argv;
-    int    return_code;
-} func_args;
-#endif
-
-#ifdef NO_ECHOCLIENT
-#define echoclient_test command_not_found
-#endif
-#ifdef NO_ECHOSERVER
-#define echoserver_test command_not_found
-#endif
-#ifdef NO_SIMPLE_CLIENT
-#define client_test command_not_found
-#endif
-#ifdef NO_SIMPLE_SERVER
-#define server_test command_not_found
-#endif
-#ifdef NO_CRYPT_BENCHMARK
-#define benchmark_test command_not_found
-#endif
-#ifdef NO_CRYPT_TEST
-#define ctaocrypt_test command_not_found
-#endif
-
-#ifndef CYASSL_KEIL_NET
-#define ipaddr_comm command_not_found
-#endif
-
-#if !defined(HAVE_KEIL_RTX)
-#define stack_comm command_not_found
-#endif
-
-
-#if !defined(DEBUG_CYASSL)
-#define dbg_comm command_not_found
-#endif
-
-
-void command_not_found(void *argv) {
-        printf("Command not found\n") ;
-}
-
-extern void echoclient_test(void *args) ;
-extern void echoserver_test(void *args) ;
-extern void benchmark_test(void *args) ;
-extern void ctaocrypt_test(void *args) ;
-extern void client_test(void *args) ;
-extern void server_test(void *args) ;
-extern void kill_task(void *args) ;
-extern void ipaddr_comm(void *args) ;
-extern void stack_comm(void *args) ;
-extern void for_command(void *args) ;
-extern void dbg_comm(void *arg) ;
-extern void help_comm(void *arg) ;
-
-#if !defined(NO_CRYPT_TEST)
-
-#ifndef NO_MD5
-extern void md5_test(void *arg) ;
-#endif
-#ifdef CYASSL_MD2
-extern void md2_test(void *arg) ;
-#endif
-#ifndef NO_MD4
-extern void md4_test(void *arg) ;
-#endif
-
-extern void sha_test(void *arg) ;
-
-#ifndef NO_SHA256
-extern void sha256_test(void *arg) ;
-#endif
-#ifdef CYASSL_SHA384
-extern void sha384_test(void *arg) ;
-#endif
-
-#ifdef CYASSL_SHA512
-extern void sha512_test(void *arg) ;
-#endif
-
-#ifdef CYASSL_RIPEMD
-extern void ripemd_test(void *arg) ;
-#endif
-#ifndef NO_HMAC
-    #ifndef NO_MD5
-extern void hmac_md5_test(void *arg) ;
-    #endif
-extern void hmac_sha_test(void *arg) ;
-
-    #ifndef NO_SHA256
-extern void hmac_sha256_test(void *arg) ;
-    #endif
-
-    #ifdef CYASSL_SHA384
-extern void hmac_sha384_test(void *arg) ;
-    #endif
-#endif
-#ifndef NO_RC4
-extern void arc4_test(void *arg) ;
-#endif
-
-#ifndef NO_HC128
-extern void hc128_test(void *arg) ;
-#endif
-
-#ifndef NO_RABBIT
-extern void rabbit_test(void *arg) ;
-#endif
-
-#ifndef NO_DES3
-extern void des_test(void *arg) ;
-extern void des3_test(void *arg) ;
-#endif
-
-#ifndef NO_AES
-extern void aes_test(void *arg) ;
-#ifdef HAVE_AESGCM
-extern void aesgcm_test(void *arg) ;
-#endif
-
-#ifdef HAVE_AESCCM
-extern void aesccm_test(void *arg) ;
-#endif
-#endif
-
-#ifdef HAVE_CAMELLIA
-extern void camellia_test(void *arg) ;
-#endif
-extern void random_test(void *arg) ;
-
-#ifndef NO_RSA
-extern void rsa_test(void *arg) ;
-#endif
-
-#ifndef NO_DH
-extern void dh_test(void *arg) ;
-#endif
-
-#ifndef NO_DSA
-extern void dsa_test(void *arg) ;
-#endif
-    
-#ifndef NO_PWDBASED
-extern void pwdbased_test(void *arg) ;
-#endif
-
-#ifdef OPENSSL_EXTRA
-extern void openssl_test(void *arg) ;
-#endif
-
-#ifdef HAVE_ECC
-extern void ecc_test(void *arg) ;
-#endif
-
-#endif /* NO_CRYPT_TEST */
-
-static struct {
-  const char *command ;
-    void (*func)(void *args) ;
-}   commandTable[] = {
-    "echoclient", echoclient_test,
-    "echoserver", echoserver_test,
-    "benchmark", benchmark_test,
-    "test", ctaocrypt_test,
-    "client", client_test,
-    "server", server_test,
-    "ipaddr", ipaddr_comm,      /* TBD */
-    "stack", stack_comm,        /* On/Off check stack size */
-    "for", for_command,         /* iterate next command X times */
-    "debug", dbg_comm,          /* On/Off debug message  */
-    "help", help_comm,          /* Breif description about the commands */
-
-    /** short name **/
-    "ec", echoclient_test,
-    "es", echoserver_test,
-    "bm", benchmark_test,
-    "te", ctaocrypt_test,
-    "cl", client_test,
-    "sv", server_test,
-    "ip", ipaddr_comm,
-    "st", stack_comm,
-  "dbg", dbg_comm,
-    "?",    help_comm,
-
-/*** test suites ****/
-#if !defined(NO_CRYPT_TEST)
-#ifndef NO_MD5
-  "md5",  md5_test,
-#endif
-#ifdef CYASSL_MD2
-  "md2",  md2_test,
-#endif
-#ifndef NO_MD4
-  "md4",  md4_test,
-#endif
-  "sha",  sha_test,
-#ifndef NO_SHA256
-  "sha256",  sha256_test,
-#endif
-#ifdef CYASSL_SHA384
-  "sha384",  sha384_test,
-#endif
-#ifdef CYASSL_SHA512
-  "sha512",  sha512_test,
-#endif
-#ifdef CYASSL_RIPEMD
-  "ripemd",  ripemd_test,
-#endif
-#ifndef NO_HMAC
-  #ifndef NO_MD5
-  "hmac_md5",  hmac_md5_test,
-    #endif
-  "hmac_sha",  hmac_sha_test,
-    #ifndef NO_SHA256
-  "hmac_sha256",  hmac_sha256_test,
-    #endif
-    #ifdef CYASSL_SHA384
-  "hmac_sha384",  hmac_sha384_test,
-  #endif
-#endif
-#ifndef NO_RC4
-    "arc4",  arc4_test,
-#endif
-#ifndef NO_HC128
-  "hc128",  hc128_test,
-#endif
-#ifndef NO_RABBIT
-  "rabbit",  rabbit_test,
-#endif
-#ifndef NO_DES3
-  "des",  des_test,
-  "des3",  des3_test,
-#endif  
-#ifndef NO_AES  
-  "aes",  aes_test,
-    #ifdef HAVE_AESGCM
-  "aesgcm",  aesgcm_test,
-    #endif
-    #ifdef HAVE_AESCCM
-  "aesccm",  aesccm_test,
-    #endif
-#endif
-
-#ifdef HAVE_CAMELLIA
-  "camellia",  camellia_test,
-#endif
-  "random",  random_test,
-#ifndef NO_RSA
-  "rsa",  rsa_test,
-#endif
-#ifndef NO_DH
-  "dh",  dh_test,
-#endif
-#ifndef NO_DSA
-    "dsa",  dsa_test,
-#endif 
-#ifndef NO_PWDBASED
-  "pwdbased",  pwdbased_test,
-#endif  
-#ifdef OPENSSL_EXTRA
-  "openssl",  openssl_test,
-#endif
-#ifdef HAVE_ECC
-  "ecc",  ecc_test,
-#endif
-
-#endif /* NO_CRYPT_TEST */
-
-    "",  NULL
-} ;
-
-enum jobtype { FORGROUND, BACKGROUND }  ;
-
-#define IF_DELIMITER(ch) ((ch) == ' ' || (ch) == '\n')
-
-static int BackGround = 0 ; /* 1: background job is running */
-
-/*******  Get Command Line *****************************/
-static int getline(char * line, int sz, func_args *args, int*bf_flg) 
-{
-    char * ret ;
-    int i ;
-    
-    #define MAXARGS 10
-    #define MAXARGLEN 30
-    static char *argv[MAXARGS] ;
-    args->argv = argv ;
-    
-    putchar('>') ;
-    fflush(stdout) ;
-    ret = fgets(line, sz, stdin) ;
-    
-    #define SHELL_ERROR_FGETS -102
-    if(ret != line) return(SHELL_ERROR_FGETS) ;
-    
-    if(line[strlen(line)-2] == '&') {
-        (*bf_flg) = BACKGROUND ;
-        line[strlen(line)-2] = '\n' ;
-    } else {
-        (*bf_flg) = FORGROUND ;
-    }
-    args->argc = 0 ;
-    for(i=0; iargv[args->argc] = &(line[i]) ;
-        while(!IF_DELIMITER(line[i])) i++ ;
-        args->argc++ ;
-        if(line[i] == '\n') {
-            line[i]  = '\0' ;
-            break ;
-        } else {
-            line[i]  = '\0' ;
-        }
-    }
-    return i ;
-}
-
-
-/************* Embedded Shell Commands **********************************/
-#define IP_SIZE 16
-
-#ifdef CYASSL_KEIL_NET
-static void ipaddr_comm(void *args) 
-{
-    if(((func_args *)args)->argc == 1) {
-            printf("IP addr: %s, port %d\n", yasslIP, yasslPort) ;
-    } else {
-        if(BackGround != 0) {
-        printf("Cannot change IP addr while background server is running\n") ;
-        } else if(((func_args *)args)->argc == 3 && 
-                  ((func_args *)args)->argv[1][0] == '-'&& 
-                  ((func_args *)args)->argv[1][1] == 'a' ) {
-/*          strcpy(yasslIP, ((func_args *)args)->argv[2]) ; */
-        } else if(((func_args *)args)->argc == 3 && 
-                  ((func_args *)args)->argv[1][0] == '-' && 
-                  ((func_args *)args)->argv[1][1] == 'p' ) {
-/*          yasslPort = atoi(((func_args *)args)->argv[2]) ; */
-        } else printf("Invalid argument\n") ; 
-    }
-}
-
-#endif
-
-
-
-#if defined(HAVE_KEIL_RTX)
-static int stack_ck = 0 ;
-
-void stack_comm(void *args) 
-{
-    if(stack_ck) {
-        printf("Stack Check: Off\n") ;
-        stack_ck = 0 ;
-    } else {
-        printf("Stack Check: On\n") ;
-        stack_ck = 1 ;
-    }
-}
-    
-#define FILL_PATTERN 0xa596695a
-void stack_fill(char * stack, int size)
-{
-    int i ;
-
-    if(stack_ck == 0)return ;
-    for(i=1; iargc == 1) {
-        printf("For %d times\n", for_iteration) ;
-    } else if( args == NULL || ((func_args *)args)->argc == 2) {
-        for_iteration = atoi(((func_args *)args)->argv[1]) ;
-    } else printf("Invalid argument\n") ;
-}
-
-
-#if defined(DEBUG_CYASSL)
-
-static int CyasslDebug = 1 ;
-
-static void dbg_comm(void *args) 
-{
-    if(CyasslDebug == 1) {
-        CyasslDebug = 0 ;
-        printf("Turning OFF Debug message\n") ;
-        CyaSSL_Debugging_OFF() ;
-    } else {
-        CyasslDebug = 1 ;
-        printf("Turning ON Debug message\n") ;
-        CyaSSL_Debugging_ON() ;
-    }
-}
-#endif
-
-static void help_comm(void *args) 
-{
-    static char *commands[] = {
-        "test", 
-        "benchmark",
-        "echoserver&            : simple echo server in background mode",
-        "echoclient             : simple echo client followed by any input string, or \"quit\", \"break\"",
-        "server&                : simple server in background mode",
-        "client                 : simple client",
-        "client -g -v [0123] -h xxx.xxx.xxx.xxx -p 443  : usage example",
-        "server/client -h        :  help for server/client command",
-        "help",
-        ""  
-    } ;
-
-    int i ;
-    printf("Commands:\n") ;
-    for(i=0; commands[i][0] ; i++)
-        printf("    %s\n", commands[i]) ;
-
-}
-
-
-
-#define BG_JOB_STACK_SIZE 8000
-#if (!defined(NO_SIMPLE_SERVER) && !defined(NO_ECHOSERVER)) && \
-                                                   defined(HAVE_KEIL_RTX)
-#if !defined(CYASSL_CMSIS_RTOS)
-static char bg_job_stack[BG_JOB_STACK_SIZE] ;
-#endif
-
-#endif
-
-#define COMMAND_STACK_SIZE 10000
-#if defined(HAVE_KEIL_RTX) && !defined(CYASSL_CMSIS_RTOS)
-static char command_stack[COMMAND_STACK_SIZE] ;
-#endif
-
-
-#ifdef  HAVE_KEIL_RTX
-static   CyaSSL_Mutex command_mutex ;
-#endif
-
-void exit_command(void) {
-	  printf("Command Aborted\n") ;
-    #ifdef CYASSL_CMSIS_RTOS
-        osThreadTerminate(osThreadGetId()) ;
-    #else
-        os_tsk_delete_self() ;
-    #endif
-}
-
-
-/***********    Invoke Forground Command  *********************/
-static void command_invoke(void const *args) 
-{
-    void (*func)(void const * ) ;
-    int i,iteration ;
-    
-    func = (void(*)(void const *))((func_args *)args)->argv[0] ; 
-    #ifdef  HAVE_KEIL_RTX
-    LockMutex((CyaSSL_Mutex *)&command_mutex) ;
-    #endif
-    iteration = for_iteration ;
-    for(i=0; i< iteration; i++) {
-        if(iteration > 1) printf("--- Start for %d ---->\n", i) ;
-        #if defined(HAVE_KEIL_RTX) && !defined(CYASSL_CMSIS_RTOS)
-        stack_fill(command_stack, COMMAND_STACK_SIZE) ;
-        #endif
-                
-        func(args) ;        /* invoke command */
-                
-        #if defined(HAVE_KEIL_RTX)&& !defined(CYASSL_CMSIS_RTOS)
-        stack_check(command_stack, COMMAND_STACK_SIZE) ;
-        #endif
-    }
-
-    if(iteration > 1) 
-    for_iteration = 1 ;
-    osDelay(20000) ;
-    #ifdef HAVE_KEIL_RTX
-        UnLockMutex((CyaSSL_Mutex *)&command_mutex) ;
-        #ifdef CYASSL_CMSIS_RTOS
-            osThreadTerminate(osThreadGetId()) ;
-        #else
-            os_tsk_delete_self() ;
-        #endif
-    #endif
-}
-
-#if defined(HAVE_KEIL_RTX)
-/*******  Invoke Background Job   *******************************/
-static void bg_job_invoke(void const *args) 
-{
-    void (*func)(void const * ) ;
-    BackGround = 1 ; 
-    #if defined(HAVE_KEIL_RTX)&& !defined(CYASSL_CMSIS_RTOS)
-    stack_fill(bg_job_stack, BG_JOB_STACK_SIZE) ;
-    #endif
-
-    func = (void(*)(void const *))((func_args *)args)->argv[0] ; 
-    func(args) ;        /* invoke command */
-    #if defined(HAVE_KEIL_RTX) && !defined(CYASSL_CMSIS_RTOS)
-    stack_check(bg_job_stack, BG_JOB_STACK_SIZE) ;
-    #endif
-    
-    osDelay(20000) ;
-    BackGround = 0 ;
-
-    #ifdef CYASSL_CMSIS_RTOS
-        osThreadTerminate(osThreadGetId()) ;
-    #else   
-        os_tsk_delete_self() ; ;
-    #endif
-}
-#endif
-
-#define LINESIZE 100
-static char line[LINESIZE] ;
-
-#if defined(CYASSL_CMSIS_RTOS)
-    osThreadDef (command_invoke, osPriorityAboveNormal , 1, COMMAND_STACK_SIZE) ;
-    osThreadDef (bg_job_invoke, osPriorityNormal , 1 , BG_JOB_STACK_SIZE) ;
-#endif
-/********* SHEULL MAIN LOOP ***********************************/
-void shell_main(void *arg) {
-    int i ; 
-    func_args args ;
-    int bf_flg ;
-   
-    i = BackGround ; 
-        /* Dummy for avoiding warning: BackGround is defined but not used. */
-    
- #if defined(HAVE_KEIL_RTX)
-    InitMutex(&command_mutex) ;
-#endif
-    help_comm(NULL) ;
-    
-    printf("Starting Shell\n") ;
-    while(1) {
-        if(getline(line,  LINESIZE, &args, &bf_flg) > 0) {
-        for(i=0; commandTable[i].func != NULL; i++) {
-            if(strcmp(commandTable[i].command, args.argv[0]) == 0) {
-            args.argv[0] = (char *) commandTable[i].func ;
-                if(bf_flg == FORGROUND) {
-                    #if defined(HAVE_KEIL_RTX) && !defined(CYASSL_CMSIS_RTOS)
-                        UnLockMutex((CyaSSL_Mutex *)&command_mutex) ;
-                        os_tsk_create_user_ex( (void(*)(void *))&command_invoke, 7,
-                                 command_stack, COMMAND_STACK_SIZE, &args) ;
-                    #else
-                        #if defined(CYASSL_CMSIS_RTOS)
-                             UnLockMutex((CyaSSL_Mutex *)&command_mutex) ;
-                             osThreadCreate (osThread (command_invoke) , &args);   
-                        #else
-                              command_invoke(&args) ;
-                        #endif
-                    #endif
-                    #ifdef  HAVE_KEIL_RTX
-                    LockMutex((CyaSSL_Mutex *)&command_mutex) ;
-                    #endif
-                } else {
-                    #if (!defined(NO_SIMPLE_SERVER) && \
-                         !defined(NO_ECHOSERVER)) && \
-                         defined(HAVE_KEIL_RTX)
-                    if(BackGround != 0) {
-                        printf("Multiple background servers not supported.\n") ;
-                    } else {
-                        printf("\"%s\" is running with the background mode.\n", 
-                                                     commandTable[i].command) ;
-                        #if  defined(HAVE_KEIL_RTX) && !defined(CYASSL_CMSIS_RTOS)
-                             os_tsk_create_user_ex( (void(*)(void *))&bg_job_invoke, 
-                                   6, bg_job_stack, BG_JOB_STACK_SIZE, &args) ;
-                        #else
-                                osThreadCreate (osThread (bg_job_invoke),  &args); 
-                                osDelay (500) ;
-                        #endif
-                    }
-                    #else
-                    printf("Invalid Command: no background job\n") ;
-                    #endif
-                }
-                break ;
-            }
-        }
-        if(commandTable[i].func == NULL)
-            printf("Command not found\n") ;
-        }
-    }
-}
-
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/test.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/test.c
deleted file mode 100644
index 751cfdf85..000000000
--- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/test.c
+++ /dev/null
@@ -1,4758 +0,0 @@
-/* test.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 
-#endif
-
-#include 
-
-#ifdef XMALLOC_USER
-    #include   /* we're using malloc / free direct here */
-#endif
-
-#ifndef NO_CRYPT_TEST
-
-#ifdef CYASSL_TEST_CERT
-    #include 
-#else
-    #include 
-#endif
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#ifdef HAVE_ECC
-    #include 
-#endif
-#ifdef HAVE_BLAKE2
-    #include 
-#endif
-#ifdef HAVE_LIBZ
-    #include 
-#endif
-#ifdef HAVE_PKCS7
-    #include 
-#endif
-
-#ifdef _MSC_VER
-    /* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */
-    #pragma warning(disable: 4996)
-#endif
-
-#ifdef OPENSSL_EXTRA
-    #include 
-    #include 
-    #include 
-    #include 
-#endif
-
-
-#if defined(USE_CERT_BUFFERS_1024) || defined(USE_CERT_BUFFERS_2048)
-    /* include test cert and key buffers for use with NO_FILESYSTEM */
-    #if defined(CYASSL_MDK_ARM)
-        #include "cert_data.h"
-                        /* use certs_test.c for initial data, so other
-                                               commands can share the data. */
-    #else
-        #include 
-    #endif
-#endif
-
-#if defined(CYASSL_MDK_ARM)
-        #include 
-        #include 
-    extern FILE * CyaSSL_fopen(const char *fname, const char *mode) ;
-    #define fopen CyaSSL_fopen
-#endif
-
-#ifdef HAVE_NTRU
-    #include "crypto_ntru.h"
-#endif
-#ifdef HAVE_CAVIUM
-    #include "cavium_sysdep.h"
-    #include "cavium_common.h"
-    #include "cavium_ioctl.h"
-#endif
-
-#ifdef FREESCALE_MQX
-    #include 
-    #include 
-    #include 
-#else
-    #include 
-#endif
-
-
-#ifdef THREADX
-    /* since just testing, use THREADX log printf instead */
-    int dc_log_printf(char*, ...);
-        #undef printf
-        #define printf dc_log_printf
-#endif
-
-#include "ctaocrypt/test/test.h"
-
-
-typedef struct testVector {
-    const char*  input;
-    const char*  output;
-    size_t inLen;
-    size_t outLen;
-} testVector;
-
-int  md2_test(void);
-int  md5_test(void);
-int  md4_test(void);
-int  sha_test(void);
-int  sha256_test(void);
-int  sha512_test(void);
-int  sha384_test(void);
-int  hmac_md5_test(void);
-int  hmac_sha_test(void);
-int  hmac_sha256_test(void);
-int  hmac_sha384_test(void);
-int  hmac_sha512_test(void);
-int  hmac_blake2b_test(void);
-int  hkdf_test(void);
-int  arc4_test(void);
-int  hc128_test(void);
-int  rabbit_test(void);
-int  des_test(void);
-int  des3_test(void);
-int  aes_test(void);
-int  aesgcm_test(void);
-int  gmac_test(void);
-int  aesccm_test(void);
-int  camellia_test(void);
-int  rsa_test(void);
-int  dh_test(void);
-int  dsa_test(void);
-int  random_test(void);
-int  pwdbased_test(void);
-int  ripemd_test(void);
-int  openssl_test(void);   /* test mini api */
-int pbkdf1_test(void);
-int pkcs12_test(void);
-int pbkdf2_test(void);
-#ifdef HAVE_ECC
-    int  ecc_test(void);
-    #ifdef HAVE_ECC_ENCRYPT
-        int  ecc_encrypt_test(void);
-    #endif
-#endif
-#ifdef HAVE_BLAKE2
-    int  blake2b_test(void);
-#endif
-#ifdef HAVE_LIBZ
-    int compress_test(void);
-#endif
-#ifdef HAVE_PKCS7
-    int pkcs7enveloped_test(void);
-    int pkcs7signed_test(void);
-#endif
-
-
-
-static void err_sys(const char* msg, int es)
-{
-    printf("%s error = %d\n", msg, es);
-    #if !defined(THREADX) && !defined(CYASSL_MDK_ARM)
-  	if (msg)
-        exit(es);
-    #endif
-    return;
-}
-
-/* func_args from test.h, so don't have to pull in other junk */
-typedef struct func_args {
-    int    argc;
-    char** argv;
-    int    return_code;
-} func_args;
-
-
-
-void ctaocrypt_test(void* args)
-{
-    int ret = 0;
-
-    ((func_args*)args)->return_code = -1; /* error state */
-
-#if !defined(NO_BIG_INT)
-    if (CheckCtcSettings() != 1)
-        err_sys("Build vs runtime math mismatch\n", -1234);
-
-#ifdef USE_FAST_MATH
-    if (CheckFastMathSettings() != 1)
-        err_sys("Build vs runtime fastmath FP_MAX_BITS mismatch\n", -1235);
-#endif /* USE_FAST_MATH */
-#endif /* !NO_BIG_INT */
-
-
-#ifndef NO_MD5
-    if ( (ret = md5_test()) != 0)
-        err_sys("MD5      test failed!\n", ret);
-    else
-        printf( "MD5      test passed!\n");
-#endif
-
-#ifdef CYASSL_MD2
-    if ( (ret = md2_test()) != 0)
-        err_sys("MD2      test failed!\n", ret);
-    else
-        printf( "MD2      test passed!\n");
-#endif
-
-#ifndef NO_MD4
-    if ( (ret = md4_test()) != 0)
-        err_sys("MD4      test failed!\n", ret);
-    else
-        printf( "MD4      test passed!\n");
-#endif
-
-#ifndef NO_SHA
-    if ( (ret = sha_test()) != 0)
-        err_sys("SHA      test failed!\n", ret);
-    else
-        printf( "SHA      test passed!\n");
-#endif
-
-#ifndef NO_SHA256
-    if ( (ret = sha256_test()) != 0)
-        err_sys("SHA-256  test failed!\n", ret);
-    else
-        printf( "SHA-256  test passed!\n");
-#endif
-
-#ifdef CYASSL_SHA384
-    if ( (ret = sha384_test()) != 0)
-        err_sys("SHA-384  test failed!\n", ret);
-    else
-        printf( "SHA-384  test passed!\n");
-#endif
-
-#ifdef CYASSL_SHA512
-    if ( (ret = sha512_test()) != 0)
-        err_sys("SHA-512  test failed!\n", ret);
-    else
-        printf( "SHA-512  test passed!\n");
-#endif
-
-#ifdef CYASSL_RIPEMD
-    if ( (ret = ripemd_test()) != 0)
-        err_sys("RIPEMD   test failed!\n", ret);
-    else
-        printf( "RIPEMD   test passed!\n");
-#endif
-
-#ifdef HAVE_BLAKE2
-    if ( (ret = blake2b_test()) != 0)
-        err_sys("BLAKE2b  test failed!\n", ret);
-    else
-        printf( "BLAKE2b  test passed!\n");
-#endif
-
-#ifndef NO_HMAC
-    #ifndef NO_MD5
-        if ( (ret = hmac_md5_test()) != 0)
-            err_sys("HMAC-MD5 test failed!\n", ret);
-        else
-            printf( "HMAC-MD5 test passed!\n");
-    #endif
-
-    #ifndef NO_SHA
-    if ( (ret = hmac_sha_test()) != 0)
-        err_sys("HMAC-SHA test failed!\n", ret);
-    else
-        printf( "HMAC-SHA test passed!\n");
-    #endif
-
-    #ifndef NO_SHA256
-        if ( (ret = hmac_sha256_test()) != 0)
-            err_sys("HMAC-SHA256 test failed!\n", ret);
-        else
-            printf( "HMAC-SHA256 test passed!\n");
-    #endif
-
-    #ifdef CYASSL_SHA384
-        if ( (ret = hmac_sha384_test()) != 0)
-            err_sys("HMAC-SHA384 test failed!\n", ret);
-        else
-            printf( "HMAC-SHA384 test passed!\n");
-    #endif
-
-    #ifdef CYASSL_SHA512
-        if ( (ret = hmac_sha512_test()) != 0)
-            err_sys("HMAC-SHA512 test failed!\n", ret);
-        else
-            printf( "HMAC-SHA512 test passed!\n");
-    #endif
-
-    #ifdef HAVE_BLAKE2
-        if ( (ret = hmac_blake2b_test()) != 0)
-            err_sys("HMAC-BLAKE2 test failed!\n", ret);
-        else
-            printf( "HMAC-BLAKE2 test passed!\n");
-    #endif
-
-    #ifdef HAVE_HKDF
-        if ( (ret = hkdf_test()) != 0)
-            err_sys("HMAC-KDF    test failed!\n", ret);
-        else
-            printf( "HMAC-KDF    test passed!\n");
-    #endif
-
-#endif
-
-#ifdef HAVE_AESGCM
-    if ( (ret = gmac_test()) != 0)
-        err_sys("GMAC     test passed!\n", ret);
-    else
-        printf( "GMAC     test passed!\n");
-#endif
-
-#ifndef NO_RC4
-    if ( (ret = arc4_test()) != 0)
-        err_sys("ARC4     test failed!\n", ret);
-    else
-        printf( "ARC4     test passed!\n");
-#endif
-
-#ifndef NO_HC128
-    if ( (ret = hc128_test()) != 0)
-        err_sys("HC-128   test failed!\n", ret);
-    else
-        printf( "HC-128   test passed!\n");
-#endif
-
-#ifndef NO_RABBIT
-    if ( (ret = rabbit_test()) != 0)
-        err_sys("Rabbit   test failed!\n", ret);
-    else
-        printf( "Rabbit   test passed!\n");
-#endif
-
-#ifndef NO_DES3
-    if ( (ret = des_test()) != 0)
-        err_sys("DES      test failed!\n", ret);
-    else
-        printf( "DES      test passed!\n");
-#endif
-
-#ifndef NO_DES3
-    if ( (ret = des3_test()) != 0)
-        err_sys("DES3     test failed!\n", ret);
-    else
-        printf( "DES3     test passed!\n");
-#endif
-
-#ifndef NO_AES
-    if ( (ret = aes_test()) != 0)
-        err_sys("AES      test failed!\n", ret);
-    else
-        printf( "AES      test passed!\n");
-
-#ifdef HAVE_AESGCM
-    if ( (ret = aesgcm_test()) != 0)
-        err_sys("AES-GCM  test failed!\n", ret);
-    else
-        printf( "AES-GCM  test passed!\n");
-#endif
-
-#ifdef HAVE_AESCCM
-    if ( (ret = aesccm_test()) != 0)
-        err_sys("AES-CCM  test failed!\n", ret);
-    else
-        printf( "AES-CCM  test passed!\n");
-#endif
-#endif
-
-#ifdef HAVE_CAMELLIA
-    if ( (ret = camellia_test()) != 0)
-        err_sys("CAMELLIA test failed!\n", ret);
-    else
-        printf( "CAMELLIA test passed!\n");
-#endif
-
-    if ( (ret = random_test()) != 0)
-        err_sys("RANDOM   test failed!\n", ret);
-    else
-        printf( "RANDOM   test passed!\n");
-
-#ifndef NO_RSA
-    if ( (ret = rsa_test()) != 0)
-        err_sys("RSA      test failed!\n", ret);
-    else
-        printf( "RSA      test passed!\n");
-#endif
-
-#ifndef NO_DH
-    if ( (ret = dh_test()) != 0)
-        err_sys("DH       test failed!\n", ret);
-    else
-        printf( "DH       test passed!\n");
-#endif
-
-#ifndef NO_DSA
-    if ( (ret = dsa_test()) != 0)
-        err_sys("DSA      test failed!\n", ret);
-    else
-        printf( "DSA      test passed!\n");
-#endif
-
-#ifndef NO_PWDBASED
-    if ( (ret = pwdbased_test()) != 0)
-        err_sys("PWDBASED test failed!\n", ret);
-    else
-        printf( "PWDBASED test passed!\n");
-#endif
-
-#ifdef OPENSSL_EXTRA
-    if ( (ret = openssl_test()) != 0)
-        err_sys("OPENSSL  test failed!\n", ret);
-    else
-        printf( "OPENSSL  test passed!\n");
-#endif
-
-#ifdef HAVE_ECC
-    if ( (ret = ecc_test()) != 0)
-        err_sys("ECC      test failed!\n", ret);
-    else
-        printf( "ECC      test passed!\n");
-    #ifdef HAVE_ECC_ENCRYPT
-        if ( (ret = ecc_encrypt_test()) != 0)
-            err_sys("ECC Enc  test failed!\n", ret);
-        else
-            printf( "ECC Enc  test passed!\n");
-    #endif
-#endif
-
-#ifdef HAVE_LIBZ
-    if ( (ret = compress_test()) != 0)
-        err_sys("COMPRESS test failed!\n", ret);
-    else
-        printf( "COMPRESS test passed!\n");
-#endif
-
-#ifdef HAVE_PKCS7
-    if ( (ret = pkcs7enveloped_test()) != 0)
-        err_sys("PKCS7enveloped test failed!\n", ret);
-    else
-        printf( "PKCS7enveloped test passed!\n");
-
-    if ( (ret = pkcs7signed_test()) != 0)
-        err_sys("PKCS7signed    test failed!\n", ret);
-    else
-        printf( "PKCS7signed    test passed!\n");
-#endif
-
-    ((func_args*)args)->return_code = ret;
-}
-
-
-#ifndef NO_MAIN_DRIVER
-
-#ifdef HAVE_CAVIUM
-
-static int OpenNitroxDevice(int dma_mode,int dev_id)
-{
-   Csp1CoreAssignment core_assign;
-   Uint32             device;
-
-   if (CspInitialize(CAVIUM_DIRECT,CAVIUM_DEV_ID))
-      return -1;
-   if (Csp1GetDevType(&device))
-      return -1;
-   if (device != NPX_DEVICE) {
-      if (ioctl(gpkpdev_hdlr[CAVIUM_DEV_ID], IOCTL_CSP1_GET_CORE_ASSIGNMENT,
-                (Uint32 *)&core_assign)!= 0)
-         return -1;
-   }
-   CspShutdown(CAVIUM_DEV_ID);
-
-   return CspInitialize(dma_mode, dev_id);
-}
-
-#endif /* HAVE_CAVIUM */
-
-    /* so overall tests can pull in test function */
-
-    int main(int argc, char** argv)
-    {
-
-        func_args args;
-
-
-#ifdef HAVE_CAVIUM
-        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
-        if (ret != 0)
-            err_sys("Cavium OpenNitroxDevice failed", -1236);
-#endif /* HAVE_CAVIUM */
-
-        args.argc = argc;
-        args.argv = argv;
-
-        ctaocrypt_test(&args);
-
-#ifdef HAVE_CAVIUM
-        CspShutdown(CAVIUM_DEV_ID);
-#endif
-
-        return args.return_code;
-    }
-
-#endif /* NO_MAIN_DRIVER */
-
-
-#ifdef CYASSL_MD2
-int md2_test()
-{
-    Md2  md2;
-    byte hash[MD2_DIGEST_SIZE];
-
-    testVector a, b, c, d, e, f, g;
-    testVector test_md2[7];
-    int times = sizeof(test_md2) / sizeof(testVector), i;
-
-    a.input  = "";
-    a.output = "\x83\x50\xe5\xa3\xe2\x4c\x15\x3d\xf2\x27\x5c\x9f\x80\x69"
-               "\x27\x73";
-    a.inLen  = strlen(a.input);
-    a.outLen = MD2_DIGEST_SIZE;
-
-    b.input  = "a";
-    b.output = "\x32\xec\x01\xec\x4a\x6d\xac\x72\xc0\xab\x96\xfb\x34\xc0"
-               "\xb5\xd1";
-    b.inLen  = strlen(b.input);
-    b.outLen = MD2_DIGEST_SIZE;
-
-    c.input  = "abc";
-    c.output = "\xda\x85\x3b\x0d\x3f\x88\xd9\x9b\x30\x28\x3a\x69\xe6\xde"
-               "\xd6\xbb";
-    c.inLen  = strlen(c.input);
-    c.outLen = MD2_DIGEST_SIZE;
-
-    d.input  = "message digest";
-    d.output = "\xab\x4f\x49\x6b\xfb\x2a\x53\x0b\x21\x9f\xf3\x30\x31\xfe"
-               "\x06\xb0";
-    d.inLen  = strlen(d.input);
-    d.outLen = MD2_DIGEST_SIZE;
-
-    e.input  = "abcdefghijklmnopqrstuvwxyz";
-    e.output = "\x4e\x8d\xdf\xf3\x65\x02\x92\xab\x5a\x41\x08\xc3\xaa\x47"
-               "\x94\x0b";
-    e.inLen  = strlen(e.input);
-    e.outLen = MD2_DIGEST_SIZE;
-
-    f.input  = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345"
-               "6789";
-    f.output = "\xda\x33\xde\xf2\xa4\x2d\xf1\x39\x75\x35\x28\x46\xc3\x03"
-               "\x38\xcd";
-    f.inLen  = strlen(f.input);
-    f.outLen = MD2_DIGEST_SIZE;
-
-    g.input  = "1234567890123456789012345678901234567890123456789012345678"
-               "9012345678901234567890";
-    g.output = "\xd5\x97\x6f\x79\xd8\x3d\x3a\x0d\xc9\x80\x6c\x3c\x66\xf3"
-               "\xef\xd8";
-    g.inLen  = strlen(g.input);
-    g.outLen = MD2_DIGEST_SIZE;
-
-    test_md2[0] = a;
-    test_md2[1] = b;
-    test_md2[2] = c;
-    test_md2[3] = d;
-    test_md2[4] = e;
-    test_md2[5] = f;
-    test_md2[6] = g;
-
-    InitMd2(&md2);
-
-    for (i = 0; i < times; ++i) {
-        Md2Update(&md2, (byte*)test_md2[i].input, (word32)test_md2[i].inLen);
-        Md2Final(&md2, hash);
-
-        if (memcmp(hash, test_md2[i].output, MD2_DIGEST_SIZE) != 0)
-            return -155 - i;
-    }
-
-    return 0;
-}
-#endif
-
-#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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    test_md5[0] = a;
-    test_md5[1] = b;
-    test_md5[2] = c;
-    test_md5[3] = d;
-    test_md5[4] = e;
-
-    InitMd5(&md5);
-
-    for (i = 0; i < times; ++i) {
-        Md5Update(&md5, (byte*)test_md5[i].input, (word32)test_md5[i].inLen);
-        Md5Final(&md5, hash);
-
-        if (memcmp(hash, test_md5[i].output, MD5_DIGEST_SIZE) != 0)
-            return -5 - i;
-    }
-
-    return 0;
-}
-#endif /* NO_MD5 */
-
-
-#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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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;
-
-    InitMd4(&md4);
-
-    for (i = 0; i < times; ++i) {
-        Md4Update(&md4, (byte*)test_md4[i].input, (word32)test_md4[i].inLen);
-        Md4Final(&md4, hash);
-
-        if (memcmp(hash, test_md4[i].output, MD4_DIGEST_SIZE) != 0)
-            return -205 - i;
-    }
-
-    return 0;
-}
-
-#endif /* NO_MD4 */
-
-#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;
-    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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    test_sha[0] = a;
-    test_sha[1] = b;
-    test_sha[2] = c;
-    test_sha[3] = d;
-
-    ret = InitSha(&sha);
-    if (ret != 0)
-        return -4001;
-
-    for (i = 0; i < times; ++i) {
-        ShaUpdate(&sha, (byte*)test_sha[i].input, (word32)test_sha[i].inLen);
-        ShaFinal(&sha, hash);
-
-        if (memcmp(hash, test_sha[i].output, SHA_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-
-#endif /* NO_SHA */
-
-#ifdef CYASSL_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 = RIPEMD_DIGEST_SIZE;
-
-    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 = RIPEMD_DIGEST_SIZE;
-
-    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 = RIPEMD_DIGEST_SIZE;
-
-    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 = RIPEMD_DIGEST_SIZE;
-
-    test_ripemd[0] = a;
-    test_ripemd[1] = b;
-    test_ripemd[2] = c;
-    test_ripemd[3] = d;
-
-    InitRipeMd(&ripemd);
-
-    for (i = 0; i < times; ++i) {
-        RipeMdUpdate(&ripemd, (byte*)test_ripemd[i].input,
-                     (word32)test_ripemd[i].inLen);
-        RipeMdFinal(&ripemd, hash);
-
-        if (memcmp(hash, test_ripemd[i].output, RIPEMD_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-#endif /* CYASSL_RIPEMD */
-
-
-#ifdef HAVE_BLAKE2
-
-
-#define BLAKE2_TESTS 3
-
-static const byte blake2b_vec[BLAKE2_TESTS][BLAKE2B_OUTBYTES] =
-{
-  {
-    0x78, 0x6A, 0x02, 0xF7, 0x42, 0x01, 0x59, 0x03,
-    0xC6, 0xC6, 0xFD, 0x85, 0x25, 0x52, 0xD2, 0x72,
-    0x91, 0x2F, 0x47, 0x40, 0xE1, 0x58, 0x47, 0x61,
-    0x8A, 0x86, 0xE2, 0x17, 0xF7, 0x1F, 0x54, 0x19,
-    0xD2, 0x5E, 0x10, 0x31, 0xAF, 0xEE, 0x58, 0x53,
-    0x13, 0x89, 0x64, 0x44, 0x93, 0x4E, 0xB0, 0x4B,
-    0x90, 0x3A, 0x68, 0x5B, 0x14, 0x48, 0xB7, 0x55,
-    0xD5, 0x6F, 0x70, 0x1A, 0xFE, 0x9B, 0xE2, 0xCE
-  },
-  {
-    0x2F, 0xA3, 0xF6, 0x86, 0xDF, 0x87, 0x69, 0x95,
-    0x16, 0x7E, 0x7C, 0x2E, 0x5D, 0x74, 0xC4, 0xC7,
-    0xB6, 0xE4, 0x8F, 0x80, 0x68, 0xFE, 0x0E, 0x44,
-    0x20, 0x83, 0x44, 0xD4, 0x80, 0xF7, 0x90, 0x4C,
-    0x36, 0x96, 0x3E, 0x44, 0x11, 0x5F, 0xE3, 0xEB,
-    0x2A, 0x3A, 0xC8, 0x69, 0x4C, 0x28, 0xBC, 0xB4,
-    0xF5, 0xA0, 0xF3, 0x27, 0x6F, 0x2E, 0x79, 0x48,
-    0x7D, 0x82, 0x19, 0x05, 0x7A, 0x50, 0x6E, 0x4B
-  },
-  {
-    0x1C, 0x08, 0x79, 0x8D, 0xC6, 0x41, 0xAB, 0xA9,
-    0xDE, 0xE4, 0x35, 0xE2, 0x25, 0x19, 0xA4, 0x72,
-    0x9A, 0x09, 0xB2, 0xBF, 0xE0, 0xFF, 0x00, 0xEF,
-    0x2D, 0xCD, 0x8E, 0xD6, 0xF8, 0xA0, 0x7D, 0x15,
-    0xEA, 0xF4, 0xAE, 0xE5, 0x2B, 0xBF, 0x18, 0xAB,
-    0x56, 0x08, 0xA6, 0x19, 0x0F, 0x70, 0xB9, 0x04,
-    0x86, 0xC8, 0xA7, 0xD4, 0x87, 0x37, 0x10, 0xB1,
-    0x11, 0x5D, 0x3D, 0xEB, 0xBB, 0x43, 0x27, 0xB5
-  }
-};
-
-
-
-int blake2b_test(void)
-{
-    Blake2b b2b;
-    byte    digest[64];
-    byte    input[64];
-    int     i, ret;
-
-    for (i = 0; i < (int)sizeof(input); i++)
-        input[i] = (byte)i;
-
-    for (i = 0; i < BLAKE2_TESTS; i++) {
-        ret = InitBlake2b(&b2b, 64);
-        if (ret != 0)
-            return -4002;
-
-        ret = Blake2bUpdate(&b2b, input, i);
-        if (ret != 0)
-            return -4003;
-
-        ret = Blake2bFinal(&b2b, digest, 64);
-        if (ret != 0)
-            return -4004;
-
-        if (memcmp(digest, blake2b_vec[i], 64) != 0) {
-            return -300 - i;
-        }
-    }
-
-    return 0;
-}
-#endif /* HAVE_BLAKE2 */
-
-
-#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 = SHA256_DIGEST_SIZE;
-
-    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 = SHA256_DIGEST_SIZE;
-
-    test_sha[0] = a;
-    test_sha[1] = b;
-
-    ret = InitSha256(&sha);
-    if (ret != 0)
-        return -4005;
-
-    for (i = 0; i < times; ++i) {
-        ret = Sha256Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
-        if (ret != 0)
-            return -4006;
-        ret = Sha256Final(&sha, hash);
-        if (ret != 0)
-            return -4007;
-
-        if (memcmp(hash, test_sha[i].output, SHA256_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-#endif
-
-
-#ifdef CYASSL_SHA512
-int sha512_test(void)
-{
-    Sha512 sha;
-    byte   hash[SHA512_DIGEST_SIZE];
-    int    ret;
-
-    testVector a, b;
-    testVector test_sha[2];
-    int times = sizeof(test_sha) / sizeof(struct testVector), i;
-
-    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 = SHA512_DIGEST_SIZE;
-
-    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 = SHA512_DIGEST_SIZE;
-
-    test_sha[0] = a;
-    test_sha[1] = b;
-
-    ret = InitSha512(&sha);
-    if (ret != 0)
-        return -4009;
-
-    for (i = 0; i < times; ++i) {
-        ret = Sha512Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
-        if (ret != 0)
-            return -4010;
-
-        ret = Sha512Final(&sha, hash);
-        if (ret != 0)
-            return -4011;
-
-        if (memcmp(hash, test_sha[i].output, SHA512_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-#endif
-
-
-#ifdef CYASSL_SHA384
-int sha384_test(void)
-{
-    Sha384 sha;
-    byte   hash[SHA384_DIGEST_SIZE];
-    int    ret;
-
-    testVector a, b;
-    testVector test_sha[2];
-    int times = sizeof(test_sha) / sizeof(struct testVector), i;
-
-    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 = SHA384_DIGEST_SIZE;
-
-    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 = SHA384_DIGEST_SIZE;
-
-    test_sha[0] = a;
-    test_sha[1] = b;
-
-    ret = InitSha384(&sha);
-    if (ret != 0)
-        return -4012;
-
-    for (i = 0; i < times; ++i) {
-        ret = Sha384Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
-        if (ret != 0)
-            return -4013;
-
-        ret = Sha384Final(&sha, hash);
-        if (ret != 0)
-            return -4014;
-
-        if (memcmp(hash, test_sha[i].output, SHA384_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-#endif /* CYASSL_SHA384 */
-
-
-#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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-#ifdef HAVE_CAVIUM
-        if (i == 1)
-            continue; /* driver can't handle keys <= bytes */
-        if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
-            return -20009;
-#endif
-        ret = HmacSetKey(&hmac, MD5, (byte*)keys[i], (word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4015;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4016;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4017;
-
-        if (memcmp(hash, test_hmac[i].output, MD5_DIGEST_SIZE) != 0)
-            return -20 - i;
-#ifdef HAVE_CAVIUM
-        HmacFreeCavium(&hmac);
-#endif
-    }
-
-    return 0;
-}
-#endif /* NO_HMAC && NO_MD5 */
-
-#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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-#ifdef HAVE_CAVIUM
-        if (i == 1)
-            continue; /* driver can't handle keys <= bytes */
-        if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
-            return -20010;
-#endif
-        ret = HmacSetKey(&hmac, SHA, (byte*)keys[i], (word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4018;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4019;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4020;
-
-        if (memcmp(hash, test_hmac[i].output, SHA_DIGEST_SIZE) != 0)
-            return -20 - i;
-#ifdef HAVE_CAVIUM
-        HmacFreeCavium(&hmac);
-#endif
-    }
-
-    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 = SHA256_DIGEST_SIZE;
-
-    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 = SHA256_DIGEST_SIZE;
-
-    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 = SHA256_DIGEST_SIZE;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-#ifdef HAVE_CAVIUM
-        if (i == 1)
-            continue; /* driver can't handle keys <= bytes */
-        if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
-            return -20011;
-#endif
-        ret = HmacSetKey(&hmac, SHA256, (byte*)keys[i],(word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4021;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4022;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4023;
-
-        if (memcmp(hash, test_hmac[i].output, SHA256_DIGEST_SIZE) != 0)
-            return -20 - i;
-#ifdef HAVE_CAVIUM
-        HmacFreeCavium(&hmac);
-#endif
-    }
-
-    return 0;
-}
-#endif
-
-
-#if !defined(NO_HMAC) && defined(HAVE_BLAKE2)
-int hmac_blake2b_test(void)
-{
-    Hmac hmac;
-    byte hash[BLAKE2B_256];
-
-    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 = "\x72\x93\x0d\xdd\xf5\xf7\xe1\x78\x38\x07\x44\x18\x0b\x3f\x51"
-               "\x37\x25\xb5\x82\xc2\x08\x83\x2f\x1c\x99\xfd\x03\xa0\x16\x75"
-               "\xac\xfd";
-    a.inLen  = strlen(a.input);
-    a.outLen = BLAKE2B_256;
-
-    b.input  = "what do ya want for nothing?";
-    b.output = "\x3d\x20\x50\x71\x05\xc0\x8c\x0c\x38\x44\x1e\xf7\xf9\xd1\x67"
-               "\x21\xff\x64\xf5\x94\x00\xcf\xf9\x75\x41\xda\x88\x61\x9d\x7c"
-               "\xda\x2b";
-    b.inLen  = strlen(b.input);
-    b.outLen = BLAKE2B_256;
-
-    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 = "\xda\xfe\x2a\x24\xfc\xe7\xea\x36\x34\xbe\x41\x92\xc7\x11\xa7"
-               "\x00\xae\x53\x9c\x11\x9c\x80\x74\x55\x22\x25\x4a\xb9\x55\xd3"
-               "\x0f\x87";
-    c.inLen  = strlen(c.input);
-    c.outLen = BLAKE2B_256;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-#ifdef HAVE_CAVIUM
-        if (i == 1)
-            continue; /* driver can't handle keys <= bytes */
-        if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
-            return -20011;
-#endif
-        ret = HmacSetKey(&hmac, BLAKE2B_ID, (byte*)keys[i],
-                         (word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4024;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4025;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4026;
-
-        if (memcmp(hash, test_hmac[i].output, BLAKE2B_256) != 0)
-            return -20 - i;
-#ifdef HAVE_CAVIUM
-        HmacFreeCavium(&hmac);
-#endif
-    }
-
-    return 0;
-}
-#endif
-
-
-#if !defined(NO_HMAC) && defined(CYASSL_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 = SHA384_DIGEST_SIZE;
-
-    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 = SHA384_DIGEST_SIZE;
-
-    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 = SHA384_DIGEST_SIZE;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-        ret = HmacSetKey(&hmac, SHA384, (byte*)keys[i],(word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4027;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4028;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4029;
-
-        if (memcmp(hash, test_hmac[i].output, SHA384_DIGEST_SIZE) != 0)
-            return -20 - i;
-    }
-
-    return 0;
-}
-#endif
-
-
-#if !defined(NO_HMAC) && defined(CYASSL_SHA512)
-int hmac_sha512_test(void)
-{
-    Hmac hmac;
-    byte hash[SHA512_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 = "\x87\xaa\x7c\xde\xa5\xef\x61\x9d\x4f\xf0\xb4\x24\x1a\x1d\x6c"
-               "\xb0\x23\x79\xf4\xe2\xce\x4e\xc2\x78\x7a\xd0\xb3\x05\x45\xe1"
-               "\x7c\xde\xda\xa8\x33\xb7\xd6\xb8\xa7\x02\x03\x8b\x27\x4e\xae"
-               "\xa3\xf4\xe4\xbe\x9d\x91\x4e\xeb\x61\xf1\x70\x2e\x69\x6c\x20"
-               "\x3a\x12\x68\x54";
-    a.inLen  = strlen(a.input);
-    a.outLen = SHA512_DIGEST_SIZE;
-
-    b.input  = "what do ya want for nothing?";
-    b.output = "\x16\x4b\x7a\x7b\xfc\xf8\x19\xe2\xe3\x95\xfb\xe7\x3b\x56\xe0"
-               "\xa3\x87\xbd\x64\x22\x2e\x83\x1f\xd6\x10\x27\x0c\xd7\xea\x25"
-               "\x05\x54\x97\x58\xbf\x75\xc0\x5a\x99\x4a\x6d\x03\x4f\x65\xf8"
-               "\xf0\xe6\xfd\xca\xea\xb1\xa3\x4d\x4a\x6b\x4b\x63\x6e\x07\x0a"
-               "\x38\xbc\xe7\x37";
-    b.inLen  = strlen(b.input);
-    b.outLen = SHA512_DIGEST_SIZE;
-
-    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 = "\xfa\x73\xb0\x08\x9d\x56\xa2\x84\xef\xb0\xf0\x75\x6c\x89\x0b"
-               "\xe9\xb1\xb5\xdb\xdd\x8e\xe8\x1a\x36\x55\xf8\x3e\x33\xb2\x27"
-               "\x9d\x39\xbf\x3e\x84\x82\x79\xa7\x22\xc8\x06\xb4\x85\xa4\x7e"
-               "\x67\xc8\x07\xb9\x46\xa3\x37\xbe\xe8\x94\x26\x74\x27\x88\x59"
-               "\xe1\x32\x92\xfb";
-    c.inLen  = strlen(c.input);
-    c.outLen = SHA512_DIGEST_SIZE;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-        ret = HmacSetKey(&hmac, SHA512, (byte*)keys[i],(word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4030;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4031;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4032;
-
-        if (memcmp(hash, test_hmac[i].output, SHA512_DIGEST_SIZE) != 0)
-            return -20 - i;
-    }
-
-    return 0;
-}
-#endif
-
-
-#ifndef NO_RC4
-int arc4_test(void)
-{
-    byte cipher[16];
-    byte plain[16];
-
-    const char* keys[] =
-    {
-        "\x01\x23\x45\x67\x89\xab\xcd\xef",
-        "\x01\x23\x45\x67\x89\xab\xcd\xef",
-        "\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\xef\x01\x23\x45"
-    };
-
-    testVector a, b, c, d;
-    testVector test_arc4[4];
-
-    int times = sizeof(test_arc4) / sizeof(testVector), i;
-
-    a.input  = "\x01\x23\x45\x67\x89\xab\xcd\xef";
-    a.output = "\x75\xb7\x87\x80\x99\xe0\xc5\x96";
-    a.inLen  = 8;
-    a.outLen = 8;
-
-    b.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    b.output = "\x74\x94\xc2\xe7\x10\x4b\x08\x79";
-    b.inLen  = 8;
-    b.outLen = 8;
-
-    c.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    c.output = "\xde\x18\x89\x41\xa3\x37\x5d\x3a";
-    c.inLen  = 8;
-    c.outLen = 8;
-
-    d.input  = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
-    d.output = "\xd6\xa1\x41\xa7\xec\x3c\x38\xdf\xbd\x61";
-    d.inLen  = 10;
-    d.outLen = 10;
-
-    test_arc4[0] = a;
-    test_arc4[1] = b;
-    test_arc4[2] = c;
-    test_arc4[3] = d;
-
-    for (i = 0; i < times; ++i) {
-        Arc4 enc;
-        Arc4 dec;
-        int  keylen = 8;  /* strlen with key 0x00 not good */
-        if (i == 3)
-            keylen = 4;
-
-#ifdef HAVE_CAVIUM
-        if (Arc4InitCavium(&enc, CAVIUM_DEV_ID) != 0)
-            return -20001;
-        if (Arc4InitCavium(&dec, CAVIUM_DEV_ID) != 0)
-            return -20002;
-#endif
-
-        Arc4SetKey(&enc, (byte*)keys[i], keylen);
-        Arc4SetKey(&dec, (byte*)keys[i], keylen);
-
-        Arc4Process(&enc, cipher, (byte*)test_arc4[i].input,
-                    (word32)test_arc4[i].outLen);
-        Arc4Process(&dec, plain,  cipher, (word32)test_arc4[i].outLen);
-
-        if (memcmp(plain, test_arc4[i].input, test_arc4[i].outLen))
-            return -20 - i;
-
-        if (memcmp(cipher, test_arc4[i].output, test_arc4[i].outLen))
-            return -20 - 5 - i;
-
-#ifdef HAVE_CAVIUM
-        Arc4FreeCavium(&enc);
-        Arc4FreeCavium(&dec);
-#endif
-    }
-
-    return 0;
-}
-#endif
-
-
-int hc128_test(void)
-{
-#ifdef HAVE_HC128
-    byte cipher[16];
-    byte plain[16];
-
-    const char* keys[] =
-    {
-        "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x00\x53\xA6\xF9\x4C\x9F\xF2\x45\x98\xEB\x3E\x91\xE4\x37\x8A\xDD",
-        "\x0F\x62\xB5\x08\x5B\xAE\x01\x54\xA7\xFA\x4D\xA0\xF3\x46\x99\xEC"
-    };
-
-    const char* ivs[] =
-    {
-        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x0D\x74\xDB\x42\xA9\x10\x77\xDE\x45\xAC\x13\x7A\xE1\x48\xAF\x16",
-        "\x28\x8F\xF6\x5D\xC4\x2B\x92\xF9\x60\xC7\x2E\x95\xFC\x63\xCA\x31"
-    };
-
-
-    testVector a, b, c, d;
-    testVector test_hc128[4];
-
-    int times = sizeof(test_hc128) / sizeof(testVector), i;
-
-    a.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    a.output = "\x37\x86\x02\xB9\x8F\x32\xA7\x48";
-    a.inLen  = 8;
-    a.outLen = 8;
-
-    b.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    b.output = "\x33\x7F\x86\x11\xC6\xED\x61\x5F";
-    b.inLen  = 8;
-    b.outLen = 8;
-
-    c.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    c.output = "\x2E\x1E\xD1\x2A\x85\x51\xC0\x5A";
-    c.inLen  = 8;
-    c.outLen = 8;
-
-    d.input  = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
-    d.output = "\x1C\xD8\xAE\xDD\xFE\x52\xE2\x17\xE8\x35\xD0\xB7\xE8\x4E\x29";
-    d.inLen  = 15;
-    d.outLen = 15;
-
-    test_hc128[0] = a;
-    test_hc128[1] = b;
-    test_hc128[2] = c;
-    test_hc128[3] = d;
-
-    for (i = 0; i < times; ++i) {
-        HC128 enc;
-        HC128 dec;
-
-        /* align keys/ivs in plain/cipher buffers */
-        memcpy(plain,  keys[i], 16);
-        memcpy(cipher, ivs[i],  16);
-
-        Hc128_SetKey(&enc, plain, cipher);
-        Hc128_SetKey(&dec, plain, cipher);
-
-        /* align input */
-        memcpy(plain, test_hc128[i].input, test_hc128[i].outLen);
-        Hc128_Process(&enc, cipher, plain,  (word32)test_hc128[i].outLen);
-        Hc128_Process(&dec, plain,  cipher, (word32)test_hc128[i].outLen);
-
-        if (memcmp(plain, test_hc128[i].input, test_hc128[i].outLen))
-            return -120 - i;
-
-        if (memcmp(cipher, test_hc128[i].output, test_hc128[i].outLen))
-            return -120 - 5 - i;
-    }
-
-#endif /* HAVE_HC128 */
-    return 0;
-}
-
-
-#ifndef NO_RABBIT
-int rabbit_test(void)
-{
-    byte cipher[16];
-    byte plain[16];
-
-    const char* keys[] =
-    {
-        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\xAC\xC3\x51\xDC\xF1\x62\xFC\x3B\xFE\x36\x3D\x2E\x29\x13\x28\x91"
-    };
-
-    const char* ivs[] =
-    {
-        "\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x59\x7E\x26\xC1\x75\xF5\x73\xC3",
-        0
-    };
-
-    testVector a, b, c;
-    testVector test_rabbit[3];
-
-    int times = sizeof(test_rabbit) / sizeof(testVector), i;
-
-    a.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    a.output = "\xED\xB7\x05\x67\x37\x5D\xCD\x7C";
-    a.inLen  = 8;
-    a.outLen = 8;
-
-    b.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    b.output = "\x6D\x7D\x01\x22\x92\xCC\xDC\xE0";
-    b.inLen  = 8;
-    b.outLen = 8;
-
-    c.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    c.output = "\x04\xCE\xCA\x7A\x1A\x86\x6E\x77";
-    c.inLen  = 8;
-    c.outLen = 8;
-
-    test_rabbit[0] = a;
-    test_rabbit[1] = b;
-    test_rabbit[2] = c;
-
-    for (i = 0; i < times; ++i) {
-        Rabbit enc;
-        Rabbit dec;
-        byte*  iv;
-
-        /* align keys/ivs in plain/cipher buffers */
-        memcpy(plain,  keys[i], 16);
-        if (ivs[i]) {
-            memcpy(cipher, ivs[i],   8);
-            iv = cipher;
-        } else
-            iv = NULL;
-        RabbitSetKey(&enc, plain, iv);
-        RabbitSetKey(&dec, plain, iv);
-
-        /* align input */
-        memcpy(plain, test_rabbit[i].input, test_rabbit[i].outLen);
-        RabbitProcess(&enc, cipher, plain,  (word32)test_rabbit[i].outLen);
-        RabbitProcess(&dec, plain,  cipher, (word32)test_rabbit[i].outLen);
-
-        if (memcmp(plain, test_rabbit[i].input, test_rabbit[i].outLen))
-            return -130 - i;
-
-        if (memcmp(cipher, test_rabbit[i].output, test_rabbit[i].outLen))
-            return -130 - 5 - i;
-    }
-
-    return 0;
-}
-#endif /* NO_RABBIT */
-
-
-#ifndef NO_DES3
-int des_test(void)
-{
-    const byte vector[] = { /* "now is the time for all " w/o trailing 0 */
-        0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-        0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-        0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-    };
-
-    byte plain[24];
-    byte cipher[24];
-
-    Des enc;
-    Des dec;
-
-    const byte key[] =
-    {
-        0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef
-    };
-
-    const byte iv[] =
-    {
-        0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef
-    };
-
-    const byte verify[] =
-    {
-        0x8b,0x7c,0x52,0xb0,0x01,0x2b,0x6c,0xb8,
-        0x4f,0x0f,0xeb,0xf3,0xfb,0x5f,0x86,0x73,
-        0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
-    };
-
-    int ret;
-
-    ret = Des_SetKey(&enc, key, iv, DES_ENCRYPTION);
-    if (ret != 0)
-        return -31;
-
-    Des_CbcEncrypt(&enc, cipher, vector, sizeof(vector));
-    ret = Des_SetKey(&dec, key, iv, DES_DECRYPTION);
-    if (ret != 0)
-        return -32;
-    Des_CbcDecrypt(&dec, plain, cipher, sizeof(cipher));
-
-    if (memcmp(plain, vector, sizeof(plain)))
-        return -33;
-
-    if (memcmp(cipher, verify, sizeof(cipher)))
-        return -34;
-
-    return 0;
-}
-#endif /* NO_DES3 */
-
-
-#ifndef NO_DES3
-int des3_test(void)
-{
-    const byte vector[] = { /* "Now is the time for all " w/o trailing 0 */
-        0x4e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-        0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-        0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-    };
-
-    byte plain[24];
-    byte cipher[24];
-
-    Des3 enc;
-    Des3 dec;
-
-    const byte key3[] =
-    {
-        0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
-        0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10,
-        0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67
-    };
-    const byte iv3[] =
-    {
-        0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef,
-        0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-        0x11,0x21,0x31,0x41,0x51,0x61,0x71,0x81
-
-    };
-
-    const byte verify3[] =
-    {
-        0x43,0xa0,0x29,0x7e,0xd1,0x84,0xf8,0x0e,
-        0x89,0x64,0x84,0x32,0x12,0xd5,0x08,0x98,
-        0x18,0x94,0x15,0x74,0x87,0x12,0x7d,0xb0
-    };
-
-    int ret;
-
-
-#ifdef HAVE_CAVIUM
-    if (Des3_InitCavium(&enc, CAVIUM_DEV_ID) != 0)
-        return -20005;
-    if (Des3_InitCavium(&dec, CAVIUM_DEV_ID) != 0)
-        return -20006;
-#endif
-    ret = Des3_SetKey(&enc, key3, iv3, DES_ENCRYPTION);
-    if (ret != 0)
-        return -31;
-    ret = Des3_SetKey(&dec, key3, iv3, DES_DECRYPTION);
-    if (ret != 0)
-        return -32;
-    ret = Des3_CbcEncrypt(&enc, cipher, vector, sizeof(vector));
-    if (ret != 0)
-        return -33;
-    ret = Des3_CbcDecrypt(&dec, plain, cipher, sizeof(cipher));
-    if (ret != 0)
-        return -34;
-
-    if (memcmp(plain, vector, sizeof(plain)))
-        return -35;
-
-    if (memcmp(cipher, verify3, sizeof(cipher)))
-        return -36;
-
-#ifdef HAVE_CAVIUM
-    Des3_FreeCavium(&enc);
-    Des3_FreeCavium(&dec);
-#endif
-    return 0;
-}
-#endif /* NO_DES */
-
-
-#ifndef NO_AES
-int aes_test(void)
-{
-    Aes enc;
-    Aes dec;
-
-    const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */
-        0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-        0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-        0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-    };
-
-    const byte verify[] =
-    {
-        0x95,0x94,0x92,0x57,0x5f,0x42,0x81,0x53,
-        0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
-    };
-
-    byte key[] = "0123456789abcdef   ";  /* align */
-    byte iv[]  = "1234567890abcdef   ";  /* align */
-
-    byte cipher[AES_BLOCK_SIZE * 4];
-    byte plain [AES_BLOCK_SIZE * 4];
-    int  ret;
-
-#ifdef HAVE_CAVIUM
-        if (AesInitCavium(&enc, CAVIUM_DEV_ID) != 0)
-            return -20003;
-        if (AesInitCavium(&dec, CAVIUM_DEV_ID) != 0)
-            return -20004;
-#endif
-    ret = AesSetKey(&enc, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
-    if (ret != 0)
-        return -1001;
-    ret = AesSetKey(&dec, key, AES_BLOCK_SIZE, iv, AES_DECRYPTION);
-    if (ret != 0)
-        return -1002;
-
-    ret = AesCbcEncrypt(&enc, cipher, msg,   AES_BLOCK_SIZE);
-    if (ret != 0)
-        return -1005;
-    ret = AesCbcDecrypt(&dec, plain, cipher, AES_BLOCK_SIZE);
-    if (ret != 0)
-        return -1006;
-
-    if (memcmp(plain, msg, AES_BLOCK_SIZE))
-        return -60;
-
-    if (memcmp(cipher, verify, AES_BLOCK_SIZE))
-        return -61;
-
-#ifdef HAVE_CAVIUM
-        AesFreeCavium(&enc);
-        AesFreeCavium(&dec);
-#endif
-#ifdef CYASSL_AES_COUNTER
-    {
-        const byte ctrKey[] =
-        {
-            0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,
-            0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c
-        };
-
-        const byte ctrIv[] =
-        {
-            0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,
-            0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
-        };
-
-
-        const byte ctrPlain[] =
-        {
-            0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,
-            0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a,
-            0xae,0x2d,0x8a,0x57,0x1e,0x03,0xac,0x9c,
-            0x9e,0xb7,0x6f,0xac,0x45,0xaf,0x8e,0x51,
-            0x30,0xc8,0x1c,0x46,0xa3,0x5c,0xe4,0x11,
-            0xe5,0xfb,0xc1,0x19,0x1a,0x0a,0x52,0xef,
-            0xf6,0x9f,0x24,0x45,0xdf,0x4f,0x9b,0x17,
-            0xad,0x2b,0x41,0x7b,0xe6,0x6c,0x37,0x10
-        };
-
-        const byte ctrCipher[] =
-        {
-            0x87,0x4d,0x61,0x91,0xb6,0x20,0xe3,0x26,
-            0x1b,0xef,0x68,0x64,0x99,0x0d,0xb6,0xce,
-            0x98,0x06,0xf6,0x6b,0x79,0x70,0xfd,0xff,
-            0x86,0x17,0x18,0x7b,0xb9,0xff,0xfd,0xff,
-            0x5a,0xe4,0xdf,0x3e,0xdb,0xd5,0xd3,0x5e,
-            0x5b,0x4f,0x09,0x02,0x0d,0xb0,0x3e,0xab,
-            0x1e,0x03,0x1d,0xda,0x2f,0xbe,0x03,0xd1,
-            0x79,0x21,0x70,0xa0,0xf3,0x00,0x9c,0xee
-        };
-
-        const byte oddCipher[] =
-        {
-            0xb9,0xd7,0xcb,0x08,0xb0,0xe1,0x7b,0xa0,
-            0xc2
-        };
-
-        AesSetKeyDirect(&enc, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION);
-        /* Ctr only uses encrypt, even on key setup */
-        AesSetKeyDirect(&dec, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION);
-
-        AesCtrEncrypt(&enc, cipher, ctrPlain, AES_BLOCK_SIZE*4);
-        AesCtrEncrypt(&dec, plain, cipher, AES_BLOCK_SIZE*4);
-
-        if (memcmp(plain, ctrPlain, AES_BLOCK_SIZE*4))
-            return -66;
-
-        if (memcmp(cipher, ctrCipher, AES_BLOCK_SIZE*4))
-            return -67;
-
-        /* let's try with just 9 bytes, non block size test */
-        AesSetKeyDirect(&enc, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION);
-        /* Ctr only uses encrypt, even on key setup */
-        AesSetKeyDirect(&dec, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION);
-
-        AesCtrEncrypt(&enc, cipher, ctrPlain, 9);
-        AesCtrEncrypt(&dec, plain, cipher, 9);
-
-        if (memcmp(plain, ctrPlain, 9))
-            return -68;
-
-        if (memcmp(cipher, ctrCipher, 9))
-            return -69;
-
-        /* and an additional 9 bytes to reuse tmp left buffer */
-        AesCtrEncrypt(&enc, cipher, ctrPlain, 9);
-        AesCtrEncrypt(&dec, plain, cipher, 9);
-
-        if (memcmp(plain, ctrPlain, 9))
-            return -70;
-
-        if (memcmp(cipher, oddCipher, 9))
-            return -71;
-    }
-#endif /* CYASSL_AES_COUNTER */
-
-#if defined(CYASSL_AESNI) && defined(CYASSL_AES_DIRECT)
-    {
-        const byte niPlain[] =
-        {
-            0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,
-            0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a
-        };
-
-        const byte niCipher[] =
-        {
-            0xf3,0xee,0xd1,0xbd,0xb5,0xd2,0xa0,0x3c,
-            0x06,0x4b,0x5a,0x7e,0x3d,0xb1,0x81,0xf8
-        };
-
-        const byte niKey[] =
-        {
-            0x60,0x3d,0xeb,0x10,0x15,0xca,0x71,0xbe,
-            0x2b,0x73,0xae,0xf0,0x85,0x7d,0x77,0x81,
-            0x1f,0x35,0x2c,0x07,0x3b,0x61,0x08,0xd7,
-            0x2d,0x98,0x10,0xa3,0x09,0x14,0xdf,0xf4
-        };
-
-        XMEMSET(cipher, 0, AES_BLOCK_SIZE);
-        ret = AesSetKey(&enc, niKey, sizeof(niKey), cipher, AES_ENCRYPTION);
-        if (ret != 0)
-            return -1003;
-        AesEncryptDirect(&enc, cipher, niPlain);
-        if (XMEMCMP(cipher, niCipher, AES_BLOCK_SIZE) != 0)
-            return -20006;
-
-        XMEMSET(plain, 0, AES_BLOCK_SIZE);
-        ret = AesSetKey(&dec, niKey, sizeof(niKey), plain, AES_DECRYPTION);
-        if (ret != 0)
-            return -1004;
-        AesDecryptDirect(&dec, plain, niCipher);
-        if (XMEMCMP(plain, niPlain, AES_BLOCK_SIZE) != 0)
-            return -20007;
-    }
-#endif /* CYASSL_AESNI && CYASSL_AES_DIRECT */
-
-    return 0;
-}
-
-#ifdef HAVE_AESGCM
-int aesgcm_test(void)
-{
-    Aes enc;
-
-    /*
-     * This is Test Case 16 from the document Galois/
-     * Counter Mode of Operation (GCM) by McGrew and
-     * Viega.
-     */
-    const byte k[] =
-    {
-        0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
-        0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
-        0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
-        0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08
-    };
-
-    const byte iv[] =
-    {
-        0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
-        0xde, 0xca, 0xf8, 0x88
-    };
-
-    const byte p[] =
-    {
-        0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
-        0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
-        0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
-        0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
-        0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
-        0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
-        0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
-        0xba, 0x63, 0x7b, 0x39
-    };
-
-    const byte a[] =
-    {
-        0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
-        0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
-        0xab, 0xad, 0xda, 0xd2
-    };
-
-    const byte c[] =
-    {
-        0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07,
-        0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d,
-        0x64, 0x3a, 0x8c, 0xdc, 0xbf, 0xe5, 0xc0, 0xc9,
-        0x75, 0x98, 0xa2, 0xbd, 0x25, 0x55, 0xd1, 0xaa,
-        0x8c, 0xb0, 0x8e, 0x48, 0x59, 0x0d, 0xbb, 0x3d,
-        0xa7, 0xb0, 0x8b, 0x10, 0x56, 0x82, 0x88, 0x38,
-        0xc5, 0xf6, 0x1e, 0x63, 0x93, 0xba, 0x7a, 0x0a,
-        0xbc, 0xc9, 0xf6, 0x62
-    };
-
-    const byte t[] =
-    {
-        0x76, 0xfc, 0x6e, 0xce, 0x0f, 0x4e, 0x17, 0x68,
-        0xcd, 0xdf, 0x88, 0x53, 0xbb, 0x2d, 0x55, 0x1b
-    };
-
-    byte t2[sizeof(t)];
-    byte p2[sizeof(c)];
-    byte c2[sizeof(p)];
-
-    int result;
-
-    memset(t2, 0, sizeof(t2));
-    memset(c2, 0, sizeof(c2));
-    memset(p2, 0, sizeof(p2));
-
-    AesGcmSetKey(&enc, k, sizeof(k));
-    /* AES-GCM encrypt and decrypt both use AES encrypt internally */
-    AesGcmEncrypt(&enc, c2, p, sizeof(c2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (memcmp(c, c2, sizeof(c2)))
-        return -68;
-    if (memcmp(t, t2, sizeof(t2)))
-        return -69;
-
-    result = AesGcmDecrypt(&enc, p2, c2, sizeof(p2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (result != 0)
-        return -70;
-    if (memcmp(p, p2, sizeof(p2)))
-        return -71;
-
-    return 0;
-}
-
-int gmac_test(void)
-{
-    Gmac gmac;
-
-    const byte k1[] =
-    {
-        0x89, 0xc9, 0x49, 0xe9, 0xc8, 0x04, 0xaf, 0x01,
-        0x4d, 0x56, 0x04, 0xb3, 0x94, 0x59, 0xf2, 0xc8
-    };
-    const byte iv1[] =
-    {
-        0xd1, 0xb1, 0x04, 0xc8, 0x15, 0xbf, 0x1e, 0x94,
-        0xe2, 0x8c, 0x8f, 0x16
-    };
-    const byte a1[] =
-    {
-       0x82, 0xad, 0xcd, 0x63, 0x8d, 0x3f, 0xa9, 0xd9,
-       0xf3, 0xe8, 0x41, 0x00, 0xd6, 0x1e, 0x07, 0x77
-    };
-    const byte t1[] =
-    {
-        0x88, 0xdb, 0x9d, 0x62, 0x17, 0x2e, 0xd0, 0x43,
-        0xaa, 0x10, 0xf1, 0x6d, 0x22, 0x7d, 0xc4, 0x1b
-    };
-
-    const byte k2[] =
-    {
-        0x40, 0xf7, 0xec, 0xb2, 0x52, 0x6d, 0xaa, 0xd4,
-        0x74, 0x25, 0x1d, 0xf4, 0x88, 0x9e, 0xf6, 0x5b
-    };
-    const byte iv2[] =
-    {
-        0xee, 0x9c, 0x6e, 0x06, 0x15, 0x45, 0x45, 0x03,
-        0x1a, 0x60, 0x24, 0xa7
-    };
-    const byte a2[] =
-    {
-        0x94, 0x81, 0x2c, 0x87, 0x07, 0x4e, 0x15, 0x18,
-        0x34, 0xb8, 0x35, 0xaf, 0x1c, 0xa5, 0x7e, 0x56
-    };
-    const byte t2[] =
-    {
-        0xc6, 0x81, 0x79, 0x8e, 0x3d, 0xda, 0xb0, 0x9f,
-        0x8d, 0x83, 0xb0, 0xbb, 0x14, 0xb6, 0x91
-    };
-
-    const byte k3[] =
-    {
-        0xb8, 0xe4, 0x9a, 0x5e, 0x37, 0xf9, 0x98, 0x2b,
-        0xb9, 0x6d, 0xd0, 0xc9, 0xb6, 0xab, 0x26, 0xac
-    };
-    const byte iv3[] =
-    {
-        0xe4, 0x4a, 0x42, 0x18, 0x8c, 0xae, 0x94, 0x92,
-        0x6a, 0x9c, 0x26, 0xb0
-    };
-    const byte a3[] =
-    {
-        0x9d, 0xb9, 0x61, 0x68, 0xa6, 0x76, 0x7a, 0x31,
-        0xf8, 0x29, 0xe4, 0x72, 0x61, 0x68, 0x3f, 0x8a
-    };
-    const byte t3[] =
-    {
-        0x23, 0xe2, 0x9f, 0x66, 0xe4, 0xc6, 0x52, 0x48
-    };
-
-    byte tag[16];
-
-    memset(tag, 0, sizeof(tag));
-    GmacSetKey(&gmac, k1, sizeof(k1));
-    GmacUpdate(&gmac, iv1, sizeof(iv1), a1, sizeof(a1), tag, sizeof(t1));
-    if (memcmp(t1, tag, sizeof(t1)) != 0)
-        return -126;
-
-    memset(tag, 0, sizeof(tag));
-    GmacSetKey(&gmac, k2, sizeof(k2));
-    GmacUpdate(&gmac, iv2, sizeof(iv2), a2, sizeof(a2), tag, sizeof(t2));
-    if (memcmp(t2, tag, sizeof(t2)) != 0)
-        return -127;
-
-    memset(tag, 0, sizeof(tag));
-    GmacSetKey(&gmac, k3, sizeof(k3));
-    GmacUpdate(&gmac, iv3, sizeof(iv3), a3, sizeof(a3), tag, sizeof(t3));
-    if (memcmp(t3, tag, sizeof(t3)) != 0)
-        return -128;
-
-    return 0;
-}
-#endif /* HAVE_AESGCM */
-
-#ifdef HAVE_AESCCM
-int aesccm_test(void)
-{
-    Aes enc;
-
-    /* key */
-    const byte k[] =
-    {
-        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
-        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf
-    };
-
-    /* nonce */
-    const byte iv[] =
-    {
-        0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
-        0xa1, 0xa2, 0xa3, 0xa4, 0xa5
-    };
-
-    /* plaintext */
-    const byte p[] =
-    {
-        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-        0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e
-    };
-
-    const byte a[] =
-    {
-        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
-    };
-
-    const byte c[] =
-    {
-        0x58, 0x8c, 0x97, 0x9a, 0x61, 0xc6, 0x63, 0xd2,
-        0xf0, 0x66, 0xd0, 0xc2, 0xc0, 0xf9, 0x89, 0x80,
-        0x6d, 0x5f, 0x6b, 0x61, 0xda, 0xc3, 0x84
-    };
-
-    const byte t[] =
-    {
-        0x17, 0xe8, 0xd1, 0x2c, 0xfd, 0xf9, 0x26, 0xe0
-    };
-
-    byte t2[sizeof(t)];
-    byte p2[sizeof(p)];
-    byte c2[sizeof(c)];
-
-    int result;
-
-    memset(t2, 0, sizeof(t2));
-    memset(c2, 0, sizeof(c2));
-    memset(p2, 0, sizeof(p2));
-
-    AesCcmSetKey(&enc, k, sizeof(k));
-    /* AES-CCM encrypt and decrypt both use AES encrypt internally */
-    AesCcmEncrypt(&enc, c2, p, sizeof(c2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (memcmp(c, c2, sizeof(c2)))
-        return -107;
-    if (memcmp(t, t2, sizeof(t2)))
-        return -108;
-
-    result = AesCcmDecrypt(&enc, p2, c2, sizeof(p2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (result != 0)
-        return -109;
-    if (memcmp(p, p2, sizeof(p2)))
-        return -110;
-
-    /* Test the authentication failure */
-    t2[0]++; /* Corrupt the authentication tag. */
-    result = AesCcmDecrypt(&enc, p2, c, sizeof(p2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (result == 0)
-        return -111;
-
-    /* Clear c2 to compare against p2. p2 should be set to zero in case of
-     * authentication fail. */
-    memset(c2, 0, sizeof(c2));
-    if (memcmp(p2, c2, sizeof(p2)))
-        return -112;
-
-    return 0;
-}
-#endif /* HAVE_AESCCM */
-
-
-#endif /* NO_AES */
-
-
-#ifdef HAVE_CAMELLIA
-
-enum {
-    CAM_ECB_ENC, CAM_ECB_DEC, CAM_CBC_ENC, CAM_CBC_DEC
-};
-
-typedef struct {
-    int type;
-    const byte* plaintext;
-    const byte* iv;
-    const byte* ciphertext;
-    const byte* key;
-    word32 keySz;
-    int errorCode;
-} test_vector_t;
-
-int camellia_test(void)
-{
-    /* Camellia ECB Test Plaintext */
-    static const byte pte[] =
-    {
-        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
-        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10
-    };
-
-    /* Camellia ECB Test Initialization Vector */
-    static const byte ive[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-
-    /* Test 1: Camellia ECB 128-bit key */
-    static const byte k1[] =
-    {
-        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
-        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10
-    };
-    static const byte c1[] =
-    {
-        0x67, 0x67, 0x31, 0x38, 0x54, 0x96, 0x69, 0x73,
-        0x08, 0x57, 0x06, 0x56, 0x48, 0xea, 0xbe, 0x43
-    };
-
-    /* Test 2: Camellia ECB 192-bit key */
-    static const byte k2[] =
-    {
-        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
-        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
-        0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77
-    };
-    static const byte c2[] =
-    {
-        0xb4, 0x99, 0x34, 0x01, 0xb3, 0xe9, 0x96, 0xf8,
-        0x4e, 0xe5, 0xce, 0xe7, 0xd7, 0x9b, 0x09, 0xb9
-    };
-
-    /* Test 3: Camellia ECB 256-bit key */
-    static const byte k3[] =
-    {
-        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
-        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
-        0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
-        0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff
-    };
-    static const byte c3[] =
-    {
-        0x9a, 0xcc, 0x23, 0x7d, 0xff, 0x16, 0xd7, 0x6c,
-        0x20, 0xef, 0x7c, 0x91, 0x9e, 0x3a, 0x75, 0x09
-    };
-
-    /* Camellia CBC Test Plaintext */
-    static const byte ptc[] =
-    {
-        0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
-        0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A
-    };
-
-    /* Camellia CBC Test Initialization Vector */
-    static const byte ivc[] =
-    {
-        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-        0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
-    };
-
-    /* Test 4: Camellia-CBC 128-bit key */
-    static const byte k4[] =
-    {
-        0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
-        0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
-    };
-    static const byte c4[] =
-    {
-        0x16, 0x07, 0xCF, 0x49, 0x4B, 0x36, 0xBB, 0xF0,
-        0x0D, 0xAE, 0xB0, 0xB5, 0x03, 0xC8, 0x31, 0xAB
-    };
-
-    /* Test 5: Camellia-CBC 192-bit key */
-    static const byte k5[] =
-    {
-        0x8E, 0x73, 0xB0, 0xF7, 0xDA, 0x0E, 0x64, 0x52,
-        0xC8, 0x10, 0xF3, 0x2B, 0x80, 0x90, 0x79, 0xE5,
-        0x62, 0xF8, 0xEA, 0xD2, 0x52, 0x2C, 0x6B, 0x7B
-    };
-    static const byte c5[] =
-    {
-        0x2A, 0x48, 0x30, 0xAB, 0x5A, 0xC4, 0xA1, 0xA2,
-        0x40, 0x59, 0x55, 0xFD, 0x21, 0x95, 0xCF, 0x93
-    };
-
-    /* Test 6: CBC 256-bit key */
-    static const byte k6[] =
-    {
-        0x60, 0x3D, 0xEB, 0x10, 0x15, 0xCA, 0x71, 0xBE,
-        0x2B, 0x73, 0xAE, 0xF0, 0x85, 0x7D, 0x77, 0x81,
-        0x1F, 0x35, 0x2C, 0x07, 0x3B, 0x61, 0x08, 0xD7,
-        0x2D, 0x98, 0x10, 0xA3, 0x09, 0x14, 0xDF, 0xF4
-    };
-    static const byte c6[] =
-    {
-        0xE6, 0xCF, 0xA3, 0x5F, 0xC0, 0x2B, 0x13, 0x4A,
-        0x4D, 0x2C, 0x0B, 0x67, 0x37, 0xAC, 0x3E, 0xDA
-    };
-
-    byte out[CAMELLIA_BLOCK_SIZE];
-    Camellia cam;
-    int i, testsSz;
-    const test_vector_t testVectors[] =
-    {
-        {CAM_ECB_ENC, pte, ive, c1, k1, sizeof(k1), -114},
-        {CAM_ECB_ENC, pte, ive, c2, k2, sizeof(k2), -115},
-        {CAM_ECB_ENC, pte, ive, c3, k3, sizeof(k3), -116},
-        {CAM_ECB_DEC, pte, ive, c1, k1, sizeof(k1), -117},
-        {CAM_ECB_DEC, pte, ive, c2, k2, sizeof(k2), -118},
-        {CAM_ECB_DEC, pte, ive, c3, k3, sizeof(k3), -119},
-        {CAM_CBC_ENC, ptc, ivc, c4, k4, sizeof(k4), -120},
-        {CAM_CBC_ENC, ptc, ivc, c5, k5, sizeof(k5), -121},
-        {CAM_CBC_ENC, ptc, ivc, c6, k6, sizeof(k6), -122},
-        {CAM_CBC_DEC, ptc, ivc, c4, k4, sizeof(k4), -123},
-        {CAM_CBC_DEC, ptc, ivc, c5, k5, sizeof(k5), -124},
-        {CAM_CBC_DEC, ptc, ivc, c6, k6, sizeof(k6), -125}
-    };
-
-    testsSz = sizeof(testVectors)/sizeof(test_vector_t);
-    for (i = 0; i < testsSz; i++) {
-        if (CamelliaSetKey(&cam, testVectors[i].key, testVectors[i].keySz,
-                                                        testVectors[i].iv) != 0)
-            return testVectors[i].errorCode;
-
-        switch (testVectors[i].type) {
-            case CAM_ECB_ENC:
-                CamelliaEncryptDirect(&cam, out, testVectors[i].plaintext);
-                if (memcmp(out, testVectors[i].ciphertext, CAMELLIA_BLOCK_SIZE))
-                    return testVectors[i].errorCode;
-                break;
-            case CAM_ECB_DEC:
-                CamelliaDecryptDirect(&cam, out, testVectors[i].ciphertext);
-                if (memcmp(out, testVectors[i].plaintext, CAMELLIA_BLOCK_SIZE))
-                    return testVectors[i].errorCode;
-                break;
-            case CAM_CBC_ENC:
-                CamelliaCbcEncrypt(&cam, out, testVectors[i].plaintext,
-                                                           CAMELLIA_BLOCK_SIZE);
-                if (memcmp(out, testVectors[i].ciphertext, CAMELLIA_BLOCK_SIZE))
-                    return testVectors[i].errorCode;
-                break;
-            case CAM_CBC_DEC:
-                CamelliaCbcDecrypt(&cam, out, testVectors[i].ciphertext,
-                                                           CAMELLIA_BLOCK_SIZE);
-                if (memcmp(out, testVectors[i].plaintext, CAMELLIA_BLOCK_SIZE))
-                    return testVectors[i].errorCode;
-                break;
-            default:
-                break;
-        }
-    }
-
-    /* Setting the IV and checking it was actually set. */
-    CamelliaSetIV(&cam, ivc);
-    if (XMEMCMP(cam.reg, ivc, CAMELLIA_BLOCK_SIZE))
-        return -1;
-
-    /* Setting the IV to NULL should be same as all zeros IV */
-    if (CamelliaSetIV(&cam, NULL) != 0 ||
-                                    XMEMCMP(cam.reg, ive, CAMELLIA_BLOCK_SIZE))
-        return -1;
-
-    /* First parameter should never be null */
-    if (CamelliaSetIV(NULL, NULL) == 0)
-        return -1;
-
-    /* First parameter should never be null, check it fails */
-    if (CamelliaSetKey(NULL, k1, sizeof(k1), NULL) == 0)
-        return -1;
-
-    /* Key should have a size of 16, 24, or 32 */
-    if (CamelliaSetKey(&cam, k1, 0, NULL) == 0)
-        return -1;
-
-    return 0;
-}
-#endif /* HAVE_CAMELLIA */
-
-
-int random_test(void)
-{
-    WC_RNG rng;
-    byte block[32];
-    int ret;
-
-#ifdef HAVE_CAVIUM
-    ret = InitRngCavium(&rng, CAVIUM_DEV_ID);
-    if (ret != 0) return -2007;
-#endif
-    ret = InitRng(&rng);
-    if (ret != 0) return -39;
-
-    ret = RNG_GenerateBlock(&rng, block, sizeof(block));
-    if (ret != 0) return -40;
-
-    return 0;
-}
-
-
-#ifdef HAVE_NTRU
-
-byte GetEntropy(ENTROPY_CMD cmd, byte* out);
-
-byte GetEntropy(ENTROPY_CMD cmd, byte* out)
-{
-    static WC_RNG rng;
-
-    if (cmd == INIT)
-        return (InitRng(&rng) == 0) ? 1 : 0;
-
-    if (out == NULL)
-        return 0;
-
-    if (cmd == GET_BYTE_OF_ENTROPY)
-        return (RNG_GenerateBlock(&rng, out, 1) == 0) ? 1 : 0;
-
-    if (cmd == GET_NUM_BYTES_PER_BYTE_OF_ENTROPY) {
-        *out = 1;
-        return 1;
-    }
-
-    return 0;
-}
-
-#endif /* HAVE_NTRU */
-
-#ifndef NO_RSA
-
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    #ifdef FREESCALE_MQX
-        static const char* clientKey  = "a:\\certs\\client-key.der";
-        static const char* clientCert = "a:\\certs\\client-cert.der";
-        #ifdef CYASSL_CERT_GEN
-            static const char* caKeyFile  = "a:\\certs\\ca-key.der";
-            static const char* caCertFile = "a:\\certs\\ca-cert.pem";
-            #ifdef HAVE_ECC
-                static const char* eccCaKeyFile  = "a:\\certs\\ecc-key.der";
-                static const char* eccCaCertFile = "a:\\certs\\server-ecc.pem";
-            #endif
-        #endif
-    #elif defined(CYASSL_MKD_SHELL)
-        static char* clientKey = "certs/client-key.der";
-        static char* clientCert = "certs/client-cert.der";
-        void set_clientKey(char *key) {  clientKey = key ; }
-        void set_clientCert(char *cert) {  clientCert = cert ; }
-        #ifdef CYASSL_CERT_GEN
-            static char* caKeyFile  = "certs/ca-key.der";
-            static char* caCertFile = "certs/ca-cert.pem";
-            void set_caKeyFile (char * key)  { caKeyFile   = key ; }
-            void set_caCertFile(char * cert) { caCertFile = cert ; }
-            #ifdef HAVE_ECC
-                static const char* eccCaKeyFile  = "certs/ecc-key.der";
-                static const char* eccCaCertFile = "certs/server-ecc.pem";
-                void set_eccCaKeyFile (char * key)  { eccCaKeyFile  = key ; }
-                void set_eccCaCertFile(char * cert) { eccCaCertFile = cert ; }
-            #endif
-        #endif
-    #else
-        static const char* clientKey  = "./certs/client-key.der";
-        static const char* clientCert = "./certs/client-cert.der";
-        #ifdef CYASSL_CERT_GEN
-            static const char* caKeyFile  = "./certs/ca-key.der";
-            static const char* caCertFile = "./certs/ca-cert.pem";
-            #ifdef HAVE_ECC
-                static const char* eccCaKeyFile  = "./certs/ecc-key.der";
-                static const char* eccCaCertFile = "./certs/server-ecc.pem";
-            #endif
-        #endif
-    #endif
-#endif
-
-
-
-#define FOURK_BUF 4096
-
-int rsa_test(void)
-{
-    byte*   tmp;
-    size_t bytes;
-    RsaKey key;
-    WC_RNG rng;
-    word32 idx = 0;
-    int    ret;
-    byte   in[] = "Everyone gets Friday off.";
-    word32 inLen = (word32)strlen((char*)in);
-    byte   out[256];
-    byte   plain[256];
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    FILE*  file, * file2;
-#endif
-#ifdef CYASSL_TEST_CERT
-    DecodedCert cert;
-#endif
-
-    tmp = (byte*)malloc(FOURK_BUF);
-    if (tmp == NULL)
-        return -40;
-
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, client_key_der_1024, sizeof_client_key_der_1024);
-    bytes = sizeof_client_key_der_1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, client_key_der_2048, sizeof_client_key_der_2048);
-    bytes = sizeof_client_key_der_2048;
-#else
-    file = fopen(clientKey, "rb");
-
-    if (!file)
-        err_sys("can't open ./certs/client-key.der, "
-                "Please run from CyaSSL home dir", -40);
-
-    bytes = fread(tmp, 1, FOURK_BUF, file);
-    fclose(file);
-#endif /* USE_CERT_BUFFERS */
-
-#ifdef HAVE_CAVIUM
-    RsaInitCavium(&key, CAVIUM_DEV_ID);
-#endif
-    ret = InitRsaKey(&key, 0);
-    if (ret != 0) return -39;
-    ret = RsaPrivateKeyDecode(tmp, &idx, &key, (word32)bytes);
-    if (ret != 0) return -41;
-
-    ret = InitRng(&rng);
-    if (ret != 0) return -42;
-
-    ret = RsaPublicEncrypt(in, inLen, out, sizeof(out), &key, &rng);
-    if (ret < 0) return -43;
-
-    ret = RsaPrivateDecrypt(out, ret, plain, sizeof(plain), &key);
-    if (ret < 0) return -44;
-
-    if (memcmp(plain, in, inLen)) return -45;
-
-    ret = RsaSSL_Sign(in, inLen, out, sizeof(out), &key, &rng);
-    if (ret < 0) return -46;
-
-    memset(plain, 0, sizeof(plain));
-    ret = RsaSSL_Verify(out, ret, plain, sizeof(plain), &key);
-    if (ret < 0) return -47;
-
-    if (memcmp(plain, in, ret)) return -48;
-
-#if defined(CYASSL_MDK_ARM)
-    #define sizeof(s) strlen((char *)(s))
-#endif
-
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, client_cert_der_1024, sizeof_client_cert_der_1024);
-    bytes = sizeof_client_cert_der_1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, client_cert_der_2048, sizeof_client_cert_der_2048);
-    bytes = sizeof_client_cert_der_2048;
-#else
-    file2 = fopen(clientCert, "rb");
-    if (!file2)
-        return -49;
-
-    bytes = fread(tmp, 1, FOURK_BUF, file2);
-    fclose(file2);
-#endif
-
-#ifdef sizeof
-		#undef sizeof
-#endif
-
-#ifdef CYASSL_TEST_CERT
-    InitDecodedCert(&cert, tmp, (word32)bytes, 0);
-
-    ret = ParseCert(&cert, CERT_TYPE, NO_VERIFY, 0);
-    if (ret != 0) return -491;
-
-    FreeDecodedCert(&cert);
-#else
-    (void)bytes;
-#endif
-
-
-#ifdef CYASSL_KEY_GEN
-    {
-        byte*  der;
-        byte*  pem;
-        int    derSz = 0;
-        int    pemSz = 0;
-        RsaKey derIn;
-        RsaKey genKey;
-        FILE* keyFile;
-        FILE* pemFile;
-
-        ret = InitRsaKey(&genKey, 0);
-        if (ret != 0)
-            return -300;
-        ret = MakeRsaKey(&genKey, 1024, 65537, &rng);
-        if (ret != 0)
-            return -301;
-
-        der = (byte*)malloc(FOURK_BUF);
-        if (der == NULL) {
-            FreeRsaKey(&genKey);
-            return -307;
-        }
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(der);
-            FreeRsaKey(&genKey);
-            return -308;
-        }
-
-        derSz = RsaKeyToDer(&genKey, der, FOURK_BUF);
-        if (derSz < 0) {
-            free(der);
-            free(pem);
-            return -302;
-        }
-
-        keyFile = fopen("./key.der", "wb");
-        if (!keyFile) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -303;
-        }
-        ret = (int)fwrite(der, 1, derSz, keyFile);
-        fclose(keyFile);
-        if (ret != derSz) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -313;
-        }
-
-        pemSz = DerToPem(der, derSz, pem, FOURK_BUF, PRIVATEKEY_TYPE);
-        if (pemSz < 0) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -304;
-        }
-
-        pemFile = fopen("./key.pem", "wb");
-        if (!pemFile) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -305;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        fclose(pemFile);
-        if (ret != pemSz) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -314;
-        }
-
-        ret = InitRsaKey(&derIn, 0);
-        if (ret != 0) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -3060;
-        }
-        idx = 0;
-        ret = RsaPrivateKeyDecode(der, &idx, &derIn, derSz);
-        if (ret != 0) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&derIn);
-            FreeRsaKey(&genKey);
-            return -306;
-        }
-
-        FreeRsaKey(&derIn);
-        FreeRsaKey(&genKey);
-        free(pem);
-        free(der);
-    }
-#endif /* CYASSL_KEY_GEN */
-
-
-#ifdef CYASSL_CERT_GEN
-    /* self signed */
-    {
-        Cert        myCert;
-        byte*       derCert;
-        byte*       pem;
-        FILE*       derFile;
-        FILE*       pemFile;
-        int         certSz;
-        int         pemSz;
-#ifdef CYASSL_TEST_CERT
-        DecodedCert decode;
-#endif
-
-        derCert = (byte*)malloc(FOURK_BUF);
-        if (derCert == NULL)
-            return -309;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(derCert);
-            return -310;
-        }
-
-        InitCert(&myCert);
-
-        strncpy(myCert.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(myCert.subject.org, "yaSSL", CTC_NAME_SIZE);
-        strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(myCert.subject.commonName, "www.yassl.com", CTC_NAME_SIZE);
-        strncpy(myCert.subject.email, "info@yassl.com", CTC_NAME_SIZE);
-        myCert.isCA    = 1;
-        myCert.sigType = CTC_SHA256wRSA;
-
-        certSz = MakeSelfCert(&myCert, derCert, FOURK_BUF, &key, &rng);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            return -401;
-        }
-
-#ifdef CYASSL_TEST_CERT
-        InitDecodedCert(&decode, derCert, certSz, 0);
-        ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -402;
-        }
-        FreeDecodedCert(&decode);
-#endif
-        derFile = fopen("./cert.der", "wb");
-        if (!derFile) {
-            free(derCert);
-            free(pem);
-            return -403;
-        }
-        ret = (int)fwrite(derCert, 1, certSz, derFile);
-        fclose(derFile);
-        if (ret != certSz) {
-            free(derCert);
-            free(pem);
-            return -414;
-        }
-
-        pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE);
-        if (pemSz < 0) {
-            free(derCert);
-            free(pem);
-            return -404;
-        }
-
-        pemFile = fopen("./cert.pem", "wb");
-        if (!pemFile) {
-            free(derCert);
-            free(pem);
-            return -405;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        fclose(pemFile);
-        if (ret != pemSz) {
-            free(derCert);
-            free(pem);
-            return -406;
-        }
-        free(pem);
-        free(derCert);
-    }
-    /* CA style */
-    {
-        RsaKey      caKey;
-        Cert        myCert;
-        byte*       derCert;
-        byte*       pem;
-        FILE*       derFile;
-        FILE*       pemFile;
-        int         certSz;
-        int         pemSz;
-        size_t      bytes3;
-        word32      idx3 = 0;
-			  FILE* file3 ;
-#ifdef CYASSL_TEST_CERT
-        DecodedCert decode;
-#endif
-
-        derCert = (byte*)malloc(FOURK_BUF);
-        if (derCert == NULL)
-            return -311;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(derCert);
-            return -312;
-        }
-
-        file3 = fopen(caKeyFile, "rb");
-
-        if (!file3) {
-            free(derCert);
-            free(pem);
-            return -412;
-        }
-
-        bytes3 = fread(tmp, 1, FOURK_BUF, file3);
-        fclose(file3);
-
-        ret = InitRsaKey(&caKey, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -411;
-        }
-        ret = RsaPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes3);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -413;
-        }
-
-        InitCert(&myCert);
-
-        strncpy(myCert.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(myCert.subject.org, "yaSSL", CTC_NAME_SIZE);
-        strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(myCert.subject.commonName, "www.yassl.com", CTC_NAME_SIZE);
-        strncpy(myCert.subject.email, "info@yassl.com", CTC_NAME_SIZE);
-
-        ret = SetIssuer(&myCert, caCertFile);
-        if (ret < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -405;
-        }
-
-        certSz = MakeCert(&myCert, derCert, FOURK_BUF, &key, NULL, &rng);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -407;
-        }
-
-        certSz = SignCert(myCert.bodySz, myCert.sigType, derCert, FOURK_BUF,
-                          &caKey, NULL, &rng);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -408;
-        }
-
-
-#ifdef CYASSL_TEST_CERT
-        InitDecodedCert(&decode, derCert, certSz, 0);
-        ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -409;
-        }
-        FreeDecodedCert(&decode);
-#endif
-
-        derFile = fopen("./othercert.der", "wb");
-        if (!derFile) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -410;
-        }
-        ret = (int)fwrite(derCert, 1, certSz, derFile);
-        fclose(derFile);
-        if (ret != certSz) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -416;
-        }
-
-        pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE);
-        if (pemSz < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -411;
-        }
-
-        pemFile = fopen("./othercert.pem", "wb");
-        if (!pemFile) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -412;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        if (ret != pemSz) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -415;
-        }
-        fclose(pemFile);
-        free(pem);
-        free(derCert);
-        FreeRsaKey(&caKey);
-    }
-#ifdef HAVE_ECC
-    /* ECC CA style */
-    {
-        ecc_key     caKey;
-        Cert        myCert;
-        byte*       derCert;
-        byte*       pem;
-        FILE*       derFile;
-        FILE*       pemFile;
-        int         certSz;
-        int         pemSz;
-        size_t      bytes3;
-        word32      idx3 = 0;
-        FILE*       file3;
-#ifdef CYASSL_TEST_CERT
-        DecodedCert decode;
-#endif
-
-        derCert = (byte*)malloc(FOURK_BUF);
-        if (derCert == NULL)
-            return -5311;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(derCert);
-            return -5312;
-        }
-
-        file3 = fopen(eccCaKeyFile, "rb");
-
-        if (!file3) {
-            free(derCert);
-            free(pem);
-            return -5412;
-        }
-
-        bytes3 = fread(tmp, 1, FOURK_BUF, file3);
-        fclose(file3);
-
-        ecc_init(&caKey);
-        ret = EccPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes3);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -5413;
-        }
-
-        InitCert(&myCert);
-        myCert.sigType = CTC_SHA256wECDSA;
-
-        strncpy(myCert.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(myCert.subject.org, "wolfSSL", CTC_NAME_SIZE);
-        strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(myCert.subject.commonName, "www.wolfssl.com", CTC_NAME_SIZE);
-        strncpy(myCert.subject.email, "info@wolfssl.com", CTC_NAME_SIZE);
-
-        ret = SetIssuer(&myCert, eccCaCertFile);
-        if (ret < 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5405;
-        }
-
-        certSz = MakeCert(&myCert, derCert, FOURK_BUF, NULL, &caKey, &rng);
-        if (certSz < 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5407;
-        }
-
-        certSz = SignCert(myCert.bodySz, myCert.sigType, derCert, FOURK_BUF,
-                          NULL, &caKey, &rng);
-        if (certSz < 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5408;
-        }
-
-#ifdef CYASSL_TEST_CERT
-        InitDecodedCert(&decode, derCert, certSz, 0);
-        ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
-        if (ret != 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5409;
-        }
-        FreeDecodedCert(&decode);
-#endif
-
-        derFile = fopen("./certecc.der", "wb");
-        if (!derFile) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5410;
-        }
-        ret = (int)fwrite(derCert, 1, certSz, derFile);
-        fclose(derFile);
-        if (ret != certSz) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5414;
-        }
-
-        pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE);
-        if (pemSz < 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5411;
-        }
-
-        pemFile = fopen("./certecc.pem", "wb");
-        if (!pemFile) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5412;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        if (ret != pemSz) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5415;
-        }
-        fclose(pemFile);
-        free(pem);
-        free(derCert);
-        ecc_free(&caKey);
-    }
-#endif /* HAVE_ECC */
-#ifdef HAVE_NTRU
-    {
-        RsaKey      caKey;
-        Cert        myCert;
-        byte*       derCert;
-        byte*       pem;
-        FILE*       derFile;
-        FILE*       pemFile;
-        FILE*       caFile;
-        FILE*       ntruPrivFile;
-        int         certSz;
-        int         pemSz;
-        word32      idx3;
-#ifdef CYASSL_TEST_CERT
-        DecodedCert decode;
-#endif
-        derCert = (byte*)malloc(FOURK_BUF);
-        if (derCert == NULL)
-            return -311;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(derCert);
-            return -312;
-        }
-
-        byte   public_key[557];          /* sized for EES401EP2 */
-        word16 public_key_len;           /* no. of octets in public key */
-        byte   private_key[607];         /* sized for EES401EP2 */
-        word16 private_key_len;          /* no. of octets in private key */
-        DRBG_HANDLE drbg;
-        static uint8_t const pers_str[] = {
-                'C', 'y', 'a', 'S', 'S', 'L', ' ', 't', 'e', 's', 't'
-        };
-        word32 rc = crypto_drbg_instantiate(112, pers_str, sizeof(pers_str),
-                                            GetEntropy, &drbg);
-        if (rc != DRBG_OK) {
-            free(derCert);
-            free(pem);
-            return -450;
-        }
-
-        rc = crypto_ntru_encrypt_keygen(drbg, NTRU_EES401EP2, &public_key_len,
-                                        NULL, &private_key_len, NULL);
-        if (rc != NTRU_OK) {
-            free(derCert);
-            free(pem);
-            return -451;
-        }
-
-        rc = crypto_ntru_encrypt_keygen(drbg, NTRU_EES401EP2, &public_key_len,
-                                     public_key, &private_key_len, private_key);
-        crypto_drbg_uninstantiate(drbg);
-
-        if (rc != NTRU_OK) {
-            free(derCert);
-            free(pem);
-            return -452;
-        }
-
-        caFile = fopen(caKeyFile, "rb");
-
-        if (!caFile) {
-            free(derCert);
-            free(pem);
-            return -453;
-        }
-
-        bytes = fread(tmp, 1, FOURK_BUF, caFile);
-        fclose(caFile);
-
-        ret = InitRsaKey(&caKey, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -459;
-        }
-        ret = RsaPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -454;
-        }
-
-        InitCert(&myCert);
-
-        strncpy(myCert.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(myCert.subject.org, "yaSSL", CTC_NAME_SIZE);
-        strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(myCert.subject.commonName, "www.yassl.com", CTC_NAME_SIZE);
-        strncpy(myCert.subject.email, "info@yassl.com", CTC_NAME_SIZE);
-
-        ret = SetIssuer(&myCert, caCertFile);
-        if (ret < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -455;
-        }
-
-        certSz = MakeNtruCert(&myCert, derCert, FOURK_BUF, public_key,
-                              public_key_len, &rng);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -456;
-        }
-
-        certSz = SignCert(myCert.bodySz, myCert.sigType, derCert, FOURK_BUF,
-                          &caKey, NULL, &rng);
-        FreeRsaKey(&caKey);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            return -457;
-        }
-
-
-#ifdef CYASSL_TEST_CERT
-        InitDecodedCert(&decode, derCert, certSz, 0);
-        ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -458;
-        }
-        FreeDecodedCert(&decode);
-#endif
-        derFile = fopen("./ntru-cert.der", "wb");
-        if (!derFile) {
-            free(derCert);
-            free(pem);
-            return -459;
-        }
-        ret = (int)fwrite(derCert, 1, certSz, derFile);
-        fclose(derFile);
-        if (ret != certSz) {
-            free(derCert);
-            free(pem);
-            return -473;
-        }
-
-        pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE);
-        if (pemSz < 0) {
-            free(derCert);
-            free(pem);
-            return -460;
-        }
-
-        pemFile = fopen("./ntru-cert.pem", "wb");
-        if (!pemFile) {
-            free(derCert);
-            free(pem);
-            return -461;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        fclose(pemFile);
-        if (ret != pemSz) {
-            free(derCert);
-            free(pem);
-            return -474;
-        }
-
-        ntruPrivFile = fopen("./ntru-key.raw", "wb");
-        if (!ntruPrivFile) {
-            free(derCert);
-            free(pem);
-            return -462;
-        }
-        ret = (int)fwrite(private_key, 1, private_key_len, ntruPrivFile);
-        fclose(ntruPrivFile);
-        if (ret != private_key_len) {
-            free(pem);
-            free(derCert);
-            return -475;
-        }
-        free(pem);
-        free(derCert);
-    }
-#endif /* HAVE_NTRU */
-#ifdef CYASSL_CERT_REQ
-    {
-        Cert        req;
-        byte*       der;
-        byte*       pem;
-        int         derSz;
-        int         pemSz;
-        FILE*       reqFile;
-
-        der = (byte*)malloc(FOURK_BUF);
-        if (der == NULL)
-            return -463;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(der);
-            return -464;
-        }
-
-        InitCert(&req);
-
-        req.version = 0;
-        req.isCA    = 1;
-        strncpy(req.challengePw, "yassl123", CTC_NAME_SIZE);
-        strncpy(req.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(req.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(req.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(req.subject.org, "yaSSL", CTC_NAME_SIZE);
-        strncpy(req.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(req.subject.commonName, "www.yassl.com", CTC_NAME_SIZE);
-        strncpy(req.subject.email, "info@yassl.com", CTC_NAME_SIZE);
-        req.sigType = CTC_SHA256wRSA;
-
-        derSz = MakeCertReq(&req, der, FOURK_BUF, &key, NULL);
-        if (derSz < 0) {
-            free(pem);
-            free(der);
-            return -465;
-        }
-
-        derSz = SignCert(req.bodySz, req.sigType, der, FOURK_BUF,
-                          &key, NULL, &rng);
-        if (derSz < 0) {
-            free(pem);
-            free(der);
-            return -466;
-        }
-
-        pemSz = DerToPem(der, derSz, pem, FOURK_BUF, CERTREQ_TYPE);
-        if (pemSz < 0) {
-            free(pem);
-            free(der);
-            return -467;
-        }
-
-        reqFile = fopen("./certreq.der", "wb");
-        if (!reqFile) {
-            free(pem);
-            free(der);
-            return -468;
-        }
-
-        ret = (int)fwrite(der, 1, derSz, reqFile);
-        fclose(reqFile);
-        if (ret != derSz) {
-            free(pem);
-            free(der);
-            return -471;
-        }
-
-        reqFile = fopen("./certreq.pem", "wb");
-        if (!reqFile) {
-            free(pem);
-            free(der);
-            return -469;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, reqFile);
-        fclose(reqFile);
-        if (ret != pemSz) {
-            free(pem);
-            free(der);
-            return -470;
-        }
-
-        free(pem);
-        free(der);
-    }
-#endif /* CYASSL_CERT_REQ */
-#endif /* CYASSL_CERT_GEN */
-
-    FreeRsaKey(&key);
-#ifdef HAVE_CAVIUM
-    RsaFreeCavium(&key);
-#endif
-    free(tmp);
-
-    return 0;
-}
-
-#endif
-
-
-#ifndef NO_DH
-
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    #ifdef FREESCALE_MQX
-        static const char* dhKey = "a:\certs\\dh2048.der";
-    #else
-        static const char* dhKey = "./certs/dh2048.der";
-    #endif
-#endif
-
-int dh_test(void)
-{
-    int    ret;
-    word32 bytes;
-    word32 idx = 0, privSz, pubSz, privSz2, pubSz2, agreeSz, agreeSz2;
-    byte   tmp[1024];
-    byte   priv[256];
-    byte   pub[256];
-    byte   priv2[256];
-    byte   pub2[256];
-    byte   agree[256];
-    byte   agree2[256];
-    DhKey  key;
-    DhKey  key2;
-    WC_RNG rng;
-
-
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, dh_key_der_1024, sizeof_dh_key_der_1024);
-    bytes = sizeof_dh_key_der_1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, dh_key_der_2048, sizeof_dh_key_der_2048);
-    bytes = sizeof_dh_key_der_2048;
-#else
-    FILE*  file = fopen(dhKey, "rb");
-
-    if (!file)
-        return -50;
-
-    bytes = (word32) fread(tmp, 1, sizeof(tmp), file);
-    fclose(file);
-#endif /* USE_CERT_BUFFERS */
-
-    InitDhKey(&key);
-    InitDhKey(&key2);
-    ret = DhKeyDecode(tmp, &idx, &key, bytes);
-    if (ret != 0)
-        return -51;
-
-    idx = 0;
-    ret = DhKeyDecode(tmp, &idx, &key2, bytes);
-    if (ret != 0)
-        return -52;
-
-    ret = InitRng(&rng);
-    if (ret != 0)
-        return -53;
-
-    ret =  DhGenerateKeyPair(&key, &rng, priv, &privSz, pub, &pubSz);
-    ret += DhGenerateKeyPair(&key2, &rng, priv2, &privSz2, pub2, &pubSz2);
-    if (ret != 0)
-        return -54;
-
-    ret =  DhAgree(&key, agree, &agreeSz, priv, privSz, pub2, pubSz2);
-    ret += DhAgree(&key2, agree2, &agreeSz2, priv2, privSz2, pub, pubSz);
-    if (ret != 0)
-        return -55;
-
-    if (memcmp(agree, agree2, agreeSz))
-        return -56;
-
-    FreeDhKey(&key);
-    FreeDhKey(&key2);
-
-    return 0;
-}
-
-#endif /* NO_DH */
-
-
-#ifndef NO_DSA
-
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    #ifdef FREESCALE_MQX
-        static const char* dsaKey = "a:\\certs\\dsa2048.der";
-    #else
-        static const char* dsaKey = "./certs/dsa2048.der";
-    #endif
-#endif
-
-int dsa_test(void)
-{
-    int    ret, answer;
-    word32 bytes;
-    word32 idx = 0;
-    byte   tmp[1024];
-    DsaKey key;
-    WC_RNG rng;
-    Sha    sha;
-    byte   hash[SHA_DIGEST_SIZE];
-    byte   signature[40];
-
-
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, dsa_key_der_1024, sizeof_dsa_key_der_1024);
-    bytes = sizeof_dsa_key_der_1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, dsa_key_der_2048, sizeof_dsa_key_der_2048);
-    bytes = sizeof_dsa_key_der_2048;
-#else
-    FILE*  file = fopen(dsaKey, "rb");
-
-    if (!file)
-        return -60;
-
-    bytes = (word32) fread(tmp, 1, sizeof(tmp), file);
-    fclose(file);
-#endif /* USE_CERT_BUFFERS */
-
-    ret = InitSha(&sha);
-    if (ret != 0)
-        return -4002;
-    ShaUpdate(&sha, tmp, bytes);
-    ShaFinal(&sha, hash);
-
-    InitDsaKey(&key);
-    ret = DsaPrivateKeyDecode(tmp, &idx, &key, bytes);
-    if (ret != 0) return -61;
-
-    ret = InitRng(&rng);
-    if (ret != 0) return -62;
-
-    ret = DsaSign(hash, signature, &key, &rng);
-    if (ret != 0) return -63;
-
-    ret = DsaVerify(hash, signature, &key, &answer);
-    if (ret != 0) return -64;
-    if (answer != 1) return -65;
-
-    FreeDsaKey(&key);
-
-    return 0;
-}
-
-#endif /* NO_DSA */
-
-
-#ifdef OPENSSL_EXTRA
-
-int openssl_test(void)
-{
-    EVP_MD_CTX md_ctx;
-    testVector a, b, c, d, e, f;
-    byte       hash[SHA_DIGEST_SIZE*4];  /* max size */
-
-    (void)e;
-    (void)f;
-
-    a.input  = "1234567890123456789012345678901234567890123456789012345678"
-               "9012345678901234567890";
-    a.output = "\x57\xed\xf4\xa2\x2b\xe3\xc9\x55\xac\x49\xda\x2e\x21\x07\xb6"
-               "\x7a";
-    a.inLen  = strlen(a.input);
-    a.outLen = MD5_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_md5());
-
-    EVP_DigestUpdate(&md_ctx, a.input, a.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, a.output, MD5_DIGEST_SIZE) != 0)
-        return -71;
-
-    b.input  = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-               "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-               "aaaaaaaaaa";
-    b.output = "\xAD\x5B\x3F\xDB\xCB\x52\x67\x78\xC2\x83\x9D\x2F\x15\x1E\xA7"
-               "\x53\x99\x5E\x26\xA0";
-    b.inLen  = strlen(b.input);
-    b.outLen = SHA_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_sha1());
-
-    EVP_DigestUpdate(&md_ctx, b.input, b.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, b.output, SHA_DIGEST_SIZE) != 0)
-        return -72;
-
-
-    d.input  = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
-    d.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";
-    d.inLen  = strlen(d.input);
-    d.outLen = SHA256_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_sha256());
-
-    EVP_DigestUpdate(&md_ctx, d.input, d.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, d.output, SHA256_DIGEST_SIZE) != 0)
-        return -78;
-
-#ifdef CYASSL_SHA384
-
-    e.input  = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
-               "jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
-    e.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";
-    e.inLen  = strlen(e.input);
-    e.outLen = SHA384_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_sha384());
-
-    EVP_DigestUpdate(&md_ctx, e.input, e.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, e.output, SHA384_DIGEST_SIZE) != 0)
-        return -79;
-
-#endif /* CYASSL_SHA384 */
-
-
-#ifdef CYASSL_SHA512
-
-    f.input  = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
-               "jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
-    f.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";
-    f.inLen  = strlen(f.input);
-    f.outLen = SHA512_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_sha512());
-
-    EVP_DigestUpdate(&md_ctx, f.input, f.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, f.output, SHA512_DIGEST_SIZE) != 0)
-        return -80;
-
-#endif /* CYASSL_SHA512 */
-
-
-    if (RAND_bytes(hash, sizeof(hash)) != 1)
-        return -73;
-
-    c.input  = "what do ya want for nothing?";
-    c.output = "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7"
-               "\x38";
-    c.inLen  = strlen(c.input);
-    c.outLen = MD5_DIGEST_SIZE;
-
-    HMAC(EVP_md5(), "Jefe", 4, (byte*)c.input, (int)c.inLen, hash, 0);
-
-    if (memcmp(hash, c.output, MD5_DIGEST_SIZE) != 0)
-        return -74;
-
-    { /* des test */
-    const byte vector[] = { /* "now is the time for all " w/o trailing 0 */
-        0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-        0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-        0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-    };
-
-    byte plain[24];
-    byte cipher[24];
-
-    const_DES_cblock key =
-    {
-        0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef
-    };
-
-    DES_cblock iv =
-    {
-        0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef
-    };
-
-    DES_key_schedule sched;
-
-    const byte verify[] =
-    {
-        0x8b,0x7c,0x52,0xb0,0x01,0x2b,0x6c,0xb8,
-        0x4f,0x0f,0xeb,0xf3,0xfb,0x5f,0x86,0x73,
-        0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
-    };
-
-    DES_key_sched(&key, &sched);
-
-    DES_cbc_encrypt(vector, cipher, sizeof(vector), &sched, &iv, DES_ENCRYPT);
-    DES_cbc_encrypt(cipher, plain, sizeof(vector), &sched, &iv, DES_DECRYPT);
-
-    if (memcmp(plain, vector, sizeof(vector)) != 0)
-        return -75;
-
-    if (memcmp(cipher, verify, sizeof(verify)) != 0)
-        return -76;
-
-        /* test changing iv */
-    DES_ncbc_encrypt(vector, cipher, 8, &sched, &iv, DES_ENCRYPT);
-    DES_ncbc_encrypt(vector + 8, cipher + 8, 16, &sched, &iv, DES_ENCRYPT);
-
-    if (memcmp(cipher, verify, sizeof(verify)) != 0)
-        return -77;
-
-    }  /* end des test */
-
-    {  /* evp_cipher test */
-        EVP_CIPHER_CTX ctx;
-
-
-        const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */
-            0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-            0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-            0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-        };
-
-        const byte verify[] =
-        {
-            0x95,0x94,0x92,0x57,0x5f,0x42,0x81,0x53,
-            0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
-        };
-
-        byte key[] = "0123456789abcdef   ";  /* align */
-        byte iv[]  = "1234567890abcdef   ";  /* align */
-
-        byte cipher[AES_BLOCK_SIZE * 4];
-        byte plain [AES_BLOCK_SIZE * 4];
-
-        EVP_CIPHER_CTX_init(&ctx);
-        if (EVP_CipherInit(&ctx, EVP_aes_128_cbc(), key, iv, 1) == 0)
-            return -81;
-
-        if (EVP_Cipher(&ctx, cipher, (byte*)msg, 16) == 0)
-            return -82;
-
-        if (memcmp(cipher, verify, AES_BLOCK_SIZE))
-            return -83;
-
-        EVP_CIPHER_CTX_init(&ctx);
-        if (EVP_CipherInit(&ctx, EVP_aes_128_cbc(), key, iv, 0) == 0)
-            return -84;
-
-        if (EVP_Cipher(&ctx, plain, cipher, 16) == 0)
-            return -85;
-
-        if (memcmp(plain, msg, AES_BLOCK_SIZE))
-            return -86;
-
-
-    }  /* end evp_cipher test */
-
-    return 0;
-}
-
-#endif /* OPENSSL_EXTRA */
-
-
-#ifndef NO_PWDBASED
-
-int pkcs12_test(void)
-{
-    const byte passwd[] = { 0x00, 0x73, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x67,
-                            0x00, 0x00 };
-    const byte salt[] =   { 0x0a, 0x58, 0xCF, 0x64, 0x53, 0x0d, 0x82, 0x3f };
-
-    const byte passwd2[] = { 0x00, 0x71, 0x00, 0x75, 0x00, 0x65, 0x00, 0x65,
-                             0x00, 0x67, 0x00, 0x00 };
-    const byte salt2[] =   { 0x16, 0x82, 0xC0, 0xfC, 0x5b, 0x3f, 0x7e, 0xc5 };
-    byte  derived[64];
-
-    const byte verify[] = {
-        0x8A, 0xAA, 0xE6, 0x29, 0x7B, 0x6C, 0xB0, 0x46,
-        0x42, 0xAB, 0x5B, 0x07, 0x78, 0x51, 0x28, 0x4E,
-        0xB7, 0x12, 0x8F, 0x1A, 0x2A, 0x7F, 0xBC, 0xA3
-    };
-
-    const byte verify2[] = {
-        0x48, 0x3D, 0xD6, 0xE9, 0x19, 0xD7, 0xDE, 0x2E,
-        0x8E, 0x64, 0x8B, 0xA8, 0xF8, 0x62, 0xF3, 0xFB,
-        0xFB, 0xDC, 0x2B, 0xCB, 0x2C, 0x02, 0x95, 0x7F
-    };
-
-    int id         =  1;
-    int kLen       = 24;
-    int iterations =  1;
-    int ret = PKCS12_PBKDF(derived, passwd, sizeof(passwd), salt, 8, iterations,
-                           kLen, SHA, id);
-
-    if (ret < 0)
-        return -103;
-
-    if ( (ret = memcmp(derived, verify, kLen)) != 0)
-        return -104;
-
-    iterations = 1000;
-    ret = PKCS12_PBKDF(derived, passwd2, sizeof(passwd2), salt2, 8, iterations,
-                       kLen, SHA, id);
-    if (ret < 0)
-        return -105;
-
-    if ( (ret = memcmp(derived, verify2, 24)) != 0)
-        return -106;
-
-    return 0;
-}
-
-
-int pbkdf2_test(void)
-{
-    char passwd[] = "password";
-    const byte salt[] = { 0x78, 0x57, 0x8E, 0x5a, 0x5d, 0x63, 0xcb, 0x06 };
-    int   iterations = 2048;
-    int   kLen = 24;
-    byte  derived[64];
-
-    const byte verify[] = {
-        0xBF, 0xDE, 0x6B, 0xE9, 0x4D, 0xF7, 0xE1, 0x1D, 0xD4, 0x09, 0xBC, 0xE2,
-        0x0A, 0x02, 0x55, 0xEC, 0x32, 0x7C, 0xB9, 0x36, 0xFF, 0xE9, 0x36, 0x43
-
-    };
-
-    int ret = PBKDF2(derived, (byte*)passwd, (int)strlen(passwd), salt, 8,
-                                                         iterations, kLen, SHA);
-    if (ret != 0)
-        return ret;
-
-    if (memcmp(derived, verify, sizeof(verify)) != 0)
-        return -102;
-
-    return 0;
-}
-
-
-int pbkdf1_test(void)
-{
-    char passwd[] = "password";
-    const byte salt[] = { 0x78, 0x57, 0x8E, 0x5a, 0x5d, 0x63, 0xcb, 0x06 };
-    int   iterations = 1000;
-    int   kLen = 16;
-    byte  derived[16];
-
-    const byte verify[] = {
-        0xDC, 0x19, 0x84, 0x7E, 0x05, 0xC6, 0x4D, 0x2F, 0xAF, 0x10, 0xEB, 0xFB,
-        0x4A, 0x3D, 0x2A, 0x20
-    };
-
-    PBKDF1(derived, (byte*)passwd, (int)strlen(passwd), salt, 8, iterations,
-           kLen, SHA);
-
-    if (memcmp(derived, verify, sizeof(verify)) != 0)
-        return -101;
-
-    return 0;
-}
-
-
-int pwdbased_test(void)
-{
-   int ret =  pbkdf1_test();
-   ret += pbkdf2_test();
-
-   return ret + pkcs12_test();
-}
-
-#endif /* NO_PWDBASED */
-
-#if defined(HAVE_HKDF) && (!defined(NO_SHA) || !defined(NO_SHA256))
-
-int hkdf_test(void)
-{
-    int ret;
-    int L = 42;
-    byte okm1[42];
-    byte ikm1[22] = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
-                      0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
-                      0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b };
-    byte salt1[13] ={ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-                      0x08, 0x09, 0x0a, 0x0b, 0x0c };
-    byte info1[10] ={ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
-                      0xf8, 0xf9 };
-    byte res1[42] = { 0x0a, 0xc1, 0xaf, 0x70, 0x02, 0xb3, 0xd7, 0x61,
-                      0xd1, 0xe5, 0x52, 0x98, 0xda, 0x9d, 0x05, 0x06,
-                      0xb9, 0xae, 0x52, 0x05, 0x72, 0x20, 0xa3, 0x06,
-                      0xe0, 0x7b, 0x6b, 0x87, 0xe8, 0xdf, 0x21, 0xd0,
-                      0xea, 0x00, 0x03, 0x3d, 0xe0, 0x39, 0x84, 0xd3,
-                      0x49, 0x18 };
-    byte res2[42] = { 0x08, 0x5a, 0x01, 0xea, 0x1b, 0x10, 0xf3, 0x69,
-                      0x33, 0x06, 0x8b, 0x56, 0xef, 0xa5, 0xad, 0x81,
-                      0xa4, 0xf1, 0x4b, 0x82, 0x2f, 0x5b, 0x09, 0x15,
-                      0x68, 0xa9, 0xcd, 0xd4, 0xf1, 0x55, 0xfd, 0xa2,
-                      0xc2, 0x2e, 0x42, 0x24, 0x78, 0xd3, 0x05, 0xf3,
-                      0xf8, 0x96 };
-    byte res3[42] = { 0x8d, 0xa4, 0xe7, 0x75, 0xa5, 0x63, 0xc1, 0x8f,
-                      0x71, 0x5f, 0x80, 0x2a, 0x06, 0x3c, 0x5a, 0x31,
-                      0xb8, 0xa1, 0x1f, 0x5c, 0x5e, 0xe1, 0x87, 0x9e,
-                      0xc3, 0x45, 0x4e, 0x5f, 0x3c, 0x73, 0x8d, 0x2d,
-                      0x9d, 0x20, 0x13, 0x95, 0xfa, 0xa4, 0xb6, 0x1a,
-                      0x96, 0xc8 };
-    byte res4[42] = { 0x3c, 0xb2, 0x5f, 0x25, 0xfa, 0xac, 0xd5, 0x7a,
-                      0x90, 0x43, 0x4f, 0x64, 0xd0, 0x36, 0x2f, 0x2a,
-                      0x2d, 0x2d, 0x0a, 0x90, 0xcf, 0x1a, 0x5a, 0x4c,
-                      0x5d, 0xb0, 0x2d, 0x56, 0xec, 0xc4, 0xc5, 0xbf,
-                      0x34, 0x00, 0x72, 0x08, 0xd5, 0xb8, 0x87, 0x18,
-                      0x58, 0x65 };
-
-    (void)res1;
-    (void)res2;
-    (void)res3;
-    (void)res4;
-
-#ifndef NO_SHA
-    ret = HKDF(SHA, ikm1, 22, NULL, 0, NULL, 0, okm1, L);
-    if (ret != 0)
-        return -2001;
-
-    if (memcmp(okm1, res1, L) != 0)
-        return -2002;
-
-    ret = HKDF(SHA, ikm1, 11, salt1, 13, info1, 10, okm1, L);
-    if (ret != 0)
-        return -2003;
-
-    if (memcmp(okm1, res2, L) != 0)
-        return -2004;
-#endif /* NO_SHA */
-
-#ifndef NO_SHA256
-    ret = HKDF(SHA256, ikm1, 22, NULL, 0, NULL, 0, okm1, L);
-    if (ret != 0)
-        return -2005;
-
-    if (memcmp(okm1, res3, L) != 0)
-        return -2006;
-
-    ret = HKDF(SHA256, ikm1, 22, salt1, 13, info1, 10, okm1, L);
-    if (ret != 0)
-        return -2007;
-
-    if (memcmp(okm1, res4, L) != 0)
-        return -2007;
-#endif /* NO_SHA256 */
-
-    return 0;
-}
-
-#endif /* HAVE_HKDF */
-
-
-#ifdef HAVE_ECC
-
-int ecc_test(void)
-{
-    WC_RNG  rng;
-    byte    sharedA[1024];
-    byte    sharedB[1024];
-    byte    sig[1024];
-    byte    digest[20];
-    byte    exportBuf[1024];
-    word32  x, y;
-    int     i, verify, ret;
-    ecc_key userA, userB, pubKey;
-
-    ret = InitRng(&rng);
-    if (ret != 0)
-        return -1001;
-
-    ecc_init(&userA);
-    ecc_init(&userB);
-    ecc_init(&pubKey);
-
-    ret = ecc_make_key(&rng, 32, &userA);
-
-    if (ret != 0)
-        return -1014;
-
-    ret = ecc_make_key(&rng, 32, &userB);
-
-    if (ret != 0)
-        return -1002;
-
-    x = sizeof(sharedA);
-    ret = ecc_shared_secret(&userA, &userB, sharedA, &x);
-
-    if (ret != 0)
-        return -1015;
-
-    y = sizeof(sharedB);
-    ret = ecc_shared_secret(&userB, &userA, sharedB, &y);
-
-    if (ret != 0)
-        return -1003;
-
-    if (y != x)
-        return -1004;
-
-    if (memcmp(sharedA, sharedB, x))
-        return -1005;
-
-    x = sizeof(exportBuf);
-    ret = ecc_export_x963(&userA, exportBuf, &x);
-    if (ret != 0)
-        return -1006;
-
-    ret = ecc_import_x963(exportBuf, x, &pubKey);
-
-    if (ret != 0)
-        return -1007;
-
-    y = sizeof(sharedB);
-    ret = ecc_shared_secret(&userB, &pubKey, sharedB, &y);
-
-    if (ret != 0)
-        return -1008;
-
-    if (memcmp(sharedA, sharedB, y))
-        return -1010;
-
-    /* test DSA sign hash */
-    for (i = 0; i < (int)sizeof(digest); i++)
-        digest[i] = (byte)i;
-
-    x = sizeof(sig);
-    ret = ecc_sign_hash(digest, sizeof(digest), sig, &x, &rng, &userA);
-
-    if (ret != 0)
-        return -1016;
-
-    verify = 0;
-    ret = ecc_verify_hash(sig, x, digest, sizeof(digest), &verify, &userA);
-
-    if (ret != 0)
-        return -1011;
-
-    if (verify != 1)
-        return -1012;
-
-    x = sizeof(exportBuf);
-    ret = ecc_export_private_only(&userA, exportBuf, &x);
-    if (ret != 0)
-        return -1013;
-
-    ecc_free(&pubKey);
-    ecc_free(&userB);
-    ecc_free(&userA);
-
-    return 0;
-}
-
-#ifdef HAVE_ECC_ENCRYPT
-
-int ecc_encrypt_test(void)
-{
-    WC_RNG  rng;
-    int     ret;
-    ecc_key userA, userB;
-    byte    msg[48];
-    byte    plain[48];
-    byte    out[80];
-    word32  outSz   = sizeof(out);
-    word32  plainSz = sizeof(plain);
-    int     i;
-
-    ret = InitRng(&rng);
-    if (ret != 0)
-        return -3001;
-
-    ecc_init(&userA);
-    ecc_init(&userB);
-
-    ret  = ecc_make_key(&rng, 32, &userA);
-    ret += ecc_make_key(&rng, 32, &userB);
-
-    if (ret != 0)
-        return -3002;
-
-    for (i = 0; i < 48; i++)
-        msg[i] = i;
-
-    /* encrypt msg to B */
-    ret = ecc_encrypt(&userA, &userB, msg, sizeof(msg), out, &outSz, NULL);
-    if (ret != 0)
-        return -3003;
-
-    /* decrypt msg from A */
-    ret = ecc_decrypt(&userB, &userA, out, outSz, plain, &plainSz, NULL);
-    if (ret != 0)
-        return -3004;
-
-    if (memcmp(plain, msg, sizeof(msg)) != 0)
-        return -3005;
-
-
-    {  /* let's verify message exchange works, A is client, B is server */
-        ecEncCtx* cliCtx = ecc_ctx_new(REQ_RESP_CLIENT, &rng);
-        ecEncCtx* srvCtx = ecc_ctx_new(REQ_RESP_SERVER, &rng);
-
-        byte cliSalt[EXCHANGE_SALT_SZ];
-        byte srvSalt[EXCHANGE_SALT_SZ];
-        const byte* tmpSalt;
-
-        if (cliCtx == NULL || srvCtx == NULL)
-            return -3006;
-
-        /* get salt to send to peer */
-        tmpSalt = ecc_ctx_get_own_salt(cliCtx);
-        if (tmpSalt == NULL)
-            return -3007;
-        memcpy(cliSalt, tmpSalt, EXCHANGE_SALT_SZ);
-
-        tmpSalt = ecc_ctx_get_own_salt(srvCtx);
-        if (tmpSalt == NULL)
-            return -3007;
-        memcpy(srvSalt, tmpSalt, EXCHANGE_SALT_SZ);
-
-        /* in actual use, we'd get the peer's salt over the transport */
-        ret  = ecc_ctx_set_peer_salt(cliCtx, srvSalt);
-        ret += ecc_ctx_set_peer_salt(srvCtx, cliSalt);
-
-        if (ret != 0)
-            return -3008;
-
-        /* get encrypted msg (request) to send to B */
-        outSz  = sizeof(out);
-        ret = ecc_encrypt(&userA, &userB, msg, sizeof(msg), out, &outSz,cliCtx);
-        if (ret != 0)
-            return -3009;
-
-        /* B decrypts msg (request) from A */
-        plainSz = sizeof(plain);
-        ret = ecc_decrypt(&userB, &userA, out, outSz, plain, &plainSz, srvCtx);
-        if (ret != 0)
-            return -3010;
-
-        if (memcmp(plain, msg, sizeof(msg)) != 0)
-            return -3011;
-
-        {
-            /* msg2 (response) from B to A */
-            byte    msg2[48];
-            byte    plain2[48];
-            byte    out2[80];
-            word32  outSz2   = sizeof(out2);
-            word32  plainSz2 = sizeof(plain2);
-
-            for (i = 0; i < 48; i++)
-                msg2[i] = i+48;
-
-            /* get encrypted msg (response) to send to B */
-            ret = ecc_encrypt(&userB, &userA, msg2, sizeof(msg2), out2,
-                              &outSz2, srvCtx);
-            if (ret != 0)
-                return -3012;
-
-            /* A decrypts msg (response) from B */
-            ret = ecc_decrypt(&userA, &userB, out2, outSz2, plain2, &plainSz2,
-                             cliCtx);
-            if (ret != 0)
-                return -3013;
-
-            if (memcmp(plain2, msg2, sizeof(msg2)) != 0)
-                return -3014;
-        }
-
-        /* cleanup */
-        ecc_ctx_free(srvCtx);
-        ecc_ctx_free(cliCtx);
-    }
-
-    /* cleanup */
-    ecc_free(&userB);
-    ecc_free(&userA);
-
-    return 0;
-}
-
-#endif /* HAVE_ECC_ENCRYPT */
-#endif /* HAVE_ECC */
-
-#ifdef HAVE_LIBZ
-
-const byte sample_text[] =
-    "Biodiesel cupidatat marfa, cliche aute put a bird on it incididunt elit\n"
-    "polaroid. Sunt tattooed bespoke reprehenderit. Sint twee organic id\n"
-    "marfa. Commodo veniam ad esse gastropub. 3 wolf moon sartorial vero,\n"
-    "plaid delectus biodiesel squid +1 vice. Post-ironic keffiyeh leggings\n"
-    "selfies cray fap hoodie, forage anim. Carles cupidatat shoreditch, VHS\n"
-    "small batch meggings kogi dolore food truck bespoke gastropub.\n"
-    "\n"
-    "Terry richardson adipisicing actually typewriter tumblr, twee whatever\n"
-    "four loko you probably haven't heard of them high life. Messenger bag\n"
-    "whatever tattooed deep v mlkshk. Brooklyn pinterest assumenda chillwave\n"
-    "et, banksy ullamco messenger bag umami pariatur direct trade forage.\n"
-    "Typewriter culpa try-hard, pariatur sint brooklyn meggings. Gentrify\n"
-    "food truck next level, tousled irony non semiotics PBR ethical anim cred\n"
-    "readymade. Mumblecore brunch lomo odd future, portland organic terry\n"
-    "richardson elit leggings adipisicing ennui raw denim banjo hella. Godard\n"
-    "mixtape polaroid, pork belly readymade organic cray typewriter helvetica\n"
-    "four loko whatever street art yr farm-to-table.\n"
-    "\n"
-    "Vinyl keytar vice tofu. Locavore you probably haven't heard of them pug\n"
-    "pickled, hella tonx labore truffaut DIY mlkshk elit cosby sweater sint\n"
-    "et mumblecore. Elit swag semiotics, reprehenderit DIY sartorial nisi ugh\n"
-    "nesciunt pug pork belly wayfarers selfies delectus. Ethical hoodie\n"
-    "seitan fingerstache kale chips. Terry richardson artisan williamsburg,\n"
-    "eiusmod fanny pack irony tonx ennui lo-fi incididunt tofu YOLO\n"
-    "readymade. 8-bit sed ethnic beard officia. Pour-over iphone DIY butcher,\n"
-    "ethnic art party qui letterpress nisi proident jean shorts mlkshk\n"
-    "locavore.\n"
-    "\n"
-    "Narwhal flexitarian letterpress, do gluten-free voluptate next level\n"
-    "banh mi tonx incididunt carles DIY. Odd future nulla 8-bit beard ut\n"
-    "cillum pickled velit, YOLO officia you probably haven't heard of them\n"
-    "trust fund gastropub. Nisi adipisicing tattooed, Austin mlkshk 90's\n"
-    "small batch american apparel. Put a bird on it cosby sweater before they\n"
-    "sold out pork belly kogi hella. Street art mollit sustainable polaroid,\n"
-    "DIY ethnic ea pug beard dreamcatcher cosby sweater magna scenester nisi.\n"
-    "Sed pork belly skateboard mollit, labore proident eiusmod. Sriracha\n"
-    "excepteur cosby sweater, anim deserunt laborum eu aliquip ethical et\n"
-    "neutra PBR selvage.\n"
-    "\n"
-    "Raw denim pork belly truffaut, irony plaid sustainable put a bird on it\n"
-    "next level jean shorts exercitation. Hashtag keytar whatever, nihil\n"
-    "authentic aliquip disrupt laborum. Tattooed selfies deserunt trust fund\n"
-    "wayfarers. 3 wolf moon synth church-key sartorial, gastropub leggings\n"
-    "tattooed. Labore high life commodo, meggings raw denim fingerstache pug\n"
-    "trust fund leggings seitan forage. Nostrud ullamco duis, reprehenderit\n"
-    "incididunt flannel sustainable helvetica pork belly pug banksy you\n"
-    "probably haven't heard of them nesciunt farm-to-table. Disrupt nostrud\n"
-    "mollit magna, sriracha sartorial helvetica.\n"
-    "\n"
-    "Nulla kogi reprehenderit, skateboard sustainable duis adipisicing viral\n"
-    "ad fanny pack salvia. Fanny pack trust fund you probably haven't heard\n"
-    "of them YOLO vice nihil. Keffiyeh cray lo-fi pinterest cardigan aliqua,\n"
-    "reprehenderit aute. Culpa tousled williamsburg, marfa lomo actually anim\n"
-    "skateboard. Iphone aliqua ugh, semiotics pariatur vero readymade\n"
-    "organic. Marfa squid nulla, in laborum disrupt laboris irure gastropub.\n"
-    "Veniam sunt food truck leggings, sint vinyl fap.\n"
-    "\n"
-    "Hella dolore pork belly, truffaut carles you probably haven't heard of\n"
-    "them PBR helvetica in sapiente. Fashion axe ugh bushwick american\n"
-    "apparel. Fingerstache sed iphone, jean shorts blue bottle nisi bushwick\n"
-    "flexitarian officia veniam plaid bespoke fap YOLO lo-fi. Blog\n"
-    "letterpress mumblecore, food truck id cray brooklyn cillum ad sed.\n"
-    "Assumenda chambray wayfarers vinyl mixtape sustainable. VHS vinyl\n"
-    "delectus, culpa williamsburg polaroid cliche swag church-key synth kogi\n"
-    "magna pop-up literally. Swag thundercats ennui shoreditch vegan\n"
-    "pitchfork neutra truffaut etsy, sed single-origin coffee craft beer.\n"
-    "\n"
-    "Odio letterpress brooklyn elit. Nulla single-origin coffee in occaecat\n"
-    "meggings. Irony meggings 8-bit, chillwave lo-fi adipisicing cred\n"
-    "dreamcatcher veniam. Put a bird on it irony umami, trust fund bushwick\n"
-    "locavore kale chips. Sriracha swag thundercats, chillwave disrupt\n"
-    "tousled beard mollit mustache leggings portland next level. Nihil esse\n"
-    "est, skateboard art party etsy thundercats sed dreamcatcher ut iphone\n"
-    "swag consectetur et. Irure skateboard banjo, nulla deserunt messenger\n"
-    "bag dolor terry richardson sapiente.\n";
-
-
-int compress_test(void)
-{
-    int ret = 0;
-    word32 dSz = sizeof(sample_text);
-    word32 cSz = (dSz + (word32)(dSz * 0.001) + 12);
-    byte *c = NULL;
-    byte *d = NULL;
-
-    c = calloc(cSz, sizeof(byte));
-    d = calloc(dSz, sizeof(byte));
-
-    if (c == NULL || d == NULL)
-        ret = -300;
-
-    if (ret == 0 && (ret = Compress(c, cSz, sample_text, dSz, 0)) < 0)
-        ret = -301;
-
-    if (ret > 0) {
-        cSz = (word32)ret;
-        ret = 0;
-    }
-
-    if (ret == 0 && DeCompress(d, dSz, c, cSz) != (int)dSz)
-        ret = -302;
-
-    if (ret == 0 && memcmp(d, sample_text, dSz))
-        ret = -303;
-
-    if (c) free(c);
-    if (d) free(d);
-
-    return ret;
-}
-
-#endif /* HAVE_LIBZ */
-
-#ifdef HAVE_PKCS7
-
-int pkcs7enveloped_test(void)
-{
-    int ret = 0;
-
-    int cipher = DES3b;
-    int envelopedSz, decodedSz;
-    PKCS7 pkcs7;
-    byte* cert;
-    byte* privKey;
-    byte  enveloped[2048];
-    byte  decoded[2048];
-
-    size_t certSz;
-    size_t privKeySz;
-    FILE*  certFile;
-    FILE*  keyFile;
-    FILE*  pkcs7File;
-    const char* pkcs7OutFile = "pkcs7envelopedData.der";
-
-    const byte data[] = { /* Hello World */
-        0x48,0x65,0x6c,0x6c,0x6f,0x20,0x57,0x6f,
-        0x72,0x6c,0x64
-    };
-
-    /* read client cert and key in DER format */
-    cert = (byte*)malloc(FOURK_BUF);
-    if (cert == NULL)
-        return -201;
-
-    privKey = (byte*)malloc(FOURK_BUF);
-    if (privKey == NULL) {
-        free(cert);
-        return -202;
-    }
-
-    certFile = fopen(clientCert, "rb");
-    if (!certFile) {
-        free(cert);
-        free(privKey);
-        err_sys("can't open ./certs/client-cert.der, "
-                "Please run from CyaSSL home dir", -42);
-    }
-
-    certSz = fread(cert, 1, FOURK_BUF, certFile);
-    fclose(certFile);
-
-    keyFile = fopen(clientKey, "rb");
-    if (!keyFile) {
-        free(cert);
-        free(privKey);
-        err_sys("can't open ./certs/client-key.der, "
-                "Please run from CyaSSL home dir", -43);
-    }
-
-    privKeySz = fread(privKey, 1, FOURK_BUF, keyFile);
-    fclose(keyFile);
-
-    PKCS7_InitWithCert(&pkcs7, cert, (word32)certSz);
-    pkcs7.content     = (byte*)data;
-    pkcs7.contentSz   = (word32)sizeof(data);
-    pkcs7.contentOID  = DATA;
-    pkcs7.encryptOID  = cipher;
-    pkcs7.privateKey  = privKey;
-    pkcs7.privateKeySz = (word32)privKeySz;
-
-    /* encode envelopedData */
-    envelopedSz = PKCS7_EncodeEnvelopedData(&pkcs7, enveloped,
-                                            sizeof(enveloped));
-    if (envelopedSz <= 0) {
-        free(cert);
-        free(privKey);
-        return -203;
-    }
-
-    /* decode envelopedData */
-    decodedSz = PKCS7_DecodeEnvelopedData(&pkcs7, enveloped, envelopedSz,
-                                          decoded, sizeof(decoded));
-    if (decodedSz <= 0) {
-        free(cert);
-        free(privKey);
-        return -204;
-    }
-
-    /* test decode result */
-    if (memcmp(decoded, data, sizeof(data)) != 0) {
-        free(cert);
-        free(privKey);
-        return -205;
-    }
-
-    /* output pkcs7 envelopedData for external testing */
-    pkcs7File = fopen(pkcs7OutFile, "wb");
-    if (!pkcs7File) {
-        free(cert);
-        free(privKey);
-        return -206;
-    }
-
-    ret = (int)fwrite(enveloped, envelopedSz, 1, pkcs7File);
-    fclose(pkcs7File);
-
-    free(cert);
-    free(privKey);
-    PKCS7_Free(&pkcs7);
-
-    if (ret > 0)
-        return 0;
-
-    return ret;
-}
-
-int pkcs7signed_test(void)
-{
-    int ret = 0;
-
-    FILE* file;
-    byte* certDer;
-    byte* keyDer;
-    byte* out;
-    char data[] = "Hello World";
-    word32 dataSz, outSz, certDerSz, keyDerSz;
-    PKCS7  msg;
-    WC_RNG rng;
-
-    byte transIdOid[] =
-               { 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01,
-                 0x09, 0x07 };
-    byte messageTypeOid[] =
-               { 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01,
-                 0x09, 0x02 };
-    byte senderNonceOid[] =
-               { 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01,
-                 0x09, 0x05 };
-    byte transId[(SHA_DIGEST_SIZE + 1) * 2 + 1];
-    byte messageType[] = { 0x13, 2, '1', '9' };
-    byte senderNonce[PKCS7_NONCE_SZ + 2];
-
-    PKCS7Attrib attribs[] =
-    {
-        { transIdOid, sizeof(transIdOid),
-                     transId, sizeof(transId) - 1 }, /* take off the null */
-        { messageTypeOid, sizeof(messageTypeOid),
-                     messageType, sizeof(messageType) },
-        { senderNonceOid, sizeof(senderNonceOid),
-                     senderNonce, sizeof(senderNonce) }
-    };
-
-    dataSz = (word32) strlen(data);
-    outSz = FOURK_BUF;
-
-    certDer = (byte*)malloc(FOURK_BUF);
-    if (certDer == NULL)
-        return -207;
-    keyDer = (byte*)malloc(FOURK_BUF);
-    if (keyDer == NULL) {
-        free(certDer);
-        return -208;
-    }
-    out = (byte*)malloc(FOURK_BUF);
-    if (out == NULL) {
-        free(certDer);
-        free(keyDer);
-        return -209;
-    }
-
-    /* read in DER cert of recipient, into cert of size certSz */
-    file = fopen(clientCert, "rb");
-    if (!file) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        err_sys("can't open ./certs/client-cert.der, "
-                "Please run from CyaSSL home dir", -44);
-    }
-    certDerSz = (word32)fread(certDer, 1, FOURK_BUF, file);
-    fclose(file);
-
-    file = fopen(clientKey, "rb");
-    if (!file) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        err_sys("can't open ./certs/client-key.der, "
-                "Please run from CyaSSL home dir", -45);
-    }
-    keyDerSz = (word32)fread(keyDer, 1, FOURK_BUF, file);
-    fclose(file);
-
-    ret = InitRng(&rng);
-    if (ret != 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        return -210;
-    }
-
-    senderNonce[0] = 0x04;
-    senderNonce[1] = PKCS7_NONCE_SZ;
-
-    ret = RNG_GenerateBlock(&rng, &senderNonce[2], PKCS7_NONCE_SZ);
-    if (ret != 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        return -211;
-    }
-
-    PKCS7_InitWithCert(&msg, certDer, certDerSz);
-    msg.privateKey = keyDer;
-    msg.privateKeySz = keyDerSz;
-    msg.content = (byte*)data;
-    msg.contentSz = dataSz;
-    msg.hashOID = SHAh;
-    msg.encryptOID = RSAk;
-    msg.signedAttribs = attribs;
-    msg.signedAttribsSz = sizeof(attribs)/sizeof(PKCS7Attrib);
-    msg.rng = &rng;
-    {
-        Sha sha;
-        byte digest[SHA_DIGEST_SIZE];
-        int i,j;
-
-        transId[0] = 0x13;
-        transId[1] = SHA_DIGEST_SIZE * 2;
-
-        ret = InitSha(&sha);
-        if (ret != 0) {
-            free(certDer);
-            free(keyDer);
-            free(out);
-            return -4003;
-        }
-        ShaUpdate(&sha, msg.publicKey, msg.publicKeySz);
-        ShaFinal(&sha, digest);
-
-        for (i = 0, j = 2; i < SHA_DIGEST_SIZE; i++, j += 2) {
-            snprintf((char*)&transId[j], 3, "%02x", digest[i]);
-        }
-    }
-    ret = PKCS7_EncodeSignedData(&msg, out, outSz);
-    if (ret < 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -212;
-    }
-    else
-        outSz = ret;
-
-    /* write PKCS#7 to output file for more testing */
-    file = fopen("./pkcs7signedData.der", "wb");
-    if (!file) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -213;
-    }
-    ret = (int)fwrite(out, 1, outSz, file);
-    fclose(file);
-    if (ret != (int)outSz) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -218;
-    }
-
-    PKCS7_Free(&msg);
-    PKCS7_InitWithCert(&msg, NULL, 0);
-
-    ret = PKCS7_VerifySignedData(&msg, out, outSz);
-    if (ret < 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -214;
-    }
-
-    if (msg.singleCert == NULL || msg.singleCertSz == 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -215;
-    }
-
-    file = fopen("./pkcs7cert.der", "wb");
-    if (!file) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -216;
-    }
-    ret = (int)fwrite(msg.singleCert, 1, msg.singleCertSz, file);
-    fclose(file);
-
-    free(certDer);
-    free(keyDer);
-    free(out);
-    PKCS7_Free(&msg);
-
-    if (ret > 0)
-        return 0;
-
-    return ret;
-}
-
-#endif /* HAVE_PKCS7 */
-
-#endif /* NO_CRYPT_TEST */
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/time-CortexM3-4.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/time-CortexM3-4.c
deleted file mode 100644
index ca5046138..000000000
--- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/time-CortexM3-4.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* time-STM32F2.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 
-#endif
-
-
-#include        
-#define DWT                 ((DWT_Type       *)     (0xE0001000UL)     ) 
-typedef struct
-{
-  uint32_t CTRL;                    /*!< Offset: 0x000 (R/W)  Control Register                          */
-  uint32_t CYCCNT;                  /*!< Offset: 0x004 (R/W)  Cycle Count Register                      */
-} DWT_Type;
-
-extern uint32_t SystemCoreClock ;
-
-double current_time(int reset) 
-{
-      if(reset) DWT->CYCCNT = 0 ;
-      return ((double)DWT->CYCCNT/SystemCoreClock) ;
-}
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/time-dummy.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/time-dummy.c
deleted file mode 100644
index 8f98da46a..000000000
--- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/time-dummy.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* time-dummy.c.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
- 
-#ifdef HAVE_CONFIG_H
-    #include 
-#endif
-
-#include "time.h"
-
-struct tm *Cyassl_MDK_gmtime(const time_t *c) 
-{ 
-    static struct tm date ; 
-    return(&date) ;
-}
-
-time_t time(time_t * t) { return 0 ; }

From 26ca093c765614a159b6367e00ad274011bc27a4 Mon Sep 17 00:00:00 2001
From: Takashi Kojo 
Date: Fri, 9 Oct 2015 09:49:38 +0900
Subject: [PATCH 46/77] fixed errno with errno.h

---
 src/io.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/src/io.c b/src/io.c
index d7065df9e..3df6570b9 100644
--- a/src/io.c
+++ b/src/io.c
@@ -64,15 +64,12 @@
     #elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET)
         #if defined(WOLFSSL_MDK5) || defined(WOLFSSL_KEIL_TCP_NET)
             #include "cmsis_os.h"
-            #include "rl_net.h"
         #else
             #include 
         #endif
-        static int errno;
+        #include "errno.h"
         #define SOCKET_T int
         #include "rl_net.h"
-        /* for avoiding name conflict in "stm32f2xx.h" */
-        static int errno;
     #elif defined(WOLFSSL_TIRTOS)
         #include 
     #elif defined(FREERTOS_TCP)

From bf3b0a228d3f00c95042a582b098fdd9fe9d59a9 Mon Sep 17 00:00:00 2001
From: Ludovic FLAMENT 
Date: Fri, 9 Oct 2015 15:18:41 +0200
Subject: [PATCH 47/77] add support for Application-Layer Protocol Name (RFC
 7301) in the TLS extensions

---
 configure.ac              |  17 ++-
 examples/client/client.c  |  55 ++++++-
 examples/server/server.c  |  34 ++++-
 src/internal.c            |   3 +
 src/ssl.c                 |  63 ++++++++
 src/tls.c                 | 309 ++++++++++++++++++++++++++++++++++++++
 tests/api.c               | 297 ++++++++++++++++++++++++++++++------
 wolfssl/error-ssl.h       |   2 +
 wolfssl/internal.h        |  20 ++-
 wolfssl/ssl.h             |  25 ++-
 wolfssl/wolfcrypt/types.h |   2 +-
 11 files changed, 773 insertions(+), 54 deletions(-)

diff --git a/configure.ac b/configure.ac
index a239a89de..018685731 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1565,6 +1565,19 @@ AC_ARG_ENABLE([maxfragment],
     [ ENABLED_MAX_FRAGMENT=no ]
     )
 
+# ALPN
+AC_ARG_ENABLE([alpn],
+    [  --enable-alpn            Enable ALPN (default: disabled)],
+    [ ENABLED_ALPN=$enableval ],
+    [ ENABLED_ALPN=no ]
+    )
+
+if test "x$ENABLED_ALPN" = "xyes"
+then
+    AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_ALPN"
+fi
+
+# Maximum Fragment Length
 if test "x$ENABLED_MAX_FRAGMENT" = "xyes"
 then
     AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_MAX_FRAGMENT"
@@ -1647,7 +1660,8 @@ then
 	ENABLED_MAX_FRAGMENT=yes
 	ENABLED_TRUNCATED_HMAC=yes
 	ENABLED_SUPPORTED_CURVES=yes
-    AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_SUPPORTED_CURVES"
+	ENABLED_ALPN=yes
+    AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_SUPPORTED_CURVES -DHAVE_ALPN"
 fi
 
 # PKCS7
@@ -2473,6 +2487,7 @@ echo "   * Atomic User Record Layer:  $ENABLED_ATOMICUSER"
 echo "   * Public Key Callbacks:      $ENABLED_PKCALLBACKS"
 echo "   * NTRU:                      $ENABLED_NTRU"
 echo "   * SNI:                       $ENABLED_SNI"
+echo "   * ALPN:                      $ENABLED_ALPN"
 echo "   * Maximum Fragment Length:   $ENABLED_MAX_FRAGMENT"
 echo "   * Truncated HMAC:            $ENABLED_TRUNCATED_HMAC"
 echo "   * Renegotiation Indication:  $ENABLED_RENEGOTIATION_INDICATION"
diff --git a/examples/client/client.c b/examples/client/client.c
index b37fd4cd3..3f8d232df 100644
--- a/examples/client/client.c
+++ b/examples/client/client.c
@@ -193,6 +193,9 @@ static void Usage(void)
 #ifdef HAVE_CRL
     printf("-C          Disable CRL\n");
 #endif
+#ifdef HAVE_ALPN
+    printf("-n    Application-Layer Protocole Name\n");
+#endif
 }
 
 THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
@@ -243,6 +246,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
     int    pkCallbacks   = 0;
     int    overrideDateErrors = 0;
     int    minDhKeyBits  = DEFAULT_MIN_DHKEY_BITS;
+    char*  alpnList = NULL;
     char*  cipherList = NULL;
     const char* verifyCert = caCert;
     const char* ourCert    = cliCert;
@@ -289,11 +293,12 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
     (void)overrideDateErrors;
     (void)disableCRL;
     (void)minDhKeyBits;
+    (void)alpnList;
 
     StackTrap();
 
     while ((ch = mygetopt(argc, argv,
-                          "?gdeDusmNrwRitfxXUPCh:p:v:l:A:c:k:Z:b:zS:L:ToO:a"))
+                          "?gdeDusmNrwRitfxXUPCh:p:v:l:A:c:k:Z:b:zS:L:ToO:an:"))
                                                                         != -1) {
         switch (ch) {
             case '?' :
@@ -492,6 +497,12 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
                 #endif
                 break;
 
+            case 'n' :
+                #ifdef HAVE_ALPN
+                    alpnList = myoptarg;
+                #endif
+                break;
+
             default:
                 Usage();
                 exit(MY_EX_USAGE);
@@ -797,6 +808,14 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
     #ifdef HAVE_SESSION_TICKET
     wolfSSL_set_SessionTicket_cb(ssl, sessionTicketCB, (void*)"initial session");
     #endif
+
+#ifdef HAVE_ALPN
+    if (alpnList != NULL) {
+       printf("ALPN accepted protocols list : %s\n", alpnList);
+        wolfSSL_UseALPN(ssl, alpnList, (word32)XSTRLEN(alpnList));
+    }
+#endif
+
     if (doDTLS) {
         SOCKADDR_IN_T addr;
         build_addr(&addr, host, port, 1);
@@ -865,6 +884,20 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
 #endif
     showPeer(ssl);
 
+#ifdef HAVE_ALPN
+    {
+        char *protocol_name = NULL;
+        word16 protocol_nameSz = 0;
+
+        if (wolfSSL_ALPN_GetProtocol(ssl, &protocol_name,
+                                     &protocol_nameSz) != SSL_SUCCESS)
+            printf("Getting ALPN protocol name failed\n");
+        else
+            printf("Received ALPN protocol : %s (%d)\n",
+                   protocol_name, protocol_nameSz);
+    }
+#endif
+
 #ifdef HAVE_SECURE_RENEGOTIATION
     if (scr && forceScr) {
         if (nonBlocking) {
@@ -952,6 +985,12 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
             tcp_connect(&sockfd, host, port, 0);
         }
         wolfSSL_set_fd(sslResume, sockfd);
+#ifdef HAVE_ALPN
+        if (alpnList != NULL) {
+            printf("ALPN accepted protocols list : %s\n", alpnList);
+            wolfSSL_UseALPN(sslResume, alpnList, (word32)XSTRLEN(alpnList));
+        }
+#endif
 #ifdef HAVE_SECURE_RENEGOTIATION
         if (scr) {
             if (wolfSSL_UseSecureRenegotiation(sslResume) != SSL_SUCCESS)
@@ -984,6 +1023,20 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
         else
             printf("didn't reuse session id!!!\n");
 
+#ifdef HAVE_ALPN
+        {
+            char *protocol_name = NULL;
+            word16 protocol_nameSz = 0;
+
+            printf("Sending ALPN accepted list : %s\n", alpnList);
+            if (wolfSSL_ALPN_GetProtocol(sslResume, &protocol_name,
+                                         &protocol_nameSz) != SSL_SUCCESS)
+                printf("Getting ALPN protocol name failed\n");
+            else
+                printf("Received ALPN protocol : %s (%d)\n",
+                       protocol_name, protocol_nameSz);
+        }
+#endif
         if (wolfSSL_write(sslResume, resumeMsg, resumeSz) != resumeSz)
             err_sys("SSL_write failed");
 
diff --git a/examples/server/server.c b/examples/server/server.c
index 07f3012e4..b2e90ad31 100644
--- a/examples/server/server.c
+++ b/examples/server/server.c
@@ -161,6 +161,9 @@ static void Usage(void)
 #ifndef NO_PSK
     printf("-I          Do not send PSK identity hint\n");
 #endif
+#ifdef HAVE_ALPN
+    printf("-L    Application-Layer Protocole Name\n");
+#endif
 }
 
 THREAD_RETURN CYASSL_THREAD server_test(void* args)
@@ -194,6 +197,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
     int    resume = 0;            /* do resume, and resume count */
     int    minDhKeyBits = DEFAULT_MIN_DHKEY_BITS;
     int    ret;
+    char*  alpnList = NULL;
     char*  cipherList = NULL;
     const char* verifyCert = cliCert;
     const char* ourCert    = svrCert;
@@ -232,12 +236,13 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
     (void)useNtruKey;
     (void)doCliCertCheck;
     (void)minDhKeyBits;
+    (void)alpnList;
 
 #ifdef CYASSL_TIRTOS
     fdOpenSession(Task_self());
 #endif
 
-    while ((ch = mygetopt(argc, argv, "?dbstnNufrRawPIp:v:l:A:c:k:Z:S:oO:D:"))
+    while ((ch = mygetopt(argc, argv, "?dbstnNufrRawPIp:v:l:A:c:k:Z:S:oO:D:L:"))
                          != -1) {
         switch (ch) {
             case '?' :
@@ -376,6 +381,11 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
                 #endif
                 break;
 
+            case 'L' :
+                #ifdef HAVE_ALPN
+                    alpnList = myoptarg;
+                #endif
+                break;
             default:
                 Usage();
                 exit(MY_EX_USAGE);
@@ -622,6 +632,14 @@ while (1) {  /* allow resume option */
     }
 
     SSL_set_fd(ssl, clientfd);
+
+#ifdef HAVE_ALPN
+    if (alpnList != NULL) {
+        printf("ALPN accepted protocols list : %s\n", alpnList);
+        wolfSSL_UseALPN(ssl, alpnList, (word32)XSTRLEN(alpnList));
+    }
+#endif
+
 #ifdef WOLFSSL_DTLS
     if (doDTLS) {
         SOCKADDR_IN_T cliaddr;
@@ -664,6 +682,20 @@ while (1) {  /* allow resume option */
 #endif
     showPeer(ssl);
 
+#ifdef HAVE_ALPN
+    {
+        char *protocol_name = NULL;
+        word16 protocol_nameSz = 0;
+
+        if (wolfSSL_ALPN_GetProtocol(ssl, &protocol_name,
+                                     &protocol_nameSz) != SSL_SUCCESS)
+            printf("Getting ALPN protocol name failed\n");
+        else
+            printf("Send ALPN protocol : %s (%d)\n",
+                   protocol_name, protocol_nameSz);
+    }
+#endif
+
     idx = SSL_read(ssl, input, sizeof(input)-1);
     if (idx > 0) {
         input[idx] = 0;
diff --git a/src/internal.c b/src/internal.c
index 9321a840e..f0e54cf2f 100644
--- a/src/internal.c
+++ b/src/internal.c
@@ -8500,6 +8500,9 @@ const char* wolfSSL_ERR_reason_error_string(unsigned long e)
     case RSA_SIGN_FAULT:
         return "RSA Signature Fault Error";
 
+    case UNKNOWN_ALPN_PROTOCOL_NAME_E:
+        return "Unrecognized protocol name Error";
+
     default :
         return "unknown error number";
     }
diff --git a/src/ssl.c b/src/ssl.c
index bb2bd9276..a0d7dd6dd 100644
--- a/src/ssl.c
+++ b/src/ssl.c
@@ -882,6 +882,69 @@ int wolfSSL_UseSupportedQSH(WOLFSSL* ssl, word16 name)
 #endif /* NO_WOLFSSL_CLIENT */
 #endif /* HAVE_QSH */
 
+
+/* Application-Layer Procotol Name */
+#ifdef HAVE_ALPN
+
+int wolfSSL_UseALPN(WOLFSSL* ssl, char *protocol_name_list,
+                    word32 protocol_name_listSz)
+{
+    char    *list, *ptr, *token[10];
+    word16  len;
+    int     idx = 0;
+    int     ret = SSL_FAILURE;
+
+    WOLFSSL_ENTER("wolfSSL_UseALPN");
+
+    if (ssl == NULL || protocol_name_list == NULL)
+        return BAD_FUNC_ARG;
+
+    if (protocol_name_listSz > (WOLFSSL_MAX_ALPN_NUMBER *
+                                WOLFSSL_MAX_ALPN_PROTO_NAME_LEN +
+                                WOLFSSL_MAX_ALPN_NUMBER)) {
+        WOLFSSL_MSG("Invalid arguments, procolt name list too long");
+        return BAD_FUNC_ARG;
+    }
+
+    list = (char *)XMALLOC(protocol_name_listSz+1, NULL,
+                           DYNAMIC_TYPE_TMP_BUFFER);
+    if (list == NULL) {
+        WOLFSSL_MSG("Memory failure");
+        return MEMORY_ERROR;
+    }
+
+    XMEMSET(list, 0, protocol_name_listSz+1);
+    XSTRNCPY(list, protocol_name_list, protocol_name_listSz);
+
+    /* read all protocol name from the list */
+    token[idx] = XSTRTOK(list, ",", &ptr);
+    while (token[idx] != NULL)
+        token[++idx] = XSTRTOK(NULL, ",", &ptr);
+
+    /* add protocol name list in the TLS extension in reverse order */
+    while ((idx--) > 0) {
+        len = (word16)XSTRLEN(token[idx]);
+
+        ret = TLSX_UseALPN(&ssl->extensions, token[idx], len);
+        if (ret != SSL_SUCCESS) {
+            WOLFSSL_MSG("TLSX_UseALPN failure");
+            break;
+        }
+    }
+
+    XFREE(list, NULL, DYNAMIC_TYPE_TMP_BUFFER);
+
+    return ret;
+}
+
+int wolfSSL_ALPN_GetProtocol(WOLFSSL* ssl, char **protocol_name, word16 *size)
+{
+    return TLSX_ALPN_GetRequest(ssl ? ssl->extensions : NULL,
+                           (void **)protocol_name, size);
+}
+
+#endif /* HAVE_ALPN */
+
 /* Secure Renegotiation */
 #ifdef HAVE_SECURE_RENEGOTIATION
 
diff --git a/src/tls.c b/src/tls.c
index 5d4657941..42176353c 100644
--- a/src/tls.c
+++ b/src/tls.c
@@ -845,6 +845,296 @@ void TLSX_SetResponse(WOLFSSL* ssl, TLSX_Type type)
 
 #endif
 
+
+#ifdef HAVE_ALPN
+/** Creates a new ALPN object, providing protocol name to use. */
+static ALPN* TLSX_ALPN_New(char *protocol_name, word16 protocol_nameSz)
+{
+    ALPN *alpn;
+
+    WOLFSSL_ENTER("TLSX_ALPN_New");
+
+    if (protocol_name == NULL ||
+        protocol_nameSz > WOLFSSL_MAX_ALPN_PROTO_NAME_LEN) {
+        WOLFSSL_MSG("Invalid arguments");
+        return NULL;
+    }
+
+    alpn = (ALPN*)XMALLOC(sizeof(ALPN), 0, DYNAMIC_TYPE_TLSX);
+    if (alpn == NULL) {
+        WOLFSSL_MSG("Memory failure");
+        return NULL;
+    }
+
+    alpn->next = NULL;
+
+    alpn->protocol_name = XMALLOC(protocol_nameSz + 1, 0, DYNAMIC_TYPE_TLSX);
+    if (alpn->protocol_name == NULL) {
+        WOLFSSL_MSG("Memory failure");
+        XFREE(alpn, 0, DYNAMIC_TYPE_TLSX);
+        return NULL;
+    }
+
+    XMEMCPY(alpn->protocol_name, protocol_name, protocol_nameSz);
+    alpn->protocol_name[protocol_nameSz] = 0;
+
+    return alpn;
+}
+
+/** Releases an ALPN object. */
+static void TLSX_ALPN_Free(ALPN *alpn)
+{
+    if (alpn == NULL)
+        return;
+
+    XFREE(alpn->protocol_name, 0, DYNAMIC_TYPE_TLSX);
+    XFREE(alpn, 0, DYNAMIC_TYPE_TLSX);
+}
+
+/** Releases all ALPN objects in the provided list. */
+static void TLSX_ALPN_FreeAll(ALPN *list)
+{
+    ALPN* alpn;
+
+    while ((alpn = list)) {
+        list = alpn->next;
+        TLSX_ALPN_Free(alpn);
+    }
+}
+
+/** Tells the buffered size of the ALPN objects in a list. */
+static word16 TLSX_ALPN_GetSize(ALPN *list)
+{
+    ALPN* alpn;
+    word16 length = OPAQUE16_LEN; /* list length */
+
+    while ((alpn = list)) {
+        list = alpn->next;
+
+        length++; /* protocol name length is on one byte */
+        length += XSTRLEN(alpn->protocol_name);
+    }
+    
+    return length;
+}
+
+/** Writes the ALPN objects of a list in a buffer. */
+static word16 TLSX_ALPN_Write(ALPN *list, byte *output)
+{
+    ALPN* alpn;
+    word16 length = 0;
+    word16 offset = OPAQUE16_LEN; /* list length offset */
+
+    while ((alpn = list)) {
+        list = alpn->next;
+
+        length = XSTRLEN(alpn->protocol_name);
+
+        /* protocol name length */
+        output[offset++] = (byte)length;
+
+        /* protocol name value */
+        XMEMCPY(output + offset, alpn->protocol_name, length);
+
+        offset += length;
+    }
+
+    /* writing list length */
+    c16toa(offset - OPAQUE16_LEN, output);
+    
+    return offset;
+}
+
+/** Finds a protocol name in the provided ALPN list */
+static ALPN* TLSX_ALPN_Find(ALPN *list, char *protocol_name, word16 size)
+{
+    ALPN *alpn;
+
+    if (list == NULL || protocol_name == NULL)
+        return NULL;
+
+    alpn = list;
+    while (alpn != NULL && (
+           XSTRLEN(alpn->protocol_name) != size ||
+           XSTRNCMP(alpn->protocol_name, protocol_name, size)))
+        alpn = alpn->next;
+
+    return alpn;
+}
+
+/** Set the ALPN matching client and server requirements */
+static int TLSX_SetALPN(TLSX** extensions, const void* data, word16 size)
+{
+    ALPN *alpn;
+    int  ret;
+
+    if (extensions == NULL || data == NULL)
+        return BAD_FUNC_ARG;
+
+    alpn = TLSX_ALPN_New((char *)data, size);
+    if (alpn == NULL) {
+        WOLFSSL_MSG("Memory failure");
+        return MEMORY_E;
+    }
+
+    ret = TLSX_Push(extensions, WOLFSSL_ALPN, (void*)alpn);
+    if (ret != 0) {
+        TLSX_ALPN_Free(alpn);
+        return ret;
+    }
+
+    return SSL_SUCCESS;
+}
+
+/** Parses a buffer of ALPN extensions and set the first one matching
+ * client and server requirements */
+static int TLSX_ALPN_ParseAndSet(WOLFSSL *ssl, byte *input, word16 length,
+                                 byte isRequest)
+{
+    word16 size = 0;
+    word16 offset = 0;
+    int    r = BUFFER_ERROR;
+    TLSX   *extension;
+    ALPN   *alpn = NULL;
+
+    extension = TLSX_Find(ssl->extensions, WOLFSSL_ALPN);
+    if (extension == NULL)
+        extension = TLSX_Find(ssl->ctx->extensions, WOLFSSL_ALPN);
+
+    if (extension == NULL || extension->data == NULL) {
+        WOLFSSL_MSG("No ALPN extensions not used or bad");
+        return isRequest ? 0             /* not using ALPN */
+                         : BUFFER_ERROR; /* unexpected ALPN response */
+    }
+
+    if (OPAQUE16_LEN > length)
+        return BUFFER_ERROR;
+
+    ato16(input, &size);
+    offset += OPAQUE16_LEN;
+
+    /* validating alpn list length */
+    if (length != OPAQUE16_LEN + size)
+        return BUFFER_ERROR;
+
+    for (size = 0; offset < length; offset += size) {
+
+        size = input[offset++];
+        if (offset + size > length)
+            return BUFFER_ERROR;
+
+        alpn = TLSX_ALPN_Find((ALPN*)extension->data,
+                              (char*)input + offset, size);
+        if (alpn != NULL) {
+            WOLFSSL_MSG("ALPN protocol match");
+            break;
+        }
+    }
+
+    if (alpn == NULL) {
+        WOLFSSL_MSG("No ALPN protocol match");
+
+        SendAlert(ssl, alert_fatal, no_application_protocol);
+        return UNKNOWN_ALPN_PROTOCOL_NAME_E;
+    }
+
+    /* set the matching negociated protocol */
+    r = TLSX_SetALPN(&ssl->extensions,
+                     alpn->protocol_name, XSTRLEN(alpn->protocol_name));
+    if (r != SSL_SUCCESS) {
+        WOLFSSL_MSG("TLSX_UseALPN failed");
+        return BUFFER_ERROR;
+    }
+
+    /* reply to ALPN extension sent from client */
+    if (isRequest) {
+#ifndef NO_WOLFSSL_SERVER
+        TLSX_SetResponse(ssl, WOLFSSL_ALPN);
+#endif
+    }
+
+    return 0;
+}
+
+/** Add a protocol name to the list of accepted usable ones */
+int TLSX_UseALPN(TLSX** extensions, const void* data, word16 size)
+{
+    ALPN *alpn;
+    TLSX *extension;
+    int  ret;
+
+    if (extensions == NULL || data == NULL)
+        return BAD_FUNC_ARG;
+
+    alpn = TLSX_ALPN_New((char *)data, size);
+    if (alpn == NULL) {
+        WOLFSSL_MSG("Memory failure");
+        return MEMORY_E;
+    }
+
+    extension = TLSX_Find(*extensions, WOLFSSL_ALPN);
+    if (extension == NULL) {
+        ret = TLSX_Push(extensions, WOLFSSL_ALPN, (void*)alpn);
+        if (ret != 0) {
+            TLSX_ALPN_Free(alpn);
+            return ret;
+        }
+    }
+    else {
+        /* push new ALPN object to extension data. */
+        alpn->next = (ALPN*)extension->data;
+        extension->data = (void*)alpn;
+    }
+
+    return SSL_SUCCESS;
+}
+
+/** Get the protocol name set by the server */
+int TLSX_ALPN_GetRequest(TLSX* extensions, void** data, word16 *dataSz)
+{
+    TLSX *extension;
+    ALPN *alpn;
+
+    if (extensions == NULL || data == NULL || dataSz == NULL)
+        return BAD_FUNC_ARG;
+
+    extension = TLSX_Find(extensions, WOLFSSL_ALPN);
+    if (extension == NULL) {
+        WOLFSSL_MSG("TLS extension not found");
+        return SSL_FATAL_ERROR;
+    }
+
+    alpn = (ALPN *)extension->data;
+    if (alpn == NULL) {
+        WOLFSSL_MSG("ALPN extension not found");
+        return WOLFSSL_ALPN_NO_MATCH;
+    }
+
+    if (alpn->next != NULL) {
+        WOLFSSL_MSG("Only one protocol name must be accepted");
+        return SSL_FATAL_ERROR;
+    }
+
+    *data = alpn->protocol_name;
+    *dataSz = XSTRLEN(*data);
+
+    return SSL_SUCCESS;
+}
+
+#define ALPN_FREE_ALL     TLSX_ALPN_FreeAll
+#define ALPN_GET_SIZE     TLSX_ALPN_GetSize
+#define ALPN_WRITE        TLSX_ALPN_Write
+#define ALPN_PARSE        TLSX_ALPN_ParseAndSet
+
+#else /* HAVE_ALPN */
+
+#define ALPN_FREE_ALL(list)
+#define ALPN_GET_SIZE(list)     0
+#define ALPN_WRITE(a, b)        0
+#define ALPN_PARSE(a, b, c, d)  0
+
+#endif /* HAVE_ALPN */
+
 /* Server Name Indication */
 #ifdef HAVE_SNI
 
@@ -2712,6 +3002,10 @@ void TLSX_FreeAll(TLSX* list)
             case WOLFSSL_QSH:
                 QSH_FREE_ALL(extension->data);
                 break;
+
+            case WOLFSSL_ALPN:
+                ALPN_FREE_ALL((ALPN*)extension->data);
+                break;
         }
 
         XFREE(extension, 0, DYNAMIC_TYPE_TLSX);
@@ -2775,6 +3069,11 @@ static word16 TLSX_GetSize(TLSX* list, byte* semaphore, byte isRequest)
             case WOLFSSL_QSH:
                 length += QSH_GET_SIZE(extension->data, isRequest);
                 break;
+
+            case WOLFSSL_ALPN:
+                length += ALPN_GET_SIZE(extension->data);
+                break;
+
         }
 
         /* marks the extension as processed so ctx level */
@@ -2845,6 +3144,10 @@ static word16 TLSX_Write(TLSX* list, byte* output, byte* semaphore,
                 offset += QSHPK_WRITE(extension->data, output + offset);
                 offset += QSH_SERREQ(output + offset, isRequest);
                 break;
+
+            case WOLFSSL_ALPN:
+                offset += ALPN_WRITE(extension->data, output + offset);
+                break;
         }
 
         /* writes extension data length. */
@@ -3335,6 +3638,12 @@ int TLSX_Parse(WOLFSSL* ssl, byte* input, word16 length, byte isRequest,
                 ret = QSH_PARSE(ssl, input + offset, size, isRequest);
                 break;
 
+            case WOLFSSL_ALPN:
+                WOLFSSL_MSG("ALPN extension received");
+
+                ret = ALPN_PARSE(ssl, input + offset, size, isRequest);
+                break;
+
             case HELLO_EXT_SIG_ALGO:
                 if (isRequest) {
                     /* do not mess with offset inside the switch! */
diff --git a/tests/api.c b/tests/api.c
index a34ecebbc..000c7d92d 100644
--- a/tests/api.c
+++ b/tests/api.c
@@ -507,8 +507,8 @@ done2:
     return;
 }
 
-/* SNI helper functions */
-#ifdef HAVE_SNI
+/* SNI / ALPN helper functions */
+#if defined(HAVE_SNI) || defined(HAVE_ALPN)
 
 static THREAD_RETURN WOLFSSL_THREAD run_wolfssl_server(void* args)
 {
@@ -685,7 +685,7 @@ static void run_wolfssl_client(void* args)
 #endif
 }
 
-#endif /* HAVE_SNI */
+#endif /* defined(HAVE_SNI) || defined(HAVE_ALPN) */
 #endif /* io tests dependencies */
 
 
@@ -747,6 +747,51 @@ static void test_wolfSSL_read_write(void)
  | TLS extensions tests
  *----------------------------------------------------------------------------*/
 
+#if defined(HAVE_SNI) || defined(HAVE_ALPN)
+/* connection test runner */
+static void test_wolfSSL_client_server(callback_functions* client_callbacks,
+                                       callback_functions* server_callbacks)
+{
+#ifdef HAVE_IO_TESTS_DEPENDENCIES
+    tcp_ready ready;
+    func_args client_args;
+    func_args server_args;
+    THREAD_TYPE serverThread;
+
+    StartTCP();
+
+    client_args.callbacks = client_callbacks;
+    server_args.callbacks = server_callbacks;
+
+#ifdef WOLFSSL_TIRTOS
+    fdOpenSession(Task_self());
+#endif
+
+    /* RUN Server side */
+    InitTcpReady(&ready);
+    server_args.signal = &ready;
+    client_args.signal = &ready;
+    start_thread(run_wolfssl_server, &server_args, &serverThread);
+    wait_tcp_ready(&server_args);
+
+    /* RUN Client side */
+    run_wolfssl_client(&client_args);
+    join_thread(serverThread);
+
+    FreeTcpReady(&ready);
+#ifdef WOLFSSL_TIRTOS
+    fdCloseSession(Task_self());
+#endif
+
+#else
+    (void)client_callbacks;
+    (void)server_callbacks;
+#endif
+}
+
+#endif /* defined(HAVE_SNI) || defined(HAVE_ALPN) */
+
+
 #ifdef HAVE_SNI
 static void test_wolfSSL_UseSNI_params(void)
 {
@@ -827,11 +872,6 @@ static void use_PSEUDO_MANDATORY_SNI_at_ctx(WOLFSSL_CTX* ctx)
                  WOLFSSL_SNI_ANSWER_ON_MISMATCH | WOLFSSL_SNI_ABORT_ON_ABSENCE);
 }
 
-static void verify_FATAL_ERROR_on_client(WOLFSSL* ssl)
-{
-    AssertIntEQ(FATAL_ERROR, wolfSSL_get_error(ssl, 0));
-}
-
 static void verify_UNKNOWN_SNI_on_server(WOLFSSL* ssl)
 {
     AssertIntEQ(UNKNOWN_SNI_HOST_NAME_E, wolfSSL_get_error(ssl, 0));
@@ -874,48 +914,12 @@ static void verify_SNI_fake_matching(WOLFSSL* ssl)
     AssertNotNull(request);
     AssertStrEQ("ww2.wolfssl.com", request);
 }
-/* END of connection tests callbacks */
 
-/* connection test runner */
-static void test_wolfSSL_client_server(callback_functions* client_callbacks,
-                                      callback_functions* server_callbacks)
+static void verify_FATAL_ERROR_on_client(WOLFSSL* ssl)
 {
-#ifdef HAVE_IO_TESTS_DEPENDENCIES
-    tcp_ready ready;
-    func_args client_args;
-    func_args server_args;
-    THREAD_TYPE serverThread;
-
-    StartTCP();
-
-    client_args.callbacks = client_callbacks;
-    server_args.callbacks = server_callbacks;
-
-#ifdef WOLFSSL_TIRTOS
-    fdOpenSession(Task_self());
-#endif
-
-    /* RUN Server side */
-    InitTcpReady(&ready);
-    server_args.signal = &ready;
-    client_args.signal = &ready;
-    start_thread(run_wolfssl_server, &server_args, &serverThread);
-    wait_tcp_ready(&server_args);
-
-    /* RUN Client side */
-    run_wolfssl_client(&client_args);
-    join_thread(serverThread);
-
-    FreeTcpReady(&ready);
-#ifdef WOLFSSL_TIRTOS
-    fdCloseSession(Task_self());
-#endif
-
-#else
-    (void)client_callbacks;
-    (void)server_callbacks;
-#endif
+    AssertIntEQ(FATAL_ERROR, wolfSSL_get_error(ssl, 0));
 }
+/* END of connection tests callbacks */
 
 static void test_wolfSSL_UseSNI_connection(void)
 {
@@ -1197,6 +1201,204 @@ static void test_wolfSSL_UseSupportedCurve(void)
 #endif
 }
 
+#ifdef HAVE_ALPN
+
+static void verify_ALPN_FATAL_ERROR_on_client(WOLFSSL* ssl)
+{
+    AssertIntEQ(UNKNOWN_ALPN_PROTOCOL_NAME_E, wolfSSL_get_error(ssl, 0));
+}
+
+static void use_ALPN_all(WOLFSSL* ssl)
+{
+    /* http/1.1,spdy/1,spdy/2,spdy/3 */
+    char alpn_list[] = {0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31, 0x2c,
+                        0x73, 0x70, 0x64, 0x79, 0x2f, 0x31, 0x2c,
+                        0x73, 0x70, 0x64, 0x79, 0x2f, 0x32, 0x2c,
+                        0x73, 0x70, 0x64, 0x79, 0x2f, 0x33};
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, alpn_list, sizeof(alpn_list)));
+}
+
+static void use_ALPN_one(WOLFSSL* ssl)
+{
+    /* spdy/2 */
+    char proto[] = {0x73, 0x70, 0x64, 0x79, 0x2f, 0x32};
+
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, proto, sizeof(proto)));
+}
+
+static void use_ALPN_unknown(WOLFSSL* ssl)
+{
+    /* http/2.0 */
+    char proto[] = {0x68, 0x74, 0x74, 0x70, 0x2f, 0x32, 0x2e, 0x30};
+
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, proto, sizeof(proto)));
+}
+
+static void verify_ALPN_not_matching_spdy3(WOLFSSL* ssl)
+{
+    /* spdy/3 */
+    char nego_proto[] = {0x73, 0x70, 0x64, 0x79, 0x2f, 0x33};
+
+    char *proto;
+    word16 protoSz = 0;
+
+    printf("verify_ALPN_not_matching GetProtocol(ssl) = %d\n",
+           wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
+
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
+
+    /* check value */
+    AssertIntNE(1, sizeof(nego_proto) == protoSz);
+    AssertIntNE(0, XMEMCMP(nego_proto, proto, sizeof(nego_proto)));
+}
+
+static void verify_ALPN_matching_http1(WOLFSSL* ssl)
+{
+    /* http/1.1 */
+    char nego_proto[] = {0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31};
+    char *proto;
+    word16 protoSz = 0;
+
+    printf("verify_ALPN_matching GetProtocol(ssl) = %d\n",
+           wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
+
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
+
+    /* check value */
+    AssertIntEQ(1, sizeof(nego_proto) == protoSz);
+    AssertIntEQ(0, XMEMCMP(nego_proto, proto, protoSz));
+}
+
+static void verify_ALPN_matching_spdy2(WOLFSSL* ssl)
+{
+    /* spdy/2 */
+    char nego_proto[] = {0x73, 0x70, 0x64, 0x79, 0x2f, 0x32};
+    char *proto;
+    word16 protoSz = 0;
+
+    printf("verify_ALPN_matching GetProtocol(ssl) = %d\n",
+           wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
+
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
+
+    /* check value */
+    AssertIntEQ(1, sizeof(nego_proto) == protoSz);
+    AssertIntEQ(0, XMEMCMP(nego_proto, proto, protoSz));
+}
+
+
+static void test_wolfSSL_UseALPN_connection(void)
+{
+    unsigned long i;
+    callback_functions callbacks[] = {
+        /* success case same list */
+        {0, 0, use_ALPN_all, 0},
+        {0, 0, use_ALPN_all, verify_ALPN_matching_http1},
+
+        /* success case only one for server */
+        {0, 0, use_ALPN_all, 0},
+        {0, 0, use_ALPN_one, verify_ALPN_matching_spdy2},
+
+        /* success case only one for client */
+        {0, 0, use_ALPN_one, 0},
+        {0, 0, use_ALPN_all, verify_ALPN_matching_spdy2},
+
+        /* success case none for client */
+        {0, 0, 0, 0},
+        {0, 0, use_ALPN_all, 0},
+
+        /* missmatch behavior with same list
+         * the first and only this one must be taken */
+        {0, 0, use_ALPN_all, 0},
+        {0, 0, use_ALPN_all, verify_ALPN_not_matching_spdy3},
+
+        /* default missmatch behavior */
+        {0, 0, use_ALPN_all, 0},
+        {0, 0, use_ALPN_unknown, verify_ALPN_FATAL_ERROR_on_client},
+    };
+
+    for (i = 0; i < sizeof(callbacks) / sizeof(callback_functions); i += 2) {
+        callbacks[i    ].method = wolfSSLv23_client_method;
+        callbacks[i + 1].method = wolfSSLv23_server_method;
+        test_wolfSSL_client_server(&callbacks[i], &callbacks[i + 1]);
+    }
+}
+
+static void test_wolfSSL_UseALPN_params(void)
+{
+    /* "http/1.1" */
+    char http1[] = {0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31};
+    /* "spdy/1" */
+    char spdy1[] = {0x73, 0x70, 0x64, 0x79, 0x2f, 0x31};
+    /* "spdy/2" */
+    char spdy2[] = {0x73, 0x70, 0x64, 0x79, 0x2f, 0x32};
+    /* "spdy/3" */
+    char spdy3[] = {0x73, 0x70, 0x64, 0x79, 0x2f, 0x33};
+    char buff[256];
+    word32 idx;
+
+    WOLFSSL_CTX *ctx = wolfSSL_CTX_new(wolfSSLv23_client_method());
+    WOLFSSL     *ssl = wolfSSL_new(ctx);
+
+    AssertNotNull(ctx);
+    AssertNotNull(ssl);
+
+    /* error cases */
+    AssertIntNE(SSL_SUCCESS,
+                wolfSSL_UseALPN(NULL, http1, sizeof(http1)));
+    AssertIntNE(SSL_SUCCESS, wolfSSL_UseALPN(ssl, NULL, 0));
+
+    /* success case */
+    /* http1 only */
+    AssertIntEQ(SSL_SUCCESS,
+                wolfSSL_UseALPN(ssl, http1, sizeof(http1)));
+
+    /* http1, spdy1 */
+    memcpy(buff, http1, sizeof(http1));
+    idx = sizeof(http1);
+    buff[idx++] = ',';
+    memcpy(buff+idx, spdy1, sizeof(spdy1));
+    idx += sizeof(spdy1);
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, buff, idx));
+
+    /* http1, spdy2, spdy1 */
+    memcpy(buff, http1, sizeof(http1));
+    idx = sizeof(http1);
+    buff[idx++] = ',';
+    memcpy(buff+idx, spdy2, sizeof(spdy2));
+    idx += sizeof(spdy2);
+    buff[idx++] = ',';
+    memcpy(buff+idx, spdy1, sizeof(spdy1));
+    idx += sizeof(spdy1);
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, buff, idx));
+
+    /* spdy3, http1, spdy2, spdy1 */
+    memcpy(buff, spdy3, sizeof(spdy3));
+    idx = sizeof(spdy3);
+    buff[idx++] = ',';
+    memcpy(buff+idx, http1, sizeof(http1));
+    idx += sizeof(http1);
+    buff[idx++] = ',';
+    memcpy(buff+idx, spdy2, sizeof(spdy2));
+    idx += sizeof(spdy2);
+    buff[idx++] = ',';
+    memcpy(buff+idx, spdy1, sizeof(spdy1));
+    idx += sizeof(spdy1);
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, buff, idx));
+
+    wolfSSL_free(ssl);
+    wolfSSL_CTX_free(ctx);
+}
+#endif /* HAVE_ALPN  */
+
+static void test_wolfSSL_UseALPN(void)
+{
+#ifdef HAVE_ALPN
+    test_wolfSSL_UseALPN_connection();
+    test_wolfSSL_UseALPN_params();
+#endif
+}
+
 /*----------------------------------------------------------------------------*
  | Main
  *----------------------------------------------------------------------------*/
@@ -1220,6 +1422,7 @@ void ApiTest(void)
     test_wolfSSL_UseMaxFragment();
     test_wolfSSL_UseTruncatedHMAC();
     test_wolfSSL_UseSupportedCurve();
+    test_wolfSSL_UseALPN();
 
     test_wolfSSL_Cleanup();
     printf(" End API Tests\n");
diff --git a/wolfssl/error-ssl.h b/wolfssl/error-ssl.h
index 309be9eca..ec2d9af82 100644
--- a/wolfssl/error-ssl.h
+++ b/wolfssl/error-ssl.h
@@ -137,6 +137,8 @@ enum wolfSSL_ErrorCodes {
     SNI_ABSENT_ERROR        = -402,        /* No SNI request. */
     RSA_SIGN_FAULT          = -403,        /* RSA Sign fault */
 
+    UNKNOWN_ALPN_PROTOCOL_NAME_E = -404,   /* Unrecognized protocol name Error*/
+
     /* add strings to SetErrorString !!!!! */
 
     /* begin negotiation parameter errors */
diff --git a/wolfssl/internal.h b/wolfssl/internal.h
index 99831e599..f88e96e9e 100644
--- a/wolfssl/internal.h
+++ b/wolfssl/internal.h
@@ -1453,7 +1453,8 @@ typedef enum {
     ELLIPTIC_CURVES        = 0x000a,
     SESSION_TICKET         = 0x0023,
     SECURE_RENEGOTIATION   = 0xff01,
-    WOLFSSL_QSH            = 0x0018  /* Quantum-Safe-Hybrid */
+    WOLFSSL_QSH            = 0x0018, /* Quantum-Safe-Hybrid */
+    WOLFSSL_ALPN           = 0x0010  /* Application-Layer Protocol Name */
 } TLSX_Type;
 
 typedef struct TLSX {
@@ -1486,7 +1487,8 @@ WOLFSSL_LOCAL int    TLSX_Parse(WOLFSSL* ssl, byte* input, word16 length,
    || defined(HAVE_TRUNCATED_HMAC)       \
    || defined(HAVE_SUPPORTED_CURVES)     \
    || defined(HAVE_SECURE_RENEGOTIATION) \
-   || defined(HAVE_SESSION_TICKET)
+   || defined(HAVE_SESSION_TICKET) \
+   || defined(HAVE_ALPN)
 
 #error Using TLS extensions requires HAVE_TLS_EXTENSIONS to be defined.
 
@@ -1520,6 +1522,20 @@ WOLFSSL_LOCAL int    TLSX_SNI_GetFromBuffer(const byte* buffer, word32 bufferSz,
 
 #endif /* HAVE_SNI */
 
+/* Application-layer Protocol Name */
+#ifdef HAVE_ALPN
+typedef struct ALPN {
+    char*        protocol_name; /* ALPN protocol name */
+    struct ALPN* next;          /* List Behavior      */
+} ALPN;
+
+WOLFSSL_LOCAL int TLSX_ALPN_GetRequest(TLSX* extensions,
+                                       void** data, word16 *dataSz);
+
+WOLFSSL_LOCAL int TLSX_UseALPN(TLSX** extensions, const void* data,
+                               word16 size);
+#endif /* HAVE_ALPN */
+
 /* Maximum Fragment Length */
 #ifdef HAVE_MAX_FRAGMENT
 
diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h
index 8df18bd37..1f4963c7b 100644
--- a/wolfssl/ssl.h
+++ b/wolfssl/ssl.h
@@ -187,7 +187,8 @@ enum AlertDescription {
     protocol_version        = 70,
     #endif
     no_renegotiation        = 100,
-    unrecognized_name       = 112
+    unrecognized_name       = 112,
+    no_application_protocol = 120
 };
 
 
@@ -1346,6 +1347,28 @@ WOLFSSL_API int wolfSSL_SNI_GetFromBuffer(
 #endif
 #endif
 
+/* Application-Layer Protocol Name */
+#ifdef HAVE_ALPN
+
+/* ALPN status code */
+enum {
+    WOLFSSL_ALPN_NO_MATCH = 0,
+    WOLFSSL_ALPN_MATCH    = 1
+};
+
+enum {
+    WOLFSSL_MAX_ALPN_PROTO_NAME_LEN = 255,
+    WOLFSSL_MAX_ALPN_NUMBER = 257
+};
+
+WOLFSSL_API int wolfSSL_UseALPN(WOLFSSL* ssl, char *protocol_name_list,
+                                unsigned int protocol_name_listSz);
+
+WOLFSSL_API int wolfSSL_ALPN_GetProtocol(WOLFSSL* ssl, char **protocol_name,
+                                         unsigned short *size);
+
+#endif /* HAVE_ALPN */
+
 /* Maximum Fragment Length */
 #ifdef HAVE_MAX_FRAGMENT
 
diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h
index 55969ee23..d97636e0a 100644
--- a/wolfssl/wolfcrypt/types.h
+++ b/wolfssl/wolfcrypt/types.h
@@ -216,7 +216,7 @@
 	        #define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n))
 	    #endif
 
-        #ifdef WOLFSSL_CERT_EXT
+        #if defined(WOLFSSL_CERT_EXT) || defined(HAVE_ALPN)
             /* use only Thread Safe version of strtok */
             #ifndef USE_WINDOWS_API
                 #define XSTRTOK strtok_r

From 266936db93e439c5158957cd5438a3ff3d758aaf Mon Sep 17 00:00:00 2001
From: Ludovic FLAMENT 
Date: Fri, 9 Oct 2015 16:00:53 +0200
Subject: [PATCH 48/77] fix warning on Windows

---
 src/tls.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/tls.c b/src/tls.c
index 42176353c..5eca631e1 100644
--- a/src/tls.c
+++ b/src/tls.c
@@ -912,7 +912,7 @@ static word16 TLSX_ALPN_GetSize(ALPN *list)
         list = alpn->next;
 
         length++; /* protocol name length is on one byte */
-        length += XSTRLEN(alpn->protocol_name);
+        length += (word16)XSTRLEN(alpn->protocol_name);
     }
     
     return length;
@@ -928,7 +928,7 @@ static word16 TLSX_ALPN_Write(ALPN *list, byte *output)
     while ((alpn = list)) {
         list = alpn->next;
 
-        length = XSTRLEN(alpn->protocol_name);
+        length = (word16)XSTRLEN(alpn->protocol_name);
 
         /* protocol name length */
         output[offset++] = (byte)length;
@@ -955,7 +955,7 @@ static ALPN* TLSX_ALPN_Find(ALPN *list, char *protocol_name, word16 size)
 
     alpn = list;
     while (alpn != NULL && (
-           XSTRLEN(alpn->protocol_name) != size ||
+           (word16)XSTRLEN(alpn->protocol_name) != size ||
            XSTRNCMP(alpn->protocol_name, protocol_name, size)))
         alpn = alpn->next;
 
@@ -1040,7 +1040,7 @@ static int TLSX_ALPN_ParseAndSet(WOLFSSL *ssl, byte *input, word16 length,
 
     /* set the matching negociated protocol */
     r = TLSX_SetALPN(&ssl->extensions,
-                     alpn->protocol_name, XSTRLEN(alpn->protocol_name));
+                     alpn->protocol_name, (word16)XSTRLEN(alpn->protocol_name));
     if (r != SSL_SUCCESS) {
         WOLFSSL_MSG("TLSX_UseALPN failed");
         return BUFFER_ERROR;
@@ -1116,7 +1116,7 @@ int TLSX_ALPN_GetRequest(TLSX* extensions, void** data, word16 *dataSz)
     }
 
     *data = alpn->protocol_name;
-    *dataSz = XSTRLEN(*data);
+    *dataSz = (word16)XSTRLEN(*data);
 
     return SSL_SUCCESS;
 }

From 7e5be2f3132c658245c41202f338d256c06ff6d9 Mon Sep 17 00:00:00 2001
From: Chris Conlon 
Date: Fri, 9 Oct 2015 10:57:55 -0600
Subject: [PATCH 49/77] fix resource cleanup in testsuite and wolfcrypt test

---
 src/internal.c        | 2 +-
 testsuite/testsuite.c | 2 ++
 wolfcrypt/test/test.c | 1 +
 wolfssl/test.h        | 3 ++-
 4 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/internal.c b/src/internal.c
index 5c9ede255..5090c9fbd 100644
--- a/src/internal.c
+++ b/src/internal.c
@@ -2577,7 +2577,7 @@ ProtocolVersion MakeDTLSv1_2(void)
 
     word32 LowResTimer(void)
     {
-        NET_SECURE_OS_TICK  clk;
+        NET_SECURE_OS_TICK  clk = 0;
 
         #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED)
             clk = NetSecure_OS_TimeGet();
diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c
index dc756377c..9f256c2c5 100644
--- a/testsuite/testsuite.c
+++ b/testsuite/testsuite.c
@@ -382,6 +382,7 @@ void file_test(const char* file, byte* check)
         ret = wc_Sha256Update(&sha256, buf, i);
         if (ret != 0) {
             printf("Can't wc_Sha256Update %d\n", ret);
+            fclose(f);
             return;
         }
     }
@@ -389,6 +390,7 @@ void file_test(const char* file, byte* check)
     ret = wc_Sha256Final(&sha256, shasum);
     if (ret != 0) {
         printf("Can't wc_Sha256Final %d\n", ret);
+        fclose(f);
         return;
     }
 
diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c
index e3e89a73e..f804e6d9f 100644
--- a/wolfcrypt/test/test.c
+++ b/wolfcrypt/test/test.c
@@ -4447,6 +4447,7 @@ int rsa_test(void)
             free(derCert);
             free(pem);
             free(tmp);
+            fclose(pemFile);
             wc_FreeRsaKey(&caKey);
             return -415;
         }
diff --git a/wolfssl/test.h b/wolfssl/test.h
index f0196a323..f6b25819f 100644
--- a/wolfssl/test.h
+++ b/wolfssl/test.h
@@ -918,7 +918,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity,
         sz = ftell(file);
         rewind(file);
         fread(buff, sizeof(buff), 1, file);
-  
+
         if (type == WOLFSSL_CA) {
             if (wolfSSL_CTX_load_verify_buffer(ctx, buff, sz, SSL_FILETYPE_PEM)
                                               != SSL_SUCCESS)
@@ -934,6 +934,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity,
                         SSL_FILETYPE_PEM) != SSL_SUCCESS)
                 err_sys("can't load buffer key file");
         }
+        fclose(file);
     }
 
 #endif /* NO_FILESYSTEM */

From 6e61a095c7a0d98a16a4c07b4b6bcee074bd9ced Mon Sep 17 00:00:00 2001
From: David Garske 
Date: Fri, 9 Oct 2015 10:25:40 -0700
Subject: [PATCH 50/77] Added new Xcode project for test suite. Added Xcode
 workspace file. Added library support for iOS and OS X targets. Updated
 project files to Xcode 7. Updated README. Added shared user_settings.h.
 Cleanup of the test.h "ChangeDirBack" function. Cleanup of duplicate
 ChangeDirBack() code in testsuite.c and adjusted for new Xcode build
 location.

---
 IDE/iOS/README.md                             |  44 +-
 IDE/iOS/include.am                            |   3 +
 IDE/iOS/user_settings.h                       |  16 +
 .../wolfssl-FIPS.xcodeproj/project.pbxproj    | 505 ++++++++++++++++--
 IDE/iOS/wolfssl.xcodeproj/project.pbxproj     | 482 ++++++++++++++++-
 .../contents.xcworkspacedata                  |  13 +
 .../project.pbxproj                           | 347 ++++++++++++
 testsuite/testsuite.c                         |  33 +-
 wolfssl/test.h                                |  43 +-
 9 files changed, 1374 insertions(+), 112 deletions(-)
 create mode 100644 IDE/iOS/user_settings.h
 create mode 100644 IDE/iOS/wolfssl.xcworkspace/contents.xcworkspacedata
 create mode 100644 IDE/iOS/wolfssl_testsuite.xcodeproj/project.pbxproj

diff --git a/IDE/iOS/README.md b/IDE/iOS/README.md
index f4525176c..b2bfae757 100644
--- a/IDE/iOS/README.md
+++ b/IDE/iOS/README.md
@@ -1,14 +1,35 @@
-# wolfSSL and wolfCrypt iOS Xcode Projects
+# wolfSSL and wolfCrypt Xcode Projects for OS X and iOS
 
-This directory contains two xcodeproj:
+This directory contains the following files:
 
-1. `wolfssl.xcodeproj` -- builds wolfSSL and wolfCrypt
-2. `wolfssl-FIPS.xcodeproj` -- builds wolfSSL and wolfCrypt-FIPS if available
+1. `wolfssl.xcworkspace` -- workspace with library and testsuite client
+2. `wolfssl_testsuite.xcodeproj` -- project to run the testsuite.
+3. `wolfssl.xcodeproj` -- project to build OS/x and iOS libraries for wolfSSL and/or wolfCrypt
+4. `wolfssl-FIPS.xcodeproj` -- project to build wolfSSL and wolfCrypt-FIPS if available
+5. `user_settings.h` -- custom library settings, which are shared across projects
 
-Both projects will build the library `libwolfssl.a` and produce a directory
-named `include` with the wolfSSL and wolfCrypt headers, and the CyaSSL and
-CtaoCrypt compatibility headers. Specific build options may be added to the
-`IPHONE` section of the file `wolfssl/wolfcrypt/settings.h`.
+The library will output as `libwolfssl_osx.a` or 'libwolfssl_ios.a` depending on 
+the target. It will also copy the wolfSSL/wolfCrypt (and the CyaSSL/CtaoCrypt 
+compatibility) headers into an `include` directory located in 
+`Build/Products/Debug` or `Build/Products/Release`.
+
+For the library and testsuite to link properly the build location needs to be 
+configured as realitive to workspace.
+1. File -> Workspace Settings (or Xcode -> Preferences -> Locations -> Locations)
+2. Derived Data -> Advanced
+3. Custom -> Relative to Workspace
+4. Products -> Build/Products
+
+These Xcode projects define the `WOLFSSL_USER_SETTINGS` preprocessor 
+to enable the `user_settings.h` file for setting macros across 
+multiple projects.
+
+If needed the Xcode preprocessors can be modifed with these steps:
+1. Click on the Project in "Project Navigator".
+2. Click on the "Build Settings" tab.
+3. Scroll down to the "Apple LLVM 6.0 - Preprocessing" section.
+4. Open the disclosure for "Preprocessor Macros" and use the "+" and 
+"-" buttons to modify. Remember to do this for both Debug and Release.
 
 ## wolfSSL
 
@@ -35,7 +56,7 @@ You can make an archive for a device, as well. That is a release build.
 
 # Installing libwolfssl.a
 
-Simply drag the file libwolfssl.a and the directory `include` and drop it into
+Simply drag the file libwolfssl_XXX_.a and the directory `include` and drop it into
 your project file list pane where it makes sense for you. Allow it to copy the
 files over to the project directory. This should automatically add the library
 to the list of libraries to link against.
@@ -52,10 +73,7 @@ Add the path to the include directory to the list "Header Search Paths".
 
 ## When using FIPS
 
-When using the FIPS version, on the target window, in the "Build Settings" tab,
-scroll down to the "Apple LLVM 6.0 - Preprocessing" section. Open the disclosure
-for "Preprocessor Macros" and add the following under both `Release` and
-`Debug`:
+When using the FIPS version the following preprocessors need to be defined:
 
 * `IPHONE`
 * `HAVE_FIPS`
diff --git a/IDE/iOS/include.am b/IDE/iOS/include.am
index 504b4d19c..10c1b403f 100644
--- a/IDE/iOS/include.am
+++ b/IDE/iOS/include.am
@@ -5,3 +5,6 @@
 EXTRA_DIST+= IDE/iOS/README.md
 EXTRA_DIST+= IDE/iOS/wolfssl-FIPS.xcodeproj/project.pbxproj
 EXTRA_DIST+= IDE/iOS/wolfssl.xcodeproj/project.pbxproj
+EXTRA_DIST+= IDE/iOS/wolfssl.xcworkspace
+EXTRA_DIST+= IDE/iOS/wolfssl_testsuite.xcodeproj
+EXTRA_DIST+= IDE/iOS/user_settings.h
diff --git a/IDE/iOS/user_settings.h b/IDE/iOS/user_settings.h
new file mode 100644
index 000000000..627188c81
--- /dev/null
+++ b/IDE/iOS/user_settings.h
@@ -0,0 +1,16 @@
+/* Configuration */
+#define IPHONE	/* Needed for Xcode */
+#define HAVE_HASHDRBG
+#define HAVE_AESGCM
+#define WOLFSSL_SHA512
+#define WOLFSSL_SHA384
+
+#ifdef HAVE_FIPS
+#define NO_MD4
+#define NO_HC128
+#define NO_RABBIT
+#define NO_DSA
+#define NO_PWDBASED
+#else
+#define USE_FAST_MATH
+#endif
diff --git a/IDE/iOS/wolfssl-FIPS.xcodeproj/project.pbxproj b/IDE/iOS/wolfssl-FIPS.xcodeproj/project.pbxproj
index e2ae6f02b..325443d41 100644
--- a/IDE/iOS/wolfssl-FIPS.xcodeproj/project.pbxproj
+++ b/IDE/iOS/wolfssl-FIPS.xcodeproj/project.pbxproj
@@ -169,6 +169,168 @@
 		522DBE131B792A190031F454 /* wc_encrypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 522DBE121B7929E70031F454 /* wc_encrypt.h */; };
 		525BE5BA1B38853E0054BBCD /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 525BE5B91B38853E0054BBCD /* hash.c */; };
 		525BE5BC1B3885750054BBCD /* hash.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 525BE5BB1B3885580054BBCD /* hash.h */; };
+		A4A54DF71BC5C3E0002866CD /* wolfcrypt_first.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216481B1A8AC2990062516A /* wolfcrypt_first.c */; };
+		A4A54DF81BC5C3E0002866CD /* hmac.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648141A8AC2990062516A /* hmac.c */; };
+		A4A54DF91BC5C3E0002866CD /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648161A8AC2990062516A /* random.c */; };
+		A4A54DFA1BC5C3E0002866CD /* sha256.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648191A8AC2990062516A /* sha256.c */; };
+		A4A54DFB1BC5C3E0002866CD /* rsa.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648171A8AC2990062516A /* rsa.c */; };
+		A4A54DFC1BC5C3E0002866CD /* aes.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648101A8AC2990062516A /* aes.c */; };
+		A4A54DFD1BC5C3E0002866CD /* des3.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648111A8AC2990062516A /* des3.c */; };
+		A4A54DFE1BC5C3E0002866CD /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 525BE5B91B38853E0054BBCD /* hash.c */; };
+		A4A54DFF1BC5C3E0002866CD /* sha.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648181A8AC2990062516A /* sha.c */; };
+		A4A54E001BC5C3E0002866CD /* sha512.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216481A1A8AC2990062516A /* sha512.c */; };
+		A4A54E011BC5C3E0002866CD /* fips.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648131A8AC2990062516A /* fips.c */; };
+		A4A54E021BC5C3E0002866CD /* fips_test.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648121A8AC2990062516A /* fips_test.c */; };
+		A4A54E031BC5C3E0002866CD /* wolfcrypt_last.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216481C1A8AC2990062516A /* wolfcrypt_last.c */; };
+		A4A54E041BC5C3E0002866CD /* dsa.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461A1A8992CC0062516A /* dsa.c */; };
+		A4A54E051BC5C3E0002866CD /* logging.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646201A8992CC0062516A /* logging.c */; };
+		A4A54E061BC5C3E0002866CD /* sha.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462D1A8992CC0062516A /* sha.c */; };
+		A4A54E071BC5C3E0002866CD /* poly1305.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646271A8992CC0062516A /* poly1305.c */; };
+		A4A54E081BC5C3E0002866CD /* dh.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646191A8992CC0062516A /* dh.c */; };
+		A4A54E091BC5C3E0002866CD /* camellia.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646151A8992CC0062516A /* camellia.c */; };
+		A4A54E0A1BC5C3E0002866CD /* wc_port.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646311A8992CC0062516A /* wc_port.c */; };
+		A4A54E0B1BC5C3E0002866CD /* pwdbased.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646281A8992CC0062516A /* pwdbased.c */; };
+		A4A54E0C1BC5C3E0002866CD /* misc.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646251A8992CC0062516A /* misc.c */; };
+		A4A54E0D1BC5C3E0002866CD /* hc128.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461D1A8992CC0062516A /* hc128.c */; };
+		A4A54E0E1BC5C3E0002866CD /* asn.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646131A8992CC0062516A /* asn.c */; };
+		A4A54E0F1BC5C3E0002866CD /* sha512.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462F1A8992CC0062516A /* sha512.c */; };
+		A4A54E101BC5C3E0002866CD /* rabbit.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646291A8992CC0062516A /* rabbit.c */; };
+		A4A54E111BC5C3E0002866CD /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646231A8992CC0062516A /* md5.c */; };
+		A4A54E121BC5C3E0002866CD /* ssl.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646071A89928E0062516A /* ssl.c */; };
+		A4A54E131BC5C3E0002866CD /* rsa.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462C1A8992CC0062516A /* rsa.c */; };
+		A4A54E141BC5C3E0002866CD /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462A1A8992CC0062516A /* random.c */; };
+		A4A54E151BC5C3E0002866CD /* tls.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646081A89928E0062516A /* tls.c */; };
+		A4A54E161BC5C3E0002866CD /* ocsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646051A89928E0062516A /* ocsp.c */; };
+		A4A54E171BC5C3E0002866CD /* md4.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646221A8992CC0062516A /* md4.c */; };
+		A4A54E181BC5C3E0002866CD /* aes.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646111A8992CC0062516A /* aes.c */; };
+		A4A54E191BC5C3E0002866CD /* des3.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646181A8992CC0062516A /* des3.c */; };
+		A4A54E1A1BC5C3E0002866CD /* blake2b.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646141A8992CC0062516A /* blake2b.c */; };
+		A4A54E1B1BC5C3E0002866CD /* ripemd.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462B1A8992CC0062516A /* ripemd.c */; };
+		A4A54E1C1BC5C3E0002866CD /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646241A8992CC0062516A /* memory.c */; };
+		A4A54E1D1BC5C3E0002866CD /* wc_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 522DBE101B7929C80031F454 /* wc_encrypt.c */; };
+		A4A54E1E1BC5C3E0002866CD /* ecc.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461B1A8992CC0062516A /* ecc.c */; };
+		A4A54E1F1BC5C3E0002866CD /* sha256.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462E1A8992CC0062516A /* sha256.c */; };
+		A4A54E201BC5C3E0002866CD /* chacha.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646161A8992CC0062516A /* chacha.c */; };
+		A4A54E211BC5C3E0002866CD /* pkcs7.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646261A8992CC0062516A /* pkcs7.c */; };
+		A4A54E221BC5C3E0002866CD /* sniffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646061A89928E0062516A /* sniffer.c */; };
+		A4A54E231BC5C3E0002866CD /* md2.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646211A8992CC0062516A /* md2.c */; };
+		A4A54E241BC5C3E0002866CD /* coding.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646171A8992CC0062516A /* coding.c */; };
+		A4A54E251BC5C3E0002866CD /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461C1A8992CC0062516A /* error.c */; };
+		A4A54E261BC5C3E0002866CD /* hmac.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461E1A8992CC0062516A /* hmac.c */; };
+		A4A54E271BC5C3E0002866CD /* arc4.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646121A8992CC0062516A /* arc4.c */; };
+		A4A54E281BC5C3E0002866CD /* integer.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461F1A8992CC0062516A /* integer.c */; };
+		A4A54E291BC5C3E0002866CD /* internal.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646021A89928E0062516A /* internal.c */; };
+		A4A54E2A1BC5C3E0002866CD /* io.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646031A89928E0062516A /* io.c */; };
+		A4A54E2B1BC5C3E0002866CD /* tfm.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646301A8992CC0062516A /* tfm.c */; };
+		A4A54E2C1BC5C3E0002866CD /* crl.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646011A89928E0062516A /* crl.c */; };
+		A4A54E2D1BC5C3E0002866CD /* keys.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646041A89928E0062516A /* keys.c */; };
+		A4A54E301BC5C3E0002866CD /* callbacks.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646531A8993290062516A /* callbacks.h */; };
+		A4A54E311BC5C3E0002866CD /* certs_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646541A8993290062516A /* certs_test.h */; };
+		A4A54E321BC5C3E0002866CD /* crl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646551A8993290062516A /* crl.h */; };
+		A4A54E331BC5C3E0002866CD /* error-ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646561A8993290062516A /* error-ssl.h */; };
+		A4A54E341BC5C3E0002866CD /* internal.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646571A8993290062516A /* internal.h */; };
+		A4A54E351BC5C3E0002866CD /* ocsp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646581A8993290062516A /* ocsp.h */; };
+		A4A54E361BC5C3E0002866CD /* ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465B1A8993290062516A /* ssl.h */; };
+		A4A54E371BC5C3E0002866CD /* test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465C1A8993290062516A /* test.h */; };
+		A4A54E381BC5C3E0002866CD /* version.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465D1A8993290062516A /* version.h */; };
+		A4A54E3A1BC5C3E0002866CD /* wc_encrypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 522DBE121B7929E70031F454 /* wc_encrypt.h */; };
+		A4A54E3B1BC5C3E0002866CD /* hash.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 525BE5BB1B3885580054BBCD /* hash.h */; };
+		A4A54E3C1BC5C3E0002866CD /* aes.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465E1A8993770062516A /* aes.h */; };
+		A4A54E3D1BC5C3E0002866CD /* arc4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465F1A8993770062516A /* arc4.h */; };
+		A4A54E3E1BC5C3E0002866CD /* asn_public.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646601A8993770062516A /* asn_public.h */; };
+		A4A54E3F1BC5C3E0002866CD /* asn.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646611A8993770062516A /* asn.h */; };
+		A4A54E401BC5C3E0002866CD /* blake2-impl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646621A8993770062516A /* blake2-impl.h */; };
+		A4A54E411BC5C3E0002866CD /* blake2-int.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646631A8993770062516A /* blake2-int.h */; };
+		A4A54E421BC5C3E0002866CD /* blake2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646641A8993770062516A /* blake2.h */; };
+		A4A54E431BC5C3E0002866CD /* camellia.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646651A8993770062516A /* camellia.h */; };
+		A4A54E441BC5C3E0002866CD /* chacha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646661A8993770062516A /* chacha.h */; };
+		A4A54E451BC5C3E0002866CD /* coding.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646671A8993770062516A /* coding.h */; };
+		A4A54E461BC5C3E0002866CD /* compress.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646681A8993770062516A /* compress.h */; };
+		A4A54E471BC5C3E0002866CD /* des3.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646691A8993770062516A /* des3.h */; };
+		A4A54E481BC5C3E0002866CD /* dh.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466A1A8993770062516A /* dh.h */; };
+		A4A54E491BC5C3E0002866CD /* dsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466B1A8993770062516A /* dsa.h */; };
+		A4A54E4A1BC5C3E0002866CD /* ecc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466C1A8993770062516A /* ecc.h */; };
+		A4A54E4B1BC5C3E0002866CD /* error-crypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466D1A8993770062516A /* error-crypt.h */; };
+		A4A54E4C1BC5C3E0002866CD /* fips_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466E1A8993770062516A /* fips_test.h */; };
+		A4A54E4D1BC5C3E0002866CD /* hc128.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466F1A8993770062516A /* hc128.h */; };
+		A4A54E4E1BC5C3E0002866CD /* hmac.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646701A8993770062516A /* hmac.h */; };
+		A4A54E4F1BC5C3E0002866CD /* integer.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646721A8993770062516A /* integer.h */; };
+		A4A54E501BC5C3E0002866CD /* logging.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646731A8993770062516A /* logging.h */; };
+		A4A54E511BC5C3E0002866CD /* md2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646741A8993770062516A /* md2.h */; };
+		A4A54E521BC5C3E0002866CD /* md4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646751A8993770062516A /* md4.h */; };
+		A4A54E531BC5C3E0002866CD /* md5.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646761A8993770062516A /* md5.h */; };
+		A4A54E541BC5C3E0002866CD /* memory.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646771A8993770062516A /* memory.h */; };
+		A4A54E551BC5C3E0002866CD /* misc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646781A8993770062516A /* misc.h */; };
+		A4A54E561BC5C3E0002866CD /* mpi_class.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646791A8993770062516A /* mpi_class.h */; };
+		A4A54E571BC5C3E0002866CD /* mpi_superclass.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467A1A8993770062516A /* mpi_superclass.h */; };
+		A4A54E581BC5C3E0002866CD /* pkcs7.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467B1A8993770062516A /* pkcs7.h */; };
+		A4A54E591BC5C3E0002866CD /* poly1305.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467C1A8993770062516A /* poly1305.h */; };
+		A4A54E5A1BC5C3E0002866CD /* pwdbased.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467D1A8993770062516A /* pwdbased.h */; };
+		A4A54E5B1BC5C3E0002866CD /* rabbit.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467E1A8993770062516A /* rabbit.h */; };
+		A4A54E5C1BC5C3E0002866CD /* random.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467F1A8993770062516A /* random.h */; };
+		A4A54E5D1BC5C3E0002866CD /* ripemd.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646801A8993770062516A /* ripemd.h */; };
+		A4A54E5E1BC5C3E0002866CD /* rsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646811A8993770062516A /* rsa.h */; };
+		A4A54E5F1BC5C3E0002866CD /* settings.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646821A8993770062516A /* settings.h */; };
+		A4A54E601BC5C3E0002866CD /* sha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646831A8993770062516A /* sha.h */; };
+		A4A54E611BC5C3E0002866CD /* sha256.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646841A8993770062516A /* sha256.h */; };
+		A4A54E621BC5C3E0002866CD /* sha512.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646851A8993770062516A /* sha512.h */; };
+		A4A54E631BC5C3E0002866CD /* tfm.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646861A8993770062516A /* tfm.h */; };
+		A4A54E641BC5C3E0002866CD /* types.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646871A8993770062516A /* types.h */; };
+		A4A54E651BC5C3E0002866CD /* visibility.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646881A8993770062516A /* visibility.h */; };
+		A4A54E661BC5C3E0002866CD /* wc_port.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646891A8993770062516A /* wc_port.h */; };
+		A4A54E681BC5C3E0002866CD /* callbacks.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468A1A8993BB0062516A /* callbacks.h */; };
+		A4A54E691BC5C3E0002866CD /* certs_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468B1A8993BB0062516A /* certs_test.h */; };
+		A4A54E6A1BC5C3E0002866CD /* crl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468C1A8993BB0062516A /* crl.h */; };
+		A4A54E6B1BC5C3E0002866CD /* error-ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468D1A8993BB0062516A /* error-ssl.h */; };
+		A4A54E6C1BC5C3E0002866CD /* internal.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468E1A8993BB0062516A /* internal.h */; };
+		A4A54E6D1BC5C3E0002866CD /* ocsp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468F1A8993BB0062516A /* ocsp.h */; };
+		A4A54E6E1BC5C3E0002866CD /* ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646921A8993BB0062516A /* ssl.h */; };
+		A4A54E6F1BC5C3E0002866CD /* test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646931A8993BB0062516A /* test.h */; };
+		A4A54E701BC5C3E0002866CD /* version.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646941A8993BB0062516A /* version.h */; };
+		A4A54E721BC5C3E0002866CD /* aes.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646951A8993F50062516A /* aes.h */; };
+		A4A54E731BC5C3E0002866CD /* arc4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646961A8993F50062516A /* arc4.h */; };
+		A4A54E741BC5C3E0002866CD /* asn_public.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646971A8993F50062516A /* asn_public.h */; };
+		A4A54E751BC5C3E0002866CD /* asn.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646981A8993F50062516A /* asn.h */; };
+		A4A54E761BC5C3E0002866CD /* blake2-impl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646991A8993F50062516A /* blake2-impl.h */; };
+		A4A54E771BC5C3E0002866CD /* blake2-int.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469A1A8993F50062516A /* blake2-int.h */; };
+		A4A54E781BC5C3E0002866CD /* blake2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469B1A8993F50062516A /* blake2.h */; };
+		A4A54E791BC5C3E0002866CD /* camellia.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469C1A8993F50062516A /* camellia.h */; };
+		A4A54E7A1BC5C3E0002866CD /* chacha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469D1A8993F50062516A /* chacha.h */; };
+		A4A54E7B1BC5C3E0002866CD /* coding.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469E1A8993F50062516A /* coding.h */; };
+		A4A54E7C1BC5C3E0002866CD /* compress.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469F1A8993F50062516A /* compress.h */; };
+		A4A54E7D1BC5C3E0002866CD /* des3.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A01A8993F50062516A /* des3.h */; };
+		A4A54E7E1BC5C3E0002866CD /* dh.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A11A8993F50062516A /* dh.h */; };
+		A4A54E7F1BC5C3E0002866CD /* dsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A21A8993F50062516A /* dsa.h */; };
+		A4A54E801BC5C3E0002866CD /* ecc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A31A8993F50062516A /* ecc.h */; };
+		A4A54E811BC5C3E0002866CD /* error-crypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A41A8993F50062516A /* error-crypt.h */; };
+		A4A54E821BC5C3E0002866CD /* fips_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A51A8993F50062516A /* fips_test.h */; };
+		A4A54E831BC5C3E0002866CD /* hc128.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A61A8993F50062516A /* hc128.h */; };
+		A4A54E841BC5C3E0002866CD /* hmac.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A71A8993F50062516A /* hmac.h */; };
+		A4A54E851BC5C3E0002866CD /* integer.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A81A8993F50062516A /* integer.h */; };
+		A4A54E861BC5C3E0002866CD /* logging.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A91A8993F50062516A /* logging.h */; };
+		A4A54E871BC5C3E0002866CD /* md2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AA1A8993F50062516A /* md2.h */; };
+		A4A54E881BC5C3E0002866CD /* md4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AB1A8993F50062516A /* md4.h */; };
+		A4A54E891BC5C3E0002866CD /* md5.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AC1A8993F50062516A /* md5.h */; };
+		A4A54E8A1BC5C3E0002866CD /* memory.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AD1A8993F50062516A /* memory.h */; };
+		A4A54E8B1BC5C3E0002866CD /* misc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AE1A8993F50062516A /* misc.h */; };
+		A4A54E8C1BC5C3E0002866CD /* mpi_class.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AF1A8993F50062516A /* mpi_class.h */; };
+		A4A54E8D1BC5C3E0002866CD /* mpi_superclass.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B01A8993F50062516A /* mpi_superclass.h */; };
+		A4A54E8E1BC5C3E0002866CD /* pkcs7.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B11A8993F50062516A /* pkcs7.h */; };
+		A4A54E8F1BC5C3E0002866CD /* poly1305.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B21A8993F50062516A /* poly1305.h */; };
+		A4A54E901BC5C3E0002866CD /* pwdbased.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B31A8993F50062516A /* pwdbased.h */; };
+		A4A54E911BC5C3E0002866CD /* rabbit.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B41A8993F50062516A /* rabbit.h */; };
+		A4A54E921BC5C3E0002866CD /* random.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B51A8993F50062516A /* random.h */; };
+		A4A54E931BC5C3E0002866CD /* ripemd.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B61A8993F50062516A /* ripemd.h */; };
+		A4A54E941BC5C3E0002866CD /* rsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B71A8993F50062516A /* rsa.h */; };
+		A4A54E951BC5C3E0002866CD /* settings_comp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B81A8993F50062516A /* settings_comp.h */; };
+		A4A54E961BC5C3E0002866CD /* settings.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B91A8993F50062516A /* settings.h */; };
+		A4A54E971BC5C3E0002866CD /* sha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BA1A8993F50062516A /* sha.h */; };
+		A4A54E981BC5C3E0002866CD /* sha256.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BB1A8993F50062516A /* sha256.h */; };
+		A4A54E991BC5C3E0002866CD /* sha512.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BC1A8993F50062516A /* sha512.h */; };
+		A4A54E9A1BC5C3E0002866CD /* tfm.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BD1A8993F50062516A /* tfm.h */; };
+		A4A54E9B1BC5C3E0002866CD /* types.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BE1A8993F50062516A /* types.h */; };
+		A4A54E9C1BC5C3E0002866CD /* visibility.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BF1A8993F50062516A /* visibility.h */; };
+		A4A54E9D1BC5C3E0002866CD /* wc_port.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646C01A8993F50062516A /* wc_port.h */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -315,6 +477,149 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		A4A54E2F1BC5C3E0002866CD /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = include/wolfssl;
+			dstSubfolderSpec = 7;
+			files = (
+				A4A54E301BC5C3E0002866CD /* callbacks.h in CopyFiles */,
+				A4A54E311BC5C3E0002866CD /* certs_test.h in CopyFiles */,
+				A4A54E321BC5C3E0002866CD /* crl.h in CopyFiles */,
+				A4A54E331BC5C3E0002866CD /* error-ssl.h in CopyFiles */,
+				A4A54E341BC5C3E0002866CD /* internal.h in CopyFiles */,
+				A4A54E351BC5C3E0002866CD /* ocsp.h in CopyFiles */,
+				A4A54E361BC5C3E0002866CD /* ssl.h in CopyFiles */,
+				A4A54E371BC5C3E0002866CD /* test.h in CopyFiles */,
+				A4A54E381BC5C3E0002866CD /* version.h in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		A4A54E391BC5C3E0002866CD /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = include/wolfssl/wolfcrypt;
+			dstSubfolderSpec = 7;
+			files = (
+				A4A54E3A1BC5C3E0002866CD /* wc_encrypt.h in CopyFiles */,
+				A4A54E3B1BC5C3E0002866CD /* hash.h in CopyFiles */,
+				A4A54E3C1BC5C3E0002866CD /* aes.h in CopyFiles */,
+				A4A54E3D1BC5C3E0002866CD /* arc4.h in CopyFiles */,
+				A4A54E3E1BC5C3E0002866CD /* asn_public.h in CopyFiles */,
+				A4A54E3F1BC5C3E0002866CD /* asn.h in CopyFiles */,
+				A4A54E401BC5C3E0002866CD /* blake2-impl.h in CopyFiles */,
+				A4A54E411BC5C3E0002866CD /* blake2-int.h in CopyFiles */,
+				A4A54E421BC5C3E0002866CD /* blake2.h in CopyFiles */,
+				A4A54E431BC5C3E0002866CD /* camellia.h in CopyFiles */,
+				A4A54E441BC5C3E0002866CD /* chacha.h in CopyFiles */,
+				A4A54E451BC5C3E0002866CD /* coding.h in CopyFiles */,
+				A4A54E461BC5C3E0002866CD /* compress.h in CopyFiles */,
+				A4A54E471BC5C3E0002866CD /* des3.h in CopyFiles */,
+				A4A54E481BC5C3E0002866CD /* dh.h in CopyFiles */,
+				A4A54E491BC5C3E0002866CD /* dsa.h in CopyFiles */,
+				A4A54E4A1BC5C3E0002866CD /* ecc.h in CopyFiles */,
+				A4A54E4B1BC5C3E0002866CD /* error-crypt.h in CopyFiles */,
+				A4A54E4C1BC5C3E0002866CD /* fips_test.h in CopyFiles */,
+				A4A54E4D1BC5C3E0002866CD /* hc128.h in CopyFiles */,
+				A4A54E4E1BC5C3E0002866CD /* hmac.h in CopyFiles */,
+				A4A54E4F1BC5C3E0002866CD /* integer.h in CopyFiles */,
+				A4A54E501BC5C3E0002866CD /* logging.h in CopyFiles */,
+				A4A54E511BC5C3E0002866CD /* md2.h in CopyFiles */,
+				A4A54E521BC5C3E0002866CD /* md4.h in CopyFiles */,
+				A4A54E531BC5C3E0002866CD /* md5.h in CopyFiles */,
+				A4A54E541BC5C3E0002866CD /* memory.h in CopyFiles */,
+				A4A54E551BC5C3E0002866CD /* misc.h in CopyFiles */,
+				A4A54E561BC5C3E0002866CD /* mpi_class.h in CopyFiles */,
+				A4A54E571BC5C3E0002866CD /* mpi_superclass.h in CopyFiles */,
+				A4A54E581BC5C3E0002866CD /* pkcs7.h in CopyFiles */,
+				A4A54E591BC5C3E0002866CD /* poly1305.h in CopyFiles */,
+				A4A54E5A1BC5C3E0002866CD /* pwdbased.h in CopyFiles */,
+				A4A54E5B1BC5C3E0002866CD /* rabbit.h in CopyFiles */,
+				A4A54E5C1BC5C3E0002866CD /* random.h in CopyFiles */,
+				A4A54E5D1BC5C3E0002866CD /* ripemd.h in CopyFiles */,
+				A4A54E5E1BC5C3E0002866CD /* rsa.h in CopyFiles */,
+				A4A54E5F1BC5C3E0002866CD /* settings.h in CopyFiles */,
+				A4A54E601BC5C3E0002866CD /* sha.h in CopyFiles */,
+				A4A54E611BC5C3E0002866CD /* sha256.h in CopyFiles */,
+				A4A54E621BC5C3E0002866CD /* sha512.h in CopyFiles */,
+				A4A54E631BC5C3E0002866CD /* tfm.h in CopyFiles */,
+				A4A54E641BC5C3E0002866CD /* types.h in CopyFiles */,
+				A4A54E651BC5C3E0002866CD /* visibility.h in CopyFiles */,
+				A4A54E661BC5C3E0002866CD /* wc_port.h in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		A4A54E671BC5C3E0002866CD /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = include/cyassl;
+			dstSubfolderSpec = 7;
+			files = (
+				A4A54E681BC5C3E0002866CD /* callbacks.h in CopyFiles */,
+				A4A54E691BC5C3E0002866CD /* certs_test.h in CopyFiles */,
+				A4A54E6A1BC5C3E0002866CD /* crl.h in CopyFiles */,
+				A4A54E6B1BC5C3E0002866CD /* error-ssl.h in CopyFiles */,
+				A4A54E6C1BC5C3E0002866CD /* internal.h in CopyFiles */,
+				A4A54E6D1BC5C3E0002866CD /* ocsp.h in CopyFiles */,
+				A4A54E6E1BC5C3E0002866CD /* ssl.h in CopyFiles */,
+				A4A54E6F1BC5C3E0002866CD /* test.h in CopyFiles */,
+				A4A54E701BC5C3E0002866CD /* version.h in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		A4A54E711BC5C3E0002866CD /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = include/cyassl/ctaocrypt;
+			dstSubfolderSpec = 7;
+			files = (
+				A4A54E721BC5C3E0002866CD /* aes.h in CopyFiles */,
+				A4A54E731BC5C3E0002866CD /* arc4.h in CopyFiles */,
+				A4A54E741BC5C3E0002866CD /* asn_public.h in CopyFiles */,
+				A4A54E751BC5C3E0002866CD /* asn.h in CopyFiles */,
+				A4A54E761BC5C3E0002866CD /* blake2-impl.h in CopyFiles */,
+				A4A54E771BC5C3E0002866CD /* blake2-int.h in CopyFiles */,
+				A4A54E781BC5C3E0002866CD /* blake2.h in CopyFiles */,
+				A4A54E791BC5C3E0002866CD /* camellia.h in CopyFiles */,
+				A4A54E7A1BC5C3E0002866CD /* chacha.h in CopyFiles */,
+				A4A54E7B1BC5C3E0002866CD /* coding.h in CopyFiles */,
+				A4A54E7C1BC5C3E0002866CD /* compress.h in CopyFiles */,
+				A4A54E7D1BC5C3E0002866CD /* des3.h in CopyFiles */,
+				A4A54E7E1BC5C3E0002866CD /* dh.h in CopyFiles */,
+				A4A54E7F1BC5C3E0002866CD /* dsa.h in CopyFiles */,
+				A4A54E801BC5C3E0002866CD /* ecc.h in CopyFiles */,
+				A4A54E811BC5C3E0002866CD /* error-crypt.h in CopyFiles */,
+				A4A54E821BC5C3E0002866CD /* fips_test.h in CopyFiles */,
+				A4A54E831BC5C3E0002866CD /* hc128.h in CopyFiles */,
+				A4A54E841BC5C3E0002866CD /* hmac.h in CopyFiles */,
+				A4A54E851BC5C3E0002866CD /* integer.h in CopyFiles */,
+				A4A54E861BC5C3E0002866CD /* logging.h in CopyFiles */,
+				A4A54E871BC5C3E0002866CD /* md2.h in CopyFiles */,
+				A4A54E881BC5C3E0002866CD /* md4.h in CopyFiles */,
+				A4A54E891BC5C3E0002866CD /* md5.h in CopyFiles */,
+				A4A54E8A1BC5C3E0002866CD /* memory.h in CopyFiles */,
+				A4A54E8B1BC5C3E0002866CD /* misc.h in CopyFiles */,
+				A4A54E8C1BC5C3E0002866CD /* mpi_class.h in CopyFiles */,
+				A4A54E8D1BC5C3E0002866CD /* mpi_superclass.h in CopyFiles */,
+				A4A54E8E1BC5C3E0002866CD /* pkcs7.h in CopyFiles */,
+				A4A54E8F1BC5C3E0002866CD /* poly1305.h in CopyFiles */,
+				A4A54E901BC5C3E0002866CD /* pwdbased.h in CopyFiles */,
+				A4A54E911BC5C3E0002866CD /* rabbit.h in CopyFiles */,
+				A4A54E921BC5C3E0002866CD /* random.h in CopyFiles */,
+				A4A54E931BC5C3E0002866CD /* ripemd.h in CopyFiles */,
+				A4A54E941BC5C3E0002866CD /* rsa.h in CopyFiles */,
+				A4A54E951BC5C3E0002866CD /* settings_comp.h in CopyFiles */,
+				A4A54E961BC5C3E0002866CD /* settings.h in CopyFiles */,
+				A4A54E971BC5C3E0002866CD /* sha.h in CopyFiles */,
+				A4A54E981BC5C3E0002866CD /* sha256.h in CopyFiles */,
+				A4A54E991BC5C3E0002866CD /* sha512.h in CopyFiles */,
+				A4A54E9A1BC5C3E0002866CD /* tfm.h in CopyFiles */,
+				A4A54E9B1BC5C3E0002866CD /* types.h in CopyFiles */,
+				A4A54E9C1BC5C3E0002866CD /* visibility.h in CopyFiles */,
+				A4A54E9D1BC5C3E0002866CD /* wc_port.h in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
@@ -480,7 +785,9 @@
 		522DBE121B7929E70031F454 /* wc_encrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wc_encrypt.h; path = ../../wolfssl/wolfcrypt/wc_encrypt.h; sourceTree = ""; };
 		525BE5B91B38853E0054BBCD /* hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hash.c; path = ../../wolfcrypt/src/hash.c; sourceTree = ""; };
 		525BE5BB1B3885580054BBCD /* hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hash.h; path = ../../wolfssl/wolfcrypt/hash.h; sourceTree = ""; };
-		52B1344D16F3C9E800C07B32 /* libwolfssl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwolfssl.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		52B1344D16F3C9E800C07B32 /* libwolfssl_fips_ios.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwolfssl_fips_ios.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		A4A54DF41BC5C380002866CD /* user_settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = user_settings.h; sourceTree = ""; };
+		A4A54EA11BC5C3E0002866CD /* libwolfssl_fips_osx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwolfssl_fips_osx.a; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -491,6 +798,13 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		A4A54E2E1BC5C3E0002866CD /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
@@ -643,6 +957,7 @@
 		521645FB1A8991990062516A /* Source */ = {
 			isa = PBXGroup;
 			children = (
+				A4A54DF41BC5C380002866CD /* user_settings.h */,
 				521646001A89924A0062516A /* wolfSSL */,
 				521645FF1A8992470062516A /* wolfCrypt */,
 				5216480F1A8ABDA50062516A /* CtaoCrypt */,
@@ -738,7 +1053,8 @@
 		52B1344E16F3C9E800C07B32 /* Products */ = {
 			isa = PBXGroup;
 			children = (
-				52B1344D16F3C9E800C07B32 /* libwolfssl.a */,
+				52B1344D16F3C9E800C07B32 /* libwolfssl_fips_ios.a */,
+				A4A54EA11BC5C3E0002866CD /* libwolfssl_fips_osx.a */,
 			);
 			name = Products;
 			sourceTree = "";
@@ -746,9 +1062,9 @@
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
-		52B1344C16F3C9E800C07B32 /* wolfssl */ = {
+		52B1344C16F3C9E800C07B32 /* wolfssl_fips_ios */ = {
 			isa = PBXNativeTarget;
-			buildConfigurationList = 52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl" */;
+			buildConfigurationList = 52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl_fips_ios" */;
 			buildPhases = (
 				52B1344916F3C9E800C07B32 /* Sources */,
 				52B1344A16F3C9E800C07B32 /* Frameworks */,
@@ -761,9 +1077,29 @@
 			);
 			dependencies = (
 			);
-			name = wolfssl;
+			name = wolfssl_fips_ios;
 			productName = "wolfssl-ios";
-			productReference = 52B1344D16F3C9E800C07B32 /* libwolfssl.a */;
+			productReference = 52B1344D16F3C9E800C07B32 /* libwolfssl_fips_ios.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		A4A54DF51BC5C3E0002866CD /* wolfssl_fips_osx */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = A4A54E9E1BC5C3E0002866CD /* Build configuration list for PBXNativeTarget "wolfssl_fips_osx" */;
+			buildPhases = (
+				A4A54DF61BC5C3E0002866CD /* Sources */,
+				A4A54E2E1BC5C3E0002866CD /* Frameworks */,
+				A4A54E2F1BC5C3E0002866CD /* CopyFiles */,
+				A4A54E391BC5C3E0002866CD /* CopyFiles */,
+				A4A54E671BC5C3E0002866CD /* CopyFiles */,
+				A4A54E711BC5C3E0002866CD /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = wolfssl_fips_osx;
+			productName = "wolfssl-ios";
+			productReference = A4A54EA11BC5C3E0002866CD /* libwolfssl_fips_osx.a */;
 			productType = "com.apple.product-type.library.static";
 		};
 /* End PBXNativeTarget section */
@@ -787,7 +1123,8 @@
 			projectDirPath = "";
 			projectRoot = "";
 			targets = (
-				52B1344C16F3C9E800C07B32 /* wolfssl */,
+				52B1344C16F3C9E800C07B32 /* wolfssl_fips_ios */,
+				A4A54DF51BC5C3E0002866CD /* wolfssl_fips_osx */,
 			);
 		};
 /* End PBXProject section */
@@ -855,6 +1192,68 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		A4A54DF61BC5C3E0002866CD /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				A4A54DF71BC5C3E0002866CD /* wolfcrypt_first.c in Sources */,
+				A4A54DF81BC5C3E0002866CD /* hmac.c in Sources */,
+				A4A54DF91BC5C3E0002866CD /* random.c in Sources */,
+				A4A54DFA1BC5C3E0002866CD /* sha256.c in Sources */,
+				A4A54DFB1BC5C3E0002866CD /* rsa.c in Sources */,
+				A4A54DFC1BC5C3E0002866CD /* aes.c in Sources */,
+				A4A54DFD1BC5C3E0002866CD /* des3.c in Sources */,
+				A4A54DFE1BC5C3E0002866CD /* hash.c in Sources */,
+				A4A54DFF1BC5C3E0002866CD /* sha.c in Sources */,
+				A4A54E001BC5C3E0002866CD /* sha512.c in Sources */,
+				A4A54E011BC5C3E0002866CD /* fips.c in Sources */,
+				A4A54E021BC5C3E0002866CD /* fips_test.c in Sources */,
+				A4A54E031BC5C3E0002866CD /* wolfcrypt_last.c in Sources */,
+				A4A54E041BC5C3E0002866CD /* dsa.c in Sources */,
+				A4A54E051BC5C3E0002866CD /* logging.c in Sources */,
+				A4A54E061BC5C3E0002866CD /* sha.c in Sources */,
+				A4A54E071BC5C3E0002866CD /* poly1305.c in Sources */,
+				A4A54E081BC5C3E0002866CD /* dh.c in Sources */,
+				A4A54E091BC5C3E0002866CD /* camellia.c in Sources */,
+				A4A54E0A1BC5C3E0002866CD /* wc_port.c in Sources */,
+				A4A54E0B1BC5C3E0002866CD /* pwdbased.c in Sources */,
+				A4A54E0C1BC5C3E0002866CD /* misc.c in Sources */,
+				A4A54E0D1BC5C3E0002866CD /* hc128.c in Sources */,
+				A4A54E0E1BC5C3E0002866CD /* asn.c in Sources */,
+				A4A54E0F1BC5C3E0002866CD /* sha512.c in Sources */,
+				A4A54E101BC5C3E0002866CD /* rabbit.c in Sources */,
+				A4A54E111BC5C3E0002866CD /* md5.c in Sources */,
+				A4A54E121BC5C3E0002866CD /* ssl.c in Sources */,
+				A4A54E131BC5C3E0002866CD /* rsa.c in Sources */,
+				A4A54E141BC5C3E0002866CD /* random.c in Sources */,
+				A4A54E151BC5C3E0002866CD /* tls.c in Sources */,
+				A4A54E161BC5C3E0002866CD /* ocsp.c in Sources */,
+				A4A54E171BC5C3E0002866CD /* md4.c in Sources */,
+				A4A54E181BC5C3E0002866CD /* aes.c in Sources */,
+				A4A54E191BC5C3E0002866CD /* des3.c in Sources */,
+				A4A54E1A1BC5C3E0002866CD /* blake2b.c in Sources */,
+				A4A54E1B1BC5C3E0002866CD /* ripemd.c in Sources */,
+				A4A54E1C1BC5C3E0002866CD /* memory.c in Sources */,
+				A4A54E1D1BC5C3E0002866CD /* wc_encrypt.c in Sources */,
+				A4A54E1E1BC5C3E0002866CD /* ecc.c in Sources */,
+				A4A54E1F1BC5C3E0002866CD /* sha256.c in Sources */,
+				A4A54E201BC5C3E0002866CD /* chacha.c in Sources */,
+				A4A54E211BC5C3E0002866CD /* pkcs7.c in Sources */,
+				A4A54E221BC5C3E0002866CD /* sniffer.c in Sources */,
+				A4A54E231BC5C3E0002866CD /* md2.c in Sources */,
+				A4A54E241BC5C3E0002866CD /* coding.c in Sources */,
+				A4A54E251BC5C3E0002866CD /* error.c in Sources */,
+				A4A54E261BC5C3E0002866CD /* hmac.c in Sources */,
+				A4A54E271BC5C3E0002866CD /* arc4.c in Sources */,
+				A4A54E281BC5C3E0002866CD /* integer.c in Sources */,
+				A4A54E291BC5C3E0002866CD /* internal.c in Sources */,
+				A4A54E2A1BC5C3E0002866CD /* io.c in Sources */,
+				A4A54E2B1BC5C3E0002866CD /* tfm.c in Sources */,
+				A4A54E2C1BC5C3E0002866CD /* crl.c in Sources */,
+				A4A54E2D1BC5C3E0002866CD /* keys.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXSourcesBuildPhase section */
 
 /* Begin XCBuildConfiguration section */
@@ -921,17 +1320,8 @@
 				GCC_PREFIX_HEADER = "";
 				GCC_PREPROCESSOR_DEFINITIONS = (
 					"DEBUG=1",
-					IPHONE,
 					HAVE_FIPS,
-					HAVE_HASHDRBG,
-					HAVE_AESGCM,
-					WOLFSSL_SHA512,
-					WOLFSSL_SHA384,
-					NO_MD4,
-					NO_HC128,
-					NO_RABBIT,
-					NO_DSA,
-					NO_PWDBASED,
+					WOLFSSL_USER_SETTINGS,
 				);
 				HEADER_SEARCH_PATHS = (
 					$SRCROOT,
@@ -940,7 +1330,7 @@
 				IPHONEOS_DEPLOYMENT_TARGET = 8.1;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
-				PRODUCT_NAME = wolfssl;
+				PRODUCT_NAME = wolfssl_fips_ios;
 				SKIP_INSTALL = YES;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl";
@@ -956,17 +1346,8 @@
 				GCC_PRECOMPILE_PREFIX_HEADER = NO;
 				GCC_PREFIX_HEADER = "";
 				GCC_PREPROCESSOR_DEFINITIONS = (
-					IPHONE,
 					HAVE_FIPS,
-					HAVE_HASHDRBG,
-					HAVE_AESGCM,
-					WOLFSSL_SHA512,
-					WOLFSSL_SHA384,
-					NO_MD4,
-					NO_HC128,
-					NO_RABBIT,
-					NO_DSA,
-					NO_PWDBASED,
+					WOLFSSL_USER_SETTINGS,
 				);
 				HEADER_SEARCH_PATHS = (
 					$SRCROOT,
@@ -975,7 +1356,62 @@
 				IPHONEOS_DEPLOYMENT_TARGET = 8.1;
 				OTHER_CFLAGS = "";
 				OTHER_LDFLAGS = "";
-				PRODUCT_NAME = wolfssl;
+				PRODUCT_NAME = wolfssl_fips_ios;
+				SKIP_INSTALL = YES;
+				TARGETED_DEVICE_FAMILY = "1,2";
+				USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl";
+			};
+			name = Release;
+		};
+		A4A54E9F1BC5C3E0002866CD /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = YES;
+				CLANG_LINK_OBJC_RUNTIME = NO;
+				DSTROOT = /tmp/wolfssl_ios.dst;
+				GCC_PRECOMPILE_PREFIX_HEADER = NO;
+				GCC_PREFIX_HEADER = "";
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					HAVE_FIPS,
+					WOLFSSL_USER_SETTINGS,
+				);
+				HEADER_SEARCH_PATHS = (
+					$SRCROOT,
+					$PROJECT_DIR/../..,
+				);
+				IPHONEOS_DEPLOYMENT_TARGET = 8.1;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = macosx;
+				SKIP_INSTALL = YES;
+				TARGETED_DEVICE_FAMILY = "1,2";
+				USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl";
+			};
+			name = Debug;
+		};
+		A4A54EA01BC5C3E0002866CD /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = YES;
+				CLANG_LINK_OBJC_RUNTIME = NO;
+				DSTROOT = /tmp/wolfssl_ios.dst;
+				GCC_PRECOMPILE_PREFIX_HEADER = NO;
+				GCC_PREFIX_HEADER = "";
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					HAVE_FIPS,
+					WOLFSSL_USER_SETTINGS,
+				);
+				HEADER_SEARCH_PATHS = (
+					$SRCROOT,
+					$PROJECT_DIR/../..,
+				);
+				IPHONEOS_DEPLOYMENT_TARGET = 8.1;
+				OTHER_CFLAGS = "";
+				OTHER_LDFLAGS = "";
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = macosx;
 				SKIP_INSTALL = YES;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl";
@@ -994,7 +1430,7 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
 		};
-		52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl" */ = {
+		52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl_fips_ios" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				52B1347316F3C9E800C07B32 /* Debug */,
@@ -1003,6 +1439,15 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
 		};
+		A4A54E9E1BC5C3E0002866CD /* Build configuration list for PBXNativeTarget "wolfssl_fips_osx" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				A4A54E9F1BC5C3E0002866CD /* Debug */,
+				A4A54EA01BC5C3E0002866CD /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
 /* End XCConfigurationList section */
 	};
 	rootObject = 52B1344516F3C9E800C07B32 /* Project object */;
diff --git a/IDE/iOS/wolfssl.xcodeproj/project.pbxproj b/IDE/iOS/wolfssl.xcodeproj/project.pbxproj
index 9b6943fda..ab88276a0 100644
--- a/IDE/iOS/wolfssl.xcodeproj/project.pbxproj
+++ b/IDE/iOS/wolfssl.xcodeproj/project.pbxproj
@@ -157,6 +157,156 @@
 		522DBE0F1B7927A50031F454 /* wc_encrypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 522DBE0E1B7927290031F454 /* wc_encrypt.h */; };
 		525BE5341B3869110054BBCD /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 525BE5331B3869110054BBCD /* hash.c */; };
 		525BE5361B3869780054BBCD /* hash.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 525BE5351B3869430054BBCD /* hash.h */; };
+		A4F318501BC58B1700FDF2BB /* dsa.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461A1A8992CC0062516A /* dsa.c */; };
+		A4F318511BC58B1700FDF2BB /* logging.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646201A8992CC0062516A /* logging.c */; };
+		A4F318521BC58B1700FDF2BB /* sha.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462D1A8992CC0062516A /* sha.c */; };
+		A4F318531BC58B1700FDF2BB /* poly1305.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646271A8992CC0062516A /* poly1305.c */; };
+		A4F318541BC58B1700FDF2BB /* dh.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646191A8992CC0062516A /* dh.c */; };
+		A4F318551BC58B1700FDF2BB /* camellia.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646151A8992CC0062516A /* camellia.c */; };
+		A4F318561BC58B1700FDF2BB /* wc_port.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646311A8992CC0062516A /* wc_port.c */; };
+		A4F318571BC58B1700FDF2BB /* pwdbased.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646281A8992CC0062516A /* pwdbased.c */; };
+		A4F318581BC58B1700FDF2BB /* misc.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646251A8992CC0062516A /* misc.c */; };
+		A4F318591BC58B1700FDF2BB /* hc128.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461D1A8992CC0062516A /* hc128.c */; };
+		A4F3185A1BC58B1700FDF2BB /* asn.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646131A8992CC0062516A /* asn.c */; };
+		A4F3185B1BC58B1700FDF2BB /* sha512.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462F1A8992CC0062516A /* sha512.c */; };
+		A4F3185C1BC58B1700FDF2BB /* rabbit.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646291A8992CC0062516A /* rabbit.c */; };
+		A4F3185D1BC58B1700FDF2BB /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 525BE5331B3869110054BBCD /* hash.c */; };
+		A4F3185E1BC58B1700FDF2BB /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646231A8992CC0062516A /* md5.c */; };
+		A4F3185F1BC58B1700FDF2BB /* ssl.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646071A89928E0062516A /* ssl.c */; };
+		A4F318601BC58B1700FDF2BB /* rsa.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462C1A8992CC0062516A /* rsa.c */; };
+		A4F318611BC58B1700FDF2BB /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462A1A8992CC0062516A /* random.c */; };
+		A4F318621BC58B1700FDF2BB /* wc_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 522DBE0C1B7926FB0031F454 /* wc_encrypt.c */; };
+		A4F318631BC58B1700FDF2BB /* tls.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646081A89928E0062516A /* tls.c */; };
+		A4F318641BC58B1700FDF2BB /* ocsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646051A89928E0062516A /* ocsp.c */; };
+		A4F318651BC58B1700FDF2BB /* md4.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646221A8992CC0062516A /* md4.c */; };
+		A4F318661BC58B1700FDF2BB /* aes.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646111A8992CC0062516A /* aes.c */; };
+		A4F318671BC58B1700FDF2BB /* des3.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646181A8992CC0062516A /* des3.c */; };
+		A4F318681BC58B1700FDF2BB /* blake2b.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646141A8992CC0062516A /* blake2b.c */; };
+		A4F318691BC58B1700FDF2BB /* ripemd.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462B1A8992CC0062516A /* ripemd.c */; };
+		A4F3186A1BC58B1700FDF2BB /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646241A8992CC0062516A /* memory.c */; };
+		A4F3186B1BC58B1700FDF2BB /* ecc.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461B1A8992CC0062516A /* ecc.c */; };
+		A4F3186C1BC58B1700FDF2BB /* sha256.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462E1A8992CC0062516A /* sha256.c */; };
+		A4F3186D1BC58B1700FDF2BB /* chacha.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646161A8992CC0062516A /* chacha.c */; };
+		A4F3186E1BC58B1700FDF2BB /* pkcs7.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646261A8992CC0062516A /* pkcs7.c */; };
+		A4F3186F1BC58B1700FDF2BB /* sniffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646061A89928E0062516A /* sniffer.c */; };
+		A4F318701BC58B1700FDF2BB /* md2.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646211A8992CC0062516A /* md2.c */; };
+		A4F318711BC58B1700FDF2BB /* coding.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646171A8992CC0062516A /* coding.c */; };
+		A4F318721BC58B1700FDF2BB /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461C1A8992CC0062516A /* error.c */; };
+		A4F318731BC58B1700FDF2BB /* hmac.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461E1A8992CC0062516A /* hmac.c */; };
+		A4F318741BC58B1700FDF2BB /* arc4.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646121A8992CC0062516A /* arc4.c */; };
+		A4F318751BC58B1700FDF2BB /* integer.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461F1A8992CC0062516A /* integer.c */; };
+		A4F318761BC58B1700FDF2BB /* internal.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646021A89928E0062516A /* internal.c */; };
+		A4F318771BC58B1700FDF2BB /* io.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646031A89928E0062516A /* io.c */; };
+		A4F318781BC58B1700FDF2BB /* tfm.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646301A8992CC0062516A /* tfm.c */; };
+		A4F318791BC58B1700FDF2BB /* crl.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646011A89928E0062516A /* crl.c */; };
+		A4F3187A1BC58B1700FDF2BB /* keys.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646041A89928E0062516A /* keys.c */; };
+		A4F3187D1BC58B1700FDF2BB /* callbacks.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646531A8993290062516A /* callbacks.h */; };
+		A4F3187E1BC58B1700FDF2BB /* certs_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646541A8993290062516A /* certs_test.h */; };
+		A4F3187F1BC58B1700FDF2BB /* crl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646551A8993290062516A /* crl.h */; };
+		A4F318801BC58B1700FDF2BB /* error-ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646561A8993290062516A /* error-ssl.h */; };
+		A4F318811BC58B1700FDF2BB /* internal.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646571A8993290062516A /* internal.h */; };
+		A4F318821BC58B1700FDF2BB /* ocsp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646581A8993290062516A /* ocsp.h */; };
+		A4F318831BC58B1700FDF2BB /* ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465B1A8993290062516A /* ssl.h */; };
+		A4F318841BC58B1700FDF2BB /* test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465C1A8993290062516A /* test.h */; };
+		A4F318851BC58B1700FDF2BB /* version.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465D1A8993290062516A /* version.h */; };
+		A4F318871BC58B1700FDF2BB /* wc_encrypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 522DBE0E1B7927290031F454 /* wc_encrypt.h */; };
+		A4F318881BC58B1700FDF2BB /* hash.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 525BE5351B3869430054BBCD /* hash.h */; };
+		A4F318891BC58B1700FDF2BB /* aes.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465E1A8993770062516A /* aes.h */; };
+		A4F3188A1BC58B1700FDF2BB /* arc4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465F1A8993770062516A /* arc4.h */; };
+		A4F3188B1BC58B1700FDF2BB /* asn_public.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646601A8993770062516A /* asn_public.h */; };
+		A4F3188C1BC58B1700FDF2BB /* asn.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646611A8993770062516A /* asn.h */; };
+		A4F3188D1BC58B1700FDF2BB /* blake2-impl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646621A8993770062516A /* blake2-impl.h */; };
+		A4F3188E1BC58B1700FDF2BB /* blake2-int.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646631A8993770062516A /* blake2-int.h */; };
+		A4F3188F1BC58B1700FDF2BB /* blake2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646641A8993770062516A /* blake2.h */; };
+		A4F318901BC58B1700FDF2BB /* camellia.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646651A8993770062516A /* camellia.h */; };
+		A4F318911BC58B1700FDF2BB /* chacha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646661A8993770062516A /* chacha.h */; };
+		A4F318921BC58B1700FDF2BB /* coding.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646671A8993770062516A /* coding.h */; };
+		A4F318931BC58B1700FDF2BB /* compress.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646681A8993770062516A /* compress.h */; };
+		A4F318941BC58B1700FDF2BB /* des3.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646691A8993770062516A /* des3.h */; };
+		A4F318951BC58B1700FDF2BB /* dh.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466A1A8993770062516A /* dh.h */; };
+		A4F318961BC58B1700FDF2BB /* dsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466B1A8993770062516A /* dsa.h */; };
+		A4F318971BC58B1700FDF2BB /* ecc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466C1A8993770062516A /* ecc.h */; };
+		A4F318981BC58B1700FDF2BB /* error-crypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466D1A8993770062516A /* error-crypt.h */; };
+		A4F318991BC58B1700FDF2BB /* fips_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466E1A8993770062516A /* fips_test.h */; };
+		A4F3189A1BC58B1700FDF2BB /* hc128.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466F1A8993770062516A /* hc128.h */; };
+		A4F3189B1BC58B1700FDF2BB /* hmac.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646701A8993770062516A /* hmac.h */; };
+		A4F3189C1BC58B1700FDF2BB /* integer.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646721A8993770062516A /* integer.h */; };
+		A4F3189D1BC58B1700FDF2BB /* logging.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646731A8993770062516A /* logging.h */; };
+		A4F3189E1BC58B1700FDF2BB /* md2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646741A8993770062516A /* md2.h */; };
+		A4F3189F1BC58B1700FDF2BB /* md4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646751A8993770062516A /* md4.h */; };
+		A4F318A01BC58B1700FDF2BB /* md5.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646761A8993770062516A /* md5.h */; };
+		A4F318A11BC58B1700FDF2BB /* memory.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646771A8993770062516A /* memory.h */; };
+		A4F318A21BC58B1700FDF2BB /* misc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646781A8993770062516A /* misc.h */; };
+		A4F318A31BC58B1700FDF2BB /* mpi_class.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646791A8993770062516A /* mpi_class.h */; };
+		A4F318A41BC58B1700FDF2BB /* mpi_superclass.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467A1A8993770062516A /* mpi_superclass.h */; };
+		A4F318A51BC58B1700FDF2BB /* pkcs7.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467B1A8993770062516A /* pkcs7.h */; };
+		A4F318A61BC58B1700FDF2BB /* poly1305.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467C1A8993770062516A /* poly1305.h */; };
+		A4F318A71BC58B1700FDF2BB /* pwdbased.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467D1A8993770062516A /* pwdbased.h */; };
+		A4F318A81BC58B1700FDF2BB /* rabbit.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467E1A8993770062516A /* rabbit.h */; };
+		A4F318A91BC58B1700FDF2BB /* random.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467F1A8993770062516A /* random.h */; };
+		A4F318AA1BC58B1700FDF2BB /* ripemd.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646801A8993770062516A /* ripemd.h */; };
+		A4F318AB1BC58B1700FDF2BB /* rsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646811A8993770062516A /* rsa.h */; };
+		A4F318AC1BC58B1700FDF2BB /* settings.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646821A8993770062516A /* settings.h */; };
+		A4F318AD1BC58B1700FDF2BB /* sha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646831A8993770062516A /* sha.h */; };
+		A4F318AE1BC58B1700FDF2BB /* sha256.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646841A8993770062516A /* sha256.h */; };
+		A4F318AF1BC58B1700FDF2BB /* sha512.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646851A8993770062516A /* sha512.h */; };
+		A4F318B01BC58B1700FDF2BB /* tfm.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646861A8993770062516A /* tfm.h */; };
+		A4F318B11BC58B1700FDF2BB /* types.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646871A8993770062516A /* types.h */; };
+		A4F318B21BC58B1700FDF2BB /* visibility.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646881A8993770062516A /* visibility.h */; };
+		A4F318B31BC58B1700FDF2BB /* wc_port.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646891A8993770062516A /* wc_port.h */; };
+		A4F318B51BC58B1700FDF2BB /* callbacks.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468A1A8993BB0062516A /* callbacks.h */; };
+		A4F318B61BC58B1700FDF2BB /* certs_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468B1A8993BB0062516A /* certs_test.h */; };
+		A4F318B71BC58B1700FDF2BB /* crl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468C1A8993BB0062516A /* crl.h */; };
+		A4F318B81BC58B1700FDF2BB /* error-ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468D1A8993BB0062516A /* error-ssl.h */; };
+		A4F318B91BC58B1700FDF2BB /* internal.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468E1A8993BB0062516A /* internal.h */; };
+		A4F318BA1BC58B1700FDF2BB /* ocsp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468F1A8993BB0062516A /* ocsp.h */; };
+		A4F318BB1BC58B1700FDF2BB /* ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646921A8993BB0062516A /* ssl.h */; };
+		A4F318BC1BC58B1700FDF2BB /* test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646931A8993BB0062516A /* test.h */; };
+		A4F318BD1BC58B1700FDF2BB /* version.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646941A8993BB0062516A /* version.h */; };
+		A4F318BF1BC58B1700FDF2BB /* aes.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646951A8993F50062516A /* aes.h */; };
+		A4F318C01BC58B1700FDF2BB /* arc4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646961A8993F50062516A /* arc4.h */; };
+		A4F318C11BC58B1700FDF2BB /* asn_public.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646971A8993F50062516A /* asn_public.h */; };
+		A4F318C21BC58B1700FDF2BB /* asn.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646981A8993F50062516A /* asn.h */; };
+		A4F318C31BC58B1700FDF2BB /* blake2-impl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646991A8993F50062516A /* blake2-impl.h */; };
+		A4F318C41BC58B1700FDF2BB /* blake2-int.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469A1A8993F50062516A /* blake2-int.h */; };
+		A4F318C51BC58B1700FDF2BB /* blake2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469B1A8993F50062516A /* blake2.h */; };
+		A4F318C61BC58B1700FDF2BB /* camellia.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469C1A8993F50062516A /* camellia.h */; };
+		A4F318C71BC58B1700FDF2BB /* chacha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469D1A8993F50062516A /* chacha.h */; };
+		A4F318C81BC58B1700FDF2BB /* coding.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469E1A8993F50062516A /* coding.h */; };
+		A4F318C91BC58B1700FDF2BB /* compress.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469F1A8993F50062516A /* compress.h */; };
+		A4F318CA1BC58B1700FDF2BB /* des3.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A01A8993F50062516A /* des3.h */; };
+		A4F318CB1BC58B1700FDF2BB /* dh.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A11A8993F50062516A /* dh.h */; };
+		A4F318CC1BC58B1700FDF2BB /* dsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A21A8993F50062516A /* dsa.h */; };
+		A4F318CD1BC58B1700FDF2BB /* ecc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A31A8993F50062516A /* ecc.h */; };
+		A4F318CE1BC58B1700FDF2BB /* error-crypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A41A8993F50062516A /* error-crypt.h */; };
+		A4F318CF1BC58B1700FDF2BB /* fips_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A51A8993F50062516A /* fips_test.h */; };
+		A4F318D01BC58B1700FDF2BB /* hc128.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A61A8993F50062516A /* hc128.h */; };
+		A4F318D11BC58B1700FDF2BB /* hmac.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A71A8993F50062516A /* hmac.h */; };
+		A4F318D21BC58B1700FDF2BB /* integer.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A81A8993F50062516A /* integer.h */; };
+		A4F318D31BC58B1700FDF2BB /* logging.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A91A8993F50062516A /* logging.h */; };
+		A4F318D41BC58B1700FDF2BB /* md2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AA1A8993F50062516A /* md2.h */; };
+		A4F318D51BC58B1700FDF2BB /* md4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AB1A8993F50062516A /* md4.h */; };
+		A4F318D61BC58B1700FDF2BB /* md5.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AC1A8993F50062516A /* md5.h */; };
+		A4F318D71BC58B1700FDF2BB /* memory.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AD1A8993F50062516A /* memory.h */; };
+		A4F318D81BC58B1700FDF2BB /* misc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AE1A8993F50062516A /* misc.h */; };
+		A4F318D91BC58B1700FDF2BB /* mpi_class.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AF1A8993F50062516A /* mpi_class.h */; };
+		A4F318DA1BC58B1700FDF2BB /* mpi_superclass.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B01A8993F50062516A /* mpi_superclass.h */; };
+		A4F318DB1BC58B1700FDF2BB /* pkcs7.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B11A8993F50062516A /* pkcs7.h */; };
+		A4F318DC1BC58B1700FDF2BB /* poly1305.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B21A8993F50062516A /* poly1305.h */; };
+		A4F318DD1BC58B1700FDF2BB /* pwdbased.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B31A8993F50062516A /* pwdbased.h */; };
+		A4F318DE1BC58B1700FDF2BB /* rabbit.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B41A8993F50062516A /* rabbit.h */; };
+		A4F318DF1BC58B1700FDF2BB /* random.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B51A8993F50062516A /* random.h */; };
+		A4F318E01BC58B1700FDF2BB /* ripemd.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B61A8993F50062516A /* ripemd.h */; };
+		A4F318E11BC58B1700FDF2BB /* rsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B71A8993F50062516A /* rsa.h */; };
+		A4F318E21BC58B1700FDF2BB /* settings_comp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B81A8993F50062516A /* settings_comp.h */; };
+		A4F318E31BC58B1700FDF2BB /* settings.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B91A8993F50062516A /* settings.h */; };
+		A4F318E41BC58B1700FDF2BB /* sha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BA1A8993F50062516A /* sha.h */; };
+		A4F318E51BC58B1700FDF2BB /* sha256.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BB1A8993F50062516A /* sha256.h */; };
+		A4F318E61BC58B1700FDF2BB /* sha512.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BC1A8993F50062516A /* sha512.h */; };
+		A4F318E71BC58B1700FDF2BB /* tfm.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BD1A8993F50062516A /* tfm.h */; };
+		A4F318E81BC58B1700FDF2BB /* types.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BE1A8993F50062516A /* types.h */; };
+		A4F318E91BC58B1700FDF2BB /* visibility.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BF1A8993F50062516A /* visibility.h */; };
+		A4F318EA1BC58B1700FDF2BB /* wc_port.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646C01A8993F50062516A /* wc_port.h */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -303,6 +453,149 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		A4F3187C1BC58B1700FDF2BB /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = include/wolfssl;
+			dstSubfolderSpec = 7;
+			files = (
+				A4F3187D1BC58B1700FDF2BB /* callbacks.h in CopyFiles */,
+				A4F3187E1BC58B1700FDF2BB /* certs_test.h in CopyFiles */,
+				A4F3187F1BC58B1700FDF2BB /* crl.h in CopyFiles */,
+				A4F318801BC58B1700FDF2BB /* error-ssl.h in CopyFiles */,
+				A4F318811BC58B1700FDF2BB /* internal.h in CopyFiles */,
+				A4F318821BC58B1700FDF2BB /* ocsp.h in CopyFiles */,
+				A4F318831BC58B1700FDF2BB /* ssl.h in CopyFiles */,
+				A4F318841BC58B1700FDF2BB /* test.h in CopyFiles */,
+				A4F318851BC58B1700FDF2BB /* version.h in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		A4F318861BC58B1700FDF2BB /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = include/wolfssl/wolfcrypt;
+			dstSubfolderSpec = 7;
+			files = (
+				A4F318871BC58B1700FDF2BB /* wc_encrypt.h in CopyFiles */,
+				A4F318881BC58B1700FDF2BB /* hash.h in CopyFiles */,
+				A4F318891BC58B1700FDF2BB /* aes.h in CopyFiles */,
+				A4F3188A1BC58B1700FDF2BB /* arc4.h in CopyFiles */,
+				A4F3188B1BC58B1700FDF2BB /* asn_public.h in CopyFiles */,
+				A4F3188C1BC58B1700FDF2BB /* asn.h in CopyFiles */,
+				A4F3188D1BC58B1700FDF2BB /* blake2-impl.h in CopyFiles */,
+				A4F3188E1BC58B1700FDF2BB /* blake2-int.h in CopyFiles */,
+				A4F3188F1BC58B1700FDF2BB /* blake2.h in CopyFiles */,
+				A4F318901BC58B1700FDF2BB /* camellia.h in CopyFiles */,
+				A4F318911BC58B1700FDF2BB /* chacha.h in CopyFiles */,
+				A4F318921BC58B1700FDF2BB /* coding.h in CopyFiles */,
+				A4F318931BC58B1700FDF2BB /* compress.h in CopyFiles */,
+				A4F318941BC58B1700FDF2BB /* des3.h in CopyFiles */,
+				A4F318951BC58B1700FDF2BB /* dh.h in CopyFiles */,
+				A4F318961BC58B1700FDF2BB /* dsa.h in CopyFiles */,
+				A4F318971BC58B1700FDF2BB /* ecc.h in CopyFiles */,
+				A4F318981BC58B1700FDF2BB /* error-crypt.h in CopyFiles */,
+				A4F318991BC58B1700FDF2BB /* fips_test.h in CopyFiles */,
+				A4F3189A1BC58B1700FDF2BB /* hc128.h in CopyFiles */,
+				A4F3189B1BC58B1700FDF2BB /* hmac.h in CopyFiles */,
+				A4F3189C1BC58B1700FDF2BB /* integer.h in CopyFiles */,
+				A4F3189D1BC58B1700FDF2BB /* logging.h in CopyFiles */,
+				A4F3189E1BC58B1700FDF2BB /* md2.h in CopyFiles */,
+				A4F3189F1BC58B1700FDF2BB /* md4.h in CopyFiles */,
+				A4F318A01BC58B1700FDF2BB /* md5.h in CopyFiles */,
+				A4F318A11BC58B1700FDF2BB /* memory.h in CopyFiles */,
+				A4F318A21BC58B1700FDF2BB /* misc.h in CopyFiles */,
+				A4F318A31BC58B1700FDF2BB /* mpi_class.h in CopyFiles */,
+				A4F318A41BC58B1700FDF2BB /* mpi_superclass.h in CopyFiles */,
+				A4F318A51BC58B1700FDF2BB /* pkcs7.h in CopyFiles */,
+				A4F318A61BC58B1700FDF2BB /* poly1305.h in CopyFiles */,
+				A4F318A71BC58B1700FDF2BB /* pwdbased.h in CopyFiles */,
+				A4F318A81BC58B1700FDF2BB /* rabbit.h in CopyFiles */,
+				A4F318A91BC58B1700FDF2BB /* random.h in CopyFiles */,
+				A4F318AA1BC58B1700FDF2BB /* ripemd.h in CopyFiles */,
+				A4F318AB1BC58B1700FDF2BB /* rsa.h in CopyFiles */,
+				A4F318AC1BC58B1700FDF2BB /* settings.h in CopyFiles */,
+				A4F318AD1BC58B1700FDF2BB /* sha.h in CopyFiles */,
+				A4F318AE1BC58B1700FDF2BB /* sha256.h in CopyFiles */,
+				A4F318AF1BC58B1700FDF2BB /* sha512.h in CopyFiles */,
+				A4F318B01BC58B1700FDF2BB /* tfm.h in CopyFiles */,
+				A4F318B11BC58B1700FDF2BB /* types.h in CopyFiles */,
+				A4F318B21BC58B1700FDF2BB /* visibility.h in CopyFiles */,
+				A4F318B31BC58B1700FDF2BB /* wc_port.h in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		A4F318B41BC58B1700FDF2BB /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = include/cyassl;
+			dstSubfolderSpec = 7;
+			files = (
+				A4F318B51BC58B1700FDF2BB /* callbacks.h in CopyFiles */,
+				A4F318B61BC58B1700FDF2BB /* certs_test.h in CopyFiles */,
+				A4F318B71BC58B1700FDF2BB /* crl.h in CopyFiles */,
+				A4F318B81BC58B1700FDF2BB /* error-ssl.h in CopyFiles */,
+				A4F318B91BC58B1700FDF2BB /* internal.h in CopyFiles */,
+				A4F318BA1BC58B1700FDF2BB /* ocsp.h in CopyFiles */,
+				A4F318BB1BC58B1700FDF2BB /* ssl.h in CopyFiles */,
+				A4F318BC1BC58B1700FDF2BB /* test.h in CopyFiles */,
+				A4F318BD1BC58B1700FDF2BB /* version.h in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+		A4F318BE1BC58B1700FDF2BB /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = include/cyassl/ctaocrypt;
+			dstSubfolderSpec = 7;
+			files = (
+				A4F318BF1BC58B1700FDF2BB /* aes.h in CopyFiles */,
+				A4F318C01BC58B1700FDF2BB /* arc4.h in CopyFiles */,
+				A4F318C11BC58B1700FDF2BB /* asn_public.h in CopyFiles */,
+				A4F318C21BC58B1700FDF2BB /* asn.h in CopyFiles */,
+				A4F318C31BC58B1700FDF2BB /* blake2-impl.h in CopyFiles */,
+				A4F318C41BC58B1700FDF2BB /* blake2-int.h in CopyFiles */,
+				A4F318C51BC58B1700FDF2BB /* blake2.h in CopyFiles */,
+				A4F318C61BC58B1700FDF2BB /* camellia.h in CopyFiles */,
+				A4F318C71BC58B1700FDF2BB /* chacha.h in CopyFiles */,
+				A4F318C81BC58B1700FDF2BB /* coding.h in CopyFiles */,
+				A4F318C91BC58B1700FDF2BB /* compress.h in CopyFiles */,
+				A4F318CA1BC58B1700FDF2BB /* des3.h in CopyFiles */,
+				A4F318CB1BC58B1700FDF2BB /* dh.h in CopyFiles */,
+				A4F318CC1BC58B1700FDF2BB /* dsa.h in CopyFiles */,
+				A4F318CD1BC58B1700FDF2BB /* ecc.h in CopyFiles */,
+				A4F318CE1BC58B1700FDF2BB /* error-crypt.h in CopyFiles */,
+				A4F318CF1BC58B1700FDF2BB /* fips_test.h in CopyFiles */,
+				A4F318D01BC58B1700FDF2BB /* hc128.h in CopyFiles */,
+				A4F318D11BC58B1700FDF2BB /* hmac.h in CopyFiles */,
+				A4F318D21BC58B1700FDF2BB /* integer.h in CopyFiles */,
+				A4F318D31BC58B1700FDF2BB /* logging.h in CopyFiles */,
+				A4F318D41BC58B1700FDF2BB /* md2.h in CopyFiles */,
+				A4F318D51BC58B1700FDF2BB /* md4.h in CopyFiles */,
+				A4F318D61BC58B1700FDF2BB /* md5.h in CopyFiles */,
+				A4F318D71BC58B1700FDF2BB /* memory.h in CopyFiles */,
+				A4F318D81BC58B1700FDF2BB /* misc.h in CopyFiles */,
+				A4F318D91BC58B1700FDF2BB /* mpi_class.h in CopyFiles */,
+				A4F318DA1BC58B1700FDF2BB /* mpi_superclass.h in CopyFiles */,
+				A4F318DB1BC58B1700FDF2BB /* pkcs7.h in CopyFiles */,
+				A4F318DC1BC58B1700FDF2BB /* poly1305.h in CopyFiles */,
+				A4F318DD1BC58B1700FDF2BB /* pwdbased.h in CopyFiles */,
+				A4F318DE1BC58B1700FDF2BB /* rabbit.h in CopyFiles */,
+				A4F318DF1BC58B1700FDF2BB /* random.h in CopyFiles */,
+				A4F318E01BC58B1700FDF2BB /* ripemd.h in CopyFiles */,
+				A4F318E11BC58B1700FDF2BB /* rsa.h in CopyFiles */,
+				A4F318E21BC58B1700FDF2BB /* settings_comp.h in CopyFiles */,
+				A4F318E31BC58B1700FDF2BB /* settings.h in CopyFiles */,
+				A4F318E41BC58B1700FDF2BB /* sha.h in CopyFiles */,
+				A4F318E51BC58B1700FDF2BB /* sha256.h in CopyFiles */,
+				A4F318E61BC58B1700FDF2BB /* sha512.h in CopyFiles */,
+				A4F318E71BC58B1700FDF2BB /* tfm.h in CopyFiles */,
+				A4F318E81BC58B1700FDF2BB /* types.h in CopyFiles */,
+				A4F318E91BC58B1700FDF2BB /* visibility.h in CopyFiles */,
+				A4F318EA1BC58B1700FDF2BB /* wc_port.h in CopyFiles */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXCopyFilesBuildPhase section */
 
 /* Begin PBXFileReference section */
@@ -456,7 +749,9 @@
 		522DBE0E1B7927290031F454 /* wc_encrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wc_encrypt.h; path = ../../wolfssl/wolfcrypt/wc_encrypt.h; sourceTree = ""; };
 		525BE5331B3869110054BBCD /* hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hash.c; path = ../../wolfcrypt/src/hash.c; sourceTree = ""; };
 		525BE5351B3869430054BBCD /* hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hash.h; path = ../../wolfssl/wolfcrypt/hash.h; sourceTree = ""; };
-		52B1344D16F3C9E800C07B32 /* libwolfssl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwolfssl.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		52B1344D16F3C9E800C07B32 /* libwolfssl_ios.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwolfssl_ios.a; sourceTree = BUILT_PRODUCTS_DIR; };
+		A45EA7091BC5995E00A8614A /* user_settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = user_settings.h; sourceTree = ""; };
+		A4F318EE1BC58B1700FDF2BB /* libwolfssl_osx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwolfssl_osx.a; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -467,6 +762,13 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		A4F3187B1BC58B1700FDF2BB /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXFrameworksBuildPhase section */
 
 /* Begin PBXGroup section */
@@ -619,6 +921,7 @@
 		521645FB1A8991990062516A /* Source */ = {
 			isa = PBXGroup;
 			children = (
+				A45EA7091BC5995E00A8614A /* user_settings.h */,
 				521646001A89924A0062516A /* wolfSSL */,
 				521645FF1A8992470062516A /* wolfCrypt */,
 			);
@@ -694,7 +997,8 @@
 		52B1344E16F3C9E800C07B32 /* Products */ = {
 			isa = PBXGroup;
 			children = (
-				52B1344D16F3C9E800C07B32 /* libwolfssl.a */,
+				52B1344D16F3C9E800C07B32 /* libwolfssl_ios.a */,
+				A4F318EE1BC58B1700FDF2BB /* libwolfssl_osx.a */,
 			);
 			name = Products;
 			sourceTree = "";
@@ -702,9 +1006,9 @@
 /* End PBXGroup section */
 
 /* Begin PBXNativeTarget section */
-		52B1344C16F3C9E800C07B32 /* wolfssl */ = {
+		52B1344C16F3C9E800C07B32 /* wolfssl_ios */ = {
 			isa = PBXNativeTarget;
-			buildConfigurationList = 52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl" */;
+			buildConfigurationList = 52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl_ios" */;
 			buildPhases = (
 				52B1344916F3C9E800C07B32 /* Sources */,
 				52B1344A16F3C9E800C07B32 /* Frameworks */,
@@ -717,9 +1021,29 @@
 			);
 			dependencies = (
 			);
-			name = wolfssl;
+			name = wolfssl_ios;
 			productName = "wolfssl-ios";
-			productReference = 52B1344D16F3C9E800C07B32 /* libwolfssl.a */;
+			productReference = 52B1344D16F3C9E800C07B32 /* libwolfssl_ios.a */;
+			productType = "com.apple.product-type.library.static";
+		};
+		A4F3184E1BC58B1700FDF2BB /* wolfssl_osx */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = A4F318EB1BC58B1700FDF2BB /* Build configuration list for PBXNativeTarget "wolfssl_osx" */;
+			buildPhases = (
+				A4F3184F1BC58B1700FDF2BB /* Sources */,
+				A4F3187B1BC58B1700FDF2BB /* Frameworks */,
+				A4F3187C1BC58B1700FDF2BB /* CopyFiles */,
+				A4F318861BC58B1700FDF2BB /* CopyFiles */,
+				A4F318B41BC58B1700FDF2BB /* CopyFiles */,
+				A4F318BE1BC58B1700FDF2BB /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = wolfssl_osx;
+			productName = "wolfssl-osx";
+			productReference = A4F318EE1BC58B1700FDF2BB /* libwolfssl_osx.a */;
 			productType = "com.apple.product-type.library.static";
 		};
 /* End PBXNativeTarget section */
@@ -743,7 +1067,8 @@
 			projectDirPath = "";
 			projectRoot = "";
 			targets = (
-				52B1344C16F3C9E800C07B32 /* wolfssl */,
+				52B1344C16F3C9E800C07B32 /* wolfssl_ios */,
+				A4F3184E1BC58B1700FDF2BB /* wolfssl_osx */,
 			);
 		};
 /* End PBXProject section */
@@ -799,6 +1124,56 @@
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
+		A4F3184F1BC58B1700FDF2BB /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				A4F318501BC58B1700FDF2BB /* dsa.c in Sources */,
+				A4F318511BC58B1700FDF2BB /* logging.c in Sources */,
+				A4F318521BC58B1700FDF2BB /* sha.c in Sources */,
+				A4F318531BC58B1700FDF2BB /* poly1305.c in Sources */,
+				A4F318541BC58B1700FDF2BB /* dh.c in Sources */,
+				A4F318551BC58B1700FDF2BB /* camellia.c in Sources */,
+				A4F318561BC58B1700FDF2BB /* wc_port.c in Sources */,
+				A4F318571BC58B1700FDF2BB /* pwdbased.c in Sources */,
+				A4F318581BC58B1700FDF2BB /* misc.c in Sources */,
+				A4F318591BC58B1700FDF2BB /* hc128.c in Sources */,
+				A4F3185A1BC58B1700FDF2BB /* asn.c in Sources */,
+				A4F3185B1BC58B1700FDF2BB /* sha512.c in Sources */,
+				A4F3185C1BC58B1700FDF2BB /* rabbit.c in Sources */,
+				A4F3185D1BC58B1700FDF2BB /* hash.c in Sources */,
+				A4F3185E1BC58B1700FDF2BB /* md5.c in Sources */,
+				A4F3185F1BC58B1700FDF2BB /* ssl.c in Sources */,
+				A4F318601BC58B1700FDF2BB /* rsa.c in Sources */,
+				A4F318611BC58B1700FDF2BB /* random.c in Sources */,
+				A4F318621BC58B1700FDF2BB /* wc_encrypt.c in Sources */,
+				A4F318631BC58B1700FDF2BB /* tls.c in Sources */,
+				A4F318641BC58B1700FDF2BB /* ocsp.c in Sources */,
+				A4F318651BC58B1700FDF2BB /* md4.c in Sources */,
+				A4F318661BC58B1700FDF2BB /* aes.c in Sources */,
+				A4F318671BC58B1700FDF2BB /* des3.c in Sources */,
+				A4F318681BC58B1700FDF2BB /* blake2b.c in Sources */,
+				A4F318691BC58B1700FDF2BB /* ripemd.c in Sources */,
+				A4F3186A1BC58B1700FDF2BB /* memory.c in Sources */,
+				A4F3186B1BC58B1700FDF2BB /* ecc.c in Sources */,
+				A4F3186C1BC58B1700FDF2BB /* sha256.c in Sources */,
+				A4F3186D1BC58B1700FDF2BB /* chacha.c in Sources */,
+				A4F3186E1BC58B1700FDF2BB /* pkcs7.c in Sources */,
+				A4F3186F1BC58B1700FDF2BB /* sniffer.c in Sources */,
+				A4F318701BC58B1700FDF2BB /* md2.c in Sources */,
+				A4F318711BC58B1700FDF2BB /* coding.c in Sources */,
+				A4F318721BC58B1700FDF2BB /* error.c in Sources */,
+				A4F318731BC58B1700FDF2BB /* hmac.c in Sources */,
+				A4F318741BC58B1700FDF2BB /* arc4.c in Sources */,
+				A4F318751BC58B1700FDF2BB /* integer.c in Sources */,
+				A4F318761BC58B1700FDF2BB /* internal.c in Sources */,
+				A4F318771BC58B1700FDF2BB /* io.c in Sources */,
+				A4F318781BC58B1700FDF2BB /* tfm.c in Sources */,
+				A4F318791BC58B1700FDF2BB /* crl.c in Sources */,
+				A4F3187A1BC58B1700FDF2BB /* keys.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
 /* End PBXSourcesBuildPhase section */
 
 /* Begin XCBuildConfiguration section */
@@ -813,6 +1188,7 @@
 				CLANG_WARN_ENUM_CONVERSION = YES;
 				CLANG_WARN_INT_CONVERSION = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
 				COPY_PHASE_STRIP = NO;
 				GCC_C_LANGUAGE_STANDARD = gnu99;
 				GCC_DYNAMIC_NO_PIC = NO;
@@ -825,8 +1201,8 @@
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNINITIALIZED_AUTOS = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 6.1;
 				ONLY_ACTIVE_ARCH = YES;
+				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				SDKROOT = iphoneos;
 				USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl include";
 			};
@@ -843,12 +1219,13 @@
 				CLANG_WARN_ENUM_CONVERSION = YES;
 				CLANG_WARN_INT_CONVERSION = YES;
 				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
 				COPY_PHASE_STRIP = YES;
 				GCC_C_LANGUAGE_STANDARD = gnu99;
 				GCC_WARN_ABOUT_RETURN_TYPE = YES;
 				GCC_WARN_UNINITIALIZED_AUTOS = YES;
 				GCC_WARN_UNUSED_VARIABLE = YES;
-				IPHONEOS_DEPLOYMENT_TARGET = 6.1;
+				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
 				SDKROOT = iphoneos;
 				USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl include";
 				VALIDATE_PRODUCT = NO;
@@ -864,22 +1241,19 @@
 				GCC_PRECOMPILE_PREFIX_HEADER = NO;
 				GCC_PREFIX_HEADER = "";
 				GCC_PREPROCESSOR_DEFINITIONS = (
-					"DEBUG=1",
 					"$(inherited)",
-					IPHONE,
-					HAVE_HASHDRBG,
-					USE_FAST_MATH,
-					HAVE_HASHDRBG,
-					HAVE_AESGCM,
-					WOLFSSL_SHA512,
-					WOLFSSL_SHA384,
+					WOLFSSL_USER_SETTINGS,
 				);
 				HEADER_SEARCH_PATHS = (
 					$SRCROOT,
 					$PROJECT_DIR/../..,
 				);
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(PROJECT_DIR)/DerivedData/wolfssl/Build/Products/Debug",
+				);
 				OTHER_LDFLAGS = "";
-				PRODUCT_NAME = wolfssl;
+				PRODUCT_NAME = wolfssl_ios;
 				SKIP_INSTALL = YES;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl";
@@ -894,21 +1268,66 @@
 				DSTROOT = /tmp/wolfssl_ios.dst;
 				GCC_PRECOMPILE_PREFIX_HEADER = NO;
 				GCC_PREFIX_HEADER = "";
+				GCC_PREPROCESSOR_DEFINITIONS = WOLFSSL_USER_SETTINGS;
+				HEADER_SEARCH_PATHS = (
+					$SRCROOT,
+					$PROJECT_DIR/../..,
+				);
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(PROJECT_DIR)/DerivedData/wolfssl/Build/Products/Debug",
+				);
+				OTHER_LDFLAGS = "";
+				PRODUCT_NAME = wolfssl_ios;
+				SKIP_INSTALL = YES;
+				TARGETED_DEVICE_FAMILY = "1,2";
+				USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl";
+			};
+			name = Release;
+		};
+		A4F318EC1BC58B1700FDF2BB /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = YES;
+				CLANG_LINK_OBJC_RUNTIME = NO;
+				DSTROOT = /tmp/wolfssl_osx.dst;
+				GCC_PRECOMPILE_PREFIX_HEADER = NO;
+				GCC_PREFIX_HEADER = "";
 				GCC_PREPROCESSOR_DEFINITIONS = (
-					IPHONE,
-					HAVE_HASHDRBG,
-					USE_FAST_MATH,
-					HAVE_HASHDRBG,
-					HAVE_AESGCM,
-					WOLFSSL_SHA512,
-					WOLFSSL_SHA384,
+					"$(inherited)",
+					WOLFSSL_USER_SETTINGS,
 				);
 				HEADER_SEARCH_PATHS = (
 					$SRCROOT,
 					$PROJECT_DIR/../..,
 				);
 				OTHER_LDFLAGS = "";
-				PRODUCT_NAME = wolfssl;
+				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = macosx;
+				SKIP_INSTALL = YES;
+				TARGETED_DEVICE_FAMILY = "1,2";
+				USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl";
+			};
+			name = Debug;
+		};
+		A4F318ED1BC58B1700FDF2BB /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = YES;
+				CLANG_LINK_OBJC_RUNTIME = NO;
+				DSTROOT = /tmp/wolfssl_osx.dst;
+				GCC_PRECOMPILE_PREFIX_HEADER = NO;
+				GCC_PREFIX_HEADER = "";
+				GCC_PREPROCESSOR_DEFINITIONS = WOLFSSL_USER_SETTINGS;
+				HEADER_SEARCH_PATHS = (
+					$SRCROOT,
+					$PROJECT_DIR/../..,
+				);
+				OTHER_LDFLAGS = "";
+				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO;
+				PRODUCT_NAME = "$(TARGET_NAME)";
+				SDKROOT = macosx;
 				SKIP_INSTALL = YES;
 				TARGETED_DEVICE_FAMILY = "1,2";
 				USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl";
@@ -927,7 +1346,7 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
 		};
-		52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl" */ = {
+		52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl_ios" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (
 				52B1347316F3C9E800C07B32 /* Debug */,
@@ -936,6 +1355,15 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Release;
 		};
+		A4F318EB1BC58B1700FDF2BB /* Build configuration list for PBXNativeTarget "wolfssl_osx" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				A4F318EC1BC58B1700FDF2BB /* Debug */,
+				A4F318ED1BC58B1700FDF2BB /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
 /* End XCConfigurationList section */
 	};
 	rootObject = 52B1344516F3C9E800C07B32 /* Project object */;
diff --git a/IDE/iOS/wolfssl.xcworkspace/contents.xcworkspacedata b/IDE/iOS/wolfssl.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 000000000..602c4aaac
--- /dev/null
+++ b/IDE/iOS/wolfssl.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,13 @@
+
+
+   
+   
+   
+   
+   
+   
+
diff --git a/IDE/iOS/wolfssl_testsuite.xcodeproj/project.pbxproj b/IDE/iOS/wolfssl_testsuite.xcodeproj/project.pbxproj
new file mode 100644
index 000000000..e19e92576
--- /dev/null
+++ b/IDE/iOS/wolfssl_testsuite.xcodeproj/project.pbxproj
@@ -0,0 +1,347 @@
+// !$*UTF8*$!
+{
+	archiveVersion = 1;
+	classes = {
+	};
+	objectVersion = 46;
+	objects = {
+
+/* Begin PBXBuildFile section */
+		A44566701BC59CA50053D0CB /* libwolfssl_osx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A445666F1BC59CA50053D0CB /* libwolfssl_osx.a */; };
+		A45EA6DF1BC5922C00A8614A /* client.c in Sources */ = {isa = PBXBuildFile; fileRef = A45EA69D1BC5922C00A8614A /* client.c */; settings = {ASSET_TAGS = (); }; };
+		A45EA6E31BC5922C00A8614A /* echoclient.c in Sources */ = {isa = PBXBuildFile; fileRef = A45EA6B01BC5922C00A8614A /* echoclient.c */; settings = {ASSET_TAGS = (); }; };
+		A45EA6E61BC5922C00A8614A /* echoserver.c in Sources */ = {isa = PBXBuildFile; fileRef = A45EA6C31BC5922C00A8614A /* echoserver.c */; settings = {ASSET_TAGS = (); }; };
+		A45EA6E91BC5922C00A8614A /* server.c in Sources */ = {isa = PBXBuildFile; fileRef = A45EA6D71BC5922C00A8614A /* server.c */; settings = {ASSET_TAGS = (); }; };
+		A45EA6FD1BC5929500A8614A /* test.c in Sources */ = {isa = PBXBuildFile; fileRef = A45EA6F61BC5929500A8614A /* test.c */; settings = {ASSET_TAGS = (); }; };
+		A4C7CBF51BC58BD600E591AE /* testsuite.c in Sources */ = {isa = PBXBuildFile; fileRef = A4C7CBF41BC58BD600E591AE /* testsuite.c */; settings = {ASSET_TAGS = (); }; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+		A4F318F61BC58B8100FDF2BB /* CopyFiles */ = {
+			isa = PBXCopyFilesBuildPhase;
+			buildActionMask = 2147483647;
+			dstPath = /usr/share/man/man1/;
+			dstSubfolderSpec = 0;
+			files = (
+			);
+			runOnlyForDeploymentPostprocessing = 1;
+		};
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+		A445666F1BC59CA50053D0CB /* libwolfssl_osx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwolfssl_osx.a; path = Build/Products/libwolfssl_osx.a; sourceTree = ""; };
+		A45EA69D1BC5922C00A8614A /* client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = client.c; sourceTree = ""; };
+		A45EA69E1BC5922C00A8614A /* client.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = client.h; sourceTree = ""; };
+		A45EA6B01BC5922C00A8614A /* echoclient.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = echoclient.c; sourceTree = ""; };
+		A45EA6B11BC5922C00A8614A /* echoclient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = echoclient.h; sourceTree = ""; };
+		A45EA6C31BC5922C00A8614A /* echoserver.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = echoserver.c; sourceTree = ""; };
+		A45EA6C41BC5922C00A8614A /* echoserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = echoserver.h; sourceTree = ""; };
+		A45EA6D71BC5922C00A8614A /* server.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = server.c; sourceTree = ""; };
+		A45EA6D81BC5922C00A8614A /* server.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = server.h; sourceTree = ""; };
+		A45EA6F61BC5929500A8614A /* test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = test.c; sourceTree = ""; };
+		A45EA6F71BC5929500A8614A /* test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = test.h; sourceTree = ""; };
+		A45EA7081BC5995800A8614A /* user_settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = user_settings.h; sourceTree = ""; };
+		A4C7CBF41BC58BD600E591AE /* testsuite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testsuite.c; path = ../../testsuite/testsuite.c; sourceTree = ""; };
+		A4F318F81BC58B8100FDF2BB /* wolfssl_testsuite */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = wolfssl_testsuite; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+		A4F318F51BC58B8100FDF2BB /* Frameworks */ = {
+			isa = PBXFrameworksBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				A44566701BC59CA50053D0CB /* libwolfssl_osx.a in Frameworks */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+		A45EA6921BC5922C00A8614A /* client */ = {
+			isa = PBXGroup;
+			children = (
+				A45EA69D1BC5922C00A8614A /* client.c */,
+				A45EA69E1BC5922C00A8614A /* client.h */,
+			);
+			name = client;
+			path = ../../examples/client;
+			sourceTree = "";
+		};
+		A45EA6A61BC5922C00A8614A /* echoclient */ = {
+			isa = PBXGroup;
+			children = (
+				A45EA6B01BC5922C00A8614A /* echoclient.c */,
+				A45EA6B11BC5922C00A8614A /* echoclient.h */,
+			);
+			name = echoclient;
+			path = ../../examples/echoclient;
+			sourceTree = "";
+		};
+		A45EA6B91BC5922C00A8614A /* echoserver */ = {
+			isa = PBXGroup;
+			children = (
+				A45EA6C31BC5922C00A8614A /* echoserver.c */,
+				A45EA6C41BC5922C00A8614A /* echoserver.h */,
+			);
+			name = echoserver;
+			path = ../../examples/echoserver;
+			sourceTree = "";
+		};
+		A45EA6CB1BC5922C00A8614A /* server */ = {
+			isa = PBXGroup;
+			children = (
+				A45EA6D71BC5922C00A8614A /* server.c */,
+				A45EA6D81BC5922C00A8614A /* server.h */,
+			);
+			name = server;
+			path = ../../examples/server;
+			sourceTree = "";
+		};
+		A45EA6ED1BC5929500A8614A /* test */ = {
+			isa = PBXGroup;
+			children = (
+				A45EA6F61BC5929500A8614A /* test.c */,
+				A45EA6F71BC5929500A8614A /* test.h */,
+			);
+			name = test;
+			path = ../../wolfcrypt/test;
+			sourceTree = "";
+		};
+		A4C7CBF31BC58BC300E591AE /* Source */ = {
+			isa = PBXGroup;
+			children = (
+				A45EA7081BC5995800A8614A /* user_settings.h */,
+				A45EA6ED1BC5929500A8614A /* test */,
+				A45EA6921BC5922C00A8614A /* client */,
+				A45EA6A61BC5922C00A8614A /* echoclient */,
+				A45EA6B91BC5922C00A8614A /* echoserver */,
+				A45EA6CB1BC5922C00A8614A /* server */,
+				A4C7CBF41BC58BD600E591AE /* testsuite.c */,
+			);
+			name = Source;
+			sourceTree = "";
+		};
+		A4F318EF1BC58B8100FDF2BB = {
+			isa = PBXGroup;
+			children = (
+				A445666F1BC59CA50053D0CB /* libwolfssl_osx.a */,
+				A4C7CBF31BC58BC300E591AE /* Source */,
+				A4F318F91BC58B8100FDF2BB /* Products */,
+			);
+			sourceTree = "";
+		};
+		A4F318F91BC58B8100FDF2BB /* Products */ = {
+			isa = PBXGroup;
+			children = (
+				A4F318F81BC58B8100FDF2BB /* wolfssl_testsuite */,
+			);
+			name = Products;
+			sourceTree = "";
+		};
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+		A4F318F71BC58B8100FDF2BB /* wolfssl_testsuite */ = {
+			isa = PBXNativeTarget;
+			buildConfigurationList = A4F318FF1BC58B8100FDF2BB /* Build configuration list for PBXNativeTarget "wolfssl_testsuite" */;
+			buildPhases = (
+				A4F318F41BC58B8100FDF2BB /* Sources */,
+				A4F318F51BC58B8100FDF2BB /* Frameworks */,
+				A4F318F61BC58B8100FDF2BB /* CopyFiles */,
+			);
+			buildRules = (
+			);
+			dependencies = (
+			);
+			name = wolfssl_testsuite;
+			productName = wolfssl_testsuite;
+			productReference = A4F318F81BC58B8100FDF2BB /* wolfssl_testsuite */;
+			productType = "com.apple.product-type.tool";
+		};
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+		A4F318F01BC58B8100FDF2BB /* Project object */ = {
+			isa = PBXProject;
+			attributes = {
+				LastUpgradeCheck = 0700;
+				ORGANIZATIONNAME = WolfSSL;
+				TargetAttributes = {
+					A4F318F71BC58B8100FDF2BB = {
+						CreatedOnToolsVersion = 7.0.1;
+					};
+				};
+			};
+			buildConfigurationList = A4F318F31BC58B8100FDF2BB /* Build configuration list for PBXProject "wolfssl_testsuite" */;
+			compatibilityVersion = "Xcode 3.2";
+			developmentRegion = English;
+			hasScannedForEncodings = 0;
+			knownRegions = (
+				en,
+			);
+			mainGroup = A4F318EF1BC58B8100FDF2BB;
+			productRefGroup = A4F318F91BC58B8100FDF2BB /* Products */;
+			projectDirPath = "";
+			projectRoot = "";
+			targets = (
+				A4F318F71BC58B8100FDF2BB /* wolfssl_testsuite */,
+			);
+		};
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+		A4F318F41BC58B8100FDF2BB /* Sources */ = {
+			isa = PBXSourcesBuildPhase;
+			buildActionMask = 2147483647;
+			files = (
+				A45EA6DF1BC5922C00A8614A /* client.c in Sources */,
+				A45EA6E31BC5922C00A8614A /* echoclient.c in Sources */,
+				A4C7CBF51BC58BD600E591AE /* testsuite.c in Sources */,
+				A45EA6FD1BC5929500A8614A /* test.c in Sources */,
+				A45EA6E91BC5922C00A8614A /* server.c in Sources */,
+				A45EA6E61BC5922C00A8614A /* echoserver.c in Sources */,
+			);
+			runOnlyForDeploymentPostprocessing = 0;
+		};
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+		A4F318FD1BC58B8100FDF2BB /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = dwarf;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				ENABLE_TESTABILITY = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_DYNAMIC_NO_PIC = NO;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"DEBUG=1",
+					"$(inherited)",
+				);
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MTL_ENABLE_DEBUG_INFO = YES;
+				ONLY_ACTIVE_ARCH = YES;
+				SDKROOT = macosx;
+			};
+			name = Debug;
+		};
+		A4F318FE1BC58B8100FDF2BB /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				ALWAYS_SEARCH_USER_PATHS = NO;
+				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+				CLANG_CXX_LIBRARY = "libc++";
+				CLANG_ENABLE_MODULES = YES;
+				CLANG_ENABLE_OBJC_ARC = YES;
+				CLANG_WARN_BOOL_CONVERSION = YES;
+				CLANG_WARN_CONSTANT_CONVERSION = YES;
+				CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+				CLANG_WARN_EMPTY_BODY = YES;
+				CLANG_WARN_ENUM_CONVERSION = YES;
+				CLANG_WARN_INT_CONVERSION = YES;
+				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+				CLANG_WARN_UNREACHABLE_CODE = YES;
+				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+				COPY_PHASE_STRIP = NO;
+				DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+				ENABLE_NS_ASSERTIONS = NO;
+				ENABLE_STRICT_OBJC_MSGSEND = YES;
+				GCC_C_LANGUAGE_STANDARD = gnu99;
+				GCC_NO_COMMON_BLOCKS = YES;
+				GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+				GCC_WARN_UNDECLARED_SELECTOR = YES;
+				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+				GCC_WARN_UNUSED_FUNCTION = YES;
+				GCC_WARN_UNUSED_VARIABLE = YES;
+				MTL_ENABLE_DEBUG_INFO = NO;
+				SDKROOT = macosx;
+			};
+			name = Release;
+		};
+		A4F319001BC58B8100FDF2BB /* Debug */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					"$(inherited)",
+					NO_MAIN_DRIVER,
+					WOLFSSL_USER_SETTINGS,
+				);
+				HEADER_SEARCH_PATHS = (
+					$SRCROOT,
+					$PROJECT_DIR/../..,
+				);
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(PROJECT_DIR)/Build/Products",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Debug;
+		};
+		A4F319011BC58B8100FDF2BB /* Release */ = {
+			isa = XCBuildConfiguration;
+			buildSettings = {
+				GCC_PREPROCESSOR_DEFINITIONS = (
+					NO_MAIN_DRIVER,
+					WOLFSSL_USER_SETTINGS,
+				);
+				HEADER_SEARCH_PATHS = (
+					$SRCROOT,
+					$PROJECT_DIR/../..,
+				);
+				LIBRARY_SEARCH_PATHS = (
+					"$(inherited)",
+					"$(PROJECT_DIR)/Build/Products",
+				);
+				PRODUCT_NAME = "$(TARGET_NAME)";
+			};
+			name = Release;
+		};
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+		A4F318F31BC58B8100FDF2BB /* Build configuration list for PBXProject "wolfssl_testsuite" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				A4F318FD1BC58B8100FDF2BB /* Debug */,
+				A4F318FE1BC58B8100FDF2BB /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+		A4F318FF1BC58B8100FDF2BB /* Build configuration list for PBXNativeTarget "wolfssl_testsuite" */ = {
+			isa = XCConfigurationList;
+			buildConfigurations = (
+				A4F319001BC58B8100FDF2BB /* Debug */,
+				A4F319011BC58B8100FDF2BB /* Release */,
+			);
+			defaultConfigurationIsVisible = 0;
+			defaultConfigurationName = Release;
+		};
+/* End XCConfigurationList section */
+	};
+	rootObject = A4F318F01BC58B8100FDF2BB /* Project object */;
+}
diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c
index 9f256c2c5..61d7e77bf 100644
--- a/testsuite/testsuite.c
+++ b/testsuite/testsuite.c
@@ -53,6 +53,23 @@ static const char *outputName;
 int myoptind = 0;
 char* myoptarg = NULL;
 
+// This function changes the current directory to the wolfssl root
+static void ChangeDirToRoot(void)
+{
+	/* Normal Command Line=_build, Visual Studio=testsuite */
+	if (CurrentDir("testsuite") || CurrentDir("_build")) {
+		ChangeDirBack(1);
+	}
+	
+	/* Xcode: To output application to correct location: */
+	/* 1. Xcode->Preferences->Locations->Locations */
+	/* 2. Derived Data Advanced -> Custom */
+	/* 3. Relative to Workspace, Build/Products */
+	/* Build/Products/Debug or Build/Products/Release */
+	else if (CurrentDir("Debug") || CurrentDir("Release")) {
+		ChangeDirBack(5);
+	}
+}
 
 #ifndef NO_TESTSUITE_MAIN_DRIVER
 
@@ -100,13 +117,7 @@ int testsuite_test(int argc, char** argv)
 #endif
 
 #if !defined(WOLFSSL_TIRTOS)
-    if (CurrentDir("testsuite") || CurrentDir("_build"))
-        ChangeDirBack(1);
-    else if (CurrentDir("Debug") || CurrentDir("Release"))
-        ChangeDirBack(3);          /* Xcode->Preferences->Locations->Locations*/
-                                   /* Derived Data Advanced -> Custom  */
-                                   /* Relative to Workspace, Build/Products */
-                                   /* Debug or Release */
+	ChangeDirToRoot();
 #endif
 
 #ifdef WOLFSSL_TIRTOS
@@ -419,13 +430,7 @@ int main(int argc, char** argv)
     server_args.argc = argc;
     server_args.argv = argv;
 
-    if (CurrentDir("testsuite") || CurrentDir("_build"))
-        ChangeDirBack(1);
-    else if (CurrentDir("Debug") || CurrentDir("Release"))
-        ChangeDirBack(3);          /* Xcode->Preferences->Locations->Locations*/
-                                   /* Derived Data Advanced -> Custom  */
-                                   /* Relative to Workspace, Build/Products */
-                                   /* Debug or Release */
+    ChangeDirToRoot();
 
     wolfcrypt_test(&server_args);
     if (server_args.return_code != 0) return server_args.return_code;
diff --git a/wolfssl/test.h b/wolfssl/test.h
index f6b25819f..bb37ac9df 100644
--- a/wolfssl/test.h
+++ b/wolfssl/test.h
@@ -1099,20 +1099,13 @@ static INLINE int OpenNitroxDevice(int dma_mode,int dev_id)
 /* do back x number of directories */
 static INLINE void ChangeDirBack(int x)
 {
-    char path[MAX_PATH];
-
-    if (x == 1)
-        strncpy(path, "..\\", MAX_PATH);
-    else if (x == 2)
-        strncpy(path, "..\\..\\", MAX_PATH);
-    else if (x == 3)
-        strncpy(path, "..\\..\\..\\", MAX_PATH);
-    else if (x == 4)
-        strncpy(path, "..\\..\\..\\..\\", MAX_PATH);
-    else
-        strncpy(path, ".\\", MAX_PATH);
-    
-    SetCurrentDirectoryA(path);
+	char path[MAX_PATH];
+	XMEMSET(path, 0, MAX_PATH);
+	XSTRNCAT(path, ".\\", MAX_PATH);
+	while (x-- > 0) {
+		XSTRNCAT(path, "..\\", MAX_PATH);
+	}
+	SetCurrentDirectoryA(path);
 }
 
 /* does current dir contain str */
@@ -1148,20 +1141,14 @@ static INLINE int CurrentDir(const char* str)
 static INLINE void ChangeDirBack(int x)
 {
     char path[MAX_PATH];
-
-    if (x == 1)
-        strncpy(path, "../", MAX_PATH);
-    else if (x == 2)
-        strncpy(path, "../../", MAX_PATH);
-    else if (x == 3)
-        strncpy(path, "../../../", MAX_PATH);
-    else if (x == 4)
-        strncpy(path, "../../../../", MAX_PATH);
-    else
-        strncpy(path, "./", MAX_PATH);
-    
-    if (chdir(path) < 0)
-        printf("chdir to %s failed\n", path);
+	XMEMSET(path, 0, MAX_PATH);
+	XSTRNCAT(path, "./", MAX_PATH);
+	while (x-- > 0) {
+        XSTRNCAT(path, "../", MAX_PATH);
+	}
+	if (chdir(path) < 0) {
+		printf("chdir to %s failed\n", path);
+	}
 }
 
 /* does current dir contain str */

From 91e7d433f81f629a585419fa9825f3b792003975 Mon Sep 17 00:00:00 2001
From: kaleb-himes 
Date: Fri, 9 Oct 2015 09:20:10 -0600
Subject: [PATCH 51/77] expected_configure test fixes. Squash for review.

fix for --enable-certservice --disable-md5

fix for --disable-md5 --enable-fortress

update macros to reflect referencing code logic for --disable-asn fix
---
 src/internal.c | 4 ++++
 src/ssl.c      | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/internal.c b/src/internal.c
index 5c9ede255..e8309dc69 100644
--- a/src/internal.c
+++ b/src/internal.c
@@ -2679,6 +2679,7 @@ ProtocolVersion MakeDTLSv1_2(void)
 #endif /* USE_WINDOWS_API */
 
 
+#ifndef NO_CERTS
 static int HashOutputRaw(WOLFSSL* ssl, const byte* output, int sz)
 {
 #ifdef HAVE_FUZZER
@@ -2716,6 +2717,7 @@ static int HashOutputRaw(WOLFSSL* ssl, const byte* output, int sz)
 
     return 0;
 }
+#endif /* NO_CERTS */
 
 
 /* add output to md5 and sha handshake hashes, exclude record header */
@@ -2886,6 +2888,7 @@ static void AddHeaders(byte* output, word32 length, byte type, WOLFSSL* ssl)
 }
 
 
+#ifndef NO_CERTS
 static void AddFragHeaders(byte* output, word32 fragSz, word32 fragOffset,
                            word32 length, byte type, WOLFSSL* ssl)
 {
@@ -2903,6 +2906,7 @@ static void AddFragHeaders(byte* output, word32 fragSz, word32 fragOffset,
     AddRecordHeader(output, fragSz + lengthAdj, handshake, ssl);
     AddHandShakeHeader(output + outputAdj, length, fragOffset, fragSz, type, ssl);
 }
+#endif /* NO_CERTS */
 
 
 /* return bytes received, -1 on error */
diff --git a/src/ssl.c b/src/ssl.c
index fdbe8ce5d..501b492ea 100644
--- a/src/ssl.c
+++ b/src/ssl.c
@@ -2279,7 +2279,8 @@ static int wolfssl_decrypt_buffer_key(buffer* der, byte* password,
 #endif
         return SSL_FATAL_ERROR;
     }
-
+#else
+    (void) passwordSz;
 #endif /* NO_MD5 */
 
 #ifndef NO_DES3
@@ -2355,7 +2356,8 @@ static int wolfssl_encrypt_buffer_key(byte* der, word32 derSz, byte* password,
 #endif
         return SSL_FATAL_ERROR;
     }
-
+#else
+    (void) passwordSz;
 #endif /* NO_MD5 */
 
 #ifndef NO_DES3

From 7364884a69a08cec12afa0a92183a649c7530aa8 Mon Sep 17 00:00:00 2001
From: kaleb-himes 
Date: Fri, 9 Oct 2015 22:04:41 -0600
Subject: [PATCH 52/77] Modified scope for ChangeDirToRoot

---
 testsuite/testsuite.c | 37 +++++++++++++++++++------------------
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c
index 61d7e77bf..c0304e324 100644
--- a/testsuite/testsuite.c
+++ b/testsuite/testsuite.c
@@ -29,6 +29,25 @@
 #include 
 #include "wolfcrypt/test/test.h"
 
+/* This function changes the current directory to the wolfssl root */
+static void ChangeDirToRoot(void)
+{
+    /* Normal Command Line=_build, Visual Studio=testsuite */
+    if (CurrentDir("testsuite") || CurrentDir("_build")) {
+        ChangeDirBack(1);
+    }
+
+    /* Xcode: To output application to correct location: */
+    /* 1. Xcode->Preferences->Locations->Locations */
+    /* 2. Derived Data Advanced -> Custom */
+    /* 3. Relative to Workspace, Build/Products */
+    /* Build/Products/Debug or Build/Products/Release */
+    else if (CurrentDir("Debug") || CurrentDir("Release")) {
+    ChangeDirBack(5);
+    }
+}
+
+
 #ifndef SINGLE_THREADED
 
 #include 
@@ -53,24 +72,6 @@ static const char *outputName;
 int myoptind = 0;
 char* myoptarg = NULL;
 
-// This function changes the current directory to the wolfssl root
-static void ChangeDirToRoot(void)
-{
-	/* Normal Command Line=_build, Visual Studio=testsuite */
-	if (CurrentDir("testsuite") || CurrentDir("_build")) {
-		ChangeDirBack(1);
-	}
-	
-	/* Xcode: To output application to correct location: */
-	/* 1. Xcode->Preferences->Locations->Locations */
-	/* 2. Derived Data Advanced -> Custom */
-	/* 3. Relative to Workspace, Build/Products */
-	/* Build/Products/Debug or Build/Products/Release */
-	else if (CurrentDir("Debug") || CurrentDir("Release")) {
-		ChangeDirBack(5);
-	}
-}
-
 #ifndef NO_TESTSUITE_MAIN_DRIVER
 
     static int testsuite_test(int argc, char** argv);

From 2840fb47ef95eb2f91125470fd4541bfa8bd19e0 Mon Sep 17 00:00:00 2001
From: John Safranek 
Date: Sun, 11 Oct 2015 21:32:13 -0700
Subject: [PATCH 53/77] fix bounds check of handshake messages in TLS

---
 src/internal.c | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/src/internal.c b/src/internal.c
index 45f05b0f1..14c77f86f 100644
--- a/src/internal.c
+++ b/src/internal.c
@@ -5268,9 +5268,12 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx,
                           word32 totalSz)
 {
     int    ret = 0;
+    word32 inputLength;
 
     WOLFSSL_ENTER("DoHandShakeMsg()");
 
+    inputLength = ssl->buffers.inputBuffer.length - *inOutIdx;
+
     /* If there is a pending fragmented handshake message,
      * pending message size will be non-zero. */
     if (ssl->arrays->pendingMsgSz == 0) {
@@ -5289,7 +5292,7 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx,
         }
 
         /* size is the size of the certificate message payload */
-        if (ssl->curSize < size) {
+        if (inputLength - HANDSHAKE_HEADER_SZ < size) {
             ssl->arrays->pendingMsgType = type;
             ssl->arrays->pendingMsgSz = size + HANDSHAKE_HEADER_SZ;
             ssl->arrays->pendingMsg = (byte*)XMALLOC(size + HANDSHAKE_HEADER_SZ,
@@ -5298,25 +5301,26 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx,
             if (ssl->arrays->pendingMsg == NULL)
                 return MEMORY_E;
             XMEMCPY(ssl->arrays->pendingMsg,
-                    input + *inOutIdx - HANDSHAKE_HEADER_SZ, ssl->curSize);
-            ssl->arrays->pendingMsgOffset = ssl->curSize;
-            *inOutIdx += ssl->curSize - HANDSHAKE_HEADER_SZ;
+                    input + *inOutIdx - HANDSHAKE_HEADER_SZ,
+                    inputLength);
+            ssl->arrays->pendingMsgOffset = inputLength;
+            *inOutIdx += inputLength - HANDSHAKE_HEADER_SZ;
             return 0;
         }
 
         ret = DoHandShakeMsgType(ssl, input, inOutIdx, type, size, totalSz);
     }
     else {
-        if (ssl->curSize + ssl->arrays->pendingMsgOffset
+        if (inputLength + ssl->arrays->pendingMsgOffset
                                                   > ssl->arrays->pendingMsgSz) {
 
             return BUFFER_ERROR;
         }
         else {
             XMEMCPY(ssl->arrays->pendingMsg + ssl->arrays->pendingMsgOffset,
-                    input + *inOutIdx, ssl->curSize);
-            ssl->arrays->pendingMsgOffset += ssl->curSize;
-            *inOutIdx += ssl->curSize;
+                    input + *inOutIdx, inputLength);
+            ssl->arrays->pendingMsgOffset += inputLength;
+            *inOutIdx += inputLength;
         }
 
         if (ssl->arrays->pendingMsgOffset == ssl->arrays->pendingMsgSz)

From c7264ff6d759df579cdeb75bc34b199ade530323 Mon Sep 17 00:00:00 2001
From: Jacob Barthelmeh 
Date: Mon, 12 Oct 2015 09:25:54 -0600
Subject: [PATCH 54/77] enable ecc with stunnel

---
 configure.ac | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure.ac b/configure.ac
index bbf5205f9..198c8e77d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1888,6 +1888,7 @@ then
     if test "x$ENABLED_ECC" = "xno"
     then
         ENABLED_OPENSSLEXTRA="yes"
+        ENABLED_ECC="yes"
         AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DECC_SHAMIR"
         AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"])
     fi

From 10f51543896a15cbab08ef5479397260fe7d03dd Mon Sep 17 00:00:00 2001
From: Ludovic FLAMENT 
Date: Tue, 13 Oct 2015 09:38:40 +0200
Subject: [PATCH 55/77] ALPN : add option to continue in case of client/server
 protocol mismatch (like OpenSSL)

---
 examples/client/client.c | 48 +++++++++++++++++++-------
 examples/server/server.c | 31 +++++++++++++----
 src/ssl.c                | 13 +++++--
 src/tls.c                | 45 ++++++++++++++++++++----
 tests/api.c              | 74 +++++++++++++++++++++++++++++-----------
 wolfssl/internal.h       |  6 +++-
 wolfssl/ssl.h            |  8 +++--
 7 files changed, 173 insertions(+), 52 deletions(-)

diff --git a/examples/client/client.c b/examples/client/client.c
index 3f8d232df..1c665613f 100644
--- a/examples/client/client.c
+++ b/examples/client/client.c
@@ -194,7 +194,7 @@ static void Usage(void)
     printf("-C          Disable CRL\n");
 #endif
 #ifdef HAVE_ALPN
-    printf("-n    Application-Layer Protocole Name\n");
+    printf("-n    Application-Layer Protocole Name ({C,F}:)\n");
 #endif
 }
 
@@ -247,6 +247,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
     int    overrideDateErrors = 0;
     int    minDhKeyBits  = DEFAULT_MIN_DHKEY_BITS;
     char*  alpnList = NULL;
+    unsigned char alpn_opt = 0;
     char*  cipherList = NULL;
     const char* verifyCert = caCert;
     const char* ourCert    = cliCert;
@@ -294,6 +295,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
     (void)disableCRL;
     (void)minDhKeyBits;
     (void)alpnList;
+    (void)alpn_opt;
 
     StackTrap();
 
@@ -500,6 +502,18 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
             case 'n' :
                 #ifdef HAVE_ALPN
                     alpnList = myoptarg;
+
+                    if (alpnList[0] == 'C' && alpnList[1] == ':')
+                        alpn_opt = WOLFSSL_ALPN_CONTINUE_ON_MISMATCH;
+                    else if (alpnList[0] == 'F' && alpnList[1] == ':')
+                        alpn_opt = WOLFSSL_ALPN_FAILED_ON_MISMATCH;
+                    else {
+                        Usage();
+                        exit(MY_EX_USAGE);
+                    }
+
+                    alpnList += 2;
+
                 #endif
                 break;
 
@@ -812,7 +826,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
 #ifdef HAVE_ALPN
     if (alpnList != NULL) {
        printf("ALPN accepted protocols list : %s\n", alpnList);
-        wolfSSL_UseALPN(ssl, alpnList, (word32)XSTRLEN(alpnList));
+       wolfSSL_UseALPN(ssl, alpnList, (word32)XSTRLEN(alpnList), alpn_opt);
     }
 #endif
 
@@ -885,16 +899,19 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
     showPeer(ssl);
 
 #ifdef HAVE_ALPN
-    {
+    if (alpnList != NULL) {
+        int err;
         char *protocol_name = NULL;
         word16 protocol_nameSz = 0;
 
-        if (wolfSSL_ALPN_GetProtocol(ssl, &protocol_name,
-                                     &protocol_nameSz) != SSL_SUCCESS)
-            printf("Getting ALPN protocol name failed\n");
-        else
+        err = wolfSSL_ALPN_GetProtocol(ssl, &protocol_name, &protocol_nameSz);
+        if (err == SSL_SUCCESS)
             printf("Received ALPN protocol : %s (%d)\n",
                    protocol_name, protocol_nameSz);
+        else if (err == SSL_ALPN_NOT_FOUND)
+            printf("Not received ALPN response (no match with server)\n");
+        else
+            printf("Getting ALPN protocol name failed\n");
     }
 #endif
 
@@ -988,7 +1005,8 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
 #ifdef HAVE_ALPN
         if (alpnList != NULL) {
             printf("ALPN accepted protocols list : %s\n", alpnList);
-            wolfSSL_UseALPN(sslResume, alpnList, (word32)XSTRLEN(alpnList));
+            wolfSSL_UseALPN(sslResume, alpnList, (word32)XSTRLEN(alpnList),
+                            alpn_opt);
         }
 #endif
 #ifdef HAVE_SECURE_RENEGOTIATION
@@ -1024,17 +1042,21 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
             printf("didn't reuse session id!!!\n");
 
 #ifdef HAVE_ALPN
-        {
+        if (alpnList != NULL) {
+            int err;
             char *protocol_name = NULL;
             word16 protocol_nameSz = 0;
 
             printf("Sending ALPN accepted list : %s\n", alpnList);
-            if (wolfSSL_ALPN_GetProtocol(sslResume, &protocol_name,
-                                         &protocol_nameSz) != SSL_SUCCESS)
-                printf("Getting ALPN protocol name failed\n");
-            else
+            err = wolfSSL_ALPN_GetProtocol(sslResume, &protocol_name,
+                                           &protocol_nameSz);
+            if (err == SSL_SUCCESS)
                 printf("Received ALPN protocol : %s (%d)\n",
                        protocol_name, protocol_nameSz);
+            else if (err == SSL_ALPN_NOT_FOUND)
+                printf("Not received ALPN response (no match with server)\n");
+            else
+                printf("Getting ALPN protocol name failed\n");
         }
 #endif
         if (wolfSSL_write(sslResume, resumeMsg, resumeSz) != resumeSz)
diff --git a/examples/server/server.c b/examples/server/server.c
index b2e90ad31..6ef02412d 100644
--- a/examples/server/server.c
+++ b/examples/server/server.c
@@ -162,7 +162,7 @@ static void Usage(void)
     printf("-I          Do not send PSK identity hint\n");
 #endif
 #ifdef HAVE_ALPN
-    printf("-L    Application-Layer Protocole Name\n");
+    printf("-L    Application-Layer Protocole Name ({C,F}:)\n");
 #endif
 }
 
@@ -198,6 +198,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
     int    minDhKeyBits = DEFAULT_MIN_DHKEY_BITS;
     int    ret;
     char*  alpnList = NULL;
+    unsigned char alpn_opt = 0;
     char*  cipherList = NULL;
     const char* verifyCert = cliCert;
     const char* ourCert    = svrCert;
@@ -237,6 +238,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
     (void)doCliCertCheck;
     (void)minDhKeyBits;
     (void)alpnList;
+    (void)alpn_opt;
 
 #ifdef CYASSL_TIRTOS
     fdOpenSession(Task_self());
@@ -384,6 +386,18 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
             case 'L' :
                 #ifdef HAVE_ALPN
                     alpnList = myoptarg;
+
+                    if (alpnList[0] == 'C' && alpnList[1] == ':')
+                        alpn_opt = WOLFSSL_ALPN_CONTINUE_ON_MISMATCH;
+                    else if (alpnList[0] == 'F' && alpnList[1] == ':')
+                        alpn_opt = WOLFSSL_ALPN_FAILED_ON_MISMATCH;
+                    else {
+                        Usage();
+                        exit(MY_EX_USAGE);
+                    }
+
+                    alpnList += 2;
+
                 #endif
                 break;
             default:
@@ -636,7 +650,7 @@ while (1) {  /* allow resume option */
 #ifdef HAVE_ALPN
     if (alpnList != NULL) {
         printf("ALPN accepted protocols list : %s\n", alpnList);
-        wolfSSL_UseALPN(ssl, alpnList, (word32)XSTRLEN(alpnList));
+        wolfSSL_UseALPN(ssl, alpnList, (word32)XSTRLEN(alpnList), alpn_opt);
     }
 #endif
 
@@ -683,16 +697,19 @@ while (1) {  /* allow resume option */
     showPeer(ssl);
 
 #ifdef HAVE_ALPN
-    {
+    if (alpnList != NULL) {
+        int err;
         char *protocol_name = NULL;
         word16 protocol_nameSz = 0;
 
-        if (wolfSSL_ALPN_GetProtocol(ssl, &protocol_name,
-                                     &protocol_nameSz) != SSL_SUCCESS)
-            printf("Getting ALPN protocol name failed\n");
-        else
+        err = wolfSSL_ALPN_GetProtocol(ssl, &protocol_name, &protocol_nameSz);
+        if (err == SSL_SUCCESS)
             printf("Send ALPN protocol : %s (%d)\n",
                    protocol_name, protocol_nameSz);
+        else if (err == SSL_ALPN_NOT_FOUND)
+            printf("Not send ALPN response (no match with server)\n");
+        else
+            printf("Getting ALPN protocol name failed\n");
     }
 #endif
 
diff --git a/src/ssl.c b/src/ssl.c
index dfd5696ab..6410aa3d0 100644
--- a/src/ssl.c
+++ b/src/ssl.c
@@ -889,7 +889,7 @@ int wolfSSL_UseSupportedQSH(WOLFSSL* ssl, word16 name)
 #ifdef HAVE_ALPN
 
 int wolfSSL_UseALPN(WOLFSSL* ssl, char *protocol_name_list,
-                    word32 protocol_name_listSz)
+                    word32 protocol_name_listSz, byte options)
 {
     char    *list, *ptr, *token[10];
     word16  len;
@@ -904,10 +904,17 @@ int wolfSSL_UseALPN(WOLFSSL* ssl, char *protocol_name_list,
     if (protocol_name_listSz > (WOLFSSL_MAX_ALPN_NUMBER *
                                 WOLFSSL_MAX_ALPN_PROTO_NAME_LEN +
                                 WOLFSSL_MAX_ALPN_NUMBER)) {
-        WOLFSSL_MSG("Invalid arguments, procolt name list too long");
+        WOLFSSL_MSG("Invalid arguments, protocol name list too long");
         return BAD_FUNC_ARG;
     }
 
+    if (!(options & WOLFSSL_ALPN_CONTINUE_ON_MISMATCH) &&
+        !(options & WOLFSSL_ALPN_FAILED_ON_MISMATCH)) {
+            WOLFSSL_MSG("Invalid arguments, options not supported");
+            return BAD_FUNC_ARG;
+        }
+
+
     list = (char *)XMALLOC(protocol_name_listSz+1, NULL,
                            DYNAMIC_TYPE_TMP_BUFFER);
     if (list == NULL) {
@@ -927,7 +934,7 @@ int wolfSSL_UseALPN(WOLFSSL* ssl, char *protocol_name_list,
     while ((idx--) > 0) {
         len = (word16)XSTRLEN(token[idx]);
 
-        ret = TLSX_UseALPN(&ssl->extensions, token[idx], len);
+        ret = TLSX_UseALPN(&ssl->extensions, token[idx], len, options);
         if (ret != SSL_SUCCESS) {
             WOLFSSL_MSG("TLSX_UseALPN failure");
             break;
diff --git a/src/tls.c b/src/tls.c
index 5eca631e1..cece0696c 100644
--- a/src/tls.c
+++ b/src/tls.c
@@ -867,6 +867,8 @@ static ALPN* TLSX_ALPN_New(char *protocol_name, word16 protocol_nameSz)
     }
 
     alpn->next = NULL;
+    alpn->negociated = 0;
+    alpn->options = 0;
 
     alpn->protocol_name = XMALLOC(protocol_nameSz + 1, 0, DYNAMIC_TYPE_TLSX);
     if (alpn->protocol_name == NULL) {
@@ -977,6 +979,8 @@ static int TLSX_SetALPN(TLSX** extensions, const void* data, word16 size)
         return MEMORY_E;
     }
 
+    alpn->negociated = 1;
+
     ret = TLSX_Push(extensions, WOLFSSL_ALPN, (void*)alpn);
     if (ret != 0) {
         TLSX_ALPN_Free(alpn);
@@ -995,7 +999,7 @@ static int TLSX_ALPN_ParseAndSet(WOLFSSL *ssl, byte *input, word16 length,
     word16 offset = 0;
     int    r = BUFFER_ERROR;
     TLSX   *extension;
-    ALPN   *alpn = NULL;
+    ALPN   *alpn = NULL, *list;
 
     extension = TLSX_Find(ssl->extensions, WOLFSSL_ALPN);
     if (extension == NULL)
@@ -1017,14 +1021,15 @@ static int TLSX_ALPN_ParseAndSet(WOLFSSL *ssl, byte *input, word16 length,
     if (length != OPAQUE16_LEN + size)
         return BUFFER_ERROR;
 
+    list = (ALPN*)extension->data;
+
     for (size = 0; offset < length; offset += size) {
 
         size = input[offset++];
         if (offset + size > length)
             return BUFFER_ERROR;
 
-        alpn = TLSX_ALPN_Find((ALPN*)extension->data,
-                              (char*)input + offset, size);
+        alpn = TLSX_ALPN_Find(list, (char*)input + offset, size);
         if (alpn != NULL) {
             WOLFSSL_MSG("ALPN protocol match");
             break;
@@ -1034,13 +1039,21 @@ static int TLSX_ALPN_ParseAndSet(WOLFSSL *ssl, byte *input, word16 length,
     if (alpn == NULL) {
         WOLFSSL_MSG("No ALPN protocol match");
 
+        /* do nothing if no protocol match between client and server and option
+         is set to continue (like OpenSSL) */
+        if (list->options & WOLFSSL_ALPN_CONTINUE_ON_MISMATCH) {
+            WOLFSSL_MSG("Continue on mismatch");
+            return 0;
+        }
+
         SendAlert(ssl, alert_fatal, no_application_protocol);
         return UNKNOWN_ALPN_PROTOCOL_NAME_E;
     }
 
     /* set the matching negociated protocol */
     r = TLSX_SetALPN(&ssl->extensions,
-                     alpn->protocol_name, (word16)XSTRLEN(alpn->protocol_name));
+                     alpn->protocol_name,
+                     (word16)XSTRLEN(alpn->protocol_name));
     if (r != SSL_SUCCESS) {
         WOLFSSL_MSG("TLSX_UseALPN failed");
         return BUFFER_ERROR;
@@ -1057,7 +1070,7 @@ static int TLSX_ALPN_ParseAndSet(WOLFSSL *ssl, byte *input, word16 length,
 }
 
 /** Add a protocol name to the list of accepted usable ones */
-int TLSX_UseALPN(TLSX** extensions, const void* data, word16 size)
+int TLSX_UseALPN(TLSX** extensions, const void* data, word16 size, byte options)
 {
     ALPN *alpn;
     TLSX *extension;
@@ -1072,6 +1085,9 @@ int TLSX_UseALPN(TLSX** extensions, const void* data, word16 size)
         return MEMORY_E;
     }
 
+    /* Set Options of ALPN */
+    alpn->options = options;
+
     extension = TLSX_Find(*extensions, WOLFSSL_ALPN);
     if (extension == NULL) {
         ret = TLSX_Push(extensions, WOLFSSL_ALPN, (void*)alpn);
@@ -1101,13 +1117,28 @@ int TLSX_ALPN_GetRequest(TLSX* extensions, void** data, word16 *dataSz)
     extension = TLSX_Find(extensions, WOLFSSL_ALPN);
     if (extension == NULL) {
         WOLFSSL_MSG("TLS extension not found");
-        return SSL_FATAL_ERROR;
+        return SSL_ALPN_NOT_FOUND;
     }
 
     alpn = (ALPN *)extension->data;
     if (alpn == NULL) {
         WOLFSSL_MSG("ALPN extension not found");
-        return WOLFSSL_ALPN_NO_MATCH;
+        *data = NULL;
+        *dataSz = 0;
+        return SSL_FATAL_ERROR;
+    }
+
+    if (alpn->negociated != 1) {
+
+        /* consider as an error */
+        if (alpn->options & WOLFSSL_ALPN_FAILED_ON_MISMATCH) {
+            WOLFSSL_MSG("No protocol match with peer -> Failed");
+            return SSL_FATAL_ERROR;
+        }
+
+        /* continue without negociated protocol */
+        WOLFSSL_MSG("No protocol match with peer -> Continue");
+        return SSL_ALPN_NOT_FOUND;
     }
 
     if (alpn->next != NULL) {
diff --git a/tests/api.c b/tests/api.c
index 000c7d92d..8feb84a39 100644
--- a/tests/api.c
+++ b/tests/api.c
@@ -1215,7 +1215,19 @@ static void use_ALPN_all(WOLFSSL* ssl)
                         0x73, 0x70, 0x64, 0x79, 0x2f, 0x31, 0x2c,
                         0x73, 0x70, 0x64, 0x79, 0x2f, 0x32, 0x2c,
                         0x73, 0x70, 0x64, 0x79, 0x2f, 0x33};
-    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, alpn_list, sizeof(alpn_list)));
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, alpn_list, sizeof(alpn_list),
+                                             WOLFSSL_ALPN_FAILED_ON_MISMATCH));
+}
+
+static void use_ALPN_all_continue(WOLFSSL* ssl)
+{
+    /* http/1.1,spdy/1,spdy/2,spdy/3 */
+    char alpn_list[] = {0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31, 0x2c,
+        0x73, 0x70, 0x64, 0x79, 0x2f, 0x31, 0x2c,
+        0x73, 0x70, 0x64, 0x79, 0x2f, 0x32, 0x2c,
+        0x73, 0x70, 0x64, 0x79, 0x2f, 0x33};
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, alpn_list, sizeof(alpn_list),
+                                             WOLFSSL_ALPN_CONTINUE_ON_MISMATCH));
 }
 
 static void use_ALPN_one(WOLFSSL* ssl)
@@ -1223,7 +1235,8 @@ static void use_ALPN_one(WOLFSSL* ssl)
     /* spdy/2 */
     char proto[] = {0x73, 0x70, 0x64, 0x79, 0x2f, 0x32};
 
-    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, proto, sizeof(proto)));
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, proto, sizeof(proto),
+                                             WOLFSSL_ALPN_FAILED_ON_MISMATCH));
 }
 
 static void use_ALPN_unknown(WOLFSSL* ssl)
@@ -1231,7 +1244,17 @@ static void use_ALPN_unknown(WOLFSSL* ssl)
     /* http/2.0 */
     char proto[] = {0x68, 0x74, 0x74, 0x70, 0x2f, 0x32, 0x2e, 0x30};
 
-    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, proto, sizeof(proto)));
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, proto, sizeof(proto),
+                                             WOLFSSL_ALPN_FAILED_ON_MISMATCH));
+}
+
+static void use_ALPN_unknown_continue(WOLFSSL* ssl)
+{
+    /* http/2.0 */
+    char proto[] = {0x68, 0x74, 0x74, 0x70, 0x2f, 0x32, 0x2e, 0x30};
+
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, proto, sizeof(proto),
+                                             WOLFSSL_ALPN_CONTINUE_ON_MISMATCH));
 }
 
 static void verify_ALPN_not_matching_spdy3(WOLFSSL* ssl)
@@ -1242,9 +1265,6 @@ static void verify_ALPN_not_matching_spdy3(WOLFSSL* ssl)
     char *proto;
     word16 protoSz = 0;
 
-    printf("verify_ALPN_not_matching GetProtocol(ssl) = %d\n",
-           wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
-
     AssertIntEQ(SSL_SUCCESS, wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
 
     /* check value */
@@ -1252,6 +1272,19 @@ static void verify_ALPN_not_matching_spdy3(WOLFSSL* ssl)
     AssertIntNE(0, XMEMCMP(nego_proto, proto, sizeof(nego_proto)));
 }
 
+static void verify_ALPN_not_matching_continue(WOLFSSL* ssl)
+{
+    char *proto = NULL;
+    word16 protoSz = 0;
+
+    AssertIntEQ(SSL_ALPN_NOT_FOUND,
+                wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
+
+    /* check value */
+    AssertIntEQ(1, 0 == protoSz);
+    AssertIntEQ(1, NULL == proto);
+}
+
 static void verify_ALPN_matching_http1(WOLFSSL* ssl)
 {
     /* http/1.1 */
@@ -1259,9 +1292,6 @@ static void verify_ALPN_matching_http1(WOLFSSL* ssl)
     char *proto;
     word16 protoSz = 0;
 
-    printf("verify_ALPN_matching GetProtocol(ssl) = %d\n",
-           wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
-
     AssertIntEQ(SSL_SUCCESS, wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
 
     /* check value */
@@ -1276,9 +1306,6 @@ static void verify_ALPN_matching_spdy2(WOLFSSL* ssl)
     char *proto;
     word16 protoSz = 0;
 
-    printf("verify_ALPN_matching GetProtocol(ssl) = %d\n",
-           wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
-
     AssertIntEQ(SSL_SUCCESS, wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
 
     /* check value */
@@ -1286,7 +1313,6 @@ static void verify_ALPN_matching_spdy2(WOLFSSL* ssl)
     AssertIntEQ(0, XMEMCMP(nego_proto, proto, protoSz));
 }
 
-
 static void test_wolfSSL_UseALPN_connection(void)
 {
     unsigned long i;
@@ -1307,6 +1333,10 @@ static void test_wolfSSL_UseALPN_connection(void)
         {0, 0, 0, 0},
         {0, 0, use_ALPN_all, 0},
 
+        /* success case missmatch behavior but option 'continue' set */
+        {0, 0, use_ALPN_all_continue, verify_ALPN_not_matching_continue},
+        {0, 0, use_ALPN_unknown_continue, 0},
+
         /* missmatch behavior with same list
          * the first and only this one must be taken */
         {0, 0, use_ALPN_all, 0},
@@ -1345,13 +1375,16 @@ static void test_wolfSSL_UseALPN_params(void)
 
     /* error cases */
     AssertIntNE(SSL_SUCCESS,
-                wolfSSL_UseALPN(NULL, http1, sizeof(http1)));
-    AssertIntNE(SSL_SUCCESS, wolfSSL_UseALPN(ssl, NULL, 0));
+                wolfSSL_UseALPN(NULL, http1, sizeof(http1),
+                                WOLFSSL_ALPN_FAILED_ON_MISMATCH));
+    AssertIntNE(SSL_SUCCESS, wolfSSL_UseALPN(ssl, NULL, 0,
+                                             WOLFSSL_ALPN_FAILED_ON_MISMATCH));
 
     /* success case */
     /* http1 only */
     AssertIntEQ(SSL_SUCCESS,
-                wolfSSL_UseALPN(ssl, http1, sizeof(http1)));
+                wolfSSL_UseALPN(ssl, http1, sizeof(http1),
+                                WOLFSSL_ALPN_FAILED_ON_MISMATCH));
 
     /* http1, spdy1 */
     memcpy(buff, http1, sizeof(http1));
@@ -1359,7 +1392,8 @@ static void test_wolfSSL_UseALPN_params(void)
     buff[idx++] = ',';
     memcpy(buff+idx, spdy1, sizeof(spdy1));
     idx += sizeof(spdy1);
-    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, buff, idx));
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, buff, idx,
+                                             WOLFSSL_ALPN_FAILED_ON_MISMATCH));
 
     /* http1, spdy2, spdy1 */
     memcpy(buff, http1, sizeof(http1));
@@ -1370,7 +1404,8 @@ static void test_wolfSSL_UseALPN_params(void)
     buff[idx++] = ',';
     memcpy(buff+idx, spdy1, sizeof(spdy1));
     idx += sizeof(spdy1);
-    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, buff, idx));
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, buff, idx,
+                                             WOLFSSL_ALPN_FAILED_ON_MISMATCH));
 
     /* spdy3, http1, spdy2, spdy1 */
     memcpy(buff, spdy3, sizeof(spdy3));
@@ -1384,7 +1419,8 @@ static void test_wolfSSL_UseALPN_params(void)
     buff[idx++] = ',';
     memcpy(buff+idx, spdy1, sizeof(spdy1));
     idx += sizeof(spdy1);
-    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, buff, idx));
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, buff, idx,
+                                             WOLFSSL_ALPN_CONTINUE_ON_MISMATCH));
 
     wolfSSL_free(ssl);
     wolfSSL_CTX_free(ctx);
diff --git a/wolfssl/internal.h b/wolfssl/internal.h
index 511ba29dd..ec3a763a8 100644
--- a/wolfssl/internal.h
+++ b/wolfssl/internal.h
@@ -1540,13 +1540,17 @@ WOLFSSL_LOCAL int    TLSX_SNI_GetFromBuffer(const byte* buffer, word32 bufferSz,
 typedef struct ALPN {
     char*        protocol_name; /* ALPN protocol name */
     struct ALPN* next;          /* List Behavior      */
+    byte         options;       /* Behaviour options */
+    byte         negociated;    /* ALPN protocol negociated or not */
 } ALPN;
 
 WOLFSSL_LOCAL int TLSX_ALPN_GetRequest(TLSX* extensions,
                                        void** data, word16 *dataSz);
 
 WOLFSSL_LOCAL int TLSX_UseALPN(TLSX** extensions, const void* data,
-                               word16 size);
+                               word16 size, byte options);
+
+WOLFSSL_LOCAL int TLSX_ALPN_SetOptions(TLSX** extensions, const byte option);
 #endif /* HAVE_ALPN */
 
 /* Maximum Fragment Length */
diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h
index 14d13c663..b1a890e36 100644
--- a/wolfssl/ssl.h
+++ b/wolfssl/ssl.h
@@ -674,6 +674,7 @@ enum { /* ssl Constants */
     SSL_SUCCESS         =  1,
     SSL_SHUTDOWN_NOT_DONE =  2,  /* call wolfSSL_shutdown again to complete */
 
+    SSL_ALPN_NOT_FOUND  = -9,
     SSL_BAD_CERTTYPE    = -8,
     SSL_BAD_STAT        = -7,
     SSL_BAD_PATH        = -6,
@@ -1354,7 +1355,9 @@ WOLFSSL_API int wolfSSL_SNI_GetFromBuffer(
 /* ALPN status code */
 enum {
     WOLFSSL_ALPN_NO_MATCH = 0,
-    WOLFSSL_ALPN_MATCH    = 1
+    WOLFSSL_ALPN_MATCH    = 1,
+    WOLFSSL_ALPN_CONTINUE_ON_MISMATCH = 2,
+    WOLFSSL_ALPN_FAILED_ON_MISMATCH = 4,
 };
 
 enum {
@@ -1363,7 +1366,8 @@ enum {
 };
 
 WOLFSSL_API int wolfSSL_UseALPN(WOLFSSL* ssl, char *protocol_name_list,
-                                unsigned int protocol_name_listSz);
+                                unsigned int protocol_name_listSz,
+                                unsigned char options);
 
 WOLFSSL_API int wolfSSL_ALPN_GetProtocol(WOLFSSL* ssl, char **protocol_name,
                                          unsigned short *size);

From 67861bb222e8c127e3e8b23950d4d200a4af3f85 Mon Sep 17 00:00:00 2001
From: David Garske 
Date: Tue, 13 Oct 2015 12:36:24 -0700
Subject: [PATCH 56/77] Added crypto hardware mutex capabilities to
 wolfcrypt/wc_port. Added optional define "WOLFSSL_CRYPT_HW_MUTEX" to override
 use of hardware mutex. Enabled hardware mutex protection for Freescale MMCAU.
 Cleanup of the AES FREESCALE_MMCAU implementation to use
 wc_AesEncrypt/wc_AesDecrypt wrappers. Fixes #154.

---
 wolfcrypt/src/aes.c         | 227 ++++++++++--------------------------
 wolfcrypt/src/des3.c        |  32 ++++-
 wolfcrypt/src/md5.c         |  14 ++-
 wolfcrypt/src/sha.c         |  22 +++-
 wolfcrypt/src/sha256.c      |  17 ++-
 wolfcrypt/src/wc_port.c     |  38 ++++++
 wolfssl/wolfcrypt/wc_port.h |  27 +++++
 7 files changed, 200 insertions(+), 177 deletions(-)

diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c
index 9487132d0..0550d6118 100644
--- a/wolfcrypt/src/aes.c
+++ b/wolfcrypt/src/aes.c
@@ -217,6 +217,25 @@ void wc_AesFreeCavium(Aes* aes)
      * Guide (See note in README).
      * NOTE: no support for AES-CTR */
     #include "cau_api.h"
+
+    static int wc_AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock)
+    {    
+        int ret = wolfSSL_CryptHwMutexLock();
+        if(ret == 0) {
+            cau_aes_encrypt(inBlock, (byte*)aes->key, aes->rounds, outBlock);
+            wolfSSL_CryptHwMutexUnLock();
+        }
+        return ret;
+    }
+    static int wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock)
+    {    
+        int ret = wolfSSL_CryptHwMutexLock();
+        if(ret == 0) {
+            cau_aes_decrypt(inBlock, (byte*)aes->key, aes->rounds, outBlock);
+            wolfSSL_CryptHwMutexUnLock();
+        }
+        return ret;
+    }
 #elif defined(WOLFSSL_PIC32MZ_CRYPT)
     /* NOTE: no support for AES-CCM/Direct */
     #define DEBUG_WOLFSSL
@@ -1490,6 +1509,7 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock)
     int wc_AesSetKey(Aes* aes, const byte* userKey, word32 keylen, const byte* iv,
                   int dir)
     {
+        int ret;
         byte *rk = (byte*)aes->key;
 
         if (!((keylen == 16) || (keylen == 24) || (keylen == 32)))
@@ -1499,9 +1519,16 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock)
             return BAD_FUNC_ARG;
 
         aes->rounds = keylen/4 + 6;
-        cau_aes_set_key(userKey, keylen*8, rk);
-
-        return wc_AesSetIV(aes, iv);
+		
+        ret = wolfSSL_CryptHwMutexLock();
+        if(ret == 0) {
+            cau_aes_set_key(userKey, keylen*8, rk);
+            wolfSSL_CryptHwMutexUnLock();
+            
+            ret = wc_AesSetIV(aes, iv);
+        }
+        
+        return ret;
     }
 
     int wc_AesSetKeyDirect(Aes* aes, const byte* userKey, word32 keylen,
@@ -1724,27 +1751,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
 
 /* AES-DIRECT */
 #if defined(WOLFSSL_AES_DIRECT)
-    #if defined(FREESCALE_MMCAU)
-
-        /* Allow direct access to one block encrypt */
-        void wc_AesEncryptDirect(Aes* aes, byte* out, const byte* in)
-        {
-            byte* key;
-            key = (byte*)aes->key;
-
-            return cau_aes_encrypt(in, key, aes->rounds, out);
-        }
-
-        /* Allow direct access to one block decrypt */
-        void wc_AesDecryptDirect(Aes* aes, byte* out, const byte* in)
-        {
-            byte* key;
-            key = (byte*)aes->key;
-
-            return cau_aes_decrypt(in, key, aes->rounds, out);
-        }
-
-    #elif defined(STM32F2_CRYPTO)
+    #if defined(STM32F2_CRYPTO)
         #error "STM32F2 crypto doesn't yet support AES direct"
 
     #elif defined(HAVE_COLDFIRE_SEC)
@@ -1766,7 +1773,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
             wc_AesDecrypt(aes, in, out);
         }
 
-    #endif /* FREESCALE_MMCAU, AES direct block */
+    #endif /* AES direct block */
 #endif /* WOLFSSL_AES_DIRECT */
 
 
@@ -2109,11 +2116,10 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
         int offset = 0;
         int len = sz;
 
-        byte *iv, *enc_key;
+        byte *iv;
         byte temp_block[AES_BLOCK_SIZE];
 
         iv      = (byte*)aes->reg;
-        enc_key = (byte*)aes->key;
 
         if ((wolfssl_word)out % WOLFSSL_MMCAU_ALIGNMENT) {
             WOLFSSL_MSG("Bad cau_aes_encrypt alignment");
@@ -2128,7 +2134,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
             for (i = 0; i < AES_BLOCK_SIZE; i++)
                 temp_block[i] ^= iv[i];
 
-            cau_aes_encrypt(temp_block, enc_key, aes->rounds, out + offset);
+            wc_AesEncrypt(aes, temp_block, out + offset);
 
             len    -= AES_BLOCK_SIZE;
             offset += AES_BLOCK_SIZE;
@@ -2146,11 +2152,10 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
         int offset = 0;
         int len = sz;
 
-        byte* iv, *dec_key;
+        byte* iv;
         byte temp_block[AES_BLOCK_SIZE];
 
         iv      = (byte*)aes->reg;
-        dec_key = (byte*)aes->key;
 
         if ((wolfssl_word)out % WOLFSSL_MMCAU_ALIGNMENT) {
             WOLFSSL_MSG("Bad cau_aes_decrypt alignment");
@@ -2161,8 +2166,8 @@ int wc_AesSetIV(Aes* aes, const byte* iv)
         {
             XMEMCPY(temp_block, in + offset, AES_BLOCK_SIZE);
 
-            cau_aes_decrypt(in + offset, dec_key, aes->rounds, out + offset);
-
+            wc_AesEncrypt(aes, in + offset, out + offset);
+            
             /* XOR block with IV for CBC */
             for (i = 0; i < AES_BLOCK_SIZE; i++)
                 (out + offset)[i] ^= iv[i];
@@ -2741,10 +2746,6 @@ int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len)
     int  ret;
     byte iv[AES_BLOCK_SIZE];
 
-    #ifdef FREESCALE_MMCAU
-        byte* rk = (byte*)aes->key;
-    #endif
-
     if (!((len == 16) || (len == 24) || (len == 32)))
         return BAD_FUNC_ARG;
 
@@ -2752,11 +2753,7 @@ int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len)
     ret = wc_AesSetKey(aes, key, len, iv, AES_ENCRYPTION);
 
     if (ret == 0) {
-    #ifdef FREESCALE_MMCAU
-        cau_aes_encrypt(iv, rk, aes->rounds, aes->H);
-    #else
         wc_AesEncrypt(aes, iv, aes->H);
-    #endif
     #ifdef GCM_TABLE
         GenerateM0(aes);
     #endif /* GCM_TABLE */
@@ -3282,10 +3279,6 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz,
     byte *ctr ;
     byte scratch[AES_BLOCK_SIZE];
 
-#ifdef FREESCALE_MMCAU
-    byte* key = (byte*)aes->key;
-#endif
-
     WOLFSSL_ENTER("AesGcmEncrypt");
 
 #ifdef WOLFSSL_PIC32MZ_CRYPT
@@ -3306,13 +3299,9 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz,
     while (blocks--) {
         IncrementGcmCounter(ctr);
         #ifndef WOLFSSL_PIC32MZ_CRYPT
-            #ifdef FREESCALE_MMCAU
-                cau_aes_encrypt(ctr, key, aes->rounds, scratch);
-            #else
-                wc_AesEncrypt(aes, ctr, scratch);
-            #endif
-        xorbuf(scratch, p, AES_BLOCK_SIZE);
-        XMEMCPY(c, scratch, AES_BLOCK_SIZE);
+            wc_AesEncrypt(aes, ctr, scratch);
+            xorbuf(scratch, p, AES_BLOCK_SIZE);
+            XMEMCPY(c, scratch, AES_BLOCK_SIZE);
         #endif
         p += AES_BLOCK_SIZE;
         c += AES_BLOCK_SIZE;
@@ -3320,11 +3309,7 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz,
 
     if (partial != 0) {
         IncrementGcmCounter(ctr);
-        #ifdef FREESCALE_MMCAU
-            cau_aes_encrypt(ctr, key, aes->rounds, scratch);
-        #else
-            wc_AesEncrypt(aes, ctr, scratch);
-        #endif
+        wc_AesEncrypt(aes, ctr, scratch);
         xorbuf(scratch, p, partial);
         XMEMCPY(c, scratch, partial);
 
@@ -3332,11 +3317,7 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz,
 
     GHASH(aes, authIn, authInSz, out, sz, authTag, authTagSz);
     InitGcmCounter(ctr);
-    #ifdef FREESCALE_MMCAU
-        cau_aes_encrypt(ctr, key, aes->rounds, scratch);
-    #else
-        wc_AesEncrypt(aes, ctr, scratch);
-    #endif
+    wc_AesEncrypt(aes, ctr, scratch);
     xorbuf(authTag, scratch, authTagSz);
 
     return 0;
@@ -3356,10 +3337,6 @@ int  wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz,
     byte *ctr ;
     byte scratch[AES_BLOCK_SIZE];
 
-#ifdef FREESCALE_MMCAU
-    byte* key = (byte*)aes->key;
-#endif
-
     WOLFSSL_ENTER("AesGcmDecrypt");
 
 #ifdef WOLFSSL_PIC32MZ_CRYPT
@@ -3379,11 +3356,7 @@ int  wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz,
         byte EKY0[AES_BLOCK_SIZE];
 
         GHASH(aes, authIn, authInSz, in, sz, Tprime, sizeof(Tprime));
-        #ifdef FREESCALE_MMCAU
-            cau_aes_encrypt(ctr, key, aes->rounds, EKY0);
-        #else
-            wc_AesEncrypt(aes, ctr, EKY0);
-        #endif
+        wc_AesEncrypt(aes, ctr, EKY0);
         xorbuf(Tprime, EKY0, sizeof(Tprime));
 
         if (ConstantCompare(authTag, Tprime, authTagSz) != 0) {
@@ -3400,24 +3373,16 @@ int  wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz,
     while (blocks--) {
         IncrementGcmCounter(ctr);
         #ifndef WOLFSSL_PIC32MZ_CRYPT
-            #ifdef FREESCALE_MMCAU
-                cau_aes_encrypt(ctr, key, aes->rounds, scratch);
-            #else
-                wc_AesEncrypt(aes, ctr, scratch);
-            #endif
-        xorbuf(scratch, c, AES_BLOCK_SIZE);
-        XMEMCPY(p, scratch, AES_BLOCK_SIZE);
+            wc_AesEncrypt(aes, ctr, scratch);
+            xorbuf(scratch, c, AES_BLOCK_SIZE);
+            XMEMCPY(p, scratch, AES_BLOCK_SIZE);
         #endif
         p += AES_BLOCK_SIZE;
         c += AES_BLOCK_SIZE;
     }
     if (partial != 0) {
         IncrementGcmCounter(ctr);
-        #ifdef FREESCALE_MMCAU
-            cau_aes_encrypt(ctr, key, aes->rounds, scratch);
-        #else
-            wc_AesEncrypt(aes, ctr, scratch);
-        #endif
+        wc_AesEncrypt(aes, ctr, scratch);
         xorbuf(scratch, c, partial);
         XMEMCPY(p, scratch, partial);
     }
@@ -3470,31 +3435,19 @@ void wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz)
 
 static void roll_x(Aes* aes, const byte* in, word32 inSz, byte* out)
 {
-    #ifdef FREESCALE_MMCAU
-        byte* key = (byte*)aes->key;
-    #endif
-
     /* process the bulk of the data */
     while (inSz >= AES_BLOCK_SIZE) {
         xorbuf(out, in, AES_BLOCK_SIZE);
         in += AES_BLOCK_SIZE;
         inSz -= AES_BLOCK_SIZE;
 
-        #ifdef FREESCALE_MMCAU
-            cau_aes_encrypt(out, key, aes->rounds, out);
-        #else
-            wc_AesEncrypt(aes, out, out);
-        #endif
+        wc_AesEncrypt(aes, out, out);
     }
 
     /* process remainder of the data */
     if (inSz > 0) {
         xorbuf(out, in, inSz);
-        #ifdef FREESCALE_MMCAU
-            cau_aes_encrypt(out, key, aes->rounds, out);
-        #else
-            wc_AesEncrypt(aes, out, out);
-        #endif
+        wc_AesEncrypt(aes, out, out);
     }
 }
 
@@ -3504,10 +3457,6 @@ static void roll_auth(Aes* aes, const byte* in, word32 inSz, byte* out)
     word32 authLenSz;
     word32 remainder;
 
-    #ifdef FREESCALE_MMCAU
-        byte* key = (byte*)aes->key;
-    #endif
-
     /* encode the length in */
     if (inSz <= 0xFEFF) {
         authLenSz = 2;
@@ -3541,11 +3490,7 @@ static void roll_auth(Aes* aes, const byte* in, word32 inSz, byte* out)
         xorbuf(out + authLenSz, in, inSz);
         inSz = 0;
     }
-    #ifdef FREESCALE_MMCAU
-        cau_aes_encrypt(out, key, aes->rounds, out);
-    #else
-        wc_AesEncrypt(aes, out, out);
-    #endif
+    wc_AesEncrypt(aes, out, out);
 
     if (inSz > 0)
         roll_x(aes, in, inSz, out);
@@ -3575,19 +3520,11 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
     byte mask     = 0xFF;
     word32 wordSz = (word32)sizeof(word32);
 
-    #ifdef FREESCALE_MMCAU
-        byte* key;
-    #endif
-
     /* sanity check on arugments */
     if (aes == NULL || out == NULL || in == NULL || nonce == NULL
             || authTag == NULL || nonceSz < 7 || nonceSz > 13)
         return BAD_FUNC_ARG;
 
-    #ifdef FREESCALE_MMCAU
-        key = (byte*)aes->key;
-    #endif
-
     XMEMCPY(B+1, nonce, nonceSz);
     lenSz = AES_BLOCK_SIZE - 1 - (byte)nonceSz;
     B[0] = (authInSz > 0 ? 64 : 0)
@@ -3599,11 +3536,8 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
         B[AES_BLOCK_SIZE - 1 - i] = (inSz >> ((8 * i) & mask)) & mask;
     }
 
-    #ifdef FREESCALE_MMCAU
-        cau_aes_encrypt(B, key, aes->rounds, A);
-    #else
-        wc_AesEncrypt(aes, B, A);
-    #endif
+    wc_AesEncrypt(aes, B, A);
+
     if (authInSz > 0)
         roll_auth(aes, authIn, authInSz, A);
     if (inSz > 0)
@@ -3613,20 +3547,12 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
     B[0] = lenSz - 1;
     for (i = 0; i < lenSz; i++)
         B[AES_BLOCK_SIZE - 1 - i] = 0;
-    #ifdef FREESCALE_MMCAU
-        cau_aes_encrypt(B, key, aes->rounds, A);
-    #else
-        wc_AesEncrypt(aes, B, A);
-    #endif
+    wc_AesEncrypt(aes, B, A);
     xorbuf(authTag, A, authTagSz);
 
     B[15] = 1;
     while (inSz >= AES_BLOCK_SIZE) {
-        #ifdef FREESCALE_MMCAU
-            cau_aes_encrypt(B, key, aes->rounds, A);
-        #else
-            wc_AesEncrypt(aes, B, A);
-        #endif
+        wc_AesEncrypt(aes, B, A);
         xorbuf(A, in, AES_BLOCK_SIZE);
         XMEMCPY(out, A, AES_BLOCK_SIZE);
 
@@ -3636,11 +3562,7 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
         out += AES_BLOCK_SIZE;
     }
     if (inSz > 0) {
-        #ifdef FREESCALE_MMCAU
-            cau_aes_encrypt(B, key, aes->rounds, A);
-        #else
-            wc_AesEncrypt(aes, B, A);
-        #endif
+        wc_AesEncrypt(aes, B, A);
         xorbuf(A, in, inSz);
         XMEMCPY(out, A, inSz);
     }
@@ -3666,19 +3588,11 @@ int  wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
     byte mask     = 0xFF;
     word32 wordSz = (word32)sizeof(word32);
 
-    #ifdef FREESCALE_MMCAU
-        byte* key;
-    #endif
-
     /* sanity check on arugments */
     if (aes == NULL || out == NULL || in == NULL || nonce == NULL
             || authTag == NULL || nonceSz < 7 || nonceSz > 13)
         return BAD_FUNC_ARG;
 
-    #ifdef FREESCALE_MMCAU
-        key = (byte*)aes->key;
-    #endif
-
     o = out;
     oSz = inSz;
     XMEMCPY(B+1, nonce, nonceSz);
@@ -3690,11 +3604,7 @@ int  wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
     B[15] = 1;
 
     while (oSz >= AES_BLOCK_SIZE) {
-        #ifdef FREESCALE_MMCAU
-            cau_aes_encrypt(B, key, aes->rounds, A);
-        #else
-            wc_AesEncrypt(aes, B, A);
-        #endif
+        wc_AesEncrypt(aes, B, A);
         xorbuf(A, in, AES_BLOCK_SIZE);
         XMEMCPY(o, A, AES_BLOCK_SIZE);
 
@@ -3704,22 +3614,14 @@ int  wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
         o += AES_BLOCK_SIZE;
     }
     if (inSz > 0) {
-        #ifdef FREESCALE_MMCAU
-            cau_aes_encrypt(B, key, aes->rounds, A);
-        #else
-            wc_AesEncrypt(aes, B, A);
-        #endif
+        wc_AesEncrypt(aes, B, A);
         xorbuf(A, in, oSz);
         XMEMCPY(o, A, oSz);
     }
 
     for (i = 0; i < lenSz; i++)
         B[AES_BLOCK_SIZE - 1 - i] = 0;
-    #ifdef FREESCALE_MMCAU
-        cau_aes_encrypt(B, key, aes->rounds, A);
-    #else
-        wc_AesEncrypt(aes, B, A);
-    #endif
+    wc_AesEncrypt(aes, B, A);
 
     o = out;
     oSz = inSz;
@@ -3733,11 +3635,8 @@ int  wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
         B[AES_BLOCK_SIZE - 1 - i] = (inSz >> ((8 * i) & mask)) & mask;
     }
 
-    #ifdef FREESCALE_MMCAU
-        cau_aes_encrypt(B, key, aes->rounds, A);
-    #else
-        wc_AesEncrypt(aes, B, A);
-    #endif
+    wc_AesEncrypt(aes, B, A);
+
     if (authInSz > 0)
         roll_auth(aes, authIn, authInSz, A);
     if (inSz > 0)
@@ -3746,11 +3645,7 @@ int  wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz,
     B[0] = lenSz - 1;
     for (i = 0; i < lenSz; i++)
         B[AES_BLOCK_SIZE - 1 - i] = 0;
-    #ifdef FREESCALE_MMCAU
-        cau_aes_encrypt(B, key, aes->rounds, B);
-    #else
-        wc_AesEncrypt(aes, B, B);
-    #endif
+    wc_AesEncrypt(aes, B, B);
     xorbuf(A, B, authTagSz);
 
     if (ConstantCompare(A, authTag, authTagSz) != 0) {
diff --git a/wolfcrypt/src/des3.c b/wolfcrypt/src/des3.c
index 423afb4a0..e1199ef13 100644
--- a/wolfcrypt/src/des3.c
+++ b/wolfcrypt/src/des3.c
@@ -654,6 +654,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
         int i;
         int offset = 0;
         int len = sz;
+        int ret = 0;
         byte *iv;
         byte temp_block[DES_BLOCK_SIZE];
 
@@ -672,7 +673,12 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
             for (i = 0; i < DES_BLOCK_SIZE; i++)
                 temp_block[i] ^= iv[i];
 
+            ret = wolfSSL_CryptHwMutexLock();
+            if(ret != 0) {
+                return ret;
+            }
             cau_des_encrypt(temp_block, (byte*)des->key, out + offset);
+            wolfSSL_CryptHwMutexUnLock();
 
             len    -= DES_BLOCK_SIZE;
             offset += DES_BLOCK_SIZE;
@@ -681,7 +687,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
             XMEMCPY(iv, out + offset - DES_BLOCK_SIZE, DES_BLOCK_SIZE);
         }
 
-        return 0;
+        return ret;
     }
 
     int wc_Des_CbcDecrypt(Des* des, byte* out, const byte* in, word32 sz)
@@ -689,6 +695,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
         int i;
         int offset = 0;
         int len = sz;
+        int ret = 0;
         byte* iv;
         byte temp_block[DES_BLOCK_SIZE];
 
@@ -703,7 +710,12 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
         {
             XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE);
 
+            ret = wolfSSL_CryptHwMutexLock();
+            if(ret != 0) {
+                return ret;
+            }
             cau_des_decrypt(in + offset, (byte*)des->key, out + offset);
+            wolfSSL_CryptHwMutexUnLock();
 
             /* XOR block with IV for CBC */
             for (i = 0; i < DES_BLOCK_SIZE; i++)
@@ -716,7 +728,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
             offset += DES_BLOCK_SIZE;
         }
 
-        return 0;
+        return ret;
     }
 
     int wc_Des3_CbcEncrypt(Des3* des, byte* out, const byte* in, word32 sz)
@@ -724,6 +736,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
         int i;
         int offset = 0;
         int len = sz;
+        int ret = 0;
 
         byte *iv;
         byte temp_block[DES_BLOCK_SIZE];
@@ -743,9 +756,14 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
             for (i = 0; i < DES_BLOCK_SIZE; i++)
                 temp_block[i] ^= iv[i];
 
+            ret = wolfSSL_CryptHwMutexLock();
+            if(ret != 0) {
+                return ret;
+            }
             cau_des_encrypt(temp_block  , (byte*)des->key[0], out + offset);
             cau_des_decrypt(out + offset, (byte*)des->key[1], out + offset);
             cau_des_encrypt(out + offset, (byte*)des->key[2], out + offset);
+            wolfSSL_CryptHwMutexUnLock();
 
             len    -= DES_BLOCK_SIZE;
             offset += DES_BLOCK_SIZE;
@@ -754,7 +772,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
             XMEMCPY(iv, out + offset - DES_BLOCK_SIZE, DES_BLOCK_SIZE);
         }
 
-        return 0;
+        return ret;
     }
 
     int wc_Des3_CbcDecrypt(Des3* des, byte* out, const byte* in, word32 sz)
@@ -762,6 +780,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
         int i;
         int offset = 0;
         int len = sz;
+        int ret = 0;
 
         byte* iv;
         byte temp_block[DES_BLOCK_SIZE];
@@ -777,9 +796,14 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
         {
             XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE);
 
+            ret = wolfSSL_CryptHwMutexLock();
+            if(ret != 0) {
+                return ret;
+            }
             cau_des_decrypt(in + offset , (byte*)des->key[2], out + offset);
             cau_des_encrypt(out + offset, (byte*)des->key[1], out + offset);
             cau_des_decrypt(out + offset, (byte*)des->key[0], out + offset);
+            wolfSSL_CryptHwMutexUnLock();
 
             /* XOR block with IV for CBC */
             for (i = 0; i < DES_BLOCK_SIZE; i++)
@@ -792,7 +816,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir)
             offset += DES_BLOCK_SIZE;
         }
 
-        return 0;
+        return ret;
     }
 
 
diff --git a/wolfcrypt/src/md5.c b/wolfcrypt/src/md5.c
index fbf732add..5d1339a8f 100644
--- a/wolfcrypt/src/md5.c
+++ b/wolfcrypt/src/md5.c
@@ -49,7 +49,7 @@
 
 #ifdef FREESCALE_MMCAU
     #include "cau_api.h"
-    #define XTRANSFORM(S,B)  cau_md5_hash_n((B), 1, (unsigned char*)(S)->digest)
+    #define XTRANSFORM(S,B)  Transform((S), (B))
 #else
     #define XTRANSFORM(S,B)  Transform((S))
 #endif
@@ -192,6 +192,18 @@ void wc_InitMd5(Md5* md5)
     md5->hiLen   = 0;
 }
 
+#ifdef FREESCALE_MMCAU
+static int Transform(Md5* md5, byte* data)
+{
+    int ret = wolfSSL_CryptHwMutexLock();
+    if(ret == 0) {
+        cau_md5_hash_n(data, 1, (unsigned char*)md5->digest);
+        wolfSSL_CryptHwMutexUnLock();
+    }
+    return ret;
+}
+#endif /* FREESCALE_MMCAU */
+
 #ifndef FREESCALE_MMCAU
 
 static void Transform(Md5* md5)
diff --git a/wolfcrypt/src/sha.c b/wolfcrypt/src/sha.c
index 984d7343d..bde6376c8 100644
--- a/wolfcrypt/src/sha.c
+++ b/wolfcrypt/src/sha.c
@@ -72,7 +72,7 @@
 
 #ifdef FREESCALE_MMCAU
     #include "cau_api.h"
-    #define XTRANSFORM(S,B)  cau_sha1_hash_n((B), 1, ((S))->digest)
+    #define XTRANSFORM(S,B)  Transform((S), (B))
 #else
     #define XTRANSFORM(S,B)  Transform((S))
 #endif
@@ -210,8 +210,14 @@ int wc_ShaFinal(Sha* sha, byte* hash)
 
 int wc_InitSha(Sha* sha)
 {
+    int ret = 0;
 #ifdef FREESCALE_MMCAU
+    ret = wolfSSL_CryptHwMutexLock();
+    if(ret != 0) {
+        return ret;
+    }
     cau_sha1_initialize_output(sha->digest);
+    wolfSSL_CryptHwMutexUnLock();
 #else
     sha->digest[0] = 0x67452301L;
     sha->digest[1] = 0xEFCDAB89L;
@@ -224,9 +230,21 @@ int wc_InitSha(Sha* sha)
     sha->loLen   = 0;
     sha->hiLen   = 0;
 
-    return 0;
+    return ret;
 }
 
+#ifdef FREESCALE_MMCAU
+static int Transform(Sha* sha, byte* data)
+{
+    int ret = wolfSSL_CryptHwMutexLock();
+    if(ret == 0) {
+        cau_sha1_hash_n(data, 1, sha->digest);
+        wolfSSL_CryptHwMutexUnLock();
+    }
+    return ret;
+}
+#endif /* FREESCALE_MMCAU */
+        
 #ifndef FREESCALE_MMCAU
 
 #define blk0(i) (W[i] = sha->buffer[i])
diff --git a/wolfcrypt/src/sha256.c b/wolfcrypt/src/sha256.c
index 3dc1f4a8e..2cdad7d88 100644
--- a/wolfcrypt/src/sha256.c
+++ b/wolfcrypt/src/sha256.c
@@ -301,8 +301,14 @@ static void set_Transform(void) {
 
 int wc_InitSha256(Sha256* sha256)
 {
+    int ret = 0;
     #ifdef FREESCALE_MMCAU
+        ret = wolfSSL_CryptHwMutexLock();
+        if(ret != 0) {
+            return ret;
+        }
         cau_sha256_initialize_output(sha256->digest);
+        wolfSSL_CryptHwMutexUnLock();
     #else
         sha256->digest[0] = 0x6A09E667L;
         sha256->digest[1] = 0xBB67AE85L;
@@ -322,7 +328,7 @@ int wc_InitSha256(Sha256* sha256)
     set_Transform() ; /* choose best Transform function under this runtime environment */
 #endif
 
-    return 0;
+    return ret;
 }
 
 
@@ -349,9 +355,12 @@ static const ALIGN32 word32 K[64] = {
 
 static int Transform(Sha256* sha256, byte* buf)
 {
-    cau_sha256_hash_n(buf, 1, sha256->digest);
-
-    return 0;
+    int ret = wolfSSL_CryptHwMutexLock();
+    if(ret == 0) {
+        cau_sha256_hash_n(buf, 1, sha256->digest);
+        wolfSSL_CryptHwMutexUnLock();
+    }
+    return ret;
 }
 
 #endif /* FREESCALE_MMCAU */
diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c
index 72a014065..8a6d7513a 100644
--- a/wolfcrypt/src/wc_port.c
+++ b/wolfcrypt/src/wc_port.c
@@ -34,6 +34,44 @@
 #endif
 
 
+#if WOLFSSL_CRYPT_HW_MUTEX
+/* Mutex for protection of cryptograpghy hardware */
+static wolfSSL_Mutex wcCryptHwMutex;
+static int wcCryptHwMutexInit = 0;
+
+int wolfSSL_CryptHwMutexInit(void) {
+    int ret = 0;
+    if(wcCryptHwMutexInit == 0) {
+        ret = InitMutex(&wcCryptHwMutex);
+        if(ret == 0) {
+            wcCryptHwMutexInit = 1;
+        }
+    }
+    return ret;
+}
+
+int wolfSSL_CryptHwMutexLock(void) {
+    int ret = BAD_MUTEX_E;
+
+    /* Make sure HW Mutex has been initialized */
+    wolfSSL_CryptHwMutexInit();
+
+    if(wcCryptHwMutexInit) {
+        ret = LockMutex(&wcCryptHwMutex);
+    }
+    return ret;
+}
+
+int wolfSSL_CryptHwMutexUnLock(void) {
+    int ret = BAD_MUTEX_E;
+    
+    if(wcCryptHwMutexInit) {
+        ret = UnLockMutex(&wcCryptHwMutex);
+    }
+    return ret;
+}
+#endif /* WOLFSSL_CRYPT_HW_MUTEX */
+
 
 #ifdef SINGLE_THREADED
 
diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h
index 4989d19f1..7e260f923 100644
--- a/wolfssl/wolfcrypt/wc_port.h
+++ b/wolfssl/wolfcrypt/wc_port.h
@@ -136,7 +136,34 @@
         #error Need a mutex type in multithreaded mode
     #endif /* USE_WINDOWS_API */
 #endif /* SINGLE_THREADED */
+        
+/* Enable crypt HW mutex for Freescale MMCAU */
+#if defined(FREESCALE_MMCAU)
+    #ifndef WOLFSSL_CRYPT_HW_MUTEX
+        #define WOLFSSL_CRYPT_HW_MUTEX  1
+    #endif
+#endif /* FREESCALE_MMCAU */
 
+#ifndef WOLFSSL_CRYPT_HW_MUTEX
+    #define WOLFSSL_CRYPT_HW_MUTEX  0
+#endif
+
+#if WOLFSSL_CRYPT_HW_MUTEX
+    /* wolfSSL_CryptHwMutexInit is called on first wolfSSL_CryptHwMutexLock, 
+       however it's recommended to call this directly on Hw init to avoid possible 
+       race condition where two calls to wolfSSL_CryptHwMutexLock are made at 
+       the same time. */
+    int wolfSSL_CryptHwMutexInit(void);
+    int wolfSSL_CryptHwMutexLock(void);
+    int wolfSSL_CryptHwMutexUnLock(void);
+#else
+    /* Define stubs, since HW mutex is disabled */
+    #define wolfSSL_CryptHwMutexInit()      0 /* Success */
+    #define wolfSSL_CryptHwMutexLock()      0 /* Success */
+    #define wolfSSL_CryptHwMutexUnLock()    0 /* Success */
+#endif /* WOLFSSL_CRYPT_HW_MUTEX */
+
+/* Mutex functions */
 WOLFSSL_LOCAL int InitMutex(wolfSSL_Mutex*);
 WOLFSSL_LOCAL int FreeMutex(wolfSSL_Mutex*);
 WOLFSSL_LOCAL int LockMutex(wolfSSL_Mutex*);

From dfc733a3043cebee134379f0017aba9332a26cfa Mon Sep 17 00:00:00 2001
From: toddouska 
Date: Tue, 13 Oct 2015 14:13:12 -0700
Subject: [PATCH 57/77] switch example client max fragment arg to -F to make -L
 open on both client and server

---
 examples/client/client.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/examples/client/client.c b/examples/client/client.c
index b37fd4cd3..3317dcb9c 100644
--- a/examples/client/client.c
+++ b/examples/client/client.c
@@ -172,7 +172,7 @@ static void Usage(void)
     printf("-S     Use Host Name Indication\n");
 #endif
 #ifdef HAVE_MAX_FRAGMENT
-    printf("-L     Use Maximum Fragment Length [1-5]\n");
+    printf("-F     Use Maximum Fragment Length [1-5]\n");
 #endif
 #ifdef HAVE_TRUNCATED_HMAC
     printf("-T          Use Truncated HMAC\n");
@@ -293,7 +293,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
     StackTrap();
 
     while ((ch = mygetopt(argc, argv,
-                          "?gdeDusmNrwRitfxXUPCh:p:v:l:A:c:k:Z:b:zS:L:ToO:a"))
+                          "?gdeDusmNrwRitfxXUPCh:p:v:l:A:c:k:Z:b:zS:F:ToO:a"))
                                                                         != -1) {
         switch (ch) {
             case '?' :
@@ -456,7 +456,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
                 #endif
                 break;
 
-            case 'L' :
+            case 'F' :
                 #ifdef HAVE_MAX_FRAGMENT
                     maxFragment = atoi(myoptarg);
                     if (maxFragment < WOLFSSL_MFL_2_9 ||

From c0210491d9db975365762bb9402a2b88f0604d93 Mon Sep 17 00:00:00 2001
From: John Safranek 
Date: Tue, 13 Oct 2015 14:21:39 -0700
Subject: [PATCH 58/77] don't try to defragment handshake messages outside the
 handshake

---
 src/internal.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/internal.c b/src/internal.c
index 14c77f86f..4265caf7e 100644
--- a/src/internal.c
+++ b/src/internal.c
@@ -5272,6 +5272,16 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx,
 
     WOLFSSL_ENTER("DoHandShakeMsg()");
 
+    if (ssl->arrays == NULL) {
+        byte   type;
+        word32 size;
+
+        if (GetHandShakeHeader(ssl,input,inOutIdx,&type, &size, totalSz) != 0)
+            return PARSE_ERROR;
+
+        return DoHandShakeMsgType(ssl, input, inOutIdx, type, size, totalSz);
+    }
+
     inputLength = ssl->buffers.inputBuffer.length - *inOutIdx;
 
     /* If there is a pending fragmented handshake message,

From a0a4386504b7cdd2f708e109009dd8d9ac96c033 Mon Sep 17 00:00:00 2001
From: toddouska 
Date: Tue, 13 Oct 2015 15:00:53 -0700
Subject: [PATCH 59/77] fix alpn example client merge command options

---
 configure.ac              |  17 +-
 examples/client/client.c  |  77 ++++++++-
 examples/server/server.c  |  51 +++++-
 src/internal.c            |   3 +
 src/ssl.c                 |  70 ++++++++
 src/tls.c                 | 340 ++++++++++++++++++++++++++++++++++++++
 tests/api.c               | 333 +++++++++++++++++++++++++++++++------
 wolfssl/error-ssl.h       |   2 +
 wolfssl/internal.h        |  24 ++-
 wolfssl/ssl.h             |  29 +++-
 wolfssl/wolfcrypt/types.h |   2 +-
 11 files changed, 894 insertions(+), 54 deletions(-)

diff --git a/configure.ac b/configure.ac
index 198c8e77d..726181904 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1565,6 +1565,19 @@ AC_ARG_ENABLE([maxfragment],
     [ ENABLED_MAX_FRAGMENT=no ]
     )
 
+# ALPN
+AC_ARG_ENABLE([alpn],
+    [  --enable-alpn            Enable ALPN (default: disabled)],
+    [ ENABLED_ALPN=$enableval ],
+    [ ENABLED_ALPN=no ]
+    )
+
+if test "x$ENABLED_ALPN" = "xyes"
+then
+    AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_ALPN"
+fi
+
+# Maximum Fragment Length
 if test "x$ENABLED_MAX_FRAGMENT" = "xyes"
 then
     AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_MAX_FRAGMENT"
@@ -1647,7 +1660,8 @@ then
 	ENABLED_MAX_FRAGMENT=yes
 	ENABLED_TRUNCATED_HMAC=yes
 	ENABLED_SUPPORTED_CURVES=yes
-    AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_SUPPORTED_CURVES"
+	ENABLED_ALPN=yes
+    AM_CFLAGS="$AM_CFLAGS -DHAVE_TLS_EXTENSIONS -DHAVE_SNI -DHAVE_MAX_FRAGMENT -DHAVE_TRUNCATED_HMAC -DHAVE_SUPPORTED_CURVES -DHAVE_ALPN"
 fi
 
 # PKCS7
@@ -2474,6 +2488,7 @@ echo "   * Atomic User Record Layer:  $ENABLED_ATOMICUSER"
 echo "   * Public Key Callbacks:      $ENABLED_PKCALLBACKS"
 echo "   * NTRU:                      $ENABLED_NTRU"
 echo "   * SNI:                       $ENABLED_SNI"
+echo "   * ALPN:                      $ENABLED_ALPN"
 echo "   * Maximum Fragment Length:   $ENABLED_MAX_FRAGMENT"
 echo "   * Truncated HMAC:            $ENABLED_TRUNCATED_HMAC"
 echo "   * Renegotiation Indication:  $ENABLED_RENEGOTIATION_INDICATION"
diff --git a/examples/client/client.c b/examples/client/client.c
index 3317dcb9c..fbb9cb979 100644
--- a/examples/client/client.c
+++ b/examples/client/client.c
@@ -146,6 +146,9 @@ static void Usage(void)
                                  DEFAULT_MIN_DHKEY_BITS);
 #endif
     printf("-b     Benchmark  connections and print stats\n");
+#ifdef HAVE_ALPN
+    printf("-L     Application-Layer Protocole Name ({C,F}:)\n");
+#endif
     printf("-s          Use pre Shared keys\n");
     printf("-t          Track wolfSSL memory use\n");
     printf("-d          Disable peer checks\n");
@@ -243,6 +246,8 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
     int    pkCallbacks   = 0;
     int    overrideDateErrors = 0;
     int    minDhKeyBits  = DEFAULT_MIN_DHKEY_BITS;
+    char*  alpnList = NULL;
+    unsigned char alpn_opt = 0;
     char*  cipherList = NULL;
     const char* verifyCert = caCert;
     const char* ourCert    = cliCert;
@@ -289,11 +294,13 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
     (void)overrideDateErrors;
     (void)disableCRL;
     (void)minDhKeyBits;
+    (void)alpnList;
+    (void)alpn_opt;
 
     StackTrap();
 
     while ((ch = mygetopt(argc, argv,
-                          "?gdeDusmNrwRitfxXUPCh:p:v:l:A:c:k:Z:b:zS:F:ToO:a"))
+                          "?gdeDusmNrwRitfxXUPCh:p:v:l:A:c:k:Z:b:zS:L:ToO:an:"))
                                                                         != -1) {
         switch (ch) {
             case '?' :
@@ -492,6 +499,24 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
                 #endif
                 break;
 
+            case 'n' :
+                #ifdef HAVE_ALPN
+                    alpnList = myoptarg;
+
+                    if (alpnList[0] == 'C' && alpnList[1] == ':')
+                        alpn_opt = WOLFSSL_ALPN_CONTINUE_ON_MISMATCH;
+                    else if (alpnList[0] == 'F' && alpnList[1] == ':')
+                        alpn_opt = WOLFSSL_ALPN_FAILED_ON_MISMATCH;
+                    else {
+                        Usage();
+                        exit(MY_EX_USAGE);
+                    }
+
+                    alpnList += 2;
+
+                #endif
+                break;
+
             default:
                 Usage();
                 exit(MY_EX_USAGE);
@@ -797,6 +822,14 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
     #ifdef HAVE_SESSION_TICKET
     wolfSSL_set_SessionTicket_cb(ssl, sessionTicketCB, (void*)"initial session");
     #endif
+
+#ifdef HAVE_ALPN
+    if (alpnList != NULL) {
+       printf("ALPN accepted protocols list : %s\n", alpnList);
+       wolfSSL_UseALPN(ssl, alpnList, (word32)XSTRLEN(alpnList), alpn_opt);
+    }
+#endif
+
     if (doDTLS) {
         SOCKADDR_IN_T addr;
         build_addr(&addr, host, port, 1);
@@ -865,6 +898,23 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
 #endif
     showPeer(ssl);
 
+#ifdef HAVE_ALPN
+    if (alpnList != NULL) {
+        int err;
+        char *protocol_name = NULL;
+        word16 protocol_nameSz = 0;
+
+        err = wolfSSL_ALPN_GetProtocol(ssl, &protocol_name, &protocol_nameSz);
+        if (err == SSL_SUCCESS)
+            printf("Received ALPN protocol : %s (%d)\n",
+                   protocol_name, protocol_nameSz);
+        else if (err == SSL_ALPN_NOT_FOUND)
+            printf("No ALPN response received (no match with server)\n");
+        else
+            printf("Getting ALPN protocol name failed\n");
+    }
+#endif
+
 #ifdef HAVE_SECURE_RENEGOTIATION
     if (scr && forceScr) {
         if (nonBlocking) {
@@ -952,6 +1002,13 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
             tcp_connect(&sockfd, host, port, 0);
         }
         wolfSSL_set_fd(sslResume, sockfd);
+#ifdef HAVE_ALPN
+        if (alpnList != NULL) {
+            printf("ALPN accepted protocols list : %s\n", alpnList);
+            wolfSSL_UseALPN(sslResume, alpnList, (word32)XSTRLEN(alpnList),
+                            alpn_opt);
+        }
+#endif
 #ifdef HAVE_SECURE_RENEGOTIATION
         if (scr) {
             if (wolfSSL_UseSecureRenegotiation(sslResume) != SSL_SUCCESS)
@@ -984,6 +1041,24 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args)
         else
             printf("didn't reuse session id!!!\n");
 
+#ifdef HAVE_ALPN
+        if (alpnList != NULL) {
+            int err;
+            char *protocol_name = NULL;
+            word16 protocol_nameSz = 0;
+
+            printf("Sending ALPN accepted list : %s\n", alpnList);
+            err = wolfSSL_ALPN_GetProtocol(sslResume, &protocol_name,
+                                           &protocol_nameSz);
+            if (err == SSL_SUCCESS)
+                printf("Received ALPN protocol : %s (%d)\n",
+                       protocol_name, protocol_nameSz);
+            else if (err == SSL_ALPN_NOT_FOUND)
+                printf("Not received ALPN response (no match with server)\n");
+            else
+                printf("Getting ALPN protocol name failed\n");
+        }
+#endif
         if (wolfSSL_write(sslResume, resumeMsg, resumeSz) != resumeSz)
             err_sys("SSL_write failed");
 
diff --git a/examples/server/server.c b/examples/server/server.c
index 07f3012e4..014342af3 100644
--- a/examples/server/server.c
+++ b/examples/server/server.c
@@ -135,6 +135,9 @@ static void Usage(void)
     printf("-D    Diffie-Hellman Params file, default %s\n", dhParam);
     printf("-Z     Minimum DH key bits,        default %d\n",
                                  DEFAULT_MIN_DHKEY_BITS);
+#endif
+#ifdef HAVE_ALPN
+    printf("-L     Application-Layer Protocole Name ({C,F}:)\n");
 #endif
     printf("-d          Disable client cert check\n");
     printf("-b          Bind to any interface instead of localhost only\n");
@@ -194,6 +197,8 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
     int    resume = 0;            /* do resume, and resume count */
     int    minDhKeyBits = DEFAULT_MIN_DHKEY_BITS;
     int    ret;
+    char*  alpnList = NULL;
+    unsigned char alpn_opt = 0;
     char*  cipherList = NULL;
     const char* verifyCert = cliCert;
     const char* ourCert    = svrCert;
@@ -232,12 +237,14 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
     (void)useNtruKey;
     (void)doCliCertCheck;
     (void)minDhKeyBits;
+    (void)alpnList;
+    (void)alpn_opt;
 
 #ifdef CYASSL_TIRTOS
     fdOpenSession(Task_self());
 #endif
 
-    while ((ch = mygetopt(argc, argv, "?dbstnNufrRawPIp:v:l:A:c:k:Z:S:oO:D:"))
+    while ((ch = mygetopt(argc, argv, "?dbstnNufrRawPIp:v:l:A:c:k:Z:S:oO:D:L:"))
                          != -1) {
         switch (ch) {
             case '?' :
@@ -376,6 +383,23 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args)
                 #endif
                 break;
 
+            case 'L' :
+                #ifdef HAVE_ALPN
+                    alpnList = myoptarg;
+
+                    if (alpnList[0] == 'C' && alpnList[1] == ':')
+                        alpn_opt = WOLFSSL_ALPN_CONTINUE_ON_MISMATCH;
+                    else if (alpnList[0] == 'F' && alpnList[1] == ':')
+                        alpn_opt = WOLFSSL_ALPN_FAILED_ON_MISMATCH;
+                    else {
+                        Usage();
+                        exit(MY_EX_USAGE);
+                    }
+
+                    alpnList += 2;
+
+                #endif
+                break;
             default:
                 Usage();
                 exit(MY_EX_USAGE);
@@ -622,6 +646,14 @@ while (1) {  /* allow resume option */
     }
 
     SSL_set_fd(ssl, clientfd);
+
+#ifdef HAVE_ALPN
+    if (alpnList != NULL) {
+        printf("ALPN accepted protocols list : %s\n", alpnList);
+        wolfSSL_UseALPN(ssl, alpnList, (word32)XSTRLEN(alpnList), alpn_opt);
+    }
+#endif
+
 #ifdef WOLFSSL_DTLS
     if (doDTLS) {
         SOCKADDR_IN_T cliaddr;
@@ -664,6 +696,23 @@ while (1) {  /* allow resume option */
 #endif
     showPeer(ssl);
 
+#ifdef HAVE_ALPN
+    if (alpnList != NULL) {
+        int err;
+        char *protocol_name = NULL;
+        word16 protocol_nameSz = 0;
+
+        err = wolfSSL_ALPN_GetProtocol(ssl, &protocol_name, &protocol_nameSz);
+        if (err == SSL_SUCCESS)
+            printf("Sent ALPN protocol : %s (%d)\n",
+                   protocol_name, protocol_nameSz);
+        else if (err == SSL_ALPN_NOT_FOUND)
+            printf("No ALPN response sent (no match)\n");
+        else
+            printf("Getting ALPN protocol name failed\n");
+    }
+#endif
+
     idx = SSL_read(ssl, input, sizeof(input)-1);
     if (idx > 0) {
         input[idx] = 0;
diff --git a/src/internal.c b/src/internal.c
index 14c77f86f..6c7542ea1 100644
--- a/src/internal.c
+++ b/src/internal.c
@@ -8569,6 +8569,9 @@ const char* wolfSSL_ERR_reason_error_string(unsigned long e)
     case RSA_SIGN_FAULT:
         return "RSA Signature Fault Error";
 
+    case UNKNOWN_ALPN_PROTOCOL_NAME_E:
+        return "Unrecognized protocol name Error";
+
     case HANDSHAKE_SIZE_ERROR:
         return "Handshake message too large Error";
 
diff --git a/src/ssl.c b/src/ssl.c
index 12311a78f..e96705102 100644
--- a/src/ssl.c
+++ b/src/ssl.c
@@ -884,6 +884,76 @@ int wolfSSL_UseSupportedQSH(WOLFSSL* ssl, word16 name)
 #endif /* NO_WOLFSSL_CLIENT */
 #endif /* HAVE_QSH */
 
+
+/* Application-Layer Procotol Name */
+#ifdef HAVE_ALPN
+
+int wolfSSL_UseALPN(WOLFSSL* ssl, char *protocol_name_list,
+                    word32 protocol_name_listSz, byte options)
+{
+    char    *list, *ptr, *token[10];
+    word16  len;
+    int     idx = 0;
+    int     ret = SSL_FAILURE;
+
+    WOLFSSL_ENTER("wolfSSL_UseALPN");
+
+    if (ssl == NULL || protocol_name_list == NULL)
+        return BAD_FUNC_ARG;
+
+    if (protocol_name_listSz > (WOLFSSL_MAX_ALPN_NUMBER *
+                                WOLFSSL_MAX_ALPN_PROTO_NAME_LEN +
+                                WOLFSSL_MAX_ALPN_NUMBER)) {
+        WOLFSSL_MSG("Invalid arguments, protocol name list too long");
+        return BAD_FUNC_ARG;
+    }
+
+    if (!(options & WOLFSSL_ALPN_CONTINUE_ON_MISMATCH) &&
+        !(options & WOLFSSL_ALPN_FAILED_ON_MISMATCH)) {
+            WOLFSSL_MSG("Invalid arguments, options not supported");
+            return BAD_FUNC_ARG;
+        }
+
+
+    list = (char *)XMALLOC(protocol_name_listSz+1, NULL,
+                           DYNAMIC_TYPE_TMP_BUFFER);
+    if (list == NULL) {
+        WOLFSSL_MSG("Memory failure");
+        return MEMORY_ERROR;
+    }
+
+    XMEMSET(list, 0, protocol_name_listSz+1);
+    XSTRNCPY(list, protocol_name_list, protocol_name_listSz);
+
+    /* read all protocol name from the list */
+    token[idx] = XSTRTOK(list, ",", &ptr);
+    while (token[idx] != NULL)
+        token[++idx] = XSTRTOK(NULL, ",", &ptr);
+
+    /* add protocol name list in the TLS extension in reverse order */
+    while ((idx--) > 0) {
+        len = (word16)XSTRLEN(token[idx]);
+
+        ret = TLSX_UseALPN(&ssl->extensions, token[idx], len, options);
+        if (ret != SSL_SUCCESS) {
+            WOLFSSL_MSG("TLSX_UseALPN failure");
+            break;
+        }
+    }
+
+    XFREE(list, NULL, DYNAMIC_TYPE_TMP_BUFFER);
+
+    return ret;
+}
+
+int wolfSSL_ALPN_GetProtocol(WOLFSSL* ssl, char **protocol_name, word16 *size)
+{
+    return TLSX_ALPN_GetRequest(ssl ? ssl->extensions : NULL,
+                           (void **)protocol_name, size);
+}
+
+#endif /* HAVE_ALPN */
+
 /* Secure Renegotiation */
 #ifdef HAVE_SECURE_RENEGOTIATION
 
diff --git a/src/tls.c b/src/tls.c
index 5d4657941..cece0696c 100644
--- a/src/tls.c
+++ b/src/tls.c
@@ -845,6 +845,327 @@ void TLSX_SetResponse(WOLFSSL* ssl, TLSX_Type type)
 
 #endif
 
+
+#ifdef HAVE_ALPN
+/** Creates a new ALPN object, providing protocol name to use. */
+static ALPN* TLSX_ALPN_New(char *protocol_name, word16 protocol_nameSz)
+{
+    ALPN *alpn;
+
+    WOLFSSL_ENTER("TLSX_ALPN_New");
+
+    if (protocol_name == NULL ||
+        protocol_nameSz > WOLFSSL_MAX_ALPN_PROTO_NAME_LEN) {
+        WOLFSSL_MSG("Invalid arguments");
+        return NULL;
+    }
+
+    alpn = (ALPN*)XMALLOC(sizeof(ALPN), 0, DYNAMIC_TYPE_TLSX);
+    if (alpn == NULL) {
+        WOLFSSL_MSG("Memory failure");
+        return NULL;
+    }
+
+    alpn->next = NULL;
+    alpn->negociated = 0;
+    alpn->options = 0;
+
+    alpn->protocol_name = XMALLOC(protocol_nameSz + 1, 0, DYNAMIC_TYPE_TLSX);
+    if (alpn->protocol_name == NULL) {
+        WOLFSSL_MSG("Memory failure");
+        XFREE(alpn, 0, DYNAMIC_TYPE_TLSX);
+        return NULL;
+    }
+
+    XMEMCPY(alpn->protocol_name, protocol_name, protocol_nameSz);
+    alpn->protocol_name[protocol_nameSz] = 0;
+
+    return alpn;
+}
+
+/** Releases an ALPN object. */
+static void TLSX_ALPN_Free(ALPN *alpn)
+{
+    if (alpn == NULL)
+        return;
+
+    XFREE(alpn->protocol_name, 0, DYNAMIC_TYPE_TLSX);
+    XFREE(alpn, 0, DYNAMIC_TYPE_TLSX);
+}
+
+/** Releases all ALPN objects in the provided list. */
+static void TLSX_ALPN_FreeAll(ALPN *list)
+{
+    ALPN* alpn;
+
+    while ((alpn = list)) {
+        list = alpn->next;
+        TLSX_ALPN_Free(alpn);
+    }
+}
+
+/** Tells the buffered size of the ALPN objects in a list. */
+static word16 TLSX_ALPN_GetSize(ALPN *list)
+{
+    ALPN* alpn;
+    word16 length = OPAQUE16_LEN; /* list length */
+
+    while ((alpn = list)) {
+        list = alpn->next;
+
+        length++; /* protocol name length is on one byte */
+        length += (word16)XSTRLEN(alpn->protocol_name);
+    }
+    
+    return length;
+}
+
+/** Writes the ALPN objects of a list in a buffer. */
+static word16 TLSX_ALPN_Write(ALPN *list, byte *output)
+{
+    ALPN* alpn;
+    word16 length = 0;
+    word16 offset = OPAQUE16_LEN; /* list length offset */
+
+    while ((alpn = list)) {
+        list = alpn->next;
+
+        length = (word16)XSTRLEN(alpn->protocol_name);
+
+        /* protocol name length */
+        output[offset++] = (byte)length;
+
+        /* protocol name value */
+        XMEMCPY(output + offset, alpn->protocol_name, length);
+
+        offset += length;
+    }
+
+    /* writing list length */
+    c16toa(offset - OPAQUE16_LEN, output);
+    
+    return offset;
+}
+
+/** Finds a protocol name in the provided ALPN list */
+static ALPN* TLSX_ALPN_Find(ALPN *list, char *protocol_name, word16 size)
+{
+    ALPN *alpn;
+
+    if (list == NULL || protocol_name == NULL)
+        return NULL;
+
+    alpn = list;
+    while (alpn != NULL && (
+           (word16)XSTRLEN(alpn->protocol_name) != size ||
+           XSTRNCMP(alpn->protocol_name, protocol_name, size)))
+        alpn = alpn->next;
+
+    return alpn;
+}
+
+/** Set the ALPN matching client and server requirements */
+static int TLSX_SetALPN(TLSX** extensions, const void* data, word16 size)
+{
+    ALPN *alpn;
+    int  ret;
+
+    if (extensions == NULL || data == NULL)
+        return BAD_FUNC_ARG;
+
+    alpn = TLSX_ALPN_New((char *)data, size);
+    if (alpn == NULL) {
+        WOLFSSL_MSG("Memory failure");
+        return MEMORY_E;
+    }
+
+    alpn->negociated = 1;
+
+    ret = TLSX_Push(extensions, WOLFSSL_ALPN, (void*)alpn);
+    if (ret != 0) {
+        TLSX_ALPN_Free(alpn);
+        return ret;
+    }
+
+    return SSL_SUCCESS;
+}
+
+/** Parses a buffer of ALPN extensions and set the first one matching
+ * client and server requirements */
+static int TLSX_ALPN_ParseAndSet(WOLFSSL *ssl, byte *input, word16 length,
+                                 byte isRequest)
+{
+    word16 size = 0;
+    word16 offset = 0;
+    int    r = BUFFER_ERROR;
+    TLSX   *extension;
+    ALPN   *alpn = NULL, *list;
+
+    extension = TLSX_Find(ssl->extensions, WOLFSSL_ALPN);
+    if (extension == NULL)
+        extension = TLSX_Find(ssl->ctx->extensions, WOLFSSL_ALPN);
+
+    if (extension == NULL || extension->data == NULL) {
+        WOLFSSL_MSG("No ALPN extensions not used or bad");
+        return isRequest ? 0             /* not using ALPN */
+                         : BUFFER_ERROR; /* unexpected ALPN response */
+    }
+
+    if (OPAQUE16_LEN > length)
+        return BUFFER_ERROR;
+
+    ato16(input, &size);
+    offset += OPAQUE16_LEN;
+
+    /* validating alpn list length */
+    if (length != OPAQUE16_LEN + size)
+        return BUFFER_ERROR;
+
+    list = (ALPN*)extension->data;
+
+    for (size = 0; offset < length; offset += size) {
+
+        size = input[offset++];
+        if (offset + size > length)
+            return BUFFER_ERROR;
+
+        alpn = TLSX_ALPN_Find(list, (char*)input + offset, size);
+        if (alpn != NULL) {
+            WOLFSSL_MSG("ALPN protocol match");
+            break;
+        }
+    }
+
+    if (alpn == NULL) {
+        WOLFSSL_MSG("No ALPN protocol match");
+
+        /* do nothing if no protocol match between client and server and option
+         is set to continue (like OpenSSL) */
+        if (list->options & WOLFSSL_ALPN_CONTINUE_ON_MISMATCH) {
+            WOLFSSL_MSG("Continue on mismatch");
+            return 0;
+        }
+
+        SendAlert(ssl, alert_fatal, no_application_protocol);
+        return UNKNOWN_ALPN_PROTOCOL_NAME_E;
+    }
+
+    /* set the matching negociated protocol */
+    r = TLSX_SetALPN(&ssl->extensions,
+                     alpn->protocol_name,
+                     (word16)XSTRLEN(alpn->protocol_name));
+    if (r != SSL_SUCCESS) {
+        WOLFSSL_MSG("TLSX_UseALPN failed");
+        return BUFFER_ERROR;
+    }
+
+    /* reply to ALPN extension sent from client */
+    if (isRequest) {
+#ifndef NO_WOLFSSL_SERVER
+        TLSX_SetResponse(ssl, WOLFSSL_ALPN);
+#endif
+    }
+
+    return 0;
+}
+
+/** Add a protocol name to the list of accepted usable ones */
+int TLSX_UseALPN(TLSX** extensions, const void* data, word16 size, byte options)
+{
+    ALPN *alpn;
+    TLSX *extension;
+    int  ret;
+
+    if (extensions == NULL || data == NULL)
+        return BAD_FUNC_ARG;
+
+    alpn = TLSX_ALPN_New((char *)data, size);
+    if (alpn == NULL) {
+        WOLFSSL_MSG("Memory failure");
+        return MEMORY_E;
+    }
+
+    /* Set Options of ALPN */
+    alpn->options = options;
+
+    extension = TLSX_Find(*extensions, WOLFSSL_ALPN);
+    if (extension == NULL) {
+        ret = TLSX_Push(extensions, WOLFSSL_ALPN, (void*)alpn);
+        if (ret != 0) {
+            TLSX_ALPN_Free(alpn);
+            return ret;
+        }
+    }
+    else {
+        /* push new ALPN object to extension data. */
+        alpn->next = (ALPN*)extension->data;
+        extension->data = (void*)alpn;
+    }
+
+    return SSL_SUCCESS;
+}
+
+/** Get the protocol name set by the server */
+int TLSX_ALPN_GetRequest(TLSX* extensions, void** data, word16 *dataSz)
+{
+    TLSX *extension;
+    ALPN *alpn;
+
+    if (extensions == NULL || data == NULL || dataSz == NULL)
+        return BAD_FUNC_ARG;
+
+    extension = TLSX_Find(extensions, WOLFSSL_ALPN);
+    if (extension == NULL) {
+        WOLFSSL_MSG("TLS extension not found");
+        return SSL_ALPN_NOT_FOUND;
+    }
+
+    alpn = (ALPN *)extension->data;
+    if (alpn == NULL) {
+        WOLFSSL_MSG("ALPN extension not found");
+        *data = NULL;
+        *dataSz = 0;
+        return SSL_FATAL_ERROR;
+    }
+
+    if (alpn->negociated != 1) {
+
+        /* consider as an error */
+        if (alpn->options & WOLFSSL_ALPN_FAILED_ON_MISMATCH) {
+            WOLFSSL_MSG("No protocol match with peer -> Failed");
+            return SSL_FATAL_ERROR;
+        }
+
+        /* continue without negociated protocol */
+        WOLFSSL_MSG("No protocol match with peer -> Continue");
+        return SSL_ALPN_NOT_FOUND;
+    }
+
+    if (alpn->next != NULL) {
+        WOLFSSL_MSG("Only one protocol name must be accepted");
+        return SSL_FATAL_ERROR;
+    }
+
+    *data = alpn->protocol_name;
+    *dataSz = (word16)XSTRLEN(*data);
+
+    return SSL_SUCCESS;
+}
+
+#define ALPN_FREE_ALL     TLSX_ALPN_FreeAll
+#define ALPN_GET_SIZE     TLSX_ALPN_GetSize
+#define ALPN_WRITE        TLSX_ALPN_Write
+#define ALPN_PARSE        TLSX_ALPN_ParseAndSet
+
+#else /* HAVE_ALPN */
+
+#define ALPN_FREE_ALL(list)
+#define ALPN_GET_SIZE(list)     0
+#define ALPN_WRITE(a, b)        0
+#define ALPN_PARSE(a, b, c, d)  0
+
+#endif /* HAVE_ALPN */
+
 /* Server Name Indication */
 #ifdef HAVE_SNI
 
@@ -2712,6 +3033,10 @@ void TLSX_FreeAll(TLSX* list)
             case WOLFSSL_QSH:
                 QSH_FREE_ALL(extension->data);
                 break;
+
+            case WOLFSSL_ALPN:
+                ALPN_FREE_ALL((ALPN*)extension->data);
+                break;
         }
 
         XFREE(extension, 0, DYNAMIC_TYPE_TLSX);
@@ -2775,6 +3100,11 @@ static word16 TLSX_GetSize(TLSX* list, byte* semaphore, byte isRequest)
             case WOLFSSL_QSH:
                 length += QSH_GET_SIZE(extension->data, isRequest);
                 break;
+
+            case WOLFSSL_ALPN:
+                length += ALPN_GET_SIZE(extension->data);
+                break;
+
         }
 
         /* marks the extension as processed so ctx level */
@@ -2845,6 +3175,10 @@ static word16 TLSX_Write(TLSX* list, byte* output, byte* semaphore,
                 offset += QSHPK_WRITE(extension->data, output + offset);
                 offset += QSH_SERREQ(output + offset, isRequest);
                 break;
+
+            case WOLFSSL_ALPN:
+                offset += ALPN_WRITE(extension->data, output + offset);
+                break;
         }
 
         /* writes extension data length. */
@@ -3335,6 +3669,12 @@ int TLSX_Parse(WOLFSSL* ssl, byte* input, word16 length, byte isRequest,
                 ret = QSH_PARSE(ssl, input + offset, size, isRequest);
                 break;
 
+            case WOLFSSL_ALPN:
+                WOLFSSL_MSG("ALPN extension received");
+
+                ret = ALPN_PARSE(ssl, input + offset, size, isRequest);
+                break;
+
             case HELLO_EXT_SIG_ALGO:
                 if (isRequest) {
                     /* do not mess with offset inside the switch! */
diff --git a/tests/api.c b/tests/api.c
index a34ecebbc..8feb84a39 100644
--- a/tests/api.c
+++ b/tests/api.c
@@ -507,8 +507,8 @@ done2:
     return;
 }
 
-/* SNI helper functions */
-#ifdef HAVE_SNI
+/* SNI / ALPN helper functions */
+#if defined(HAVE_SNI) || defined(HAVE_ALPN)
 
 static THREAD_RETURN WOLFSSL_THREAD run_wolfssl_server(void* args)
 {
@@ -685,7 +685,7 @@ static void run_wolfssl_client(void* args)
 #endif
 }
 
-#endif /* HAVE_SNI */
+#endif /* defined(HAVE_SNI) || defined(HAVE_ALPN) */
 #endif /* io tests dependencies */
 
 
@@ -747,6 +747,51 @@ static void test_wolfSSL_read_write(void)
  | TLS extensions tests
  *----------------------------------------------------------------------------*/
 
+#if defined(HAVE_SNI) || defined(HAVE_ALPN)
+/* connection test runner */
+static void test_wolfSSL_client_server(callback_functions* client_callbacks,
+                                       callback_functions* server_callbacks)
+{
+#ifdef HAVE_IO_TESTS_DEPENDENCIES
+    tcp_ready ready;
+    func_args client_args;
+    func_args server_args;
+    THREAD_TYPE serverThread;
+
+    StartTCP();
+
+    client_args.callbacks = client_callbacks;
+    server_args.callbacks = server_callbacks;
+
+#ifdef WOLFSSL_TIRTOS
+    fdOpenSession(Task_self());
+#endif
+
+    /* RUN Server side */
+    InitTcpReady(&ready);
+    server_args.signal = &ready;
+    client_args.signal = &ready;
+    start_thread(run_wolfssl_server, &server_args, &serverThread);
+    wait_tcp_ready(&server_args);
+
+    /* RUN Client side */
+    run_wolfssl_client(&client_args);
+    join_thread(serverThread);
+
+    FreeTcpReady(&ready);
+#ifdef WOLFSSL_TIRTOS
+    fdCloseSession(Task_self());
+#endif
+
+#else
+    (void)client_callbacks;
+    (void)server_callbacks;
+#endif
+}
+
+#endif /* defined(HAVE_SNI) || defined(HAVE_ALPN) */
+
+
 #ifdef HAVE_SNI
 static void test_wolfSSL_UseSNI_params(void)
 {
@@ -827,11 +872,6 @@ static void use_PSEUDO_MANDATORY_SNI_at_ctx(WOLFSSL_CTX* ctx)
                  WOLFSSL_SNI_ANSWER_ON_MISMATCH | WOLFSSL_SNI_ABORT_ON_ABSENCE);
 }
 
-static void verify_FATAL_ERROR_on_client(WOLFSSL* ssl)
-{
-    AssertIntEQ(FATAL_ERROR, wolfSSL_get_error(ssl, 0));
-}
-
 static void verify_UNKNOWN_SNI_on_server(WOLFSSL* ssl)
 {
     AssertIntEQ(UNKNOWN_SNI_HOST_NAME_E, wolfSSL_get_error(ssl, 0));
@@ -874,48 +914,12 @@ static void verify_SNI_fake_matching(WOLFSSL* ssl)
     AssertNotNull(request);
     AssertStrEQ("ww2.wolfssl.com", request);
 }
-/* END of connection tests callbacks */
 
-/* connection test runner */
-static void test_wolfSSL_client_server(callback_functions* client_callbacks,
-                                      callback_functions* server_callbacks)
+static void verify_FATAL_ERROR_on_client(WOLFSSL* ssl)
 {
-#ifdef HAVE_IO_TESTS_DEPENDENCIES
-    tcp_ready ready;
-    func_args client_args;
-    func_args server_args;
-    THREAD_TYPE serverThread;
-
-    StartTCP();
-
-    client_args.callbacks = client_callbacks;
-    server_args.callbacks = server_callbacks;
-
-#ifdef WOLFSSL_TIRTOS
-    fdOpenSession(Task_self());
-#endif
-
-    /* RUN Server side */
-    InitTcpReady(&ready);
-    server_args.signal = &ready;
-    client_args.signal = &ready;
-    start_thread(run_wolfssl_server, &server_args, &serverThread);
-    wait_tcp_ready(&server_args);
-
-    /* RUN Client side */
-    run_wolfssl_client(&client_args);
-    join_thread(serverThread);
-
-    FreeTcpReady(&ready);
-#ifdef WOLFSSL_TIRTOS
-    fdCloseSession(Task_self());
-#endif
-
-#else
-    (void)client_callbacks;
-    (void)server_callbacks;
-#endif
+    AssertIntEQ(FATAL_ERROR, wolfSSL_get_error(ssl, 0));
 }
+/* END of connection tests callbacks */
 
 static void test_wolfSSL_UseSNI_connection(void)
 {
@@ -1197,6 +1201,240 @@ static void test_wolfSSL_UseSupportedCurve(void)
 #endif
 }
 
+#ifdef HAVE_ALPN
+
+static void verify_ALPN_FATAL_ERROR_on_client(WOLFSSL* ssl)
+{
+    AssertIntEQ(UNKNOWN_ALPN_PROTOCOL_NAME_E, wolfSSL_get_error(ssl, 0));
+}
+
+static void use_ALPN_all(WOLFSSL* ssl)
+{
+    /* http/1.1,spdy/1,spdy/2,spdy/3 */
+    char alpn_list[] = {0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31, 0x2c,
+                        0x73, 0x70, 0x64, 0x79, 0x2f, 0x31, 0x2c,
+                        0x73, 0x70, 0x64, 0x79, 0x2f, 0x32, 0x2c,
+                        0x73, 0x70, 0x64, 0x79, 0x2f, 0x33};
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, alpn_list, sizeof(alpn_list),
+                                             WOLFSSL_ALPN_FAILED_ON_MISMATCH));
+}
+
+static void use_ALPN_all_continue(WOLFSSL* ssl)
+{
+    /* http/1.1,spdy/1,spdy/2,spdy/3 */
+    char alpn_list[] = {0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31, 0x2c,
+        0x73, 0x70, 0x64, 0x79, 0x2f, 0x31, 0x2c,
+        0x73, 0x70, 0x64, 0x79, 0x2f, 0x32, 0x2c,
+        0x73, 0x70, 0x64, 0x79, 0x2f, 0x33};
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, alpn_list, sizeof(alpn_list),
+                                             WOLFSSL_ALPN_CONTINUE_ON_MISMATCH));
+}
+
+static void use_ALPN_one(WOLFSSL* ssl)
+{
+    /* spdy/2 */
+    char proto[] = {0x73, 0x70, 0x64, 0x79, 0x2f, 0x32};
+
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, proto, sizeof(proto),
+                                             WOLFSSL_ALPN_FAILED_ON_MISMATCH));
+}
+
+static void use_ALPN_unknown(WOLFSSL* ssl)
+{
+    /* http/2.0 */
+    char proto[] = {0x68, 0x74, 0x74, 0x70, 0x2f, 0x32, 0x2e, 0x30};
+
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, proto, sizeof(proto),
+                                             WOLFSSL_ALPN_FAILED_ON_MISMATCH));
+}
+
+static void use_ALPN_unknown_continue(WOLFSSL* ssl)
+{
+    /* http/2.0 */
+    char proto[] = {0x68, 0x74, 0x74, 0x70, 0x2f, 0x32, 0x2e, 0x30};
+
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, proto, sizeof(proto),
+                                             WOLFSSL_ALPN_CONTINUE_ON_MISMATCH));
+}
+
+static void verify_ALPN_not_matching_spdy3(WOLFSSL* ssl)
+{
+    /* spdy/3 */
+    char nego_proto[] = {0x73, 0x70, 0x64, 0x79, 0x2f, 0x33};
+
+    char *proto;
+    word16 protoSz = 0;
+
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
+
+    /* check value */
+    AssertIntNE(1, sizeof(nego_proto) == protoSz);
+    AssertIntNE(0, XMEMCMP(nego_proto, proto, sizeof(nego_proto)));
+}
+
+static void verify_ALPN_not_matching_continue(WOLFSSL* ssl)
+{
+    char *proto = NULL;
+    word16 protoSz = 0;
+
+    AssertIntEQ(SSL_ALPN_NOT_FOUND,
+                wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
+
+    /* check value */
+    AssertIntEQ(1, 0 == protoSz);
+    AssertIntEQ(1, NULL == proto);
+}
+
+static void verify_ALPN_matching_http1(WOLFSSL* ssl)
+{
+    /* http/1.1 */
+    char nego_proto[] = {0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31};
+    char *proto;
+    word16 protoSz = 0;
+
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
+
+    /* check value */
+    AssertIntEQ(1, sizeof(nego_proto) == protoSz);
+    AssertIntEQ(0, XMEMCMP(nego_proto, proto, protoSz));
+}
+
+static void verify_ALPN_matching_spdy2(WOLFSSL* ssl)
+{
+    /* spdy/2 */
+    char nego_proto[] = {0x73, 0x70, 0x64, 0x79, 0x2f, 0x32};
+    char *proto;
+    word16 protoSz = 0;
+
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_ALPN_GetProtocol(ssl, &proto, &protoSz));
+
+    /* check value */
+    AssertIntEQ(1, sizeof(nego_proto) == protoSz);
+    AssertIntEQ(0, XMEMCMP(nego_proto, proto, protoSz));
+}
+
+static void test_wolfSSL_UseALPN_connection(void)
+{
+    unsigned long i;
+    callback_functions callbacks[] = {
+        /* success case same list */
+        {0, 0, use_ALPN_all, 0},
+        {0, 0, use_ALPN_all, verify_ALPN_matching_http1},
+
+        /* success case only one for server */
+        {0, 0, use_ALPN_all, 0},
+        {0, 0, use_ALPN_one, verify_ALPN_matching_spdy2},
+
+        /* success case only one for client */
+        {0, 0, use_ALPN_one, 0},
+        {0, 0, use_ALPN_all, verify_ALPN_matching_spdy2},
+
+        /* success case none for client */
+        {0, 0, 0, 0},
+        {0, 0, use_ALPN_all, 0},
+
+        /* success case missmatch behavior but option 'continue' set */
+        {0, 0, use_ALPN_all_continue, verify_ALPN_not_matching_continue},
+        {0, 0, use_ALPN_unknown_continue, 0},
+
+        /* missmatch behavior with same list
+         * the first and only this one must be taken */
+        {0, 0, use_ALPN_all, 0},
+        {0, 0, use_ALPN_all, verify_ALPN_not_matching_spdy3},
+
+        /* default missmatch behavior */
+        {0, 0, use_ALPN_all, 0},
+        {0, 0, use_ALPN_unknown, verify_ALPN_FATAL_ERROR_on_client},
+    };
+
+    for (i = 0; i < sizeof(callbacks) / sizeof(callback_functions); i += 2) {
+        callbacks[i    ].method = wolfSSLv23_client_method;
+        callbacks[i + 1].method = wolfSSLv23_server_method;
+        test_wolfSSL_client_server(&callbacks[i], &callbacks[i + 1]);
+    }
+}
+
+static void test_wolfSSL_UseALPN_params(void)
+{
+    /* "http/1.1" */
+    char http1[] = {0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31};
+    /* "spdy/1" */
+    char spdy1[] = {0x73, 0x70, 0x64, 0x79, 0x2f, 0x31};
+    /* "spdy/2" */
+    char spdy2[] = {0x73, 0x70, 0x64, 0x79, 0x2f, 0x32};
+    /* "spdy/3" */
+    char spdy3[] = {0x73, 0x70, 0x64, 0x79, 0x2f, 0x33};
+    char buff[256];
+    word32 idx;
+
+    WOLFSSL_CTX *ctx = wolfSSL_CTX_new(wolfSSLv23_client_method());
+    WOLFSSL     *ssl = wolfSSL_new(ctx);
+
+    AssertNotNull(ctx);
+    AssertNotNull(ssl);
+
+    /* error cases */
+    AssertIntNE(SSL_SUCCESS,
+                wolfSSL_UseALPN(NULL, http1, sizeof(http1),
+                                WOLFSSL_ALPN_FAILED_ON_MISMATCH));
+    AssertIntNE(SSL_SUCCESS, wolfSSL_UseALPN(ssl, NULL, 0,
+                                             WOLFSSL_ALPN_FAILED_ON_MISMATCH));
+
+    /* success case */
+    /* http1 only */
+    AssertIntEQ(SSL_SUCCESS,
+                wolfSSL_UseALPN(ssl, http1, sizeof(http1),
+                                WOLFSSL_ALPN_FAILED_ON_MISMATCH));
+
+    /* http1, spdy1 */
+    memcpy(buff, http1, sizeof(http1));
+    idx = sizeof(http1);
+    buff[idx++] = ',';
+    memcpy(buff+idx, spdy1, sizeof(spdy1));
+    idx += sizeof(spdy1);
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, buff, idx,
+                                             WOLFSSL_ALPN_FAILED_ON_MISMATCH));
+
+    /* http1, spdy2, spdy1 */
+    memcpy(buff, http1, sizeof(http1));
+    idx = sizeof(http1);
+    buff[idx++] = ',';
+    memcpy(buff+idx, spdy2, sizeof(spdy2));
+    idx += sizeof(spdy2);
+    buff[idx++] = ',';
+    memcpy(buff+idx, spdy1, sizeof(spdy1));
+    idx += sizeof(spdy1);
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, buff, idx,
+                                             WOLFSSL_ALPN_FAILED_ON_MISMATCH));
+
+    /* spdy3, http1, spdy2, spdy1 */
+    memcpy(buff, spdy3, sizeof(spdy3));
+    idx = sizeof(spdy3);
+    buff[idx++] = ',';
+    memcpy(buff+idx, http1, sizeof(http1));
+    idx += sizeof(http1);
+    buff[idx++] = ',';
+    memcpy(buff+idx, spdy2, sizeof(spdy2));
+    idx += sizeof(spdy2);
+    buff[idx++] = ',';
+    memcpy(buff+idx, spdy1, sizeof(spdy1));
+    idx += sizeof(spdy1);
+    AssertIntEQ(SSL_SUCCESS, wolfSSL_UseALPN(ssl, buff, idx,
+                                             WOLFSSL_ALPN_CONTINUE_ON_MISMATCH));
+
+    wolfSSL_free(ssl);
+    wolfSSL_CTX_free(ctx);
+}
+#endif /* HAVE_ALPN  */
+
+static void test_wolfSSL_UseALPN(void)
+{
+#ifdef HAVE_ALPN
+    test_wolfSSL_UseALPN_connection();
+    test_wolfSSL_UseALPN_params();
+#endif
+}
+
 /*----------------------------------------------------------------------------*
  | Main
  *----------------------------------------------------------------------------*/
@@ -1220,6 +1458,7 @@ void ApiTest(void)
     test_wolfSSL_UseMaxFragment();
     test_wolfSSL_UseTruncatedHMAC();
     test_wolfSSL_UseSupportedCurve();
+    test_wolfSSL_UseALPN();
 
     test_wolfSSL_Cleanup();
     printf(" End API Tests\n");
diff --git a/wolfssl/error-ssl.h b/wolfssl/error-ssl.h
index c3ff047fc..f07796079 100644
--- a/wolfssl/error-ssl.h
+++ b/wolfssl/error-ssl.h
@@ -138,6 +138,8 @@ enum wolfSSL_ErrorCodes {
     RSA_SIGN_FAULT          = -403,        /* RSA Sign fault */
     HANDSHAKE_SIZE_ERROR    = -404,        /* Handshake message too large */
 
+    UNKNOWN_ALPN_PROTOCOL_NAME_E = -405,   /* Unrecognized protocol name Error*/
+
     /* add strings to SetErrorString !!!!! */
 
     /* begin negotiation parameter errors */
diff --git a/wolfssl/internal.h b/wolfssl/internal.h
index 85afad61c..ec3a763a8 100644
--- a/wolfssl/internal.h
+++ b/wolfssl/internal.h
@@ -1466,7 +1466,8 @@ typedef enum {
     ELLIPTIC_CURVES        = 0x000a,
     SESSION_TICKET         = 0x0023,
     SECURE_RENEGOTIATION   = 0xff01,
-    WOLFSSL_QSH            = 0x0018  /* Quantum-Safe-Hybrid */
+    WOLFSSL_QSH            = 0x0018, /* Quantum-Safe-Hybrid */
+    WOLFSSL_ALPN           = 0x0010  /* Application-Layer Protocol Name */
 } TLSX_Type;
 
 typedef struct TLSX {
@@ -1499,7 +1500,8 @@ WOLFSSL_LOCAL int    TLSX_Parse(WOLFSSL* ssl, byte* input, word16 length,
    || defined(HAVE_TRUNCATED_HMAC)       \
    || defined(HAVE_SUPPORTED_CURVES)     \
    || defined(HAVE_SECURE_RENEGOTIATION) \
-   || defined(HAVE_SESSION_TICKET)
+   || defined(HAVE_SESSION_TICKET) \
+   || defined(HAVE_ALPN)
 
 #error Using TLS extensions requires HAVE_TLS_EXTENSIONS to be defined.
 
@@ -1533,6 +1535,24 @@ WOLFSSL_LOCAL int    TLSX_SNI_GetFromBuffer(const byte* buffer, word32 bufferSz,
 
 #endif /* HAVE_SNI */
 
+/* Application-layer Protocol Name */
+#ifdef HAVE_ALPN
+typedef struct ALPN {
+    char*        protocol_name; /* ALPN protocol name */
+    struct ALPN* next;          /* List Behavior      */
+    byte         options;       /* Behaviour options */
+    byte         negociated;    /* ALPN protocol negociated or not */
+} ALPN;
+
+WOLFSSL_LOCAL int TLSX_ALPN_GetRequest(TLSX* extensions,
+                                       void** data, word16 *dataSz);
+
+WOLFSSL_LOCAL int TLSX_UseALPN(TLSX** extensions, const void* data,
+                               word16 size, byte options);
+
+WOLFSSL_LOCAL int TLSX_ALPN_SetOptions(TLSX** extensions, const byte option);
+#endif /* HAVE_ALPN */
+
 /* Maximum Fragment Length */
 #ifdef HAVE_MAX_FRAGMENT
 
diff --git a/wolfssl/ssl.h b/wolfssl/ssl.h
index 19a7b2cf5..b1a890e36 100644
--- a/wolfssl/ssl.h
+++ b/wolfssl/ssl.h
@@ -187,7 +187,8 @@ enum AlertDescription {
     protocol_version        = 70,
     #endif
     no_renegotiation        = 100,
-    unrecognized_name       = 112
+    unrecognized_name       = 112,
+    no_application_protocol = 120
 };
 
 
@@ -673,6 +674,7 @@ enum { /* ssl Constants */
     SSL_SUCCESS         =  1,
     SSL_SHUTDOWN_NOT_DONE =  2,  /* call wolfSSL_shutdown again to complete */
 
+    SSL_ALPN_NOT_FOUND  = -9,
     SSL_BAD_CERTTYPE    = -8,
     SSL_BAD_STAT        = -7,
     SSL_BAD_PATH        = -6,
@@ -1347,6 +1349,31 @@ WOLFSSL_API int wolfSSL_SNI_GetFromBuffer(
 #endif
 #endif
 
+/* Application-Layer Protocol Name */
+#ifdef HAVE_ALPN
+
+/* ALPN status code */
+enum {
+    WOLFSSL_ALPN_NO_MATCH = 0,
+    WOLFSSL_ALPN_MATCH    = 1,
+    WOLFSSL_ALPN_CONTINUE_ON_MISMATCH = 2,
+    WOLFSSL_ALPN_FAILED_ON_MISMATCH = 4,
+};
+
+enum {
+    WOLFSSL_MAX_ALPN_PROTO_NAME_LEN = 255,
+    WOLFSSL_MAX_ALPN_NUMBER = 257
+};
+
+WOLFSSL_API int wolfSSL_UseALPN(WOLFSSL* ssl, char *protocol_name_list,
+                                unsigned int protocol_name_listSz,
+                                unsigned char options);
+
+WOLFSSL_API int wolfSSL_ALPN_GetProtocol(WOLFSSL* ssl, char **protocol_name,
+                                         unsigned short *size);
+
+#endif /* HAVE_ALPN */
+
 /* Maximum Fragment Length */
 #ifdef HAVE_MAX_FRAGMENT
 
diff --git a/wolfssl/wolfcrypt/types.h b/wolfssl/wolfcrypt/types.h
index 55969ee23..d97636e0a 100644
--- a/wolfssl/wolfcrypt/types.h
+++ b/wolfssl/wolfcrypt/types.h
@@ -216,7 +216,7 @@
 	        #define XSTRNCASECMP(s1,s2,n) _strnicmp((s1),(s2),(n))
 	    #endif
 
-        #ifdef WOLFSSL_CERT_EXT
+        #if defined(WOLFSSL_CERT_EXT) || defined(HAVE_ALPN)
             /* use only Thread Safe version of strtok */
             #ifndef USE_WINDOWS_API
                 #define XSTRTOK strtok_r

From 52cdf85e265768d489aad611802075b0f01b3c38 Mon Sep 17 00:00:00 2001
From: toddouska 
Date: Wed, 14 Oct 2015 09:18:05 -0700
Subject: [PATCH 60/77] move touch fips files for non fips distribution to
 autogen.sh for cleaner autoconf handling

---
 Makefile.am  | 3 ---
 autogen.sh   | 3 +++
 configure.ac | 5 -----
 3 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 65b4d3d82..f3ad8ecd5 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -113,9 +113,6 @@ tests/unit.log: testsuite/testsuite.log
 
 DISTCLEANFILES+= cyassl-config
 DISTCLEANFILES+= wolfssl-config
-# fips files shouldn't be left after make distclean
-DISTCLEANFILES+= ctaocrypt/src/fips.c
-DISTCLEANFILES+= ctaocrypt/src/fips_test.c
 
 maintainer-clean-local:
 	-rm Makefile.in
diff --git a/autogen.sh b/autogen.sh
index 89e475c0b..196764e1f 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -15,6 +15,9 @@ fi
 # If this is a source checkout then call autoreconf with error as well
 if test -d .git; then
   WARNINGS="all,error"
+  # touch fips files for non fips distribution
+  touch ./ctaocrypt/src/fips.c
+  touch ./ctaocrypt/src/fips_test.c
 else
   WARNINGS="all"
 fi
diff --git a/configure.ac b/configure.ac
index 726181904..0c505b85b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2319,11 +2319,6 @@ AC_OUTPUT
 echo "---"
 echo "Running make clean..."
 make clean >/dev/null 2>&1
-# Touch files that may not be in repository
-echo "Touching File..."
-touch ctaocrypt/src/fips.c
-touch ctaocrypt/src/fips_test.c
-echo
 
 # generate user options header
 echo "---"

From d2cc582939cf1b7ee57a2be3f48105e89ab4947c Mon Sep 17 00:00:00 2001
From: Jacob Barthelmeh 
Date: Wed, 14 Oct 2015 10:51:39 -0600
Subject: [PATCH 61/77] fips related macros for configurations using AES direct
 and DES ECB

---
 cyassl/ctaocrypt/settings_comp.h | 15 ++++++++++++++-
 wolfssl/wolfcrypt/rsa.h          |  2 +-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/cyassl/ctaocrypt/settings_comp.h b/cyassl/ctaocrypt/settings_comp.h
index 89278a2db..f1832c3f0 100644
--- a/cyassl/ctaocrypt/settings_comp.h
+++ b/cyassl/ctaocrypt/settings_comp.h
@@ -50,9 +50,22 @@
 #if defined(NO_WOLFSSL_MEMORY) && !defined(NO_CYASSL_MEMORY)
     #define NO_CYASSL_MEMORY
 #endif
-#ifdef WOLFSSL_KEY_GEN
+#if defined(WOLFSSL_KEY_GEN) && !defined(CYASSL_KEY_GEN)
     #define CYASSL_KEY_GEN
 #endif
 
+/* AES */
+#if defined(WOLFSSL_AES_DIRECT) && !defined(CYASSL_AES_DIRECT)
+    #define CYASSL_AES_DIRECT
+#endif
+#if defined(WOLFSSL_AES_COUNTER) && !defined(CYASSL_AES_COUNTER)
+    #define CYASSL_AES_COUNTER
+#endif
+
+/* DES */
+#if defined(WOLFSSL_DES_ECB) && !defined(CYASSL_DES_ECB)
+    #define CYASSL_DES_ECB
+#endif
+
 #endif /* CTAO_CRYPT_SETTINGS_C_H */
 
diff --git a/wolfssl/wolfcrypt/rsa.h b/wolfssl/wolfcrypt/rsa.h
index 9da3becf2..8141367c9 100644
--- a/wolfssl/wolfcrypt/rsa.h
+++ b/wolfssl/wolfcrypt/rsa.h
@@ -99,13 +99,13 @@ WOLFSSL_API int  wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz,
                                         const byte* e, word32 eSz, RsaKey* key);
 #ifdef WOLFSSL_KEY_GEN
     WOLFSSL_API int wc_RsaKeyToDer(RsaKey*, byte* output, word32 inLen);
-    WOLFSSL_API int wc_RsaKeyToPublicDer(RsaKey*, byte* output, word32 inLen);
 #endif
 #endif /* HAVE_FIPS*/
 WOLFSSL_API int  wc_RsaFlattenPublicKey(RsaKey*, byte*, word32*, byte*,
                                                                        word32*);
 
 #ifdef WOLFSSL_KEY_GEN
+    WOLFSSL_API int wc_RsaKeyToPublicDer(RsaKey*, byte* output, word32 inLen);
     WOLFSSL_API int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng);
 #endif
 

From 56af895c680953a333b46d5569b4da7e623751aa Mon Sep 17 00:00:00 2001
From: toddouska 
Date: Wed, 14 Oct 2015 10:48:37 -0700
Subject: [PATCH 62/77] make sure pubkey in ecc private key has size

---
 wolfcrypt/src/asn.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c
index 0b41d5d58..5eeae21d4 100644
--- a/wolfcrypt/src/asn.c
+++ b/wolfcrypt/src/asn.c
@@ -8100,6 +8100,10 @@ int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key,
             else if (GetLength(input, inOutIdx, &length, inSz) < 0) {
                 ret = ASN_PARSE_E;
             }
+            else if (length <= 0) {
+                /* pubkey needs some size */
+                ret = ASN_INPUT_E;
+            }
             else {
                 b = input[*inOutIdx];
                 *inOutIdx += 1;

From d6cb20321056354abd330971f0a92257cd4493c8 Mon Sep 17 00:00:00 2001
From: toddouska 
Date: Wed, 14 Oct 2015 11:16:22 -0700
Subject: [PATCH 63/77] fix tlsx library proper build with NO_SERVER or
 NO_CLIENT

---
 src/tls.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/tls.c b/src/tls.c
index cece0696c..4c7683fc5 100644
--- a/src/tls.c
+++ b/src/tls.c
@@ -567,7 +567,7 @@ static INLINE void ato16(const byte* c, word16* u16)
     *u16 = (c[0] << 8) | (c[1]);
 }
 
-#ifdef HAVE_SNI
+#if defined(HAVE_SNI) && !defined(NO_WOLFSSL_SERVER)
 /* convert a 24 bit integer into a 32 bit one */
 static INLINE void c24to32(const word24 u24, word32* u32)
 {
@@ -1282,6 +1282,8 @@ static word16 TLSX_SNI_Write(SNI* list, byte* output)
     return offset;
 }
 
+#ifndef NO_WOLFSSL_SERVER
+
 /** Finds a SNI object in the provided list. */
 static SNI* TLSX_SNI_Find(SNI *list, byte type)
 {
@@ -1293,7 +1295,6 @@ static SNI* TLSX_SNI_Find(SNI *list, byte type)
     return sni;
 }
 
-#ifndef NO_WOLFSSL_SERVER
 
 /** Sets the status of a SNI object. */
 static void TLSX_SNI_SetStatus(TLSX* extensions, byte type, byte status)
@@ -1334,7 +1335,8 @@ static int TLSX_SNI_Parse(WOLFSSL* ssl, byte* input, word16 length,
     if (!extension)
         extension = TLSX_Find(ssl->ctx->extensions, SERVER_NAME_INDICATION);
 
-
+    (void)isRequest;
+    (void)input;
 
     if (!extension || !extension->data) {
 #if defined(WOLFSSL_ALWAYS_KEEP_SNI) && !defined(NO_WOLFSSL_SERVER)
@@ -1429,6 +1431,8 @@ static int TLSX_SNI_Parse(WOLFSSL* ssl, byte* input, word16 length,
 
 static int TLSX_SNI_VerifyParse(WOLFSSL* ssl,  byte isRequest)
 {
+    (void)ssl;
+
     if (isRequest) {
     #ifndef NO_WOLFSSL_SERVER
         TLSX* ctx_ext = TLSX_Find(ssl->ctx->extensions, SERVER_NAME_INDICATION);
@@ -1721,6 +1725,8 @@ static word16 TLSX_MFL_Write(byte* data, byte* output)
 static int TLSX_MFL_Parse(WOLFSSL* ssl, byte* input, word16 length,
                                                                  byte isRequest)
 {
+    (void)isRequest;
+
     if (length != ENUM_LEN)
         return BUFFER_ERROR;
 
@@ -1795,6 +1801,8 @@ int TLSX_UseMaxFragment(TLSX** extensions, byte mfl)
 static int TLSX_THM_Parse(WOLFSSL* ssl, byte* input, word16 length,
                                                                  byte isRequest)
 {
+    (void)isRequest;
+
     if (length != 0 || input == NULL)
         return BUFFER_ERROR;
 

From ee8537fb6dc25da85de8aafd9a4b3b94e63053c1 Mon Sep 17 00:00:00 2001
From: Ludovic FLAMENT 
Date: Wed, 14 Oct 2015 20:53:30 +0200
Subject: [PATCH 64/77] Merge branch 'master' of
 https://github.com/wolfssl/wolfssl

---
 IDE/MDK5-ARM/Conf/config-Crypt.h              |  198 +-
 IDE/MDK5-ARM/Conf/config-CyaSSL.h             |  144 -
 IDE/MDK5-ARM/Conf/user_settings.h             |   34 +
 IDE/MDK5-ARM/Inc/cert_data.h                  |   39 -
 IDE/MDK5-ARM/Inc/config.h                     |   41 +-
 IDE/MDK5-ARM/Inc/cyassl_MDK_ARM.h             |  106 -
 .../CryptBenchmark/CryptBenchmark.uvoptx      |  722 +--
 .../CryptBenchmark/CryptBenchmark.uvprojx     |  546 +-
 .../Projects/CryptBenchmark/benchmark.c       | 1313 -----
 .../Projects/CryptTest/CryptTest.uvoptx       |  731 +--
 .../Projects/CryptTest/CryptTest.uvprojx      |  544 +-
 IDE/MDK5-ARM/Projects/CryptTest/cert_data.c   |   28 -
 IDE/MDK5-ARM/Projects/CryptTest/test.c        | 4863 -----------------
 .../Projects/CyaSSL-Full/CyaSSL-Full.uvoptx   | 1366 -----
 .../Projects/CyaSSL-Full/CyaSSL-Full.uvprojx  | 1185 ----
 .../CyaSSL-Full/RTE/wolfSSL/settings.h        |  667 ---
 IDE/MDK5-ARM/Projects/CyaSSL-Full/benchmark.c | 1222 -----
 IDE/MDK5-ARM/Projects/CyaSSL-Full/cert_data.c |   28 -
 IDE/MDK5-ARM/Projects/CyaSSL-Full/client.c    |  858 ---
 .../Projects/CyaSSL-Full/echoclient.c         |  282 -
 .../Projects/CyaSSL-Full/echoserver.c         |  368 --
 IDE/MDK5-ARM/Projects/CyaSSL-Full/server.c    |  605 --
 IDE/MDK5-ARM/Projects/CyaSSL-Full/test.c      | 4758 ----------------
 .../Projects/CyaSSL-Full/time-dummy.c         |   34 -
 .../Projects/EchoClient/EchoClient.uvoptx     |  988 +---
 .../Projects/EchoClient/EchoClient.uvprojx    |  864 ++-
 IDE/MDK5-ARM/Projects/EchoClient/echoclient.c |  282 -
 .../Projects/EchoServer/EchoServer.uvoptx     | 1027 +---
 .../Projects/EchoServer/EchoServer.uvprojx    |  868 ++-
 IDE/MDK5-ARM/Projects/EchoServer/echoserver.c |  368 --
 .../Projects/SimpleClient/SimpleClient.uvoptx |  995 +---
 IDE/MDK5-ARM/Projects/SimpleClient/client.c   |  862 ---
 .../SimpleClient/simpleClient.uvprojx         |  890 ++-
 .../Projects/SimpleServer/SimpleServer.uvoptx |  992 +---
 .../SimpleServer/SimpleServer.uvprojx         |  871 ++-
 IDE/MDK5-ARM/Projects/SimpleServer/server.c   |  605 --
 .../Abstract.txt                              |    0
 .../{CyaSSL-Full => wolfSSL-Full}/main.c      |   88 +-
 .../{CyaSSL-Full => wolfSSL-Full}/shell.c     |  162 +-
 .../time-CortexM3-4.c                         |    2 +
 .../Projects/wolfSSL-Full/wolfsslFull.uvoptx  |  387 ++
 .../Projects/wolfSSL-Full/wolfsslFull.uvprojx |  950 ++++
 .../Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx   |  314 ++
 .../Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx  |  782 +++
 IDE/MDK5-ARM/Src/cert_data.c                  |   28 -
 IDE/MDK5-ARM/Src/cyassl_MDK_ARM.c             |  247 -
 IDE/iOS/README.md                             |   44 +-
 IDE/iOS/include.am                            |    3 +
 IDE/iOS/user_settings.h                       |   16 +
 .../wolfssl-FIPS.xcodeproj/project.pbxproj    |  505 +-
 IDE/iOS/wolfssl.xcodeproj/project.pbxproj     |  482 +-
 .../contents.xcworkspacedata                  |   13 +
 .../project.pbxproj                           |  347 ++
 Makefile.am                                   |    3 -
 autogen.sh                                    |    3 +
 configure.ac                                  |    6 +-
 cyassl/ctaocrypt/settings_comp.h              |   15 +-
 examples/client/client.c                      |   12 +-
 examples/echoclient/echoclient.c              |   18 +-
 examples/server/server.c                      |   10 +-
 src/internal.c                                |   36 +-
 src/io.c                                      |   19 +-
 src/ssl.c                                     |   15 +-
 src/tls.c                                     |   14 +-
 testsuite/testsuite.c                         |   38 +-
 wolfcrypt/src/aes.c                           |  227 +-
 wolfcrypt/src/asn.c                           |    4 +
 wolfcrypt/src/des3.c                          |   32 +-
 wolfcrypt/src/md5.c                           |   14 +-
 wolfcrypt/src/sha.c                           |   22 +-
 wolfcrypt/src/sha256.c                        |   17 +-
 wolfcrypt/src/wc_port.c                       |   38 +
 wolfcrypt/test/test.c                         |    1 +
 wolfssl/test.h                                |  123 +-
 wolfssl/wolfcrypt/rsa.h                       |    2 +-
 wolfssl/wolfcrypt/wc_port.h                   |   27 +
 76 files changed, 6524 insertions(+), 28836 deletions(-)
 delete mode 100644 IDE/MDK5-ARM/Conf/config-CyaSSL.h
 create mode 100644 IDE/MDK5-ARM/Conf/user_settings.h
 delete mode 100644 IDE/MDK5-ARM/Inc/cert_data.h
 delete mode 100644 IDE/MDK5-ARM/Inc/cyassl_MDK_ARM.h
 delete mode 100644 IDE/MDK5-ARM/Projects/CryptBenchmark/benchmark.c
 delete mode 100644 IDE/MDK5-ARM/Projects/CryptTest/cert_data.c
 delete mode 100644 IDE/MDK5-ARM/Projects/CryptTest/test.c
 delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvoptx
 delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvprojx
 delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/RTE/wolfSSL/settings.h
 delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/benchmark.c
 delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/cert_data.c
 delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/client.c
 delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/echoclient.c
 delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/echoserver.c
 delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/server.c
 delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/test.c
 delete mode 100644 IDE/MDK5-ARM/Projects/CyaSSL-Full/time-dummy.c
 delete mode 100644 IDE/MDK5-ARM/Projects/EchoClient/echoclient.c
 delete mode 100644 IDE/MDK5-ARM/Projects/EchoServer/echoserver.c
 delete mode 100644 IDE/MDK5-ARM/Projects/SimpleClient/client.c
 delete mode 100644 IDE/MDK5-ARM/Projects/SimpleServer/server.c
 rename IDE/MDK5-ARM/Projects/{CyaSSL-Full => wolfSSL-Full}/Abstract.txt (100%)
 rename IDE/MDK5-ARM/Projects/{CyaSSL-Full => wolfSSL-Full}/main.c (53%)
 rename IDE/MDK5-ARM/Projects/{CyaSSL-Full => wolfSSL-Full}/shell.c (80%)
 rename IDE/MDK5-ARM/Projects/{CyaSSL-Full => wolfSSL-Full}/time-CortexM3-4.c (97%)
 create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx
 create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx
 create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx
 create mode 100644 IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx
 delete mode 100644 IDE/MDK5-ARM/Src/cert_data.c
 delete mode 100644 IDE/MDK5-ARM/Src/cyassl_MDK_ARM.c
 create mode 100644 IDE/iOS/user_settings.h
 create mode 100644 IDE/iOS/wolfssl.xcworkspace/contents.xcworkspacedata
 create mode 100644 IDE/iOS/wolfssl_testsuite.xcodeproj/project.pbxproj

diff --git a/IDE/MDK5-ARM/Conf/config-Crypt.h b/IDE/MDK5-ARM/Conf/config-Crypt.h
index 2004294cf..baaf43f2e 100644
--- a/IDE/MDK5-ARM/Conf/config-Crypt.h
+++ b/IDE/MDK5-ARM/Conf/config-Crypt.h
@@ -1,4 +1,4 @@
-/* config-FS.h
+/* config-Crypt.h
  *
  * Copyright (C) 2006-2015 wolfSSL Inc.
  *
@@ -26,7 +26,7 @@
 
 //  Cert/Key Strage
 //        Cert Storage <0=> SD Card <1=> Mem Buff (1024bytes) <2=> Mem Buff (2048bytes)
-#define MDK_CONF_CERT_BUFF 0
+#define MDK_CONF_CERT_BUFF 2
 #if MDK_CONF_CERT_BUFF== 1
 #define USE_CERT_BUFFERS_1024
 #elif MDK_CONF_CERT_BUFF == 2
@@ -36,13 +36,10 @@
 
 //  Crypt Algrithm
 
-//       MD5, SHA, SHA-256, AES, RC4, ASN, RSA
-//        
-
 //      MD2
-#define MDK_CONF_MD2 0
+#define MDK_CONF_MD2 1
 #if MDK_CONF_MD2 == 1
-#define CYASSL_MD2
+#define WOLFSSL_MD2
 #endif
 //  
 //      MD4
@@ -51,23 +48,46 @@
 #define NO_MD4
 #endif
 //  
+//      MD5
+#define MDK_CONF_MD5 1
+#if MDK_CONF_MD5 == 0
+#define NO_MD5
+#endif
+//  
+//      SHA
+#define MDK_CONF_SHA  1
+#if MDK_CONF_SHA == 0
+#define NO_SHA
+#endif
+//  
+//      SHA-256
+#define MDK_CONF_SHA256 1
+#if MDK_CONF_SHA256 == 0
+#define NO_SHA256
+#endif
+//  
 //      SHA-384
-//          This has to be with SHA512
-#define MDK_CONF_SHA384 0
+#define MDK_CONF_SHA384 1
 #if MDK_CONF_SHA384 == 1
-#define CYASSL_SHA384
+#define WOLFSSL_SHA384
 #endif
 //  
 //      SHA-512          
-#define MDK_CONF_SHA512     0
+#define MDK_CONF_SHA512     1
 #if MDK_CONF_SHA512     == 1
-#define CYASSL_SHA512   
+#define WOLFSSL_SHA512   
 #endif
 //  
 //      RIPEMD
-#define MDK_CONF_RIPEMD 0
+#define MDK_CONF_RIPEMD 1
 #if MDK_CONF_RIPEMD == 1
-#define CYASSL_RIPEMD
+#define WOLFSSL_RIPEMD
+#endif
+//  
+//      BLAKE2
+#define MDK_CONF_BLAKE2 0
+#if MDK_CONF_BLAKE2 == 1
+#define HAVE_BLAKE2
 #endif
 //  
 //      HMAC
@@ -76,40 +96,83 @@
 #define NO_HMAC
 #endif
 //  
-//      HC128
-#define MDK_CONF_HC128 0
-#if MDK_CONF_HC128 == 1
-#define HAVE_HC128
+//      HMAC KDF
+#define MDK_CONF_HKDF 1
+#if MDK_CONF_HKDF == 1
+#define HAVE_HKDF
 #endif
 //  
-//  RABBIT
+
+//      AES CCM
+#define MDK_CONF_AESCCM 1
+#if MDK_CONF_AESCCM == 1
+#define HAVE_AESCCM
+#endif
+//  
+//      AES GCM
+#define MDK_CONF_AESGCM 1
+#if MDK_CONF_AESGCM == 1
+#define HAVE_AESGCM
+#endif
+//  
+
+//      RC4
+#define MDK_CONF_RC4 1
+#if MDK_CONF_RC4 == 0
+#define NO_RC4
+#endif
+//  
+
+//      HC128
+#define MDK_CONF_HC128 1
+#if MDK_CONF_AESGCM == 0
+#define NO_HC128
+#endif
+//  
+
+//      RABBIT
 #define MDK_CONF_RABBIT 1
-#if MDK_CONF_RABBI == 0
+#if MDK_CONF_RABBIT == 0
 #define NO_RABBIT
 #endif
 //  
 
-//      AEAD     
-#define MDK_CONF_AEAD 0
-#if MDK_CONF_AEAD == 1
-#define HAVE_AEAD
+//      CHACHA
+#define MDK_CONF_CHACHA 1
+#if MDK_CONF_CHACHA == 1
+#define HAVE_CHACHA
 #endif
 //  
+
+//      POLY1305
+#define MDK_CONF_POLY1305 1
+#if MDK_CONF_POLY1305 == 0
+#define HAVE_POLY1305
+#endif
+//  
+
 //      DES3
 #define MDK_CONF_DES3 1
 #if MDK_CONF_DES3 == 0
 #define NO_DES3
 #endif
 //  
+
+//      AES
+#define MDK_CONF_AES 1
+#if MDK_CONF_AES == 0
+#define NO_AES
+#endif
+//  
+
 //      CAMELLIA
-#define MDK_CONF_CAMELLIA 0
+#define MDK_CONF_CAMELLIA 1
 #if MDK_CONF_CAMELLIA == 1
 #define HAVE_CAMELLIA
 #endif
 //  
 
 //      DH
-//              need this for CYASSL_SERVER, OPENSSL_EXTRA
 #define MDK_CONF_DH 1
 #if MDK_CONF_DH == 0
 #define NO_DH
@@ -121,6 +184,14 @@
 #define NO_DSA
 #endif
 //  
+
+//      SRP
+#define MDK_CONF_SRP 1 
+#if MDK_CONF_SRP == 1
+#define HAVE_SRP
+#endif
+//  
+
 //      PWDBASED
 #define MDK_CONF_PWDBASED 1
 #if MDK_CONF_PWDBASED == 0
@@ -129,30 +200,35 @@
 //  
 
 //      ECC
-#define MDK_CONF_ECC 0
+#define MDK_CONF_ECC 1
 #if MDK_CONF_ECC == 1
 #define HAVE_ECC
 #endif
 //  
-//      PSK
-#define MDK_CONF_PSK 1
-#if MDK_CONF_PSK == 0
-#define NO_PSK
+
+//      CURVE25519
+#define MDK_CONF_CURVE25519 1
+#if MDK_CONF_CURVE25519 == 1
+#define HAVE_CURVE25519
+#define CURVED25519_SMALL
+//#define TFM_ECC256
 #endif
 //  
-//      AESCCM (Turn off Hardware Crypt)
-#define MDK_CONF_AESCCM 0
-#if MDK_CONF_AESCCM == 1
-#define HAVE_AESCCM
+
+//      ED25519
+#define MDK_CONF_ED25519 1
+#if MDK_CONF_ED25519 == 1
+#define HAVE_ED25519
 #endif
 //  
-//      AESGCM (Turn off Hardware Crypt)
-#define MDK_CONF_AESGCM 0
-#if MDK_CONF_AESGCM == 1
-#define HAVE_AESGCM
-#define BUILD_AESGCM
+
+//      PKCS7
+#define MDK_CONF_PKCS7 0
+#if MDK_CONF_PKCS7 == 1
+#define HAVE_PKCS7
 #endif
 //  
+
 //      NTRU (need License, "crypto_ntru.h")
 #define MDK_CONF_NTRU 0
 #if MDK_CONF_NTRU == 1
@@ -179,6 +255,48 @@
 
 // 
 
+//  Other Settings
+
+//      Use Fast Math
+#define MDK_CONF_FASTMATH 1
+#if MDK_CONF_FASTMATH == 1
+#define USE_FAST_MATH
+#define TFM_TIMING_RESISTANT
+#endif
+//  
+//      Small Stack
+#define MDK_CONF_SmallStack 0
+#if MDK_CONF_SmallStack == 0
+#define NO_WOLFSSL_SMALL_STACK
+#endif
+//  
+//      ErrNo.h
+#define MDK_CONF_ErrNo 1
+#if MDK_CONF_ErrNo == 1
+#define HAVE_ERRNO
+#endif
+//  
+//      Error Strings
+#define MDK_CONF_ErrorStrings 1
+#if MDK_CONF_ErrorStrings == 0
+#define NO_ERROR_STRINGS
+#endif
+//  
+//      zlib (need "zlib.h")
+#define MDK_CONF_LIBZ 0
+#if MDK_CONF_LIBZ == 1
+#define HAVE_LIBZ
+#endif
+//  
+//      CAVIUM (need CAVIUM headers)
+#define MDK_CONF_CAVIUM 0
+#if MDK_CONF_CAVIUM == 1
+#define HAVE_CAVIUM
+#endif
+//  
+
+//  
+
 
 
 //
diff --git a/IDE/MDK5-ARM/Conf/config-CyaSSL.h b/IDE/MDK5-ARM/Conf/config-CyaSSL.h
deleted file mode 100644
index 9e9d13844..000000000
--- a/IDE/MDK5-ARM/Conf/config-CyaSSL.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* config-RTX-TCP-FS.h
- *
- * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
-
-
-/**** CyaSSL for KEIL-RL Configuration ****/
-
-#define __CORTEX_M3__
-#define CYASSL_MDK_ARM
-#define NO_WRITEV
-#define NO_CYASSL_DIR
-#define NO_MAIN_DRIVER
-
-
-#define CYASSL_DER_LOAD
-#define HAVE_NULL_CIPHER
-
-#define HAVE_KEIL_RTX
-#define CYASSL_CMSIS_RTOS
-#define CYASSL_KEIL_TCP_NET
-
-
-// <<< Use Configuration Wizard in Context Menu >>>
-//  CyaSSL Configuration
-
-//     SSL (Included by default)
-//     
-
-//      TLS 
-#define MDK_CONF_TLS 1
-#if MDK_CONF_TLS == 0
-#define NO_TLS
-#endif
-//  
-
-//      CRL
-#define MDK_CONF_DER_LOAD 0
-#if MDK_CONF_DER_LOAD == 1
-#define CYASSL_DER_LOAD
-#endif
-//  
-//      OpenSSL Extra
-#define MDK_CONF_OPENSSL_EXTRA 1
-#if MDK_CONF_OPENSSL_EXTRA == 1
-#define OPENSSL_EXTRA
-#endif
-//  
-//
-
-//  Cert/Key Generation
-//      CertGen
-#define MDK_CONF_CERT_GEN 0
-#if MDK_CONF_CERT_GEN == 1
-#define CYASSL_CERT_GEN
-#endif
-//  
-//      KeyGen
-#define MDK_CONF_KEY_GEN 0
-#if MDK_CONF_KEY_GEN == 1
-#define CYASSL_KEY_GEN
-#endif
-//  
-//
-
-//  Others
-
-//      Inline
-#define MDK_CONF_INLINE 0
-#if MDK_CONF_INLINE == 0
-#define NO_INLINE
-#endif
-//  
-//      Debug
-//              Debug Message
-#define MDK_CONF_DebugMessage 0
-#if MDK_CONF_DebugMessage == 1
-#define DEBUG_CYASSL
-#endif
-//         
-//              Check malloc
-#define MDK_CONF_CheckMalloc 1
-#if MDK_CONF_CheckMalloc == 1
-#define CYASSL_MALLOC_CHECK
-#endif
-//         
-
-
-//  
-//      ErrNo.h
-#define MDK_CONF_ErrNo 0
-#if MDK_CONF_ErrNo == 1
-#define HAVE_ERRNO
-#endif
-//  
-//      Error Strings
-#define MDK_CONF_ErrorStrings 1
-#if MDK_CONF_ErrorStrings == 0
-#define NO_ERROR_STRINGS
-#endif
-//  
-//      zlib (need "zlib.h")
-#define MDK_CONF_LIBZ 0
-#if MDK_CONF_LIBZ == 1
-#define HAVE_LIBZ
-#endif
-//  
-//      CAVIUM (need CAVIUM headers)
-#define MDK_CONF_CAVIUM 0
-#if MDK_CONF_CAVIUM == 1
-#define HAVE_CAVIUM
-#endif
-//  
-//      Small Stack
-#define MDK_CONF_SmallStack 1
-#if MDK_CONF_SmallStack == 0
-#define NO_CYASSL_SMALL_STACK
-#endif
-//  
-//      Use Fast Math
-#define MDK_CONF_FASTMATH 0
-#if MDK_CONF_FASTMATH == 1
-#define USE_FAST_MATH
-#endif
-//  
-//  
-
-// <<< end of configuration section >>>
diff --git a/IDE/MDK5-ARM/Conf/user_settings.h b/IDE/MDK5-ARM/Conf/user_settings.h
new file mode 100644
index 000000000..05cbd7425
--- /dev/null
+++ b/IDE/MDK5-ARM/Conf/user_settings.h
@@ -0,0 +1,34 @@
+#define NO_WRITEV
+#define NO_MAIN_DRIVER
+#define WOLFSSL_MDK_SHELL
+
+/* #define SINGLE_THREADED      or define RTOS  option */
+#define WOLFSSL_CMSIS_RTOS
+
+/* #define NO_FILESYSTEM         or define Filesystem option */
+#define WOLFSSL_KEIL_FS
+#define NO_WOLFSSL_DIR 
+#define WOLFSSL_NO_CURRDIR
+
+/* #define WOLFSSL_USER_IO      or use BSD incompatible TCP stack */
+#define WOLFSSL_KEIL_TCP_NET  /* KEIL_TCP + wolfssl_MDL_ARM.c for BSD compatibility */
+
+#define NO_DEV_RANDOM
+/* define your Rand gen for the operational use */
+#define WOLFSSL_GENSEED_FORTEST
+
+#define USE_WOLFSSL_MEMORY
+#define WOLFSSL_MALLOC_CHECK
+
+#define USER_TIME
+#define TIME_OVERRIDES
+#define XTIME time_dummy  /* Have to be replaced with operational function */
+static long time_dummy(long *t) {     return (365*24*60*60*(2016-1970)) ;  }
+#define WOLFSSL_USER_CURRTIME
+
+#define USE_FAST_MATH
+#define TFM_TIMING_RESISTANT
+#define BENCH_EMBEDDED
+
+
+
diff --git a/IDE/MDK5-ARM/Inc/cert_data.h b/IDE/MDK5-ARM/Inc/cert_data.h
deleted file mode 100644
index 6629ee051..000000000
--- a/IDE/MDK5-ARM/Inc/cert_data.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef CYASSL_CERT_DATA_H
-#define CYASSL_CERT_DATA_H
-
-#ifdef USE_CERT_BUFFERS_1024
-extern const unsigned char client_key_der_1024[]  ;
-extern int sizeof_client_key_der_1024 ;
-/* ./certs/1024/client-cert.der, 1024-bit */
-extern const unsigned char client_cert_der_1024[] ;
-extern int sizeof_client_cert_der_1024 ;
-/* ./certs/1024/dh1024.der, 1024-bit */
-extern const unsigned char dh_key_der_1024[] ; 
-extern int sizeof_dh_key_der_1024 ; 
-/* ./certs/1024/dsa1024.der, 1024-bit */
-extern const unsigned char dsa_key_der_1024[] ;
-extern int sizeof_dsa_key_der_1024 ;
-/* ./certs/1024/rsa1024.der, 1024-bit */
-extern const unsigned char rsa_key_der_1024[] ;
-extern int sizeof_rsa_key_der_1024 ;
-
-#elif defined(USE_CERT_BUFFERS_2048)
-/* ./certs/client-key.der, 2048-bit */
-extern const unsigned char client_key_der_2048[] ;
-extern int sizeof_client_key_der_2048 ;
-/* ./certs/client-cert.der, 2048-bit */
-extern const unsigned char client_cert_der_2048[] ;
-extern int sizeof_client_cert_der_2048 ;
-/* ./certs/dh2048.der, 2048-bit */
-extern const unsigned char dh_key_der_2048[] ;
-extern int sizeof_dh_key_der_2048 ;
-/* ./certs/dsa2048.der, 2048-bit */
-extern const unsigned char dsa_key_der_2048[] ;
-extern int sizeof_dsa_key_der_2048;
-/* ./certs/rsa2048.der, 2048-bit */
-extern const unsigned char rsa_key_der_2048[] ;
-extern int sizeof_rsa_key_der_2048 ;
-#endif
-
-#endif
-
diff --git a/IDE/MDK5-ARM/Inc/config.h b/IDE/MDK5-ARM/Inc/config.h
index 6fbc07d06..39986dd95 100644
--- a/IDE/MDK5-ARM/Inc/config.h
+++ b/IDE/MDK5-ARM/Inc/config.h
@@ -20,43 +20,38 @@
  */
 
 #define __CORTEX_M3__
-#define CYASSL_MDK_ARM
-#define CYASSL_MDK5
-#define CYASSL_CMSIS_RTOS
 
-#define NO_WRITEV
-#define NO_CYASSL_DIR
-#define BENCH_EMBEDDED
-
-#define CYASSL_DER_LOAD
-#define HAVE_NULL_CIPHER
-#define NO_MAIN_DRIVER
-
-#if  defined(MDK_CONF_CYASSL)
-#define CYASSL_MDK_SHELL
+#if  defined(MDK_CONF_full)
 #include "config-Crypt.h"
-#include "config-CyaSSL.h"
+#include "config-wolfSSL.h"
+
 #elif  defined(MDK_CONF_SimpleClient)
 #include "config-Crypt.h"
-#include "config-CyaSSL.h"
+#include "config-wolfSSL.h"
+
 #elif  defined(MDK_CONF_SimpleServer)
 #include "config-Crypt.h"
-#include "config-CyaSSL.h"
+#include "config-wolfSSL.h"
+
 #elif  defined(MDK_CONF_EchoClient)
 #include "config-Crypt.h"
-#include "config-CyaSSL.h"
+#include "config-wolfSSL.h"
+
 #elif  defined(MDK_CONF_EchoServer)
 #include "config-Crypt.h"
-#include "config-CyaSSL.h"
+#include "config-wolfSSL.h"
+
 #elif  defined(MDK_CONF_Benchmark)
 #define SINGLE_THREADED
-#define NO_INLINE
-#include "config-Crypt.h"
-#elif  defined(MDK_CONF_CryptTest)
-#define SINGLE_THREADED
-#define NO_INLINE
 #include "config-Crypt.h"
 
+#elif  defined(MDK_CONF_CryptTest)
+#define SINGLE_THREADED
+#include "config-Crypt.h"
+
+#elif  defined(MDK_CONF_wolfSSL_lib)
+#include "config-Crypt.h"
+#include "config-wolfSSL.h"
 #endif
 
 
diff --git a/IDE/MDK5-ARM/Inc/cyassl_MDK_ARM.h b/IDE/MDK5-ARM/Inc/cyassl_MDK_ARM.h
deleted file mode 100644
index 43c5c5ade..000000000
--- a/IDE/MDK5-ARM/Inc/cyassl_MDK_ARM.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* cyassl_KEIL_RL.h
- *
- * 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
- */
-
-/******************************************************************************/
-/**   This file is for defining types, values for specific to KEIL-MDK-ARM.  **/
-/******************************************************************************/
-#ifndef CYASSL_KEIL_RL_H
-#define CYASSL_KEIL_RL_H
-
-
-
-#include 
-
-/* Go to STDIN */
-#define fgets(buff, sz, fd)   Cyassl_fgets(buff, sz, fd) 
-extern char * Cyassl_fgets ( char * str, int num, FILE * f ) ;
-
-#define SOCKET_T int
-
-/*** #include  ***/
-#define  NUMBITSPERBYTE 8
-#define FD_SETSIZE 10
-
-typedef long fd_mask;
-#define NFDBITS   (sizeof(fd_mask) * NUMBITSPERBYTE)  /* bits per mask */
-
-typedef struct fd_set {
-    fd_mask fds_bits[(FD_SETSIZE + NFDBITS - 1) / NFDBITS];
-} fd_set;
-
-/*** #include  ***/
-struct timeval {
-   long tv_sec;     /* seconds      */
-   long tv_usec;    /* microseconds */
-};
-
-
-#if defined(CYASSL_KEIL_TCP_NET) 
-
-
-#if defined(CYASSL_MDK5)
-#define SCK_EWOULDBLOCK     BSD_ERROR_WOULDBLOCK
-#define SCK_ETIMEOUT        BSD_ERROR_TIMEOUT
-#include "rl_net.h" 
-#endif
- 
-typedef int socklen_t ;
-
-/* for avoiding conflict with KEIL-TCPnet BSD socket */
-/* Bodies are in cyassl_KEIL_RL.c                    */
-#define connect             Cyassl_connect
-#define accept              Cyassl_accept
-#define recv                Cyassl_recv
-#define send                Cyassl_send
-#define sleep               Cyassl_sleep
-
-/* for avoiding conflicting with KEIL-TCPnet TCP socket */
-/* Bodies are in test.h */
-#define tcp_connect Cyassl_tcp_connect    
-#define tcp_socket    Cyassl_tcp_soket
-#define tcp_listen      Cyassl_tcp_listen
-#define tcp_select     Cyassl_tcp_select
-
-extern int Cyassl_connect(int sd, const struct sockaddr * sa, int sz) ;
-extern int Cyassl_accept(int sd, struct sockaddr *addr, socklen_t *addrlen);
-extern int Cyassl_recv(int sd, void *buf, size_t len, int flags);
-extern int Cyassl_send(int sd, const void *buf, size_t len, int flags);
-extern void Cyassl_sleep(int sec) ;
-extern int Cyassl_tcp_select(int sd, int timeout) ;
-
-/** KEIL-RL TCPnet ****/
-/* TCPnet BSD socket does not have following functions. */
-extern char *inet_ntoa(struct in_addr in);
-extern unsigned long inet_addr(const char *cp);
-extern int setsockopt(int sockfd, int level, int optname, 
-                                      const void *optval, socklen_t optlen);
-extern int select(int nfds, fd_set *readfds, fd_set *writefds,
-                          fd_set *exceptfds, const struct timeval *timeout);
-
-#endif /* CYASSL_KEIL_TCP_NET */
-
-
-/* CyaSSL MDK-ARM time functions */
-#include 
-struct tm *Cyassl_MDK_gmtime(const time_t *c) ;
-extern double current_time(void) ;
-
-#endif /* CYASSL_KEIL_RL_H */
diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx
index 2100471cf..cf8773119 100644
--- a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx
+++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvoptx
@@ -13,6 +13,7 @@
     *.txt; *.h; *.inc
     *.plm
     *.cpp
+    0
   
 
   
@@ -25,12 +26,13 @@
     0x4
     ARM-ADS
     
-      120000000
+      12000000
       
         1
         1
         0
         1
+        0
       
       
         1
@@ -75,17 +77,17 @@
         0
         1
       
-      255
+      18
       
         
           0
           Schematics (MCBSTM32F200)
-          C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf
+          C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf
         
         
           1
           User Manual (MCBSTM32F200)
-          C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm
+          C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm
         
         
           2
@@ -113,10 +115,9 @@
         1
         1
         1
-        1
         0
         0
-        8
+        1
         
         
         
@@ -127,9 +128,14 @@
         
         
         .\STM32_SWO.ini
-        BIN\ULP2CM3.DLL
+        BIN\UL2CM3.DLL
       
       
+        
+          0
+          ARMRTXEVENTFLAGS
+          -L70 -Z18 -C0 -M0 -T1
+        
         
           0
           DLGTARM
@@ -143,17 +149,17 @@
         
           0
           ULP2CM3
-          -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)
+          -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM)
         
         
           0
           DLGUARM
-          
+          (105=-1,-1,-1,-1,0)
         
         
           0
           UL2CM3
-          UL2CM3(-S0 -C0 -P0 )  -FN1 -FC1000 -FD20000000 -FF0STM32F2xx_1024 -FL0100000 -FS08000000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.FLM)
+          -UM1020ADE -O206 -S0 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)
         
       
       
@@ -162,6 +168,7 @@
           1
           8
           0x20000408
+          0
         
       
       
@@ -169,6 +176,7 @@
           2
           8
           0x8004dc8
+          0
         
       
       
@@ -232,8 +240,8 @@
       0
       0
       0
-      .\benchmark.c
-      benchmark.c
+      .\time-CortexM3-4.c
+      time-CortexM3-4.c
       0
       0
     
@@ -266,8 +274,8 @@
       0
       0
       0
-      .\RTE\wolfSSL\settings.h
-      settings.h
+      .\RTE\wolfSSL\user_settings.h
+      user_settings.h
       0
       0
     
@@ -294,72 +302,28 @@
     
   
 
-  
-    Devices
-    1
-    0
-    0
-    0
-    
-      4
-      6
-      1
-      0
-      0
-      0
-      0
-      .\time-CortexM3-4.c
-      time-CortexM3-4.c
-      0
-      0
-    
-    
-      4
-      7
-      1
-      0
-      0
-      0
-      0
-      .\time-dummy.c
-      time-dummy.c
-      0
-      0
-    
-  
-
   
     ::CMSIS
     1
     0
     0
     1
-    
-      5
-      8
-      1
-      0
-      0
-      0
-      0
-      RTE\CMSIS\RTX_Conf_CM.c
-      RTX_Conf_CM.c
-      1
-      0
-    
-    
-      5
-      9
-      4
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib
-      RTX_CM3.lib
-      1
-      0
-    
+  
+
+  
+    ::CMSIS Driver
+    1
+    0
+    0
+    1
+  
+
+  
+    ::Compiler
+    1
+    0
+    0
+    1
   
 
   
@@ -368,628 +332,22 @@
     0
     0
     1
-    
-      6
-      10
-      5
-      0
-      0
-      0
-      0
-      RTE\Device\STM32F207IG\RTE_Device.h
-      RTE_Device.h
-      1
-      0
-    
-    
-      6
-      11
-      2
-      0
-      0
-      0
-      0
-      RTE\Device\STM32F207IG\startup_stm32f2xx.s
-      startup_stm32f2xx.s
-      1
-      0
-    
-    
-      6
-      12
-      1
-      0
-      0
-      0
-      0
-      RTE\Device\STM32F207IG\system_stm32f2xx.c
-      system_stm32f2xx.c
-      1
-      0
-    
-    
-      6
-      13
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c
-      DMA_STM32F2xx.c
-      1
-      0
-    
-    
-      6
-      14
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c
-      GPIO_STM32F2xx.c
-      1
-      0
-    
-  
-
-  
-    ::Drivers
-    0
-    0
-    0
-    1
-    
-      7
-      15
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c
-      MCI_STM32F2xx.c
-      1
-      0
-    
   
 
   
     ::File System
-    0
+    1
     0
     0
     1
-    
-      8
-      16
-      1
-      0
-      0
-      0
-      0
-      RTE\File_System\FS_Config.c
-      FS_Config.c
-      1
-      0
-    
-    
-      8
-      17
-      5
-      0
-      0
-      0
-      0
-      RTE\File_System\FS_Config_MC_0.h
-      FS_Config_MC_0.h
-      1
-      0
-    
-    
-      8
-      18
-      4
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib
-      FS_LFN_CM3_L.lib
-      1
-      0
-    
   
 
   
     ::wolfSSL
-    0
+    1
     0
     0
     1
-    
-      9
-      19
-      5
-      0
-      0
-      0
-      0
-      RTE\wolfSSL\config-Crypt.h
-      config-Crypt.h
-      1
-      0
-    
-    
-      9
-      20
-      5
-      0
-      0
-      0
-      0
-      RTE\wolfSSL\settings.h
-      settings.h
-      1
-      0
-    
-    
-      9
-      21
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c
-      cyassl_MDK_ARM.c
-      1
-      0
-    
-    
-      9
-      22
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\ssl-dummy.c
-      ssl-dummy.c
-      1
-      0
-    
-    
-      9
-      23
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c
-      aes.c
-      1
-      0
-    
-    
-      9
-      24
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c
-      arc4.c
-      1
-      0
-    
-    
-      9
-      25
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c
-      asm.c
-      1
-      0
-    
-    
-      9
-      26
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c
-      asn.c
-      1
-      0
-    
-    
-      9
-      27
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c
-      blake2b.c
-      1
-      0
-    
-    
-      9
-      28
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c
-      camellia.c
-      1
-      0
-    
-    
-      9
-      29
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c
-      coding.c
-      1
-      0
-    
-    
-      9
-      30
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c
-      compress.c
-      1
-      0
-    
-    
-      9
-      31
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c
-      des3.c
-      1
-      0
-    
-    
-      9
-      32
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c
-      dh.c
-      1
-      0
-    
-    
-      9
-      33
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c
-      dsa.c
-      1
-      0
-    
-    
-      9
-      34
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c
-      ecc.c
-      1
-      0
-    
-    
-      9
-      35
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c
-      ecc_fp.c
-      1
-      0
-    
-    
-      9
-      36
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c
-      error.c
-      1
-      0
-    
-    
-      9
-      37
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c
-      hc128.c
-      1
-      0
-    
-    
-      9
-      38
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c
-      hmac.c
-      1
-      0
-    
-    
-      9
-      39
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c
-      integer.c
-      1
-      0
-    
-    
-      9
-      40
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c
-      logging.c
-      1
-      0
-    
-    
-      9
-      41
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c
-      md2.c
-      1
-      0
-    
-    
-      9
-      42
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c
-      md4.c
-      1
-      0
-    
-    
-      9
-      43
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c
-      md5.c
-      1
-      0
-    
-    
-      9
-      44
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c
-      memory.c
-      1
-      0
-    
-    
-      9
-      45
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c
-      misc.c
-      1
-      0
-    
-    
-      9
-      46
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c
-      pwdbased.c
-      1
-      0
-    
-    
-      9
-      47
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c
-      rabbit.c
-      1
-      0
-    
-    
-      9
-      48
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c
-      random.c
-      1
-      0
-    
-    
-      9
-      49
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c
-      ripemd.c
-      1
-      0
-    
-    
-      9
-      50
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c
-      rsa.c
-      1
-      0
-    
-    
-      9
-      51
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c
-      sha.c
-      1
-      0
-    
-    
-      9
-      52
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c
-      sha256.c
-      1
-      0
-    
-    
-      9
-      53
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c
-      sha512.c
-      1
-      0
-    
-    
-      9
-      54
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c
-      tfm.c
-      1
-      0
-    
-    
-      9
-      55
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c
-      wc_port.c
-      1
-      0
-    
   
 
 
diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx
index 02f337fd2..caf784195 100644
--- a/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx
+++ b/IDE/MDK5-ARM/Projects/CryptBenchmark/CryptBenchmark.uvprojx
@@ -12,14 +12,16 @@
       ARM-ADS
       
         
-          STM32F207IG
+          STM32F207IGHx
           STMicroelectronics
-          IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE
+          Keil.STM32F2xx_DFP.2.2.0
+          http://www.keil.com/pack
+          IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE
           
           
-          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm))
+          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM))
           0
-          $$Device:STM32F207IG$Device\Include\stm32f2xx.h
+          $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h
           
           
           
@@ -29,7 +31,7 @@
           
           
           
-          $$Device:STM32F207IG$SVD\STM32F20x.svd
+          $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd
           0
           0
           
@@ -143,10 +145,9 @@
             1
             1
             1
-            1
           
           0
-          8
+          1
           
             
             
@@ -160,7 +161,7 @@
             
             
             .\STM32_SWO.ini
-            BIN\ULP2CM3.DLL
+            BIN\UL2CM3.DLL
           
         
         
@@ -173,8 +174,8 @@
             4100
           
           1
-          BIN\ULP2CM3.DLL
-          "" ()
+          BIN\UL2CM3.DLL
+          
           
           
           
@@ -362,7 +363,7 @@
             0
             
               
-              HAVE_CONFIG_H   MDK_CONF_Benchmark
+              HAVE_CONFIG_H   MDK_CONF_Benchmark WOLFSSL_USER_SETTINGS
               
               
             
@@ -413,9 +414,9 @@
               .\main.c
             
             
-              benchmark.c
+              time-CortexM3-4.c
               1
-              .\benchmark.c
+              .\time-CortexM3-4.c
             
           
         
@@ -428,9 +429,9 @@
               .\RTE\wolfSSL\config-Crypt.h
             
             
-              settings.h
+              user_settings.h
               5
-              .\RTE\wolfSSL\settings.h
+              .\RTE\wolfSSL\user_settings.h
             
           
         
@@ -445,395 +446,166 @@
           
         
         
-          Devices
-          
-            
-              time-CortexM3-4.c
-              1
-              .\time-CortexM3-4.c
-            
-            
-              time-dummy.c
-              1
-              .\time-dummy.c
-            
-          
+          ::CMSIS
         
         
-          ::CMSIS
-          
-            
-              RTX_Conf_CM.c
-              1
-              RTE\CMSIS\RTX_Conf_CM.c
-            
-            
-              RTX_CM3.lib
-              4
-              C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib
-            
-          
+          ::CMSIS Driver
+        
+        
+          ::Compiler
         
         
           ::Device
-          
-            
-              RTE_Device.h
-              5
-              RTE\Device\STM32F207IG\RTE_Device.h
-            
-            
-              startup_stm32f2xx.s
-              2
-              RTE\Device\STM32F207IG\startup_stm32f2xx.s
-            
-            
-              system_stm32f2xx.c
-              1
-              RTE\Device\STM32F207IG\system_stm32f2xx.c
-            
-            
-              DMA_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c
-            
-            
-              GPIO_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c
-            
-          
-        
-        
-          ::Drivers
-          
-            
-              MCI_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c
-            
-          
         
         
           ::File System
-          
-            
-              FS_Config.c
-              1
-              RTE\File_System\FS_Config.c
-            
-            
-              FS_Config_MC_0.h
-              5
-              RTE\File_System\FS_Config_MC_0.h
-            
-            
-              FS_LFN_CM3_L.lib
-              4
-              C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib
-            
-          
         
         
           ::wolfSSL
-          
-            
-              config-Crypt.h
-              5
-              RTE\wolfSSL\config-Crypt.h
-            
-            
-              settings.h
-              5
-              RTE\wolfSSL\settings.h
-            
-            
-              cyassl_MDK_ARM.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c
-            
-            
-              ssl-dummy.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\ssl-dummy.c
-            
-            
-              aes.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c
-            
-            
-              arc4.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c
-            
-            
-              asm.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c
-            
-            
-              asn.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c
-            
-            
-              blake2b.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c
-            
-            
-              camellia.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c
-            
-            
-              coding.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c
-            
-            
-              compress.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c
-            
-            
-              des3.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c
-            
-            
-              dh.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c
-            
-            
-              dsa.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c
-            
-            
-              ecc.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c
-            
-            
-              ecc_fp.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c
-            
-            
-              error.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c
-            
-            
-              hc128.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c
-            
-            
-              hmac.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c
-            
-            
-              integer.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c
-            
-            
-              logging.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c
-            
-            
-              md2.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c
-            
-            
-              md4.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c
-            
-            
-              md5.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c
-            
-            
-              memory.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c
-            
-            
-              misc.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c
-            
-            
-              pwdbased.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c
-            
-            
-              rabbit.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c
-            
-            
-              random.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c
-            
-            
-              ripemd.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c
-            
-            
-              rsa.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c
-            
-            
-              sha.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c
-            
-            
-              sha256.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c
-            
-            
-              sha512.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c
-            
-            
-              tfm.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c
-            
-            
-              wc_port.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c
-            
-          
         
       
     
   
 
   
-    
-      
-        
-          
-        
-      
-      
-        
-          
-        
-      
-      
-        
-          
-        
-      
-      
-        
-          
-        
-      
-      
-        
-          
-        
-      
-    
     
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
+        
+          
+        
+      
+      
+        
         
           
         
       
     
     
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
         
           
         
       
     
     
-      
+      
         RTE\CMSIS\RTX_Conf_CM.c
         
         
@@ -841,42 +613,80 @@
           
         
       
-      
-        RTE\Device\STM32F207IG\RTE_Device.h
-        
-        
+      
+        RTE\Device\STM32F207IGHx\RTE_Device.h
+        
+        
         
           
         
       
+      
+        RTE\Device\STM32F207IGHx\startup_stm32f207xx.s
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGHx\system_stm32f2xx.c
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IG\RTE_Device.h
+        
+        
+        
+      
+      
+        RTE\Device\STM32F207IG\startup_stm32f207xx.s
+        
+        
+        
+      
       
-        RTE\Device\STM32F207IG\startup_stm32f2xx.s
-        
-        
-        
-          
-        
+        RTE\Device\STM32F207IG\startup_stm32f2xx.s
+        
+        
+        
       
-      
-        RTE\Device\STM32F207IG\system_stm32f2xx.c
-        
-        
-        
-          
-        
+      
+        RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h
+        
+        
+        
       
-      
+      
+        RTE\Device\STM32F207IG\system_stm32f2xx.c
+        
+        
+        
+      
+      
         RTE\File_System\FS_Config.c
-        
-        
+        
+        
         
           
         
       
-      
+      
         RTE\File_System\FS_Config_MC_0.h
-        
-        
+        
+        
         
           
         
@@ -947,24 +757,30 @@
         
         
       
-      
+      
         RTE\wolfSSL\config-Crypt.h
-        
-        
+        
+        
         
           
         
       
       
         RTE\wolfSSL\config.h
-        
+        
         
         
       
-      
-        RTE\wolfSSL\settings.h
-        
-        
+      
+        RTE\wolfSSL\settings.h
+        
+        
+        
+      
+      
+        RTE\wolfSSL\user_settings.h
+        
+        
         
           
         
diff --git a/IDE/MDK5-ARM/Projects/CryptBenchmark/benchmark.c b/IDE/MDK5-ARM/Projects/CryptBenchmark/benchmark.c
deleted file mode 100644
index 9ee281329..000000000
--- a/IDE/MDK5-ARM/Projects/CryptBenchmark/benchmark.c
+++ /dev/null
@@ -1,1313 +0,0 @@
-/* benchmark.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
- */
-
-/* CTaoCrypt benchmark */
-
-#ifdef HAVE_CONFIG_H
-    #include 
-#endif
-
-#include 
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#ifdef HAVE_CAVIUM
-    #include "cavium_sysdep.h"
-    #include "cavium_common.h"
-    #include "cavium_ioctl.h"
-#endif
-#ifdef HAVE_NTRU
-    #include "libntruencrypt/ntru_crypto.h"
-#endif
-
-#if defined(CYASSL_MDK_ARM)
-    extern FILE * CyaSSL_fopen(const char *fname, const char *mode) ;
-    #define fopen CyaSSL_fopen
-#endif
-
-#if defined(USE_CERT_BUFFERS_1024) || defined(USE_CERT_BUFFERS_2048)
-    /* include test cert and key buffers for use with NO_FILESYSTEM */
-    #if defined(CYASSL_MDK_ARM)
-        #include "cert_data.h" /* use certs_test.c for initial data, 
-                                      so other commands can share the data. */
-    #else
-        #include 
-    #endif
-#endif
-
-
-#ifdef HAVE_BLAKE2
-    #include 
-    void bench_blake2(void);
-#endif
-
-#ifdef _MSC_VER
-    /* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */
-    #pragma warning(disable: 4996)
-#endif
-
-void bench_des(void);
-void bench_arc4(void);
-void bench_hc128(void);
-void bench_rabbit(void);
-void bench_aes(int);
-void bench_aesgcm(void);
-void bench_aesccm(void);
-void bench_aesctr(void);
-void bench_camellia(void);
-
-void bench_md5(void);
-void bench_sha(void);
-void bench_sha256(void);
-void bench_sha512(void);
-void bench_ripemd(void);
-
-void bench_rsa(void);
-void bench_rsaKeyGen(void);
-void bench_dh(void);
-#ifdef HAVE_ECC
-void bench_eccKeyGen(void);
-void bench_eccKeyAgree(void);
-#endif
-#ifdef HAVE_NTRU
-void bench_ntruKeyGen(void);
-#endif
-
-double current_time(int);
-
-
-#ifdef HAVE_CAVIUM
-
-static int OpenNitroxDevice(int dma_mode,int dev_id)
-{
-   Csp1CoreAssignment core_assign;
-   Uint32             device;
-
-   if (CspInitialize(CAVIUM_DIRECT,CAVIUM_DEV_ID))
-      return -1;
-   if (Csp1GetDevType(&device))
-      return -1;
-   if (device != NPX_DEVICE) {
-      if (ioctl(gpkpdev_hdlr[CAVIUM_DEV_ID], IOCTL_CSP1_GET_CORE_ASSIGNMENT,
-                (Uint32 *)&core_assign)!= 0)
-         return -1;
-   }
-   CspShutdown(CAVIUM_DEV_ID);
-
-   return CspInitialize(dma_mode, dev_id);
-}
-
-#endif
-
-#if defined(DEBUG_CYASSL) && !defined(HAVE_VALGRIND)
-    CYASSL_API int CyaSSL_Debugging_ON();
-#endif
-
-/* so embedded projects can pull in tests on their own */
-#if !defined(NO_MAIN_DRIVER)
-
-int main(int argc, char** argv)
-
-{
-  (void)argc;
-  (void)argv;
-#else
-int benchmark_test(void *args) 
-{
-#endif
-
-    #if defined(DEBUG_CYASSL) && !defined(HAVE_VALGRIND)
-        CyaSSL_Debugging_ON();
-    #endif
-
-	#ifdef HAVE_CAVIUM
-    int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
-    if (ret != 0) {
-        printf("Cavium OpenNitroxDevice failed\n");
-        exit(-1);
-    }
-#endif /* HAVE_CAVIUM */
-#ifndef NO_AES
-    bench_aes(0);
-    bench_aes(1);
-#endif
-#ifdef HAVE_AESGCM
-    bench_aesgcm();
-#endif
-
-#ifdef CYASSL_AES_COUNTER
-    bench_aesctr();
-#endif
-
-#ifdef HAVE_AESCCM
-    bench_aesccm();
-#endif
-#ifdef HAVE_CAMELLIA
-    bench_camellia();
-#endif
-#ifndef NO_RC4
-    bench_arc4();
-#endif
-#ifdef HAVE_HC128
-    bench_hc128();
-#endif
-#ifndef NO_RABBIT
-    bench_rabbit();
-#endif
-#ifndef NO_DES3
-    bench_des();
-#endif
-    
-    printf("\n");
-
-#ifndef NO_MD5
-    bench_md5();
-#endif
-#ifndef NO_SHA
-    bench_sha();
-#endif
-#ifndef NO_SHA256
-    bench_sha256();
-#endif
-#ifdef CYASSL_SHA512
-    bench_sha512();
-#endif
-#ifdef CYASSL_RIPEMD
-    bench_ripemd();
-#endif
-#ifdef HAVE_BLAKE2
-    bench_blake2();
-#endif
-
-    printf("\n");
-
-#ifndef NO_RSA
-    bench_rsa();
-#endif
-
-#ifndef NO_DH
-    bench_dh();
-#endif
-
-#if defined(CYASSL_KEY_GEN) && !defined(NO_RSA)
-    bench_rsaKeyGen();
-#endif
-
-#ifdef HAVE_NTRU
-    bench_ntruKeyGen();
-#endif
-
-#ifdef HAVE_ECC 
-    bench_eccKeyGen();
-    bench_eccKeyAgree();
-#endif
-
-    return 0;
-}
-
-
-#ifdef BENCH_EMBEDDED
-enum BenchmarkBounds {
-    numBlocks  = 25, /* how many kB to test (en/de)cryption */
-    ntimes     = 1,
-    genTimes   = 5,  /* public key iterations */
-    agreeTimes = 5
-};
-static const char blockType[] = "kB";   /* used in printf output */
-#else
-enum BenchmarkBounds {
-    numBlocks  = 5,  /* how many megs to test (en/de)cryption */
-    ntimes     = 100,
-    genTimes   = 100,
-    agreeTimes = 100
-};
-static const char blockType[] = "megs"; /* used in printf output */
-#endif
-
-
-/* use kB instead of mB for embedded benchmarking */
-#ifdef BENCH_EMBEDDED
-static byte plain [1024];
-#else
-static byte plain [1024*1024];
-#endif
-
-
-#ifndef NO_AES
-
-static const byte key[] = 
-{
-    0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
-    0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10,
-    0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67
-};
-
-static const byte iv[] = 
-{
-    0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef,
-    0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-    0x11,0x21,0x31,0x41,0x51,0x61,0x71,0x81
-    
-};
-
-
-/* use kB instead of mB for embedded benchmarking */
-#ifdef BENCH_EMBEDDED
-static byte cipher[1024];
-#else
-static byte cipher[1024*1024];
-#endif
-
-
-void bench_aes(int show)
-{
-    Aes    enc;
-    double start, total, persec;
-    int    i;
-    int    ret;
-
-#ifdef HAVE_CAVIUM
-    if (AesInitCavium(&enc, CAVIUM_DEV_ID) != 0) {
-        printf("aes init cavium failed\n");
-        return;
-    }
-#endif
-
-    ret = AesSetKey(&enc, key, 16, iv, AES_ENCRYPTION);
-    if (ret != 0) {
-        printf("AesSetKey failed, ret = %d\n", ret);
-        return;
-    }
-    start = current_time(1);
-
-    for(i = 0; i < numBlocks; i++)
-        AesCbcEncrypt(&enc, plain, cipher, sizeof(plain));
-
-    total = current_time(0) - start;
-
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    if (show)
-        printf("AES      %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                                  blockType, total, persec);
-#ifdef HAVE_CAVIUM
-    AesFreeCavium(&enc);
-#endif
-}
-#endif
-
-
-#if defined(HAVE_AESGCM) || defined(HAVE_AESCCM)
-    static byte additional[13];
-    static byte tag[16];
-#endif
-
-
-#ifdef HAVE_AESGCM
-void bench_aesgcm(void)
-{
-    Aes    enc;
-    double start, total, persec;
-    int    i;
-
-    AesGcmSetKey(&enc, key, 16);
-    start = current_time(1);
-
-    for(i = 0; i < numBlocks; i++)
-        AesGcmEncrypt(&enc, cipher, plain, sizeof(plain), iv, 12,
-                        tag, 16, additional, 13);
-
-    total = current_time(0) - start;
-
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("AES-GCM  %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-}
-#endif
-
-#ifdef CYASSL_AES_COUNTER
-void bench_aesctr(void)
-{
-    Aes    enc;
-    double start, total, persec;
-    int    i;
-
-    AesSetKeyDirect(&enc, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
-    start = current_time(1);
-
-    for(i = 0; i < numBlocks; i++)
-        AesCtrEncrypt(&enc, plain, cipher, sizeof(plain));
-
-    total = current_time(0) - start;
-
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("AES-CTR  %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-}
-#endif
-
-
-
-#ifdef HAVE_AESCCM
-void bench_aesccm(void)
-{
-    Aes    enc;
-    double start, total, persec;
-    int    i;
-
-    AesCcmSetKey(&enc, key, 16);
-    start = current_time(1);
-
-    for(i = 0; i < numBlocks; i++)
-        AesCcmEncrypt(&enc, cipher, plain, sizeof(plain), iv, 12,
-                        tag, 16, additional, 13);
-
-    total = current_time(0) - start;
-
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("AES-CCM  %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-}
-#endif
-
-
-#ifdef HAVE_CAMELLIA
-void bench_camellia(void)
-{
-    Camellia cam;
-    double start, total, persec;
-    int    i, ret;
-
-    ret = CamelliaSetKey(&cam, key, 16, iv);
-    if (ret != 0) {
-        printf("CamelliaSetKey failed, ret = %d\n", ret);
-        return;
-    }
-    start = current_time(1);
-
-    for(i = 0; i < numBlocks; i++)
-        CamelliaCbcEncrypt(&cam, plain, cipher, sizeof(plain));
-
-    total = current_time(0) - start;
-
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("Camellia %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-}
-#endif
-
-
-#ifndef NO_DES3
-void bench_des(void)
-{
-    Des3   enc;
-    double start, total, persec;
-    int    i, ret;
-
-#ifdef HAVE_CAVIUM
-    if (Des3_InitCavium(&enc, CAVIUM_DEV_ID) != 0)
-        printf("des3 init cavium failed\n");
-#endif
-    ret = Des3_SetKey(&enc, key, iv, DES_ENCRYPTION);
-    if (ret != 0) {
-        printf("Des3_SetKey failed, ret = %d\n", ret);
-        return;
-    }
-    start = current_time(1);
-
-    for(i = 0; i < numBlocks; i++)
-        Des3_CbcEncrypt(&enc, plain, cipher, sizeof(plain));
-
-    total = current_time(0) - start;
-
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("3DES     %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-#ifdef HAVE_CAVIUM
-    Des3_FreeCavium(&enc);
-#endif
-}
-#endif
-
-
-#ifndef NO_RC4
-void bench_arc4(void)
-{
-    Arc4   enc;
-    double start, total, persec;
-    int    i;
-    
-#ifdef HAVE_CAVIUM
-    if (Arc4InitCavium(&enc, CAVIUM_DEV_ID) != 0)
-        printf("arc4 init cavium failed\n");
-#endif
-
-    Arc4SetKey(&enc, key, 16);
-    start = current_time(1);
-
-    for(i = 0; i < numBlocks; i++)
-        Arc4Process(&enc, cipher, plain, sizeof(plain));
-
-    total = current_time(0) - start;
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("ARC4     %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-#ifdef HAVE_CAVIUM
-    Arc4FreeCavium(&enc);
-#endif
-}
-#endif
-
-
-#ifdef HAVE_HC128
-void bench_hc128(void)
-{
-    HC128  enc;
-    double start, total, persec;
-    int    i;
-    
-    Hc128_SetKey(&enc, key, iv);
-    start = current_time(1);
-
-    for(i = 0; i < numBlocks; i++)
-        Hc128_Process(&enc, cipher, plain, sizeof(plain));
-
-    total = current_time(0) - start;
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("HC128    %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-}
-#endif /* HAVE_HC128 */
-
-
-#ifndef NO_RABBIT
-void bench_rabbit(void)
-{
-    Rabbit  enc;
-    double start, total, persec;
-    int    i;
-    
-    RabbitSetKey(&enc, key, iv);
-    start = current_time(1);
-
-    for(i = 0; i < numBlocks; i++)
-        RabbitProcess(&enc, cipher, plain, sizeof(plain));
-
-    total = current_time(0) - start;
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("RABBIT   %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-}
-#endif /* NO_RABBIT */
-
-
-#ifndef NO_MD5
-void bench_md5(void)
-{
-    Md5    hash;
-    byte   digest[MD5_DIGEST_SIZE];
-    double start, total, persec;
-    int    i;
-
-    InitMd5(&hash);
-    start = current_time(1);
-
-    for(i = 0; i < numBlocks; i++)
-        Md5Update(&hash, plain, sizeof(plain));
-   
-    Md5Final(&hash, digest);
-
-    total = current_time(0) - start;
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("MD5      %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-}
-#endif /* NO_MD5 */
-
-
-#ifndef NO_SHA
-void bench_sha(void)
-{
-    Sha    hash;
-    byte   digest[SHA_DIGEST_SIZE];
-    double start, total, persec;
-    int    i, ret;
-        
-    ret = InitSha(&hash);
-    if (ret != 0) {
-        printf("InitSha failed, ret = %d\n", ret);
-        return;
-    }
-    start = current_time(1);
-    
-    for(i = 0; i < numBlocks; i++)
-        ShaUpdate(&hash, plain, sizeof(plain));
-   
-    ShaFinal(&hash, digest);
-
-    total = current_time(0) - start;
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("SHA      %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-}
-#endif /* NO_SHA */
-
-
-#ifndef NO_SHA256
-void bench_sha256(void)
-{
-    Sha256 hash;
-    byte   digest[SHA256_DIGEST_SIZE];
-    double start, total, persec;
-    int    i, ret;
-        
-    ret = InitSha256(&hash);
-    if (ret != 0) {
-        printf("InitSha256 failed, ret = %d\n", ret);
-        return;
-    }
-    start = current_time(1);
-    
-    for(i = 0; i < numBlocks; i++) {
-        ret = Sha256Update(&hash, plain, sizeof(plain));
-        if (ret != 0) {
-            printf("Sha256Update failed, ret = %d\n", ret);
-            return;
-        }
-    }
-   
-    ret = Sha256Final(&hash, digest);
-    if (ret != 0) {
-        printf("Sha256Final failed, ret = %d\n", ret);
-        return;
-    }
-
-    total = current_time(0) - start;
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("SHA-256  %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-}
-#endif
-
-#ifdef CYASSL_SHA512
-void bench_sha512(void)
-{
-    Sha512 hash;
-    byte   digest[SHA512_DIGEST_SIZE];
-    double start, total, persec;
-    int    i, ret;
-        
-    ret = InitSha512(&hash);
-    if (ret != 0) {
-        printf("InitSha512 failed, ret = %d\n", ret);
-        return;
-    }
-    start = current_time(1);
-    
-    for(i = 0; i < numBlocks; i++) {
-        ret = Sha512Update(&hash, plain, sizeof(plain));
-        if (ret != 0) {
-            printf("Sha512Update failed, ret = %d\n", ret);
-            return;
-        }
-    }
-
-    ret = Sha512Final(&hash, digest);
-    if (ret != 0) {
-        printf("Sha512Final failed, ret = %d\n", ret);
-        return;
-    }
-
-    total = current_time(0) - start;
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("SHA-512  %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-}
-#endif
-
-#ifdef CYASSL_RIPEMD
-void bench_ripemd(void)
-{
-    RipeMd hash;
-    byte   digest[RIPEMD_DIGEST_SIZE];
-    double start, total, persec;
-    int    i;
-        
-    InitRipeMd(&hash);
-    start = current_time(1);
-    
-    for(i = 0; i < numBlocks; i++)
-        RipeMdUpdate(&hash, plain, sizeof(plain));
-   
-    RipeMdFinal(&hash, digest);
-
-    total = current_time(0) - start;
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("RIPEMD   %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-}
-#endif
-
-
-#ifdef HAVE_BLAKE2
-void bench_blake2(void)
-{
-    Blake2b b2b;
-    byte    digest[64];
-    double  start, total, persec;
-    int     i, ret;
-       
-    ret = InitBlake2b(&b2b, 64);
-    if (ret != 0) {
-        printf("InitBlake2b failed, ret = %d\n", ret);
-        return;
-    }
-    start = current_time(1);
-    
-    for(i = 0; i < numBlocks; i++) {
-        ret = Blake2bUpdate(&b2b, plain, sizeof(plain));
-        if (ret != 0) {
-            printf("Blake2bUpdate failed, ret = %d\n", ret);
-            return;
-        }
-    }
-   
-    ret = Blake2bFinal(&b2b, digest, 64);
-    if (ret != 0) {
-        printf("Blake2bFinal failed, ret = %d\n", ret);
-        return;
-    }
-
-    total = current_time(0) - start;
-    persec = 1 / total * numBlocks;
-#ifdef BENCH_EMBEDDED
-    /* since using kB, convert to MB/s */
-    persec = persec / 1024;
-#endif
-
-    printf("BLAKE2b  %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks,
-                                              blockType, total, persec);
-}
-#endif
-
-
-#if !defined(NO_RSA) || !defined(NO_DH) \
-                                || defined(CYASSL_KEYGEN) || defined(HAVE_ECC)
-static WC_RNG rng;
-#endif
-
-#ifndef NO_RSA
-
-
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    #if defined(CYASSL_MDK_SHELL)
-        static char *certRSAname = "certs/rsa2048.der";
-        /* set by shell command */
-        static void set_Bench_RSA_File(char * cert) { certRSAname = cert ; }
-    #else
-        static const char *certRSAname = "certs/rsa2048.der";
-    #endif
-#endif
-
-void bench_rsa(void)
-{
-    int    i;
-    int    ret;
-    byte   tmp[3072];
-    size_t bytes;
-    word32 idx = 0;
-
-    byte      message[] = "Everyone gets Friday off.";
-    byte      enc[512];  /* for up to 4096 bit */
-    const int len = (int)strlen((char*)message);
-    double    start, total, each, milliEach;
-    
-    RsaKey rsaKey;
-    int    rsaKeySz = 2048; /* used in printf */
-
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, rsa_key_der_1024, sizeof_rsa_key_der_1024);
-    bytes = sizeof_rsa_key_der_1024;
-    rsaKeySz = 1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, rsa_key_der_2048, sizeof_rsa_key_der_2048);
-    bytes = sizeof_rsa_key_der_2048;
-#else
-    FILE*  file = fopen(certRSAname, "rb");
-
-    if (!file) {
-        printf("can't find %s, Please run from CyaSSL home dir\n", certRSAname);
-        return;
-    }
-    
-    bytes = fread(tmp, 1, sizeof(tmp), file);
-    fclose(file);
-#endif /* USE_CERT_BUFFERS */
-
-		
-#ifdef HAVE_CAVIUM
-    if (RsaInitCavium(&rsaKey, CAVIUM_DEV_ID) != 0)
-        printf("RSA init cavium failed\n");
-#endif
-    ret = InitRng(&rng);
-    if (ret < 0) {
-        printf("InitRNG failed\n");
-        return;
-    }
-    ret = InitRsaKey(&rsaKey, 0);
-    if (ret < 0) {
-        printf("InitRsaKey failed\n");
-        return;
-    }
-    ret = RsaPrivateKeyDecode(tmp, &idx, &rsaKey, (word32)bytes);
-    
-    start = current_time(1);
-
-    for (i = 0; i < ntimes; i++)
-        ret = RsaPublicEncrypt(message,len,enc,sizeof(enc), &rsaKey, &rng);
-
-    total = current_time(0) - start;
-    each  = total / ntimes;   /* per second   */
-    milliEach = each * 1000; /* milliseconds */
-
-    printf("RSA %d encryption took %6.3f milliseconds, avg over %d"
-           " iterations\n", rsaKeySz, milliEach, ntimes);
-
-    if (ret < 0) {
-        printf("Rsa Public Encrypt failed\n");
-        return;
-    }
-
-    start = current_time(1);
-
-    for (i = 0; i < ntimes; i++) {
-         byte  out[512];  /* for up to 4096 bit */
-         RsaPrivateDecrypt(enc, (word32)ret, out, sizeof(out), &rsaKey);
-    }
-
-    total = current_time(0) - start;
-    each  = total / ntimes;   /* per second   */
-    milliEach = each * 1000; /* milliseconds */
-
-    printf("RSA %d decryption took %6.3f milliseconds, avg over %d"
-           " iterations\n", rsaKeySz, milliEach, ntimes);
-
-    FreeRsaKey(&rsaKey);
-#ifdef HAVE_CAVIUM
-    RsaFreeCavium(&rsaKey);
-#endif
-}
-#endif
-
-
-#ifndef NO_DH
-
-
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    #if defined(CYASSL_MDK_SHELL)
-        static char *certDHname = "certs/dh2048.der";
-        /* set by shell command */
-        void set_Bench_DH_File(char * cert) { certDHname = cert ; }
-    #else
-        static const char *certDHname = "certs/dh2048.der";
-    #endif
-#endif
-
-void bench_dh(void)
-{
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    int    ret;
-#endif
-    int    i ;
-    byte   tmp[1024];
-    size_t bytes;
-    word32 idx = 0, pubSz, privSz = 0, pubSz2, privSz2, agreeSz;
-
-    byte   pub[256];    /* for 2048 bit */
-    byte   priv[256];   /* for 2048 bit */
-    byte   pub2[256];   /* for 2048 bit */
-    byte   priv2[256];  /* for 2048 bit */
-    byte   agree[256];  /* for 2048 bit */
-    
-    double start, total, each, milliEach;
-    DhKey  dhKey;
-    int    dhKeySz = 2048; /* used in printf */
-
-	
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, dh_key_der_1024, sizeof_dh_key_der_1024);
-    bytes = sizeof_dh_key_der_1024;
-    dhKeySz = 1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, dh_key_der_2048, sizeof_dh_key_der_2048);
-    bytes = sizeof_dh_key_der_2048;
-#else
-    FILE*  file = fopen(certDHname, "rb");
-
-    if (!file) {
-        printf("can't find %s,  Please run from CyaSSL home dir\n", certDHname);
-        return;
-    }
-
-    ret = InitRng(&rng);
-    if (ret < 0) {
-        printf("InitRNG failed\n");
-        return;
-    }
-    bytes = fread(tmp, 1, sizeof(tmp), file);
-#endif /* USE_CERT_BUFFERS */
-
-		
-    InitDhKey(&dhKey);
-    bytes = DhKeyDecode(tmp, &idx, &dhKey, (word32)bytes);
-    if (bytes != 0) {
-        printf("dhekydecode failed, can't benchmark\n");
-        #if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-            fclose(file);
-        #endif
-        return;
-    }
-
-    start = current_time(1);
-
-    for (i = 0; i < ntimes; i++)
-        DhGenerateKeyPair(&dhKey, &rng, priv, &privSz, pub, &pubSz);
-
-    total = current_time(0) - start;
-    each  = total / ntimes;   /* per second   */
-    milliEach = each * 1000; /* milliseconds */
-
-    printf("DH  %d key generation  %6.3f milliseconds, avg over %d"
-           " iterations\n", dhKeySz, milliEach, ntimes);
-
-    DhGenerateKeyPair(&dhKey, &rng, priv2, &privSz2, pub2, &pubSz2);
-    start = current_time(1);
-
-    for (i = 0; i < ntimes; i++)
-        DhAgree(&dhKey, agree, &agreeSz, priv, privSz, pub2, pubSz2);
-
-    total = current_time(0) - start;
-    each  = total / ntimes;   /* per second   */
-    milliEach = each * 1000; /* milliseconds */
-
-    printf("DH  %d key agreement   %6.3f milliseconds, avg over %d"
-           " iterations\n", dhKeySz, milliEach, ntimes);
-
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    fclose(file);
-#endif
-    FreeDhKey(&dhKey);
-}
-#endif
-
-#if defined(CYASSL_KEY_GEN) && !defined(NO_RSA)
-void bench_rsaKeyGen(void)
-{
-    RsaKey genKey;
-    double start, total, each, milliEach;
-    int    i;
-  
-    /* 1024 bit */ 
-    start = current_time(1);
-
-    for(i = 0; i < genTimes; i++) {
-        InitRsaKey(&genKey, 0); 
-        MakeRsaKey(&genKey, 1024, 65537, &rng);
-        FreeRsaKey(&genKey);
-    }
-
-    total = current_time(0) - start;
-    each  = total / genTimes;  /* per second  */
-    milliEach = each * 1000;   /* millisconds */
-    printf("\n");
-    printf("RSA 1024 key generation  %6.3f milliseconds, avg over %d"
-           " iterations\n", milliEach, genTimes);
-
-    /* 2048 bit */
-    start = current_time(1);
-
-    for(i = 0; i < genTimes; i++) {
-        InitRsaKey(&genKey, 0); 
-        MakeRsaKey(&genKey, 2048, 65537, &rng);
-        FreeRsaKey(&genKey);
-    }
-
-    total = current_time(0) - start;
-    each  = total / genTimes;  /* per second  */
-    milliEach = each * 1000;   /* millisconds */
-    printf("RSA 2048 key generation  %6.3f milliseconds, avg over %d"
-           " iterations\n", milliEach, genTimes);
-}
-#endif /* CYASSL_KEY_GEN */
-#ifdef HAVE_NTRU
-byte GetEntropy(ENTROPY_CMD cmd, byte* out);
-
-byte GetEntropy(ENTROPY_CMD cmd, byte* out)
-{
-    if (cmd == INIT)
-        return (InitRng(&rng) == 0) ? 1 : 0;
-
-    if (out == NULL)
-        return 0;
-
-    if (cmd == GET_BYTE_OF_ENTROPY)
-        return (RNG_GenerateBlock(&rng, out, 1) == 0) ? 1 : 0;
-
-    if (cmd == GET_NUM_BYTES_PER_BYTE_OF_ENTROPY) {
-        *out = 1;
-        return 1;
-    }
-
-    return 0;
-}
-void bench_ntruKeyGen(void)
-{
-    double start, total, each, milliEach;
-    int    i;
-
-    byte   public_key[557]; /* 2048 key equivalent to rsa */
-    word16 public_key_len = sizeof(public_key);
-    byte   private_key[607];
-    word16 private_key_len = sizeof(private_key);
-
-    DRBG_HANDLE drbg;
-    static uint8_t const pers_str[] = {
-                'C', 'y', 'a', 'S', 'S', 'L', ' ', 't', 'e', 's', 't'
-    };
-
-    word32 rc = ntru_crypto_drbg_instantiate(112, pers_str, sizeof(pers_str),
-                                             GetEntropy, &drbg);
-    if(rc != DRBG_OK) {
-        printf("NTRU drbg instantiate failed\n");
-        return;
-    }
-
-    start = current_time(1);
-
-    for(i = 0; i < genTimes; i++) {
-        ntru_crypto_ntru_encrypt_keygen(drbg, NTRU_EES401EP2, &public_key_len,
-                                     public_key, &private_key_len, private_key);
-    }
-
-    total = current_time(0) - start;
-
-    rc = ntru_crypto_drbg_uninstantiate(drbg);
-
-    if (rc != NTRU_OK) {
-        printf("NTRU drbg uninstantiate failed\n");
-        return;
-    }
-
-    each = total / genTimes;
-    milliEach = each * 1000;
-
-    printf("\n");
-    printf("NTRU 112 key generation  %6.3f milliseconds, avg over %d"
-        " iterations\n", milliEach, genTimes);
-
-}
-#endif
-
-#ifdef HAVE_ECC 
-void bench_eccKeyGen(void)
-{
-    ecc_key genKey;
-    double start, total, each, milliEach;
-    int    i, ret;
-  
-    ret = InitRng(&rng);
-    if (ret < 0) {
-        printf("InitRNG failed\n");
-        return;
-    }
-    /* 256 bit */ 
-    start = current_time(1);
-
-    for(i = 0; i < genTimes; i++) {
-        ecc_make_key(&rng, 32, &genKey);
-        ecc_free(&genKey);
-    }
-
-    total = current_time(0) - start;
-    each  = total / genTimes;  /* per second  */
-    milliEach = each * 1000;   /* millisconds */
-    printf("\n");
-    printf("ECC  256 key generation  %6.3f milliseconds, avg over %d"
-           " iterations\n", milliEach, genTimes);
-}
-
-
-void bench_eccKeyAgree(void)
-{
-    ecc_key genKey, genKey2;
-    double start, total, each, milliEach;
-    int    i, ret;
-    byte   shared[1024];
-    byte   sig[1024];
-    byte   digest[32];
-    word32 x = 0;
- 
-    ecc_init(&genKey);
-    ecc_init(&genKey2);
-
-    ret = InitRng(&rng);
-    if (ret < 0) {
-        printf("InitRNG failed\n");
-        return;
-    }
-
-    ret = ecc_make_key(&rng, 32, &genKey);
-    if (ret != 0) {
-        printf("ecc_make_key failed\n");
-        return;
-    }
-    ret = ecc_make_key(&rng, 32, &genKey2);
-    if (ret != 0) {
-        printf("ecc_make_key failed\n");
-        return;
-    }
-
-    /* 256 bit */ 
-    start = current_time(1);
-
-    for(i = 0; i < agreeTimes; i++) {
-        x = sizeof(shared);
-        ret = ecc_shared_secret(&genKey, &genKey2, shared, &x);
-        if (ret != 0) {
-            printf("ecc_shared_secret failed\n");
-            return; 
-        }
-    }
-
-    total = current_time(0) - start;
-    each  = total / agreeTimes;  /* per second  */
-    milliEach = each * 1000;   /* millisconds */
-    printf("EC-DHE   key agreement   %6.3f milliseconds, avg over %d"
-           " iterations\n", milliEach, agreeTimes);
-
-    /* make dummy digest */
-    for (i = 0; i < (int)sizeof(digest); i++)
-        digest[i] = (byte)i;
-
-
-    start = current_time(1);
-
-    for(i = 0; i < agreeTimes; i++) {
-        x = sizeof(sig);
-        ret = ecc_sign_hash(digest, sizeof(digest), sig, &x, &rng, &genKey);
-        if (ret != 0) {
-            printf("ecc_sign_hash failed\n");
-            return; 
-        }
-    }
-
-    total = current_time(0) - start;
-    each  = total / agreeTimes;  /* per second  */
-    milliEach = each * 1000;   /* millisconds */
-    printf("EC-DSA   sign   time     %6.3f milliseconds, avg over %d"
-           " iterations\n", milliEach, agreeTimes);
-
-    start = current_time(1);
-
-    for(i = 0; i < agreeTimes; i++) {
-        int verify = 0;
-        ret = ecc_verify_hash(sig, x, digest, sizeof(digest), &verify, &genKey);
-        if (ret != 0) {
-            printf("ecc_verify_hash failed\n");
-            return; 
-        }
-    }
-
-    total = current_time(0) - start;
-    each  = total / agreeTimes;  /* per second  */
-    milliEach = each * 1000;     /* millisconds */
-    printf("EC-DSA   verify time     %6.3f milliseconds, avg over %d"
-           " iterations\n", milliEach, agreeTimes);
-
-    ecc_free(&genKey2);
-    ecc_free(&genKey);
-}
-#endif /* HAVE_ECC */
-
-#ifdef _WIN32
-
-    #define WIN32_LEAN_AND_MEAN
-    #include 
-
-    double current_time(int reset)
-    {
-        static int init = 0;
-        static LARGE_INTEGER freq;
-    
-        LARGE_INTEGER count;
-
-        (void)reset;
-
-        if (!init) {
-            QueryPerformanceFrequency(&freq);
-            init = 1;
-        }
-
-        QueryPerformanceCounter(&count);
-
-        return (double)count.QuadPart / freq.QuadPart;
-    }
-
-#elif defined MICROCHIP_PIC32
-    #if defined(CYASSL_MICROCHIP_PIC32MZ)
-        #define CLOCK 80000000.0
-    #else
-        #include 
-        #define CLOCK 40000000.0
-    #endif
-
-    double current_time(int reset)
-    {
-        unsigned int ns;
-
-        if (reset) {
-            WriteCoreTimer(0);
-        }
-
-        /* get timer in ns */
-        ns = ReadCoreTimer();
-
-        /* return seconds as a double */
-        return ( ns / CLOCK * 2.0);
-    }
-
-#elif defined(CYASSL_IAR_ARM) || defined (CYASSL_MDK_ARM)
-
-#elif defined FREERTOS
-
-    double current_time(int reset)
-    {
-        (void) reset;
-
-        portTickType tickCount;
-
-        /* tick count == ms, if configTICK_RATE_HZ is set to 1000 */
-        tickCount = xTaskGetTickCount();
-        return (double)tickCount / 1000;
-    }
-
-#else
-
-    #include 
-
-    double current_time(int reset)
-    {
-        struct timeval tv;
-
-        (void)reset;
-
-        gettimeofday(&tv, 0);
-
-        return (double)tv.tv_sec + (double)tv.tv_usec / 1000000;
-    }
-
-#endif /* _WIN32 */
diff --git a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx
index d308da438..f0f9517f4 100644
--- a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx
+++ b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvoptx
@@ -13,6 +13,7 @@
     *.txt; *.h; *.inc
     *.plm
     *.cpp
+    0
   
 
   
@@ -25,12 +26,13 @@
     0x4
     ARM-ADS
     
-      120000000
+      12000000
       
         1
         1
         0
         1
+        0
       
       
         1
@@ -75,17 +77,17 @@
         0
         1
       
-      255
+      18
       
         
           0
           Schematics (MCBSTM32F200)
-          C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf
+          C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf
         
         
           1
           User Manual (MCBSTM32F200)
-          C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm
+          C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm
         
         
           2
@@ -113,10 +115,9 @@
         1
         1
         1
-        1
         0
         0
-        8
+        1
         
         
         
@@ -127,13 +128,18 @@
         
         
         .\STM32_SWO.ini
-        BIN\ULP2CM3.DLL
+        BIN\UL2CM3.DLL
       
       
+        
+          0
+          ARMRTXEVENTFLAGS
+          -L70 -Z18 -C0 -M0 -T1
+        
         
           0
           DLGUARM
-          
+          (105=-1,-1,-1,-1,0)
         
         
           0
@@ -148,12 +154,12 @@
         
           0
           ULP2CM3
-          -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO3 -TC10000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)
+          -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO7 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM)
         
         
           0
           UL2CM3
-          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm))
+          -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)
         
       
       
@@ -161,7 +167,8 @@
         
           1
           8
-          0x20000408
+          clientKey
+          0
         
       
       
@@ -169,6 +176,7 @@
           2
           8
           0x8004dc8
+          0
         
       
       
@@ -224,45 +232,6 @@
       0
       0
     
-    
-      1
-      2
-      1
-      0
-      0
-      0
-      0
-      .\test.c
-      test.c
-      0
-      0
-    
-    
-      1
-      3
-      1
-      0
-      0
-      0
-      0
-      .\cert_data.c
-      cert_data.c
-      0
-      0
-    
-    
-      1
-      4
-      1
-      0
-      0
-      0
-      0
-      .\time-dummy.c
-      time-dummy.c
-      0
-      0
-    
   
 
   
@@ -273,7 +242,7 @@
     0
     
       2
-      5
+      2
       5
       0
       0
@@ -286,14 +255,14 @@
     
     
       2
-      6
+      3
       5
       0
       0
       0
       0
-      .\RTE\wolfSSL\settings.h
-      settings.h
+      .\RTE\wolfSSL\user_settings.h
+      user_settings.h
       0
       0
     
@@ -301,13 +270,13 @@
 
   
     Documentation
-    0
+    1
     0
     0
     0
     
       3
-      7
+      4
       5
       0
       0
@@ -326,32 +295,22 @@
     0
     0
     1
-    
-      4
-      8
-      1
-      0
-      0
-      0
-      0
-      RTE\CMSIS\RTX_Conf_CM.c
-      RTX_Conf_CM.c
-      1
-      0
-    
-    
-      4
-      9
-      4
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib
-      RTX_CM3.lib
-      1
-      0
-    
+  
+
+  
+    ::CMSIS Driver
+    1
+    0
+    0
+    1
+  
+
+  
+    ::Compiler
+    1
+    0
+    0
+    1
   
 
   
@@ -360,92 +319,6 @@
     0
     0
     1
-    
-      5
-      10
-      5
-      0
-      0
-      0
-      0
-      RTE\Device\STM32F207IG\RTE_Device.h
-      RTE_Device.h
-      1
-      0
-    
-    
-      5
-      11
-      2
-      0
-      0
-      0
-      0
-      RTE\Device\STM32F207IG\startup_stm32f2xx.s
-      startup_stm32f2xx.s
-      1
-      0
-    
-    
-      5
-      12
-      1
-      0
-      0
-      0
-      0
-      RTE\Device\STM32F207IG\system_stm32f2xx.c
-      system_stm32f2xx.c
-      1
-      0
-    
-    
-      5
-      13
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c
-      DMA_STM32F2xx.c
-      1
-      0
-    
-    
-      5
-      14
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c
-      GPIO_STM32F2xx.c
-      1
-      0
-    
-  
-
-  
-    ::Drivers
-    1
-    0
-    0
-    1
-    
-      6
-      15
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c
-      MCI_STM32F2xx.c
-      1
-      0
-    
   
 
   
@@ -454,534 +327,14 @@
     0
     0
     1
-    
-      7
-      16
-      1
-      0
-      0
-      0
-      0
-      RTE\File_System\FS_Config.c
-      FS_Config.c
-      1
-      0
-    
-    
-      7
-      17
-      5
-      0
-      0
-      0
-      0
-      RTE\File_System\FS_Config_MC_0.h
-      FS_Config_MC_0.h
-      1
-      0
-    
-    
-      7
-      18
-      4
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib
-      FS_LFN_CM3_L.lib
-      1
-      0
-    
   
 
   
     ::wolfSSL
-    0
+    1
     0
     0
     1
-    
-      8
-      19
-      5
-      0
-      0
-      0
-      0
-      RTE\wolfSSL\config-Crypt.h
-      config-Crypt.h
-      1
-      0
-    
-    
-      8
-      20
-      5
-      0
-      0
-      0
-      0
-      RTE\wolfSSL\settings.h
-      settings.h
-      1
-      0
-    
-    
-      8
-      21
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c
-      cyassl_MDK_ARM.c
-      1
-      0
-    
-    
-      8
-      22
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\ssl-dummy.c
-      ssl-dummy.c
-      1
-      0
-    
-    
-      8
-      23
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c
-      aes.c
-      1
-      0
-    
-    
-      8
-      24
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c
-      arc4.c
-      1
-      0
-    
-    
-      8
-      25
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c
-      asm.c
-      1
-      0
-    
-    
-      8
-      26
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c
-      asn.c
-      1
-      0
-    
-    
-      8
-      27
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c
-      blake2b.c
-      1
-      0
-    
-    
-      8
-      28
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c
-      camellia.c
-      1
-      0
-    
-    
-      8
-      29
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c
-      coding.c
-      1
-      0
-    
-    
-      8
-      30
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c
-      compress.c
-      1
-      0
-    
-    
-      8
-      31
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c
-      des3.c
-      1
-      0
-    
-    
-      8
-      32
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c
-      dh.c
-      1
-      0
-    
-    
-      8
-      33
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c
-      dsa.c
-      1
-      0
-    
-    
-      8
-      34
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c
-      ecc.c
-      1
-      0
-    
-    
-      8
-      35
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c
-      ecc_fp.c
-      1
-      0
-    
-    
-      8
-      36
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c
-      error.c
-      1
-      0
-    
-    
-      8
-      37
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c
-      hc128.c
-      1
-      0
-    
-    
-      8
-      38
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c
-      hmac.c
-      1
-      0
-    
-    
-      8
-      39
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c
-      integer.c
-      1
-      0
-    
-    
-      8
-      40
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c
-      logging.c
-      1
-      0
-    
-    
-      8
-      41
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c
-      md2.c
-      1
-      0
-    
-    
-      8
-      42
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c
-      md4.c
-      1
-      0
-    
-    
-      8
-      43
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c
-      md5.c
-      1
-      0
-    
-    
-      8
-      44
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c
-      memory.c
-      1
-      0
-    
-    
-      8
-      45
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c
-      misc.c
-      1
-      0
-    
-    
-      8
-      46
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c
-      pwdbased.c
-      1
-      0
-    
-    
-      8
-      47
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c
-      rabbit.c
-      1
-      0
-    
-    
-      8
-      48
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c
-      random.c
-      1
-      0
-    
-    
-      8
-      49
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c
-      ripemd.c
-      1
-      0
-    
-    
-      8
-      50
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c
-      rsa.c
-      1
-      0
-    
-    
-      8
-      51
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c
-      sha.c
-      1
-      0
-    
-    
-      8
-      52
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c
-      sha256.c
-      1
-      0
-    
-    
-      8
-      53
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c
-      sha512.c
-      1
-      0
-    
-    
-      8
-      54
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c
-      tfm.c
-      1
-      0
-    
-    
-      8
-      55
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c
-      wc_port.c
-      1
-      0
-    
   
 
 
diff --git a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx
index 677c74e3e..214951a09 100644
--- a/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx
+++ b/IDE/MDK5-ARM/Projects/CryptTest/CryptTest.uvprojx
@@ -12,14 +12,16 @@
       ARM-ADS
       
         
-          STM32F207IG
+          STM32F207IGHx
           STMicroelectronics
-          IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE
+          Keil.STM32F2xx_DFP.2.2.0
+          http://www.keil.com/pack
+          IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE
           
           
-          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm))
+          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM))
           0
-          $$Device:STM32F207IG$Device\Include\stm32f2xx.h
+          $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h
           
           
           
@@ -29,7 +31,7 @@
           
           
           
-          $$Device:STM32F207IG$SVD\STM32F20x.svd
+          $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd
           0
           0
           
@@ -104,11 +106,11 @@
         
         
           SARMCM3.DLL
-          -REMAP -MPU
+           -REMAP -MPU
           DCM.DLL
           -pCM3
           SARMCM3.DLL
-          -REMAP -MPU
+           -MPU
           TCM.DLL
           -pCM3
         
@@ -143,10 +145,9 @@
             1
             1
             1
-            1
           
           0
-          8
+          1
           
             
             
@@ -160,7 +161,7 @@
             
             
             .\STM32_SWO.ini
-            BIN\ULP2CM3.DLL
+            BIN\UL2CM3.DLL
           
         
         
@@ -173,8 +174,8 @@
             4100
           
           1
-          BIN\ULP2CM3.DLL
-          "" ()
+          BIN\UL2CM3.DLL
+          
           
           
           
@@ -362,7 +363,7 @@
             0
             
               
-              HAVE_CONFIG_H   MDK_CONF_CryptTest
+              HAVE_CONFIG_H   WOLFSSL_USER_SETTINGS MDK_CONF_CryptTest
               
               
             
@@ -412,21 +413,6 @@
               1
               .\main.c
             
-            
-              test.c
-              1
-              .\test.c
-            
-            
-              cert_data.c
-              1
-              .\cert_data.c
-            
-            
-              time-dummy.c
-              1
-              .\time-dummy.c
-            
           
         
         
@@ -438,9 +424,9 @@
               .\RTE\wolfSSL\config-Crypt.h
             
             
-              settings.h
+              user_settings.h
               5
-              .\RTE\wolfSSL\settings.h
+              .\RTE\wolfSSL\user_settings.h
             
           
         
@@ -456,268 +442,21 @@
         
         
           ::CMSIS
-          
-            
-              RTX_Conf_CM.c
-              1
-              RTE\CMSIS\RTX_Conf_CM.c
-            
-            
-              RTX_CM3.lib
-              4
-              C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib
-            
-          
+        
+        
+          ::CMSIS Driver
+        
+        
+          ::Compiler
         
         
           ::Device
-          
-            
-              RTE_Device.h
-              5
-              RTE\Device\STM32F207IG\RTE_Device.h
-            
-            
-              startup_stm32f2xx.s
-              2
-              RTE\Device\STM32F207IG\startup_stm32f2xx.s
-            
-            
-              system_stm32f2xx.c
-              1
-              RTE\Device\STM32F207IG\system_stm32f2xx.c
-            
-            
-              DMA_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c
-            
-            
-              GPIO_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c
-            
-          
-        
-        
-          ::Drivers
-          
-            
-              MCI_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c
-            
-          
         
         
           ::File System
-          
-            
-              FS_Config.c
-              1
-              RTE\File_System\FS_Config.c
-            
-            
-              FS_Config_MC_0.h
-              5
-              RTE\File_System\FS_Config_MC_0.h
-            
-            
-              FS_LFN_CM3_L.lib
-              4
-              C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib
-            
-          
         
         
           ::wolfSSL
-          
-            
-              config-Crypt.h
-              5
-              RTE\wolfSSL\config-Crypt.h
-            
-            
-              settings.h
-              5
-              RTE\wolfSSL\settings.h
-            
-            
-              cyassl_MDK_ARM.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c
-            
-            
-              ssl-dummy.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\ssl-dummy.c
-            
-            
-              aes.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c
-            
-            
-              arc4.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c
-            
-            
-              asm.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c
-            
-            
-              asn.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c
-            
-            
-              blake2b.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c
-            
-            
-              camellia.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c
-            
-            
-              coding.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c
-            
-            
-              compress.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c
-            
-            
-              des3.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c
-            
-            
-              dh.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c
-            
-            
-              dsa.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c
-            
-            
-              ecc.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c
-            
-            
-              ecc_fp.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c
-            
-            
-              error.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c
-            
-            
-              hc128.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c
-            
-            
-              hmac.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c
-            
-            
-              integer.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c
-            
-            
-              logging.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c
-            
-            
-              md2.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c
-            
-            
-              md4.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c
-            
-            
-              md5.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c
-            
-            
-              memory.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c
-            
-            
-              misc.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c
-            
-            
-              pwdbased.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c
-            
-            
-              rabbit.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c
-            
-            
-              random.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c
-            
-            
-              ripemd.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c
-            
-            
-              rsa.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c
-            
-            
-              sha.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c
-            
-            
-              sha256.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c
-            
-            
-              sha512.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c
-            
-            
-              tfm.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c
-            
-            
-              wc_port.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c
-            
-          
         
       
     
@@ -725,110 +464,179 @@
 
   
     
-      
+      
+        
+      
+      
         
-          
+          
         
       
-      
+      
         
-          
+          
         
       
-      
+      
         
-          
+          
         
       
-      
+      
         
-          
+          
         
       
-      
+      
         
-          
+          
         
       
     
     
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
+        
+          
+        
+      
+      
+        
         
           
         
       
     
     
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
         
           
         
       
-      
-        
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
         
           
         
       
     
     
-      
+      
         RTE\CMSIS\RTX_Conf_CM.c
         
         
@@ -836,42 +644,92 @@
           
         
       
-      
-        RTE\Device\STM32F207IG\RTE_Device.h
-        
-        
+      
+        RTE\Device\STM32F207IGHx\RTE_Device.h
+        
+        
         
           
         
       
+      
+        RTE\Device\STM32F207IGHx\startup_stm32f207xx.s
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGHx\system_stm32f2xx.c
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGTx\RTE_Device.h
+        
+        
+        
+      
+      
+        RTE\Device\STM32F207IGTx\startup_stm32f207xx.s
+        
+        
+        
+      
+      
+        RTE\Device\STM32F207IGTx\stm32f2xx_hal_conf.h
+        
+        
+        
+      
+      
+        RTE\Device\STM32F207IGTx\system_stm32f2xx.c
+        
+        
+        
+      
+      
+        RTE\Device\STM32F207IG\RTE_Device.h
+        
+        
+        
+      
       
-        RTE\Device\STM32F207IG\startup_stm32f2xx.s
+        RTE\Device\STM32F207IG\startup_stm32f2xx.s
         
         
-        
-          
-        
+        
       
       
-        RTE\Device\STM32F207IG\system_stm32f2xx.c
+        RTE\Device\STM32F207IG\system_stm32f2xx.c
         
         
-        
-          
-        
+        
       
-      
+      
         RTE\File_System\FS_Config.c
-        
-        
+        
+        
         
           
         
       
-      
+      
         RTE\File_System\FS_Config_MC_0.h
-        
-        
+        
+        
         
           
         
@@ -942,10 +800,10 @@
         
         
       
-      
+      
         RTE\wolfSSL\config-Crypt.h
-        
-        
+        
+        
         
           
         
@@ -957,9 +815,15 @@
         
       
       
-        RTE\wolfSSL\settings.h
+        RTE\wolfSSL\settings.h
         
         
+        
+      
+      
+        RTE\wolfSSL\user_settings.h
+        
+        
         
           
         
diff --git a/IDE/MDK5-ARM/Projects/CryptTest/cert_data.c b/IDE/MDK5-ARM/Projects/CryptTest/cert_data.c
deleted file mode 100644
index d6cef016d..000000000
--- a/IDE/MDK5-ARM/Projects/CryptTest/cert_data.c
+++ /dev/null
@@ -1,28 +0,0 @@
-/* certs_test.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 
-#endif
-
-/* Define initial data for cert buffers */
-#include 
-
diff --git a/IDE/MDK5-ARM/Projects/CryptTest/test.c b/IDE/MDK5-ARM/Projects/CryptTest/test.c
deleted file mode 100644
index 9b9bf3537..000000000
--- a/IDE/MDK5-ARM/Projects/CryptTest/test.c
+++ /dev/null
@@ -1,4863 +0,0 @@
-/* test.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 
-#endif
-
-#include 
-
-#ifdef XMALLOC_USER
-    #include   /* we're using malloc / free direct here */
-#endif
-
-#ifndef NO_CRYPT_TEST
-
-#ifdef CYASSL_TEST_CERT
-    #include 
-#else
-    #include 
-#endif
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#ifdef HAVE_ECC
-    #include 
-#endif
-#ifdef HAVE_BLAKE2
-    #include 
-#endif
-#ifdef HAVE_LIBZ
-    #include 
-#endif
-#ifdef HAVE_PKCS7
-    #include 
-#endif
-
-#ifdef _MSC_VER
-    /* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */
-    #pragma warning(disable: 4996)
-#endif
-
-#ifdef OPENSSL_EXTRA
-    #include 
-    #include 
-    #include 
-    #include 
-#endif
-
-
-#if defined(USE_CERT_BUFFERS_1024) || defined(USE_CERT_BUFFERS_2048)
-    /* include test cert and key buffers for use with NO_FILESYSTEM */
-    #if defined(CYASSL_MDK_ARM)
-        #include "cert_data.h"
-                        /* use certs_test.c for initial data, so other
-                                               commands can share the data. */
-    #else
-        #include 
-    #endif
-#endif
-
-#if defined(CYASSL_MDK_ARM)
-        #include 
-        #include 
-    extern FILE * CyaSSL_fopen(const char *fname, const char *mode) ;
-    #define fopen CyaSSL_fopen
-#endif
-
-#ifdef HAVE_NTRU
-    #include "libntruencrypt/ntru_crypto.h"
-#endif
-#ifdef HAVE_CAVIUM
-    #include "cavium_sysdep.h"
-    #include "cavium_common.h"
-    #include "cavium_ioctl.h"
-#endif
-
-#ifdef FREESCALE_MQX
-    #include 
-    #include 
-    #include 
-#else
-    #include 
-#endif
-
-
-#ifdef THREADX
-    /* since just testing, use THREADX log printf instead */
-    int dc_log_printf(char*, ...);
-        #undef printf
-        #define printf dc_log_printf
-#endif
-
-#include "ctaocrypt/test/test.h"
-
-
-typedef struct testVector {
-    const char*  input;
-    const char*  output;
-    size_t inLen;
-    size_t outLen;
-} testVector;
-
-int  md2_test(void);
-int  md5_test(void);
-int  md4_test(void);
-int  sha_test(void);
-int  sha256_test(void);
-int  sha512_test(void);
-int  sha384_test(void);
-int  hmac_md5_test(void);
-int  hmac_sha_test(void);
-int  hmac_sha256_test(void);
-int  hmac_sha384_test(void);
-int  hmac_sha512_test(void);
-int  hmac_blake2b_test(void);
-int  hkdf_test(void);
-int  arc4_test(void);
-int  hc128_test(void);
-int  rabbit_test(void);
-int  des_test(void);
-int  des3_test(void);
-int  aes_test(void);
-int  aesgcm_test(void);
-int  gmac_test(void);
-int  aesccm_test(void);
-int  camellia_test(void);
-int  rsa_test(void);
-int  dh_test(void);
-int  dsa_test(void);
-int  random_test(void);
-int  pwdbased_test(void);
-int  ripemd_test(void);
-int  openssl_test(void);   /* test mini api */
-int pbkdf1_test(void);
-int pkcs12_test(void);
-int pbkdf2_test(void);
-#ifdef HAVE_ECC
-    int  ecc_test(void);
-    #ifdef HAVE_ECC_ENCRYPT
-        int  ecc_encrypt_test(void);
-    #endif
-#endif
-#ifdef HAVE_BLAKE2
-    int  blake2b_test(void);
-#endif
-#ifdef HAVE_LIBZ
-    int compress_test(void);
-#endif
-#ifdef HAVE_PKCS7
-    int pkcs7enveloped_test(void);
-    int pkcs7signed_test(void);
-#endif
-
-
-
-static void err_sys(const char* msg, int es)
-{
-    printf("%s error = %d\n", msg, es);
-    #if !defined(THREADX) && !defined(CYASSL_MDK_ARM)
-  	if (msg)
-        exit(es);
-    #endif
-    return;
-}
-
-/* func_args from test.h, so don't have to pull in other junk */
-typedef struct func_args {
-    int    argc;
-    char** argv;
-    int    return_code;
-} func_args;
-
-
-
-void ctaocrypt_test(void* args)
-{
-    int ret = 0;
-
-    ((func_args*)args)->return_code = -1; /* error state */
-
-#if !defined(NO_BIG_INT)
-    if (CheckCtcSettings() != 1)
-        err_sys("Build vs runtime math mismatch\n", -1234);
-
-#ifdef USE_FAST_MATH
-    if (CheckFastMathSettings() != 1)
-        err_sys("Build vs runtime fastmath FP_MAX_BITS mismatch\n", -1235);
-#endif /* USE_FAST_MATH */
-#endif /* !NO_BIG_INT */
-
-
-#ifndef NO_MD5
-    if ( (ret = md5_test()) != 0)
-        err_sys("MD5      test failed!\n", ret);
-    else
-        printf( "MD5      test passed!\n");
-#endif
-
-#ifdef CYASSL_MD2
-    if ( (ret = md2_test()) != 0)
-        err_sys("MD2      test failed!\n", ret);
-    else
-        printf( "MD2      test passed!\n");
-#endif
-
-#ifndef NO_MD4
-    if ( (ret = md4_test()) != 0)
-        err_sys("MD4      test failed!\n", ret);
-    else
-        printf( "MD4      test passed!\n");
-#endif
-
-#ifndef NO_SHA
-    if ( (ret = sha_test()) != 0)
-        err_sys("SHA      test failed!\n", ret);
-    else
-        printf( "SHA      test passed!\n");
-#endif
-
-#ifndef NO_SHA256
-    if ( (ret = sha256_test()) != 0)
-        err_sys("SHA-256  test failed!\n", ret);
-    else
-        printf( "SHA-256  test passed!\n");
-#endif
-
-#ifdef CYASSL_SHA384
-    if ( (ret = sha384_test()) != 0)
-        err_sys("SHA-384  test failed!\n", ret);
-    else
-        printf( "SHA-384  test passed!\n");
-#endif
-
-#ifdef CYASSL_SHA512
-    if ( (ret = sha512_test()) != 0)
-        err_sys("SHA-512  test failed!\n", ret);
-    else
-        printf( "SHA-512  test passed!\n");
-#endif
-
-#ifdef CYASSL_RIPEMD
-    if ( (ret = ripemd_test()) != 0)
-        err_sys("RIPEMD   test failed!\n", ret);
-    else
-        printf( "RIPEMD   test passed!\n");
-#endif
-
-#ifdef HAVE_BLAKE2
-    if ( (ret = blake2b_test()) != 0)
-        err_sys("BLAKE2b  test failed!\n", ret);
-    else
-        printf( "BLAKE2b  test passed!\n");
-#endif
-
-#ifndef NO_HMAC
-    #ifndef NO_MD5
-        if ( (ret = hmac_md5_test()) != 0)
-            err_sys("HMAC-MD5 test failed!\n", ret);
-        else
-            printf( "HMAC-MD5 test passed!\n");
-    #endif
-
-    #ifndef NO_SHA
-    if ( (ret = hmac_sha_test()) != 0)
-        err_sys("HMAC-SHA test failed!\n", ret);
-    else
-        printf( "HMAC-SHA test passed!\n");
-    #endif
-
-    #ifndef NO_SHA256
-        if ( (ret = hmac_sha256_test()) != 0)
-            err_sys("HMAC-SHA256 test failed!\n", ret);
-        else
-            printf( "HMAC-SHA256 test passed!\n");
-    #endif
-
-    #ifdef CYASSL_SHA384
-        if ( (ret = hmac_sha384_test()) != 0)
-            err_sys("HMAC-SHA384 test failed!\n", ret);
-        else
-            printf( "HMAC-SHA384 test passed!\n");
-    #endif
-
-    #ifdef CYASSL_SHA512
-        if ( (ret = hmac_sha512_test()) != 0)
-            err_sys("HMAC-SHA512 test failed!\n", ret);
-        else
-            printf( "HMAC-SHA512 test passed!\n");
-    #endif
-
-    #ifdef HAVE_BLAKE2
-        if ( (ret = hmac_blake2b_test()) != 0)
-            err_sys("HMAC-BLAKE2 test failed!\n", ret);
-        else
-            printf( "HMAC-BLAKE2 test passed!\n");
-    #endif
-
-    #ifdef HAVE_HKDF
-        if ( (ret = hkdf_test()) != 0)
-            err_sys("HMAC-KDF    test failed!\n", ret);
-        else
-            printf( "HMAC-KDF    test passed!\n");
-    #endif
-
-#endif
-
-#ifdef HAVE_AESGCM
-    if ( (ret = gmac_test()) != 0)
-        err_sys("GMAC     test passed!\n", ret);
-    else
-        printf( "GMAC     test passed!\n");
-#endif
-
-#ifndef NO_RC4
-    if ( (ret = arc4_test()) != 0)
-        err_sys("ARC4     test failed!\n", ret);
-    else
-        printf( "ARC4     test passed!\n");
-#endif
-
-#ifndef NO_HC128
-    if ( (ret = hc128_test()) != 0)
-        err_sys("HC-128   test failed!\n", ret);
-    else
-        printf( "HC-128   test passed!\n");
-#endif
-
-#ifndef NO_RABBIT
-    if ( (ret = rabbit_test()) != 0)
-        err_sys("Rabbit   test failed!\n", ret);
-    else
-        printf( "Rabbit   test passed!\n");
-#endif
-
-#ifndef NO_DES3
-    if ( (ret = des_test()) != 0)
-        err_sys("DES      test failed!\n", ret);
-    else
-        printf( "DES      test passed!\n");
-#endif
-
-#ifndef NO_DES3
-    if ( (ret = des3_test()) != 0)
-        err_sys("DES3     test failed!\n", ret);
-    else
-        printf( "DES3     test passed!\n");
-#endif
-
-#ifndef NO_AES
-    if ( (ret = aes_test()) != 0)
-        err_sys("AES      test failed!\n", ret);
-    else
-        printf( "AES      test passed!\n");
-
-#ifdef HAVE_AESGCM
-    if ( (ret = aesgcm_test()) != 0)
-        err_sys("AES-GCM  test failed!\n", ret);
-    else
-        printf( "AES-GCM  test passed!\n");
-#endif
-
-#ifdef HAVE_AESCCM
-    if ( (ret = aesccm_test()) != 0)
-        err_sys("AES-CCM  test failed!\n", ret);
-    else
-        printf( "AES-CCM  test passed!\n");
-#endif
-#endif
-
-#ifdef HAVE_CAMELLIA
-    if ( (ret = camellia_test()) != 0)
-        err_sys("CAMELLIA test failed!\n", ret);
-    else
-        printf( "CAMELLIA test passed!\n");
-#endif
-
-    if ( (ret = random_test()) != 0)
-        err_sys("RANDOM   test failed!\n", ret);
-    else
-        printf( "RANDOM   test passed!\n");
-
-#ifndef NO_RSA
-    if ( (ret = rsa_test()) != 0)
-        err_sys("RSA      test failed!\n", ret);
-    else
-        printf( "RSA      test passed!\n");
-#endif
-
-#ifndef NO_DH
-    if ( (ret = dh_test()) != 0)
-        err_sys("DH       test failed!\n", ret);
-    else
-        printf( "DH       test passed!\n");
-#endif
-
-#ifndef NO_DSA
-    if ( (ret = dsa_test()) != 0)
-        err_sys("DSA      test failed!\n", ret);
-    else
-        printf( "DSA      test passed!\n");
-#endif
-
-#ifndef NO_PWDBASED
-    if ( (ret = pwdbased_test()) != 0)
-        err_sys("PWDBASED test failed!\n", ret);
-    else
-        printf( "PWDBASED test passed!\n");
-#endif
-
-#ifdef OPENSSL_EXTRA
-    if ( (ret = openssl_test()) != 0)
-        err_sys("OPENSSL  test failed!\n", ret);
-    else
-        printf( "OPENSSL  test passed!\n");
-#endif
-
-#ifdef HAVE_ECC
-    if ( (ret = ecc_test()) != 0)
-        err_sys("ECC      test failed!\n", ret);
-    else
-        printf( "ECC      test passed!\n");
-    #ifdef HAVE_ECC_ENCRYPT
-        if ( (ret = ecc_encrypt_test()) != 0)
-            err_sys("ECC Enc  test failed!\n", ret);
-        else
-            printf( "ECC Enc  test passed!\n");
-    #endif
-#endif
-
-#ifdef HAVE_LIBZ
-    if ( (ret = compress_test()) != 0)
-        err_sys("COMPRESS test failed!\n", ret);
-    else
-        printf( "COMPRESS test passed!\n");
-#endif
-
-#ifdef HAVE_PKCS7
-    if ( (ret = pkcs7enveloped_test()) != 0)
-        err_sys("PKCS7enveloped test failed!\n", ret);
-    else
-        printf( "PKCS7enveloped test passed!\n");
-
-    if ( (ret = pkcs7signed_test()) != 0)
-        err_sys("PKCS7signed    test failed!\n", ret);
-    else
-        printf( "PKCS7signed    test passed!\n");
-#endif
-
-    ((func_args*)args)->return_code = ret;
-}
-
-
-#ifndef NO_MAIN_DRIVER
-
-#ifdef HAVE_CAVIUM
-
-static int OpenNitroxDevice(int dma_mode,int dev_id)
-{
-   Csp1CoreAssignment core_assign;
-   Uint32             device;
-
-   if (CspInitialize(CAVIUM_DIRECT,CAVIUM_DEV_ID))
-      return -1;
-   if (Csp1GetDevType(&device))
-      return -1;
-   if (device != NPX_DEVICE) {
-      if (ioctl(gpkpdev_hdlr[CAVIUM_DEV_ID], IOCTL_CSP1_GET_CORE_ASSIGNMENT,
-                (Uint32 *)&core_assign)!= 0)
-         return -1;
-   }
-   CspShutdown(CAVIUM_DEV_ID);
-
-   return CspInitialize(dma_mode, dev_id);
-}
-
-#endif /* HAVE_CAVIUM */
-
-    /* so overall tests can pull in test function */
-
-    int main(int argc, char** argv)
-    {
-
-        func_args args;
-
-
-#ifdef HAVE_CAVIUM
-        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
-        if (ret != 0)
-            err_sys("Cavium OpenNitroxDevice failed", -1236);
-#endif /* HAVE_CAVIUM */
-
-        args.argc = argc;
-        args.argv = argv;
-
-        ctaocrypt_test(&args);
-
-#ifdef HAVE_CAVIUM
-        CspShutdown(CAVIUM_DEV_ID);
-#endif
-
-        return args.return_code;
-    }
-
-#endif /* NO_MAIN_DRIVER */
-
-
-#ifdef CYASSL_MD2
-int md2_test()
-{
-    Md2  md2;
-    byte hash[MD2_DIGEST_SIZE];
-
-    testVector a, b, c, d, e, f, g;
-    testVector test_md2[7];
-    int times = sizeof(test_md2) / sizeof(testVector), i;
-
-    a.input  = "";
-    a.output = "\x83\x50\xe5\xa3\xe2\x4c\x15\x3d\xf2\x27\x5c\x9f\x80\x69"
-               "\x27\x73";
-    a.inLen  = strlen(a.input);
-    a.outLen = MD2_DIGEST_SIZE;
-
-    b.input  = "a";
-    b.output = "\x32\xec\x01\xec\x4a\x6d\xac\x72\xc0\xab\x96\xfb\x34\xc0"
-               "\xb5\xd1";
-    b.inLen  = strlen(b.input);
-    b.outLen = MD2_DIGEST_SIZE;
-
-    c.input  = "abc";
-    c.output = "\xda\x85\x3b\x0d\x3f\x88\xd9\x9b\x30\x28\x3a\x69\xe6\xde"
-               "\xd6\xbb";
-    c.inLen  = strlen(c.input);
-    c.outLen = MD2_DIGEST_SIZE;
-
-    d.input  = "message digest";
-    d.output = "\xab\x4f\x49\x6b\xfb\x2a\x53\x0b\x21\x9f\xf3\x30\x31\xfe"
-               "\x06\xb0";
-    d.inLen  = strlen(d.input);
-    d.outLen = MD2_DIGEST_SIZE;
-
-    e.input  = "abcdefghijklmnopqrstuvwxyz";
-    e.output = "\x4e\x8d\xdf\xf3\x65\x02\x92\xab\x5a\x41\x08\xc3\xaa\x47"
-               "\x94\x0b";
-    e.inLen  = strlen(e.input);
-    e.outLen = MD2_DIGEST_SIZE;
-
-    f.input  = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345"
-               "6789";
-    f.output = "\xda\x33\xde\xf2\xa4\x2d\xf1\x39\x75\x35\x28\x46\xc3\x03"
-               "\x38\xcd";
-    f.inLen  = strlen(f.input);
-    f.outLen = MD2_DIGEST_SIZE;
-
-    g.input  = "1234567890123456789012345678901234567890123456789012345678"
-               "9012345678901234567890";
-    g.output = "\xd5\x97\x6f\x79\xd8\x3d\x3a\x0d\xc9\x80\x6c\x3c\x66\xf3"
-               "\xef\xd8";
-    g.inLen  = strlen(g.input);
-    g.outLen = MD2_DIGEST_SIZE;
-
-    test_md2[0] = a;
-    test_md2[1] = b;
-    test_md2[2] = c;
-    test_md2[3] = d;
-    test_md2[4] = e;
-    test_md2[5] = f;
-    test_md2[6] = g;
-
-    InitMd2(&md2);
-
-    for (i = 0; i < times; ++i) {
-        Md2Update(&md2, (byte*)test_md2[i].input, (word32)test_md2[i].inLen);
-        Md2Final(&md2, hash);
-
-        if (memcmp(hash, test_md2[i].output, MD2_DIGEST_SIZE) != 0)
-            return -155 - i;
-    }
-
-    return 0;
-}
-#endif
-
-#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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    test_md5[0] = a;
-    test_md5[1] = b;
-    test_md5[2] = c;
-    test_md5[3] = d;
-    test_md5[4] = e;
-
-    InitMd5(&md5);
-
-    for (i = 0; i < times; ++i) {
-        Md5Update(&md5, (byte*)test_md5[i].input, (word32)test_md5[i].inLen);
-        Md5Final(&md5, hash);
-
-        if (memcmp(hash, test_md5[i].output, MD5_DIGEST_SIZE) != 0)
-            return -5 - i;
-    }
-
-    return 0;
-}
-#endif /* NO_MD5 */
-
-
-#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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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;
-
-    InitMd4(&md4);
-
-    for (i = 0; i < times; ++i) {
-        Md4Update(&md4, (byte*)test_md4[i].input, (word32)test_md4[i].inLen);
-        Md4Final(&md4, hash);
-
-        if (memcmp(hash, test_md4[i].output, MD4_DIGEST_SIZE) != 0)
-            return -205 - i;
-    }
-
-    return 0;
-}
-
-#endif /* NO_MD4 */
-
-#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;
-    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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    test_sha[0] = a;
-    test_sha[1] = b;
-    test_sha[2] = c;
-    test_sha[3] = d;
-
-    ret = InitSha(&sha);
-    if (ret != 0)
-        return -4001;
-
-    for (i = 0; i < times; ++i) {
-        ShaUpdate(&sha, (byte*)test_sha[i].input, (word32)test_sha[i].inLen);
-        ShaFinal(&sha, hash);
-
-        if (memcmp(hash, test_sha[i].output, SHA_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-
-#endif /* NO_SHA */
-
-#ifdef CYASSL_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 = RIPEMD_DIGEST_SIZE;
-
-    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 = RIPEMD_DIGEST_SIZE;
-
-    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 = RIPEMD_DIGEST_SIZE;
-
-    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 = RIPEMD_DIGEST_SIZE;
-
-    test_ripemd[0] = a;
-    test_ripemd[1] = b;
-    test_ripemd[2] = c;
-    test_ripemd[3] = d;
-
-    InitRipeMd(&ripemd);
-
-    for (i = 0; i < times; ++i) {
-        RipeMdUpdate(&ripemd, (byte*)test_ripemd[i].input,
-                     (word32)test_ripemd[i].inLen);
-        RipeMdFinal(&ripemd, hash);
-
-        if (memcmp(hash, test_ripemd[i].output, RIPEMD_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-#endif /* CYASSL_RIPEMD */
-
-
-#ifdef HAVE_BLAKE2
-
-
-#define BLAKE2_TESTS 3
-
-static const byte blake2b_vec[BLAKE2_TESTS][BLAKE2B_OUTBYTES] =
-{
-  {
-    0x78, 0x6A, 0x02, 0xF7, 0x42, 0x01, 0x59, 0x03,
-    0xC6, 0xC6, 0xFD, 0x85, 0x25, 0x52, 0xD2, 0x72,
-    0x91, 0x2F, 0x47, 0x40, 0xE1, 0x58, 0x47, 0x61,
-    0x8A, 0x86, 0xE2, 0x17, 0xF7, 0x1F, 0x54, 0x19,
-    0xD2, 0x5E, 0x10, 0x31, 0xAF, 0xEE, 0x58, 0x53,
-    0x13, 0x89, 0x64, 0x44, 0x93, 0x4E, 0xB0, 0x4B,
-    0x90, 0x3A, 0x68, 0x5B, 0x14, 0x48, 0xB7, 0x55,
-    0xD5, 0x6F, 0x70, 0x1A, 0xFE, 0x9B, 0xE2, 0xCE
-  },
-  {
-    0x2F, 0xA3, 0xF6, 0x86, 0xDF, 0x87, 0x69, 0x95,
-    0x16, 0x7E, 0x7C, 0x2E, 0x5D, 0x74, 0xC4, 0xC7,
-    0xB6, 0xE4, 0x8F, 0x80, 0x68, 0xFE, 0x0E, 0x44,
-    0x20, 0x83, 0x44, 0xD4, 0x80, 0xF7, 0x90, 0x4C,
-    0x36, 0x96, 0x3E, 0x44, 0x11, 0x5F, 0xE3, 0xEB,
-    0x2A, 0x3A, 0xC8, 0x69, 0x4C, 0x28, 0xBC, 0xB4,
-    0xF5, 0xA0, 0xF3, 0x27, 0x6F, 0x2E, 0x79, 0x48,
-    0x7D, 0x82, 0x19, 0x05, 0x7A, 0x50, 0x6E, 0x4B
-  },
-  {
-    0x1C, 0x08, 0x79, 0x8D, 0xC6, 0x41, 0xAB, 0xA9,
-    0xDE, 0xE4, 0x35, 0xE2, 0x25, 0x19, 0xA4, 0x72,
-    0x9A, 0x09, 0xB2, 0xBF, 0xE0, 0xFF, 0x00, 0xEF,
-    0x2D, 0xCD, 0x8E, 0xD6, 0xF8, 0xA0, 0x7D, 0x15,
-    0xEA, 0xF4, 0xAE, 0xE5, 0x2B, 0xBF, 0x18, 0xAB,
-    0x56, 0x08, 0xA6, 0x19, 0x0F, 0x70, 0xB9, 0x04,
-    0x86, 0xC8, 0xA7, 0xD4, 0x87, 0x37, 0x10, 0xB1,
-    0x11, 0x5D, 0x3D, 0xEB, 0xBB, 0x43, 0x27, 0xB5
-  }
-};
-
-
-
-int blake2b_test(void)
-{
-    Blake2b b2b;
-    byte    digest[64];
-    byte    input[64];
-    int     i, ret;
-
-    for (i = 0; i < (int)sizeof(input); i++)
-        input[i] = (byte)i;
-
-    for (i = 0; i < BLAKE2_TESTS; i++) {
-        ret = InitBlake2b(&b2b, 64);
-        if (ret != 0)
-            return -4002;
-
-        ret = Blake2bUpdate(&b2b, input, i);
-        if (ret != 0)
-            return -4003;
-
-        ret = Blake2bFinal(&b2b, digest, 64);
-        if (ret != 0)
-            return -4004;
-
-        if (memcmp(digest, blake2b_vec[i], 64) != 0) {
-            return -300 - i;
-        }
-    }
-
-    return 0;
-}
-#endif /* HAVE_BLAKE2 */
-
-
-#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 = SHA256_DIGEST_SIZE;
-
-    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 = SHA256_DIGEST_SIZE;
-
-    test_sha[0] = a;
-    test_sha[1] = b;
-
-    ret = InitSha256(&sha);
-    if (ret != 0)
-        return -4005;
-
-    for (i = 0; i < times; ++i) {
-        ret = Sha256Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
-        if (ret != 0)
-            return -4006;
-        ret = Sha256Final(&sha, hash);
-        if (ret != 0)
-            return -4007;
-
-        if (memcmp(hash, test_sha[i].output, SHA256_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-#endif
-
-
-#ifdef CYASSL_SHA512
-int sha512_test(void)
-{
-    Sha512 sha;
-    byte   hash[SHA512_DIGEST_SIZE];
-    int    ret;
-
-    testVector a, b;
-    testVector test_sha[2];
-    int times = sizeof(test_sha) / sizeof(struct testVector), i;
-
-    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 = SHA512_DIGEST_SIZE;
-
-    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 = SHA512_DIGEST_SIZE;
-
-    test_sha[0] = a;
-    test_sha[1] = b;
-
-    ret = InitSha512(&sha);
-    if (ret != 0)
-        return -4009;
-
-    for (i = 0; i < times; ++i) {
-        ret = Sha512Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
-        if (ret != 0)
-            return -4010;
-
-        ret = Sha512Final(&sha, hash);
-        if (ret != 0)
-            return -4011;
-
-        if (memcmp(hash, test_sha[i].output, SHA512_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-#endif
-
-
-#ifdef CYASSL_SHA384
-int sha384_test(void)
-{
-    Sha384 sha;
-    byte   hash[SHA384_DIGEST_SIZE];
-    int    ret;
-
-    testVector a, b;
-    testVector test_sha[2];
-    int times = sizeof(test_sha) / sizeof(struct testVector), i;
-
-    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 = SHA384_DIGEST_SIZE;
-
-    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 = SHA384_DIGEST_SIZE;
-
-    test_sha[0] = a;
-    test_sha[1] = b;
-
-    ret = InitSha384(&sha);
-    if (ret != 0)
-        return -4012;
-
-    for (i = 0; i < times; ++i) {
-        ret = Sha384Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
-        if (ret != 0)
-            return -4013;
-
-        ret = Sha384Final(&sha, hash);
-        if (ret != 0)
-            return -4014;
-
-        if (memcmp(hash, test_sha[i].output, SHA384_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-#endif /* CYASSL_SHA384 */
-
-
-#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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-#if defined(HAVE_FIPS) || defined(HAVE_CAVIUM)
-        if (i == 1)
-            continue; /* cavium can't handle short keys, fips not allowed */
-#endif
-#ifdef HAVE_CAVIUM
-        if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
-            return -20009;
-#endif
-        ret = HmacSetKey(&hmac, MD5, (byte*)keys[i], (word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4015;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4016;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4017;
-
-        if (memcmp(hash, test_hmac[i].output, MD5_DIGEST_SIZE) != 0)
-            return -20 - i;
-#ifdef HAVE_CAVIUM
-        HmacFreeCavium(&hmac);
-#endif
-    }
-
-    return 0;
-}
-#endif /* NO_HMAC && NO_MD5 */
-
-#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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-#if defined(HAVE_FIPS) || defined(HAVE_CAVIUM)
-        if (i == 1)
-            continue; /* cavium can't handle short keys, fips not allowed */
-#endif
-#ifdef HAVE_CAVIUM
-        if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
-            return -20010;
-#endif
-        ret = HmacSetKey(&hmac, SHA, (byte*)keys[i], (word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4018;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4019;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4020;
-
-        if (memcmp(hash, test_hmac[i].output, SHA_DIGEST_SIZE) != 0)
-            return -20 - i;
-#ifdef HAVE_CAVIUM
-        HmacFreeCavium(&hmac);
-#endif
-    }
-
-    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 = SHA256_DIGEST_SIZE;
-
-    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 = SHA256_DIGEST_SIZE;
-
-    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 = SHA256_DIGEST_SIZE;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-#if defined(HAVE_FIPS) || defined(HAVE_CAVIUM)
-        if (i == 1)
-            continue; /* cavium can't handle short keys, fips not allowed */
-#endif
-#ifdef HAVE_CAVIUM
-        if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
-            return -20011;
-#endif
-        ret = HmacSetKey(&hmac, SHA256, (byte*)keys[i],(word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4021;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4022;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4023;
-
-        if (memcmp(hash, test_hmac[i].output, SHA256_DIGEST_SIZE) != 0)
-            return -20 - i;
-#ifdef HAVE_CAVIUM
-        HmacFreeCavium(&hmac);
-#endif
-    }
-
-    return 0;
-}
-#endif
-
-
-#if !defined(NO_HMAC) && defined(HAVE_BLAKE2)
-int hmac_blake2b_test(void)
-{
-    Hmac hmac;
-    byte hash[BLAKE2B_256];
-
-    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 = "\x72\x93\x0d\xdd\xf5\xf7\xe1\x78\x38\x07\x44\x18\x0b\x3f\x51"
-               "\x37\x25\xb5\x82\xc2\x08\x83\x2f\x1c\x99\xfd\x03\xa0\x16\x75"
-               "\xac\xfd";
-    a.inLen  = strlen(a.input);
-    a.outLen = BLAKE2B_256;
-
-    b.input  = "what do ya want for nothing?";
-    b.output = "\x3d\x20\x50\x71\x05\xc0\x8c\x0c\x38\x44\x1e\xf7\xf9\xd1\x67"
-               "\x21\xff\x64\xf5\x94\x00\xcf\xf9\x75\x41\xda\x88\x61\x9d\x7c"
-               "\xda\x2b";
-    b.inLen  = strlen(b.input);
-    b.outLen = BLAKE2B_256;
-
-    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 = "\xda\xfe\x2a\x24\xfc\xe7\xea\x36\x34\xbe\x41\x92\xc7\x11\xa7"
-               "\x00\xae\x53\x9c\x11\x9c\x80\x74\x55\x22\x25\x4a\xb9\x55\xd3"
-               "\x0f\x87";
-    c.inLen  = strlen(c.input);
-    c.outLen = BLAKE2B_256;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-#if defined(HAVE_FIPS) || defined(HAVE_CAVIUM)
-        if (i == 1)
-            continue; /* cavium can't handle short keys, fips not allowed */
-#endif
-#ifdef HAVE_CAVIUM
-        if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
-            return -20011;
-#endif
-        ret = HmacSetKey(&hmac, BLAKE2B_ID, (byte*)keys[i],
-                         (word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4024;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4025;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4026;
-
-        if (memcmp(hash, test_hmac[i].output, BLAKE2B_256) != 0)
-            return -20 - i;
-#ifdef HAVE_CAVIUM
-        HmacFreeCavium(&hmac);
-#endif
-    }
-
-    return 0;
-}
-#endif
-
-
-#if !defined(NO_HMAC) && defined(CYASSL_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 = SHA384_DIGEST_SIZE;
-
-    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 = SHA384_DIGEST_SIZE;
-
-    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 = SHA384_DIGEST_SIZE;
-
-    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 = HmacSetKey(&hmac, SHA384, (byte*)keys[i],(word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4027;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4028;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4029;
-
-        if (memcmp(hash, test_hmac[i].output, SHA384_DIGEST_SIZE) != 0)
-            return -20 - i;
-    }
-
-    return 0;
-}
-#endif
-
-
-#if !defined(NO_HMAC) && defined(CYASSL_SHA512)
-int hmac_sha512_test(void)
-{
-    Hmac hmac;
-    byte hash[SHA512_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 = "\x87\xaa\x7c\xde\xa5\xef\x61\x9d\x4f\xf0\xb4\x24\x1a\x1d\x6c"
-               "\xb0\x23\x79\xf4\xe2\xce\x4e\xc2\x78\x7a\xd0\xb3\x05\x45\xe1"
-               "\x7c\xde\xda\xa8\x33\xb7\xd6\xb8\xa7\x02\x03\x8b\x27\x4e\xae"
-               "\xa3\xf4\xe4\xbe\x9d\x91\x4e\xeb\x61\xf1\x70\x2e\x69\x6c\x20"
-               "\x3a\x12\x68\x54";
-    a.inLen  = strlen(a.input);
-    a.outLen = SHA512_DIGEST_SIZE;
-
-    b.input  = "what do ya want for nothing?";
-    b.output = "\x16\x4b\x7a\x7b\xfc\xf8\x19\xe2\xe3\x95\xfb\xe7\x3b\x56\xe0"
-               "\xa3\x87\xbd\x64\x22\x2e\x83\x1f\xd6\x10\x27\x0c\xd7\xea\x25"
-               "\x05\x54\x97\x58\xbf\x75\xc0\x5a\x99\x4a\x6d\x03\x4f\x65\xf8"
-               "\xf0\xe6\xfd\xca\xea\xb1\xa3\x4d\x4a\x6b\x4b\x63\x6e\x07\x0a"
-               "\x38\xbc\xe7\x37";
-    b.inLen  = strlen(b.input);
-    b.outLen = SHA512_DIGEST_SIZE;
-
-    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 = "\xfa\x73\xb0\x08\x9d\x56\xa2\x84\xef\xb0\xf0\x75\x6c\x89\x0b"
-               "\xe9\xb1\xb5\xdb\xdd\x8e\xe8\x1a\x36\x55\xf8\x3e\x33\xb2\x27"
-               "\x9d\x39\xbf\x3e\x84\x82\x79\xa7\x22\xc8\x06\xb4\x85\xa4\x7e"
-               "\x67\xc8\x07\xb9\x46\xa3\x37\xbe\xe8\x94\x26\x74\x27\x88\x59"
-               "\xe1\x32\x92\xfb";
-    c.inLen  = strlen(c.input);
-    c.outLen = SHA512_DIGEST_SIZE;
-
-    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 = HmacSetKey(&hmac, SHA512, (byte*)keys[i],(word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4030;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4031;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4032;
-
-        if (memcmp(hash, test_hmac[i].output, SHA512_DIGEST_SIZE) != 0)
-            return -20 - i;
-    }
-
-    return 0;
-}
-#endif
-
-
-#ifndef NO_RC4
-int arc4_test(void)
-{
-    byte cipher[16];
-    byte plain[16];
-
-    const char* keys[] =
-    {
-        "\x01\x23\x45\x67\x89\xab\xcd\xef",
-        "\x01\x23\x45\x67\x89\xab\xcd\xef",
-        "\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\xef\x01\x23\x45"
-    };
-
-    testVector a, b, c, d;
-    testVector test_arc4[4];
-
-    int times = sizeof(test_arc4) / sizeof(testVector), i;
-
-    a.input  = "\x01\x23\x45\x67\x89\xab\xcd\xef";
-    a.output = "\x75\xb7\x87\x80\x99\xe0\xc5\x96";
-    a.inLen  = 8;
-    a.outLen = 8;
-
-    b.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    b.output = "\x74\x94\xc2\xe7\x10\x4b\x08\x79";
-    b.inLen  = 8;
-    b.outLen = 8;
-
-    c.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    c.output = "\xde\x18\x89\x41\xa3\x37\x5d\x3a";
-    c.inLen  = 8;
-    c.outLen = 8;
-
-    d.input  = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
-    d.output = "\xd6\xa1\x41\xa7\xec\x3c\x38\xdf\xbd\x61";
-    d.inLen  = 10;
-    d.outLen = 10;
-
-    test_arc4[0] = a;
-    test_arc4[1] = b;
-    test_arc4[2] = c;
-    test_arc4[3] = d;
-
-    for (i = 0; i < times; ++i) {
-        Arc4 enc;
-        Arc4 dec;
-        int  keylen = 8;  /* strlen with key 0x00 not good */
-        if (i == 3)
-            keylen = 4;
-
-#ifdef HAVE_CAVIUM
-        if (Arc4InitCavium(&enc, CAVIUM_DEV_ID) != 0)
-            return -20001;
-        if (Arc4InitCavium(&dec, CAVIUM_DEV_ID) != 0)
-            return -20002;
-#endif
-
-        Arc4SetKey(&enc, (byte*)keys[i], keylen);
-        Arc4SetKey(&dec, (byte*)keys[i], keylen);
-
-        Arc4Process(&enc, cipher, (byte*)test_arc4[i].input,
-                    (word32)test_arc4[i].outLen);
-        Arc4Process(&dec, plain,  cipher, (word32)test_arc4[i].outLen);
-
-        if (memcmp(plain, test_arc4[i].input, test_arc4[i].outLen))
-            return -20 - i;
-
-        if (memcmp(cipher, test_arc4[i].output, test_arc4[i].outLen))
-            return -20 - 5 - i;
-
-#ifdef HAVE_CAVIUM
-        Arc4FreeCavium(&enc);
-        Arc4FreeCavium(&dec);
-#endif
-    }
-
-    return 0;
-}
-#endif
-
-
-int hc128_test(void)
-{
-#ifdef HAVE_HC128
-    byte cipher[16];
-    byte plain[16];
-
-    const char* keys[] =
-    {
-        "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x00\x53\xA6\xF9\x4C\x9F\xF2\x45\x98\xEB\x3E\x91\xE4\x37\x8A\xDD",
-        "\x0F\x62\xB5\x08\x5B\xAE\x01\x54\xA7\xFA\x4D\xA0\xF3\x46\x99\xEC"
-    };
-
-    const char* ivs[] =
-    {
-        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x0D\x74\xDB\x42\xA9\x10\x77\xDE\x45\xAC\x13\x7A\xE1\x48\xAF\x16",
-        "\x28\x8F\xF6\x5D\xC4\x2B\x92\xF9\x60\xC7\x2E\x95\xFC\x63\xCA\x31"
-    };
-
-
-    testVector a, b, c, d;
-    testVector test_hc128[4];
-
-    int times = sizeof(test_hc128) / sizeof(testVector), i;
-
-    a.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    a.output = "\x37\x86\x02\xB9\x8F\x32\xA7\x48";
-    a.inLen  = 8;
-    a.outLen = 8;
-
-    b.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    b.output = "\x33\x7F\x86\x11\xC6\xED\x61\x5F";
-    b.inLen  = 8;
-    b.outLen = 8;
-
-    c.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    c.output = "\x2E\x1E\xD1\x2A\x85\x51\xC0\x5A";
-    c.inLen  = 8;
-    c.outLen = 8;
-
-    d.input  = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
-    d.output = "\x1C\xD8\xAE\xDD\xFE\x52\xE2\x17\xE8\x35\xD0\xB7\xE8\x4E\x29";
-    d.inLen  = 15;
-    d.outLen = 15;
-
-    test_hc128[0] = a;
-    test_hc128[1] = b;
-    test_hc128[2] = c;
-    test_hc128[3] = d;
-
-    for (i = 0; i < times; ++i) {
-        HC128 enc;
-        HC128 dec;
-
-        /* align keys/ivs in plain/cipher buffers */
-        memcpy(plain,  keys[i], 16);
-        memcpy(cipher, ivs[i],  16);
-
-        Hc128_SetKey(&enc, plain, cipher);
-        Hc128_SetKey(&dec, plain, cipher);
-
-        /* align input */
-        memcpy(plain, test_hc128[i].input, test_hc128[i].outLen);
-        Hc128_Process(&enc, cipher, plain,  (word32)test_hc128[i].outLen);
-        Hc128_Process(&dec, plain,  cipher, (word32)test_hc128[i].outLen);
-
-        if (memcmp(plain, test_hc128[i].input, test_hc128[i].outLen))
-            return -120 - i;
-
-        if (memcmp(cipher, test_hc128[i].output, test_hc128[i].outLen))
-            return -120 - 5 - i;
-    }
-
-#endif /* HAVE_HC128 */
-    return 0;
-}
-
-
-#ifndef NO_RABBIT
-int rabbit_test(void)
-{
-    byte cipher[16];
-    byte plain[16];
-
-    const char* keys[] =
-    {
-        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\xAC\xC3\x51\xDC\xF1\x62\xFC\x3B\xFE\x36\x3D\x2E\x29\x13\x28\x91"
-    };
-
-    const char* ivs[] =
-    {
-        "\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x59\x7E\x26\xC1\x75\xF5\x73\xC3",
-        0
-    };
-
-    testVector a, b, c;
-    testVector test_rabbit[3];
-
-    int times = sizeof(test_rabbit) / sizeof(testVector), i;
-
-    a.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    a.output = "\xED\xB7\x05\x67\x37\x5D\xCD\x7C";
-    a.inLen  = 8;
-    a.outLen = 8;
-
-    b.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    b.output = "\x6D\x7D\x01\x22\x92\xCC\xDC\xE0";
-    b.inLen  = 8;
-    b.outLen = 8;
-
-    c.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    c.output = "\x04\xCE\xCA\x7A\x1A\x86\x6E\x77";
-    c.inLen  = 8;
-    c.outLen = 8;
-
-    test_rabbit[0] = a;
-    test_rabbit[1] = b;
-    test_rabbit[2] = c;
-
-    for (i = 0; i < times; ++i) {
-        Rabbit enc;
-        Rabbit dec;
-        byte*  iv;
-
-        /* align keys/ivs in plain/cipher buffers */
-        memcpy(plain,  keys[i], 16);
-        if (ivs[i]) {
-            memcpy(cipher, ivs[i],   8);
-            iv = cipher;
-        } else
-            iv = NULL;
-        RabbitSetKey(&enc, plain, iv);
-        RabbitSetKey(&dec, plain, iv);
-
-        /* align input */
-        memcpy(plain, test_rabbit[i].input, test_rabbit[i].outLen);
-        RabbitProcess(&enc, cipher, plain,  (word32)test_rabbit[i].outLen);
-        RabbitProcess(&dec, plain,  cipher, (word32)test_rabbit[i].outLen);
-
-        if (memcmp(plain, test_rabbit[i].input, test_rabbit[i].outLen))
-            return -130 - i;
-
-        if (memcmp(cipher, test_rabbit[i].output, test_rabbit[i].outLen))
-            return -130 - 5 - i;
-    }
-
-    return 0;
-}
-#endif /* NO_RABBIT */
-
-
-#ifndef NO_DES3
-int des_test(void)
-{
-    const byte vector[] = { /* "now is the time for all " w/o trailing 0 */
-        0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-        0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-        0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-    };
-
-    byte plain[24];
-    byte cipher[24];
-
-    Des enc;
-    Des dec;
-
-    const byte key[] =
-    {
-        0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef
-    };
-
-    const byte iv[] =
-    {
-        0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef
-    };
-
-    const byte verify[] =
-    {
-        0x8b,0x7c,0x52,0xb0,0x01,0x2b,0x6c,0xb8,
-        0x4f,0x0f,0xeb,0xf3,0xfb,0x5f,0x86,0x73,
-        0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
-    };
-
-    int ret;
-
-    ret = Des_SetKey(&enc, key, iv, DES_ENCRYPTION);
-    if (ret != 0)
-        return -31;
-
-    Des_CbcEncrypt(&enc, cipher, vector, sizeof(vector));
-    ret = Des_SetKey(&dec, key, iv, DES_DECRYPTION);
-    if (ret != 0)
-        return -32;
-    Des_CbcDecrypt(&dec, plain, cipher, sizeof(cipher));
-
-    if (memcmp(plain, vector, sizeof(plain)))
-        return -33;
-
-    if (memcmp(cipher, verify, sizeof(cipher)))
-        return -34;
-
-    return 0;
-}
-#endif /* NO_DES3 */
-
-
-#ifndef NO_DES3
-int des3_test(void)
-{
-    const byte vector[] = { /* "Now is the time for all " w/o trailing 0 */
-        0x4e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-        0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-        0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-    };
-
-    byte plain[24];
-    byte cipher[24];
-
-    Des3 enc;
-    Des3 dec;
-
-    const byte key3[] =
-    {
-        0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
-        0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10,
-        0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67
-    };
-    const byte iv3[] =
-    {
-        0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef,
-        0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-        0x11,0x21,0x31,0x41,0x51,0x61,0x71,0x81
-
-    };
-
-    const byte verify3[] =
-    {
-        0x43,0xa0,0x29,0x7e,0xd1,0x84,0xf8,0x0e,
-        0x89,0x64,0x84,0x32,0x12,0xd5,0x08,0x98,
-        0x18,0x94,0x15,0x74,0x87,0x12,0x7d,0xb0
-    };
-
-    int ret;
-
-
-#ifdef HAVE_CAVIUM
-    if (Des3_InitCavium(&enc, CAVIUM_DEV_ID) != 0)
-        return -20005;
-    if (Des3_InitCavium(&dec, CAVIUM_DEV_ID) != 0)
-        return -20006;
-#endif
-    ret = Des3_SetKey(&enc, key3, iv3, DES_ENCRYPTION);
-    if (ret != 0)
-        return -31;
-    ret = Des3_SetKey(&dec, key3, iv3, DES_DECRYPTION);
-    if (ret != 0)
-        return -32;
-    ret = Des3_CbcEncrypt(&enc, cipher, vector, sizeof(vector));
-    if (ret != 0)
-        return -33;
-    ret = Des3_CbcDecrypt(&dec, plain, cipher, sizeof(cipher));
-    if (ret != 0)
-        return -34;
-
-    if (memcmp(plain, vector, sizeof(plain)))
-        return -35;
-
-    if (memcmp(cipher, verify3, sizeof(cipher)))
-        return -36;
-
-#ifdef HAVE_CAVIUM
-    Des3_FreeCavium(&enc);
-    Des3_FreeCavium(&dec);
-#endif
-    return 0;
-}
-#endif /* NO_DES */
-
-
-#ifndef NO_AES
-int aes_test(void)
-{
-    Aes enc;
-    Aes dec;
-
-    const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */
-        0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-        0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-        0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-    };
-
-    const byte verify[] =
-    {
-        0x95,0x94,0x92,0x57,0x5f,0x42,0x81,0x53,
-        0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
-    };
-
-    byte key[] = "0123456789abcdef   ";  /* align */
-    byte iv[]  = "1234567890abcdef   ";  /* align */
-
-    byte cipher[AES_BLOCK_SIZE * 4];
-    byte plain [AES_BLOCK_SIZE * 4];
-    int  ret;
-
-#ifdef HAVE_CAVIUM
-        if (AesInitCavium(&enc, CAVIUM_DEV_ID) != 0)
-            return -20003;
-        if (AesInitCavium(&dec, CAVIUM_DEV_ID) != 0)
-            return -20004;
-#endif
-    ret = AesSetKey(&enc, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
-    if (ret != 0)
-        return -1001;
-    ret = AesSetKey(&dec, key, AES_BLOCK_SIZE, iv, AES_DECRYPTION);
-    if (ret != 0)
-        return -1002;
-
-    ret = AesCbcEncrypt(&enc, cipher, msg,   AES_BLOCK_SIZE);
-    if (ret != 0)
-        return -1005;
-    ret = AesCbcDecrypt(&dec, plain, cipher, AES_BLOCK_SIZE);
-    if (ret != 0)
-        return -1006;
-
-    if (memcmp(plain, msg, AES_BLOCK_SIZE))
-        return -60;
-
-    if (memcmp(cipher, verify, AES_BLOCK_SIZE))
-        return -61;
-
-#ifdef HAVE_CAVIUM
-        AesFreeCavium(&enc);
-        AesFreeCavium(&dec);
-#endif
-#ifdef CYASSL_AES_COUNTER
-    {
-        const byte ctrKey[] =
-        {
-            0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,
-            0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c
-        };
-
-        const byte ctrIv[] =
-        {
-            0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,
-            0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
-        };
-
-
-        const byte ctrPlain[] =
-        {
-            0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,
-            0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a,
-            0xae,0x2d,0x8a,0x57,0x1e,0x03,0xac,0x9c,
-            0x9e,0xb7,0x6f,0xac,0x45,0xaf,0x8e,0x51,
-            0x30,0xc8,0x1c,0x46,0xa3,0x5c,0xe4,0x11,
-            0xe5,0xfb,0xc1,0x19,0x1a,0x0a,0x52,0xef,
-            0xf6,0x9f,0x24,0x45,0xdf,0x4f,0x9b,0x17,
-            0xad,0x2b,0x41,0x7b,0xe6,0x6c,0x37,0x10
-        };
-
-        const byte ctrCipher[] =
-        {
-            0x87,0x4d,0x61,0x91,0xb6,0x20,0xe3,0x26,
-            0x1b,0xef,0x68,0x64,0x99,0x0d,0xb6,0xce,
-            0x98,0x06,0xf6,0x6b,0x79,0x70,0xfd,0xff,
-            0x86,0x17,0x18,0x7b,0xb9,0xff,0xfd,0xff,
-            0x5a,0xe4,0xdf,0x3e,0xdb,0xd5,0xd3,0x5e,
-            0x5b,0x4f,0x09,0x02,0x0d,0xb0,0x3e,0xab,
-            0x1e,0x03,0x1d,0xda,0x2f,0xbe,0x03,0xd1,
-            0x79,0x21,0x70,0xa0,0xf3,0x00,0x9c,0xee
-        };
-
-        const byte oddCipher[] =
-        {
-            0xb9,0xd7,0xcb,0x08,0xb0,0xe1,0x7b,0xa0,
-            0xc2
-        };
-
-        AesSetKeyDirect(&enc, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION);
-        /* Ctr only uses encrypt, even on key setup */
-        AesSetKeyDirect(&dec, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION);
-
-        AesCtrEncrypt(&enc, cipher, ctrPlain, AES_BLOCK_SIZE*4);
-        AesCtrEncrypt(&dec, plain, cipher, AES_BLOCK_SIZE*4);
-
-        if (memcmp(plain, ctrPlain, AES_BLOCK_SIZE*4))
-            return -66;
-
-        if (memcmp(cipher, ctrCipher, AES_BLOCK_SIZE*4))
-            return -67;
-
-        /* let's try with just 9 bytes, non block size test */
-        AesSetKeyDirect(&enc, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION);
-        /* Ctr only uses encrypt, even on key setup */
-        AesSetKeyDirect(&dec, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION);
-
-        AesCtrEncrypt(&enc, cipher, ctrPlain, 9);
-        AesCtrEncrypt(&dec, plain, cipher, 9);
-
-        if (memcmp(plain, ctrPlain, 9))
-            return -68;
-
-        if (memcmp(cipher, ctrCipher, 9))
-            return -69;
-
-        /* and an additional 9 bytes to reuse tmp left buffer */
-        AesCtrEncrypt(&enc, cipher, ctrPlain, 9);
-        AesCtrEncrypt(&dec, plain, cipher, 9);
-
-        if (memcmp(plain, ctrPlain, 9))
-            return -70;
-
-        if (memcmp(cipher, oddCipher, 9))
-            return -71;
-    }
-#endif /* CYASSL_AES_COUNTER */
-
-#if defined(CYASSL_AESNI) && defined(CYASSL_AES_DIRECT)
-    {
-        const byte niPlain[] =
-        {
-            0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,
-            0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a
-        };
-
-        const byte niCipher[] =
-        {
-            0xf3,0xee,0xd1,0xbd,0xb5,0xd2,0xa0,0x3c,
-            0x06,0x4b,0x5a,0x7e,0x3d,0xb1,0x81,0xf8
-        };
-
-        const byte niKey[] =
-        {
-            0x60,0x3d,0xeb,0x10,0x15,0xca,0x71,0xbe,
-            0x2b,0x73,0xae,0xf0,0x85,0x7d,0x77,0x81,
-            0x1f,0x35,0x2c,0x07,0x3b,0x61,0x08,0xd7,
-            0x2d,0x98,0x10,0xa3,0x09,0x14,0xdf,0xf4
-        };
-
-        XMEMSET(cipher, 0, AES_BLOCK_SIZE);
-        ret = AesSetKey(&enc, niKey, sizeof(niKey), cipher, AES_ENCRYPTION);
-        if (ret != 0)
-            return -1003;
-        AesEncryptDirect(&enc, cipher, niPlain);
-        if (XMEMCMP(cipher, niCipher, AES_BLOCK_SIZE) != 0)
-            return -20006;
-
-        XMEMSET(plain, 0, AES_BLOCK_SIZE);
-        ret = AesSetKey(&dec, niKey, sizeof(niKey), plain, AES_DECRYPTION);
-        if (ret != 0)
-            return -1004;
-        AesDecryptDirect(&dec, plain, niCipher);
-        if (XMEMCMP(plain, niPlain, AES_BLOCK_SIZE) != 0)
-            return -20007;
-    }
-#endif /* CYASSL_AESNI && CYASSL_AES_DIRECT */
-
-    return 0;
-}
-
-#ifdef HAVE_AESGCM
-int aesgcm_test(void)
-{
-    Aes enc;
-
-    /*
-     * This is Test Case 16 from the document Galois/
-     * Counter Mode of Operation (GCM) by McGrew and
-     * Viega.
-     */
-    const byte k[] =
-    {
-        0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
-        0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
-        0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
-        0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08
-    };
-
-    const byte iv[] =
-    {
-        0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
-        0xde, 0xca, 0xf8, 0x88
-    };
-
-    const byte p[] =
-    {
-        0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
-        0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
-        0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
-        0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
-        0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
-        0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
-        0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
-        0xba, 0x63, 0x7b, 0x39
-    };
-
-    const byte a[] =
-    {
-        0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
-        0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
-        0xab, 0xad, 0xda, 0xd2
-    };
-
-    const byte c[] =
-    {
-        0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07,
-        0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d,
-        0x64, 0x3a, 0x8c, 0xdc, 0xbf, 0xe5, 0xc0, 0xc9,
-        0x75, 0x98, 0xa2, 0xbd, 0x25, 0x55, 0xd1, 0xaa,
-        0x8c, 0xb0, 0x8e, 0x48, 0x59, 0x0d, 0xbb, 0x3d,
-        0xa7, 0xb0, 0x8b, 0x10, 0x56, 0x82, 0x88, 0x38,
-        0xc5, 0xf6, 0x1e, 0x63, 0x93, 0xba, 0x7a, 0x0a,
-        0xbc, 0xc9, 0xf6, 0x62
-    };
-
-    const byte t[] =
-    {
-        0x76, 0xfc, 0x6e, 0xce, 0x0f, 0x4e, 0x17, 0x68,
-        0xcd, 0xdf, 0x88, 0x53, 0xbb, 0x2d, 0x55, 0x1b
-    };
-
-    byte t2[sizeof(t)];
-    byte p2[sizeof(c)];
-    byte c2[sizeof(p)];
-
-    int result;
-
-    memset(t2, 0, sizeof(t2));
-    memset(c2, 0, sizeof(c2));
-    memset(p2, 0, sizeof(p2));
-
-    AesGcmSetKey(&enc, k, sizeof(k));
-    /* AES-GCM encrypt and decrypt both use AES encrypt internally */
-    AesGcmEncrypt(&enc, c2, p, sizeof(c2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (memcmp(c, c2, sizeof(c2)))
-        return -68;
-    if (memcmp(t, t2, sizeof(t2)))
-        return -69;
-
-    result = AesGcmDecrypt(&enc, p2, c2, sizeof(p2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (result != 0)
-        return -70;
-    if (memcmp(p, p2, sizeof(p2)))
-        return -71;
-
-    return 0;
-}
-
-int gmac_test(void)
-{
-    Gmac gmac;
-
-    const byte k1[] =
-    {
-        0x89, 0xc9, 0x49, 0xe9, 0xc8, 0x04, 0xaf, 0x01,
-        0x4d, 0x56, 0x04, 0xb3, 0x94, 0x59, 0xf2, 0xc8
-    };
-    const byte iv1[] =
-    {
-        0xd1, 0xb1, 0x04, 0xc8, 0x15, 0xbf, 0x1e, 0x94,
-        0xe2, 0x8c, 0x8f, 0x16
-    };
-    const byte a1[] =
-    {
-       0x82, 0xad, 0xcd, 0x63, 0x8d, 0x3f, 0xa9, 0xd9,
-       0xf3, 0xe8, 0x41, 0x00, 0xd6, 0x1e, 0x07, 0x77
-    };
-    const byte t1[] =
-    {
-        0x88, 0xdb, 0x9d, 0x62, 0x17, 0x2e, 0xd0, 0x43,
-        0xaa, 0x10, 0xf1, 0x6d, 0x22, 0x7d, 0xc4, 0x1b
-    };
-
-    const byte k2[] =
-    {
-        0x40, 0xf7, 0xec, 0xb2, 0x52, 0x6d, 0xaa, 0xd4,
-        0x74, 0x25, 0x1d, 0xf4, 0x88, 0x9e, 0xf6, 0x5b
-    };
-    const byte iv2[] =
-    {
-        0xee, 0x9c, 0x6e, 0x06, 0x15, 0x45, 0x45, 0x03,
-        0x1a, 0x60, 0x24, 0xa7
-    };
-    const byte a2[] =
-    {
-        0x94, 0x81, 0x2c, 0x87, 0x07, 0x4e, 0x15, 0x18,
-        0x34, 0xb8, 0x35, 0xaf, 0x1c, 0xa5, 0x7e, 0x56
-    };
-    const byte t2[] =
-    {
-        0xc6, 0x81, 0x79, 0x8e, 0x3d, 0xda, 0xb0, 0x9f,
-        0x8d, 0x83, 0xb0, 0xbb, 0x14, 0xb6, 0x91
-    };
-
-    const byte k3[] =
-    {
-        0xb8, 0xe4, 0x9a, 0x5e, 0x37, 0xf9, 0x98, 0x2b,
-        0xb9, 0x6d, 0xd0, 0xc9, 0xb6, 0xab, 0x26, 0xac
-    };
-    const byte iv3[] =
-    {
-        0xe4, 0x4a, 0x42, 0x18, 0x8c, 0xae, 0x94, 0x92,
-        0x6a, 0x9c, 0x26, 0xb0
-    };
-    const byte a3[] =
-    {
-        0x9d, 0xb9, 0x61, 0x68, 0xa6, 0x76, 0x7a, 0x31,
-        0xf8, 0x29, 0xe4, 0x72, 0x61, 0x68, 0x3f, 0x8a
-    };
-    const byte t3[] =
-    {
-        0x23, 0xe2, 0x9f, 0x66, 0xe4, 0xc6, 0x52, 0x48
-    };
-
-    byte tag[16];
-
-    memset(tag, 0, sizeof(tag));
-    GmacSetKey(&gmac, k1, sizeof(k1));
-    GmacUpdate(&gmac, iv1, sizeof(iv1), a1, sizeof(a1), tag, sizeof(t1));
-    if (memcmp(t1, tag, sizeof(t1)) != 0)
-        return -126;
-
-    memset(tag, 0, sizeof(tag));
-    GmacSetKey(&gmac, k2, sizeof(k2));
-    GmacUpdate(&gmac, iv2, sizeof(iv2), a2, sizeof(a2), tag, sizeof(t2));
-    if (memcmp(t2, tag, sizeof(t2)) != 0)
-        return -127;
-
-    memset(tag, 0, sizeof(tag));
-    GmacSetKey(&gmac, k3, sizeof(k3));
-    GmacUpdate(&gmac, iv3, sizeof(iv3), a3, sizeof(a3), tag, sizeof(t3));
-    if (memcmp(t3, tag, sizeof(t3)) != 0)
-        return -128;
-
-    return 0;
-}
-#endif /* HAVE_AESGCM */
-
-#ifdef HAVE_AESCCM
-int aesccm_test(void)
-{
-    Aes enc;
-
-    /* key */
-    const byte k[] =
-    {
-        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
-        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf
-    };
-
-    /* nonce */
-    const byte iv[] =
-    {
-        0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
-        0xa1, 0xa2, 0xa3, 0xa4, 0xa5
-    };
-
-    /* plaintext */
-    const byte p[] =
-    {
-        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-        0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e
-    };
-
-    const byte a[] =
-    {
-        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
-    };
-
-    const byte c[] =
-    {
-        0x58, 0x8c, 0x97, 0x9a, 0x61, 0xc6, 0x63, 0xd2,
-        0xf0, 0x66, 0xd0, 0xc2, 0xc0, 0xf9, 0x89, 0x80,
-        0x6d, 0x5f, 0x6b, 0x61, 0xda, 0xc3, 0x84
-    };
-
-    const byte t[] =
-    {
-        0x17, 0xe8, 0xd1, 0x2c, 0xfd, 0xf9, 0x26, 0xe0
-    };
-
-    byte t2[sizeof(t)];
-    byte p2[sizeof(p)];
-    byte c2[sizeof(c)];
-
-    int result;
-
-    memset(t2, 0, sizeof(t2));
-    memset(c2, 0, sizeof(c2));
-    memset(p2, 0, sizeof(p2));
-
-    AesCcmSetKey(&enc, k, sizeof(k));
-    /* AES-CCM encrypt and decrypt both use AES encrypt internally */
-    AesCcmEncrypt(&enc, c2, p, sizeof(c2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (memcmp(c, c2, sizeof(c2)))
-        return -107;
-    if (memcmp(t, t2, sizeof(t2)))
-        return -108;
-
-    result = AesCcmDecrypt(&enc, p2, c2, sizeof(p2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (result != 0)
-        return -109;
-    if (memcmp(p, p2, sizeof(p2)))
-        return -110;
-
-    /* Test the authentication failure */
-    t2[0]++; /* Corrupt the authentication tag. */
-    result = AesCcmDecrypt(&enc, p2, c, sizeof(p2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (result == 0)
-        return -111;
-
-    /* Clear c2 to compare against p2. p2 should be set to zero in case of
-     * authentication fail. */
-    memset(c2, 0, sizeof(c2));
-    if (memcmp(p2, c2, sizeof(p2)))
-        return -112;
-
-    return 0;
-}
-#endif /* HAVE_AESCCM */
-
-
-#endif /* NO_AES */
-
-
-#ifdef HAVE_CAMELLIA
-
-enum {
-    CAM_ECB_ENC, CAM_ECB_DEC, CAM_CBC_ENC, CAM_CBC_DEC
-};
-
-typedef struct {
-    int type;
-    const byte* plaintext;
-    const byte* iv;
-    const byte* ciphertext;
-    const byte* key;
-    word32 keySz;
-    int errorCode;
-} test_vector_t;
-
-int camellia_test(void)
-{
-    /* Camellia ECB Test Plaintext */
-    static const byte pte[] =
-    {
-        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
-        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10
-    };
-
-    /* Camellia ECB Test Initialization Vector */
-    static const byte ive[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-
-    /* Test 1: Camellia ECB 128-bit key */
-    static const byte k1[] =
-    {
-        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
-        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10
-    };
-    static const byte c1[] =
-    {
-        0x67, 0x67, 0x31, 0x38, 0x54, 0x96, 0x69, 0x73,
-        0x08, 0x57, 0x06, 0x56, 0x48, 0xea, 0xbe, 0x43
-    };
-
-    /* Test 2: Camellia ECB 192-bit key */
-    static const byte k2[] =
-    {
-        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
-        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
-        0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77
-    };
-    static const byte c2[] =
-    {
-        0xb4, 0x99, 0x34, 0x01, 0xb3, 0xe9, 0x96, 0xf8,
-        0x4e, 0xe5, 0xce, 0xe7, 0xd7, 0x9b, 0x09, 0xb9
-    };
-
-    /* Test 3: Camellia ECB 256-bit key */
-    static const byte k3[] =
-    {
-        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
-        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
-        0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
-        0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff
-    };
-    static const byte c3[] =
-    {
-        0x9a, 0xcc, 0x23, 0x7d, 0xff, 0x16, 0xd7, 0x6c,
-        0x20, 0xef, 0x7c, 0x91, 0x9e, 0x3a, 0x75, 0x09
-    };
-
-    /* Camellia CBC Test Plaintext */
-    static const byte ptc[] =
-    {
-        0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
-        0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A
-    };
-
-    /* Camellia CBC Test Initialization Vector */
-    static const byte ivc[] =
-    {
-        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-        0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
-    };
-
-    /* Test 4: Camellia-CBC 128-bit key */
-    static const byte k4[] =
-    {
-        0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
-        0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
-    };
-    static const byte c4[] =
-    {
-        0x16, 0x07, 0xCF, 0x49, 0x4B, 0x36, 0xBB, 0xF0,
-        0x0D, 0xAE, 0xB0, 0xB5, 0x03, 0xC8, 0x31, 0xAB
-    };
-
-    /* Test 5: Camellia-CBC 192-bit key */
-    static const byte k5[] =
-    {
-        0x8E, 0x73, 0xB0, 0xF7, 0xDA, 0x0E, 0x64, 0x52,
-        0xC8, 0x10, 0xF3, 0x2B, 0x80, 0x90, 0x79, 0xE5,
-        0x62, 0xF8, 0xEA, 0xD2, 0x52, 0x2C, 0x6B, 0x7B
-    };
-    static const byte c5[] =
-    {
-        0x2A, 0x48, 0x30, 0xAB, 0x5A, 0xC4, 0xA1, 0xA2,
-        0x40, 0x59, 0x55, 0xFD, 0x21, 0x95, 0xCF, 0x93
-    };
-
-    /* Test 6: CBC 256-bit key */
-    static const byte k6[] =
-    {
-        0x60, 0x3D, 0xEB, 0x10, 0x15, 0xCA, 0x71, 0xBE,
-        0x2B, 0x73, 0xAE, 0xF0, 0x85, 0x7D, 0x77, 0x81,
-        0x1F, 0x35, 0x2C, 0x07, 0x3B, 0x61, 0x08, 0xD7,
-        0x2D, 0x98, 0x10, 0xA3, 0x09, 0x14, 0xDF, 0xF4
-    };
-    static const byte c6[] =
-    {
-        0xE6, 0xCF, 0xA3, 0x5F, 0xC0, 0x2B, 0x13, 0x4A,
-        0x4D, 0x2C, 0x0B, 0x67, 0x37, 0xAC, 0x3E, 0xDA
-    };
-
-    byte out[CAMELLIA_BLOCK_SIZE];
-    Camellia cam;
-    int i, testsSz;
-    const test_vector_t testVectors[] =
-    {
-        {CAM_ECB_ENC, pte, ive, c1, k1, sizeof(k1), -114},
-        {CAM_ECB_ENC, pte, ive, c2, k2, sizeof(k2), -115},
-        {CAM_ECB_ENC, pte, ive, c3, k3, sizeof(k3), -116},
-        {CAM_ECB_DEC, pte, ive, c1, k1, sizeof(k1), -117},
-        {CAM_ECB_DEC, pte, ive, c2, k2, sizeof(k2), -118},
-        {CAM_ECB_DEC, pte, ive, c3, k3, sizeof(k3), -119},
-        {CAM_CBC_ENC, ptc, ivc, c4, k4, sizeof(k4), -120},
-        {CAM_CBC_ENC, ptc, ivc, c5, k5, sizeof(k5), -121},
-        {CAM_CBC_ENC, ptc, ivc, c6, k6, sizeof(k6), -122},
-        {CAM_CBC_DEC, ptc, ivc, c4, k4, sizeof(k4), -123},
-        {CAM_CBC_DEC, ptc, ivc, c5, k5, sizeof(k5), -124},
-        {CAM_CBC_DEC, ptc, ivc, c6, k6, sizeof(k6), -125}
-    };
-
-    testsSz = sizeof(testVectors)/sizeof(test_vector_t);
-    for (i = 0; i < testsSz; i++) {
-        if (CamelliaSetKey(&cam, testVectors[i].key, testVectors[i].keySz,
-                                                        testVectors[i].iv) != 0)
-            return testVectors[i].errorCode;
-
-        switch (testVectors[i].type) {
-            case CAM_ECB_ENC:
-                CamelliaEncryptDirect(&cam, out, testVectors[i].plaintext);
-                if (memcmp(out, testVectors[i].ciphertext, CAMELLIA_BLOCK_SIZE))
-                    return testVectors[i].errorCode;
-                break;
-            case CAM_ECB_DEC:
-                CamelliaDecryptDirect(&cam, out, testVectors[i].ciphertext);
-                if (memcmp(out, testVectors[i].plaintext, CAMELLIA_BLOCK_SIZE))
-                    return testVectors[i].errorCode;
-                break;
-            case CAM_CBC_ENC:
-                CamelliaCbcEncrypt(&cam, out, testVectors[i].plaintext,
-                                                           CAMELLIA_BLOCK_SIZE);
-                if (memcmp(out, testVectors[i].ciphertext, CAMELLIA_BLOCK_SIZE))
-                    return testVectors[i].errorCode;
-                break;
-            case CAM_CBC_DEC:
-                CamelliaCbcDecrypt(&cam, out, testVectors[i].ciphertext,
-                                                           CAMELLIA_BLOCK_SIZE);
-                if (memcmp(out, testVectors[i].plaintext, CAMELLIA_BLOCK_SIZE))
-                    return testVectors[i].errorCode;
-                break;
-            default:
-                break;
-        }
-    }
-
-    /* Setting the IV and checking it was actually set. */
-    CamelliaSetIV(&cam, ivc);
-    if (XMEMCMP(cam.reg, ivc, CAMELLIA_BLOCK_SIZE))
-        return -1;
-
-    /* Setting the IV to NULL should be same as all zeros IV */
-    if (CamelliaSetIV(&cam, NULL) != 0 ||
-                                    XMEMCMP(cam.reg, ive, CAMELLIA_BLOCK_SIZE))
-        return -1;
-
-    /* First parameter should never be null */
-    if (CamelliaSetIV(NULL, NULL) == 0)
-        return -1;
-
-    /* First parameter should never be null, check it fails */
-    if (CamelliaSetKey(NULL, k1, sizeof(k1), NULL) == 0)
-        return -1;
-
-    /* Key should have a size of 16, 24, or 32 */
-    if (CamelliaSetKey(&cam, k1, 0, NULL) == 0)
-        return -1;
-
-    return 0;
-}
-#endif /* HAVE_CAMELLIA */
-
-
-#if defined(HAVE_HASHDRBG) || defined(NO_RC4)
-
-int random_test(void)
-{
-    const byte test1Entropy[] =
-    {
-        0xa6, 0x5a, 0xd0, 0xf3, 0x45, 0xdb, 0x4e, 0x0e, 0xff, 0xe8, 0x75, 0xc3,
-        0xa2, 0xe7, 0x1f, 0x42, 0xc7, 0x12, 0x9d, 0x62, 0x0f, 0xf5, 0xc1, 0x19,
-        0xa9, 0xef, 0x55, 0xf0, 0x51, 0x85, 0xe0, 0xfb, 0x85, 0x81, 0xf9, 0x31,
-        0x75, 0x17, 0x27, 0x6e, 0x06, 0xe9, 0x60, 0x7d, 0xdb, 0xcb, 0xcc, 0x2e
-    };
-    const byte test1Output[] =
-    {
-        0xd3, 0xe1, 0x60, 0xc3, 0x5b, 0x99, 0xf3, 0x40, 0xb2, 0x62, 0x82, 0x64,
-        0xd1, 0x75, 0x10, 0x60, 0xe0, 0x04, 0x5d, 0xa3, 0x83, 0xff, 0x57, 0xa5,
-        0x7d, 0x73, 0xa6, 0x73, 0xd2, 0xb8, 0xd8, 0x0d, 0xaa, 0xf6, 0xa6, 0xc3,
-        0x5a, 0x91, 0xbb, 0x45, 0x79, 0xd7, 0x3f, 0xd0, 0xc8, 0xfe, 0xd1, 0x11,
-        0xb0, 0x39, 0x13, 0x06, 0x82, 0x8a, 0xdf, 0xed, 0x52, 0x8f, 0x01, 0x81,
-        0x21, 0xb3, 0xfe, 0xbd, 0xc3, 0x43, 0xe7, 0x97, 0xb8, 0x7d, 0xbb, 0x63,
-        0xdb, 0x13, 0x33, 0xde, 0xd9, 0xd1, 0xec, 0xe1, 0x77, 0xcf, 0xa6, 0xb7,
-        0x1f, 0xe8, 0xab, 0x1d, 0xa4, 0x66, 0x24, 0xed, 0x64, 0x15, 0xe5, 0x1c,
-        0xcd, 0xe2, 0xc7, 0xca, 0x86, 0xe2, 0x83, 0x99, 0x0e, 0xea, 0xeb, 0x91,
-        0x12, 0x04, 0x15, 0x52, 0x8b, 0x22, 0x95, 0x91, 0x02, 0x81, 0xb0, 0x2d,
-        0xd4, 0x31, 0xf4, 0xc9, 0xf7, 0x04, 0x27, 0xdf
-    };
-    const byte test2EntropyA[] =
-    {
-        0x63, 0x36, 0x33, 0x77, 0xe4, 0x1e, 0x86, 0x46, 0x8d, 0xeb, 0x0a, 0xb4,
-        0xa8, 0xed, 0x68, 0x3f, 0x6a, 0x13, 0x4e, 0x47, 0xe0, 0x14, 0xc7, 0x00,
-        0x45, 0x4e, 0x81, 0xe9, 0x53, 0x58, 0xa5, 0x69, 0x80, 0x8a, 0xa3, 0x8f,
-        0x2a, 0x72, 0xa6, 0x23, 0x59, 0x91, 0x5a, 0x9f, 0x8a, 0x04, 0xca, 0x68
-    };
-    const byte test2EntropyB[] =
-    {
-        0xe6, 0x2b, 0x8a, 0x8e, 0xe8, 0xf1, 0x41, 0xb6, 0x98, 0x05, 0x66, 0xe3,
-        0xbf, 0xe3, 0xc0, 0x49, 0x03, 0xda, 0xd4, 0xac, 0x2c, 0xdf, 0x9f, 0x22,
-        0x80, 0x01, 0x0a, 0x67, 0x39, 0xbc, 0x83, 0xd3
-    };
-    const byte test2Output[] =
-    {
-        0x04, 0xee, 0xc6, 0x3b, 0xb2, 0x31, 0xdf, 0x2c, 0x63, 0x0a, 0x1a, 0xfb,
-        0xe7, 0x24, 0x94, 0x9d, 0x00, 0x5a, 0x58, 0x78, 0x51, 0xe1, 0xaa, 0x79,
-        0x5e, 0x47, 0x73, 0x47, 0xc8, 0xb0, 0x56, 0x62, 0x1c, 0x18, 0xbd, 0xdc,
-        0xdd, 0x8d, 0x99, 0xfc, 0x5f, 0xc2, 0xb9, 0x20, 0x53, 0xd8, 0xcf, 0xac,
-        0xfb, 0x0b, 0xb8, 0x83, 0x12, 0x05, 0xfa, 0xd1, 0xdd, 0xd6, 0xc0, 0x71,
-        0x31, 0x8a, 0x60, 0x18, 0xf0, 0x3b, 0x73, 0xf5, 0xed, 0xe4, 0xd4, 0xd0,
-        0x71, 0xf9, 0xde, 0x03, 0xfd, 0x7a, 0xea, 0x10, 0x5d, 0x92, 0x99, 0xb8,
-        0xaf, 0x99, 0xaa, 0x07, 0x5b, 0xdb, 0x4d, 0xb9, 0xaa, 0x28, 0xc1, 0x8d,
-        0x17, 0x4b, 0x56, 0xee, 0x2a, 0x01, 0x4d, 0x09, 0x88, 0x96, 0xff, 0x22,
-        0x82, 0xc9, 0x55, 0xa8, 0x19, 0x69, 0xe0, 0x69, 0xfa, 0x8c, 0xe0, 0x07,
-        0xa1, 0x80, 0x18, 0x3a, 0x07, 0xdf, 0xae, 0x17
-    };
-    int ret;
-
-    ret = RNG_HealthTest(0, test1Entropy, sizeof(test1Entropy), NULL, 0,
-                            test1Output, sizeof(test1Output));
-    if (ret != 0) return -39;
-
-    ret = RNG_HealthTest(1, test2EntropyA, sizeof(test2EntropyA),
-                            test2EntropyB, sizeof(test2EntropyB),
-                            test2Output, sizeof(test2Output));
-    if (ret != 0) return -40;
-
-    return 0;
-}
-
-#else /* HAVE_HASHDRBG || NO_RC4 */
-
-int random_test(void)
-{
-    WC_RNG rng;
-    byte block[32];
-    int ret;
-
-#ifdef HAVE_CAVIUM
-    ret = InitRngCavium(&rng, CAVIUM_DEV_ID);
-    if (ret != 0) return -2007;
-#endif
-    ret = InitRng(&rng);
-    if (ret != 0) return -39;
-
-    ret = RNG_GenerateBlock(&rng, block, sizeof(block));
-    if (ret != 0) return -40;
-
-    return 0;
-}
-
-#endif /* HAVE_HASHDRBG || NO_RC4 */
-
-
-#ifdef HAVE_NTRU
-
-byte GetEntropy(ENTROPY_CMD cmd, byte* out);
-
-byte GetEntropy(ENTROPY_CMD cmd, byte* out)
-{
-    static WC_RNG rng;
-
-    if (cmd == INIT)
-        return (InitRng(&rng) == 0) ? 1 : 0;
-
-    if (out == NULL)
-        return 0;
-
-    if (cmd == GET_BYTE_OF_ENTROPY)
-        return (RNG_GenerateBlock(&rng, out, 1) == 0) ? 1 : 0;
-
-    if (cmd == GET_NUM_BYTES_PER_BYTE_OF_ENTROPY) {
-        *out = 1;
-        return 1;
-    }
-
-    return 0;
-}
-
-#endif /* HAVE_NTRU */
-
-#ifndef NO_RSA
-
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    #ifdef FREESCALE_MQX
-        static const char* clientKey  = "a:\\certs\\client-key.der";
-        static const char* clientCert = "a:\\certs\\client-cert.der";
-        #ifdef CYASSL_CERT_GEN
-            static const char* caKeyFile  = "a:\\certs\\ca-key.der";
-            static const char* caCertFile = "a:\\certs\\ca-cert.pem";
-            #ifdef HAVE_ECC
-                static const char* eccCaKeyFile  = "a:\\certs\\ecc-key.der";
-                static const char* eccCaCertFile = "a:\\certs\\server-ecc.pem";
-            #endif
-        #endif
-    #elif defined(CYASSL_MKD_SHELL)
-        static char* clientKey = "certs/client-key.der";
-        static char* clientCert = "certs/client-cert.der";
-        void set_clientKey(char *key) {  clientKey = key ; }
-        void set_clientCert(char *cert) {  clientCert = cert ; }
-        #ifdef CYASSL_CERT_GEN
-            static char* caKeyFile  = "certs/ca-key.der";
-            static char* caCertFile = "certs/ca-cert.pem";
-            void set_caKeyFile (char * key)  { caKeyFile   = key ; }
-            void set_caCertFile(char * cert) { caCertFile = cert ; }
-            #ifdef HAVE_ECC
-                static const char* eccCaKeyFile  = "certs/ecc-key.der";
-                static const char* eccCaCertFile = "certs/server-ecc.pem";
-                void set_eccCaKeyFile (char * key)  { eccCaKeyFile  = key ; }
-                void set_eccCaCertFile(char * cert) { eccCaCertFile = cert ; }
-            #endif
-        #endif
-    #else
-        static const char* clientKey  = "./certs/client-key.der";
-        static const char* clientCert = "./certs/client-cert.der";
-        #ifdef CYASSL_CERT_GEN
-            static const char* caKeyFile  = "./certs/ca-key.der";
-            static const char* caCertFile = "./certs/ca-cert.pem";
-            #ifdef HAVE_ECC
-                static const char* eccCaKeyFile  = "./certs/ecc-key.der";
-                static const char* eccCaCertFile = "./certs/server-ecc.pem";
-            #endif
-        #endif
-    #endif
-#endif
-
-
-
-#define FOURK_BUF 4096
-
-int rsa_test(void)
-{
-    byte*   tmp;
-    size_t bytes;
-    RsaKey key;
-    WC_RNG rng;
-    word32 idx = 0;
-    int    ret;
-    byte   in[] = "Everyone gets Friday off.";
-    word32 inLen = (word32)strlen((char*)in);
-    byte   out[256];
-    byte   plain[256];
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    FILE*  file, * file2;
-#endif
-#ifdef CYASSL_TEST_CERT
-    DecodedCert cert;
-#endif
-
-    tmp = (byte*)malloc(FOURK_BUF);
-    if (tmp == NULL)
-        return -40;
-
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, client_key_der_1024, sizeof_client_key_der_1024);
-    bytes = sizeof_client_key_der_1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, client_key_der_2048, sizeof_client_key_der_2048);
-    bytes = sizeof_client_key_der_2048;
-#else
-    file = fopen(clientKey, "rb");
-
-    if (!file)
-        err_sys("can't open ./certs/client-key.der, "
-                "Please run from CyaSSL home dir", -40);
-
-    bytes = fread(tmp, 1, FOURK_BUF, file);
-    fclose(file);
-#endif /* USE_CERT_BUFFERS */
-
-#ifdef HAVE_CAVIUM
-    RsaInitCavium(&key, CAVIUM_DEV_ID);
-#endif
-    ret = InitRsaKey(&key, 0);
-    if (ret != 0) return -39;
-    ret = RsaPrivateKeyDecode(tmp, &idx, &key, (word32)bytes);
-    if (ret != 0) return -41;
-
-    ret = InitRng(&rng);
-    if (ret != 0) return -42;
-
-    ret = RsaPublicEncrypt(in, inLen, out, sizeof(out), &key, &rng);
-    if (ret < 0) return -43;
-
-    ret = RsaPrivateDecrypt(out, ret, plain, sizeof(plain), &key);
-    if (ret < 0) return -44;
-
-    if (memcmp(plain, in, inLen)) return -45;
-
-    ret = RsaSSL_Sign(in, inLen, out, sizeof(out), &key, &rng);
-    if (ret < 0) return -46;
-
-    memset(plain, 0, sizeof(plain));
-    ret = RsaSSL_Verify(out, ret, plain, sizeof(plain), &key);
-    if (ret < 0) return -47;
-
-    if (memcmp(plain, in, ret)) return -48;
-
-#if defined(CYASSL_MDK_ARM)
-    #define sizeof(s) strlen((char *)(s))
-#endif
-
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, client_cert_der_1024, sizeof_client_cert_der_1024);
-    bytes = sizeof_client_cert_der_1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, client_cert_der_2048, sizeof_client_cert_der_2048);
-    bytes = sizeof_client_cert_der_2048;
-#else
-    file2 = fopen(clientCert, "rb");
-    if (!file2)
-        return -49;
-
-    bytes = fread(tmp, 1, FOURK_BUF, file2);
-    fclose(file2);
-#endif
-
-#ifdef sizeof
-		#undef sizeof
-#endif
-
-#ifdef CYASSL_TEST_CERT
-    InitDecodedCert(&cert, tmp, (word32)bytes, 0);
-
-    ret = ParseCert(&cert, CERT_TYPE, NO_VERIFY, 0);
-    if (ret != 0) return -491;
-
-    FreeDecodedCert(&cert);
-#else
-    (void)bytes;
-#endif
-
-
-#ifdef CYASSL_KEY_GEN
-    {
-        byte*  der;
-        byte*  pem;
-        int    derSz = 0;
-        int    pemSz = 0;
-        RsaKey derIn;
-        RsaKey genKey;
-        FILE*  keyFile;
-        FILE*  pemFile;
-
-        ret = InitRsaKey(&genKey, 0);
-        if (ret != 0)
-            return -300;
-        ret = MakeRsaKey(&genKey, 1024, 65537, &rng);
-        if (ret != 0)
-            return -301;
-
-        der = (byte*)malloc(FOURK_BUF);
-        if (der == NULL) {
-            FreeRsaKey(&genKey);
-            return -307;
-        }
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(der);
-            FreeRsaKey(&genKey);
-            return -308;
-        }
-
-        derSz = RsaKeyToDer(&genKey, der, FOURK_BUF);
-        if (derSz < 0) {
-            free(der);
-            free(pem);
-            return -302;
-        }
-
-        keyFile = fopen("./key.der", "wb");
-        if (!keyFile) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -303;
-        }
-        ret = (int)fwrite(der, 1, derSz, keyFile);
-        fclose(keyFile);
-        if (ret != derSz) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -313;
-        }
-
-        pemSz = DerToPem(der, derSz, pem, FOURK_BUF, PRIVATEKEY_TYPE);
-        if (pemSz < 0) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -304;
-        }
-
-        pemFile = fopen("./key.pem", "wb");
-        if (!pemFile) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -305;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        fclose(pemFile);
-        if (ret != pemSz) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -314;
-        }
-
-        ret = InitRsaKey(&derIn, 0);
-        if (ret != 0) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -3060;
-        }
-        idx = 0;
-        ret = RsaPrivateKeyDecode(der, &idx, &derIn, derSz);
-        if (ret != 0) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&derIn);
-            FreeRsaKey(&genKey);
-            return -306;
-        }
-
-        FreeRsaKey(&derIn);
-        FreeRsaKey(&genKey);
-        free(pem);
-        free(der);
-    }
-#endif /* CYASSL_KEY_GEN */
-
-
-#ifdef CYASSL_CERT_GEN
-    /* self signed */
-    {
-        Cert        myCert;
-        byte*       derCert;
-        byte*       pem;
-        FILE*       derFile;
-        FILE*       pemFile;
-        int         certSz;
-        int         pemSz;
-#ifdef CYASSL_TEST_CERT
-        DecodedCert decode;
-#endif
-
-        derCert = (byte*)malloc(FOURK_BUF);
-        if (derCert == NULL)
-            return -309;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(derCert);
-            return -310;
-        }
-
-        InitCert(&myCert);
-
-        strncpy(myCert.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(myCert.subject.org, "yaSSL", CTC_NAME_SIZE);
-        strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(myCert.subject.commonName, "www.yassl.com", CTC_NAME_SIZE);
-        strncpy(myCert.subject.email, "info@yassl.com", CTC_NAME_SIZE);
-        myCert.isCA    = 1;
-        myCert.sigType = CTC_SHA256wRSA;
-
-        certSz = MakeSelfCert(&myCert, derCert, FOURK_BUF, &key, &rng);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            return -401;
-        }
-
-#ifdef CYASSL_TEST_CERT
-        InitDecodedCert(&decode, derCert, certSz, 0);
-        ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -402;
-        }
-        FreeDecodedCert(&decode);
-#endif
-        derFile = fopen("./cert.der", "wb");
-        if (!derFile) {
-            free(derCert);
-            free(pem);
-            return -403;
-        }
-        ret = (int)fwrite(derCert, 1, certSz, derFile);
-        fclose(derFile);
-        if (ret != certSz) {
-            free(derCert);
-            free(pem);
-            return -414;
-        }
-
-        pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE);
-        if (pemSz < 0) {
-            free(derCert);
-            free(pem);
-            return -404;
-        }
-
-        pemFile = fopen("./cert.pem", "wb");
-        if (!pemFile) {
-            free(derCert);
-            free(pem);
-            return -405;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        fclose(pemFile);
-        if (ret != pemSz) {
-            free(derCert);
-            free(pem);
-            return -406;
-        }
-        free(pem);
-        free(derCert);
-    }
-    /* CA style */
-    {
-        RsaKey      caKey;
-        Cert        myCert;
-        byte*       derCert;
-        byte*       pem;
-        FILE*       derFile;
-        FILE*       pemFile;
-        int         certSz;
-        int         pemSz;
-        size_t      bytes3;
-        word32      idx3 = 0;
-        FILE*       file3 ;
-#ifdef CYASSL_TEST_CERT
-        DecodedCert decode;
-#endif
-
-        derCert = (byte*)malloc(FOURK_BUF);
-        if (derCert == NULL)
-            return -311;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(derCert);
-            return -312;
-        }
-
-        file3 = fopen(caKeyFile, "rb");
-
-        if (!file3) {
-            free(derCert);
-            free(pem);
-            return -412;
-        }
-
-        bytes3 = fread(tmp, 1, FOURK_BUF, file3);
-        fclose(file3);
-
-        ret = InitRsaKey(&caKey, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -411;
-        }
-        ret = RsaPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes3);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -413;
-        }
-
-        InitCert(&myCert);
-
-        strncpy(myCert.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(myCert.subject.org, "yaSSL", CTC_NAME_SIZE);
-        strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(myCert.subject.commonName, "www.yassl.com", CTC_NAME_SIZE);
-        strncpy(myCert.subject.email, "info@yassl.com", CTC_NAME_SIZE);
-
-        ret = SetIssuer(&myCert, caCertFile);
-        if (ret < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -405;
-        }
-
-        certSz = MakeCert(&myCert, derCert, FOURK_BUF, &key, NULL, &rng);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -407;
-        }
-
-        certSz = SignCert(myCert.bodySz, myCert.sigType, derCert, FOURK_BUF,
-                          &caKey, NULL, &rng);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -408;
-        }
-
-
-#ifdef CYASSL_TEST_CERT
-        InitDecodedCert(&decode, derCert, certSz, 0);
-        ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -409;
-        }
-        FreeDecodedCert(&decode);
-#endif
-
-        derFile = fopen("./othercert.der", "wb");
-        if (!derFile) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -410;
-        }
-        ret = (int)fwrite(derCert, 1, certSz, derFile);
-        fclose(derFile);
-        if (ret != certSz) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -416;
-        }
-
-        pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE);
-        if (pemSz < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -411;
-        }
-
-        pemFile = fopen("./othercert.pem", "wb");
-        if (!pemFile) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -412;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        if (ret != pemSz) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -415;
-        }
-        fclose(pemFile);
-        free(pem);
-        free(derCert);
-        FreeRsaKey(&caKey);
-    }
-#ifdef HAVE_ECC
-    /* ECC CA style */
-    {
-        ecc_key     caKey;
-        Cert        myCert;
-        byte*       derCert;
-        byte*       pem;
-        FILE*       derFile;
-        FILE*       pemFile;
-        int         certSz;
-        int         pemSz;
-        size_t      bytes3;
-        word32      idx3 = 0;
-        FILE*       file3;
-#ifdef CYASSL_TEST_CERT
-        DecodedCert decode;
-#endif
-
-        derCert = (byte*)malloc(FOURK_BUF);
-        if (derCert == NULL)
-            return -5311;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(derCert);
-            return -5312;
-        }
-
-        file3 = fopen(eccCaKeyFile, "rb");
-
-        if (!file3) {
-            free(derCert);
-            free(pem);
-            return -5412;
-        }
-
-        bytes3 = fread(tmp, 1, FOURK_BUF, file3);
-        fclose(file3);
-
-        ecc_init(&caKey);
-        ret = EccPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes3);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -5413;
-        }
-
-        InitCert(&myCert);
-        myCert.sigType = CTC_SHA256wECDSA;
-
-        strncpy(myCert.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(myCert.subject.org, "wolfSSL", CTC_NAME_SIZE);
-        strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(myCert.subject.commonName, "www.wolfssl.com", CTC_NAME_SIZE);
-        strncpy(myCert.subject.email, "info@wolfssl.com", CTC_NAME_SIZE);
-
-        ret = SetIssuer(&myCert, eccCaCertFile);
-        if (ret < 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5405;
-        }
-
-        certSz = MakeCert(&myCert, derCert, FOURK_BUF, NULL, &caKey, &rng);
-        if (certSz < 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5407;
-        }
-
-        certSz = SignCert(myCert.bodySz, myCert.sigType, derCert, FOURK_BUF,
-                          NULL, &caKey, &rng);
-        if (certSz < 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5408;
-        }
-
-#ifdef CYASSL_TEST_CERT
-        InitDecodedCert(&decode, derCert, certSz, 0);
-        ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
-        if (ret != 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5409;
-        }
-        FreeDecodedCert(&decode);
-#endif
-
-        derFile = fopen("./certecc.der", "wb");
-        if (!derFile) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5410;
-        }
-        ret = (int)fwrite(derCert, 1, certSz, derFile);
-        fclose(derFile);
-        if (ret != certSz) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5414;
-        }
-
-        pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE);
-        if (pemSz < 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5411;
-        }
-
-        pemFile = fopen("./certecc.pem", "wb");
-        if (!pemFile) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5412;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        if (ret != pemSz) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5415;
-        }
-        fclose(pemFile);
-        free(pem);
-        free(derCert);
-        ecc_free(&caKey);
-    }
-#endif /* HAVE_ECC */
-#ifdef HAVE_NTRU
-    {
-        RsaKey      caKey;
-        Cert        myCert;
-        byte*       derCert;
-        byte*       pem;
-        FILE*       derFile;
-        FILE*       pemFile;
-        FILE*       caFile;
-        FILE*       ntruPrivFile;
-        int         certSz;
-        int         pemSz;
-        word32      idx3;
-#ifdef CYASSL_TEST_CERT
-        DecodedCert decode;
-#endif
-        derCert = (byte*)malloc(FOURK_BUF);
-        if (derCert == NULL)
-            return -311;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(derCert);
-            return -312;
-        }
-
-        byte   public_key[557];          /* sized for EES401EP2 */
-        word16 public_key_len;           /* no. of octets in public key */
-        byte   private_key[607];         /* sized for EES401EP2 */
-        word16 private_key_len;          /* no. of octets in private key */
-        DRBG_HANDLE drbg;
-        static uint8_t const pers_str[] = {
-                'C', 'y', 'a', 'S', 'S', 'L', ' ', 't', 'e', 's', 't'
-        };
-        word32 rc = ntru_crypto_drbg_instantiate(112, pers_str,
-                          sizeof(pers_str), GetEntropy, &drbg);
-        if (rc != DRBG_OK) {
-            free(derCert);
-            free(pem);
-            return -448;
-        }
-
-        rc = ntru_crypto_ntru_encrypt_keygen(drbg, NTRU_EES401EP2,
-                                             &public_key_len, NULL,
-                                             &private_key_len, NULL);
-        if (rc != NTRU_OK) {
-            free(derCert);
-            free(pem);
-            return -449;
-        }
-
-        rc = ntru_crypto_ntru_encrypt_keygen(drbg, NTRU_EES401EP2,
-                                             &public_key_len, public_key,
-                                             &private_key_len, private_key);
-        if (rc != NTRU_OK) {
-            free(derCert);
-            free(pem);
-            return -450;
-        }
-
-        rc = ntru_crypto_drbg_uninstantiate(drbg);
-
-        if (rc != NTRU_OK) {
-            free(derCert);
-            free(pem);
-            return -451;
-        }
-
-        caFile = fopen(caKeyFile, "rb");
-
-        if (!caFile) {
-            free(derCert);
-            free(pem);
-            return -452;
-        }
-
-        bytes = fread(tmp, 1, FOURK_BUF, caFile);
-        fclose(caFile);
-
-        ret = InitRsaKey(&caKey, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -453;
-        }
-        ret = RsaPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -454;
-        }
-
-        InitCert(&myCert);
-
-        strncpy(myCert.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(myCert.subject.org, "yaSSL", CTC_NAME_SIZE);
-        strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(myCert.subject.commonName, "www.yassl.com", CTC_NAME_SIZE);
-        strncpy(myCert.subject.email, "info@yassl.com", CTC_NAME_SIZE);
-
-        ret = SetIssuer(&myCert, caCertFile);
-        if (ret < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -455;
-        }
-
-        certSz = MakeNtruCert(&myCert, derCert, FOURK_BUF, public_key,
-                              public_key_len, &rng);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -456;
-        }
-
-        certSz = SignCert(myCert.bodySz, myCert.sigType, derCert, FOURK_BUF,
-                          &caKey, NULL, &rng);
-        FreeRsaKey(&caKey);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            return -457;
-        }
-
-
-#ifdef CYASSL_TEST_CERT
-        InitDecodedCert(&decode, derCert, certSz, 0);
-        ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -458;
-        }
-        FreeDecodedCert(&decode);
-#endif
-        derFile = fopen("./ntru-cert.der", "wb");
-        if (!derFile) {
-            free(derCert);
-            free(pem);
-            return -459;
-        }
-        ret = (int)fwrite(derCert, 1, certSz, derFile);
-        fclose(derFile);
-        if (ret != certSz) {
-            free(derCert);
-            free(pem);
-            return -473;
-        }
-
-        pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE);
-        if (pemSz < 0) {
-            free(derCert);
-            free(pem);
-            return -460;
-        }
-
-        pemFile = fopen("./ntru-cert.pem", "wb");
-        if (!pemFile) {
-            free(derCert);
-            free(pem);
-            return -461;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        fclose(pemFile);
-        if (ret != pemSz) {
-            free(derCert);
-            free(pem);
-            return -474;
-        }
-
-        ntruPrivFile = fopen("./ntru-key.raw", "wb");
-        if (!ntruPrivFile) {
-            free(derCert);
-            free(pem);
-            return -462;
-        }
-        ret = (int)fwrite(private_key, 1, private_key_len, ntruPrivFile);
-        fclose(ntruPrivFile);
-        if (ret != private_key_len) {
-            free(pem);
-            free(derCert);
-            return -475;
-        }
-        free(pem);
-        free(derCert);
-    }
-#endif /* HAVE_NTRU */
-#ifdef CYASSL_CERT_REQ
-    {
-        Cert        req;
-        byte*       der;
-        byte*       pem;
-        int         derSz;
-        int         pemSz;
-        FILE*       reqFile;
-
-        der = (byte*)malloc(FOURK_BUF);
-        if (der == NULL)
-            return -463;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(der);
-            return -464;
-        }
-
-        InitCert(&req);
-
-        req.version = 0;
-        req.isCA    = 1;
-        strncpy(req.challengePw, "yassl123", CTC_NAME_SIZE);
-        strncpy(req.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(req.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(req.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(req.subject.org, "yaSSL", CTC_NAME_SIZE);
-        strncpy(req.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(req.subject.commonName, "www.yassl.com", CTC_NAME_SIZE);
-        strncpy(req.subject.email, "info@yassl.com", CTC_NAME_SIZE);
-        req.sigType = CTC_SHA256wRSA;
-
-        derSz = MakeCertReq(&req, der, FOURK_BUF, &key, NULL);
-        if (derSz < 0) {
-            free(pem);
-            free(der);
-            return -465;
-        }
-
-        derSz = SignCert(req.bodySz, req.sigType, der, FOURK_BUF,
-                          &key, NULL, &rng);
-        if (derSz < 0) {
-            free(pem);
-            free(der);
-            return -466;
-        }
-
-        pemSz = DerToPem(der, derSz, pem, FOURK_BUF, CERTREQ_TYPE);
-        if (pemSz < 0) {
-            free(pem);
-            free(der);
-            return -467;
-        }
-
-        reqFile = fopen("./certreq.der", "wb");
-        if (!reqFile) {
-            free(pem);
-            free(der);
-            return -468;
-        }
-
-        ret = (int)fwrite(der, 1, derSz, reqFile);
-        fclose(reqFile);
-        if (ret != derSz) {
-            free(pem);
-            free(der);
-            return -471;
-        }
-
-        reqFile = fopen("./certreq.pem", "wb");
-        if (!reqFile) {
-            free(pem);
-            free(der);
-            return -469;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, reqFile);
-        fclose(reqFile);
-        if (ret != pemSz) {
-            free(pem);
-            free(der);
-            return -470;
-        }
-
-        free(pem);
-        free(der);
-    }
-#endif /* CYASSL_CERT_REQ */
-#endif /* CYASSL_CERT_GEN */
-
-    FreeRsaKey(&key);
-#ifdef HAVE_CAVIUM
-    RsaFreeCavium(&key);
-#endif
-    free(tmp);
-
-    return 0;
-}
-
-#endif
-
-
-#ifndef NO_DH
-
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    #ifdef FREESCALE_MQX
-        static const char* dhKey = "a:\certs\\dh2048.der";
-    #else
-        static const char* dhKey = "./certs/dh2048.der";
-    #endif
-#endif
-
-int dh_test(void)
-{
-    int    ret;
-    word32 bytes;
-    word32 idx = 0, privSz, pubSz, privSz2, pubSz2, agreeSz, agreeSz2;
-    byte   tmp[1024];
-    byte   priv[256];
-    byte   pub[256];
-    byte   priv2[256];
-    byte   pub2[256];
-    byte   agree[256];
-    byte   agree2[256];
-    DhKey  key;
-    DhKey  key2;
-    WC_RNG rng;
-
-
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, dh_key_der_1024, sizeof_dh_key_der_1024);
-    bytes = sizeof_dh_key_der_1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, dh_key_der_2048, sizeof_dh_key_der_2048);
-    bytes = sizeof_dh_key_der_2048;
-#else
-    FILE*  file = fopen(dhKey, "rb");
-
-    if (!file)
-        return -50;
-
-    bytes = (word32) fread(tmp, 1, sizeof(tmp), file);
-    fclose(file);
-#endif /* USE_CERT_BUFFERS */
-
-    InitDhKey(&key);
-    InitDhKey(&key2);
-    ret = DhKeyDecode(tmp, &idx, &key, bytes);
-    if (ret != 0)
-        return -51;
-
-    idx = 0;
-    ret = DhKeyDecode(tmp, &idx, &key2, bytes);
-    if (ret != 0)
-        return -52;
-
-    ret = InitRng(&rng);
-    if (ret != 0)
-        return -53;
-
-    ret =  DhGenerateKeyPair(&key, &rng, priv, &privSz, pub, &pubSz);
-    ret += DhGenerateKeyPair(&key2, &rng, priv2, &privSz2, pub2, &pubSz2);
-    if (ret != 0)
-        return -54;
-
-    ret =  DhAgree(&key, agree, &agreeSz, priv, privSz, pub2, pubSz2);
-    ret += DhAgree(&key2, agree2, &agreeSz2, priv2, privSz2, pub, pubSz);
-    if (ret != 0)
-        return -55;
-
-    if (memcmp(agree, agree2, agreeSz))
-        return -56;
-
-    FreeDhKey(&key);
-    FreeDhKey(&key2);
-
-    return 0;
-}
-
-#endif /* NO_DH */
-
-
-#ifndef NO_DSA
-
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    #ifdef FREESCALE_MQX
-        static const char* dsaKey = "a:\\certs\\dsa2048.der";
-    #else
-        static const char* dsaKey = "./certs/dsa2048.der";
-    #endif
-#endif
-
-int dsa_test(void)
-{
-    int    ret, answer;
-    word32 bytes;
-    word32 idx = 0;
-    byte   tmp[1024];
-    DsaKey key;
-    WC_RNG rng;
-    Sha    sha;
-    byte   hash[SHA_DIGEST_SIZE];
-    byte   signature[40];
-
-
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, dsa_key_der_1024, sizeof_dsa_key_der_1024);
-    bytes = sizeof_dsa_key_der_1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, dsa_key_der_2048, sizeof_dsa_key_der_2048);
-    bytes = sizeof_dsa_key_der_2048;
-#else
-    FILE*  file = fopen(dsaKey, "rb");
-
-    if (!file)
-        return -60;
-
-    bytes = (word32) fread(tmp, 1, sizeof(tmp), file);
-    fclose(file);
-#endif /* USE_CERT_BUFFERS */
-
-    ret = InitSha(&sha);
-    if (ret != 0)
-        return -4002;
-    ShaUpdate(&sha, tmp, bytes);
-    ShaFinal(&sha, hash);
-
-    InitDsaKey(&key);
-    ret = DsaPrivateKeyDecode(tmp, &idx, &key, bytes);
-    if (ret != 0) return -61;
-
-    ret = InitRng(&rng);
-    if (ret != 0) return -62;
-
-    ret = DsaSign(hash, signature, &key, &rng);
-    if (ret != 0) return -63;
-
-    ret = DsaVerify(hash, signature, &key, &answer);
-    if (ret != 0) return -64;
-    if (answer != 1) return -65;
-
-    FreeDsaKey(&key);
-
-    return 0;
-}
-
-#endif /* NO_DSA */
-
-
-#ifdef OPENSSL_EXTRA
-
-int openssl_test(void)
-{
-    EVP_MD_CTX md_ctx;
-    testVector a, b, c, d, e, f;
-    byte       hash[SHA_DIGEST_SIZE*4];  /* max size */
-
-    (void)e;
-    (void)f;
-
-    a.input  = "1234567890123456789012345678901234567890123456789012345678"
-               "9012345678901234567890";
-    a.output = "\x57\xed\xf4\xa2\x2b\xe3\xc9\x55\xac\x49\xda\x2e\x21\x07\xb6"
-               "\x7a";
-    a.inLen  = strlen(a.input);
-    a.outLen = MD5_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_md5());
-
-    EVP_DigestUpdate(&md_ctx, a.input, (unsigned long)a.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, a.output, MD5_DIGEST_SIZE) != 0)
-        return -71;
-
-    b.input  = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-               "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-               "aaaaaaaaaa";
-    b.output = "\xAD\x5B\x3F\xDB\xCB\x52\x67\x78\xC2\x83\x9D\x2F\x15\x1E\xA7"
-               "\x53\x99\x5E\x26\xA0";
-    b.inLen  = strlen(b.input);
-    b.outLen = SHA_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_sha1());
-
-    EVP_DigestUpdate(&md_ctx, b.input, (unsigned long)b.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, b.output, SHA_DIGEST_SIZE) != 0)
-        return -72;
-
-
-    d.input  = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
-    d.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";
-    d.inLen  = strlen(d.input);
-    d.outLen = SHA256_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_sha256());
-
-    EVP_DigestUpdate(&md_ctx, d.input, (unsigned long)d.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, d.output, SHA256_DIGEST_SIZE) != 0)
-        return -78;
-
-#ifdef CYASSL_SHA384
-
-    e.input  = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
-               "jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
-    e.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";
-    e.inLen  = strlen(e.input);
-    e.outLen = SHA384_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_sha384());
-
-    EVP_DigestUpdate(&md_ctx, e.input, e.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, e.output, SHA384_DIGEST_SIZE) != 0)
-        return -79;
-
-#endif /* CYASSL_SHA384 */
-
-
-#ifdef CYASSL_SHA512
-
-    f.input  = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
-               "jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
-    f.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";
-    f.inLen  = strlen(f.input);
-    f.outLen = SHA512_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_sha512());
-
-    EVP_DigestUpdate(&md_ctx, f.input, (unsigned long)f.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, f.output, SHA512_DIGEST_SIZE) != 0)
-        return -80;
-
-#endif /* CYASSL_SHA512 */
-
-
-    if (RAND_bytes(hash, sizeof(hash)) != 1)
-        return -73;
-
-    c.input  = "what do ya want for nothing?";
-    c.output = "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7"
-               "\x38";
-    c.inLen  = strlen(c.input);
-    c.outLen = MD5_DIGEST_SIZE;
-
-    HMAC(EVP_md5(), "Jefe", 4, (byte*)c.input, (int)c.inLen, hash, 0);
-
-    if (memcmp(hash, c.output, MD5_DIGEST_SIZE) != 0)
-        return -74;
-
-    { /* des test */
-    const byte vector[] = { /* "now is the time for all " w/o trailing 0 */
-        0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-        0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-        0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-    };
-
-    byte plain[24];
-    byte cipher[24];
-
-    const_DES_cblock key =
-    {
-        0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef
-    };
-
-    DES_cblock iv =
-    {
-        0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef
-    };
-
-    DES_key_schedule sched;
-
-    const byte verify[] =
-    {
-        0x8b,0x7c,0x52,0xb0,0x01,0x2b,0x6c,0xb8,
-        0x4f,0x0f,0xeb,0xf3,0xfb,0x5f,0x86,0x73,
-        0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
-    };
-
-    DES_key_sched(&key, &sched);
-
-    DES_cbc_encrypt(vector, cipher, sizeof(vector), &sched, &iv, DES_ENCRYPT);
-    DES_cbc_encrypt(cipher, plain, sizeof(vector), &sched, &iv, DES_DECRYPT);
-
-    if (memcmp(plain, vector, sizeof(vector)) != 0)
-        return -75;
-
-    if (memcmp(cipher, verify, sizeof(verify)) != 0)
-        return -76;
-
-        /* test changing iv */
-    DES_ncbc_encrypt(vector, cipher, 8, &sched, &iv, DES_ENCRYPT);
-    DES_ncbc_encrypt(vector + 8, cipher + 8, 16, &sched, &iv, DES_ENCRYPT);
-
-    if (memcmp(cipher, verify, sizeof(verify)) != 0)
-        return -77;
-
-    }  /* end des test */
-
-    {  /* evp_cipher test */
-        EVP_CIPHER_CTX ctx;
-
-
-        const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */
-            0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-            0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-            0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-        };
-
-        const byte verify[] =
-        {
-            0x95,0x94,0x92,0x57,0x5f,0x42,0x81,0x53,
-            0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
-        };
-
-        byte key[] = "0123456789abcdef   ";  /* align */
-        byte iv[]  = "1234567890abcdef   ";  /* align */
-
-        byte cipher[AES_BLOCK_SIZE * 4];
-        byte plain [AES_BLOCK_SIZE * 4];
-
-        EVP_CIPHER_CTX_init(&ctx);
-        if (EVP_CipherInit(&ctx, EVP_aes_128_cbc(), key, iv, 1) == 0)
-            return -81;
-
-        if (EVP_Cipher(&ctx, cipher, (byte*)msg, 16) == 0)
-            return -82;
-
-        if (memcmp(cipher, verify, AES_BLOCK_SIZE))
-            return -83;
-
-        EVP_CIPHER_CTX_init(&ctx);
-        if (EVP_CipherInit(&ctx, EVP_aes_128_cbc(), key, iv, 0) == 0)
-            return -84;
-
-        if (EVP_Cipher(&ctx, plain, cipher, 16) == 0)
-            return -85;
-
-        if (memcmp(plain, msg, AES_BLOCK_SIZE))
-            return -86;
-
-
-    }  /* end evp_cipher test */
-
-    return 0;
-}
-
-#endif /* OPENSSL_EXTRA */
-
-
-#ifndef NO_PWDBASED
-
-int pkcs12_test(void)
-{
-    const byte passwd[] = { 0x00, 0x73, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x67,
-                            0x00, 0x00 };
-    const byte salt[] =   { 0x0a, 0x58, 0xCF, 0x64, 0x53, 0x0d, 0x82, 0x3f };
-
-    const byte passwd2[] = { 0x00, 0x71, 0x00, 0x75, 0x00, 0x65, 0x00, 0x65,
-                             0x00, 0x67, 0x00, 0x00 };
-    const byte salt2[] =   { 0x16, 0x82, 0xC0, 0xfC, 0x5b, 0x3f, 0x7e, 0xc5 };
-    byte  derived[64];
-
-    const byte verify[] = {
-        0x8A, 0xAA, 0xE6, 0x29, 0x7B, 0x6C, 0xB0, 0x46,
-        0x42, 0xAB, 0x5B, 0x07, 0x78, 0x51, 0x28, 0x4E,
-        0xB7, 0x12, 0x8F, 0x1A, 0x2A, 0x7F, 0xBC, 0xA3
-    };
-
-    const byte verify2[] = {
-        0x48, 0x3D, 0xD6, 0xE9, 0x19, 0xD7, 0xDE, 0x2E,
-        0x8E, 0x64, 0x8B, 0xA8, 0xF8, 0x62, 0xF3, 0xFB,
-        0xFB, 0xDC, 0x2B, 0xCB, 0x2C, 0x02, 0x95, 0x7F
-    };
-
-    int id         =  1;
-    int kLen       = 24;
-    int iterations =  1;
-    int ret = PKCS12_PBKDF(derived, passwd, sizeof(passwd), salt, 8, iterations,
-                           kLen, SHA, id);
-
-    if (ret < 0)
-        return -103;
-
-    if ( (ret = memcmp(derived, verify, kLen)) != 0)
-        return -104;
-
-    iterations = 1000;
-    ret = PKCS12_PBKDF(derived, passwd2, sizeof(passwd2), salt2, 8, iterations,
-                       kLen, SHA, id);
-    if (ret < 0)
-        return -105;
-
-    if ( (ret = memcmp(derived, verify2, 24)) != 0)
-        return -106;
-
-    return 0;
-}
-
-
-int pbkdf2_test(void)
-{
-    char passwd[] = "password";
-    const byte salt[] = { 0x78, 0x57, 0x8E, 0x5a, 0x5d, 0x63, 0xcb, 0x06 };
-    int   iterations = 2048;
-    int   kLen = 24;
-    byte  derived[64];
-
-    const byte verify[] = {
-        0xBF, 0xDE, 0x6B, 0xE9, 0x4D, 0xF7, 0xE1, 0x1D, 0xD4, 0x09, 0xBC, 0xE2,
-        0x0A, 0x02, 0x55, 0xEC, 0x32, 0x7C, 0xB9, 0x36, 0xFF, 0xE9, 0x36, 0x43
-
-    };
-
-    int ret = PBKDF2(derived, (byte*)passwd, (int)strlen(passwd), salt, 8,
-                                                         iterations, kLen, SHA);
-    if (ret != 0)
-        return ret;
-
-    if (memcmp(derived, verify, sizeof(verify)) != 0)
-        return -102;
-
-    return 0;
-}
-
-
-int pbkdf1_test(void)
-{
-    char passwd[] = "password";
-    const byte salt[] = { 0x78, 0x57, 0x8E, 0x5a, 0x5d, 0x63, 0xcb, 0x06 };
-    int   iterations = 1000;
-    int   kLen = 16;
-    byte  derived[16];
-
-    const byte verify[] = {
-        0xDC, 0x19, 0x84, 0x7E, 0x05, 0xC6, 0x4D, 0x2F, 0xAF, 0x10, 0xEB, 0xFB,
-        0x4A, 0x3D, 0x2A, 0x20
-    };
-
-    PBKDF1(derived, (byte*)passwd, (int)strlen(passwd), salt, 8, iterations,
-           kLen, SHA);
-
-    if (memcmp(derived, verify, sizeof(verify)) != 0)
-        return -101;
-
-    return 0;
-}
-
-
-int pwdbased_test(void)
-{
-   int ret =  pbkdf1_test();
-   ret += pbkdf2_test();
-
-   return ret + pkcs12_test();
-}
-
-#endif /* NO_PWDBASED */
-
-#if defined(HAVE_HKDF) && (!defined(NO_SHA) || !defined(NO_SHA256))
-
-int hkdf_test(void)
-{
-    int ret;
-    int L = 42;
-    byte okm1[42];
-    byte ikm1[22] = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
-                      0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
-                      0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b };
-    byte salt1[13] ={ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-                      0x08, 0x09, 0x0a, 0x0b, 0x0c };
-    byte info1[10] ={ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
-                      0xf8, 0xf9 };
-    byte res1[42] = { 0x0a, 0xc1, 0xaf, 0x70, 0x02, 0xb3, 0xd7, 0x61,
-                      0xd1, 0xe5, 0x52, 0x98, 0xda, 0x9d, 0x05, 0x06,
-                      0xb9, 0xae, 0x52, 0x05, 0x72, 0x20, 0xa3, 0x06,
-                      0xe0, 0x7b, 0x6b, 0x87, 0xe8, 0xdf, 0x21, 0xd0,
-                      0xea, 0x00, 0x03, 0x3d, 0xe0, 0x39, 0x84, 0xd3,
-                      0x49, 0x18 };
-    byte res2[42] = { 0x08, 0x5a, 0x01, 0xea, 0x1b, 0x10, 0xf3, 0x69,
-                      0x33, 0x06, 0x8b, 0x56, 0xef, 0xa5, 0xad, 0x81,
-                      0xa4, 0xf1, 0x4b, 0x82, 0x2f, 0x5b, 0x09, 0x15,
-                      0x68, 0xa9, 0xcd, 0xd4, 0xf1, 0x55, 0xfd, 0xa2,
-                      0xc2, 0x2e, 0x42, 0x24, 0x78, 0xd3, 0x05, 0xf3,
-                      0xf8, 0x96 };
-    byte res3[42] = { 0x8d, 0xa4, 0xe7, 0x75, 0xa5, 0x63, 0xc1, 0x8f,
-                      0x71, 0x5f, 0x80, 0x2a, 0x06, 0x3c, 0x5a, 0x31,
-                      0xb8, 0xa1, 0x1f, 0x5c, 0x5e, 0xe1, 0x87, 0x9e,
-                      0xc3, 0x45, 0x4e, 0x5f, 0x3c, 0x73, 0x8d, 0x2d,
-                      0x9d, 0x20, 0x13, 0x95, 0xfa, 0xa4, 0xb6, 0x1a,
-                      0x96, 0xc8 };
-    byte res4[42] = { 0x3c, 0xb2, 0x5f, 0x25, 0xfa, 0xac, 0xd5, 0x7a,
-                      0x90, 0x43, 0x4f, 0x64, 0xd0, 0x36, 0x2f, 0x2a,
-                      0x2d, 0x2d, 0x0a, 0x90, 0xcf, 0x1a, 0x5a, 0x4c,
-                      0x5d, 0xb0, 0x2d, 0x56, 0xec, 0xc4, 0xc5, 0xbf,
-                      0x34, 0x00, 0x72, 0x08, 0xd5, 0xb8, 0x87, 0x18,
-                      0x58, 0x65 };
-
-    (void)res1;
-    (void)res2;
-    (void)res3;
-    (void)res4;
-    (void)salt1;
-    (void)info1;
-
-#ifndef NO_SHA
-    ret = HKDF(SHA, ikm1, 22, NULL, 0, NULL, 0, okm1, L);
-    if (ret != 0)
-        return -2001;
-
-    if (memcmp(okm1, res1, L) != 0)
-        return -2002;
-
-#ifndef HAVE_FIPS
-    /* fips can't have key size under 14 bytes, salt is key too */
-    ret = HKDF(SHA, ikm1, 11, salt1, 13, info1, 10, okm1, L);
-    if (ret != 0)
-        return -2003;
-
-    if (memcmp(okm1, res2, L) != 0)
-        return -2004;
-#endif /* HAVE_FIPS */
-#endif /* NO_SHA */
-
-#ifndef NO_SHA256
-    ret = HKDF(SHA256, ikm1, 22, NULL, 0, NULL, 0, okm1, L);
-    if (ret != 0)
-        return -2005;
-
-    if (memcmp(okm1, res3, L) != 0)
-        return -2006;
-
-#ifndef HAVE_FIPS
-    /* fips can't have key size under 14 bytes, salt is key too */
-    ret = HKDF(SHA256, ikm1, 22, salt1, 13, info1, 10, okm1, L);
-    if (ret != 0)
-        return -2007;
-
-    if (memcmp(okm1, res4, L) != 0)
-        return -2007;
-#endif /* HAVE_FIPS */
-#endif /* NO_SHA256 */
-
-    return 0;
-}
-
-#endif /* HAVE_HKDF */
-
-
-#ifdef HAVE_ECC
-
-int ecc_test(void)
-{
-    WC_RNG  rng;
-    byte    sharedA[1024];
-    byte    sharedB[1024];
-    byte    sig[1024];
-    byte    digest[20];
-    byte    exportBuf[1024];
-    word32  x, y;
-    int     i, verify, ret;
-    ecc_key userA, userB, pubKey;
-
-    ret = InitRng(&rng);
-    if (ret != 0)
-        return -1001;
-
-    ecc_init(&userA);
-    ecc_init(&userB);
-    ecc_init(&pubKey);
-
-    ret = ecc_make_key(&rng, 32, &userA);
-
-    if (ret != 0)
-        return -1014;
-
-    ret = ecc_make_key(&rng, 32, &userB);
-
-    if (ret != 0)
-        return -1002;
-
-    x = sizeof(sharedA);
-    ret = ecc_shared_secret(&userA, &userB, sharedA, &x);
-
-    if (ret != 0)
-        return -1015;
-
-    y = sizeof(sharedB);
-    ret = ecc_shared_secret(&userB, &userA, sharedB, &y);
-
-    if (ret != 0)
-        return -1003;
-
-    if (y != x)
-        return -1004;
-
-    if (memcmp(sharedA, sharedB, x))
-        return -1005;
-
-    x = sizeof(exportBuf);
-    ret = ecc_export_x963(&userA, exportBuf, &x);
-    if (ret != 0)
-        return -1006;
-
-    ret = ecc_import_x963(exportBuf, x, &pubKey);
-
-    if (ret != 0)
-        return -1007;
-
-    y = sizeof(sharedB);
-    ret = ecc_shared_secret(&userB, &pubKey, sharedB, &y);
-
-    if (ret != 0)
-        return -1008;
-
-    if (memcmp(sharedA, sharedB, y))
-        return -1010;
-
-    /* test DSA sign hash */
-    for (i = 0; i < (int)sizeof(digest); i++)
-        digest[i] = (byte)i;
-
-    x = sizeof(sig);
-    ret = ecc_sign_hash(digest, sizeof(digest), sig, &x, &rng, &userA);
-
-    if (ret != 0)
-        return -1016;
-
-    verify = 0;
-    ret = ecc_verify_hash(sig, x, digest, sizeof(digest), &verify, &userA);
-
-    if (ret != 0)
-        return -1011;
-
-    if (verify != 1)
-        return -1012;
-
-    x = sizeof(exportBuf);
-    ret = ecc_export_private_only(&userA, exportBuf, &x);
-    if (ret != 0)
-        return -1013;
-
-    ecc_free(&pubKey);
-    ecc_free(&userB);
-    ecc_free(&userA);
-
-    return 0;
-}
-
-#ifdef HAVE_ECC_ENCRYPT
-
-int ecc_encrypt_test(void)
-{
-    WC_RNG  rng;
-    int     ret;
-    ecc_key userA, userB;
-    byte    msg[48];
-    byte    plain[48];
-    byte    out[80];
-    word32  outSz   = sizeof(out);
-    word32  plainSz = sizeof(plain);
-    int     i;
-
-    ret = InitRng(&rng);
-    if (ret != 0)
-        return -3001;
-
-    ecc_init(&userA);
-    ecc_init(&userB);
-
-    ret  = ecc_make_key(&rng, 32, &userA);
-    ret += ecc_make_key(&rng, 32, &userB);
-
-    if (ret != 0)
-        return -3002;
-
-    for (i = 0; i < 48; i++)
-        msg[i] = i;
-
-    /* encrypt msg to B */
-    ret = ecc_encrypt(&userA, &userB, msg, sizeof(msg), out, &outSz, NULL);
-    if (ret != 0)
-        return -3003;
-
-    /* decrypt msg from A */
-    ret = ecc_decrypt(&userB, &userA, out, outSz, plain, &plainSz, NULL);
-    if (ret != 0)
-        return -3004;
-
-    if (memcmp(plain, msg, sizeof(msg)) != 0)
-        return -3005;
-
-
-    {  /* let's verify message exchange works, A is client, B is server */
-        ecEncCtx* cliCtx = ecc_ctx_new(REQ_RESP_CLIENT, &rng);
-        ecEncCtx* srvCtx = ecc_ctx_new(REQ_RESP_SERVER, &rng);
-
-        byte cliSalt[EXCHANGE_SALT_SZ];
-        byte srvSalt[EXCHANGE_SALT_SZ];
-        const byte* tmpSalt;
-
-        if (cliCtx == NULL || srvCtx == NULL)
-            return -3006;
-
-        /* get salt to send to peer */
-        tmpSalt = ecc_ctx_get_own_salt(cliCtx);
-        if (tmpSalt == NULL)
-            return -3007;
-        memcpy(cliSalt, tmpSalt, EXCHANGE_SALT_SZ);
-
-        tmpSalt = ecc_ctx_get_own_salt(srvCtx);
-        if (tmpSalt == NULL)
-            return -3007;
-        memcpy(srvSalt, tmpSalt, EXCHANGE_SALT_SZ);
-
-        /* in actual use, we'd get the peer's salt over the transport */
-        ret  = ecc_ctx_set_peer_salt(cliCtx, srvSalt);
-        ret += ecc_ctx_set_peer_salt(srvCtx, cliSalt);
-
-        ret += ecc_ctx_set_info(cliCtx, (byte*)"CyaSSL MSGE", 11);
-        ret += ecc_ctx_set_info(srvCtx, (byte*)"CyaSSL MSGE", 11);
-
-        if (ret != 0)
-            return -3008;
-
-        /* get encrypted msg (request) to send to B */
-        outSz  = sizeof(out);
-        ret = ecc_encrypt(&userA, &userB, msg, sizeof(msg), out, &outSz,cliCtx);
-        if (ret != 0)
-            return -3009;
-
-        /* B decrypts msg (request) from A */
-        plainSz = sizeof(plain);
-        ret = ecc_decrypt(&userB, &userA, out, outSz, plain, &plainSz, srvCtx);
-        if (ret != 0)
-            return -3010;
-
-        if (memcmp(plain, msg, sizeof(msg)) != 0)
-            return -3011;
-
-        {
-            /* msg2 (response) from B to A */
-            byte    msg2[48];
-            byte    plain2[48];
-            byte    out2[80];
-            word32  outSz2   = sizeof(out2);
-            word32  plainSz2 = sizeof(plain2);
-
-            for (i = 0; i < 48; i++)
-                msg2[i] = i+48;
-
-            /* get encrypted msg (response) to send to B */
-            ret = ecc_encrypt(&userB, &userA, msg2, sizeof(msg2), out2,
-                              &outSz2, srvCtx);
-            if (ret != 0)
-                return -3012;
-
-            /* A decrypts msg (response) from B */
-            ret = ecc_decrypt(&userA, &userB, out2, outSz2, plain2, &plainSz2,
-                             cliCtx);
-            if (ret != 0)
-                return -3013;
-
-            if (memcmp(plain2, msg2, sizeof(msg2)) != 0)
-                return -3014;
-        }
-
-        /* cleanup */
-        ecc_ctx_free(srvCtx);
-        ecc_ctx_free(cliCtx);
-    }
-
-    /* cleanup */
-    ecc_free(&userB);
-    ecc_free(&userA);
-
-    return 0;
-}
-
-#endif /* HAVE_ECC_ENCRYPT */
-#endif /* HAVE_ECC */
-
-#ifdef HAVE_LIBZ
-
-const byte sample_text[] =
-    "Biodiesel cupidatat marfa, cliche aute put a bird on it incididunt elit\n"
-    "polaroid. Sunt tattooed bespoke reprehenderit. Sint twee organic id\n"
-    "marfa. Commodo veniam ad esse gastropub. 3 wolf moon sartorial vero,\n"
-    "plaid delectus biodiesel squid +1 vice. Post-ironic keffiyeh leggings\n"
-    "selfies cray fap hoodie, forage anim. Carles cupidatat shoreditch, VHS\n"
-    "small batch meggings kogi dolore food truck bespoke gastropub.\n"
-    "\n"
-    "Terry richardson adipisicing actually typewriter tumblr, twee whatever\n"
-    "four loko you probably haven't heard of them high life. Messenger bag\n"
-    "whatever tattooed deep v mlkshk. Brooklyn pinterest assumenda chillwave\n"
-    "et, banksy ullamco messenger bag umami pariatur direct trade forage.\n"
-    "Typewriter culpa try-hard, pariatur sint brooklyn meggings. Gentrify\n"
-    "food truck next level, tousled irony non semiotics PBR ethical anim cred\n"
-    "readymade. Mumblecore brunch lomo odd future, portland organic terry\n"
-    "richardson elit leggings adipisicing ennui raw denim banjo hella. Godard\n"
-    "mixtape polaroid, pork belly readymade organic cray typewriter helvetica\n"
-    "four loko whatever street art yr farm-to-table.\n"
-    "\n"
-    "Vinyl keytar vice tofu. Locavore you probably haven't heard of them pug\n"
-    "pickled, hella tonx labore truffaut DIY mlkshk elit cosby sweater sint\n"
-    "et mumblecore. Elit swag semiotics, reprehenderit DIY sartorial nisi ugh\n"
-    "nesciunt pug pork belly wayfarers selfies delectus. Ethical hoodie\n"
-    "seitan fingerstache kale chips. Terry richardson artisan williamsburg,\n"
-    "eiusmod fanny pack irony tonx ennui lo-fi incididunt tofu YOLO\n"
-    "readymade. 8-bit sed ethnic beard officia. Pour-over iphone DIY butcher,\n"
-    "ethnic art party qui letterpress nisi proident jean shorts mlkshk\n"
-    "locavore.\n"
-    "\n"
-    "Narwhal flexitarian letterpress, do gluten-free voluptate next level\n"
-    "banh mi tonx incididunt carles DIY. Odd future nulla 8-bit beard ut\n"
-    "cillum pickled velit, YOLO officia you probably haven't heard of them\n"
-    "trust fund gastropub. Nisi adipisicing tattooed, Austin mlkshk 90's\n"
-    "small batch american apparel. Put a bird on it cosby sweater before they\n"
-    "sold out pork belly kogi hella. Street art mollit sustainable polaroid,\n"
-    "DIY ethnic ea pug beard dreamcatcher cosby sweater magna scenester nisi.\n"
-    "Sed pork belly skateboard mollit, labore proident eiusmod. Sriracha\n"
-    "excepteur cosby sweater, anim deserunt laborum eu aliquip ethical et\n"
-    "neutra PBR selvage.\n"
-    "\n"
-    "Raw denim pork belly truffaut, irony plaid sustainable put a bird on it\n"
-    "next level jean shorts exercitation. Hashtag keytar whatever, nihil\n"
-    "authentic aliquip disrupt laborum. Tattooed selfies deserunt trust fund\n"
-    "wayfarers. 3 wolf moon synth church-key sartorial, gastropub leggings\n"
-    "tattooed. Labore high life commodo, meggings raw denim fingerstache pug\n"
-    "trust fund leggings seitan forage. Nostrud ullamco duis, reprehenderit\n"
-    "incididunt flannel sustainable helvetica pork belly pug banksy you\n"
-    "probably haven't heard of them nesciunt farm-to-table. Disrupt nostrud\n"
-    "mollit magna, sriracha sartorial helvetica.\n"
-    "\n"
-    "Nulla kogi reprehenderit, skateboard sustainable duis adipisicing viral\n"
-    "ad fanny pack salvia. Fanny pack trust fund you probably haven't heard\n"
-    "of them YOLO vice nihil. Keffiyeh cray lo-fi pinterest cardigan aliqua,\n"
-    "reprehenderit aute. Culpa tousled williamsburg, marfa lomo actually anim\n"
-    "skateboard. Iphone aliqua ugh, semiotics pariatur vero readymade\n"
-    "organic. Marfa squid nulla, in laborum disrupt laboris irure gastropub.\n"
-    "Veniam sunt food truck leggings, sint vinyl fap.\n"
-    "\n"
-    "Hella dolore pork belly, truffaut carles you probably haven't heard of\n"
-    "them PBR helvetica in sapiente. Fashion axe ugh bushwick american\n"
-    "apparel. Fingerstache sed iphone, jean shorts blue bottle nisi bushwick\n"
-    "flexitarian officia veniam plaid bespoke fap YOLO lo-fi. Blog\n"
-    "letterpress mumblecore, food truck id cray brooklyn cillum ad sed.\n"
-    "Assumenda chambray wayfarers vinyl mixtape sustainable. VHS vinyl\n"
-    "delectus, culpa williamsburg polaroid cliche swag church-key synth kogi\n"
-    "magna pop-up literally. Swag thundercats ennui shoreditch vegan\n"
-    "pitchfork neutra truffaut etsy, sed single-origin coffee craft beer.\n"
-    "\n"
-    "Odio letterpress brooklyn elit. Nulla single-origin coffee in occaecat\n"
-    "meggings. Irony meggings 8-bit, chillwave lo-fi adipisicing cred\n"
-    "dreamcatcher veniam. Put a bird on it irony umami, trust fund bushwick\n"
-    "locavore kale chips. Sriracha swag thundercats, chillwave disrupt\n"
-    "tousled beard mollit mustache leggings portland next level. Nihil esse\n"
-    "est, skateboard art party etsy thundercats sed dreamcatcher ut iphone\n"
-    "swag consectetur et. Irure skateboard banjo, nulla deserunt messenger\n"
-    "bag dolor terry richardson sapiente.\n";
-
-
-int compress_test(void)
-{
-    int ret = 0;
-    word32 dSz = sizeof(sample_text);
-    word32 cSz = (dSz + (word32)(dSz * 0.001) + 12);
-    byte *c = NULL;
-    byte *d = NULL;
-
-    c = calloc(cSz, sizeof(byte));
-    d = calloc(dSz, sizeof(byte));
-
-    if (c == NULL || d == NULL)
-        ret = -300;
-
-    if (ret == 0 && (ret = Compress(c, cSz, sample_text, dSz, 0)) < 0)
-        ret = -301;
-
-    if (ret > 0) {
-        cSz = (word32)ret;
-        ret = 0;
-    }
-
-    if (ret == 0 && DeCompress(d, dSz, c, cSz) != (int)dSz)
-        ret = -302;
-
-    if (ret == 0 && memcmp(d, sample_text, dSz))
-        ret = -303;
-
-    if (c) free(c);
-    if (d) free(d);
-
-    return ret;
-}
-
-#endif /* HAVE_LIBZ */
-
-#ifdef HAVE_PKCS7
-
-int pkcs7enveloped_test(void)
-{
-    int ret = 0;
-
-    int cipher = DES3b;
-    int envelopedSz, decodedSz;
-    PKCS7 pkcs7;
-    byte* cert;
-    byte* privKey;
-    byte  enveloped[2048];
-    byte  decoded[2048];
-
-    size_t certSz;
-    size_t privKeySz;
-    FILE*  certFile;
-    FILE*  keyFile;
-    FILE*  pkcs7File;
-    const char* pkcs7OutFile = "pkcs7envelopedData.der";
-
-    const byte data[] = { /* Hello World */
-        0x48,0x65,0x6c,0x6c,0x6f,0x20,0x57,0x6f,
-        0x72,0x6c,0x64
-    };
-
-    /* read client cert and key in DER format */
-    cert = (byte*)malloc(FOURK_BUF);
-    if (cert == NULL)
-        return -201;
-
-    privKey = (byte*)malloc(FOURK_BUF);
-    if (privKey == NULL) {
-        free(cert);
-        return -202;
-    }
-
-    certFile = fopen(clientCert, "rb");
-    if (!certFile) {
-        free(cert);
-        free(privKey);
-        err_sys("can't open ./certs/client-cert.der, "
-                "Please run from CyaSSL home dir", -42);
-    }
-
-    certSz = fread(cert, 1, FOURK_BUF, certFile);
-    fclose(certFile);
-
-    keyFile = fopen(clientKey, "rb");
-    if (!keyFile) {
-        free(cert);
-        free(privKey);
-        err_sys("can't open ./certs/client-key.der, "
-                "Please run from CyaSSL home dir", -43);
-    }
-
-    privKeySz = fread(privKey, 1, FOURK_BUF, keyFile);
-    fclose(keyFile);
-
-    PKCS7_InitWithCert(&pkcs7, cert, (word32)certSz);
-    pkcs7.content     = (byte*)data;
-    pkcs7.contentSz   = (word32)sizeof(data);
-    pkcs7.contentOID  = DATA;
-    pkcs7.encryptOID  = cipher;
-    pkcs7.privateKey  = privKey;
-    pkcs7.privateKeySz = (word32)privKeySz;
-
-    /* encode envelopedData */
-    envelopedSz = PKCS7_EncodeEnvelopedData(&pkcs7, enveloped,
-                                            sizeof(enveloped));
-    if (envelopedSz <= 0) {
-        free(cert);
-        free(privKey);
-        return -203;
-    }
-
-    /* decode envelopedData */
-    decodedSz = PKCS7_DecodeEnvelopedData(&pkcs7, enveloped, envelopedSz,
-                                          decoded, sizeof(decoded));
-    if (decodedSz <= 0) {
-        free(cert);
-        free(privKey);
-        return -204;
-    }
-
-    /* test decode result */
-    if (memcmp(decoded, data, sizeof(data)) != 0) {
-        free(cert);
-        free(privKey);
-        return -205;
-    }
-
-    /* output pkcs7 envelopedData for external testing */
-    pkcs7File = fopen(pkcs7OutFile, "wb");
-    if (!pkcs7File) {
-        free(cert);
-        free(privKey);
-        return -206;
-    }
-
-    ret = (int)fwrite(enveloped, envelopedSz, 1, pkcs7File);
-    fclose(pkcs7File);
-
-    free(cert);
-    free(privKey);
-    PKCS7_Free(&pkcs7);
-
-    if (ret > 0)
-        return 0;
-
-    return ret;
-}
-
-int pkcs7signed_test(void)
-{
-    int ret = 0;
-
-    FILE* file;
-    byte* certDer;
-    byte* keyDer;
-    byte* out;
-    char data[] = "Hello World";
-    word32 dataSz, outSz, certDerSz, keyDerSz;
-    PKCS7 msg;
-    WC_RNG rng;
-
-    byte transIdOid[] =
-               { 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01,
-                 0x09, 0x07 };
-    byte messageTypeOid[] =
-               { 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01,
-                 0x09, 0x02 };
-    byte senderNonceOid[] =
-               { 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01,
-                 0x09, 0x05 };
-    byte transId[(SHA_DIGEST_SIZE + 1) * 2 + 1];
-    byte messageType[] = { 0x13, 2, '1', '9' };
-    byte senderNonce[PKCS7_NONCE_SZ + 2];
-
-    PKCS7Attrib attribs[] =
-    {
-        { transIdOid, sizeof(transIdOid),
-                     transId, sizeof(transId) - 1 }, /* take off the null */
-        { messageTypeOid, sizeof(messageTypeOid),
-                     messageType, sizeof(messageType) },
-        { senderNonceOid, sizeof(senderNonceOid),
-                     senderNonce, sizeof(senderNonce) }
-    };
-
-    dataSz = (word32) strlen(data);
-    outSz = FOURK_BUF;
-
-    certDer = (byte*)malloc(FOURK_BUF);
-    if (certDer == NULL)
-        return -207;
-    keyDer = (byte*)malloc(FOURK_BUF);
-    if (keyDer == NULL) {
-        free(certDer);
-        return -208;
-    }
-    out = (byte*)malloc(FOURK_BUF);
-    if (out == NULL) {
-        free(certDer);
-        free(keyDer);
-        return -209;
-    }
-
-    /* read in DER cert of recipient, into cert of size certSz */
-    file = fopen(clientCert, "rb");
-    if (!file) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        err_sys("can't open ./certs/client-cert.der, "
-                "Please run from CyaSSL home dir", -44);
-    }
-    certDerSz = (word32)fread(certDer, 1, FOURK_BUF, file);
-    fclose(file);
-
-    file = fopen(clientKey, "rb");
-    if (!file) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        err_sys("can't open ./certs/client-key.der, "
-                "Please run from CyaSSL home dir", -45);
-    }
-    keyDerSz = (word32)fread(keyDer, 1, FOURK_BUF, file);
-    fclose(file);
-
-    ret = InitRng(&rng);
-    if (ret != 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        return -210;
-    }
-
-    senderNonce[0] = 0x04;
-    senderNonce[1] = PKCS7_NONCE_SZ;
-
-    ret = RNG_GenerateBlock(&rng, &senderNonce[2], PKCS7_NONCE_SZ);
-    if (ret != 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        return -211;
-    }
-
-    PKCS7_InitWithCert(&msg, certDer, certDerSz);
-    msg.privateKey = keyDer;
-    msg.privateKeySz = keyDerSz;
-    msg.content = (byte*)data;
-    msg.contentSz = dataSz;
-    msg.hashOID = SHAh;
-    msg.encryptOID = RSAk;
-    msg.signedAttribs = attribs;
-    msg.signedAttribsSz = sizeof(attribs)/sizeof(PKCS7Attrib);
-    msg.rng = &rng;
-    {
-        Sha sha;
-        byte digest[SHA_DIGEST_SIZE];
-        int i,j;
-
-        transId[0] = 0x13;
-        transId[1] = SHA_DIGEST_SIZE * 2;
-
-        ret = InitSha(&sha);
-        if (ret != 0) {
-            free(certDer);
-            free(keyDer);
-            free(out);
-            return -4003;
-        }
-        ShaUpdate(&sha, msg.publicKey, msg.publicKeySz);
-        ShaFinal(&sha, digest);
-
-        for (i = 0, j = 2; i < SHA_DIGEST_SIZE; i++, j += 2) {
-            snprintf((char*)&transId[j], 3, "%02x", digest[i]);
-        }
-    }
-    ret = PKCS7_EncodeSignedData(&msg, out, outSz);
-    if (ret < 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -212;
-    }
-    else
-        outSz = ret;
-
-    /* write PKCS#7 to output file for more testing */
-    file = fopen("./pkcs7signedData.der", "wb");
-    if (!file) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -213;
-    }
-    ret = (int)fwrite(out, 1, outSz, file);
-    fclose(file);
-    if (ret != (int)outSz) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -218;
-    }
-
-    PKCS7_Free(&msg);
-    PKCS7_InitWithCert(&msg, NULL, 0);
-
-    ret = PKCS7_VerifySignedData(&msg, out, outSz);
-    if (ret < 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -214;
-    }
-
-    if (msg.singleCert == NULL || msg.singleCertSz == 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -215;
-    }
-
-    file = fopen("./pkcs7cert.der", "wb");
-    if (!file) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -216;
-    }
-    ret = (int)fwrite(msg.singleCert, 1, msg.singleCertSz, file);
-    fclose(file);
-
-    free(certDer);
-    free(keyDer);
-    free(out);
-    PKCS7_Free(&msg);
-
-    if (ret > 0)
-        return 0;
-
-    return ret;
-}
-
-#endif /* HAVE_PKCS7 */
-
-#endif /* NO_CRYPT_TEST */
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvoptx b/IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvoptx
deleted file mode 100644
index d3d972b78..000000000
--- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvoptx
+++ /dev/null
@@ -1,1366 +0,0 @@
-
-
-
-  1.0
-
-  
### uVision Project, (C) Keil Software
- - - *.c - *.s*; *.src; *.a* - *.obj - *.lib - *.txt; *.h; *.inc - *.plm - *.cpp - - - - 0 - 0 - - - - CyaSSL-Full - 0x4 - ARM-ADS - - 25000000 - - 1 - 1 - 0 - 1 - - - 1 - 65535 - 0 - 0 - 0 - - - 79 - 66 - 8 - .\Object\ - - - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 - 0 - 0 - - - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - - - 1 - 0 - 1 - - 255 - - - 0 - Schematics (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf - - - 1 - User Manual (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm - - - 2 - MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) - http://www.keil.com/mcbstm32f200/ - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - 8 - - - - - - - - - - .\STM32_SWO.ini - BIN\ULP2CM3.DLL - - - - 0 - DLGUARM - - - - 0 - DLGTARM - (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) - - - 0 - ARMDBGFLAGS - - - - 0 - ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) - - - 0 - UL2CM3 - UL2CM3(-S0 -C0 -P0 ) -FN1 -FC1000 -FD20000000 -FF0STM32F2xx_1024 -FL0100000 -FS08000000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) - - - - - - 0 - 1 - str[i] - - - 1 - 1 - str - - - - - 1 - 3 - 0x20003d9e - - - - - 2 - 8 - 0x8004dc8 - - - - 0 - - - 0 - 1 - 1 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 2 - 0 - 0 - 0 - 1 - 1 - 0 - 0 - 0 - - - - - - - - Source - 1 - 0 - 0 - 0 - - 1 - 1 - 1 - 0 - 0 - 0 - 0 - .\benchmark.c - benchmark.c - 0 - 0 - - - 1 - 2 - 1 - 0 - 0 - 0 - 0 - .\client.c - client.c - 0 - 0 - - - 1 - 3 - 1 - 0 - 0 - 0 - 0 - .\echoclient.c - echoclient.c - 0 - 0 - - - 1 - 4 - 1 - 0 - 0 - 0 - 0 - .\echoserver.c - echoserver.c - 0 - 0 - - - 1 - 5 - 1 - 0 - 0 - 0 - 0 - .\server.c - server.c - 0 - 0 - - - 1 - 6 - 1 - 0 - 0 - 0 - 0 - .\cert_data.c - cert_data.c - 0 - 0 - - - 1 - 7 - 1 - 0 - 0 - 0 - 0 - .\test.c - test.c - 0 - 0 - - - 1 - 8 - 1 - 0 - 0 - 0 - 0 - .\main.c - main.c - 0 - 0 - - - 1 - 9 - 1 - 0 - 0 - 0 - 0 - .\shell.c - shell.c - 0 - 0 - - - - - Configuration - 1 - 0 - 0 - 0 - - 2 - 10 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 0 - 0 - - - 2 - 11 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 0 - 0 - - - 2 - 12 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\settings.h - settings.h - 0 - 0 - - - 2 - 13 - 5 - 0 - 0 - 0 - 0 - .\RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h - 0 - 0 - - - - - Documentation - 1 - 0 - 0 - 0 - - 3 - 14 - 5 - 0 - 0 - 0 - 0 - .\Abstract.txt - Abstract.txt - 0 - 0 - - - - - Devices - 1 - 0 - 0 - 0 - - 4 - 15 - 1 - 0 - 0 - 0 - 0 - .\time-CortexM3-4.c - time-CortexM3-4.c - 0 - 0 - - - 4 - 16 - 1 - 0 - 0 - 0 - 0 - .\time-dummy.c - time-dummy.c - 0 - 0 - - - - - ::CMSIS - 1 - 0 - 0 - 1 - - 5 - 17 - 1 - 0 - 0 - 0 - 0 - RTE\CMSIS\RTX_Conf_CM.c - RTX_Conf_CM.c - 1 - 0 - - - 5 - 18 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - RTX_CM3.lib - 1 - 0 - - - - - ::Device - 0 - 0 - 0 - 1 - - 6 - 19 - 5 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\RTE_Device.h - RTE_Device.h - 1 - 0 - - - 6 - 20 - 2 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - startup_stm32f2xx.s - 1 - 0 - - - 6 - 21 - 1 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\system_stm32f2xx.c - system_stm32f2xx.c - 1 - 0 - - - 6 - 22 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - DMA_STM32F2xx.c - 1 - 0 - - - 6 - 23 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - GPIO_STM32F2xx.c - 1 - 0 - - - - - ::Drivers - 0 - 0 - 0 - 1 - - 7 - 24 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - EMAC_STM32F2xx.c - 1 - 0 - - - 7 - 25 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - MCI_STM32F2xx.c - 1 - 0 - - - 7 - 26 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - PHY_ST802RT1.c - 1 - 0 - - - - - ::File System - 0 - 0 - 0 - 1 - - 8 - 27 - 1 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config.c - FS_Config.c - 1 - 0 - - - 8 - 28 - 5 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config_MC_0.h - FS_Config_MC_0.h - 1 - 0 - - - 8 - 29 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - FS_LFN_CM3_L.lib - 1 - 0 - - - - - ::Network - 0 - 0 - 0 - 1 - - 9 - 30 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config.c - Net_Config.c - 1 - 0 - - - 9 - 31 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_BSD.h - Net_Config_BSD.h - 1 - 0 - - - 9 - 32 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_DNS_Client.h - Net_Config_DNS_Client.h - 1 - 0 - - - 9 - 33 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h - 1 - 0 - - - 9 - 34 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_TCP.h - Net_Config_TCP.h - 1 - 0 - - - 9 - 35 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_UDP.h - Net_Config_UDP.h - 1 - 0 - - - 9 - 36 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Debug.c - Net_Debug.c - 1 - 0 - - - 9 - 37 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - Net_Dbg_CM3_L.lib - 1 - 0 - - - - - ::wolfSSL - 0 - 0 - 0 - 1 - - 10 - 38 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 1 - 0 - - - 10 - 39 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 1 - 0 - - - 10 - 40 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\settings.h - settings.h - 1 - 0 - - - 10 - 41 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - cyassl_MDK_ARM.c - 1 - 0 - - - 10 - 42 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - aes.c - 1 - 0 - - - 10 - 43 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - arc4.c - 1 - 0 - - - 10 - 44 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - asm.c - 1 - 0 - - - 10 - 45 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - asn.c - 1 - 0 - - - 10 - 46 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - blake2b.c - 1 - 0 - - - 10 - 47 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - camellia.c - 1 - 0 - - - 10 - 48 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - coding.c - 1 - 0 - - - 10 - 49 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - compress.c - 1 - 0 - - - 10 - 50 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - des3.c - 1 - 0 - - - 10 - 51 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - dh.c - 1 - 0 - - - 10 - 52 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - dsa.c - 1 - 0 - - - 10 - 53 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - ecc.c - 1 - 0 - - - 10 - 54 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - ecc_fp.c - 1 - 0 - - - 10 - 55 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - error.c - 1 - 0 - - - 10 - 56 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - hc128.c - 1 - 0 - - - 10 - 57 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - hmac.c - 1 - 0 - - - 10 - 58 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - integer.c - 1 - 0 - - - 10 - 59 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - logging.c - 1 - 0 - - - 10 - 60 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - md2.c - 1 - 0 - - - 10 - 61 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - md4.c - 1 - 0 - - - 10 - 62 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - md5.c - 1 - 0 - - - 10 - 63 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - memory.c - 1 - 0 - - - 10 - 64 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - misc.c - 1 - 0 - - - 10 - 65 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - pwdbased.c - 1 - 0 - - - 10 - 66 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - rabbit.c - 1 - 0 - - - 10 - 67 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - random.c - 1 - 0 - - - 10 - 68 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - ripemd.c - 1 - 0 - - - 10 - 69 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - rsa.c - 1 - 0 - - - 10 - 70 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - sha.c - 1 - 0 - - - 10 - 71 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - sha256.c - 1 - 0 - - - 10 - 72 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - sha512.c - 1 - 0 - - - 10 - 73 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - tfm.c - 1 - 0 - - - 10 - 74 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - wc_port.c - 1 - 0 - - - 10 - 75 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - crl.c - 1 - 0 - - - 10 - 76 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - internal.c - 1 - 0 - - - 10 - 77 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - io.c - 1 - 0 - - - 10 - 78 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - keys.c - 1 - 0 - - - 10 - 79 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - ocsp.c - 1 - 0 - - - 10 - 80 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - sniffer.c - 1 - 0 - - - 10 - 81 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - ssl.c - 1 - 0 - - - 10 - 82 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - tls.c - 1 - 0 - - - -
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvprojx b/IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvprojx deleted file mode 100644 index 285caa687..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/CyaSSL-Full.uvprojx +++ /dev/null @@ -1,1185 +0,0 @@ - - - - 2.1 - -
### uVision Project, (C) Keil Software
- - - - CyaSSL-Full - 0x4 - ARM-ADS - - - STM32F207IG - STMicroelectronics - IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE - - - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) - 0 - $$Device:STM32F207IG$Device\Include\stm32f2xx.h - - - - - - - - - - $$Device:STM32F207IG$SVD\STM32F20x.svd - 0 - 0 - - - - - - - 0 - 0 - 0 - 0 - 1 - - .\Object\ - CyaSSL-Full - 1 - 0 - 0 - 1 - 1 - .\Object\ - 1 - 0 - 0 - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - 0 - 0 - - - 0 - 0 - - - 0 - 0 - - 0 - - - - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 3 - - - 1 - - - SARMCM3.DLL - -REMAP -MPU - DCM.DLL - -pCM3 - SARMCM3.DLL - -REMAP -MPU - TCM.DLL - -pCM3 - - - - 1 - 0 - 0 - 0 - 16 - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - - - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 1 - 1 - - 0 - 8 - - - - - - - - - - - - - .\STM32_SWO.ini - BIN\ULP2CM3.DLL - - - - - 1 - 0 - 0 - 1 - 1 - 4100 - - 0 - BIN\ULP2CM3.DLL - "" () - - - - - 0 - - - - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 1 - 1 - 0 - 1 - 1 - 0 - 0 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 1 - 0 - 0 - "Cortex-M3" - - 1 - 0 - 0 - 1 - 1 - 0 - 0 - 0 - 0 - 0 - 8 - 0 - 0 - 0 - 3 - 3 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 1 - 0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x20000 - - - 1 - 0x8000000 - 0x100000 - - - 0 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x0 - 0x0 - - - 1 - 0x8000000 - 0x100000 - - - 1 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x0 - 0x0 - - - 0 - 0x20000000 - 0x20000 - - - 0 - 0x0 - 0x0 - - - - - - 1 - 4 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - HAVE_CONFIG_H MDK_CONF_CYASSL - - - - - - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - - - - - - - - - 1 - 0 - 0 - 0 - 1 - 0 - 0x08000000 - 0x20000000 - - - - - - - - - - - - - Source - - - benchmark.c - 1 - .\benchmark.c - - - client.c - 1 - .\client.c - - - echoclient.c - 1 - .\echoclient.c - - - echoserver.c - 1 - .\echoserver.c - - - server.c - 1 - .\server.c - - - cert_data.c - 1 - .\cert_data.c - - - test.c - 1 - .\test.c - - - main.c - 1 - .\main.c - - - shell.c - 1 - .\shell.c - - - - - Configuration - - - config-CyaSSL.h - 5 - .\RTE\wolfSSL\config-CyaSSL.h - - - config-Crypt.h - 5 - .\RTE\wolfSSL\config-Crypt.h - - - settings.h - 5 - .\RTE\wolfSSL\settings.h - - - Net_Config_ETH_0.h - 5 - .\RTE\Network\Net_Config_ETH_0.h - - - - - Documentation - - - Abstract.txt - 5 - .\Abstract.txt - - - - - Devices - - - time-CortexM3-4.c - 1 - .\time-CortexM3-4.c - - - time-dummy.c - 1 - .\time-dummy.c - - - - - ::CMSIS - - - RTX_Conf_CM.c - 1 - RTE\CMSIS\RTX_Conf_CM.c - - - RTX_CM3.lib - 4 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - - - - - ::Device - - - RTE_Device.h - 5 - RTE\Device\STM32F207IG\RTE_Device.h - - - startup_stm32f2xx.s - 2 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - system_stm32f2xx.c - 1 - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - DMA_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - - - GPIO_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - - - - - ::Drivers - - - EMAC_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - - - MCI_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - - - PHY_ST802RT1.c - 1 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - - - - - ::File System - - - FS_Config.c - 1 - RTE\File_System\FS_Config.c - - - FS_Config_MC_0.h - 5 - RTE\File_System\FS_Config_MC_0.h - - - FS_LFN_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - - - - - ::Network - - - Net_Config.c - 1 - RTE\Network\Net_Config.c - - - Net_Config_BSD.h - 5 - RTE\Network\Net_Config_BSD.h - - - Net_Config_DNS_Client.h - 5 - RTE\Network\Net_Config_DNS_Client.h - - - Net_Config_ETH_0.h - 5 - RTE\Network\Net_Config_ETH_0.h - - - Net_Config_TCP.h - 5 - RTE\Network\Net_Config_TCP.h - - - Net_Config_UDP.h - 5 - RTE\Network\Net_Config_UDP.h - - - Net_Debug.c - 1 - RTE\Network\Net_Debug.c - - - Net_Dbg_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - - - - - ::wolfSSL - - - config-Crypt.h - 5 - RTE\wolfSSL\config-Crypt.h - - - config-CyaSSL.h - 5 - RTE\wolfSSL\config-CyaSSL.h - - - settings.h - 5 - RTE\wolfSSL\settings.h - - - cyassl_MDK_ARM.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - - - aes.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - - - arc4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - - - asm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - - - asn.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - - - blake2b.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - - - camellia.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - - - coding.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - - - compress.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - - - des3.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - - - dh.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - - - dsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - - - ecc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - - - ecc_fp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - - - error.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - - - hc128.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - - - hmac.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - - - integer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - - - logging.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - - - md2.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - - - md4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - - - md5.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - - - memory.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - - - misc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - - - pwdbased.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - - - rabbit.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - - - random.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - - - ripemd.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - - - rsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - - - sha.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - - - sha256.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - - - sha512.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - - - tfm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - - - wc_port.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - - - crl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - - - internal.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - - - io.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - - - keys.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - - - ocsp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - - - sniffer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - - - ssl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - - - tls.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - RTE\CMSIS\RTX_Conf_CM.c - - - - - - - - RTE\Device\STM32F207IG\RTE_Device.h - - - - - - - - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - - - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - - - - RTE\File_System\FS_Config.c - - - - - - - - RTE\File_System\FS_Config_MC_0.h - - - - - - - - RTE\Network\Net_Config.c - - - - - - - - RTE\Network\Net_Config_BSD.h - - - - - - - - RTE\Network\Net_Config_DNS_Client.h - - - - - - - - RTE\Network\Net_Config_ETH_0.h - - - - - - - - RTE\Network\Net_Config_TCP.h - - - - - - - - RTE\Network\Net_Config_UDP.h - - - - - - - - RTE\Network\Net_Debug.c - - - - - - - - RTE\Other\config-RTX-TCP-FS.h - - - - - - RTE\Other\config.h - - - - - - RTE\wolfSSL\config-Crypt.h - - - - - - - - RTE\wolfSSL\config-CyaSSL.h - - - - - - - - RTE\wolfSSL\config.h - - - - - - RTE\wolfSSL\settings.h - - - - - - - - - -
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/RTE/wolfSSL/settings.h b/IDE/MDK5-ARM/Projects/CyaSSL-Full/RTE/wolfSSL/settings.h deleted file mode 100644 index 86a57a0db..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/RTE/wolfSSL/settings.h +++ /dev/null @@ -1,667 +0,0 @@ -/* settings.h - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - */ - -/* Place OS specific preprocessor flags, defines, includes here, will be - included into every file because types.h includes it */ - - -#ifndef CTAO_CRYPT_SETTINGS_H -#define CTAO_CRYPT_SETTINGS_H - -#ifdef __cplusplus - extern "C" { -#endif - -/* Uncomment next line if using IPHONE */ -/* #define IPHONE */ - -/* Uncomment next line if using ThreadX */ -/* #define THREADX */ - -/* Uncomment next line if using Micrium ucOS */ -/* #define MICRIUM */ - -/* Uncomment next line if using Mbed */ -/* #define MBED */ - -/* Uncomment next line if using Microchip PIC32 ethernet starter kit */ -/* #define MICROCHIP_PIC32 */ - -/* Uncomment next line if using Microchip TCP/IP stack, version 5 */ -/* #define MICROCHIP_TCPIP_V5 */ - -/* Uncomment next line if using Microchip TCP/IP stack, version 6 or later */ -/* #define MICROCHIP_TCPIP */ - -/* Uncomment next line if using PIC32MZ Crypto Engine */ -/* #define CYASSL_MICROCHIP_PIC32MZ */ - -/* Uncomment next line if using FreeRTOS */ -/* #define FREERTOS */ - -/* Uncomment next line if using FreeRTOS Windows Simulator */ -/* #define FREERTOS_WINSIM */ - -/* Uncomment next line if using RTIP */ -/* #define EBSNET */ - -/* Uncomment next line if using lwip */ -/* #define CYASSL_LWIP */ - -/* Uncomment next line if building CyaSSL for a game console */ -/* #define CYASSL_GAME_BUILD */ - -/* Uncomment next line if building CyaSSL for LSR */ -/* #define CYASSL_LSR */ - -/* Uncomment next line if building CyaSSL for Freescale MQX/RTCS/MFS */ -/* #define FREESCALE_MQX */ - -/* Uncomment next line if using STM32F2 */ -/* #define CYASSL_STM32F2 */ - -/* Uncomment next line if using Comverge settings */ -/* #define COMVERGE */ - -/* Uncomment next line if using QL SEP settings */ -/* #define CYASSL_QL */ - -/* Uncomment next line if using LwIP native TCP socket settings */ -/* #define HAVE_LWIP_NATIVE */ - -/* Uncomment next line if building for EROAD */ -/* #define CYASSL_EROAD */ - -#include - -#ifdef IPHONE - #define SIZEOF_LONG_LONG 8 -#endif - - -#ifdef CYASSL_USER_SETTINGS - #include -#endif - - -#ifdef COMVERGE - #define THREADX - #define HAVE_NETX - #define CYASSL_USER_IO - #define NO_WRITEV - #define NO_DEV_RANDOM - #define NO_FILESYSTEM - #define NO_SHA512 - #define NO_DH - #define NO_DSA - #define NO_HC128 - #define NO_RSA - #define NO_SESSION_CACHE - #define HAVE_ECC -#endif - - -#ifdef THREADX - #define SIZEOF_LONG_LONG 8 -#endif - -#ifdef HAVE_NETX - #include "nx_api.h" -#endif - -#if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */ - #define CYASSL_LWIP - #define NO_WRITEV - #define SINGLE_THREADED - #define CYASSL_USER_IO - #define NO_FILESYSTEM -#endif - -#ifdef MICROCHIP_PIC32 - /* #define CYASSL_MICROCHIP_PIC32MZ */ - #define SIZEOF_LONG_LONG 8 - #define SINGLE_THREADED - #define CYASSL_USER_IO - #define NO_WRITEV - #define NO_DEV_RANDOM - #define NO_FILESYSTEM - #define USE_FAST_MATH - #define TFM_TIMING_RESISTANT -#endif - -#ifdef CYASSL_MICROCHIP_PIC32MZ - #define CYASSL_PIC32MZ_CE - #define CYASSL_PIC32MZ_CRYPT - #define HAVE_AES_ENGINE - #define CYASSL_PIC32MZ_RNG - /* #define CYASSL_PIC32MZ_HASH */ - #define CYASSL_AES_COUNTER - #define HAVE_AESGCM - #define NO_BIG_INT - -#endif - -#ifdef MICROCHIP_TCPIP_V5 - /* include timer functions */ - #include "TCPIP Stack/TCPIP.h" -#endif - -#ifdef MICROCHIP_TCPIP - /* include timer, NTP functions */ - #ifdef MICROCHIP_MPLAB_HARMONY - #include "tcpip/tcpip.h" - #else - #include "system/system_services.h" - #include "tcpip/sntp.h" - #endif -#endif - -#ifdef MBED - #define CYASSL_USER_IO - #define NO_FILESYSTEM - #define NO_CERT - #define USE_CERT_BUFFERS_1024 - #define NO_WRITEV - #define NO_DEV_RANDOM - #define NO_SHA512 - #define NO_DH - #define NO_DSA - #define NO_HC128 - #define HAVE_ECC - #define NO_SESSION_CACHE - #define CYASSL_CMSIS_RTOS -#endif - - -#ifdef CYASSL_EROAD - #define FREESCALE_MQX - #define FREESCALE_MMCAU - #define SINGLE_THREADED - #define NO_STDIO_FILESYSTEM - #define CYASSL_LEANPSK - #define HAVE_NULL_CIPHER - #define NO_OLD_TLS - #define NO_ASN - #define NO_BIG_INT - #define NO_RSA - #define NO_DSA - #define NO_DH - #define NO_CERTS - #define NO_PWDBASED - #define NO_DES3 - #define NO_MD4 - #define NO_RC4 - #define NO_MD5 - #define NO_SESSION_CACHE - #define NO_MAIN_DRIVER -#endif - -#ifdef FREERTOS_WINSIM - #define FREERTOS - #define USE_WINDOWS_API -#endif - - -/* Micrium will use Visual Studio for compilation but not the Win32 API */ -#if defined(_WIN32) && !defined(MICRIUM) && !defined(FREERTOS) \ - && !defined(EBSNET) && !defined(CYASSL_EROAD) - #define USE_WINDOWS_API -#endif - - -#if defined(CYASSL_LEANPSK) && !defined(XMALLOC_USER) - #include - #define XMALLOC(s, h, type) malloc((s)) - #define XFREE(p, h, type) free((p)) - #define XREALLOC(p, n, h, t) realloc((p), (n)) -#endif - -#if defined(XMALLOC_USER) && defined(SSN_BUILDING_LIBYASSL) - #undef XMALLOC - #define XMALLOC yaXMALLOC - #undef XFREE - #define XFREE yaXFREE - #undef XREALLOC - #define XREALLOC yaXREALLOC -#endif - - -#ifdef FREERTOS - #ifndef NO_WRITEV - #define NO_WRITEV - #endif - #ifndef NO_SHA512 - #define NO_SHA512 - #endif - #ifndef NO_DH - #define NO_DH - #endif - #ifndef NO_DSA - #define NO_DSA - #endif - #ifndef NO_HC128 - #define NO_HC128 - #endif - - #ifndef SINGLE_THREADED - #include "FreeRTOS.h" - #include "semphr.h" - #endif -#endif - -#ifdef EBSNET - #include "rtip.h" - - /* #define DEBUG_CYASSL */ - #define NO_CYASSL_DIR /* tbd */ - - #if (POLLOS) - #define SINGLE_THREADED - #endif - - #if (RTPLATFORM) - #if (!RTP_LITTLE_ENDIAN) - #define BIG_ENDIAN_ORDER - #endif - #else - #if (!KS_LITTLE_ENDIAN) - #define BIG_ENDIAN_ORDER - #endif - #endif - - #if (WINMSP3) - #undef SIZEOF_LONG - #define SIZEOF_LONG_LONG 8 - #else - #sslpro: settings.h - please implement SIZEOF_LONG and SIZEOF_LONG_LONG - #endif - - #define XMALLOC(s, h, type) ((void *)rtp_malloc((s), SSL_PRO_MALLOC)) - #define XFREE(p, h, type) (rtp_free(p)) - #define XREALLOC(p, n, h, t) realloc((p), (n)) - -#endif /* EBSNET */ - -#ifdef CYASSL_GAME_BUILD - #define SIZEOF_LONG_LONG 8 - #if defined(__PPU) || defined(__XENON) - #define BIG_ENDIAN_ORDER - #endif -#endif - -#ifdef CYASSL_LSR - #define HAVE_WEBSERVER - #define SIZEOF_LONG_LONG 8 - #define CYASSL_LOW_MEMORY - #define NO_WRITEV - #define NO_SHA512 - #define NO_DH - #define NO_DSA - #define NO_HC128 - #define NO_DEV_RANDOM - #define NO_CYASSL_DIR - #define NO_RABBIT - #ifndef NO_FILESYSTEM - #define LSR_FS - #include "inc/hw_types.h" - #include "fs.h" - #endif - #define CYASSL_LWIP - #include /* for tcp errno */ - #define CYASSL_SAFERTOS - #if defined(__IAR_SYSTEMS_ICC__) - /* enum uses enum */ - #pragma diag_suppress=Pa089 - #endif -#endif - -#ifdef CYASSL_SAFERTOS - #ifndef SINGLE_THREADED - #include "SafeRTOS/semphr.h" - #endif - - #include "SafeRTOS/heap.h" - #define XMALLOC(s, h, type) pvPortMalloc((s)) - #define XFREE(p, h, type) vPortFree((p)) - #define XREALLOC(p, n, h, t) pvPortRealloc((p), (n)) -#endif - -#ifdef CYASSL_LOW_MEMORY - #undef RSA_LOW_MEM - #define RSA_LOW_MEM - #undef CYASSL_SMALL_STACK - #define CYASSL_SMALL_STACK - #undef TFM_TIMING_RESISTANT - #define TFM_TIMING_RESISTANT -#endif - -#ifdef FREESCALE_MQX - #define SIZEOF_LONG_LONG 8 - #define NO_WRITEV - #define NO_DEV_RANDOM - #define NO_RABBIT - #define NO_CYASSL_DIR - #define USE_FAST_MATH - #define TFM_TIMING_RESISTANT - #define FREESCALE_K70_RNGA - /* #define FREESCALE_K53_RNGB */ - #include "mqx.h" - #ifndef NO_FILESYSTEM - #include "mfs.h" - #include "fio.h" - #endif - #ifndef SINGLE_THREADED - #include "mutex.h" - #endif - - #define XMALLOC(s, h, t) (void *)_mem_alloc_system((s)) - #define XFREE(p, h, t) {void* xp = (p); if ((xp)) _mem_free((xp));} - /* Note: MQX has no realloc, using fastmath above */ -#endif - -#ifdef CYASSL_STM32F2 - #define SIZEOF_LONG_LONG 8 - #define NO_DEV_RANDOM - #define NO_CYASSL_DIR - #define NO_RABBIT - #define STM32F2_RNG - #define STM32F2_CRYPTO - #define KEIL_INTRINSICS -#endif - -#ifdef MICRIUM - - #include "stdlib.h" - #include "net_cfg.h" - #include "ssl_cfg.h" - #include "net_secure_os.h" - - #define CYASSL_TYPES - - typedef CPU_INT08U byte; - typedef CPU_INT16U word16; - typedef CPU_INT32U word32; - - #if (NET_SECURE_MGR_CFG_WORD_SIZE == CPU_WORD_SIZE_32) - #define SIZEOF_LONG 4 - #undef SIZEOF_LONG_LONG - #else - #undef SIZEOF_LONG - #define SIZEOF_LONG_LONG 8 - #endif - - #define STRING_USER - - #define XSTRLEN(pstr) ((CPU_SIZE_T)Str_Len((CPU_CHAR *)(pstr))) - #define XSTRNCPY(pstr_dest, pstr_src, len_max) \ - ((CPU_CHAR *)Str_Copy_N((CPU_CHAR *)(pstr_dest), \ - (CPU_CHAR *)(pstr_src), (CPU_SIZE_T)(len_max))) - #define XSTRNCMP(pstr_1, pstr_2, len_max) \ - ((CPU_INT16S)Str_Cmp_N((CPU_CHAR *)(pstr_1), \ - (CPU_CHAR *)(pstr_2), (CPU_SIZE_T)(len_max))) - #define XSTRSTR(pstr, pstr_srch) \ - ((CPU_CHAR *)Str_Str((CPU_CHAR *)(pstr), \ - (CPU_CHAR *)(pstr_srch))) - #define XMEMSET(pmem, data_val, size) \ - ((void)Mem_Set((void *)(pmem), (CPU_INT08U) (data_val), \ - (CPU_SIZE_T)(size))) - #define XMEMCPY(pdest, psrc, size) ((void)Mem_Copy((void *)(pdest), \ - (void *)(psrc), (CPU_SIZE_T)(size))) - #define XMEMCMP(pmem_1, pmem_2, size) \ - (((CPU_BOOLEAN)Mem_Cmp((void *)(pmem_1), (void *)(pmem_2), \ - (CPU_SIZE_T)(size))) ? DEF_NO : DEF_YES) - #define XMEMMOVE XMEMCPY - -#if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED) - #define MICRIUM_MALLOC - #define XMALLOC(s, h, type) ((void *)NetSecure_BlkGet((CPU_INT08U)(type), \ - (CPU_SIZE_T)(s), (void *)0)) - #define XFREE(p, h, type) (NetSecure_BlkFree((CPU_INT08U)(type), \ - (p), (void *)0)) - #define XREALLOC(p, n, h, t) realloc((p), (n)) -#endif - - #if (NET_SECURE_MGR_CFG_FS_EN == DEF_ENABLED) - #undef NO_FILESYSTEM - #else - #define NO_FILESYSTEM - #endif - - #if (SSL_CFG_TRACE_LEVEL == CYASSL_TRACE_LEVEL_DBG) - #define DEBUG_CYASSL - #else - #undef DEBUG_CYASSL - #endif - - #if (SSL_CFG_OPENSSL_EN == DEF_ENABLED) - #define OPENSSL_EXTRA - #else - #undef OPENSSL_EXTRA - #endif - - #if (SSL_CFG_MULTI_THREAD_EN == DEF_ENABLED) - #undef SINGLE_THREADED - #else - #define SINGLE_THREADED - #endif - - #if (SSL_CFG_DH_EN == DEF_ENABLED) - #undef NO_DH - #else - #define NO_DH - #endif - - #if (SSL_CFG_DSA_EN == DEF_ENABLED) - #undef NO_DSA - #else - #define NO_DSA - #endif - - #if (SSL_CFG_PSK_EN == DEF_ENABLED) - #undef NO_PSK - #else - #define NO_PSK - #endif - - #if (SSL_CFG_3DES_EN == DEF_ENABLED) - #undef NO_DES - #else - #define NO_DES - #endif - - #if (SSL_CFG_AES_EN == DEF_ENABLED) - #undef NO_AES - #else - #define NO_AES - #endif - - #if (SSL_CFG_RC4_EN == DEF_ENABLED) - #undef NO_RC4 - #else - #define NO_RC4 - #endif - - #if (SSL_CFG_RABBIT_EN == DEF_ENABLED) - #undef NO_RABBIT - #else - #define NO_RABBIT - #endif - - #if (SSL_CFG_HC128_EN == DEF_ENABLED) - #undef NO_HC128 - #else - #define NO_HC128 - #endif - - #if (CPU_CFG_ENDIAN_TYPE == CPU_ENDIAN_TYPE_BIG) - #define BIG_ENDIAN_ORDER - #else - #undef BIG_ENDIAN_ORDER - #define LITTLE_ENDIAN_ORDER - #endif - - #if (SSL_CFG_MD4_EN == DEF_ENABLED) - #undef NO_MD4 - #else - #define NO_MD4 - #endif - - #if (SSL_CFG_WRITEV_EN == DEF_ENABLED) - #undef NO_WRITEV - #else - #define NO_WRITEV - #endif - - #if (SSL_CFG_USER_RNG_SEED_EN == DEF_ENABLED) - #define NO_DEV_RANDOM - #else - #undef NO_DEV_RANDOM - #endif - - #if (SSL_CFG_USER_IO_EN == DEF_ENABLED) - #define CYASSL_USER_IO - #else - #undef CYASSL_USER_IO - #endif - - #if (SSL_CFG_DYNAMIC_BUFFERS_EN == DEF_ENABLED) - #undef LARGE_STATIC_BUFFERS - #undef STATIC_CHUNKS_ONLY - #else - #define LARGE_STATIC_BUFFERS - #define STATIC_CHUNKS_ONLY - #endif - - #if (SSL_CFG_DER_LOAD_EN == DEF_ENABLED) - #define CYASSL_DER_LOAD - #else - #undef CYASSL_DER_LOAD - #endif - - #if (SSL_CFG_DTLS_EN == DEF_ENABLED) - #define CYASSL_DTLS - #else - #undef CYASSL_DTLS - #endif - - #if (SSL_CFG_CALLBACKS_EN == DEF_ENABLED) - #define CYASSL_CALLBACKS - #else - #undef CYASSL_CALLBACKS - #endif - - #if (SSL_CFG_FAST_MATH_EN == DEF_ENABLED) - #define USE_FAST_MATH - #else - #undef USE_FAST_MATH - #endif - - #if (SSL_CFG_TFM_TIMING_RESISTANT_EN == DEF_ENABLED) - #define TFM_TIMING_RESISTANT - #else - #undef TFM_TIMING_RESISTANT - #endif - -#endif /* MICRIUM */ - - -#ifdef CYASSL_QL - #ifndef CYASSL_SEP - #define CYASSL_SEP - #endif - #ifndef OPENSSL_EXTRA - #define OPENSSL_EXTRA - #endif - #ifndef SESSION_CERTS - #define SESSION_CERTS - #endif - #ifndef HAVE_AESCCM - #define HAVE_AESCCM - #endif - #ifndef ATOMIC_USER - #define ATOMIC_USER - #endif - #ifndef CYASSL_DER_LOAD - #define CYASSL_DER_LOAD - #endif - #ifndef KEEP_PEER_CERT - #define KEEP_PEER_CERT - #endif - #ifndef HAVE_ECC - #define HAVE_ECC - #endif - #ifndef SESSION_INDEX - #define SESSION_INDEX - #endif -#endif /* CYASSL_QL */ - - -#if !defined(XMALLOC_USER) && !defined(MICRIUM_MALLOC) && \ - !defined(CYASSL_LEANPSK) && !defined(NO_CYASSL_MEMORY) - #define USE_CYASSL_MEMORY -#endif - - -#if defined(OPENSSL_EXTRA) && !defined(NO_CERTS) - #undef KEEP_PEER_CERT - #define KEEP_PEER_CERT -#endif - - -/* stream ciphers except arc4 need 32bit alignment, intel ok without */ -#ifndef XSTREAM_ALIGNMENT - #if defined(__x86_64__) || defined(__ia64__) || defined(__i386__) - #define NO_XSTREAM_ALIGNMENT - #else - #define XSTREAM_ALIGNMENT - #endif -#endif - - -/* if using hardware crypto and have alignment requirements, specify the - requirement here. The record header of SSL/TLS will prvent easy alignment. - This hint tries to help as much as possible. */ -#ifndef CYASSL_GENERAL_ALIGNMENT - #ifdef CYASSL_AESNI - #define CYASSL_GENERAL_ALIGNMENT 16 - #elif defined(XSTREAM_ALIGNMENT) - #define CYASSL_GENERAL_ALIGNMENT 4 - #else - #define CYASSL_GENERAL_ALIGNMENT 0 - #endif -#endif - -#ifdef HAVE_CRL - /* not widely supported yet */ - #undef NO_SKID - #define NO_SKID -#endif - -/* Place any other flags or defines here */ - - -#ifdef __cplusplus - } /* extern "C" */ -#endif - - -#endif /* CTAO_CRYPT_SETTINGS_H */ - diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/benchmark.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/benchmark.c deleted file mode 100644 index faf6b7793..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/benchmark.c +++ /dev/null @@ -1,1222 +0,0 @@ -/* benchmark.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 - */ - -/* CTaoCrypt benchmark */ - -#ifdef HAVE_CONFIG_H - #include -#endif - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#ifdef HAVE_CAVIUM - #include "cavium_sysdep.h" - #include "cavium_common.h" - #include "cavium_ioctl.h" -#endif - -#if defined(CYASSL_MDK_ARM) - extern FILE * CyaSSL_fopen(const char *fname, const char *mode) ; - #define fopen CyaSSL_fopen -#endif - -#if defined(USE_CERT_BUFFERS_1024) || defined(USE_CERT_BUFFERS_2048) - /* include test cert and key buffers for use with NO_FILESYSTEM */ - #if defined(CYASSL_MDK_ARM) - #include "cert_data.h" /* use certs_test.c for initial data, - so other commands can share the data. */ - #else - #include - #endif -#endif - - -#ifdef HAVE_BLAKE2 - #include - void bench_blake2(void); -#endif - -#ifdef _MSC_VER - /* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */ - #pragma warning(disable: 4996) -#endif - -void bench_des(void); -void bench_arc4(void); -void bench_hc128(void); -void bench_rabbit(void); -void bench_aes(int); -void bench_aesgcm(void); -void bench_aesccm(void); -void bench_aesctr(void); -void bench_camellia(void); - -void bench_md5(void); -void bench_sha(void); -void bench_sha256(void); -void bench_sha512(void); -void bench_ripemd(void); - -void bench_rsa(void); -void bench_rsaKeyGen(void); -void bench_dh(void); -#ifdef HAVE_ECC -void bench_eccKeyGen(void); -void bench_eccKeyAgree(void); -#endif - -double current_time(int); - - -#ifdef HAVE_CAVIUM - -static int OpenNitroxDevice(int dma_mode,int dev_id) -{ - Csp1CoreAssignment core_assign; - Uint32 device; - - if (CspInitialize(CAVIUM_DIRECT,CAVIUM_DEV_ID)) - return -1; - if (Csp1GetDevType(&device)) - return -1; - if (device != NPX_DEVICE) { - if (ioctl(gpkpdev_hdlr[CAVIUM_DEV_ID], IOCTL_CSP1_GET_CORE_ASSIGNMENT, - (Uint32 *)&core_assign)!= 0) - return -1; - } - CspShutdown(CAVIUM_DEV_ID); - - return CspInitialize(dma_mode, dev_id); -} - -#endif - - -/* so embedded projects can pull in tests on their own */ -#if !defined(NO_MAIN_DRIVER) - -int main(int argc, char** argv) - -{ - (void)argc; - (void)argv; -#else -int benchmark_test(void *args) -{ -#endif - - #ifdef HAVE_CAVIUM - int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); - if (ret != 0) { - printf("Cavium OpenNitroxDevice failed\n"); - exit(-1); - } -#endif /* HAVE_CAVIUM */ -#ifndef NO_AES - bench_aes(0); - bench_aes(1); -#endif -#ifdef HAVE_AESGCM - bench_aesgcm(); -#endif - -#ifdef CYASSL_AES_COUNTER - bench_aesctr(); -#endif - -#ifdef HAVE_AESCCM - bench_aesccm(); -#endif -#ifdef HAVE_CAMELLIA - bench_camellia(); -#endif -#ifndef NO_RC4 - bench_arc4(); -#endif -#ifdef HAVE_HC128 - bench_hc128(); -#endif -#ifndef NO_RABBIT - bench_rabbit(); -#endif -#ifndef NO_DES3 - bench_des(); -#endif - - printf("\n"); - -#ifndef NO_MD5 - bench_md5(); -#endif -#ifndef NO_SHA - bench_sha(); -#endif -#ifndef NO_SHA256 - bench_sha256(); -#endif -#ifdef CYASSL_SHA512 - bench_sha512(); -#endif -#ifdef CYASSL_RIPEMD - bench_ripemd(); -#endif -#ifdef HAVE_BLAKE2 - bench_blake2(); -#endif - - printf("\n"); - -#ifndef NO_RSA - bench_rsa(); -#endif - -#ifndef NO_DH - bench_dh(); -#endif - -#if defined(CYASSL_KEY_GEN) && !defined(NO_RSA) - bench_rsaKeyGen(); -#endif - -#ifdef HAVE_ECC - bench_eccKeyGen(); - bench_eccKeyAgree(); -#endif - - return 0; -} - - -#ifdef BENCH_EMBEDDED -enum BenchmarkBounds { - numBlocks = 25, /* how many kB to test (en/de)cryption */ - ntimes = 1, - genTimes = 5, /* public key iterations */ - agreeTimes = 5 -}; -static const char blockType[] = "kB"; /* used in printf output */ -#else -enum BenchmarkBounds { - numBlocks = 5, /* how many megs to test (en/de)cryption */ - ntimes = 100, - genTimes = 100, - agreeTimes = 100 -}; -static const char blockType[] = "megs"; /* used in printf output */ -#endif - -static const byte key[] = -{ - 0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef, - 0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10, - 0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67 -}; - -static const byte iv[] = -{ - 0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef, - 0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, - 0x11,0x21,0x31,0x41,0x51,0x61,0x71,0x81 - -}; - - -/* use kB instead of mB for embedded benchmarking */ -#ifdef BENCH_EMBEDDED -static byte plain [1024]; -static byte cipher[1024]; -#else -static byte plain [1024*1024]; -static byte cipher[1024*1024]; -#endif - - -#ifndef NO_AES -void bench_aes(int show) -{ - Aes enc; - double start, total, persec; - int i; - int ret; - -#ifdef HAVE_CAVIUM - if (AesInitCavium(&enc, CAVIUM_DEV_ID) != 0) { - printf("aes init cavium failed\n"); - return; - } -#endif - - ret = AesSetKey(&enc, key, 16, iv, AES_ENCRYPTION); - if (ret != 0) { - printf("AesSetKey failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - AesCbcEncrypt(&enc, plain, cipher, sizeof(plain)); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - if (show) - printf("AES %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -#ifdef HAVE_CAVIUM - AesFreeCavium(&enc); -#endif -} -#endif - - -#if defined(HAVE_AESGCM) || defined(HAVE_AESCCM) - static byte additional[13]; - static byte tag[16]; -#endif - - -#ifdef HAVE_AESGCM -void bench_aesgcm(void) -{ - Aes enc; - double start, total, persec; - int i; - - AesGcmSetKey(&enc, key, 16); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - AesGcmEncrypt(&enc, cipher, plain, sizeof(plain), iv, 12, - tag, 16, additional, 13); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("AES-GCM %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - -#ifdef CYASSL_AES_COUNTER -void bench_aesctr(void) -{ - Aes enc; - double start, total, persec; - int i; - - AesSetKeyDirect(&enc, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - AesCtrEncrypt(&enc, plain, cipher, sizeof(plain)); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("AES-CTR %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - - -#ifdef HAVE_AESCCM -void bench_aesccm(void) -{ - Aes enc; - double start, total, persec; - int i; - - AesCcmSetKey(&enc, key, 16); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - AesCcmEncrypt(&enc, cipher, plain, sizeof(plain), iv, 12, - tag, 16, additional, 13); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("AES-CCM %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - -#ifdef HAVE_CAMELLIA -void bench_camellia(void) -{ - Camellia cam; - double start, total, persec; - int i, ret; - - ret = CamelliaSetKey(&cam, key, 16, iv); - if (ret != 0) { - printf("CamelliaSetKey failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - CamelliaCbcEncrypt(&cam, plain, cipher, sizeof(plain)); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("Camellia %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - -#ifndef NO_DES3 -void bench_des(void) -{ - Des3 enc; - double start, total, persec; - int i, ret; - -#ifdef HAVE_CAVIUM - if (Des3_InitCavium(&enc, CAVIUM_DEV_ID) != 0) - printf("des3 init cavium failed\n"); -#endif - ret = Des3_SetKey(&enc, key, iv, DES_ENCRYPTION); - if (ret != 0) { - printf("Des3_SetKey failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - Des3_CbcEncrypt(&enc, plain, cipher, sizeof(plain)); - - total = current_time(0) - start; - - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("3DES %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -#ifdef HAVE_CAVIUM - Des3_FreeCavium(&enc); -#endif -} -#endif - - -#ifndef NO_RC4 -void bench_arc4(void) -{ - Arc4 enc; - double start, total, persec; - int i; - -#ifdef HAVE_CAVIUM - if (Arc4InitCavium(&enc, CAVIUM_DEV_ID) != 0) - printf("arc4 init cavium failed\n"); -#endif - - Arc4SetKey(&enc, key, 16); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - Arc4Process(&enc, cipher, plain, sizeof(plain)); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("ARC4 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -#ifdef HAVE_CAVIUM - Arc4FreeCavium(&enc); -#endif -} -#endif - - -#ifdef HAVE_HC128 -void bench_hc128(void) -{ - HC128 enc; - double start, total, persec; - int i; - - Hc128_SetKey(&enc, key, iv); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - Hc128_Process(&enc, cipher, plain, sizeof(plain)); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("HC128 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif /* HAVE_HC128 */ - - -#ifndef NO_RABBIT -void bench_rabbit(void) -{ - Rabbit enc; - double start, total, persec; - int i; - - RabbitSetKey(&enc, key, iv); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - RabbitProcess(&enc, cipher, plain, sizeof(plain)); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("RABBIT %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif /* NO_RABBIT */ - - -#ifndef NO_MD5 -void bench_md5(void) -{ - Md5 hash; - byte digest[MD5_DIGEST_SIZE]; - double start, total, persec; - int i; - - InitMd5(&hash); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - Md5Update(&hash, plain, sizeof(plain)); - - Md5Final(&hash, digest); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("MD5 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif /* NO_MD5 */ - - -#ifndef NO_SHA -void bench_sha(void) -{ - Sha hash; - byte digest[SHA_DIGEST_SIZE]; - double start, total, persec; - int i, ret; - - ret = InitSha(&hash); - if (ret != 0) { - printf("InitSha failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - ShaUpdate(&hash, plain, sizeof(plain)); - - ShaFinal(&hash, digest); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("SHA %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif /* NO_SHA */ - - -#ifndef NO_SHA256 -void bench_sha256(void) -{ - Sha256 hash; - byte digest[SHA256_DIGEST_SIZE]; - double start, total, persec; - int i, ret; - - ret = InitSha256(&hash); - if (ret != 0) { - printf("InitSha256 failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) { - ret = Sha256Update(&hash, plain, sizeof(plain)); - if (ret != 0) { - printf("Sha256Update failed, ret = %d\n", ret); - return; - } - } - - ret = Sha256Final(&hash, digest); - if (ret != 0) { - printf("Sha256Final failed, ret = %d\n", ret); - return; - } - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("SHA-256 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - -#ifdef CYASSL_SHA512 -void bench_sha512(void) -{ - Sha512 hash; - byte digest[SHA512_DIGEST_SIZE]; - double start, total, persec; - int i, ret; - - ret = InitSha512(&hash); - if (ret != 0) { - printf("InitSha512 failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) { - ret = Sha512Update(&hash, plain, sizeof(plain)); - if (ret != 0) { - printf("Sha512Update failed, ret = %d\n", ret); - return; - } - } - - ret = Sha512Final(&hash, digest); - if (ret != 0) { - printf("Sha512Final failed, ret = %d\n", ret); - return; - } - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("SHA-512 %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - -#ifdef CYASSL_RIPEMD -void bench_ripemd(void) -{ - RipeMd hash; - byte digest[RIPEMD_DIGEST_SIZE]; - double start, total, persec; - int i; - - InitRipeMd(&hash); - start = current_time(1); - - for(i = 0; i < numBlocks; i++) - RipeMdUpdate(&hash, plain, sizeof(plain)); - - RipeMdFinal(&hash, digest); - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("RIPEMD %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - -#ifdef HAVE_BLAKE2 -void bench_blake2(void) -{ - Blake2b b2b; - byte digest[64]; - double start, total, persec; - int i, ret; - - ret = InitBlake2b(&b2b, 64); - if (ret != 0) { - printf("InitBlake2b failed, ret = %d\n", ret); - return; - } - start = current_time(1); - - for(i = 0; i < numBlocks; i++) { - ret = Blake2bUpdate(&b2b, plain, sizeof(plain)); - if (ret != 0) { - printf("Blake2bUpdate failed, ret = %d\n", ret); - return; - } - } - - ret = Blake2bFinal(&b2b, digest, 64); - if (ret != 0) { - printf("Blake2bFinal failed, ret = %d\n", ret); - return; - } - - total = current_time(0) - start; - persec = 1 / total * numBlocks; -#ifdef BENCH_EMBEDDED - /* since using kB, convert to MB/s */ - persec = persec / 1024; -#endif - - printf("BLAKE2b %d %s took %5.3f seconds, %7.3f MB/s\n", numBlocks, - blockType, total, persec); -} -#endif - - -#if !defined(NO_RSA) || !defined(NO_DH) \ - || defined(CYASSL_KEYGEN) || defined(HAVE_ECC) -static WC_RNG rng; -#endif - -#ifndef NO_RSA - - -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) && \ - defined(CYASSL_MDK_SHELL) -static char *certRSAname = "certs/rsa2048.der" ; -static void set_Bench_RSA_File(char * cert) { certRSAname = cert ; } - /* set by shell command */ -#elif defined(CYASSL_MDK_SHELL) - /* nothing */ -#else -static const char *certRSAname = "certs/rsa2048.der" ; -#endif - -void bench_rsa(void) -{ - int i; - int ret; - byte tmp[3072]; - size_t bytes; - word32 idx = 0; - - byte message[] = "Everyone gets Friday off."; - byte enc[512]; /* for up to 4096 bit */ - const int len = (int)strlen((char*)message); - double start, total, each, milliEach; - - RsaKey rsaKey; - int rsaKeySz = 2048; /* used in printf */ - -#ifdef USE_CERT_BUFFERS_1024 - XMEMCPY(tmp, rsa_key_der_1024, sizeof_rsa_key_der_1024); - bytes = sizeof_rsa_key_der_1024; - rsaKeySz = 1024; -#elif defined(USE_CERT_BUFFERS_2048) - XMEMCPY(tmp, rsa_key_der_2048, sizeof_rsa_key_der_2048); - bytes = sizeof_rsa_key_der_2048; -#else - FILE* file = fopen(certRSAname, "rb"); - - if (!file) { - printf("can't find %s, Please run from CyaSSL home dir\n", certRSAname); - return; - } - - bytes = fread(tmp, 1, sizeof(tmp), file); - fclose(file); -#endif /* USE_CERT_BUFFERS */ - - -#ifdef HAVE_CAVIUM - if (RsaInitCavium(&rsaKey, CAVIUM_DEV_ID) != 0) - printf("RSA init cavium failed\n"); -#endif - ret = InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } - ret = InitRsaKey(&rsaKey, 0); - if (ret < 0) { - printf("InitRsaKey failed\n"); - return; - } - ret = RsaPrivateKeyDecode(tmp, &idx, &rsaKey, (word32)bytes); - - start = current_time(1); - - for (i = 0; i < ntimes; i++) - ret = RsaPublicEncrypt(message,len,enc,sizeof(enc), &rsaKey, &rng); - - total = current_time(0) - start; - each = total / ntimes; /* per second */ - milliEach = each * 1000; /* milliseconds */ - - printf("RSA %d encryption took %6.3f milliseconds, avg over %d" - " iterations\n", rsaKeySz, milliEach, ntimes); - - if (ret < 0) { - printf("Rsa Public Encrypt failed\n"); - return; - } - - start = current_time(1); - - for (i = 0; i < ntimes; i++) { - byte out[512]; /* for up to 4096 bit */ - RsaPrivateDecrypt(enc, (word32)ret, out, sizeof(out), &rsaKey); - } - - total = current_time(0) - start; - each = total / ntimes; /* per second */ - milliEach = each * 1000; /* milliseconds */ - - printf("RSA %d decryption took %6.3f milliseconds, avg over %d" - " iterations\n", rsaKeySz, milliEach, ntimes); - - FreeRsaKey(&rsaKey); -#ifdef HAVE_CAVIUM - RsaFreeCavium(&rsaKey); -#endif -} -#endif - - -#ifndef NO_DH - - -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) && \ - defined(CYASSL_MDK_SHELL) -static char *certDHname = "certs/dh2048.der" ; -void set_Bench_DH_File(char * cert) { certDHname = cert ; } - /* set by shell command */ -#elif defined(CYASSL_MDK_SHELL) - /* nothing */ -#else -static const char *certDHname = "certs/dh2048.der" ; -#endif - -void bench_dh(void) -{ - int i, ret; - byte tmp[1024]; - size_t bytes; - word32 idx = 0, pubSz, privSz = 0, pubSz2, privSz2, agreeSz; - - byte pub[256]; /* for 2048 bit */ - byte priv[256]; /* for 2048 bit */ - byte pub2[256]; /* for 2048 bit */ - byte priv2[256]; /* for 2048 bit */ - byte agree[256]; /* for 2048 bit */ - - double start, total, each, milliEach; - DhKey dhKey; - int dhKeySz = 2048; /* used in printf */ - - -#ifdef USE_CERT_BUFFERS_1024 - XMEMCPY(tmp, dh_key_der_1024, sizeof_dh_key_der_1024); - bytes = sizeof_dh_key_der_1024; - dhKeySz = 1024; -#elif defined(USE_CERT_BUFFERS_2048) - XMEMCPY(tmp, dh_key_der_2048, sizeof_dh_key_der_2048); - bytes = sizeof_dh_key_der_2048; -#else - FILE* file = fopen(certDHname, "rb"); - - if (!file) { - printf("can't find %s, Please run from CyaSSL home dir\n", certDHname); - return; - } - - ret = InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } - bytes = fread(tmp, 1, sizeof(tmp), file); -#endif /* USE_CERT_BUFFERS */ - - - InitDhKey(&dhKey); - bytes = DhKeyDecode(tmp, &idx, &dhKey, (word32)bytes); - if (bytes != 0) { - printf("dhekydecode failed, can't benchmark\n"); - #if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) - fclose(file); - #endif - return; - } - - start = current_time(1); - - for (i = 0; i < ntimes; i++) - DhGenerateKeyPair(&dhKey, &rng, priv, &privSz, pub, &pubSz); - - total = current_time(0) - start; - each = total / ntimes; /* per second */ - milliEach = each * 1000; /* milliseconds */ - - printf("DH %d key generation %6.3f milliseconds, avg over %d" - " iterations\n", dhKeySz, milliEach, ntimes); - - DhGenerateKeyPair(&dhKey, &rng, priv2, &privSz2, pub2, &pubSz2); - start = current_time(1); - - for (i = 0; i < ntimes; i++) - DhAgree(&dhKey, agree, &agreeSz, priv, privSz, pub2, pubSz2); - - total = current_time(0) - start; - each = total / ntimes; /* per second */ - milliEach = each * 1000; /* milliseconds */ - - printf("DH %d key agreement %6.3f milliseconds, avg over %d" - " iterations\n", dhKeySz, milliEach, ntimes); - -#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048) - fclose(file); -#endif - FreeDhKey(&dhKey); -} -#endif - -#if defined(CYASSL_KEY_GEN) && !defined(NO_RSA) -void bench_rsaKeyGen(void) -{ - RsaKey genKey; - double start, total, each, milliEach; - int i; - - /* 1024 bit */ - start = current_time(1); - - for(i = 0; i < genTimes; i++) { - InitRsaKey(&genKey, 0); - MakeRsaKey(&genKey, 1024, 65537, &rng); - FreeRsaKey(&genKey); - } - - total = current_time(0) - start; - each = total / genTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("\n"); - printf("RSA 1024 key generation %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, genTimes); - - /* 2048 bit */ - start = current_time(1); - - for(i = 0; i < genTimes; i++) { - InitRsaKey(&genKey, 0); - MakeRsaKey(&genKey, 2048, 65537, &rng); - FreeRsaKey(&genKey); - } - - total = current_time(0) - start; - each = total / genTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("RSA 2048 key generation %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, genTimes); -} -#endif /* CYASSL_KEY_GEN */ - -#ifdef HAVE_ECC -void bench_eccKeyGen(void) -{ - ecc_key genKey; - double start, total, each, milliEach; - int i, ret; - - ret = InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } - /* 256 bit */ - start = current_time(1); - - for(i = 0; i < genTimes; i++) { - ecc_make_key(&rng, 32, &genKey); - ecc_free(&genKey); - } - - total = current_time(0) - start; - each = total / genTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("\n"); - printf("ECC 256 key generation %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, genTimes); -} - - -void bench_eccKeyAgree(void) -{ - ecc_key genKey, genKey2; - double start, total, each, milliEach; - int i, ret; - byte shared[1024]; - byte sig[1024]; - byte digest[32]; - word32 x = 0; - - ecc_init(&genKey); - ecc_init(&genKey2); - - ret = InitRng(&rng); - if (ret < 0) { - printf("InitRNG failed\n"); - return; - } - - ret = ecc_make_key(&rng, 32, &genKey); - if (ret != 0) { - printf("ecc_make_key failed\n"); - return; - } - ret = ecc_make_key(&rng, 32, &genKey2); - if (ret != 0) { - printf("ecc_make_key failed\n"); - return; - } - - /* 256 bit */ - start = current_time(1); - - for(i = 0; i < agreeTimes; i++) { - x = sizeof(shared); - ret = ecc_shared_secret(&genKey, &genKey2, shared, &x); - if (ret != 0) { - printf("ecc_shared_secret failed\n"); - return; - } - } - - total = current_time(0) - start; - each = total / agreeTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("EC-DHE key agreement %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, agreeTimes); - - /* make dummy digest */ - for (i = 0; i < (int)sizeof(digest); i++) - digest[i] = (byte)i; - - - start = current_time(1); - - for(i = 0; i < agreeTimes; i++) { - x = sizeof(sig); - ret = ecc_sign_hash(digest, sizeof(digest), sig, &x, &rng, &genKey); - if (ret != 0) { - printf("ecc_sign_hash failed\n"); - return; - } - } - - total = current_time(0) - start; - each = total / agreeTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("EC-DSA sign time %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, agreeTimes); - - start = current_time(1); - - for(i = 0; i < agreeTimes; i++) { - int verify = 0; - ret = ecc_verify_hash(sig, x, digest, sizeof(digest), &verify, &genKey); - if (ret != 0) { - printf("ecc_verify_hash failed\n"); - return; - } - } - - total = current_time(0) - start; - each = total / agreeTimes; /* per second */ - milliEach = each * 1000; /* millisconds */ - printf("EC-DSA verify time %6.3f milliseconds, avg over %d" - " iterations\n", milliEach, agreeTimes); - - ecc_free(&genKey2); - ecc_free(&genKey); -} -#endif /* HAVE_ECC */ - - -#ifdef _WIN32 - - #define WIN32_LEAN_AND_MEAN - #include - - double current_time(int reset) - { - static int init = 0; - static LARGE_INTEGER freq; - - LARGE_INTEGER count; - - (void)reset; - - if (!init) { - QueryPerformanceFrequency(&freq); - init = 1; - } - - QueryPerformanceCounter(&count); - - return (double)count.QuadPart / freq.QuadPart; - } - -#elif defined MICROCHIP_PIC32 - #if defined(CYASSL_MICROCHIP_PIC32MZ) - #define CLOCK 8000000.0 - #else - #include - #define CLOCK 4000000.0 - #endif - - double current_time(int reset) - { - unsigned int ns; - - if (reset) { - WriteCoreTimer(0); - } - - /* get timer in ns */ - ns = ReadCoreTimer(); - - /* return seconds as a double */ - return ( ns / CLOCK * 2.0); - } - -#elif defined CYASSL_MDK_ARM - - extern double current_time(int reset) ; - -#elif defined FREERTOS - - double current_time(int reset) - { - (void) reset; - - portTickType tickCount; - - /* tick count == ms, if configTICK_RATE_HZ is set to 1000 */ - tickCount = xTaskGetTickCount(); - return (double)tickCount / 1000; - } - -#else - - #include - - double current_time(int reset) - { - struct timeval tv; - - (void)reset; - - gettimeofday(&tv, 0); - - return (double)tv.tv_sec + (double)tv.tv_usec / 1000000; - } - -#endif /* _WIN32 */ diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/cert_data.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/cert_data.c deleted file mode 100644 index d6cef016d..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/cert_data.c +++ /dev/null @@ -1,28 +0,0 @@ -/* certs_test.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 -#endif - -/* Define initial data for cert buffers */ -#include - diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/client.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/client.c deleted file mode 100644 index bc898cb59..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/client.c +++ /dev/null @@ -1,858 +0,0 @@ -/* client.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 -#endif - #define CYASSL_MDK_ARM -#if defined(CYASSL_MDK_ARM) - #include - #include - - #if defined(CYASSL_MDK5) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #endif - - #include "cyassl_MDK_ARM.h" -#endif - -#include - -#if !defined(CYASSL_TRACK_MEMORY) && !defined(NO_MAIN_DRIVER) - /* in case memory tracker wants stats */ - #define CYASSL_TRACK_MEMORY -#endif - -#include -#include -#include "examples/client/client.h" - - -#ifdef CYASSL_CALLBACKS - int handShakeCB(HandShakeInfo*); - int timeoutCB(TimeoutInfo*); - Timeval timeout; -#endif - - -static void NonBlockingSSL_Connect(CYASSL* ssl) -{ -#ifndef CYASSL_CALLBACKS - int ret = CyaSSL_connect(ssl); -#else - int ret = CyaSSL_connect_ex(ssl, handShakeCB, timeoutCB, timeout); -#endif - int error = CyaSSL_get_error(ssl, 0); - SOCKET_T sockfd = (SOCKET_T)CyaSSL_get_fd(ssl); - int select_ret; - - while (ret != SSL_SUCCESS && (error == SSL_ERROR_WANT_READ || - error == SSL_ERROR_WANT_WRITE)) { - int currTimeout = 1; - - if (error == SSL_ERROR_WANT_READ) - printf("... client would read block\n"); - else - printf("... client would write block\n"); - -#ifdef CYASSL_DTLS - currTimeout = CyaSSL_dtls_get_current_timeout(ssl); -#endif - select_ret = tcp_select(sockfd, currTimeout); - - if ((select_ret == TEST_RECV_READY) || - (select_ret == TEST_ERROR_READY)) { - #ifndef CYASSL_CALLBACKS - ret = CyaSSL_connect(ssl); - #else - ret = CyaSSL_connect_ex(ssl,handShakeCB,timeoutCB,timeout); - #endif - error = CyaSSL_get_error(ssl, 0); - } - else if (select_ret == TEST_TIMEOUT && !CyaSSL_dtls(ssl)) { - error = SSL_ERROR_WANT_READ; - } -#ifdef CYASSL_DTLS - else if (select_ret == TEST_TIMEOUT && CyaSSL_dtls(ssl) && - CyaSSL_dtls_got_timeout(ssl) >= 0) { - error = SSL_ERROR_WANT_READ; - } -#endif - else { - error = SSL_FATAL_ERROR; - } - } - if (ret != SSL_SUCCESS) - err_sys("SSL_connect failed"); -} - - -static void Usage(void) -{ - printf("client " LIBCYASSL_VERSION_STRING - " NOTE: All files relative to CyaSSL home dir\n"); - printf("-? Help, print this usage\n"); - printf("-h Host to connect to, default %s\n", yasslIP); - printf("-p Port to connect on, not 0, default %d\n", yasslPort); - printf("-v SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n", - CLIENT_DEFAULT_VERSION); - printf("-l Cipher list\n"); - printf("-c Certificate file, default %s\n", cliCert); - printf("-k Key file, default %s\n", cliKey); - printf("-A Certificate Authority file, default %s\n", caCert); - printf("-b Benchmark connections and print stats\n"); - printf("-s Use pre Shared keys\n"); - printf("-t Track CyaSSL memory use\n"); - printf("-d Disable peer checks\n"); - printf("-g Send server HTTP GET\n"); - printf("-u Use UDP DTLS," - " add -v 2 for DTLSv1 (default), -v 3 for DTLSv1.2\n"); - printf("-m Match domain name in cert\n"); - printf("-N Use Non-blocking sockets\n"); - printf("-r Resume session\n"); - printf("-f Fewer packets/group messages\n"); - printf("-x Disable client cert/key loading\n"); -#ifdef SHOW_SIZES - printf("-z Print structure sizes\n"); -#endif -#ifdef HAVE_SNI - printf("-S Use Host Name Indication\n"); -#endif -#ifdef HAVE_MAX_FRAGMENT - printf("-L Use Maximum Fragment Length [1-5]\n"); -#endif -#ifdef HAVE_TRUNCATED_HMAC - printf("-T Use Truncated HMAC\n"); -#endif -#ifdef HAVE_OCSP - printf("-o Perform OCSP lookup on peer certificate\n"); - printf("-O Perform OCSP lookup using as responder\n"); -#endif -#ifdef ATOMIC_USER - printf("-U Atomic User Record Layer Callbacks\n"); -#endif -#ifdef HAVE_PK_CALLBACKS - printf("-P Public Key Callbacks\n"); -#endif -} - - -#ifdef CYASSL_MDK_SHELL - #define exit(code) return(code) -#endif - - -THREAD_RETURN CYASSL_THREAD client_test(void* args) -{ - SOCKET_T sockfd = 0; - - CYASSL_METHOD* method = 0; - CYASSL_CTX* ctx = 0; - CYASSL* ssl = 0; - - CYASSL* sslResume = 0; - CYASSL_SESSION* session = 0; - char resumeMsg[] = "resuming cyassl!"; - int resumeSz = sizeof(resumeMsg); - - char msg[32] = "hello cyassl!"; /* GET may make bigger */ - char reply[80]; - int input; - int msgSz = (int)strlen(msg); - - word16 port = yasslPort; - char* host = (char*)yasslIP; - char* domain = (char*)"www.yassl.com"; - - int ch; - int version = CLIENT_INVALID_VERSION; - int usePsk = 0; - int sendGET = 0; - int benchmark = 0; - int doDTLS = 0; - int matchName = 0; - int doPeerCheck = 1; - int nonBlocking = 0; - int resumeSession = 0; - int trackMemory = 0; - int useClientCert = 1; - int fewerPackets = 0; - int atomicUser = 0; - int pkCallbacks = 0; - char* cipherList = NULL; - char* verifyCert = (char*)caCert; - char* ourCert = (char*)cliCert; - char* ourKey = (char*)cliKey; - -#ifdef HAVE_SNI - char* sniHostName = NULL; -#endif -#ifdef HAVE_MAX_FRAGMENT - byte maxFragment = 0; -#endif -#ifdef HAVE_TRUNCATED_HMAC - byte truncatedHMAC = 0; -#endif - - -#ifdef HAVE_OCSP - int useOcsp = 0; - char* ocspUrl = NULL; -#endif - - int argc = ((func_args*)args)->argc; - char** argv = ((func_args*)args)->argv; - - ((func_args*)args)->return_code = -1; /* error state */ - -#ifdef NO_RSA - verifyCert = (char*)eccCert; - ourCert = (char*)cliEccCert; - ourKey = (char*)cliEccKey; -#endif - (void)resumeSz; - (void)session; - (void)sslResume; - (void)trackMemory; - (void)atomicUser; - (void)pkCallbacks; - - StackTrap(); - - while ((ch = mygetopt(argc, argv, - "?gdusmNrtfxUPh:p:v:l:A:c:k:b:zS:L:ToO:")) != -1) { - switch (ch) { - case '?' : - Usage(); - exit(EXIT_SUCCESS); - - case 'g' : - sendGET = 1; - break; - - case 'd' : - doPeerCheck = 0; - break; - - case 'u' : - doDTLS = 1; - break; - - case 's' : - usePsk = 1; - break; - - case 't' : - #ifdef USE_CYASSL_MEMORY - trackMemory = 1; - #endif - break; - - case 'm' : - matchName = 1; - break; - - case 'x' : - useClientCert = 0; - break; - - case 'f' : - fewerPackets = 1; - break; - - case 'U' : - #ifdef ATOMIC_USER - atomicUser = 1; - #endif - break; - - case 'P' : - #ifdef HAVE_PK_CALLBACKS - pkCallbacks = 1; - #endif - break; - - case 'h' : - host = myoptarg; - domain = myoptarg; - break; - - case 'p' : - port = (word16)atoi(myoptarg); - #if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API) - if (port == 0) - err_sys("port number cannot be 0"); - #endif - break; - - case 'v' : - version = atoi(myoptarg); - if (version < 0 || version > 3) { - Usage(); - exit(MY_EX_USAGE); - } - break; - - case 'l' : - cipherList = myoptarg; - break; - - case 'A' : - verifyCert = myoptarg; - break; - - case 'c' : - ourCert = myoptarg; - break; - - case 'k' : - ourKey = myoptarg; - break; - - case 'b' : - benchmark = atoi(myoptarg); - if (benchmark < 0 || benchmark > 1000000) { - Usage(); - exit(MY_EX_USAGE); - } - break; - - case 'N' : - nonBlocking = 1; - break; - - case 'r' : - resumeSession = 1; - break; - - case 'z' : - #ifndef CYASSL_LEANPSK - CyaSSL_GetObjectSize(); - #endif - break; - - case 'S' : - #ifdef HAVE_SNI - sniHostName = myoptarg; - #endif - break; - - case 'L' : - #ifdef HAVE_MAX_FRAGMENT - maxFragment = atoi(myoptarg); - if (maxFragment < CYASSL_MFL_2_9 || - maxFragment > CYASSL_MFL_2_13) { - Usage(); - exit(MY_EX_USAGE); - } - #endif - break; - - case 'T' : - #ifdef HAVE_TRUNCATED_HMAC - truncatedHMAC = 1; - #endif - break; - - case 'o' : - #ifdef HAVE_OCSP - useOcsp = 1; - #endif - break; - - case 'O' : - #ifdef HAVE_OCSP - useOcsp = 1; - ocspUrl = myoptarg; - #endif - break; - - default: - Usage(); - exit(MY_EX_USAGE); - } - } - - myoptind = 0; /* reset for test cases */ - - /* sort out DTLS versus TLS versions */ - if (version == CLIENT_INVALID_VERSION) { - if (doDTLS) - version = CLIENT_DTLS_DEFAULT_VERSION; - else - version = CLIENT_DEFAULT_VERSION; - } - else { - if (doDTLS) { - if (version == 3) - version = -2; - else - version = -1; - } - } - -#ifdef USE_CYASSL_MEMORY - if (trackMemory) - InitMemoryTracker(); -#endif - - switch (version) { -#ifndef NO_OLD_TLS - case 0: - method = wolfSSLv3_client_method(); - break; - - - #ifndef NO_TLS - case 1: - method = CyaTLSv1_client_method(); - break; - - case 2: - method = CyaTLSv1_1_client_method(); - break; - #endif /* NO_TLS */ - -#endif /* NO_OLD_TLS */ - -#ifndef NO_TLS - case 3: - method = CyaTLSv1_2_client_method(); - break; -#endif - -#ifdef CYASSL_DTLS - case -1: - method = CyaDTLSv1_client_method(); - break; - - case -2: - method = CyaDTLSv1_2_client_method(); - break; -#endif - - default: - err_sys("Bad SSL version"); - break; - } - - if (method == NULL) - err_sys("unable to get method"); - - ctx = CyaSSL_CTX_new(method); - if (ctx == NULL) - err_sys("unable to get ctx"); - - if (cipherList) - if (CyaSSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS) - err_sys("client can't set cipher list 1"); - -#ifdef CYASSL_LEANPSK - usePsk = 1; -#endif - -#if defined(NO_RSA) && !defined(HAVE_ECC) - usePsk = 1; -#endif - - if (fewerPackets) - CyaSSL_CTX_set_group_messages(ctx); - - if (usePsk) { -#ifndef NO_PSK - CyaSSL_CTX_set_psk_client_callback(ctx, my_psk_client_cb); - if (cipherList == NULL) { - const char *defaultCipherList; - #ifdef HAVE_NULL_CIPHER - defaultCipherList = "PSK-NULL-SHA256"; - #else - defaultCipherList = "PSK-AES128-CBC-SHA256"; - #endif - if (CyaSSL_CTX_set_cipher_list(ctx,defaultCipherList) !=SSL_SUCCESS) - err_sys("client can't set cipher list 2"); - } -#endif - useClientCert = 0; - } - -#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) - CyaSSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack); -#endif - -#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC) - if (cipherList == NULL) { - /* don't use EDH, can't sniff tmp keys */ - if (CyaSSL_CTX_set_cipher_list(ctx, "AES256-SHA256") != SSL_SUCCESS) { - err_sys("client can't set cipher list 3"); - } - } -#endif - -#ifdef HAVE_OCSP - if (useOcsp) { - if (ocspUrl != NULL) { - CyaSSL_CTX_SetOCSP_OverrideURL(ctx, ocspUrl); - CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE - | CYASSL_OCSP_URL_OVERRIDE); - } - else - CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE); - } -#endif - -#ifdef USER_CA_CB - CyaSSL_CTX_SetCACb(ctx, CaCb); -#endif - -#ifdef VERIFY_CALLBACK - CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, myVerify); -#endif -#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) - if (useClientCert){ - if (CyaSSL_CTX_use_certificate_chain_file(ctx, ourCert) != SSL_SUCCESS) - err_sys("can't load client cert file, check file and run from" - " CyaSSL home dir"); - - if (CyaSSL_CTX_use_PrivateKey_file(ctx, ourKey, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load client private key file, check file and run " - "from CyaSSL home dir"); - } - - if (!usePsk) { - if (CyaSSL_CTX_load_verify_locations(ctx, verifyCert, 0) != SSL_SUCCESS) - err_sys("can't load ca file, Please run from CyaSSL home dir"); - } -#endif -#if !defined(NO_CERTS) - if (!usePsk && doPeerCheck == 0) - CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); -#endif - -#ifdef HAVE_CAVIUM - CyaSSL_CTX_UseCavium(ctx, CAVIUM_DEV_ID); -#endif - -#ifdef HAVE_SNI - if (sniHostName) - if (CyaSSL_CTX_UseSNI(ctx, 0, sniHostName, XSTRLEN(sniHostName)) - != SSL_SUCCESS) - err_sys("UseSNI failed"); -#endif -#ifdef HAVE_MAX_FRAGMENT - if (maxFragment) - if (CyaSSL_CTX_UseMaxFragment(ctx, maxFragment) != SSL_SUCCESS) - err_sys("UseMaxFragment failed"); -#endif -#ifdef HAVE_TRUNCATED_HMAC - if (truncatedHMAC) - if (CyaSSL_CTX_UseTruncatedHMAC(ctx) != SSL_SUCCESS) - err_sys("UseTruncatedHMAC failed"); -#endif - - if (benchmark) { - /* time passed in number of connects give average */ - int times = benchmark; - int i = 0; - - double start = current_time(), avg; - - for (i = 0; i < times; i++) { - tcp_connect(&sockfd, host, port, doDTLS); - - ssl = CyaSSL_new(ctx); - CyaSSL_set_fd(ssl, sockfd); - if (CyaSSL_connect(ssl) != SSL_SUCCESS) - err_sys("SSL_connect failed"); - - CyaSSL_shutdown(ssl); - CyaSSL_free(ssl); - CloseSocket(sockfd); - } - avg = current_time() - start; - avg /= times; - avg *= 1000; /* milliseconds */ - printf("CyaSSL_connect avg took: %8.3f milliseconds\n", avg); - - CyaSSL_CTX_free(ctx); - ((func_args*)args)->return_code = 0; - - exit(EXIT_SUCCESS); - } - - #if defined(CYASSL_MDK_ARM) - CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); - #endif - - ssl = CyaSSL_new(ctx); - if (ssl == NULL) - err_sys("unable to get SSL object"); - if (doDTLS) { - SOCKADDR_IN_T addr; - build_addr(&addr, host, port, 1); - CyaSSL_dtls_set_peer(ssl, &addr, sizeof(addr)); - tcp_socket(&sockfd, 1); - } - else { - tcp_connect(&sockfd, host, port, 0); - } - CyaSSL_set_fd(ssl, sockfd); -#ifdef HAVE_CRL - if (CyaSSL_EnableCRL(ssl, CYASSL_CRL_CHECKALL) != SSL_SUCCESS) - err_sys("can't enable crl check"); - if (CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, 0) != SSL_SUCCESS) - err_sys("can't load crl, check crlfile and date validity"); - if (CyaSSL_SetCRL_Cb(ssl, CRL_CallBack) != SSL_SUCCESS) - err_sys("can't set crl callback"); -#endif -#ifdef ATOMIC_USER - if (atomicUser) - SetupAtomicUser(ctx, ssl); -#endif -#ifdef HAVE_PK_CALLBACKS - if (pkCallbacks) - SetupPkCallbacks(ctx, ssl); -#endif - if (matchName && doPeerCheck) - CyaSSL_check_domain_name(ssl, domain); -#ifndef CYASSL_CALLBACKS - if (nonBlocking) { - CyaSSL_set_using_nonblock(ssl, 1); - tcp_set_nonblocking(&sockfd); - NonBlockingSSL_Connect(ssl); - } - else if (CyaSSL_connect(ssl) != SSL_SUCCESS) { - /* see note at top of README */ - int err = CyaSSL_get_error(ssl, 0); - char buffer[CYASSL_MAX_ERROR_SZ]; - printf("err = %d, %s\n", err, - CyaSSL_ERR_error_string(err, buffer)); - err_sys("SSL_connect failed"); - /* if you're getting an error here */ - } -#else - timeout.tv_sec = 2; - timeout.tv_usec = 0; - NonBlockingSSL_Connect(ssl); /* will keep retrying on timeout */ -#endif - showPeer(ssl); - - if (sendGET) { - printf("SSL connect ok, sending GET...\n"); - msgSz = 28; - strncpy(msg, "GET /index.html HTTP/1.0\r\n\r\n", msgSz); - msg[msgSz] = '\0'; - } - if (CyaSSL_write(ssl, msg, msgSz) != msgSz) - err_sys("SSL_write failed"); - - input = CyaSSL_read(ssl, reply, sizeof(reply)-1); - if (input > 0) { - reply[input] = 0; - printf("Server response: %s\n", reply); - - if (sendGET) { /* get html */ - while (1) { - input = CyaSSL_read(ssl, reply, sizeof(reply)-1); - if (input > 0) { - reply[input] = 0; - printf("%s\n", reply); - } - else - break; - } - } - } - else if (input < 0) { - int readErr = CyaSSL_get_error(ssl, 0); - if (readErr != SSL_ERROR_WANT_READ) - err_sys("CyaSSL_read failed"); - } - -#ifndef NO_SESSION_CACHE - if (resumeSession) { - if (doDTLS) { - strncpy(msg, "break", 6); - msgSz = (int)strlen(msg); - /* try to send session close */ - CyaSSL_write(ssl, msg, msgSz); - } - session = CyaSSL_get_session(ssl); - sslResume = CyaSSL_new(ctx); - } -#endif - - if (doDTLS == 0) /* don't send alert after "break" command */ - CyaSSL_shutdown(ssl); /* echoserver will interpret as new conn */ -#ifdef ATOMIC_USER - if (atomicUser) - FreeAtomicUser(ssl); -#endif - CyaSSL_free(ssl); - CloseSocket(sockfd); - -#ifndef NO_SESSION_CACHE - if (resumeSession) { - if (doDTLS) { - SOCKADDR_IN_T addr; - #ifdef USE_WINDOWS_API - Sleep(500); - #else - sleep(1); - #endif - build_addr(&addr, host, port, 1); - CyaSSL_dtls_set_peer(sslResume, &addr, sizeof(addr)); - tcp_socket(&sockfd, 1); - } - else { - tcp_connect(&sockfd, host, port, 0); - } - CyaSSL_set_fd(sslResume, sockfd); - CyaSSL_set_session(sslResume, session); - - showPeer(sslResume); -#ifndef CYASSL_CALLBACKS - if (nonBlocking) { - CyaSSL_set_using_nonblock(sslResume, 1); - tcp_set_nonblocking(&sockfd); - NonBlockingSSL_Connect(sslResume); - } - else if (CyaSSL_connect(sslResume) != SSL_SUCCESS) - err_sys("SSL resume failed"); -#else - timeout.tv_sec = 2; - timeout.tv_usec = 0; - NonBlockingSSL_Connect(ssl); /* will keep retrying on timeout */ -#endif - - if (CyaSSL_session_reused(sslResume)) - printf("reused session id\n"); - else - printf("didn't reuse session id!!!\n"); - - if (CyaSSL_write(sslResume, resumeMsg, resumeSz) != resumeSz) - err_sys("SSL_write failed"); - - if (nonBlocking) { - /* give server a chance to bounce a message back to client */ - #ifdef USE_WINDOWS_API - Sleep(500); - #else - sleep(1); - #endif - } - - input = CyaSSL_read(sslResume, reply, sizeof(reply)-1); - if (input > 0) { - reply[input] = 0; - printf("Server resume response: %s\n", reply); - } - - /* try to send session break */ - CyaSSL_write(sslResume, msg, msgSz); - - CyaSSL_shutdown(sslResume); - CyaSSL_free(sslResume); - CloseSocket(sockfd); - } -#endif /* NO_SESSION_CACHE */ - - CyaSSL_CTX_free(ctx); - - ((func_args*)args)->return_code = 0; - -#ifdef USE_CYASSL_MEMORY - if (trackMemory) - ShowMemoryTracker(); -#endif /* USE_CYASSL_MEMORY */ - - return 0; -} - - -/* so overall tests can pull in test function */ -#ifndef NO_MAIN_DRIVER - - int main(int argc, char** argv) - { - func_args args; - -#ifdef HAVE_CAVIUM - int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); - if (ret != 0) - err_sys("Cavium OpenNitroxDevice failed"); -#endif /* HAVE_CAVIUM */ - - StartTCP(); - - args.argc = argc; - args.argv = argv; - - CyaSSL_Init(); -#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL) && !defined(STACK_TRAP) - CyaSSL_Debugging_ON(); -#endif - if (CurrentDir("client")) - ChangeDirBack(2); - else if (CurrentDir("Debug") || CurrentDir("Release")) - ChangeDirBack(3); - -#ifdef HAVE_STACK_SIZE - StackSizeCheck(&args, client_test); -#else - client_test(&args); -#endif - CyaSSL_Cleanup(); - -#ifdef HAVE_CAVIUM - CspShutdown(CAVIUM_DEV_ID); -#endif - return args.return_code; - } - - int myoptind = 0; - char* myoptarg = NULL; - -#endif /* NO_MAIN_DRIVER */ - - - -#ifdef CYASSL_CALLBACKS - - int handShakeCB(HandShakeInfo* info) - { - (void)info; - return 0; - } - - - int timeoutCB(TimeoutInfo* info) - { - (void)info; - return 0; - } - -#endif - diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/echoclient.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/echoclient.c deleted file mode 100644 index 73c46ab18..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/echoclient.c +++ /dev/null @@ -1,282 +0,0 @@ -/* echoclient.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 -#endif - -#include - -#include - -#if defined(CYASSL_MDK_ARM) - #include - #include - - #if defined(CYASSL_MDK5) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #endif - - #include "cyassl_MDK_ARM.h" -#endif - -#include - -#include "examples/echoclient/echoclient.h" - -void echoclient_test(void* args) -{ - SOCKET_T sockfd = 0; - - FILE* fin = stdin ; - FILE* fout = stdout; - - int inCreated = 0; - int outCreated = 0; - - char msg[1024]; - char reply[1024+1]; - - SSL_METHOD* method = 0; - SSL_CTX* ctx = 0; - SSL* ssl = 0; - - int doDTLS = 0; - int doPSK = 0; - int sendSz; - int argc = 0; - char** argv = 0; - word16 port = yasslPort; - - ((func_args*)args)->return_code = -1; /* error state */ - -#ifndef CYASSL_MDK_SHELL - argc = ((func_args*)args)->argc; - argv = ((func_args*)args)->argv; -#endif - - if (argc >= 2) { - fin = fopen(argv[1], "r"); - inCreated = 1; - } - if (argc >= 3) { - fout = fopen(argv[2], "w"); - outCreated = 1; - } - - if (!fin) err_sys("can't open input file"); - if (!fout) err_sys("can't open output file"); - -#ifdef CYASSL_DTLS - doDTLS = 1; -#endif - -#ifdef CYASSL_LEANPSK - doPSK = 1; -#endif - -#if defined(NO_RSA) && !defined(HAVE_ECC) - doPSK = 1; -#endif - -#if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && !defined(CYASSL_MDK_SHELL) - port = ((func_args*)args)->signal->port; -#endif - -#if defined(CYASSL_DTLS) - method = DTLSv1_client_method(); -#elif !defined(NO_TLS) - method = CyaSSLv23_client_method(); -#else - method = SSLv3_client_method(); -#endif - ctx = SSL_CTX_new(method); - -#ifndef NO_FILESYSTEM - #ifndef NO_RSA - if (SSL_CTX_load_verify_locations(ctx, caCert, 0) != SSL_SUCCESS) - err_sys("can't load ca file, Please run from CyaSSL home dir"); - #endif - #ifdef HAVE_ECC - if (SSL_CTX_load_verify_locations(ctx, eccCert, 0) != SSL_SUCCESS) - err_sys("can't load ca file, Please run from CyaSSL home dir"); - #endif -#elif !defined(NO_CERTS) - if (!doPSK) - load_buffer(ctx, caCert, CYASSL_CA); -#endif - -#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC) - /* don't use EDH, can't sniff tmp keys */ - SSL_CTX_set_cipher_list(ctx, "AES256-SHA"); -#endif - if (doPSK) { -#ifndef NO_PSK - const char *defaultCipherList; - - CyaSSL_CTX_set_psk_client_callback(ctx, my_psk_client_cb); - #ifdef HAVE_NULL_CIPHER - defaultCipherList = "PSK-NULL-SHA256"; - #else - defaultCipherList = "PSK-AES128-CBC-SHA256"; - #endif - if (CyaSSL_CTX_set_cipher_list(ctx,defaultCipherList) !=SSL_SUCCESS) - err_sys("client can't set cipher list 2"); -#endif - } - -#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) - SSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack); -#endif - - #if defined(CYASSL_MDK_ARM) - CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); - #endif - - ssl = SSL_new(ctx); - - - if (doDTLS) { - SOCKADDR_IN_T addr; - build_addr(&addr, yasslIP, port, 1); - CyaSSL_dtls_set_peer(ssl, &addr, sizeof(addr)); - tcp_socket(&sockfd, 1); - } - else { - tcp_connect(&sockfd, yasslIP, port, 0); - } - - SSL_set_fd(ssl, sockfd); -#if defined(USE_WINDOWS_API) && defined(CYASSL_DTLS) && defined(NO_MAIN_DRIVER) - /* let echoserver bind first, TODO: add Windows signal like pthreads does */ - Sleep(100); -#endif - - if (SSL_connect(ssl) != SSL_SUCCESS) err_sys("SSL_connect failed"); - - while (fgets(msg, sizeof(msg), fin) != 0) { - - sendSz = (int)strlen(msg); - - if (SSL_write(ssl, msg, sendSz) != sendSz) - err_sys("SSL_write failed"); - - if (strncmp(msg, "quit", 4) == 0) { - fputs("sending server shutdown command: quit!\n", fout); - break; - } - - if (strncmp(msg, "break", 5) == 0) { - fputs("sending server session close: break!\n", fout); - break; - } - - #ifndef CYASSL_MDK_SHELL - while (sendSz) { - int got; - if ( (got = SSL_read(ssl, reply, sizeof(reply)-1)) > 0) { - reply[got] = 0; - fputs(reply, fout); - fflush(fout) ; - sendSz -= got; - } - else - break; - } - #else - { - int got; - if ( (got = SSL_read(ssl, reply, sizeof(reply)-1)) > 0) { - reply[got] = 0; - fputs(reply, fout); - fflush(fout) ; - sendSz -= got; - } - } - #endif - } - - -#ifdef CYASSL_DTLS - strncpy(msg, "break", 6); - sendSz = (int)strlen(msg); - /* try to tell server done */ - SSL_write(ssl, msg, sendSz); -#else - SSL_shutdown(ssl); -#endif - - SSL_free(ssl); - SSL_CTX_free(ctx); - - fflush(fout); - if (inCreated) fclose(fin); - if (outCreated) fclose(fout); - - CloseSocket(sockfd); - ((func_args*)args)->return_code = 0; -} - - -/* so overall tests can pull in test function */ -#ifndef NO_MAIN_DRIVER - - int main(int argc, char** argv) - { - func_args args; - -#ifdef HAVE_CAVIUM - int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); - if (ret != 0) - err_sys("Cavium OpenNitroxDevice failed"); -#endif /* HAVE_CAVIUM */ - - StartTCP(); - - args.argc = argc; - args.argv = argv; - - CyaSSL_Init(); -#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL) - CyaSSL_Debugging_ON(); -#endif - - if (CurrentDir("echoclient")) - ChangeDirBack(2); - else if (CurrentDir("Debug") || CurrentDir("Release")) - ChangeDirBack(3); - echoclient_test(&args); - - CyaSSL_Cleanup(); - -#ifdef HAVE_CAVIUM - CspShutdown(CAVIUM_DEV_ID); -#endif - return args.return_code; - } - -#endif /* NO_MAIN_DRIVER */ - - diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/echoserver.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/echoserver.c deleted file mode 100644 index 2ac1f7fdb..000000000 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/echoserver.c +++ /dev/null @@ -1,368 +0,0 @@ -/* echoserver.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 -#endif - -#include - -#if defined(CYASSL_MDK_ARM) - #include - #include - - #if defined(CYASSL_MDK5) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #endif - - #include "cyassl_MDK_ARM.h" -#endif - -#include -#include - -#ifndef NO_MAIN_DRIVER - #define ECHO_OUT -#endif - -#include "examples/echoserver/echoserver.h" - - -#ifdef SESSION_STATS - CYASSL_API void PrintSessionStats(void); -#endif - -#define SVR_COMMAND_SIZE 256 - -static void SignalReady(void* args, word16 port) -{ -#if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER) && !defined(__MINGW32__) - /* signal ready to tcp_accept */ - func_args* server_args = (func_args*)args; - tcp_ready* ready = server_args->signal; - pthread_mutex_lock(&ready->mutex); - ready->ready = 1; - ready->port = port; - pthread_cond_signal(&ready->cond); - pthread_mutex_unlock(&ready->mutex); -#endif - (void)args; - (void)port; -} - - -THREAD_RETURN CYASSL_THREAD echoserver_test(void* args) -{ - SOCKET_T sockfd = 0; - CYASSL_METHOD* method = 0; - CYASSL_CTX* ctx = 0; - - int doDTLS = 0; - int doPSK = 0; - int outCreated = 0; - int shutDown = 0; - int useAnyAddr = 0; - word16 port = yasslPort; - int argc = ((func_args*)args)->argc; - char** argv = ((func_args*)args)->argv; - -#ifdef ECHO_OUT - FILE* fout = stdout; - if (argc >= 2) { - fout = fopen(argv[1], "w"); - outCreated = 1; - } - if (!fout) err_sys("can't open output file"); -#endif - (void)outCreated; - (void)argc; - (void)argv; - - ((func_args*)args)->return_code = -1; /* error state */ - -#ifdef CYASSL_DTLS - doDTLS = 1; -#endif - -#ifdef CYASSL_LEANPSK - doPSK = 1; -#endif - -#if defined(NO_RSA) && !defined(HAVE_ECC) - doPSK = 1; -#endif - - #if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && \ - !defined(CYASSL_SNIFFER) && !defined(CYASSL_MDK_SHELL) - port = 0; - #endif - #if defined(USE_ANY_ADDR) - useAnyAddr = 1; - #endif - tcp_listen(&sockfd, &port, useAnyAddr, doDTLS); - -#if defined(CYASSL_DTLS) - method = CyaDTLSv1_server_method(); -#elif !defined(NO_TLS) - method = CyaSSLv23_server_method(); -#else - method = wolfSSLv3_server_method(); -#endif - ctx = CyaSSL_CTX_new(method); - /* CyaSSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF); */ - -#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) - CyaSSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack); -#endif - -#ifndef NO_FILESYSTEM - if (doPSK == 0) { - #ifdef HAVE_NTRU - /* ntru */ - if (CyaSSL_CTX_use_certificate_file(ctx, ntruCert, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load ntru cert file, " - "Please run from CyaSSL home dir"); - - if (CyaSSL_CTX_use_NTRUPrivateKey_file(ctx, ntruKey) - != SSL_SUCCESS) - err_sys("can't load ntru key file, " - "Please run from CyaSSL home dir"); - #elif defined(HAVE_ECC) - /* ecc */ - if (CyaSSL_CTX_use_certificate_file(ctx, eccCert, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server cert file, " - "Please run from CyaSSL home dir"); - - if (CyaSSL_CTX_use_PrivateKey_file(ctx, eccKey, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server key file, " - "Please run from CyaSSL home dir"); - #elif defined(NO_CERTS) - /* do nothing, just don't load cert files */ - #else - /* normal */ - if (CyaSSL_CTX_use_certificate_file(ctx, svrCert, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server cert file, " - "Please run from CyaSSL home dir"); - - if (CyaSSL_CTX_use_PrivateKey_file(ctx, svrKey, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server key file, " - "Please run from CyaSSL home dir"); - #endif - } /* doPSK */ -#elif !defined(NO_CERTS) - if (!doPSK) { - load_buffer(ctx, svrCert, CYASSL_CERT); - load_buffer(ctx, svrKey, CYASSL_KEY); - } -#endif - -#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC) - /* don't use EDH, can't sniff tmp keys */ - CyaSSL_CTX_set_cipher_list(ctx, "AES256-SHA"); -#endif - - if (doPSK) { -#ifndef NO_PSK - const char *defaultCipherList; - - CyaSSL_CTX_set_psk_server_callback(ctx, my_psk_server_cb); - CyaSSL_CTX_use_psk_identity_hint(ctx, "cyassl server"); - #ifdef HAVE_NULL_CIPHER - defaultCipherList = "PSK-NULL-SHA256"; - #else - defaultCipherList = "PSK-AES128-CBC-SHA256"; - #endif - if (CyaSSL_CTX_set_cipher_list(ctx, defaultCipherList) != SSL_SUCCESS) - err_sys("server can't set cipher list 2"); -#endif - } - - SignalReady(args, port); - - while (!shutDown) { - CYASSL* ssl = 0; - char command[SVR_COMMAND_SIZE+1]; - int echoSz = 0; - int clientfd; - int firstRead = 1; - int gotFirstG = 0; - -#ifndef CYASSL_DTLS - SOCKADDR_IN_T client; - socklen_t client_len = sizeof(client); - clientfd = accept(sockfd, (struct sockaddr*)&client, - (ACCEPT_THIRD_T)&client_len); -#else - clientfd = udp_read_connect(sockfd); -#endif - if (clientfd == -1) err_sys("tcp accept failed"); - - ssl = CyaSSL_new(ctx); - if (ssl == NULL) err_sys("SSL_new failed"); - CyaSSL_set_fd(ssl, clientfd); - #if !defined(NO_FILESYSTEM) && defined(OPENSSL_EXTRA) - CyaSSL_SetTmpDH_file(ssl, dhParam, SSL_FILETYPE_PEM); - #elif !defined(NO_CERTS) - SetDH(ssl); /* will repick suites with DHE, higher than PSK */ - #endif - if (CyaSSL_accept(ssl) != SSL_SUCCESS) { - printf("SSL_accept failed\n"); - CyaSSL_free(ssl); - CloseSocket(clientfd); - continue; - } -#if defined(PEER_INFO) - showPeer(ssl); -#endif - - while ( (echoSz = CyaSSL_read(ssl, command, sizeof(command)-1)) > 0) { - - if (firstRead == 1) { - firstRead = 0; /* browser may send 1 byte 'G' to start */ - if (echoSz == 1 && command[0] == 'G') { - gotFirstG = 1; - continue; - } - } - else if (gotFirstG == 1 && strncmp(command, "ET /", 4) == 0) { - strncpy(command, "GET", 4); - /* fall through to normal GET */ - } - - if ( strncmp(command, "quit", 4) == 0) { - printf("client sent quit command: shutting down!\n"); - shutDown = 1; - break; - } - if ( strncmp(command, "break", 5) == 0) { - printf("client sent break command: closing session!\n"); - break; - } -#ifdef SESSION_STATS - if ( strncmp(command, "printstats", 10) == 0) { - PrintSessionStats(); - break; - } -#endif - if ( strncmp(command, "GET", 3) == 0) { - char type[] = "HTTP/1.0 200 ok\r\nContent-type:" - " text/html\r\n\r\n"; - char header[] = "\n
\n";
-                char body[]   = "greetings from CyaSSL\n";
-                char footer[] = "\r\n\r\n";
-            
-                strncpy(command, type, sizeof(type));
-                echoSz = sizeof(type) - 1;
-
-                strncpy(&command[echoSz], header, sizeof(header));
-                echoSz += (int)sizeof(header) - 1;
-                strncpy(&command[echoSz], body, sizeof(body));
-                echoSz += (int)sizeof(body) - 1;
-                strncpy(&command[echoSz], footer, sizeof(footer));
-                echoSz += (int)sizeof(footer);
-
-                if (CyaSSL_write(ssl, command, echoSz) != echoSz)
-                    err_sys("SSL_write failed");
-                break;
-            }
-            command[echoSz] = 0;
-
-            #ifdef ECHO_OUT
-                fputs(command, fout);
-            #endif
-
-            if (CyaSSL_write(ssl, command, echoSz) != echoSz)
-                err_sys("SSL_write failed");
-        }
-#ifndef CYASSL_DTLS
-        CyaSSL_shutdown(ssl);
-#endif
-        CyaSSL_free(ssl);
-        CloseSocket(clientfd);
-#ifdef CYASSL_DTLS
-        tcp_listen(&sockfd, &port, useAnyAddr, doDTLS);
-        SignalReady(args, port);
-#endif
-    }
-
-    CloseSocket(sockfd);
-    CyaSSL_CTX_free(ctx);
-
-#ifdef ECHO_OUT
-    if (outCreated)
-        fclose(fout);
-#endif
-
-    ((func_args*)args)->return_code = 0;
-    return 0;
-}
-
-
-/* so overall tests can pull in test function */
-#ifndef NO_MAIN_DRIVER
-
-    int main(int argc, char** argv)
-    {
-        func_args args;
-
-#ifdef HAVE_CAVIUM
-        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
-        if (ret != 0)
-            err_sys("Cavium OpenNitroxDevice failed");
-#endif /* HAVE_CAVIUM */
-
-        StartTCP();
-
-        args.argc = argc;
-        args.argv = argv;
-
-        CyaSSL_Init();
-#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL)
-        CyaSSL_Debugging_ON();
-#endif
-        if (CurrentDir("echoserver"))
-            ChangeDirBack(2);
-        else if (CurrentDir("Debug") || CurrentDir("Release"))
-            ChangeDirBack(3);
-        echoserver_test(&args);
-        CyaSSL_Cleanup();
-
-#ifdef HAVE_CAVIUM
-        CspShutdown(CAVIUM_DEV_ID);
-#endif
-        return args.return_code;
-    }
-
-        
-#endif /* NO_MAIN_DRIVER */
-
-
-
-
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/server.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/server.c
deleted file mode 100644
index 4c79540c8..000000000
--- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/server.c
+++ /dev/null
@@ -1,605 +0,0 @@
-/* server.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 
-#endif
-
-#include 
-
-#if !defined(CYASSL_TRACK_MEMORY) && !defined(NO_MAIN_DRIVER)
-    /* in case memory tracker wants stats */
-    #define CYASSL_TRACK_MEMORY
-#endif
-
-#if defined(CYASSL_MDK_ARM)
-        #include 
-        #include 
-
-        #if defined(CYASSL_MDK5)
-            #include "cmsis_os.h"
-            #include "rl_fs.h" 
-            #include "rl_net.h" 
-        #else
-            #include "rtl.h"
-        #endif
-
-        #include "cyassl_MDK_ARM.h"
-#endif
-#include 
-#include 
-
-#include "examples/server/server.h"
-
-
-#ifdef CYASSL_CALLBACKS
-    int srvHandShakeCB(HandShakeInfo*);
-    int srvTimeoutCB(TimeoutInfo*);
-    Timeval srvTo;
-#endif
-
-static void NonBlockingSSL_Accept(SSL* ssl)
-{
-#ifndef CYASSL_CALLBACKS
-    int ret = SSL_accept(ssl);
-#else
-    int ret = CyaSSL_accept_ex(ssl, srvHandShakeCB, srvTimeoutCB, srvTo);
-#endif
-    int error = SSL_get_error(ssl, 0);
-    SOCKET_T sockfd = (SOCKET_T)CyaSSL_get_fd(ssl);
-    int select_ret;
-
-    while (ret != SSL_SUCCESS && (error == SSL_ERROR_WANT_READ ||
-                                  error == SSL_ERROR_WANT_WRITE)) {
-        int currTimeout = 1;
-
-        if (error == SSL_ERROR_WANT_READ)
-            printf("... server would read block\n");
-        else
-            printf("... server would write block\n");
-
-#ifdef CYASSL_DTLS
-        currTimeout = CyaSSL_dtls_get_current_timeout(ssl);
-#endif
-        select_ret = tcp_select(sockfd, currTimeout);
-
-        if ((select_ret == TEST_RECV_READY) ||
-                                        (select_ret == TEST_ERROR_READY)) {
-            #ifndef CYASSL_CALLBACKS
-                ret = SSL_accept(ssl);
-            #else
-                ret = CyaSSL_accept_ex(ssl,
-                                    srvHandShakeCB, srvTimeoutCB, srvTo);
-            #endif
-            error = SSL_get_error(ssl, 0);
-        }
-        else if (select_ret == TEST_TIMEOUT && !CyaSSL_dtls(ssl)) {
-            error = SSL_ERROR_WANT_READ;
-        }
-#ifdef CYASSL_DTLS
-        else if (select_ret == TEST_TIMEOUT && CyaSSL_dtls(ssl) &&
-                                            CyaSSL_dtls_got_timeout(ssl) >= 0) {
-            error = SSL_ERROR_WANT_READ;
-        }
-#endif
-        else {
-            error = SSL_FATAL_ERROR;
-        }
-    }
-    if (ret != SSL_SUCCESS)
-        err_sys("SSL_accept failed");
-}
-
-
-static void Usage(void)
-{
-    printf("server "    LIBCYASSL_VERSION_STRING
-           " NOTE: All files relative to CyaSSL home dir\n");
-    printf("-?          Help, print this usage\n");
-    printf("-p     Port to listen on, not 0, default %d\n", yasslPort);
-    printf("-v     SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n",
-                                 SERVER_DEFAULT_VERSION);
-    printf("-l     Cipher list\n");
-    printf("-c    Certificate file,           default %s\n", svrCert);
-    printf("-k    Key file,                   default %s\n", svrKey);
-    printf("-A    Certificate Authority file, default %s\n", cliCert);
-    printf("-d          Disable client cert check\n");
-    printf("-b          Bind to any interface instead of localhost only\n");
-    printf("-s          Use pre Shared keys\n");
-    printf("-t          Track CyaSSL memory use\n");
-    printf("-u          Use UDP DTLS,"
-           " add -v 2 for DTLSv1 (default), -v 3 for DTLSv1.2\n");
-    printf("-f          Fewer packets/group messages\n");
-    printf("-N          Use Non-blocking sockets\n");
-    printf("-S     Use Host Name Indication\n");
-#ifdef HAVE_OCSP
-    printf("-o          Perform OCSP lookup on peer certificate\n");
-    printf("-O     Perform OCSP lookup using  as responder\n");
-#endif
-#ifdef HAVE_PK_CALLBACKS 
-    printf("-P          Public Key Callbacks\n");
-#endif
-}
-
-THREAD_RETURN CYASSL_THREAD server_test(void* args)
-{
-    SOCKET_T sockfd   = 0;
-    SOCKET_T clientfd = 0;
-
-    SSL_METHOD* method = 0;
-    SSL_CTX*    ctx    = 0;
-    SSL*        ssl    = 0;
-
-    char   msg[] = "I hear you fa shizzle!";
-    char   input[80];
-    int    idx;
-    int    ch;
-    int    version = SERVER_DEFAULT_VERSION;
-    int    doCliCertCheck = 0; /* = 0 for no Realtime Clock environment */
-    int    useAnyAddr = 0;
-    word16 port = yasslPort;
-    int    usePsk = 0;
-    int    doDTLS = 0;
-    int    useNtruKey   = 0;
-    int    nonBlocking  = 0;
-    int    trackMemory  = 0;
-    int    fewerPackets = 0;
-    int    pkCallbacks  = 0;
-    char*  cipherList = NULL;
-    char*  verifyCert = (char*)cliCert;
-    char*  ourCert    = (char*)svrCert;
-    char*  ourKey     = (char*)svrKey;
-    int    argc = ((func_args*)args)->argc;
-    char** argv = ((func_args*)args)->argv;
-
-#ifdef HAVE_SNI
-    char*  sniHostName = NULL;
-#endif
-
-#ifdef HAVE_OCSP
-    int    useOcsp  = 0;
-    char*  ocspUrl  = NULL;
-#endif
-
-    ((func_args*)args)->return_code = -1; /* error state */
-
-#ifdef NO_RSA
-    verifyCert = (char*)cliEccCert;
-    ourCert    = (char*)eccCert;
-    ourKey     = (char*)eccKey;
-#endif
-    (void)trackMemory;
-    (void)pkCallbacks;
-
-    while ((ch = mygetopt(argc, argv, "?dbstnNufPp:v:l:A:c:k:S:oO:")) != -1) {
-        switch (ch) {
-            case '?' :
-                Usage();
-                exit(EXIT_SUCCESS);
-
-            case 'd' :
-                doCliCertCheck = 0;
-                break;
-
-            case 'b' :
-                useAnyAddr = 1;
-                break;
-
-            case 's' :
-                usePsk = 1;
-                break;
-
-            case 't' :
-            #ifdef USE_CYASSL_MEMORY
-                trackMemory = 1;
-            #endif
-                break;
-
-            case 'n' :
-                useNtruKey = 1;
-                break;
-
-            case 'u' :
-                doDTLS  = 1;
-                break;
-
-            case 'f' :
-                fewerPackets = 1;
-                break;
-
-            case 'P' :
-            #ifdef HAVE_PK_CALLBACKS 
-                pkCallbacks = 1;
-            #endif
-                break;
-
-            case 'p' :
-                port = (word16)atoi(myoptarg);
-                #if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API)
-                    if (port == 0)
-                        err_sys("port number cannot be 0");
-                #endif
-                break;
-
-            case 'v' :
-                version = atoi(myoptarg);
-                if (version < 0 || version > 3) {
-                    Usage();
-                    exit(MY_EX_USAGE);
-                }
-                break;
-
-            case 'l' :
-                cipherList = myoptarg;
-                break;
-
-            case 'A' :
-                verifyCert = myoptarg;
-                break;
-
-            case 'c' :
-                ourCert = myoptarg;
-                break;
-
-            case 'k' :
-                ourKey = myoptarg;
-                break;
-
-            case 'N':
-                nonBlocking = 1;
-                break;
-
-            case 'S' :
-                #ifdef HAVE_SNI
-                    sniHostName = myoptarg;
-                #endif
-                break;
-
-            case 'o' :
-                #ifdef HAVE_OCSP
-                    useOcsp = 1;
-                #endif
-                break;
-
-            case 'O' :
-                #ifdef HAVE_OCSP
-                    useOcsp = 1;
-                    ocspUrl = myoptarg;
-                #endif
-                break;
-
-            default:
-                Usage();
-                exit(MY_EX_USAGE);
-        }
-    }
-
-    myoptind = 0;      /* reset for test cases */
-
-    /* sort out DTLS versus TLS versions */
-    if (version == CLIENT_INVALID_VERSION) {
-        if (doDTLS)
-            version = CLIENT_DTLS_DEFAULT_VERSION;
-        else
-            version = CLIENT_DEFAULT_VERSION;
-    }
-    else {
-        if (doDTLS) {
-            if (version == 3)
-                version = -2;
-            else
-                version = -1;
-        }
-    }
-
-#ifdef USE_CYASSL_MEMORY
-    if (trackMemory)
-        InitMemoryTracker(); 
-#endif
-
-    switch (version) {
-#ifndef NO_OLD_TLS
-        case 0:
-            method = SSLv3_server_method();
-            break;
-
-    #ifndef NO_TLS
-        case 1:
-            method = TLSv1_server_method();
-            break;
-
-
-        case 2:
-            method = TLSv1_1_server_method();
-            break;
-
-        #endif
-#endif
-
-#ifndef NO_TLS
-        case 3:
-            method = TLSv1_2_server_method();
-            break;
-#endif
-                
-#ifdef CYASSL_DTLS
-        case -1:
-            method = DTLSv1_server_method();
-            break;
-
-        case -2:
-            method = DTLSv1_2_server_method();
-            break;
-#endif
-
-        default:
-            err_sys("Bad SSL version");
-    }
-
-    if (method == NULL)
-        err_sys("unable to get method");
-
-    ctx = SSL_CTX_new(method);
-    if (ctx == NULL)
-        err_sys("unable to get ctx");
-
-    if (cipherList)
-        if (SSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS)
-            err_sys("server can't set cipher list 1");
-
-#ifdef CYASSL_LEANPSK
-    usePsk = 1;
-#endif
-
-#if defined(NO_RSA) && !defined(HAVE_ECC)
-    usePsk = 1;
-#endif
-
-    if (fewerPackets)
-        CyaSSL_CTX_set_group_messages(ctx);
-
-#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
-    SSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack);
-#endif
-
-#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
-    if (!usePsk) {
-        if (SSL_CTX_use_certificate_file(ctx, ourCert, SSL_FILETYPE_PEM)
-                                         != SSL_SUCCESS)
-            err_sys("can't load server cert file, check file and run from"
-                    " CyaSSL home dir");
-    }
-#endif
-
-#ifdef HAVE_NTRU
-    if (useNtruKey) {
-        if (CyaSSL_CTX_use_NTRUPrivateKey_file(ctx, ourKey)
-                                               != SSL_SUCCESS)
-            err_sys("can't load ntru key file, "
-                    "Please run from CyaSSL home dir");
-    }
-#endif
-
-#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
-    if (!useNtruKey && !usePsk) {
-        if (SSL_CTX_use_PrivateKey_file(ctx, ourKey, SSL_FILETYPE_PEM)
-                                         != SSL_SUCCESS)
-            err_sys("can't load server private key file, check file and run "
-                "from CyaSSL home dir");
-    }
-#endif
-
-    if (usePsk) {
-#ifndef NO_PSK
-        SSL_CTX_set_psk_server_callback(ctx, my_psk_server_cb);
-        SSL_CTX_use_psk_identity_hint(ctx, "cyassl server");
-        if (cipherList == NULL) {
-            const char *defaultCipherList;
-            #ifdef HAVE_NULL_CIPHER
-                defaultCipherList = "PSK-NULL-SHA256";
-            #else
-                defaultCipherList = "PSK-AES128-CBC-SHA256";
-            #endif
-            if (SSL_CTX_set_cipher_list(ctx, defaultCipherList) != SSL_SUCCESS)
-                err_sys("server can't set cipher list 2");
-        }
-#endif
-    }
-
-#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS)
-    /* if not using PSK, verify peer with certs */
-    if (doCliCertCheck && usePsk == 0) {
-        SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER |
-                                SSL_VERIFY_FAIL_IF_NO_PEER_CERT,0);
-        if (SSL_CTX_load_verify_locations(ctx, verifyCert, 0) != SSL_SUCCESS)
-            err_sys("can't load ca file, Please run from CyaSSL home dir");
-    }
-#endif
-
-#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC)
-    /* don't use EDH, can't sniff tmp keys */
-    if (cipherList == NULL) {
-        if (SSL_CTX_set_cipher_list(ctx, "AES256-SHA256") != SSL_SUCCESS)
-            err_sys("server can't set cipher list 3");
-    }
-#endif
-
-#ifdef HAVE_SNI
-    if (sniHostName)
-        if (CyaSSL_CTX_UseSNI(ctx, CYASSL_SNI_HOST_NAME, sniHostName,
-                                           XSTRLEN(sniHostName)) != SSL_SUCCESS)
-            err_sys("UseSNI failed");
-#endif
-
-    ssl = SSL_new(ctx);
-    if (ssl == NULL)
-        err_sys("unable to get SSL");
-
-#ifdef HAVE_CRL
-    CyaSSL_EnableCRL(ssl, 0);
-    CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, CYASSL_CRL_MONITOR |
-                                                     CYASSL_CRL_START_MON);
-    CyaSSL_SetCRL_Cb(ssl, CRL_CallBack);
-#endif
-#ifdef HAVE_OCSP
-    if (useOcsp) {
-        if (ocspUrl != NULL) {
-            CyaSSL_CTX_SetOCSP_OverrideURL(ctx, ocspUrl);
-            CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE
-                                                    | CYASSL_OCSP_URL_OVERRIDE);
-        }
-        else
-            CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE);
-    }
-#endif
-#ifdef HAVE_PK_CALLBACKS
-    if (pkCallbacks)
-        SetupPkCallbacks(ctx, ssl);
-#endif
-
-    tcp_accept(&sockfd, &clientfd, (func_args*)args, port, useAnyAddr, doDTLS,
-               0);
-    if (!doDTLS) 
-        CloseSocket(sockfd);
-
-    SSL_set_fd(ssl, clientfd);
-    if (usePsk == 0) {
-        #if !defined(NO_FILESYSTEM) && defined(OPENSSL_EXTRA)
-            CyaSSL_SetTmpDH_file(ssl, dhParam, SSL_FILETYPE_PEM);
-        #elif !defined(NO_CERTS)
-            SetDH(ssl);  /* repick suites with DHE, higher priority than PSK */
-        #endif
-    }
-
-#ifndef CYASSL_CALLBACKS
-    if (nonBlocking) {
-        CyaSSL_set_using_nonblock(ssl, 1);
-        tcp_set_nonblocking(&clientfd);
-        NonBlockingSSL_Accept(ssl);
-    } else if (SSL_accept(ssl) != SSL_SUCCESS) {
-        int err = SSL_get_error(ssl, 0);
-        char buffer[CYASSL_MAX_ERROR_SZ];
-        printf("error = %d, %s\n", err, ERR_error_string(err, buffer));
-        err_sys("SSL_accept failed");
-    }
-#else
-    NonBlockingSSL_Accept(ssl);
-#endif
-    showPeer(ssl);
-
-    idx = SSL_read(ssl, input, sizeof(input)-1);
-    if (idx > 0) {
-        input[idx] = 0;
-        printf("Client message: %s\n", input);
-
-    }
-    else if (idx < 0) {
-        int readErr = SSL_get_error(ssl, 0);
-        if (readErr != SSL_ERROR_WANT_READ)
-            err_sys("SSL_read failed");
-    }
-
-    if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg))
-        err_sys("SSL_write failed");
-        
-    #if defined(CYASSL_MDK_SHELL) && defined(HAVE_MDK_RTX)
-        os_dly_wait(500) ;
-    #endif
-
-    SSL_shutdown(ssl);
-    SSL_free(ssl);
-    SSL_CTX_free(ctx);
-    
-    CloseSocket(clientfd);
-    ((func_args*)args)->return_code = 0;
-
-#ifdef USE_CYASSL_MEMORY
-    if (trackMemory)
-        ShowMemoryTracker();
-#endif /* USE_CYASSL_MEMORY */
-
-    return 0;
-}
-
-
-/* so overall tests can pull in test function */
-#ifndef NO_MAIN_DRIVER
-
-    int main(int argc, char** argv)
-    {
-        func_args args;
-
-#ifdef HAVE_CAVIUM
-        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
-        if (ret != 0)
-            err_sys("Cavium OpenNitroxDevice failed");
-#endif /* HAVE_CAVIUM */
-
-        StartTCP();
-
-        args.argc = argc;
-        args.argv = argv;
-
-        CyaSSL_Init();
-#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL)
-        CyaSSL_Debugging_ON();
-#endif
-        if (CurrentDir("server"))
-            ChangeDirBack(2);
-        else if (CurrentDir("Debug") || CurrentDir("Release"))
-            ChangeDirBack(3);
-   
-#ifdef HAVE_STACK_SIZE
-        StackSizeCheck(&args, server_test);
-#else 
-        server_test(&args);
-#endif
-        CyaSSL_Cleanup();
-
-#ifdef HAVE_CAVIUM
-        CspShutdown(CAVIUM_DEV_ID);
-#endif
-        return args.return_code;
-    }
-
-    int myoptind = 0;
-    char* myoptarg = NULL;
-
-#endif /* NO_MAIN_DRIVER */
-
-
-#ifdef CYASSL_CALLBACKS
-
-    int srvHandShakeCB(HandShakeInfo* info)
-    {
-        (void)info;
-        return 0;
-    }
-
-
-    int srvTimeoutCB(TimeoutInfo* info)
-    {
-        (void)info;
-        return 0;
-    }
-
-#endif
-
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/test.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/test.c
deleted file mode 100644
index 751cfdf85..000000000
--- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/test.c
+++ /dev/null
@@ -1,4758 +0,0 @@
-/* test.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 
-#endif
-
-#include 
-
-#ifdef XMALLOC_USER
-    #include   /* we're using malloc / free direct here */
-#endif
-
-#ifndef NO_CRYPT_TEST
-
-#ifdef CYASSL_TEST_CERT
-    #include 
-#else
-    #include 
-#endif
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#ifdef HAVE_ECC
-    #include 
-#endif
-#ifdef HAVE_BLAKE2
-    #include 
-#endif
-#ifdef HAVE_LIBZ
-    #include 
-#endif
-#ifdef HAVE_PKCS7
-    #include 
-#endif
-
-#ifdef _MSC_VER
-    /* 4996 warning to use MS extensions e.g., strcpy_s instead of strncpy */
-    #pragma warning(disable: 4996)
-#endif
-
-#ifdef OPENSSL_EXTRA
-    #include 
-    #include 
-    #include 
-    #include 
-#endif
-
-
-#if defined(USE_CERT_BUFFERS_1024) || defined(USE_CERT_BUFFERS_2048)
-    /* include test cert and key buffers for use with NO_FILESYSTEM */
-    #if defined(CYASSL_MDK_ARM)
-        #include "cert_data.h"
-                        /* use certs_test.c for initial data, so other
-                                               commands can share the data. */
-    #else
-        #include 
-    #endif
-#endif
-
-#if defined(CYASSL_MDK_ARM)
-        #include 
-        #include 
-    extern FILE * CyaSSL_fopen(const char *fname, const char *mode) ;
-    #define fopen CyaSSL_fopen
-#endif
-
-#ifdef HAVE_NTRU
-    #include "crypto_ntru.h"
-#endif
-#ifdef HAVE_CAVIUM
-    #include "cavium_sysdep.h"
-    #include "cavium_common.h"
-    #include "cavium_ioctl.h"
-#endif
-
-#ifdef FREESCALE_MQX
-    #include 
-    #include 
-    #include 
-#else
-    #include 
-#endif
-
-
-#ifdef THREADX
-    /* since just testing, use THREADX log printf instead */
-    int dc_log_printf(char*, ...);
-        #undef printf
-        #define printf dc_log_printf
-#endif
-
-#include "ctaocrypt/test/test.h"
-
-
-typedef struct testVector {
-    const char*  input;
-    const char*  output;
-    size_t inLen;
-    size_t outLen;
-} testVector;
-
-int  md2_test(void);
-int  md5_test(void);
-int  md4_test(void);
-int  sha_test(void);
-int  sha256_test(void);
-int  sha512_test(void);
-int  sha384_test(void);
-int  hmac_md5_test(void);
-int  hmac_sha_test(void);
-int  hmac_sha256_test(void);
-int  hmac_sha384_test(void);
-int  hmac_sha512_test(void);
-int  hmac_blake2b_test(void);
-int  hkdf_test(void);
-int  arc4_test(void);
-int  hc128_test(void);
-int  rabbit_test(void);
-int  des_test(void);
-int  des3_test(void);
-int  aes_test(void);
-int  aesgcm_test(void);
-int  gmac_test(void);
-int  aesccm_test(void);
-int  camellia_test(void);
-int  rsa_test(void);
-int  dh_test(void);
-int  dsa_test(void);
-int  random_test(void);
-int  pwdbased_test(void);
-int  ripemd_test(void);
-int  openssl_test(void);   /* test mini api */
-int pbkdf1_test(void);
-int pkcs12_test(void);
-int pbkdf2_test(void);
-#ifdef HAVE_ECC
-    int  ecc_test(void);
-    #ifdef HAVE_ECC_ENCRYPT
-        int  ecc_encrypt_test(void);
-    #endif
-#endif
-#ifdef HAVE_BLAKE2
-    int  blake2b_test(void);
-#endif
-#ifdef HAVE_LIBZ
-    int compress_test(void);
-#endif
-#ifdef HAVE_PKCS7
-    int pkcs7enveloped_test(void);
-    int pkcs7signed_test(void);
-#endif
-
-
-
-static void err_sys(const char* msg, int es)
-{
-    printf("%s error = %d\n", msg, es);
-    #if !defined(THREADX) && !defined(CYASSL_MDK_ARM)
-  	if (msg)
-        exit(es);
-    #endif
-    return;
-}
-
-/* func_args from test.h, so don't have to pull in other junk */
-typedef struct func_args {
-    int    argc;
-    char** argv;
-    int    return_code;
-} func_args;
-
-
-
-void ctaocrypt_test(void* args)
-{
-    int ret = 0;
-
-    ((func_args*)args)->return_code = -1; /* error state */
-
-#if !defined(NO_BIG_INT)
-    if (CheckCtcSettings() != 1)
-        err_sys("Build vs runtime math mismatch\n", -1234);
-
-#ifdef USE_FAST_MATH
-    if (CheckFastMathSettings() != 1)
-        err_sys("Build vs runtime fastmath FP_MAX_BITS mismatch\n", -1235);
-#endif /* USE_FAST_MATH */
-#endif /* !NO_BIG_INT */
-
-
-#ifndef NO_MD5
-    if ( (ret = md5_test()) != 0)
-        err_sys("MD5      test failed!\n", ret);
-    else
-        printf( "MD5      test passed!\n");
-#endif
-
-#ifdef CYASSL_MD2
-    if ( (ret = md2_test()) != 0)
-        err_sys("MD2      test failed!\n", ret);
-    else
-        printf( "MD2      test passed!\n");
-#endif
-
-#ifndef NO_MD4
-    if ( (ret = md4_test()) != 0)
-        err_sys("MD4      test failed!\n", ret);
-    else
-        printf( "MD4      test passed!\n");
-#endif
-
-#ifndef NO_SHA
-    if ( (ret = sha_test()) != 0)
-        err_sys("SHA      test failed!\n", ret);
-    else
-        printf( "SHA      test passed!\n");
-#endif
-
-#ifndef NO_SHA256
-    if ( (ret = sha256_test()) != 0)
-        err_sys("SHA-256  test failed!\n", ret);
-    else
-        printf( "SHA-256  test passed!\n");
-#endif
-
-#ifdef CYASSL_SHA384
-    if ( (ret = sha384_test()) != 0)
-        err_sys("SHA-384  test failed!\n", ret);
-    else
-        printf( "SHA-384  test passed!\n");
-#endif
-
-#ifdef CYASSL_SHA512
-    if ( (ret = sha512_test()) != 0)
-        err_sys("SHA-512  test failed!\n", ret);
-    else
-        printf( "SHA-512  test passed!\n");
-#endif
-
-#ifdef CYASSL_RIPEMD
-    if ( (ret = ripemd_test()) != 0)
-        err_sys("RIPEMD   test failed!\n", ret);
-    else
-        printf( "RIPEMD   test passed!\n");
-#endif
-
-#ifdef HAVE_BLAKE2
-    if ( (ret = blake2b_test()) != 0)
-        err_sys("BLAKE2b  test failed!\n", ret);
-    else
-        printf( "BLAKE2b  test passed!\n");
-#endif
-
-#ifndef NO_HMAC
-    #ifndef NO_MD5
-        if ( (ret = hmac_md5_test()) != 0)
-            err_sys("HMAC-MD5 test failed!\n", ret);
-        else
-            printf( "HMAC-MD5 test passed!\n");
-    #endif
-
-    #ifndef NO_SHA
-    if ( (ret = hmac_sha_test()) != 0)
-        err_sys("HMAC-SHA test failed!\n", ret);
-    else
-        printf( "HMAC-SHA test passed!\n");
-    #endif
-
-    #ifndef NO_SHA256
-        if ( (ret = hmac_sha256_test()) != 0)
-            err_sys("HMAC-SHA256 test failed!\n", ret);
-        else
-            printf( "HMAC-SHA256 test passed!\n");
-    #endif
-
-    #ifdef CYASSL_SHA384
-        if ( (ret = hmac_sha384_test()) != 0)
-            err_sys("HMAC-SHA384 test failed!\n", ret);
-        else
-            printf( "HMAC-SHA384 test passed!\n");
-    #endif
-
-    #ifdef CYASSL_SHA512
-        if ( (ret = hmac_sha512_test()) != 0)
-            err_sys("HMAC-SHA512 test failed!\n", ret);
-        else
-            printf( "HMAC-SHA512 test passed!\n");
-    #endif
-
-    #ifdef HAVE_BLAKE2
-        if ( (ret = hmac_blake2b_test()) != 0)
-            err_sys("HMAC-BLAKE2 test failed!\n", ret);
-        else
-            printf( "HMAC-BLAKE2 test passed!\n");
-    #endif
-
-    #ifdef HAVE_HKDF
-        if ( (ret = hkdf_test()) != 0)
-            err_sys("HMAC-KDF    test failed!\n", ret);
-        else
-            printf( "HMAC-KDF    test passed!\n");
-    #endif
-
-#endif
-
-#ifdef HAVE_AESGCM
-    if ( (ret = gmac_test()) != 0)
-        err_sys("GMAC     test passed!\n", ret);
-    else
-        printf( "GMAC     test passed!\n");
-#endif
-
-#ifndef NO_RC4
-    if ( (ret = arc4_test()) != 0)
-        err_sys("ARC4     test failed!\n", ret);
-    else
-        printf( "ARC4     test passed!\n");
-#endif
-
-#ifndef NO_HC128
-    if ( (ret = hc128_test()) != 0)
-        err_sys("HC-128   test failed!\n", ret);
-    else
-        printf( "HC-128   test passed!\n");
-#endif
-
-#ifndef NO_RABBIT
-    if ( (ret = rabbit_test()) != 0)
-        err_sys("Rabbit   test failed!\n", ret);
-    else
-        printf( "Rabbit   test passed!\n");
-#endif
-
-#ifndef NO_DES3
-    if ( (ret = des_test()) != 0)
-        err_sys("DES      test failed!\n", ret);
-    else
-        printf( "DES      test passed!\n");
-#endif
-
-#ifndef NO_DES3
-    if ( (ret = des3_test()) != 0)
-        err_sys("DES3     test failed!\n", ret);
-    else
-        printf( "DES3     test passed!\n");
-#endif
-
-#ifndef NO_AES
-    if ( (ret = aes_test()) != 0)
-        err_sys("AES      test failed!\n", ret);
-    else
-        printf( "AES      test passed!\n");
-
-#ifdef HAVE_AESGCM
-    if ( (ret = aesgcm_test()) != 0)
-        err_sys("AES-GCM  test failed!\n", ret);
-    else
-        printf( "AES-GCM  test passed!\n");
-#endif
-
-#ifdef HAVE_AESCCM
-    if ( (ret = aesccm_test()) != 0)
-        err_sys("AES-CCM  test failed!\n", ret);
-    else
-        printf( "AES-CCM  test passed!\n");
-#endif
-#endif
-
-#ifdef HAVE_CAMELLIA
-    if ( (ret = camellia_test()) != 0)
-        err_sys("CAMELLIA test failed!\n", ret);
-    else
-        printf( "CAMELLIA test passed!\n");
-#endif
-
-    if ( (ret = random_test()) != 0)
-        err_sys("RANDOM   test failed!\n", ret);
-    else
-        printf( "RANDOM   test passed!\n");
-
-#ifndef NO_RSA
-    if ( (ret = rsa_test()) != 0)
-        err_sys("RSA      test failed!\n", ret);
-    else
-        printf( "RSA      test passed!\n");
-#endif
-
-#ifndef NO_DH
-    if ( (ret = dh_test()) != 0)
-        err_sys("DH       test failed!\n", ret);
-    else
-        printf( "DH       test passed!\n");
-#endif
-
-#ifndef NO_DSA
-    if ( (ret = dsa_test()) != 0)
-        err_sys("DSA      test failed!\n", ret);
-    else
-        printf( "DSA      test passed!\n");
-#endif
-
-#ifndef NO_PWDBASED
-    if ( (ret = pwdbased_test()) != 0)
-        err_sys("PWDBASED test failed!\n", ret);
-    else
-        printf( "PWDBASED test passed!\n");
-#endif
-
-#ifdef OPENSSL_EXTRA
-    if ( (ret = openssl_test()) != 0)
-        err_sys("OPENSSL  test failed!\n", ret);
-    else
-        printf( "OPENSSL  test passed!\n");
-#endif
-
-#ifdef HAVE_ECC
-    if ( (ret = ecc_test()) != 0)
-        err_sys("ECC      test failed!\n", ret);
-    else
-        printf( "ECC      test passed!\n");
-    #ifdef HAVE_ECC_ENCRYPT
-        if ( (ret = ecc_encrypt_test()) != 0)
-            err_sys("ECC Enc  test failed!\n", ret);
-        else
-            printf( "ECC Enc  test passed!\n");
-    #endif
-#endif
-
-#ifdef HAVE_LIBZ
-    if ( (ret = compress_test()) != 0)
-        err_sys("COMPRESS test failed!\n", ret);
-    else
-        printf( "COMPRESS test passed!\n");
-#endif
-
-#ifdef HAVE_PKCS7
-    if ( (ret = pkcs7enveloped_test()) != 0)
-        err_sys("PKCS7enveloped test failed!\n", ret);
-    else
-        printf( "PKCS7enveloped test passed!\n");
-
-    if ( (ret = pkcs7signed_test()) != 0)
-        err_sys("PKCS7signed    test failed!\n", ret);
-    else
-        printf( "PKCS7signed    test passed!\n");
-#endif
-
-    ((func_args*)args)->return_code = ret;
-}
-
-
-#ifndef NO_MAIN_DRIVER
-
-#ifdef HAVE_CAVIUM
-
-static int OpenNitroxDevice(int dma_mode,int dev_id)
-{
-   Csp1CoreAssignment core_assign;
-   Uint32             device;
-
-   if (CspInitialize(CAVIUM_DIRECT,CAVIUM_DEV_ID))
-      return -1;
-   if (Csp1GetDevType(&device))
-      return -1;
-   if (device != NPX_DEVICE) {
-      if (ioctl(gpkpdev_hdlr[CAVIUM_DEV_ID], IOCTL_CSP1_GET_CORE_ASSIGNMENT,
-                (Uint32 *)&core_assign)!= 0)
-         return -1;
-   }
-   CspShutdown(CAVIUM_DEV_ID);
-
-   return CspInitialize(dma_mode, dev_id);
-}
-
-#endif /* HAVE_CAVIUM */
-
-    /* so overall tests can pull in test function */
-
-    int main(int argc, char** argv)
-    {
-
-        func_args args;
-
-
-#ifdef HAVE_CAVIUM
-        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
-        if (ret != 0)
-            err_sys("Cavium OpenNitroxDevice failed", -1236);
-#endif /* HAVE_CAVIUM */
-
-        args.argc = argc;
-        args.argv = argv;
-
-        ctaocrypt_test(&args);
-
-#ifdef HAVE_CAVIUM
-        CspShutdown(CAVIUM_DEV_ID);
-#endif
-
-        return args.return_code;
-    }
-
-#endif /* NO_MAIN_DRIVER */
-
-
-#ifdef CYASSL_MD2
-int md2_test()
-{
-    Md2  md2;
-    byte hash[MD2_DIGEST_SIZE];
-
-    testVector a, b, c, d, e, f, g;
-    testVector test_md2[7];
-    int times = sizeof(test_md2) / sizeof(testVector), i;
-
-    a.input  = "";
-    a.output = "\x83\x50\xe5\xa3\xe2\x4c\x15\x3d\xf2\x27\x5c\x9f\x80\x69"
-               "\x27\x73";
-    a.inLen  = strlen(a.input);
-    a.outLen = MD2_DIGEST_SIZE;
-
-    b.input  = "a";
-    b.output = "\x32\xec\x01\xec\x4a\x6d\xac\x72\xc0\xab\x96\xfb\x34\xc0"
-               "\xb5\xd1";
-    b.inLen  = strlen(b.input);
-    b.outLen = MD2_DIGEST_SIZE;
-
-    c.input  = "abc";
-    c.output = "\xda\x85\x3b\x0d\x3f\x88\xd9\x9b\x30\x28\x3a\x69\xe6\xde"
-               "\xd6\xbb";
-    c.inLen  = strlen(c.input);
-    c.outLen = MD2_DIGEST_SIZE;
-
-    d.input  = "message digest";
-    d.output = "\xab\x4f\x49\x6b\xfb\x2a\x53\x0b\x21\x9f\xf3\x30\x31\xfe"
-               "\x06\xb0";
-    d.inLen  = strlen(d.input);
-    d.outLen = MD2_DIGEST_SIZE;
-
-    e.input  = "abcdefghijklmnopqrstuvwxyz";
-    e.output = "\x4e\x8d\xdf\xf3\x65\x02\x92\xab\x5a\x41\x08\xc3\xaa\x47"
-               "\x94\x0b";
-    e.inLen  = strlen(e.input);
-    e.outLen = MD2_DIGEST_SIZE;
-
-    f.input  = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz012345"
-               "6789";
-    f.output = "\xda\x33\xde\xf2\xa4\x2d\xf1\x39\x75\x35\x28\x46\xc3\x03"
-               "\x38\xcd";
-    f.inLen  = strlen(f.input);
-    f.outLen = MD2_DIGEST_SIZE;
-
-    g.input  = "1234567890123456789012345678901234567890123456789012345678"
-               "9012345678901234567890";
-    g.output = "\xd5\x97\x6f\x79\xd8\x3d\x3a\x0d\xc9\x80\x6c\x3c\x66\xf3"
-               "\xef\xd8";
-    g.inLen  = strlen(g.input);
-    g.outLen = MD2_DIGEST_SIZE;
-
-    test_md2[0] = a;
-    test_md2[1] = b;
-    test_md2[2] = c;
-    test_md2[3] = d;
-    test_md2[4] = e;
-    test_md2[5] = f;
-    test_md2[6] = g;
-
-    InitMd2(&md2);
-
-    for (i = 0; i < times; ++i) {
-        Md2Update(&md2, (byte*)test_md2[i].input, (word32)test_md2[i].inLen);
-        Md2Final(&md2, hash);
-
-        if (memcmp(hash, test_md2[i].output, MD2_DIGEST_SIZE) != 0)
-            return -155 - i;
-    }
-
-    return 0;
-}
-#endif
-
-#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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    test_md5[0] = a;
-    test_md5[1] = b;
-    test_md5[2] = c;
-    test_md5[3] = d;
-    test_md5[4] = e;
-
-    InitMd5(&md5);
-
-    for (i = 0; i < times; ++i) {
-        Md5Update(&md5, (byte*)test_md5[i].input, (word32)test_md5[i].inLen);
-        Md5Final(&md5, hash);
-
-        if (memcmp(hash, test_md5[i].output, MD5_DIGEST_SIZE) != 0)
-            return -5 - i;
-    }
-
-    return 0;
-}
-#endif /* NO_MD5 */
-
-
-#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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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 = MD4_DIGEST_SIZE;
-
-    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;
-
-    InitMd4(&md4);
-
-    for (i = 0; i < times; ++i) {
-        Md4Update(&md4, (byte*)test_md4[i].input, (word32)test_md4[i].inLen);
-        Md4Final(&md4, hash);
-
-        if (memcmp(hash, test_md4[i].output, MD4_DIGEST_SIZE) != 0)
-            return -205 - i;
-    }
-
-    return 0;
-}
-
-#endif /* NO_MD4 */
-
-#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;
-    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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    test_sha[0] = a;
-    test_sha[1] = b;
-    test_sha[2] = c;
-    test_sha[3] = d;
-
-    ret = InitSha(&sha);
-    if (ret != 0)
-        return -4001;
-
-    for (i = 0; i < times; ++i) {
-        ShaUpdate(&sha, (byte*)test_sha[i].input, (word32)test_sha[i].inLen);
-        ShaFinal(&sha, hash);
-
-        if (memcmp(hash, test_sha[i].output, SHA_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-
-#endif /* NO_SHA */
-
-#ifdef CYASSL_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 = RIPEMD_DIGEST_SIZE;
-
-    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 = RIPEMD_DIGEST_SIZE;
-
-    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 = RIPEMD_DIGEST_SIZE;
-
-    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 = RIPEMD_DIGEST_SIZE;
-
-    test_ripemd[0] = a;
-    test_ripemd[1] = b;
-    test_ripemd[2] = c;
-    test_ripemd[3] = d;
-
-    InitRipeMd(&ripemd);
-
-    for (i = 0; i < times; ++i) {
-        RipeMdUpdate(&ripemd, (byte*)test_ripemd[i].input,
-                     (word32)test_ripemd[i].inLen);
-        RipeMdFinal(&ripemd, hash);
-
-        if (memcmp(hash, test_ripemd[i].output, RIPEMD_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-#endif /* CYASSL_RIPEMD */
-
-
-#ifdef HAVE_BLAKE2
-
-
-#define BLAKE2_TESTS 3
-
-static const byte blake2b_vec[BLAKE2_TESTS][BLAKE2B_OUTBYTES] =
-{
-  {
-    0x78, 0x6A, 0x02, 0xF7, 0x42, 0x01, 0x59, 0x03,
-    0xC6, 0xC6, 0xFD, 0x85, 0x25, 0x52, 0xD2, 0x72,
-    0x91, 0x2F, 0x47, 0x40, 0xE1, 0x58, 0x47, 0x61,
-    0x8A, 0x86, 0xE2, 0x17, 0xF7, 0x1F, 0x54, 0x19,
-    0xD2, 0x5E, 0x10, 0x31, 0xAF, 0xEE, 0x58, 0x53,
-    0x13, 0x89, 0x64, 0x44, 0x93, 0x4E, 0xB0, 0x4B,
-    0x90, 0x3A, 0x68, 0x5B, 0x14, 0x48, 0xB7, 0x55,
-    0xD5, 0x6F, 0x70, 0x1A, 0xFE, 0x9B, 0xE2, 0xCE
-  },
-  {
-    0x2F, 0xA3, 0xF6, 0x86, 0xDF, 0x87, 0x69, 0x95,
-    0x16, 0x7E, 0x7C, 0x2E, 0x5D, 0x74, 0xC4, 0xC7,
-    0xB6, 0xE4, 0x8F, 0x80, 0x68, 0xFE, 0x0E, 0x44,
-    0x20, 0x83, 0x44, 0xD4, 0x80, 0xF7, 0x90, 0x4C,
-    0x36, 0x96, 0x3E, 0x44, 0x11, 0x5F, 0xE3, 0xEB,
-    0x2A, 0x3A, 0xC8, 0x69, 0x4C, 0x28, 0xBC, 0xB4,
-    0xF5, 0xA0, 0xF3, 0x27, 0x6F, 0x2E, 0x79, 0x48,
-    0x7D, 0x82, 0x19, 0x05, 0x7A, 0x50, 0x6E, 0x4B
-  },
-  {
-    0x1C, 0x08, 0x79, 0x8D, 0xC6, 0x41, 0xAB, 0xA9,
-    0xDE, 0xE4, 0x35, 0xE2, 0x25, 0x19, 0xA4, 0x72,
-    0x9A, 0x09, 0xB2, 0xBF, 0xE0, 0xFF, 0x00, 0xEF,
-    0x2D, 0xCD, 0x8E, 0xD6, 0xF8, 0xA0, 0x7D, 0x15,
-    0xEA, 0xF4, 0xAE, 0xE5, 0x2B, 0xBF, 0x18, 0xAB,
-    0x56, 0x08, 0xA6, 0x19, 0x0F, 0x70, 0xB9, 0x04,
-    0x86, 0xC8, 0xA7, 0xD4, 0x87, 0x37, 0x10, 0xB1,
-    0x11, 0x5D, 0x3D, 0xEB, 0xBB, 0x43, 0x27, 0xB5
-  }
-};
-
-
-
-int blake2b_test(void)
-{
-    Blake2b b2b;
-    byte    digest[64];
-    byte    input[64];
-    int     i, ret;
-
-    for (i = 0; i < (int)sizeof(input); i++)
-        input[i] = (byte)i;
-
-    for (i = 0; i < BLAKE2_TESTS; i++) {
-        ret = InitBlake2b(&b2b, 64);
-        if (ret != 0)
-            return -4002;
-
-        ret = Blake2bUpdate(&b2b, input, i);
-        if (ret != 0)
-            return -4003;
-
-        ret = Blake2bFinal(&b2b, digest, 64);
-        if (ret != 0)
-            return -4004;
-
-        if (memcmp(digest, blake2b_vec[i], 64) != 0) {
-            return -300 - i;
-        }
-    }
-
-    return 0;
-}
-#endif /* HAVE_BLAKE2 */
-
-
-#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 = SHA256_DIGEST_SIZE;
-
-    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 = SHA256_DIGEST_SIZE;
-
-    test_sha[0] = a;
-    test_sha[1] = b;
-
-    ret = InitSha256(&sha);
-    if (ret != 0)
-        return -4005;
-
-    for (i = 0; i < times; ++i) {
-        ret = Sha256Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
-        if (ret != 0)
-            return -4006;
-        ret = Sha256Final(&sha, hash);
-        if (ret != 0)
-            return -4007;
-
-        if (memcmp(hash, test_sha[i].output, SHA256_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-#endif
-
-
-#ifdef CYASSL_SHA512
-int sha512_test(void)
-{
-    Sha512 sha;
-    byte   hash[SHA512_DIGEST_SIZE];
-    int    ret;
-
-    testVector a, b;
-    testVector test_sha[2];
-    int times = sizeof(test_sha) / sizeof(struct testVector), i;
-
-    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 = SHA512_DIGEST_SIZE;
-
-    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 = SHA512_DIGEST_SIZE;
-
-    test_sha[0] = a;
-    test_sha[1] = b;
-
-    ret = InitSha512(&sha);
-    if (ret != 0)
-        return -4009;
-
-    for (i = 0; i < times; ++i) {
-        ret = Sha512Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
-        if (ret != 0)
-            return -4010;
-
-        ret = Sha512Final(&sha, hash);
-        if (ret != 0)
-            return -4011;
-
-        if (memcmp(hash, test_sha[i].output, SHA512_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-#endif
-
-
-#ifdef CYASSL_SHA384
-int sha384_test(void)
-{
-    Sha384 sha;
-    byte   hash[SHA384_DIGEST_SIZE];
-    int    ret;
-
-    testVector a, b;
-    testVector test_sha[2];
-    int times = sizeof(test_sha) / sizeof(struct testVector), i;
-
-    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 = SHA384_DIGEST_SIZE;
-
-    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 = SHA384_DIGEST_SIZE;
-
-    test_sha[0] = a;
-    test_sha[1] = b;
-
-    ret = InitSha384(&sha);
-    if (ret != 0)
-        return -4012;
-
-    for (i = 0; i < times; ++i) {
-        ret = Sha384Update(&sha, (byte*)test_sha[i].input,(word32)test_sha[i].inLen);
-        if (ret != 0)
-            return -4013;
-
-        ret = Sha384Final(&sha, hash);
-        if (ret != 0)
-            return -4014;
-
-        if (memcmp(hash, test_sha[i].output, SHA384_DIGEST_SIZE) != 0)
-            return -10 - i;
-    }
-
-    return 0;
-}
-#endif /* CYASSL_SHA384 */
-
-
-#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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    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 = MD5_DIGEST_SIZE;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-#ifdef HAVE_CAVIUM
-        if (i == 1)
-            continue; /* driver can't handle keys <= bytes */
-        if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
-            return -20009;
-#endif
-        ret = HmacSetKey(&hmac, MD5, (byte*)keys[i], (word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4015;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4016;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4017;
-
-        if (memcmp(hash, test_hmac[i].output, MD5_DIGEST_SIZE) != 0)
-            return -20 - i;
-#ifdef HAVE_CAVIUM
-        HmacFreeCavium(&hmac);
-#endif
-    }
-
-    return 0;
-}
-#endif /* NO_HMAC && NO_MD5 */
-
-#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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    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 = SHA_DIGEST_SIZE;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-#ifdef HAVE_CAVIUM
-        if (i == 1)
-            continue; /* driver can't handle keys <= bytes */
-        if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
-            return -20010;
-#endif
-        ret = HmacSetKey(&hmac, SHA, (byte*)keys[i], (word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4018;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4019;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4020;
-
-        if (memcmp(hash, test_hmac[i].output, SHA_DIGEST_SIZE) != 0)
-            return -20 - i;
-#ifdef HAVE_CAVIUM
-        HmacFreeCavium(&hmac);
-#endif
-    }
-
-    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 = SHA256_DIGEST_SIZE;
-
-    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 = SHA256_DIGEST_SIZE;
-
-    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 = SHA256_DIGEST_SIZE;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-#ifdef HAVE_CAVIUM
-        if (i == 1)
-            continue; /* driver can't handle keys <= bytes */
-        if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
-            return -20011;
-#endif
-        ret = HmacSetKey(&hmac, SHA256, (byte*)keys[i],(word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4021;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4022;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4023;
-
-        if (memcmp(hash, test_hmac[i].output, SHA256_DIGEST_SIZE) != 0)
-            return -20 - i;
-#ifdef HAVE_CAVIUM
-        HmacFreeCavium(&hmac);
-#endif
-    }
-
-    return 0;
-}
-#endif
-
-
-#if !defined(NO_HMAC) && defined(HAVE_BLAKE2)
-int hmac_blake2b_test(void)
-{
-    Hmac hmac;
-    byte hash[BLAKE2B_256];
-
-    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 = "\x72\x93\x0d\xdd\xf5\xf7\xe1\x78\x38\x07\x44\x18\x0b\x3f\x51"
-               "\x37\x25\xb5\x82\xc2\x08\x83\x2f\x1c\x99\xfd\x03\xa0\x16\x75"
-               "\xac\xfd";
-    a.inLen  = strlen(a.input);
-    a.outLen = BLAKE2B_256;
-
-    b.input  = "what do ya want for nothing?";
-    b.output = "\x3d\x20\x50\x71\x05\xc0\x8c\x0c\x38\x44\x1e\xf7\xf9\xd1\x67"
-               "\x21\xff\x64\xf5\x94\x00\xcf\xf9\x75\x41\xda\x88\x61\x9d\x7c"
-               "\xda\x2b";
-    b.inLen  = strlen(b.input);
-    b.outLen = BLAKE2B_256;
-
-    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 = "\xda\xfe\x2a\x24\xfc\xe7\xea\x36\x34\xbe\x41\x92\xc7\x11\xa7"
-               "\x00\xae\x53\x9c\x11\x9c\x80\x74\x55\x22\x25\x4a\xb9\x55\xd3"
-               "\x0f\x87";
-    c.inLen  = strlen(c.input);
-    c.outLen = BLAKE2B_256;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-#ifdef HAVE_CAVIUM
-        if (i == 1)
-            continue; /* driver can't handle keys <= bytes */
-        if (HmacInitCavium(&hmac, CAVIUM_DEV_ID) != 0)
-            return -20011;
-#endif
-        ret = HmacSetKey(&hmac, BLAKE2B_ID, (byte*)keys[i],
-                         (word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4024;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4025;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4026;
-
-        if (memcmp(hash, test_hmac[i].output, BLAKE2B_256) != 0)
-            return -20 - i;
-#ifdef HAVE_CAVIUM
-        HmacFreeCavium(&hmac);
-#endif
-    }
-
-    return 0;
-}
-#endif
-
-
-#if !defined(NO_HMAC) && defined(CYASSL_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 = SHA384_DIGEST_SIZE;
-
-    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 = SHA384_DIGEST_SIZE;
-
-    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 = SHA384_DIGEST_SIZE;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-        ret = HmacSetKey(&hmac, SHA384, (byte*)keys[i],(word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4027;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4028;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4029;
-
-        if (memcmp(hash, test_hmac[i].output, SHA384_DIGEST_SIZE) != 0)
-            return -20 - i;
-    }
-
-    return 0;
-}
-#endif
-
-
-#if !defined(NO_HMAC) && defined(CYASSL_SHA512)
-int hmac_sha512_test(void)
-{
-    Hmac hmac;
-    byte hash[SHA512_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 = "\x87\xaa\x7c\xde\xa5\xef\x61\x9d\x4f\xf0\xb4\x24\x1a\x1d\x6c"
-               "\xb0\x23\x79\xf4\xe2\xce\x4e\xc2\x78\x7a\xd0\xb3\x05\x45\xe1"
-               "\x7c\xde\xda\xa8\x33\xb7\xd6\xb8\xa7\x02\x03\x8b\x27\x4e\xae"
-               "\xa3\xf4\xe4\xbe\x9d\x91\x4e\xeb\x61\xf1\x70\x2e\x69\x6c\x20"
-               "\x3a\x12\x68\x54";
-    a.inLen  = strlen(a.input);
-    a.outLen = SHA512_DIGEST_SIZE;
-
-    b.input  = "what do ya want for nothing?";
-    b.output = "\x16\x4b\x7a\x7b\xfc\xf8\x19\xe2\xe3\x95\xfb\xe7\x3b\x56\xe0"
-               "\xa3\x87\xbd\x64\x22\x2e\x83\x1f\xd6\x10\x27\x0c\xd7\xea\x25"
-               "\x05\x54\x97\x58\xbf\x75\xc0\x5a\x99\x4a\x6d\x03\x4f\x65\xf8"
-               "\xf0\xe6\xfd\xca\xea\xb1\xa3\x4d\x4a\x6b\x4b\x63\x6e\x07\x0a"
-               "\x38\xbc\xe7\x37";
-    b.inLen  = strlen(b.input);
-    b.outLen = SHA512_DIGEST_SIZE;
-
-    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 = "\xfa\x73\xb0\x08\x9d\x56\xa2\x84\xef\xb0\xf0\x75\x6c\x89\x0b"
-               "\xe9\xb1\xb5\xdb\xdd\x8e\xe8\x1a\x36\x55\xf8\x3e\x33\xb2\x27"
-               "\x9d\x39\xbf\x3e\x84\x82\x79\xa7\x22\xc8\x06\xb4\x85\xa4\x7e"
-               "\x67\xc8\x07\xb9\x46\xa3\x37\xbe\xe8\x94\x26\x74\x27\x88\x59"
-               "\xe1\x32\x92\xfb";
-    c.inLen  = strlen(c.input);
-    c.outLen = SHA512_DIGEST_SIZE;
-
-    test_hmac[0] = a;
-    test_hmac[1] = b;
-    test_hmac[2] = c;
-
-    for (i = 0; i < times; ++i) {
-        ret = HmacSetKey(&hmac, SHA512, (byte*)keys[i],(word32)strlen(keys[i]));
-        if (ret != 0)
-            return -4030;
-        ret = HmacUpdate(&hmac, (byte*)test_hmac[i].input,
-                   (word32)test_hmac[i].inLen);
-        if (ret != 0)
-            return -4031;
-        ret = HmacFinal(&hmac, hash);
-        if (ret != 0)
-            return -4032;
-
-        if (memcmp(hash, test_hmac[i].output, SHA512_DIGEST_SIZE) != 0)
-            return -20 - i;
-    }
-
-    return 0;
-}
-#endif
-
-
-#ifndef NO_RC4
-int arc4_test(void)
-{
-    byte cipher[16];
-    byte plain[16];
-
-    const char* keys[] =
-    {
-        "\x01\x23\x45\x67\x89\xab\xcd\xef",
-        "\x01\x23\x45\x67\x89\xab\xcd\xef",
-        "\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\xef\x01\x23\x45"
-    };
-
-    testVector a, b, c, d;
-    testVector test_arc4[4];
-
-    int times = sizeof(test_arc4) / sizeof(testVector), i;
-
-    a.input  = "\x01\x23\x45\x67\x89\xab\xcd\xef";
-    a.output = "\x75\xb7\x87\x80\x99\xe0\xc5\x96";
-    a.inLen  = 8;
-    a.outLen = 8;
-
-    b.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    b.output = "\x74\x94\xc2\xe7\x10\x4b\x08\x79";
-    b.inLen  = 8;
-    b.outLen = 8;
-
-    c.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    c.output = "\xde\x18\x89\x41\xa3\x37\x5d\x3a";
-    c.inLen  = 8;
-    c.outLen = 8;
-
-    d.input  = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
-    d.output = "\xd6\xa1\x41\xa7\xec\x3c\x38\xdf\xbd\x61";
-    d.inLen  = 10;
-    d.outLen = 10;
-
-    test_arc4[0] = a;
-    test_arc4[1] = b;
-    test_arc4[2] = c;
-    test_arc4[3] = d;
-
-    for (i = 0; i < times; ++i) {
-        Arc4 enc;
-        Arc4 dec;
-        int  keylen = 8;  /* strlen with key 0x00 not good */
-        if (i == 3)
-            keylen = 4;
-
-#ifdef HAVE_CAVIUM
-        if (Arc4InitCavium(&enc, CAVIUM_DEV_ID) != 0)
-            return -20001;
-        if (Arc4InitCavium(&dec, CAVIUM_DEV_ID) != 0)
-            return -20002;
-#endif
-
-        Arc4SetKey(&enc, (byte*)keys[i], keylen);
-        Arc4SetKey(&dec, (byte*)keys[i], keylen);
-
-        Arc4Process(&enc, cipher, (byte*)test_arc4[i].input,
-                    (word32)test_arc4[i].outLen);
-        Arc4Process(&dec, plain,  cipher, (word32)test_arc4[i].outLen);
-
-        if (memcmp(plain, test_arc4[i].input, test_arc4[i].outLen))
-            return -20 - i;
-
-        if (memcmp(cipher, test_arc4[i].output, test_arc4[i].outLen))
-            return -20 - 5 - i;
-
-#ifdef HAVE_CAVIUM
-        Arc4FreeCavium(&enc);
-        Arc4FreeCavium(&dec);
-#endif
-    }
-
-    return 0;
-}
-#endif
-
-
-int hc128_test(void)
-{
-#ifdef HAVE_HC128
-    byte cipher[16];
-    byte plain[16];
-
-    const char* keys[] =
-    {
-        "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x00\x53\xA6\xF9\x4C\x9F\xF2\x45\x98\xEB\x3E\x91\xE4\x37\x8A\xDD",
-        "\x0F\x62\xB5\x08\x5B\xAE\x01\x54\xA7\xFA\x4D\xA0\xF3\x46\x99\xEC"
-    };
-
-    const char* ivs[] =
-    {
-        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x0D\x74\xDB\x42\xA9\x10\x77\xDE\x45\xAC\x13\x7A\xE1\x48\xAF\x16",
-        "\x28\x8F\xF6\x5D\xC4\x2B\x92\xF9\x60\xC7\x2E\x95\xFC\x63\xCA\x31"
-    };
-
-
-    testVector a, b, c, d;
-    testVector test_hc128[4];
-
-    int times = sizeof(test_hc128) / sizeof(testVector), i;
-
-    a.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    a.output = "\x37\x86\x02\xB9\x8F\x32\xA7\x48";
-    a.inLen  = 8;
-    a.outLen = 8;
-
-    b.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    b.output = "\x33\x7F\x86\x11\xC6\xED\x61\x5F";
-    b.inLen  = 8;
-    b.outLen = 8;
-
-    c.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    c.output = "\x2E\x1E\xD1\x2A\x85\x51\xC0\x5A";
-    c.inLen  = 8;
-    c.outLen = 8;
-
-    d.input  = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
-    d.output = "\x1C\xD8\xAE\xDD\xFE\x52\xE2\x17\xE8\x35\xD0\xB7\xE8\x4E\x29";
-    d.inLen  = 15;
-    d.outLen = 15;
-
-    test_hc128[0] = a;
-    test_hc128[1] = b;
-    test_hc128[2] = c;
-    test_hc128[3] = d;
-
-    for (i = 0; i < times; ++i) {
-        HC128 enc;
-        HC128 dec;
-
-        /* align keys/ivs in plain/cipher buffers */
-        memcpy(plain,  keys[i], 16);
-        memcpy(cipher, ivs[i],  16);
-
-        Hc128_SetKey(&enc, plain, cipher);
-        Hc128_SetKey(&dec, plain, cipher);
-
-        /* align input */
-        memcpy(plain, test_hc128[i].input, test_hc128[i].outLen);
-        Hc128_Process(&enc, cipher, plain,  (word32)test_hc128[i].outLen);
-        Hc128_Process(&dec, plain,  cipher, (word32)test_hc128[i].outLen);
-
-        if (memcmp(plain, test_hc128[i].input, test_hc128[i].outLen))
-            return -120 - i;
-
-        if (memcmp(cipher, test_hc128[i].output, test_hc128[i].outLen))
-            return -120 - 5 - i;
-    }
-
-#endif /* HAVE_HC128 */
-    return 0;
-}
-
-
-#ifndef NO_RABBIT
-int rabbit_test(void)
-{
-    byte cipher[16];
-    byte plain[16];
-
-    const char* keys[] =
-    {
-        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\xAC\xC3\x51\xDC\xF1\x62\xFC\x3B\xFE\x36\x3D\x2E\x29\x13\x28\x91"
-    };
-
-    const char* ivs[] =
-    {
-        "\x00\x00\x00\x00\x00\x00\x00\x00",
-        "\x59\x7E\x26\xC1\x75\xF5\x73\xC3",
-        0
-    };
-
-    testVector a, b, c;
-    testVector test_rabbit[3];
-
-    int times = sizeof(test_rabbit) / sizeof(testVector), i;
-
-    a.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    a.output = "\xED\xB7\x05\x67\x37\x5D\xCD\x7C";
-    a.inLen  = 8;
-    a.outLen = 8;
-
-    b.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    b.output = "\x6D\x7D\x01\x22\x92\xCC\xDC\xE0";
-    b.inLen  = 8;
-    b.outLen = 8;
-
-    c.input  = "\x00\x00\x00\x00\x00\x00\x00\x00";
-    c.output = "\x04\xCE\xCA\x7A\x1A\x86\x6E\x77";
-    c.inLen  = 8;
-    c.outLen = 8;
-
-    test_rabbit[0] = a;
-    test_rabbit[1] = b;
-    test_rabbit[2] = c;
-
-    for (i = 0; i < times; ++i) {
-        Rabbit enc;
-        Rabbit dec;
-        byte*  iv;
-
-        /* align keys/ivs in plain/cipher buffers */
-        memcpy(plain,  keys[i], 16);
-        if (ivs[i]) {
-            memcpy(cipher, ivs[i],   8);
-            iv = cipher;
-        } else
-            iv = NULL;
-        RabbitSetKey(&enc, plain, iv);
-        RabbitSetKey(&dec, plain, iv);
-
-        /* align input */
-        memcpy(plain, test_rabbit[i].input, test_rabbit[i].outLen);
-        RabbitProcess(&enc, cipher, plain,  (word32)test_rabbit[i].outLen);
-        RabbitProcess(&dec, plain,  cipher, (word32)test_rabbit[i].outLen);
-
-        if (memcmp(plain, test_rabbit[i].input, test_rabbit[i].outLen))
-            return -130 - i;
-
-        if (memcmp(cipher, test_rabbit[i].output, test_rabbit[i].outLen))
-            return -130 - 5 - i;
-    }
-
-    return 0;
-}
-#endif /* NO_RABBIT */
-
-
-#ifndef NO_DES3
-int des_test(void)
-{
-    const byte vector[] = { /* "now is the time for all " w/o trailing 0 */
-        0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-        0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-        0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-    };
-
-    byte plain[24];
-    byte cipher[24];
-
-    Des enc;
-    Des dec;
-
-    const byte key[] =
-    {
-        0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef
-    };
-
-    const byte iv[] =
-    {
-        0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef
-    };
-
-    const byte verify[] =
-    {
-        0x8b,0x7c,0x52,0xb0,0x01,0x2b,0x6c,0xb8,
-        0x4f,0x0f,0xeb,0xf3,0xfb,0x5f,0x86,0x73,
-        0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
-    };
-
-    int ret;
-
-    ret = Des_SetKey(&enc, key, iv, DES_ENCRYPTION);
-    if (ret != 0)
-        return -31;
-
-    Des_CbcEncrypt(&enc, cipher, vector, sizeof(vector));
-    ret = Des_SetKey(&dec, key, iv, DES_DECRYPTION);
-    if (ret != 0)
-        return -32;
-    Des_CbcDecrypt(&dec, plain, cipher, sizeof(cipher));
-
-    if (memcmp(plain, vector, sizeof(plain)))
-        return -33;
-
-    if (memcmp(cipher, verify, sizeof(cipher)))
-        return -34;
-
-    return 0;
-}
-#endif /* NO_DES3 */
-
-
-#ifndef NO_DES3
-int des3_test(void)
-{
-    const byte vector[] = { /* "Now is the time for all " w/o trailing 0 */
-        0x4e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-        0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-        0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-    };
-
-    byte plain[24];
-    byte cipher[24];
-
-    Des3 enc;
-    Des3 dec;
-
-    const byte key3[] =
-    {
-        0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef,
-        0xfe,0xde,0xba,0x98,0x76,0x54,0x32,0x10,
-        0x89,0xab,0xcd,0xef,0x01,0x23,0x45,0x67
-    };
-    const byte iv3[] =
-    {
-        0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef,
-        0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,
-        0x11,0x21,0x31,0x41,0x51,0x61,0x71,0x81
-
-    };
-
-    const byte verify3[] =
-    {
-        0x43,0xa0,0x29,0x7e,0xd1,0x84,0xf8,0x0e,
-        0x89,0x64,0x84,0x32,0x12,0xd5,0x08,0x98,
-        0x18,0x94,0x15,0x74,0x87,0x12,0x7d,0xb0
-    };
-
-    int ret;
-
-
-#ifdef HAVE_CAVIUM
-    if (Des3_InitCavium(&enc, CAVIUM_DEV_ID) != 0)
-        return -20005;
-    if (Des3_InitCavium(&dec, CAVIUM_DEV_ID) != 0)
-        return -20006;
-#endif
-    ret = Des3_SetKey(&enc, key3, iv3, DES_ENCRYPTION);
-    if (ret != 0)
-        return -31;
-    ret = Des3_SetKey(&dec, key3, iv3, DES_DECRYPTION);
-    if (ret != 0)
-        return -32;
-    ret = Des3_CbcEncrypt(&enc, cipher, vector, sizeof(vector));
-    if (ret != 0)
-        return -33;
-    ret = Des3_CbcDecrypt(&dec, plain, cipher, sizeof(cipher));
-    if (ret != 0)
-        return -34;
-
-    if (memcmp(plain, vector, sizeof(plain)))
-        return -35;
-
-    if (memcmp(cipher, verify3, sizeof(cipher)))
-        return -36;
-
-#ifdef HAVE_CAVIUM
-    Des3_FreeCavium(&enc);
-    Des3_FreeCavium(&dec);
-#endif
-    return 0;
-}
-#endif /* NO_DES */
-
-
-#ifndef NO_AES
-int aes_test(void)
-{
-    Aes enc;
-    Aes dec;
-
-    const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */
-        0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-        0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-        0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-    };
-
-    const byte verify[] =
-    {
-        0x95,0x94,0x92,0x57,0x5f,0x42,0x81,0x53,
-        0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
-    };
-
-    byte key[] = "0123456789abcdef   ";  /* align */
-    byte iv[]  = "1234567890abcdef   ";  /* align */
-
-    byte cipher[AES_BLOCK_SIZE * 4];
-    byte plain [AES_BLOCK_SIZE * 4];
-    int  ret;
-
-#ifdef HAVE_CAVIUM
-        if (AesInitCavium(&enc, CAVIUM_DEV_ID) != 0)
-            return -20003;
-        if (AesInitCavium(&dec, CAVIUM_DEV_ID) != 0)
-            return -20004;
-#endif
-    ret = AesSetKey(&enc, key, AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
-    if (ret != 0)
-        return -1001;
-    ret = AesSetKey(&dec, key, AES_BLOCK_SIZE, iv, AES_DECRYPTION);
-    if (ret != 0)
-        return -1002;
-
-    ret = AesCbcEncrypt(&enc, cipher, msg,   AES_BLOCK_SIZE);
-    if (ret != 0)
-        return -1005;
-    ret = AesCbcDecrypt(&dec, plain, cipher, AES_BLOCK_SIZE);
-    if (ret != 0)
-        return -1006;
-
-    if (memcmp(plain, msg, AES_BLOCK_SIZE))
-        return -60;
-
-    if (memcmp(cipher, verify, AES_BLOCK_SIZE))
-        return -61;
-
-#ifdef HAVE_CAVIUM
-        AesFreeCavium(&enc);
-        AesFreeCavium(&dec);
-#endif
-#ifdef CYASSL_AES_COUNTER
-    {
-        const byte ctrKey[] =
-        {
-            0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,
-            0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c
-        };
-
-        const byte ctrIv[] =
-        {
-            0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,
-            0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff
-        };
-
-
-        const byte ctrPlain[] =
-        {
-            0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,
-            0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a,
-            0xae,0x2d,0x8a,0x57,0x1e,0x03,0xac,0x9c,
-            0x9e,0xb7,0x6f,0xac,0x45,0xaf,0x8e,0x51,
-            0x30,0xc8,0x1c,0x46,0xa3,0x5c,0xe4,0x11,
-            0xe5,0xfb,0xc1,0x19,0x1a,0x0a,0x52,0xef,
-            0xf6,0x9f,0x24,0x45,0xdf,0x4f,0x9b,0x17,
-            0xad,0x2b,0x41,0x7b,0xe6,0x6c,0x37,0x10
-        };
-
-        const byte ctrCipher[] =
-        {
-            0x87,0x4d,0x61,0x91,0xb6,0x20,0xe3,0x26,
-            0x1b,0xef,0x68,0x64,0x99,0x0d,0xb6,0xce,
-            0x98,0x06,0xf6,0x6b,0x79,0x70,0xfd,0xff,
-            0x86,0x17,0x18,0x7b,0xb9,0xff,0xfd,0xff,
-            0x5a,0xe4,0xdf,0x3e,0xdb,0xd5,0xd3,0x5e,
-            0x5b,0x4f,0x09,0x02,0x0d,0xb0,0x3e,0xab,
-            0x1e,0x03,0x1d,0xda,0x2f,0xbe,0x03,0xd1,
-            0x79,0x21,0x70,0xa0,0xf3,0x00,0x9c,0xee
-        };
-
-        const byte oddCipher[] =
-        {
-            0xb9,0xd7,0xcb,0x08,0xb0,0xe1,0x7b,0xa0,
-            0xc2
-        };
-
-        AesSetKeyDirect(&enc, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION);
-        /* Ctr only uses encrypt, even on key setup */
-        AesSetKeyDirect(&dec, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION);
-
-        AesCtrEncrypt(&enc, cipher, ctrPlain, AES_BLOCK_SIZE*4);
-        AesCtrEncrypt(&dec, plain, cipher, AES_BLOCK_SIZE*4);
-
-        if (memcmp(plain, ctrPlain, AES_BLOCK_SIZE*4))
-            return -66;
-
-        if (memcmp(cipher, ctrCipher, AES_BLOCK_SIZE*4))
-            return -67;
-
-        /* let's try with just 9 bytes, non block size test */
-        AesSetKeyDirect(&enc, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION);
-        /* Ctr only uses encrypt, even on key setup */
-        AesSetKeyDirect(&dec, ctrKey, AES_BLOCK_SIZE, ctrIv, AES_ENCRYPTION);
-
-        AesCtrEncrypt(&enc, cipher, ctrPlain, 9);
-        AesCtrEncrypt(&dec, plain, cipher, 9);
-
-        if (memcmp(plain, ctrPlain, 9))
-            return -68;
-
-        if (memcmp(cipher, ctrCipher, 9))
-            return -69;
-
-        /* and an additional 9 bytes to reuse tmp left buffer */
-        AesCtrEncrypt(&enc, cipher, ctrPlain, 9);
-        AesCtrEncrypt(&dec, plain, cipher, 9);
-
-        if (memcmp(plain, ctrPlain, 9))
-            return -70;
-
-        if (memcmp(cipher, oddCipher, 9))
-            return -71;
-    }
-#endif /* CYASSL_AES_COUNTER */
-
-#if defined(CYASSL_AESNI) && defined(CYASSL_AES_DIRECT)
-    {
-        const byte niPlain[] =
-        {
-            0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,
-            0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a
-        };
-
-        const byte niCipher[] =
-        {
-            0xf3,0xee,0xd1,0xbd,0xb5,0xd2,0xa0,0x3c,
-            0x06,0x4b,0x5a,0x7e,0x3d,0xb1,0x81,0xf8
-        };
-
-        const byte niKey[] =
-        {
-            0x60,0x3d,0xeb,0x10,0x15,0xca,0x71,0xbe,
-            0x2b,0x73,0xae,0xf0,0x85,0x7d,0x77,0x81,
-            0x1f,0x35,0x2c,0x07,0x3b,0x61,0x08,0xd7,
-            0x2d,0x98,0x10,0xa3,0x09,0x14,0xdf,0xf4
-        };
-
-        XMEMSET(cipher, 0, AES_BLOCK_SIZE);
-        ret = AesSetKey(&enc, niKey, sizeof(niKey), cipher, AES_ENCRYPTION);
-        if (ret != 0)
-            return -1003;
-        AesEncryptDirect(&enc, cipher, niPlain);
-        if (XMEMCMP(cipher, niCipher, AES_BLOCK_SIZE) != 0)
-            return -20006;
-
-        XMEMSET(plain, 0, AES_BLOCK_SIZE);
-        ret = AesSetKey(&dec, niKey, sizeof(niKey), plain, AES_DECRYPTION);
-        if (ret != 0)
-            return -1004;
-        AesDecryptDirect(&dec, plain, niCipher);
-        if (XMEMCMP(plain, niPlain, AES_BLOCK_SIZE) != 0)
-            return -20007;
-    }
-#endif /* CYASSL_AESNI && CYASSL_AES_DIRECT */
-
-    return 0;
-}
-
-#ifdef HAVE_AESGCM
-int aesgcm_test(void)
-{
-    Aes enc;
-
-    /*
-     * This is Test Case 16 from the document Galois/
-     * Counter Mode of Operation (GCM) by McGrew and
-     * Viega.
-     */
-    const byte k[] =
-    {
-        0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
-        0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
-        0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
-        0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08
-    };
-
-    const byte iv[] =
-    {
-        0xca, 0xfe, 0xba, 0xbe, 0xfa, 0xce, 0xdb, 0xad,
-        0xde, 0xca, 0xf8, 0x88
-    };
-
-    const byte p[] =
-    {
-        0xd9, 0x31, 0x32, 0x25, 0xf8, 0x84, 0x06, 0xe5,
-        0xa5, 0x59, 0x09, 0xc5, 0xaf, 0xf5, 0x26, 0x9a,
-        0x86, 0xa7, 0xa9, 0x53, 0x15, 0x34, 0xf7, 0xda,
-        0x2e, 0x4c, 0x30, 0x3d, 0x8a, 0x31, 0x8a, 0x72,
-        0x1c, 0x3c, 0x0c, 0x95, 0x95, 0x68, 0x09, 0x53,
-        0x2f, 0xcf, 0x0e, 0x24, 0x49, 0xa6, 0xb5, 0x25,
-        0xb1, 0x6a, 0xed, 0xf5, 0xaa, 0x0d, 0xe6, 0x57,
-        0xba, 0x63, 0x7b, 0x39
-    };
-
-    const byte a[] =
-    {
-        0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
-        0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
-        0xab, 0xad, 0xda, 0xd2
-    };
-
-    const byte c[] =
-    {
-        0x52, 0x2d, 0xc1, 0xf0, 0x99, 0x56, 0x7d, 0x07,
-        0xf4, 0x7f, 0x37, 0xa3, 0x2a, 0x84, 0x42, 0x7d,
-        0x64, 0x3a, 0x8c, 0xdc, 0xbf, 0xe5, 0xc0, 0xc9,
-        0x75, 0x98, 0xa2, 0xbd, 0x25, 0x55, 0xd1, 0xaa,
-        0x8c, 0xb0, 0x8e, 0x48, 0x59, 0x0d, 0xbb, 0x3d,
-        0xa7, 0xb0, 0x8b, 0x10, 0x56, 0x82, 0x88, 0x38,
-        0xc5, 0xf6, 0x1e, 0x63, 0x93, 0xba, 0x7a, 0x0a,
-        0xbc, 0xc9, 0xf6, 0x62
-    };
-
-    const byte t[] =
-    {
-        0x76, 0xfc, 0x6e, 0xce, 0x0f, 0x4e, 0x17, 0x68,
-        0xcd, 0xdf, 0x88, 0x53, 0xbb, 0x2d, 0x55, 0x1b
-    };
-
-    byte t2[sizeof(t)];
-    byte p2[sizeof(c)];
-    byte c2[sizeof(p)];
-
-    int result;
-
-    memset(t2, 0, sizeof(t2));
-    memset(c2, 0, sizeof(c2));
-    memset(p2, 0, sizeof(p2));
-
-    AesGcmSetKey(&enc, k, sizeof(k));
-    /* AES-GCM encrypt and decrypt both use AES encrypt internally */
-    AesGcmEncrypt(&enc, c2, p, sizeof(c2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (memcmp(c, c2, sizeof(c2)))
-        return -68;
-    if (memcmp(t, t2, sizeof(t2)))
-        return -69;
-
-    result = AesGcmDecrypt(&enc, p2, c2, sizeof(p2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (result != 0)
-        return -70;
-    if (memcmp(p, p2, sizeof(p2)))
-        return -71;
-
-    return 0;
-}
-
-int gmac_test(void)
-{
-    Gmac gmac;
-
-    const byte k1[] =
-    {
-        0x89, 0xc9, 0x49, 0xe9, 0xc8, 0x04, 0xaf, 0x01,
-        0x4d, 0x56, 0x04, 0xb3, 0x94, 0x59, 0xf2, 0xc8
-    };
-    const byte iv1[] =
-    {
-        0xd1, 0xb1, 0x04, 0xc8, 0x15, 0xbf, 0x1e, 0x94,
-        0xe2, 0x8c, 0x8f, 0x16
-    };
-    const byte a1[] =
-    {
-       0x82, 0xad, 0xcd, 0x63, 0x8d, 0x3f, 0xa9, 0xd9,
-       0xf3, 0xe8, 0x41, 0x00, 0xd6, 0x1e, 0x07, 0x77
-    };
-    const byte t1[] =
-    {
-        0x88, 0xdb, 0x9d, 0x62, 0x17, 0x2e, 0xd0, 0x43,
-        0xaa, 0x10, 0xf1, 0x6d, 0x22, 0x7d, 0xc4, 0x1b
-    };
-
-    const byte k2[] =
-    {
-        0x40, 0xf7, 0xec, 0xb2, 0x52, 0x6d, 0xaa, 0xd4,
-        0x74, 0x25, 0x1d, 0xf4, 0x88, 0x9e, 0xf6, 0x5b
-    };
-    const byte iv2[] =
-    {
-        0xee, 0x9c, 0x6e, 0x06, 0x15, 0x45, 0x45, 0x03,
-        0x1a, 0x60, 0x24, 0xa7
-    };
-    const byte a2[] =
-    {
-        0x94, 0x81, 0x2c, 0x87, 0x07, 0x4e, 0x15, 0x18,
-        0x34, 0xb8, 0x35, 0xaf, 0x1c, 0xa5, 0x7e, 0x56
-    };
-    const byte t2[] =
-    {
-        0xc6, 0x81, 0x79, 0x8e, 0x3d, 0xda, 0xb0, 0x9f,
-        0x8d, 0x83, 0xb0, 0xbb, 0x14, 0xb6, 0x91
-    };
-
-    const byte k3[] =
-    {
-        0xb8, 0xe4, 0x9a, 0x5e, 0x37, 0xf9, 0x98, 0x2b,
-        0xb9, 0x6d, 0xd0, 0xc9, 0xb6, 0xab, 0x26, 0xac
-    };
-    const byte iv3[] =
-    {
-        0xe4, 0x4a, 0x42, 0x18, 0x8c, 0xae, 0x94, 0x92,
-        0x6a, 0x9c, 0x26, 0xb0
-    };
-    const byte a3[] =
-    {
-        0x9d, 0xb9, 0x61, 0x68, 0xa6, 0x76, 0x7a, 0x31,
-        0xf8, 0x29, 0xe4, 0x72, 0x61, 0x68, 0x3f, 0x8a
-    };
-    const byte t3[] =
-    {
-        0x23, 0xe2, 0x9f, 0x66, 0xe4, 0xc6, 0x52, 0x48
-    };
-
-    byte tag[16];
-
-    memset(tag, 0, sizeof(tag));
-    GmacSetKey(&gmac, k1, sizeof(k1));
-    GmacUpdate(&gmac, iv1, sizeof(iv1), a1, sizeof(a1), tag, sizeof(t1));
-    if (memcmp(t1, tag, sizeof(t1)) != 0)
-        return -126;
-
-    memset(tag, 0, sizeof(tag));
-    GmacSetKey(&gmac, k2, sizeof(k2));
-    GmacUpdate(&gmac, iv2, sizeof(iv2), a2, sizeof(a2), tag, sizeof(t2));
-    if (memcmp(t2, tag, sizeof(t2)) != 0)
-        return -127;
-
-    memset(tag, 0, sizeof(tag));
-    GmacSetKey(&gmac, k3, sizeof(k3));
-    GmacUpdate(&gmac, iv3, sizeof(iv3), a3, sizeof(a3), tag, sizeof(t3));
-    if (memcmp(t3, tag, sizeof(t3)) != 0)
-        return -128;
-
-    return 0;
-}
-#endif /* HAVE_AESGCM */
-
-#ifdef HAVE_AESCCM
-int aesccm_test(void)
-{
-    Aes enc;
-
-    /* key */
-    const byte k[] =
-    {
-        0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
-        0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf
-    };
-
-    /* nonce */
-    const byte iv[] =
-    {
-        0x00, 0x00, 0x00, 0x03, 0x02, 0x01, 0x00, 0xa0,
-        0xa1, 0xa2, 0xa3, 0xa4, 0xa5
-    };
-
-    /* plaintext */
-    const byte p[] =
-    {
-        0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
-        0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
-        0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e
-    };
-
-    const byte a[] =
-    {
-        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07
-    };
-
-    const byte c[] =
-    {
-        0x58, 0x8c, 0x97, 0x9a, 0x61, 0xc6, 0x63, 0xd2,
-        0xf0, 0x66, 0xd0, 0xc2, 0xc0, 0xf9, 0x89, 0x80,
-        0x6d, 0x5f, 0x6b, 0x61, 0xda, 0xc3, 0x84
-    };
-
-    const byte t[] =
-    {
-        0x17, 0xe8, 0xd1, 0x2c, 0xfd, 0xf9, 0x26, 0xe0
-    };
-
-    byte t2[sizeof(t)];
-    byte p2[sizeof(p)];
-    byte c2[sizeof(c)];
-
-    int result;
-
-    memset(t2, 0, sizeof(t2));
-    memset(c2, 0, sizeof(c2));
-    memset(p2, 0, sizeof(p2));
-
-    AesCcmSetKey(&enc, k, sizeof(k));
-    /* AES-CCM encrypt and decrypt both use AES encrypt internally */
-    AesCcmEncrypt(&enc, c2, p, sizeof(c2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (memcmp(c, c2, sizeof(c2)))
-        return -107;
-    if (memcmp(t, t2, sizeof(t2)))
-        return -108;
-
-    result = AesCcmDecrypt(&enc, p2, c2, sizeof(p2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (result != 0)
-        return -109;
-    if (memcmp(p, p2, sizeof(p2)))
-        return -110;
-
-    /* Test the authentication failure */
-    t2[0]++; /* Corrupt the authentication tag. */
-    result = AesCcmDecrypt(&enc, p2, c, sizeof(p2), iv, sizeof(iv),
-                                                 t2, sizeof(t2), a, sizeof(a));
-    if (result == 0)
-        return -111;
-
-    /* Clear c2 to compare against p2. p2 should be set to zero in case of
-     * authentication fail. */
-    memset(c2, 0, sizeof(c2));
-    if (memcmp(p2, c2, sizeof(p2)))
-        return -112;
-
-    return 0;
-}
-#endif /* HAVE_AESCCM */
-
-
-#endif /* NO_AES */
-
-
-#ifdef HAVE_CAMELLIA
-
-enum {
-    CAM_ECB_ENC, CAM_ECB_DEC, CAM_CBC_ENC, CAM_CBC_DEC
-};
-
-typedef struct {
-    int type;
-    const byte* plaintext;
-    const byte* iv;
-    const byte* ciphertext;
-    const byte* key;
-    word32 keySz;
-    int errorCode;
-} test_vector_t;
-
-int camellia_test(void)
-{
-    /* Camellia ECB Test Plaintext */
-    static const byte pte[] =
-    {
-        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
-        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10
-    };
-
-    /* Camellia ECB Test Initialization Vector */
-    static const byte ive[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
-
-    /* Test 1: Camellia ECB 128-bit key */
-    static const byte k1[] =
-    {
-        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
-        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10
-    };
-    static const byte c1[] =
-    {
-        0x67, 0x67, 0x31, 0x38, 0x54, 0x96, 0x69, 0x73,
-        0x08, 0x57, 0x06, 0x56, 0x48, 0xea, 0xbe, 0x43
-    };
-
-    /* Test 2: Camellia ECB 192-bit key */
-    static const byte k2[] =
-    {
-        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
-        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
-        0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77
-    };
-    static const byte c2[] =
-    {
-        0xb4, 0x99, 0x34, 0x01, 0xb3, 0xe9, 0x96, 0xf8,
-        0x4e, 0xe5, 0xce, 0xe7, 0xd7, 0x9b, 0x09, 0xb9
-    };
-
-    /* Test 3: Camellia ECB 256-bit key */
-    static const byte k3[] =
-    {
-        0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
-        0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54, 0x32, 0x10,
-        0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
-        0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff
-    };
-    static const byte c3[] =
-    {
-        0x9a, 0xcc, 0x23, 0x7d, 0xff, 0x16, 0xd7, 0x6c,
-        0x20, 0xef, 0x7c, 0x91, 0x9e, 0x3a, 0x75, 0x09
-    };
-
-    /* Camellia CBC Test Plaintext */
-    static const byte ptc[] =
-    {
-        0x6B, 0xC1, 0xBE, 0xE2, 0x2E, 0x40, 0x9F, 0x96,
-        0xE9, 0x3D, 0x7E, 0x11, 0x73, 0x93, 0x17, 0x2A
-    };
-
-    /* Camellia CBC Test Initialization Vector */
-    static const byte ivc[] =
-    {
-        0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-        0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F
-    };
-
-    /* Test 4: Camellia-CBC 128-bit key */
-    static const byte k4[] =
-    {
-        0x2B, 0x7E, 0x15, 0x16, 0x28, 0xAE, 0xD2, 0xA6,
-        0xAB, 0xF7, 0x15, 0x88, 0x09, 0xCF, 0x4F, 0x3C
-    };
-    static const byte c4[] =
-    {
-        0x16, 0x07, 0xCF, 0x49, 0x4B, 0x36, 0xBB, 0xF0,
-        0x0D, 0xAE, 0xB0, 0xB5, 0x03, 0xC8, 0x31, 0xAB
-    };
-
-    /* Test 5: Camellia-CBC 192-bit key */
-    static const byte k5[] =
-    {
-        0x8E, 0x73, 0xB0, 0xF7, 0xDA, 0x0E, 0x64, 0x52,
-        0xC8, 0x10, 0xF3, 0x2B, 0x80, 0x90, 0x79, 0xE5,
-        0x62, 0xF8, 0xEA, 0xD2, 0x52, 0x2C, 0x6B, 0x7B
-    };
-    static const byte c5[] =
-    {
-        0x2A, 0x48, 0x30, 0xAB, 0x5A, 0xC4, 0xA1, 0xA2,
-        0x40, 0x59, 0x55, 0xFD, 0x21, 0x95, 0xCF, 0x93
-    };
-
-    /* Test 6: CBC 256-bit key */
-    static const byte k6[] =
-    {
-        0x60, 0x3D, 0xEB, 0x10, 0x15, 0xCA, 0x71, 0xBE,
-        0x2B, 0x73, 0xAE, 0xF0, 0x85, 0x7D, 0x77, 0x81,
-        0x1F, 0x35, 0x2C, 0x07, 0x3B, 0x61, 0x08, 0xD7,
-        0x2D, 0x98, 0x10, 0xA3, 0x09, 0x14, 0xDF, 0xF4
-    };
-    static const byte c6[] =
-    {
-        0xE6, 0xCF, 0xA3, 0x5F, 0xC0, 0x2B, 0x13, 0x4A,
-        0x4D, 0x2C, 0x0B, 0x67, 0x37, 0xAC, 0x3E, 0xDA
-    };
-
-    byte out[CAMELLIA_BLOCK_SIZE];
-    Camellia cam;
-    int i, testsSz;
-    const test_vector_t testVectors[] =
-    {
-        {CAM_ECB_ENC, pte, ive, c1, k1, sizeof(k1), -114},
-        {CAM_ECB_ENC, pte, ive, c2, k2, sizeof(k2), -115},
-        {CAM_ECB_ENC, pte, ive, c3, k3, sizeof(k3), -116},
-        {CAM_ECB_DEC, pte, ive, c1, k1, sizeof(k1), -117},
-        {CAM_ECB_DEC, pte, ive, c2, k2, sizeof(k2), -118},
-        {CAM_ECB_DEC, pte, ive, c3, k3, sizeof(k3), -119},
-        {CAM_CBC_ENC, ptc, ivc, c4, k4, sizeof(k4), -120},
-        {CAM_CBC_ENC, ptc, ivc, c5, k5, sizeof(k5), -121},
-        {CAM_CBC_ENC, ptc, ivc, c6, k6, sizeof(k6), -122},
-        {CAM_CBC_DEC, ptc, ivc, c4, k4, sizeof(k4), -123},
-        {CAM_CBC_DEC, ptc, ivc, c5, k5, sizeof(k5), -124},
-        {CAM_CBC_DEC, ptc, ivc, c6, k6, sizeof(k6), -125}
-    };
-
-    testsSz = sizeof(testVectors)/sizeof(test_vector_t);
-    for (i = 0; i < testsSz; i++) {
-        if (CamelliaSetKey(&cam, testVectors[i].key, testVectors[i].keySz,
-                                                        testVectors[i].iv) != 0)
-            return testVectors[i].errorCode;
-
-        switch (testVectors[i].type) {
-            case CAM_ECB_ENC:
-                CamelliaEncryptDirect(&cam, out, testVectors[i].plaintext);
-                if (memcmp(out, testVectors[i].ciphertext, CAMELLIA_BLOCK_SIZE))
-                    return testVectors[i].errorCode;
-                break;
-            case CAM_ECB_DEC:
-                CamelliaDecryptDirect(&cam, out, testVectors[i].ciphertext);
-                if (memcmp(out, testVectors[i].plaintext, CAMELLIA_BLOCK_SIZE))
-                    return testVectors[i].errorCode;
-                break;
-            case CAM_CBC_ENC:
-                CamelliaCbcEncrypt(&cam, out, testVectors[i].plaintext,
-                                                           CAMELLIA_BLOCK_SIZE);
-                if (memcmp(out, testVectors[i].ciphertext, CAMELLIA_BLOCK_SIZE))
-                    return testVectors[i].errorCode;
-                break;
-            case CAM_CBC_DEC:
-                CamelliaCbcDecrypt(&cam, out, testVectors[i].ciphertext,
-                                                           CAMELLIA_BLOCK_SIZE);
-                if (memcmp(out, testVectors[i].plaintext, CAMELLIA_BLOCK_SIZE))
-                    return testVectors[i].errorCode;
-                break;
-            default:
-                break;
-        }
-    }
-
-    /* Setting the IV and checking it was actually set. */
-    CamelliaSetIV(&cam, ivc);
-    if (XMEMCMP(cam.reg, ivc, CAMELLIA_BLOCK_SIZE))
-        return -1;
-
-    /* Setting the IV to NULL should be same as all zeros IV */
-    if (CamelliaSetIV(&cam, NULL) != 0 ||
-                                    XMEMCMP(cam.reg, ive, CAMELLIA_BLOCK_SIZE))
-        return -1;
-
-    /* First parameter should never be null */
-    if (CamelliaSetIV(NULL, NULL) == 0)
-        return -1;
-
-    /* First parameter should never be null, check it fails */
-    if (CamelliaSetKey(NULL, k1, sizeof(k1), NULL) == 0)
-        return -1;
-
-    /* Key should have a size of 16, 24, or 32 */
-    if (CamelliaSetKey(&cam, k1, 0, NULL) == 0)
-        return -1;
-
-    return 0;
-}
-#endif /* HAVE_CAMELLIA */
-
-
-int random_test(void)
-{
-    WC_RNG rng;
-    byte block[32];
-    int ret;
-
-#ifdef HAVE_CAVIUM
-    ret = InitRngCavium(&rng, CAVIUM_DEV_ID);
-    if (ret != 0) return -2007;
-#endif
-    ret = InitRng(&rng);
-    if (ret != 0) return -39;
-
-    ret = RNG_GenerateBlock(&rng, block, sizeof(block));
-    if (ret != 0) return -40;
-
-    return 0;
-}
-
-
-#ifdef HAVE_NTRU
-
-byte GetEntropy(ENTROPY_CMD cmd, byte* out);
-
-byte GetEntropy(ENTROPY_CMD cmd, byte* out)
-{
-    static WC_RNG rng;
-
-    if (cmd == INIT)
-        return (InitRng(&rng) == 0) ? 1 : 0;
-
-    if (out == NULL)
-        return 0;
-
-    if (cmd == GET_BYTE_OF_ENTROPY)
-        return (RNG_GenerateBlock(&rng, out, 1) == 0) ? 1 : 0;
-
-    if (cmd == GET_NUM_BYTES_PER_BYTE_OF_ENTROPY) {
-        *out = 1;
-        return 1;
-    }
-
-    return 0;
-}
-
-#endif /* HAVE_NTRU */
-
-#ifndef NO_RSA
-
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    #ifdef FREESCALE_MQX
-        static const char* clientKey  = "a:\\certs\\client-key.der";
-        static const char* clientCert = "a:\\certs\\client-cert.der";
-        #ifdef CYASSL_CERT_GEN
-            static const char* caKeyFile  = "a:\\certs\\ca-key.der";
-            static const char* caCertFile = "a:\\certs\\ca-cert.pem";
-            #ifdef HAVE_ECC
-                static const char* eccCaKeyFile  = "a:\\certs\\ecc-key.der";
-                static const char* eccCaCertFile = "a:\\certs\\server-ecc.pem";
-            #endif
-        #endif
-    #elif defined(CYASSL_MKD_SHELL)
-        static char* clientKey = "certs/client-key.der";
-        static char* clientCert = "certs/client-cert.der";
-        void set_clientKey(char *key) {  clientKey = key ; }
-        void set_clientCert(char *cert) {  clientCert = cert ; }
-        #ifdef CYASSL_CERT_GEN
-            static char* caKeyFile  = "certs/ca-key.der";
-            static char* caCertFile = "certs/ca-cert.pem";
-            void set_caKeyFile (char * key)  { caKeyFile   = key ; }
-            void set_caCertFile(char * cert) { caCertFile = cert ; }
-            #ifdef HAVE_ECC
-                static const char* eccCaKeyFile  = "certs/ecc-key.der";
-                static const char* eccCaCertFile = "certs/server-ecc.pem";
-                void set_eccCaKeyFile (char * key)  { eccCaKeyFile  = key ; }
-                void set_eccCaCertFile(char * cert) { eccCaCertFile = cert ; }
-            #endif
-        #endif
-    #else
-        static const char* clientKey  = "./certs/client-key.der";
-        static const char* clientCert = "./certs/client-cert.der";
-        #ifdef CYASSL_CERT_GEN
-            static const char* caKeyFile  = "./certs/ca-key.der";
-            static const char* caCertFile = "./certs/ca-cert.pem";
-            #ifdef HAVE_ECC
-                static const char* eccCaKeyFile  = "./certs/ecc-key.der";
-                static const char* eccCaCertFile = "./certs/server-ecc.pem";
-            #endif
-        #endif
-    #endif
-#endif
-
-
-
-#define FOURK_BUF 4096
-
-int rsa_test(void)
-{
-    byte*   tmp;
-    size_t bytes;
-    RsaKey key;
-    WC_RNG rng;
-    word32 idx = 0;
-    int    ret;
-    byte   in[] = "Everyone gets Friday off.";
-    word32 inLen = (word32)strlen((char*)in);
-    byte   out[256];
-    byte   plain[256];
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    FILE*  file, * file2;
-#endif
-#ifdef CYASSL_TEST_CERT
-    DecodedCert cert;
-#endif
-
-    tmp = (byte*)malloc(FOURK_BUF);
-    if (tmp == NULL)
-        return -40;
-
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, client_key_der_1024, sizeof_client_key_der_1024);
-    bytes = sizeof_client_key_der_1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, client_key_der_2048, sizeof_client_key_der_2048);
-    bytes = sizeof_client_key_der_2048;
-#else
-    file = fopen(clientKey, "rb");
-
-    if (!file)
-        err_sys("can't open ./certs/client-key.der, "
-                "Please run from CyaSSL home dir", -40);
-
-    bytes = fread(tmp, 1, FOURK_BUF, file);
-    fclose(file);
-#endif /* USE_CERT_BUFFERS */
-
-#ifdef HAVE_CAVIUM
-    RsaInitCavium(&key, CAVIUM_DEV_ID);
-#endif
-    ret = InitRsaKey(&key, 0);
-    if (ret != 0) return -39;
-    ret = RsaPrivateKeyDecode(tmp, &idx, &key, (word32)bytes);
-    if (ret != 0) return -41;
-
-    ret = InitRng(&rng);
-    if (ret != 0) return -42;
-
-    ret = RsaPublicEncrypt(in, inLen, out, sizeof(out), &key, &rng);
-    if (ret < 0) return -43;
-
-    ret = RsaPrivateDecrypt(out, ret, plain, sizeof(plain), &key);
-    if (ret < 0) return -44;
-
-    if (memcmp(plain, in, inLen)) return -45;
-
-    ret = RsaSSL_Sign(in, inLen, out, sizeof(out), &key, &rng);
-    if (ret < 0) return -46;
-
-    memset(plain, 0, sizeof(plain));
-    ret = RsaSSL_Verify(out, ret, plain, sizeof(plain), &key);
-    if (ret < 0) return -47;
-
-    if (memcmp(plain, in, ret)) return -48;
-
-#if defined(CYASSL_MDK_ARM)
-    #define sizeof(s) strlen((char *)(s))
-#endif
-
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, client_cert_der_1024, sizeof_client_cert_der_1024);
-    bytes = sizeof_client_cert_der_1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, client_cert_der_2048, sizeof_client_cert_der_2048);
-    bytes = sizeof_client_cert_der_2048;
-#else
-    file2 = fopen(clientCert, "rb");
-    if (!file2)
-        return -49;
-
-    bytes = fread(tmp, 1, FOURK_BUF, file2);
-    fclose(file2);
-#endif
-
-#ifdef sizeof
-		#undef sizeof
-#endif
-
-#ifdef CYASSL_TEST_CERT
-    InitDecodedCert(&cert, tmp, (word32)bytes, 0);
-
-    ret = ParseCert(&cert, CERT_TYPE, NO_VERIFY, 0);
-    if (ret != 0) return -491;
-
-    FreeDecodedCert(&cert);
-#else
-    (void)bytes;
-#endif
-
-
-#ifdef CYASSL_KEY_GEN
-    {
-        byte*  der;
-        byte*  pem;
-        int    derSz = 0;
-        int    pemSz = 0;
-        RsaKey derIn;
-        RsaKey genKey;
-        FILE* keyFile;
-        FILE* pemFile;
-
-        ret = InitRsaKey(&genKey, 0);
-        if (ret != 0)
-            return -300;
-        ret = MakeRsaKey(&genKey, 1024, 65537, &rng);
-        if (ret != 0)
-            return -301;
-
-        der = (byte*)malloc(FOURK_BUF);
-        if (der == NULL) {
-            FreeRsaKey(&genKey);
-            return -307;
-        }
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(der);
-            FreeRsaKey(&genKey);
-            return -308;
-        }
-
-        derSz = RsaKeyToDer(&genKey, der, FOURK_BUF);
-        if (derSz < 0) {
-            free(der);
-            free(pem);
-            return -302;
-        }
-
-        keyFile = fopen("./key.der", "wb");
-        if (!keyFile) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -303;
-        }
-        ret = (int)fwrite(der, 1, derSz, keyFile);
-        fclose(keyFile);
-        if (ret != derSz) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -313;
-        }
-
-        pemSz = DerToPem(der, derSz, pem, FOURK_BUF, PRIVATEKEY_TYPE);
-        if (pemSz < 0) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -304;
-        }
-
-        pemFile = fopen("./key.pem", "wb");
-        if (!pemFile) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -305;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        fclose(pemFile);
-        if (ret != pemSz) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -314;
-        }
-
-        ret = InitRsaKey(&derIn, 0);
-        if (ret != 0) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&genKey);
-            return -3060;
-        }
-        idx = 0;
-        ret = RsaPrivateKeyDecode(der, &idx, &derIn, derSz);
-        if (ret != 0) {
-            free(der);
-            free(pem);
-            FreeRsaKey(&derIn);
-            FreeRsaKey(&genKey);
-            return -306;
-        }
-
-        FreeRsaKey(&derIn);
-        FreeRsaKey(&genKey);
-        free(pem);
-        free(der);
-    }
-#endif /* CYASSL_KEY_GEN */
-
-
-#ifdef CYASSL_CERT_GEN
-    /* self signed */
-    {
-        Cert        myCert;
-        byte*       derCert;
-        byte*       pem;
-        FILE*       derFile;
-        FILE*       pemFile;
-        int         certSz;
-        int         pemSz;
-#ifdef CYASSL_TEST_CERT
-        DecodedCert decode;
-#endif
-
-        derCert = (byte*)malloc(FOURK_BUF);
-        if (derCert == NULL)
-            return -309;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(derCert);
-            return -310;
-        }
-
-        InitCert(&myCert);
-
-        strncpy(myCert.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(myCert.subject.org, "yaSSL", CTC_NAME_SIZE);
-        strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(myCert.subject.commonName, "www.yassl.com", CTC_NAME_SIZE);
-        strncpy(myCert.subject.email, "info@yassl.com", CTC_NAME_SIZE);
-        myCert.isCA    = 1;
-        myCert.sigType = CTC_SHA256wRSA;
-
-        certSz = MakeSelfCert(&myCert, derCert, FOURK_BUF, &key, &rng);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            return -401;
-        }
-
-#ifdef CYASSL_TEST_CERT
-        InitDecodedCert(&decode, derCert, certSz, 0);
-        ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -402;
-        }
-        FreeDecodedCert(&decode);
-#endif
-        derFile = fopen("./cert.der", "wb");
-        if (!derFile) {
-            free(derCert);
-            free(pem);
-            return -403;
-        }
-        ret = (int)fwrite(derCert, 1, certSz, derFile);
-        fclose(derFile);
-        if (ret != certSz) {
-            free(derCert);
-            free(pem);
-            return -414;
-        }
-
-        pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE);
-        if (pemSz < 0) {
-            free(derCert);
-            free(pem);
-            return -404;
-        }
-
-        pemFile = fopen("./cert.pem", "wb");
-        if (!pemFile) {
-            free(derCert);
-            free(pem);
-            return -405;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        fclose(pemFile);
-        if (ret != pemSz) {
-            free(derCert);
-            free(pem);
-            return -406;
-        }
-        free(pem);
-        free(derCert);
-    }
-    /* CA style */
-    {
-        RsaKey      caKey;
-        Cert        myCert;
-        byte*       derCert;
-        byte*       pem;
-        FILE*       derFile;
-        FILE*       pemFile;
-        int         certSz;
-        int         pemSz;
-        size_t      bytes3;
-        word32      idx3 = 0;
-			  FILE* file3 ;
-#ifdef CYASSL_TEST_CERT
-        DecodedCert decode;
-#endif
-
-        derCert = (byte*)malloc(FOURK_BUF);
-        if (derCert == NULL)
-            return -311;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(derCert);
-            return -312;
-        }
-
-        file3 = fopen(caKeyFile, "rb");
-
-        if (!file3) {
-            free(derCert);
-            free(pem);
-            return -412;
-        }
-
-        bytes3 = fread(tmp, 1, FOURK_BUF, file3);
-        fclose(file3);
-
-        ret = InitRsaKey(&caKey, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -411;
-        }
-        ret = RsaPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes3);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -413;
-        }
-
-        InitCert(&myCert);
-
-        strncpy(myCert.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(myCert.subject.org, "yaSSL", CTC_NAME_SIZE);
-        strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(myCert.subject.commonName, "www.yassl.com", CTC_NAME_SIZE);
-        strncpy(myCert.subject.email, "info@yassl.com", CTC_NAME_SIZE);
-
-        ret = SetIssuer(&myCert, caCertFile);
-        if (ret < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -405;
-        }
-
-        certSz = MakeCert(&myCert, derCert, FOURK_BUF, &key, NULL, &rng);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -407;
-        }
-
-        certSz = SignCert(myCert.bodySz, myCert.sigType, derCert, FOURK_BUF,
-                          &caKey, NULL, &rng);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -408;
-        }
-
-
-#ifdef CYASSL_TEST_CERT
-        InitDecodedCert(&decode, derCert, certSz, 0);
-        ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -409;
-        }
-        FreeDecodedCert(&decode);
-#endif
-
-        derFile = fopen("./othercert.der", "wb");
-        if (!derFile) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -410;
-        }
-        ret = (int)fwrite(derCert, 1, certSz, derFile);
-        fclose(derFile);
-        if (ret != certSz) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -416;
-        }
-
-        pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE);
-        if (pemSz < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -411;
-        }
-
-        pemFile = fopen("./othercert.pem", "wb");
-        if (!pemFile) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -412;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        if (ret != pemSz) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -415;
-        }
-        fclose(pemFile);
-        free(pem);
-        free(derCert);
-        FreeRsaKey(&caKey);
-    }
-#ifdef HAVE_ECC
-    /* ECC CA style */
-    {
-        ecc_key     caKey;
-        Cert        myCert;
-        byte*       derCert;
-        byte*       pem;
-        FILE*       derFile;
-        FILE*       pemFile;
-        int         certSz;
-        int         pemSz;
-        size_t      bytes3;
-        word32      idx3 = 0;
-        FILE*       file3;
-#ifdef CYASSL_TEST_CERT
-        DecodedCert decode;
-#endif
-
-        derCert = (byte*)malloc(FOURK_BUF);
-        if (derCert == NULL)
-            return -5311;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(derCert);
-            return -5312;
-        }
-
-        file3 = fopen(eccCaKeyFile, "rb");
-
-        if (!file3) {
-            free(derCert);
-            free(pem);
-            return -5412;
-        }
-
-        bytes3 = fread(tmp, 1, FOURK_BUF, file3);
-        fclose(file3);
-
-        ecc_init(&caKey);
-        ret = EccPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes3);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -5413;
-        }
-
-        InitCert(&myCert);
-        myCert.sigType = CTC_SHA256wECDSA;
-
-        strncpy(myCert.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(myCert.subject.org, "wolfSSL", CTC_NAME_SIZE);
-        strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(myCert.subject.commonName, "www.wolfssl.com", CTC_NAME_SIZE);
-        strncpy(myCert.subject.email, "info@wolfssl.com", CTC_NAME_SIZE);
-
-        ret = SetIssuer(&myCert, eccCaCertFile);
-        if (ret < 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5405;
-        }
-
-        certSz = MakeCert(&myCert, derCert, FOURK_BUF, NULL, &caKey, &rng);
-        if (certSz < 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5407;
-        }
-
-        certSz = SignCert(myCert.bodySz, myCert.sigType, derCert, FOURK_BUF,
-                          NULL, &caKey, &rng);
-        if (certSz < 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5408;
-        }
-
-#ifdef CYASSL_TEST_CERT
-        InitDecodedCert(&decode, derCert, certSz, 0);
-        ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
-        if (ret != 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5409;
-        }
-        FreeDecodedCert(&decode);
-#endif
-
-        derFile = fopen("./certecc.der", "wb");
-        if (!derFile) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5410;
-        }
-        ret = (int)fwrite(derCert, 1, certSz, derFile);
-        fclose(derFile);
-        if (ret != certSz) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5414;
-        }
-
-        pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE);
-        if (pemSz < 0) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5411;
-        }
-
-        pemFile = fopen("./certecc.pem", "wb");
-        if (!pemFile) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5412;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        if (ret != pemSz) {
-            free(pem);
-            free(derCert);
-            ecc_free(&caKey);
-            return -5415;
-        }
-        fclose(pemFile);
-        free(pem);
-        free(derCert);
-        ecc_free(&caKey);
-    }
-#endif /* HAVE_ECC */
-#ifdef HAVE_NTRU
-    {
-        RsaKey      caKey;
-        Cert        myCert;
-        byte*       derCert;
-        byte*       pem;
-        FILE*       derFile;
-        FILE*       pemFile;
-        FILE*       caFile;
-        FILE*       ntruPrivFile;
-        int         certSz;
-        int         pemSz;
-        word32      idx3;
-#ifdef CYASSL_TEST_CERT
-        DecodedCert decode;
-#endif
-        derCert = (byte*)malloc(FOURK_BUF);
-        if (derCert == NULL)
-            return -311;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(derCert);
-            return -312;
-        }
-
-        byte   public_key[557];          /* sized for EES401EP2 */
-        word16 public_key_len;           /* no. of octets in public key */
-        byte   private_key[607];         /* sized for EES401EP2 */
-        word16 private_key_len;          /* no. of octets in private key */
-        DRBG_HANDLE drbg;
-        static uint8_t const pers_str[] = {
-                'C', 'y', 'a', 'S', 'S', 'L', ' ', 't', 'e', 's', 't'
-        };
-        word32 rc = crypto_drbg_instantiate(112, pers_str, sizeof(pers_str),
-                                            GetEntropy, &drbg);
-        if (rc != DRBG_OK) {
-            free(derCert);
-            free(pem);
-            return -450;
-        }
-
-        rc = crypto_ntru_encrypt_keygen(drbg, NTRU_EES401EP2, &public_key_len,
-                                        NULL, &private_key_len, NULL);
-        if (rc != NTRU_OK) {
-            free(derCert);
-            free(pem);
-            return -451;
-        }
-
-        rc = crypto_ntru_encrypt_keygen(drbg, NTRU_EES401EP2, &public_key_len,
-                                     public_key, &private_key_len, private_key);
-        crypto_drbg_uninstantiate(drbg);
-
-        if (rc != NTRU_OK) {
-            free(derCert);
-            free(pem);
-            return -452;
-        }
-
-        caFile = fopen(caKeyFile, "rb");
-
-        if (!caFile) {
-            free(derCert);
-            free(pem);
-            return -453;
-        }
-
-        bytes = fread(tmp, 1, FOURK_BUF, caFile);
-        fclose(caFile);
-
-        ret = InitRsaKey(&caKey, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -459;
-        }
-        ret = RsaPrivateKeyDecode(tmp, &idx3, &caKey, (word32)bytes);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -454;
-        }
-
-        InitCert(&myCert);
-
-        strncpy(myCert.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(myCert.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(myCert.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(myCert.subject.org, "yaSSL", CTC_NAME_SIZE);
-        strncpy(myCert.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(myCert.subject.commonName, "www.yassl.com", CTC_NAME_SIZE);
-        strncpy(myCert.subject.email, "info@yassl.com", CTC_NAME_SIZE);
-
-        ret = SetIssuer(&myCert, caCertFile);
-        if (ret < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -455;
-        }
-
-        certSz = MakeNtruCert(&myCert, derCert, FOURK_BUF, public_key,
-                              public_key_len, &rng);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            FreeRsaKey(&caKey);
-            return -456;
-        }
-
-        certSz = SignCert(myCert.bodySz, myCert.sigType, derCert, FOURK_BUF,
-                          &caKey, NULL, &rng);
-        FreeRsaKey(&caKey);
-        if (certSz < 0) {
-            free(derCert);
-            free(pem);
-            return -457;
-        }
-
-
-#ifdef CYASSL_TEST_CERT
-        InitDecodedCert(&decode, derCert, certSz, 0);
-        ret = ParseCert(&decode, CERT_TYPE, NO_VERIFY, 0);
-        if (ret != 0) {
-            free(derCert);
-            free(pem);
-            return -458;
-        }
-        FreeDecodedCert(&decode);
-#endif
-        derFile = fopen("./ntru-cert.der", "wb");
-        if (!derFile) {
-            free(derCert);
-            free(pem);
-            return -459;
-        }
-        ret = (int)fwrite(derCert, 1, certSz, derFile);
-        fclose(derFile);
-        if (ret != certSz) {
-            free(derCert);
-            free(pem);
-            return -473;
-        }
-
-        pemSz = DerToPem(derCert, certSz, pem, FOURK_BUF, CERT_TYPE);
-        if (pemSz < 0) {
-            free(derCert);
-            free(pem);
-            return -460;
-        }
-
-        pemFile = fopen("./ntru-cert.pem", "wb");
-        if (!pemFile) {
-            free(derCert);
-            free(pem);
-            return -461;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, pemFile);
-        fclose(pemFile);
-        if (ret != pemSz) {
-            free(derCert);
-            free(pem);
-            return -474;
-        }
-
-        ntruPrivFile = fopen("./ntru-key.raw", "wb");
-        if (!ntruPrivFile) {
-            free(derCert);
-            free(pem);
-            return -462;
-        }
-        ret = (int)fwrite(private_key, 1, private_key_len, ntruPrivFile);
-        fclose(ntruPrivFile);
-        if (ret != private_key_len) {
-            free(pem);
-            free(derCert);
-            return -475;
-        }
-        free(pem);
-        free(derCert);
-    }
-#endif /* HAVE_NTRU */
-#ifdef CYASSL_CERT_REQ
-    {
-        Cert        req;
-        byte*       der;
-        byte*       pem;
-        int         derSz;
-        int         pemSz;
-        FILE*       reqFile;
-
-        der = (byte*)malloc(FOURK_BUF);
-        if (der == NULL)
-            return -463;
-        pem = (byte*)malloc(FOURK_BUF);
-        if (pem == NULL) {
-            free(der);
-            return -464;
-        }
-
-        InitCert(&req);
-
-        req.version = 0;
-        req.isCA    = 1;
-        strncpy(req.challengePw, "yassl123", CTC_NAME_SIZE);
-        strncpy(req.subject.country, "US", CTC_NAME_SIZE);
-        strncpy(req.subject.state, "OR", CTC_NAME_SIZE);
-        strncpy(req.subject.locality, "Portland", CTC_NAME_SIZE);
-        strncpy(req.subject.org, "yaSSL", CTC_NAME_SIZE);
-        strncpy(req.subject.unit, "Development", CTC_NAME_SIZE);
-        strncpy(req.subject.commonName, "www.yassl.com", CTC_NAME_SIZE);
-        strncpy(req.subject.email, "info@yassl.com", CTC_NAME_SIZE);
-        req.sigType = CTC_SHA256wRSA;
-
-        derSz = MakeCertReq(&req, der, FOURK_BUF, &key, NULL);
-        if (derSz < 0) {
-            free(pem);
-            free(der);
-            return -465;
-        }
-
-        derSz = SignCert(req.bodySz, req.sigType, der, FOURK_BUF,
-                          &key, NULL, &rng);
-        if (derSz < 0) {
-            free(pem);
-            free(der);
-            return -466;
-        }
-
-        pemSz = DerToPem(der, derSz, pem, FOURK_BUF, CERTREQ_TYPE);
-        if (pemSz < 0) {
-            free(pem);
-            free(der);
-            return -467;
-        }
-
-        reqFile = fopen("./certreq.der", "wb");
-        if (!reqFile) {
-            free(pem);
-            free(der);
-            return -468;
-        }
-
-        ret = (int)fwrite(der, 1, derSz, reqFile);
-        fclose(reqFile);
-        if (ret != derSz) {
-            free(pem);
-            free(der);
-            return -471;
-        }
-
-        reqFile = fopen("./certreq.pem", "wb");
-        if (!reqFile) {
-            free(pem);
-            free(der);
-            return -469;
-        }
-        ret = (int)fwrite(pem, 1, pemSz, reqFile);
-        fclose(reqFile);
-        if (ret != pemSz) {
-            free(pem);
-            free(der);
-            return -470;
-        }
-
-        free(pem);
-        free(der);
-    }
-#endif /* CYASSL_CERT_REQ */
-#endif /* CYASSL_CERT_GEN */
-
-    FreeRsaKey(&key);
-#ifdef HAVE_CAVIUM
-    RsaFreeCavium(&key);
-#endif
-    free(tmp);
-
-    return 0;
-}
-
-#endif
-
-
-#ifndef NO_DH
-
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    #ifdef FREESCALE_MQX
-        static const char* dhKey = "a:\certs\\dh2048.der";
-    #else
-        static const char* dhKey = "./certs/dh2048.der";
-    #endif
-#endif
-
-int dh_test(void)
-{
-    int    ret;
-    word32 bytes;
-    word32 idx = 0, privSz, pubSz, privSz2, pubSz2, agreeSz, agreeSz2;
-    byte   tmp[1024];
-    byte   priv[256];
-    byte   pub[256];
-    byte   priv2[256];
-    byte   pub2[256];
-    byte   agree[256];
-    byte   agree2[256];
-    DhKey  key;
-    DhKey  key2;
-    WC_RNG rng;
-
-
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, dh_key_der_1024, sizeof_dh_key_der_1024);
-    bytes = sizeof_dh_key_der_1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, dh_key_der_2048, sizeof_dh_key_der_2048);
-    bytes = sizeof_dh_key_der_2048;
-#else
-    FILE*  file = fopen(dhKey, "rb");
-
-    if (!file)
-        return -50;
-
-    bytes = (word32) fread(tmp, 1, sizeof(tmp), file);
-    fclose(file);
-#endif /* USE_CERT_BUFFERS */
-
-    InitDhKey(&key);
-    InitDhKey(&key2);
-    ret = DhKeyDecode(tmp, &idx, &key, bytes);
-    if (ret != 0)
-        return -51;
-
-    idx = 0;
-    ret = DhKeyDecode(tmp, &idx, &key2, bytes);
-    if (ret != 0)
-        return -52;
-
-    ret = InitRng(&rng);
-    if (ret != 0)
-        return -53;
-
-    ret =  DhGenerateKeyPair(&key, &rng, priv, &privSz, pub, &pubSz);
-    ret += DhGenerateKeyPair(&key2, &rng, priv2, &privSz2, pub2, &pubSz2);
-    if (ret != 0)
-        return -54;
-
-    ret =  DhAgree(&key, agree, &agreeSz, priv, privSz, pub2, pubSz2);
-    ret += DhAgree(&key2, agree2, &agreeSz2, priv2, privSz2, pub, pubSz);
-    if (ret != 0)
-        return -55;
-
-    if (memcmp(agree, agree2, agreeSz))
-        return -56;
-
-    FreeDhKey(&key);
-    FreeDhKey(&key2);
-
-    return 0;
-}
-
-#endif /* NO_DH */
-
-
-#ifndef NO_DSA
-
-#if !defined(USE_CERT_BUFFERS_1024) && !defined(USE_CERT_BUFFERS_2048)
-    #ifdef FREESCALE_MQX
-        static const char* dsaKey = "a:\\certs\\dsa2048.der";
-    #else
-        static const char* dsaKey = "./certs/dsa2048.der";
-    #endif
-#endif
-
-int dsa_test(void)
-{
-    int    ret, answer;
-    word32 bytes;
-    word32 idx = 0;
-    byte   tmp[1024];
-    DsaKey key;
-    WC_RNG rng;
-    Sha    sha;
-    byte   hash[SHA_DIGEST_SIZE];
-    byte   signature[40];
-
-
-#ifdef USE_CERT_BUFFERS_1024
-    XMEMCPY(tmp, dsa_key_der_1024, sizeof_dsa_key_der_1024);
-    bytes = sizeof_dsa_key_der_1024;
-#elif defined(USE_CERT_BUFFERS_2048)
-    XMEMCPY(tmp, dsa_key_der_2048, sizeof_dsa_key_der_2048);
-    bytes = sizeof_dsa_key_der_2048;
-#else
-    FILE*  file = fopen(dsaKey, "rb");
-
-    if (!file)
-        return -60;
-
-    bytes = (word32) fread(tmp, 1, sizeof(tmp), file);
-    fclose(file);
-#endif /* USE_CERT_BUFFERS */
-
-    ret = InitSha(&sha);
-    if (ret != 0)
-        return -4002;
-    ShaUpdate(&sha, tmp, bytes);
-    ShaFinal(&sha, hash);
-
-    InitDsaKey(&key);
-    ret = DsaPrivateKeyDecode(tmp, &idx, &key, bytes);
-    if (ret != 0) return -61;
-
-    ret = InitRng(&rng);
-    if (ret != 0) return -62;
-
-    ret = DsaSign(hash, signature, &key, &rng);
-    if (ret != 0) return -63;
-
-    ret = DsaVerify(hash, signature, &key, &answer);
-    if (ret != 0) return -64;
-    if (answer != 1) return -65;
-
-    FreeDsaKey(&key);
-
-    return 0;
-}
-
-#endif /* NO_DSA */
-
-
-#ifdef OPENSSL_EXTRA
-
-int openssl_test(void)
-{
-    EVP_MD_CTX md_ctx;
-    testVector a, b, c, d, e, f;
-    byte       hash[SHA_DIGEST_SIZE*4];  /* max size */
-
-    (void)e;
-    (void)f;
-
-    a.input  = "1234567890123456789012345678901234567890123456789012345678"
-               "9012345678901234567890";
-    a.output = "\x57\xed\xf4\xa2\x2b\xe3\xc9\x55\xac\x49\xda\x2e\x21\x07\xb6"
-               "\x7a";
-    a.inLen  = strlen(a.input);
-    a.outLen = MD5_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_md5());
-
-    EVP_DigestUpdate(&md_ctx, a.input, a.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, a.output, MD5_DIGEST_SIZE) != 0)
-        return -71;
-
-    b.input  = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-               "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
-               "aaaaaaaaaa";
-    b.output = "\xAD\x5B\x3F\xDB\xCB\x52\x67\x78\xC2\x83\x9D\x2F\x15\x1E\xA7"
-               "\x53\x99\x5E\x26\xA0";
-    b.inLen  = strlen(b.input);
-    b.outLen = SHA_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_sha1());
-
-    EVP_DigestUpdate(&md_ctx, b.input, b.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, b.output, SHA_DIGEST_SIZE) != 0)
-        return -72;
-
-
-    d.input  = "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
-    d.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";
-    d.inLen  = strlen(d.input);
-    d.outLen = SHA256_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_sha256());
-
-    EVP_DigestUpdate(&md_ctx, d.input, d.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, d.output, SHA256_DIGEST_SIZE) != 0)
-        return -78;
-
-#ifdef CYASSL_SHA384
-
-    e.input  = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
-               "jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
-    e.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";
-    e.inLen  = strlen(e.input);
-    e.outLen = SHA384_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_sha384());
-
-    EVP_DigestUpdate(&md_ctx, e.input, e.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, e.output, SHA384_DIGEST_SIZE) != 0)
-        return -79;
-
-#endif /* CYASSL_SHA384 */
-
-
-#ifdef CYASSL_SHA512
-
-    f.input  = "abcdefghbcdefghicdefghijdefghijkefghijklfghijklmghijklmnhi"
-               "jklmnoijklmnopjklmnopqklmnopqrlmnopqrsmnopqrstnopqrstu";
-    f.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";
-    f.inLen  = strlen(f.input);
-    f.outLen = SHA512_DIGEST_SIZE;
-
-    EVP_MD_CTX_init(&md_ctx);
-    EVP_DigestInit(&md_ctx, EVP_sha512());
-
-    EVP_DigestUpdate(&md_ctx, f.input, f.inLen);
-    EVP_DigestFinal(&md_ctx, hash, 0);
-
-    if (memcmp(hash, f.output, SHA512_DIGEST_SIZE) != 0)
-        return -80;
-
-#endif /* CYASSL_SHA512 */
-
-
-    if (RAND_bytes(hash, sizeof(hash)) != 1)
-        return -73;
-
-    c.input  = "what do ya want for nothing?";
-    c.output = "\x75\x0c\x78\x3e\x6a\xb0\xb5\x03\xea\xa8\x6e\x31\x0a\x5d\xb7"
-               "\x38";
-    c.inLen  = strlen(c.input);
-    c.outLen = MD5_DIGEST_SIZE;
-
-    HMAC(EVP_md5(), "Jefe", 4, (byte*)c.input, (int)c.inLen, hash, 0);
-
-    if (memcmp(hash, c.output, MD5_DIGEST_SIZE) != 0)
-        return -74;
-
-    { /* des test */
-    const byte vector[] = { /* "now is the time for all " w/o trailing 0 */
-        0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-        0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-        0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-    };
-
-    byte plain[24];
-    byte cipher[24];
-
-    const_DES_cblock key =
-    {
-        0x01,0x23,0x45,0x67,0x89,0xab,0xcd,0xef
-    };
-
-    DES_cblock iv =
-    {
-        0x12,0x34,0x56,0x78,0x90,0xab,0xcd,0xef
-    };
-
-    DES_key_schedule sched;
-
-    const byte verify[] =
-    {
-        0x8b,0x7c,0x52,0xb0,0x01,0x2b,0x6c,0xb8,
-        0x4f,0x0f,0xeb,0xf3,0xfb,0x5f,0x86,0x73,
-        0x15,0x85,0xb3,0x22,0x4b,0x86,0x2b,0x4b
-    };
-
-    DES_key_sched(&key, &sched);
-
-    DES_cbc_encrypt(vector, cipher, sizeof(vector), &sched, &iv, DES_ENCRYPT);
-    DES_cbc_encrypt(cipher, plain, sizeof(vector), &sched, &iv, DES_DECRYPT);
-
-    if (memcmp(plain, vector, sizeof(vector)) != 0)
-        return -75;
-
-    if (memcmp(cipher, verify, sizeof(verify)) != 0)
-        return -76;
-
-        /* test changing iv */
-    DES_ncbc_encrypt(vector, cipher, 8, &sched, &iv, DES_ENCRYPT);
-    DES_ncbc_encrypt(vector + 8, cipher + 8, 16, &sched, &iv, DES_ENCRYPT);
-
-    if (memcmp(cipher, verify, sizeof(verify)) != 0)
-        return -77;
-
-    }  /* end des test */
-
-    {  /* evp_cipher test */
-        EVP_CIPHER_CTX ctx;
-
-
-        const byte msg[] = { /* "Now is the time for all " w/o trailing 0 */
-            0x6e,0x6f,0x77,0x20,0x69,0x73,0x20,0x74,
-            0x68,0x65,0x20,0x74,0x69,0x6d,0x65,0x20,
-            0x66,0x6f,0x72,0x20,0x61,0x6c,0x6c,0x20
-        };
-
-        const byte verify[] =
-        {
-            0x95,0x94,0x92,0x57,0x5f,0x42,0x81,0x53,
-            0x2c,0xcc,0x9d,0x46,0x77,0xa2,0x33,0xcb
-        };
-
-        byte key[] = "0123456789abcdef   ";  /* align */
-        byte iv[]  = "1234567890abcdef   ";  /* align */
-
-        byte cipher[AES_BLOCK_SIZE * 4];
-        byte plain [AES_BLOCK_SIZE * 4];
-
-        EVP_CIPHER_CTX_init(&ctx);
-        if (EVP_CipherInit(&ctx, EVP_aes_128_cbc(), key, iv, 1) == 0)
-            return -81;
-
-        if (EVP_Cipher(&ctx, cipher, (byte*)msg, 16) == 0)
-            return -82;
-
-        if (memcmp(cipher, verify, AES_BLOCK_SIZE))
-            return -83;
-
-        EVP_CIPHER_CTX_init(&ctx);
-        if (EVP_CipherInit(&ctx, EVP_aes_128_cbc(), key, iv, 0) == 0)
-            return -84;
-
-        if (EVP_Cipher(&ctx, plain, cipher, 16) == 0)
-            return -85;
-
-        if (memcmp(plain, msg, AES_BLOCK_SIZE))
-            return -86;
-
-
-    }  /* end evp_cipher test */
-
-    return 0;
-}
-
-#endif /* OPENSSL_EXTRA */
-
-
-#ifndef NO_PWDBASED
-
-int pkcs12_test(void)
-{
-    const byte passwd[] = { 0x00, 0x73, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x67,
-                            0x00, 0x00 };
-    const byte salt[] =   { 0x0a, 0x58, 0xCF, 0x64, 0x53, 0x0d, 0x82, 0x3f };
-
-    const byte passwd2[] = { 0x00, 0x71, 0x00, 0x75, 0x00, 0x65, 0x00, 0x65,
-                             0x00, 0x67, 0x00, 0x00 };
-    const byte salt2[] =   { 0x16, 0x82, 0xC0, 0xfC, 0x5b, 0x3f, 0x7e, 0xc5 };
-    byte  derived[64];
-
-    const byte verify[] = {
-        0x8A, 0xAA, 0xE6, 0x29, 0x7B, 0x6C, 0xB0, 0x46,
-        0x42, 0xAB, 0x5B, 0x07, 0x78, 0x51, 0x28, 0x4E,
-        0xB7, 0x12, 0x8F, 0x1A, 0x2A, 0x7F, 0xBC, 0xA3
-    };
-
-    const byte verify2[] = {
-        0x48, 0x3D, 0xD6, 0xE9, 0x19, 0xD7, 0xDE, 0x2E,
-        0x8E, 0x64, 0x8B, 0xA8, 0xF8, 0x62, 0xF3, 0xFB,
-        0xFB, 0xDC, 0x2B, 0xCB, 0x2C, 0x02, 0x95, 0x7F
-    };
-
-    int id         =  1;
-    int kLen       = 24;
-    int iterations =  1;
-    int ret = PKCS12_PBKDF(derived, passwd, sizeof(passwd), salt, 8, iterations,
-                           kLen, SHA, id);
-
-    if (ret < 0)
-        return -103;
-
-    if ( (ret = memcmp(derived, verify, kLen)) != 0)
-        return -104;
-
-    iterations = 1000;
-    ret = PKCS12_PBKDF(derived, passwd2, sizeof(passwd2), salt2, 8, iterations,
-                       kLen, SHA, id);
-    if (ret < 0)
-        return -105;
-
-    if ( (ret = memcmp(derived, verify2, 24)) != 0)
-        return -106;
-
-    return 0;
-}
-
-
-int pbkdf2_test(void)
-{
-    char passwd[] = "password";
-    const byte salt[] = { 0x78, 0x57, 0x8E, 0x5a, 0x5d, 0x63, 0xcb, 0x06 };
-    int   iterations = 2048;
-    int   kLen = 24;
-    byte  derived[64];
-
-    const byte verify[] = {
-        0xBF, 0xDE, 0x6B, 0xE9, 0x4D, 0xF7, 0xE1, 0x1D, 0xD4, 0x09, 0xBC, 0xE2,
-        0x0A, 0x02, 0x55, 0xEC, 0x32, 0x7C, 0xB9, 0x36, 0xFF, 0xE9, 0x36, 0x43
-
-    };
-
-    int ret = PBKDF2(derived, (byte*)passwd, (int)strlen(passwd), salt, 8,
-                                                         iterations, kLen, SHA);
-    if (ret != 0)
-        return ret;
-
-    if (memcmp(derived, verify, sizeof(verify)) != 0)
-        return -102;
-
-    return 0;
-}
-
-
-int pbkdf1_test(void)
-{
-    char passwd[] = "password";
-    const byte salt[] = { 0x78, 0x57, 0x8E, 0x5a, 0x5d, 0x63, 0xcb, 0x06 };
-    int   iterations = 1000;
-    int   kLen = 16;
-    byte  derived[16];
-
-    const byte verify[] = {
-        0xDC, 0x19, 0x84, 0x7E, 0x05, 0xC6, 0x4D, 0x2F, 0xAF, 0x10, 0xEB, 0xFB,
-        0x4A, 0x3D, 0x2A, 0x20
-    };
-
-    PBKDF1(derived, (byte*)passwd, (int)strlen(passwd), salt, 8, iterations,
-           kLen, SHA);
-
-    if (memcmp(derived, verify, sizeof(verify)) != 0)
-        return -101;
-
-    return 0;
-}
-
-
-int pwdbased_test(void)
-{
-   int ret =  pbkdf1_test();
-   ret += pbkdf2_test();
-
-   return ret + pkcs12_test();
-}
-
-#endif /* NO_PWDBASED */
-
-#if defined(HAVE_HKDF) && (!defined(NO_SHA) || !defined(NO_SHA256))
-
-int hkdf_test(void)
-{
-    int ret;
-    int L = 42;
-    byte okm1[42];
-    byte ikm1[22] = { 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
-                      0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b,
-                      0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b };
-    byte salt1[13] ={ 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
-                      0x08, 0x09, 0x0a, 0x0b, 0x0c };
-    byte info1[10] ={ 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7,
-                      0xf8, 0xf9 };
-    byte res1[42] = { 0x0a, 0xc1, 0xaf, 0x70, 0x02, 0xb3, 0xd7, 0x61,
-                      0xd1, 0xe5, 0x52, 0x98, 0xda, 0x9d, 0x05, 0x06,
-                      0xb9, 0xae, 0x52, 0x05, 0x72, 0x20, 0xa3, 0x06,
-                      0xe0, 0x7b, 0x6b, 0x87, 0xe8, 0xdf, 0x21, 0xd0,
-                      0xea, 0x00, 0x03, 0x3d, 0xe0, 0x39, 0x84, 0xd3,
-                      0x49, 0x18 };
-    byte res2[42] = { 0x08, 0x5a, 0x01, 0xea, 0x1b, 0x10, 0xf3, 0x69,
-                      0x33, 0x06, 0x8b, 0x56, 0xef, 0xa5, 0xad, 0x81,
-                      0xa4, 0xf1, 0x4b, 0x82, 0x2f, 0x5b, 0x09, 0x15,
-                      0x68, 0xa9, 0xcd, 0xd4, 0xf1, 0x55, 0xfd, 0xa2,
-                      0xc2, 0x2e, 0x42, 0x24, 0x78, 0xd3, 0x05, 0xf3,
-                      0xf8, 0x96 };
-    byte res3[42] = { 0x8d, 0xa4, 0xe7, 0x75, 0xa5, 0x63, 0xc1, 0x8f,
-                      0x71, 0x5f, 0x80, 0x2a, 0x06, 0x3c, 0x5a, 0x31,
-                      0xb8, 0xa1, 0x1f, 0x5c, 0x5e, 0xe1, 0x87, 0x9e,
-                      0xc3, 0x45, 0x4e, 0x5f, 0x3c, 0x73, 0x8d, 0x2d,
-                      0x9d, 0x20, 0x13, 0x95, 0xfa, 0xa4, 0xb6, 0x1a,
-                      0x96, 0xc8 };
-    byte res4[42] = { 0x3c, 0xb2, 0x5f, 0x25, 0xfa, 0xac, 0xd5, 0x7a,
-                      0x90, 0x43, 0x4f, 0x64, 0xd0, 0x36, 0x2f, 0x2a,
-                      0x2d, 0x2d, 0x0a, 0x90, 0xcf, 0x1a, 0x5a, 0x4c,
-                      0x5d, 0xb0, 0x2d, 0x56, 0xec, 0xc4, 0xc5, 0xbf,
-                      0x34, 0x00, 0x72, 0x08, 0xd5, 0xb8, 0x87, 0x18,
-                      0x58, 0x65 };
-
-    (void)res1;
-    (void)res2;
-    (void)res3;
-    (void)res4;
-
-#ifndef NO_SHA
-    ret = HKDF(SHA, ikm1, 22, NULL, 0, NULL, 0, okm1, L);
-    if (ret != 0)
-        return -2001;
-
-    if (memcmp(okm1, res1, L) != 0)
-        return -2002;
-
-    ret = HKDF(SHA, ikm1, 11, salt1, 13, info1, 10, okm1, L);
-    if (ret != 0)
-        return -2003;
-
-    if (memcmp(okm1, res2, L) != 0)
-        return -2004;
-#endif /* NO_SHA */
-
-#ifndef NO_SHA256
-    ret = HKDF(SHA256, ikm1, 22, NULL, 0, NULL, 0, okm1, L);
-    if (ret != 0)
-        return -2005;
-
-    if (memcmp(okm1, res3, L) != 0)
-        return -2006;
-
-    ret = HKDF(SHA256, ikm1, 22, salt1, 13, info1, 10, okm1, L);
-    if (ret != 0)
-        return -2007;
-
-    if (memcmp(okm1, res4, L) != 0)
-        return -2007;
-#endif /* NO_SHA256 */
-
-    return 0;
-}
-
-#endif /* HAVE_HKDF */
-
-
-#ifdef HAVE_ECC
-
-int ecc_test(void)
-{
-    WC_RNG  rng;
-    byte    sharedA[1024];
-    byte    sharedB[1024];
-    byte    sig[1024];
-    byte    digest[20];
-    byte    exportBuf[1024];
-    word32  x, y;
-    int     i, verify, ret;
-    ecc_key userA, userB, pubKey;
-
-    ret = InitRng(&rng);
-    if (ret != 0)
-        return -1001;
-
-    ecc_init(&userA);
-    ecc_init(&userB);
-    ecc_init(&pubKey);
-
-    ret = ecc_make_key(&rng, 32, &userA);
-
-    if (ret != 0)
-        return -1014;
-
-    ret = ecc_make_key(&rng, 32, &userB);
-
-    if (ret != 0)
-        return -1002;
-
-    x = sizeof(sharedA);
-    ret = ecc_shared_secret(&userA, &userB, sharedA, &x);
-
-    if (ret != 0)
-        return -1015;
-
-    y = sizeof(sharedB);
-    ret = ecc_shared_secret(&userB, &userA, sharedB, &y);
-
-    if (ret != 0)
-        return -1003;
-
-    if (y != x)
-        return -1004;
-
-    if (memcmp(sharedA, sharedB, x))
-        return -1005;
-
-    x = sizeof(exportBuf);
-    ret = ecc_export_x963(&userA, exportBuf, &x);
-    if (ret != 0)
-        return -1006;
-
-    ret = ecc_import_x963(exportBuf, x, &pubKey);
-
-    if (ret != 0)
-        return -1007;
-
-    y = sizeof(sharedB);
-    ret = ecc_shared_secret(&userB, &pubKey, sharedB, &y);
-
-    if (ret != 0)
-        return -1008;
-
-    if (memcmp(sharedA, sharedB, y))
-        return -1010;
-
-    /* test DSA sign hash */
-    for (i = 0; i < (int)sizeof(digest); i++)
-        digest[i] = (byte)i;
-
-    x = sizeof(sig);
-    ret = ecc_sign_hash(digest, sizeof(digest), sig, &x, &rng, &userA);
-
-    if (ret != 0)
-        return -1016;
-
-    verify = 0;
-    ret = ecc_verify_hash(sig, x, digest, sizeof(digest), &verify, &userA);
-
-    if (ret != 0)
-        return -1011;
-
-    if (verify != 1)
-        return -1012;
-
-    x = sizeof(exportBuf);
-    ret = ecc_export_private_only(&userA, exportBuf, &x);
-    if (ret != 0)
-        return -1013;
-
-    ecc_free(&pubKey);
-    ecc_free(&userB);
-    ecc_free(&userA);
-
-    return 0;
-}
-
-#ifdef HAVE_ECC_ENCRYPT
-
-int ecc_encrypt_test(void)
-{
-    WC_RNG  rng;
-    int     ret;
-    ecc_key userA, userB;
-    byte    msg[48];
-    byte    plain[48];
-    byte    out[80];
-    word32  outSz   = sizeof(out);
-    word32  plainSz = sizeof(plain);
-    int     i;
-
-    ret = InitRng(&rng);
-    if (ret != 0)
-        return -3001;
-
-    ecc_init(&userA);
-    ecc_init(&userB);
-
-    ret  = ecc_make_key(&rng, 32, &userA);
-    ret += ecc_make_key(&rng, 32, &userB);
-
-    if (ret != 0)
-        return -3002;
-
-    for (i = 0; i < 48; i++)
-        msg[i] = i;
-
-    /* encrypt msg to B */
-    ret = ecc_encrypt(&userA, &userB, msg, sizeof(msg), out, &outSz, NULL);
-    if (ret != 0)
-        return -3003;
-
-    /* decrypt msg from A */
-    ret = ecc_decrypt(&userB, &userA, out, outSz, plain, &plainSz, NULL);
-    if (ret != 0)
-        return -3004;
-
-    if (memcmp(plain, msg, sizeof(msg)) != 0)
-        return -3005;
-
-
-    {  /* let's verify message exchange works, A is client, B is server */
-        ecEncCtx* cliCtx = ecc_ctx_new(REQ_RESP_CLIENT, &rng);
-        ecEncCtx* srvCtx = ecc_ctx_new(REQ_RESP_SERVER, &rng);
-
-        byte cliSalt[EXCHANGE_SALT_SZ];
-        byte srvSalt[EXCHANGE_SALT_SZ];
-        const byte* tmpSalt;
-
-        if (cliCtx == NULL || srvCtx == NULL)
-            return -3006;
-
-        /* get salt to send to peer */
-        tmpSalt = ecc_ctx_get_own_salt(cliCtx);
-        if (tmpSalt == NULL)
-            return -3007;
-        memcpy(cliSalt, tmpSalt, EXCHANGE_SALT_SZ);
-
-        tmpSalt = ecc_ctx_get_own_salt(srvCtx);
-        if (tmpSalt == NULL)
-            return -3007;
-        memcpy(srvSalt, tmpSalt, EXCHANGE_SALT_SZ);
-
-        /* in actual use, we'd get the peer's salt over the transport */
-        ret  = ecc_ctx_set_peer_salt(cliCtx, srvSalt);
-        ret += ecc_ctx_set_peer_salt(srvCtx, cliSalt);
-
-        if (ret != 0)
-            return -3008;
-
-        /* get encrypted msg (request) to send to B */
-        outSz  = sizeof(out);
-        ret = ecc_encrypt(&userA, &userB, msg, sizeof(msg), out, &outSz,cliCtx);
-        if (ret != 0)
-            return -3009;
-
-        /* B decrypts msg (request) from A */
-        plainSz = sizeof(plain);
-        ret = ecc_decrypt(&userB, &userA, out, outSz, plain, &plainSz, srvCtx);
-        if (ret != 0)
-            return -3010;
-
-        if (memcmp(plain, msg, sizeof(msg)) != 0)
-            return -3011;
-
-        {
-            /* msg2 (response) from B to A */
-            byte    msg2[48];
-            byte    plain2[48];
-            byte    out2[80];
-            word32  outSz2   = sizeof(out2);
-            word32  plainSz2 = sizeof(plain2);
-
-            for (i = 0; i < 48; i++)
-                msg2[i] = i+48;
-
-            /* get encrypted msg (response) to send to B */
-            ret = ecc_encrypt(&userB, &userA, msg2, sizeof(msg2), out2,
-                              &outSz2, srvCtx);
-            if (ret != 0)
-                return -3012;
-
-            /* A decrypts msg (response) from B */
-            ret = ecc_decrypt(&userA, &userB, out2, outSz2, plain2, &plainSz2,
-                             cliCtx);
-            if (ret != 0)
-                return -3013;
-
-            if (memcmp(plain2, msg2, sizeof(msg2)) != 0)
-                return -3014;
-        }
-
-        /* cleanup */
-        ecc_ctx_free(srvCtx);
-        ecc_ctx_free(cliCtx);
-    }
-
-    /* cleanup */
-    ecc_free(&userB);
-    ecc_free(&userA);
-
-    return 0;
-}
-
-#endif /* HAVE_ECC_ENCRYPT */
-#endif /* HAVE_ECC */
-
-#ifdef HAVE_LIBZ
-
-const byte sample_text[] =
-    "Biodiesel cupidatat marfa, cliche aute put a bird on it incididunt elit\n"
-    "polaroid. Sunt tattooed bespoke reprehenderit. Sint twee organic id\n"
-    "marfa. Commodo veniam ad esse gastropub. 3 wolf moon sartorial vero,\n"
-    "plaid delectus biodiesel squid +1 vice. Post-ironic keffiyeh leggings\n"
-    "selfies cray fap hoodie, forage anim. Carles cupidatat shoreditch, VHS\n"
-    "small batch meggings kogi dolore food truck bespoke gastropub.\n"
-    "\n"
-    "Terry richardson adipisicing actually typewriter tumblr, twee whatever\n"
-    "four loko you probably haven't heard of them high life. Messenger bag\n"
-    "whatever tattooed deep v mlkshk. Brooklyn pinterest assumenda chillwave\n"
-    "et, banksy ullamco messenger bag umami pariatur direct trade forage.\n"
-    "Typewriter culpa try-hard, pariatur sint brooklyn meggings. Gentrify\n"
-    "food truck next level, tousled irony non semiotics PBR ethical anim cred\n"
-    "readymade. Mumblecore brunch lomo odd future, portland organic terry\n"
-    "richardson elit leggings adipisicing ennui raw denim banjo hella. Godard\n"
-    "mixtape polaroid, pork belly readymade organic cray typewriter helvetica\n"
-    "four loko whatever street art yr farm-to-table.\n"
-    "\n"
-    "Vinyl keytar vice tofu. Locavore you probably haven't heard of them pug\n"
-    "pickled, hella tonx labore truffaut DIY mlkshk elit cosby sweater sint\n"
-    "et mumblecore. Elit swag semiotics, reprehenderit DIY sartorial nisi ugh\n"
-    "nesciunt pug pork belly wayfarers selfies delectus. Ethical hoodie\n"
-    "seitan fingerstache kale chips. Terry richardson artisan williamsburg,\n"
-    "eiusmod fanny pack irony tonx ennui lo-fi incididunt tofu YOLO\n"
-    "readymade. 8-bit sed ethnic beard officia. Pour-over iphone DIY butcher,\n"
-    "ethnic art party qui letterpress nisi proident jean shorts mlkshk\n"
-    "locavore.\n"
-    "\n"
-    "Narwhal flexitarian letterpress, do gluten-free voluptate next level\n"
-    "banh mi tonx incididunt carles DIY. Odd future nulla 8-bit beard ut\n"
-    "cillum pickled velit, YOLO officia you probably haven't heard of them\n"
-    "trust fund gastropub. Nisi adipisicing tattooed, Austin mlkshk 90's\n"
-    "small batch american apparel. Put a bird on it cosby sweater before they\n"
-    "sold out pork belly kogi hella. Street art mollit sustainable polaroid,\n"
-    "DIY ethnic ea pug beard dreamcatcher cosby sweater magna scenester nisi.\n"
-    "Sed pork belly skateboard mollit, labore proident eiusmod. Sriracha\n"
-    "excepteur cosby sweater, anim deserunt laborum eu aliquip ethical et\n"
-    "neutra PBR selvage.\n"
-    "\n"
-    "Raw denim pork belly truffaut, irony plaid sustainable put a bird on it\n"
-    "next level jean shorts exercitation. Hashtag keytar whatever, nihil\n"
-    "authentic aliquip disrupt laborum. Tattooed selfies deserunt trust fund\n"
-    "wayfarers. 3 wolf moon synth church-key sartorial, gastropub leggings\n"
-    "tattooed. Labore high life commodo, meggings raw denim fingerstache pug\n"
-    "trust fund leggings seitan forage. Nostrud ullamco duis, reprehenderit\n"
-    "incididunt flannel sustainable helvetica pork belly pug banksy you\n"
-    "probably haven't heard of them nesciunt farm-to-table. Disrupt nostrud\n"
-    "mollit magna, sriracha sartorial helvetica.\n"
-    "\n"
-    "Nulla kogi reprehenderit, skateboard sustainable duis adipisicing viral\n"
-    "ad fanny pack salvia. Fanny pack trust fund you probably haven't heard\n"
-    "of them YOLO vice nihil. Keffiyeh cray lo-fi pinterest cardigan aliqua,\n"
-    "reprehenderit aute. Culpa tousled williamsburg, marfa lomo actually anim\n"
-    "skateboard. Iphone aliqua ugh, semiotics pariatur vero readymade\n"
-    "organic. Marfa squid nulla, in laborum disrupt laboris irure gastropub.\n"
-    "Veniam sunt food truck leggings, sint vinyl fap.\n"
-    "\n"
-    "Hella dolore pork belly, truffaut carles you probably haven't heard of\n"
-    "them PBR helvetica in sapiente. Fashion axe ugh bushwick american\n"
-    "apparel. Fingerstache sed iphone, jean shorts blue bottle nisi bushwick\n"
-    "flexitarian officia veniam plaid bespoke fap YOLO lo-fi. Blog\n"
-    "letterpress mumblecore, food truck id cray brooklyn cillum ad sed.\n"
-    "Assumenda chambray wayfarers vinyl mixtape sustainable. VHS vinyl\n"
-    "delectus, culpa williamsburg polaroid cliche swag church-key synth kogi\n"
-    "magna pop-up literally. Swag thundercats ennui shoreditch vegan\n"
-    "pitchfork neutra truffaut etsy, sed single-origin coffee craft beer.\n"
-    "\n"
-    "Odio letterpress brooklyn elit. Nulla single-origin coffee in occaecat\n"
-    "meggings. Irony meggings 8-bit, chillwave lo-fi adipisicing cred\n"
-    "dreamcatcher veniam. Put a bird on it irony umami, trust fund bushwick\n"
-    "locavore kale chips. Sriracha swag thundercats, chillwave disrupt\n"
-    "tousled beard mollit mustache leggings portland next level. Nihil esse\n"
-    "est, skateboard art party etsy thundercats sed dreamcatcher ut iphone\n"
-    "swag consectetur et. Irure skateboard banjo, nulla deserunt messenger\n"
-    "bag dolor terry richardson sapiente.\n";
-
-
-int compress_test(void)
-{
-    int ret = 0;
-    word32 dSz = sizeof(sample_text);
-    word32 cSz = (dSz + (word32)(dSz * 0.001) + 12);
-    byte *c = NULL;
-    byte *d = NULL;
-
-    c = calloc(cSz, sizeof(byte));
-    d = calloc(dSz, sizeof(byte));
-
-    if (c == NULL || d == NULL)
-        ret = -300;
-
-    if (ret == 0 && (ret = Compress(c, cSz, sample_text, dSz, 0)) < 0)
-        ret = -301;
-
-    if (ret > 0) {
-        cSz = (word32)ret;
-        ret = 0;
-    }
-
-    if (ret == 0 && DeCompress(d, dSz, c, cSz) != (int)dSz)
-        ret = -302;
-
-    if (ret == 0 && memcmp(d, sample_text, dSz))
-        ret = -303;
-
-    if (c) free(c);
-    if (d) free(d);
-
-    return ret;
-}
-
-#endif /* HAVE_LIBZ */
-
-#ifdef HAVE_PKCS7
-
-int pkcs7enveloped_test(void)
-{
-    int ret = 0;
-
-    int cipher = DES3b;
-    int envelopedSz, decodedSz;
-    PKCS7 pkcs7;
-    byte* cert;
-    byte* privKey;
-    byte  enveloped[2048];
-    byte  decoded[2048];
-
-    size_t certSz;
-    size_t privKeySz;
-    FILE*  certFile;
-    FILE*  keyFile;
-    FILE*  pkcs7File;
-    const char* pkcs7OutFile = "pkcs7envelopedData.der";
-
-    const byte data[] = { /* Hello World */
-        0x48,0x65,0x6c,0x6c,0x6f,0x20,0x57,0x6f,
-        0x72,0x6c,0x64
-    };
-
-    /* read client cert and key in DER format */
-    cert = (byte*)malloc(FOURK_BUF);
-    if (cert == NULL)
-        return -201;
-
-    privKey = (byte*)malloc(FOURK_BUF);
-    if (privKey == NULL) {
-        free(cert);
-        return -202;
-    }
-
-    certFile = fopen(clientCert, "rb");
-    if (!certFile) {
-        free(cert);
-        free(privKey);
-        err_sys("can't open ./certs/client-cert.der, "
-                "Please run from CyaSSL home dir", -42);
-    }
-
-    certSz = fread(cert, 1, FOURK_BUF, certFile);
-    fclose(certFile);
-
-    keyFile = fopen(clientKey, "rb");
-    if (!keyFile) {
-        free(cert);
-        free(privKey);
-        err_sys("can't open ./certs/client-key.der, "
-                "Please run from CyaSSL home dir", -43);
-    }
-
-    privKeySz = fread(privKey, 1, FOURK_BUF, keyFile);
-    fclose(keyFile);
-
-    PKCS7_InitWithCert(&pkcs7, cert, (word32)certSz);
-    pkcs7.content     = (byte*)data;
-    pkcs7.contentSz   = (word32)sizeof(data);
-    pkcs7.contentOID  = DATA;
-    pkcs7.encryptOID  = cipher;
-    pkcs7.privateKey  = privKey;
-    pkcs7.privateKeySz = (word32)privKeySz;
-
-    /* encode envelopedData */
-    envelopedSz = PKCS7_EncodeEnvelopedData(&pkcs7, enveloped,
-                                            sizeof(enveloped));
-    if (envelopedSz <= 0) {
-        free(cert);
-        free(privKey);
-        return -203;
-    }
-
-    /* decode envelopedData */
-    decodedSz = PKCS7_DecodeEnvelopedData(&pkcs7, enveloped, envelopedSz,
-                                          decoded, sizeof(decoded));
-    if (decodedSz <= 0) {
-        free(cert);
-        free(privKey);
-        return -204;
-    }
-
-    /* test decode result */
-    if (memcmp(decoded, data, sizeof(data)) != 0) {
-        free(cert);
-        free(privKey);
-        return -205;
-    }
-
-    /* output pkcs7 envelopedData for external testing */
-    pkcs7File = fopen(pkcs7OutFile, "wb");
-    if (!pkcs7File) {
-        free(cert);
-        free(privKey);
-        return -206;
-    }
-
-    ret = (int)fwrite(enveloped, envelopedSz, 1, pkcs7File);
-    fclose(pkcs7File);
-
-    free(cert);
-    free(privKey);
-    PKCS7_Free(&pkcs7);
-
-    if (ret > 0)
-        return 0;
-
-    return ret;
-}
-
-int pkcs7signed_test(void)
-{
-    int ret = 0;
-
-    FILE* file;
-    byte* certDer;
-    byte* keyDer;
-    byte* out;
-    char data[] = "Hello World";
-    word32 dataSz, outSz, certDerSz, keyDerSz;
-    PKCS7  msg;
-    WC_RNG rng;
-
-    byte transIdOid[] =
-               { 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01,
-                 0x09, 0x07 };
-    byte messageTypeOid[] =
-               { 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01,
-                 0x09, 0x02 };
-    byte senderNonceOid[] =
-               { 0x06, 0x0a, 0x60, 0x86, 0x48, 0x01, 0x86, 0xF8, 0x45, 0x01,
-                 0x09, 0x05 };
-    byte transId[(SHA_DIGEST_SIZE + 1) * 2 + 1];
-    byte messageType[] = { 0x13, 2, '1', '9' };
-    byte senderNonce[PKCS7_NONCE_SZ + 2];
-
-    PKCS7Attrib attribs[] =
-    {
-        { transIdOid, sizeof(transIdOid),
-                     transId, sizeof(transId) - 1 }, /* take off the null */
-        { messageTypeOid, sizeof(messageTypeOid),
-                     messageType, sizeof(messageType) },
-        { senderNonceOid, sizeof(senderNonceOid),
-                     senderNonce, sizeof(senderNonce) }
-    };
-
-    dataSz = (word32) strlen(data);
-    outSz = FOURK_BUF;
-
-    certDer = (byte*)malloc(FOURK_BUF);
-    if (certDer == NULL)
-        return -207;
-    keyDer = (byte*)malloc(FOURK_BUF);
-    if (keyDer == NULL) {
-        free(certDer);
-        return -208;
-    }
-    out = (byte*)malloc(FOURK_BUF);
-    if (out == NULL) {
-        free(certDer);
-        free(keyDer);
-        return -209;
-    }
-
-    /* read in DER cert of recipient, into cert of size certSz */
-    file = fopen(clientCert, "rb");
-    if (!file) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        err_sys("can't open ./certs/client-cert.der, "
-                "Please run from CyaSSL home dir", -44);
-    }
-    certDerSz = (word32)fread(certDer, 1, FOURK_BUF, file);
-    fclose(file);
-
-    file = fopen(clientKey, "rb");
-    if (!file) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        err_sys("can't open ./certs/client-key.der, "
-                "Please run from CyaSSL home dir", -45);
-    }
-    keyDerSz = (word32)fread(keyDer, 1, FOURK_BUF, file);
-    fclose(file);
-
-    ret = InitRng(&rng);
-    if (ret != 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        return -210;
-    }
-
-    senderNonce[0] = 0x04;
-    senderNonce[1] = PKCS7_NONCE_SZ;
-
-    ret = RNG_GenerateBlock(&rng, &senderNonce[2], PKCS7_NONCE_SZ);
-    if (ret != 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        return -211;
-    }
-
-    PKCS7_InitWithCert(&msg, certDer, certDerSz);
-    msg.privateKey = keyDer;
-    msg.privateKeySz = keyDerSz;
-    msg.content = (byte*)data;
-    msg.contentSz = dataSz;
-    msg.hashOID = SHAh;
-    msg.encryptOID = RSAk;
-    msg.signedAttribs = attribs;
-    msg.signedAttribsSz = sizeof(attribs)/sizeof(PKCS7Attrib);
-    msg.rng = &rng;
-    {
-        Sha sha;
-        byte digest[SHA_DIGEST_SIZE];
-        int i,j;
-
-        transId[0] = 0x13;
-        transId[1] = SHA_DIGEST_SIZE * 2;
-
-        ret = InitSha(&sha);
-        if (ret != 0) {
-            free(certDer);
-            free(keyDer);
-            free(out);
-            return -4003;
-        }
-        ShaUpdate(&sha, msg.publicKey, msg.publicKeySz);
-        ShaFinal(&sha, digest);
-
-        for (i = 0, j = 2; i < SHA_DIGEST_SIZE; i++, j += 2) {
-            snprintf((char*)&transId[j], 3, "%02x", digest[i]);
-        }
-    }
-    ret = PKCS7_EncodeSignedData(&msg, out, outSz);
-    if (ret < 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -212;
-    }
-    else
-        outSz = ret;
-
-    /* write PKCS#7 to output file for more testing */
-    file = fopen("./pkcs7signedData.der", "wb");
-    if (!file) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -213;
-    }
-    ret = (int)fwrite(out, 1, outSz, file);
-    fclose(file);
-    if (ret != (int)outSz) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -218;
-    }
-
-    PKCS7_Free(&msg);
-    PKCS7_InitWithCert(&msg, NULL, 0);
-
-    ret = PKCS7_VerifySignedData(&msg, out, outSz);
-    if (ret < 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -214;
-    }
-
-    if (msg.singleCert == NULL || msg.singleCertSz == 0) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -215;
-    }
-
-    file = fopen("./pkcs7cert.der", "wb");
-    if (!file) {
-        free(certDer);
-        free(keyDer);
-        free(out);
-        PKCS7_Free(&msg);
-        return -216;
-    }
-    ret = (int)fwrite(msg.singleCert, 1, msg.singleCertSz, file);
-    fclose(file);
-
-    free(certDer);
-    free(keyDer);
-    free(out);
-    PKCS7_Free(&msg);
-
-    if (ret > 0)
-        return 0;
-
-    return ret;
-}
-
-#endif /* HAVE_PKCS7 */
-
-#endif /* NO_CRYPT_TEST */
diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/time-dummy.c b/IDE/MDK5-ARM/Projects/CyaSSL-Full/time-dummy.c
deleted file mode 100644
index 8f98da46a..000000000
--- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/time-dummy.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* time-dummy.c.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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
- 
-#ifdef HAVE_CONFIG_H
-    #include 
-#endif
-
-#include "time.h"
-
-struct tm *Cyassl_MDK_gmtime(const time_t *c) 
-{ 
-    static struct tm date ; 
-    return(&date) ;
-}
-
-time_t time(time_t * t) { return 0 ; }
diff --git a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx
index 660fd4507..1645ff076 100644
--- a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx
+++ b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvoptx
@@ -13,6 +13,7 @@
     *.txt; *.h; *.inc
     *.plm
     *.cpp
+    0
   
 
   
@@ -21,16 +22,17 @@
   
 
   
-    EchoClient
+    STM32F207 Flash
     0x4
     ARM-ADS
     
-      120000000
+      12000000
       
         1
         1
         0
         1
+        0
       
       
         1
@@ -75,17 +77,17 @@
         0
         1
       
-      255
+      18
       
         
           0
           Schematics (MCBSTM32F200)
-          C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf
+          C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf
         
         
           1
           User Manual (MCBSTM32F200)
-          C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm
+          C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm
         
         
           2
@@ -113,10 +115,9 @@
         1
         1
         1
-        1
         0
         0
-        8
+        1
         
         
         
@@ -127,9 +128,14 @@
         
         
         .\STM32_SWO.ini
-        BIN\ULP2CM3.DLL
+        BIN\UL2CM3.DLL
       
       
+        
+          0
+          ARMRTXEVENTFLAGS
+          -L70 -Z18 -C0 -M0 -T1
+        
         
           0
           DLGTARM
@@ -143,17 +149,17 @@
         
           0
           ULP2CM3
-          -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)
+          -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM)
         
         
           0
           DLGUARM
-          
+          (105=-1,-1,-1,-1,0)
         
         
           0
           UL2CM3
-          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm))
+          -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)
         
       
       
@@ -161,7 +167,8 @@
         
           1
           8
-          ((func_args*)args)->signal->port
+          port
+          0
         
       
       
@@ -169,6 +176,7 @@
           2
           8
           0x8004dc8
+          0
         
       
       
@@ -195,7 +203,7 @@
         0
         0
         1
-        0
+        1
         0
         0
         0
@@ -224,19 +232,6 @@
       0
       0
     
-    
-      1
-      2
-      1
-      0
-      0
-      0
-      0
-      .\echoclient.c
-      echoclient.c
-      0
-      0
-    
   
 
   
@@ -247,20 +242,7 @@
     0
     
       2
-      3
-      5
-      0
-      0
-      0
-      0
-      .\RTE\wolfSSL\config-CyaSSL.h
-      config-CyaSSL.h
-      0
-      0
-    
-    
-      2
-      4
+      2
       5
       0
       0
@@ -273,14 +255,27 @@
     
     
       2
-      5
+      3
       5
       0
       0
       0
       0
-      .\RTE\Network\Net_Config_ETH_0.h
-      Net_Config_ETH_0.h
+      .\RTE\wolfSSL\config-wolfSSL.h
+      config-wolfSSL.h
+      0
+      0
+    
+    
+      2
+      4
+      5
+      0
+      0
+      0
+      0
+      .\RTE\wolfSSL\user_settings.h
+      user_settings.h
       0
       0
     
@@ -294,7 +289,7 @@
     0
     
       3
-      6
+      5
       5
       0
       0
@@ -307,59 +302,28 @@
     
   
 
-  
-    Devices
-    1
-    0
-    0
-    0
-    
-      4
-      7
-      1
-      0
-      0
-      0
-      0
-      .\time-dummy.c
-      time-dummy.c
-      0
-      0
-    
-  
-
   
     ::CMSIS
     1
     0
     0
     1
-    
-      5
-      8
-      1
-      0
-      0
-      0
-      0
-      RTE\CMSIS\RTX_Conf_CM.c
-      RTX_Conf_CM.c
-      1
-      0
-    
-    
-      5
-      9
-      4
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib
-      RTX_CM3.lib
-      1
-      0
-    
+  
+
+  
+    ::CMSIS Driver
+    1
+    0
+    0
+    1
+  
+
+  
+    ::Compiler
+    1
+    0
+    0
+    1
   
 
   
@@ -368,118 +332,6 @@
     0
     0
     1
-    
-      6
-      10
-      5
-      0
-      0
-      0
-      0
-      RTE\Device\STM32F207IG\RTE_Device.h
-      RTE_Device.h
-      1
-      0
-    
-    
-      6
-      11
-      2
-      0
-      0
-      0
-      0
-      RTE\Device\STM32F207IG\startup_stm32f2xx.s
-      startup_stm32f2xx.s
-      1
-      0
-    
-    
-      6
-      12
-      1
-      0
-      0
-      0
-      0
-      RTE\Device\STM32F207IG\system_stm32f2xx.c
-      system_stm32f2xx.c
-      1
-      0
-    
-    
-      6
-      13
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c
-      DMA_STM32F2xx.c
-      1
-      0
-    
-    
-      6
-      14
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c
-      GPIO_STM32F2xx.c
-      1
-      0
-    
-  
-
-  
-    ::Drivers
-    0
-    0
-    0
-    1
-    
-      7
-      15
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c
-      EMAC_STM32F2xx.c
-      1
-      0
-    
-    
-      7
-      16
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c
-      MCI_STM32F2xx.c
-      1
-      0
-    
-    
-      7
-      17
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c
-      PHY_ST802RT1.c
-      1
-      0
-    
   
 
   
@@ -488,45 +340,6 @@
     0
     0
     1
-    
-      8
-      18
-      1
-      0
-      0
-      0
-      0
-      RTE\File_System\FS_Config.c
-      FS_Config.c
-      1
-      0
-    
-    
-      8
-      19
-      5
-      0
-      0
-      0
-      0
-      RTE\File_System\FS_Config_MC_0.h
-      FS_Config_MC_0.h
-      1
-      0
-    
-    
-      8
-      20
-      4
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib
-      FS_LFN_CM3_L.lib
-      1
-      0
-    
   
 
   
@@ -535,703 +348,14 @@
     0
     0
     1
-    
-      9
-      21
-      1
-      0
-      0
-      0
-      0
-      RTE\Network\Net_Config.c
-      Net_Config.c
-      1
-      0
-    
-    
-      9
-      22
-      5
-      0
-      0
-      0
-      0
-      RTE\Network\Net_Config_BSD.h
-      Net_Config_BSD.h
-      1
-      0
-    
-    
-      9
-      23
-      5
-      0
-      0
-      0
-      0
-      RTE\Network\Net_Config_DNS_Client.h
-      Net_Config_DNS_Client.h
-      1
-      0
-    
-    
-      9
-      24
-      5
-      0
-      0
-      0
-      0
-      RTE\Network\Net_Config_ETH_0.h
-      Net_Config_ETH_0.h
-      1
-      0
-    
-    
-      9
-      25
-      5
-      0
-      0
-      0
-      0
-      RTE\Network\Net_Config_TCP.h
-      Net_Config_TCP.h
-      1
-      0
-    
-    
-      9
-      26
-      5
-      0
-      0
-      0
-      0
-      RTE\Network\Net_Config_UDP.h
-      Net_Config_UDP.h
-      1
-      0
-    
-    
-      9
-      27
-      1
-      1
-      0
-      0
-      0
-      RTE\Network\Net_Debug.c
-      Net_Debug.c
-      1
-      0
-    
-    
-      9
-      28
-      4
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib
-      Net_Dbg_CM3_L.lib
-      1
-      0
-    
   
 
   
     ::wolfSSL
-    0
+    1
     0
     0
     1
-    
-      10
-      29
-      5
-      0
-      0
-      0
-      0
-      RTE\wolfSSL\config-Crypt.h
-      config-Crypt.h
-      1
-      0
-    
-    
-      10
-      30
-      5
-      0
-      0
-      0
-      0
-      RTE\wolfSSL\config-CyaSSL.h
-      config-CyaSSL.h
-      1
-      0
-    
-    
-      10
-      31
-      5
-      0
-      0
-      0
-      0
-      RTE\wolfSSL\settings.h
-      settings.h
-      1
-      0
-    
-    
-      10
-      32
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c
-      cyassl_MDK_ARM.c
-      1
-      0
-    
-    
-      10
-      33
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c
-      aes.c
-      1
-      0
-    
-    
-      10
-      34
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c
-      arc4.c
-      1
-      0
-    
-    
-      10
-      35
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c
-      asm.c
-      1
-      0
-    
-    
-      10
-      36
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c
-      asn.c
-      1
-      0
-    
-    
-      10
-      37
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c
-      blake2b.c
-      1
-      0
-    
-    
-      10
-      38
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c
-      camellia.c
-      1
-      0
-    
-    
-      10
-      39
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c
-      coding.c
-      1
-      0
-    
-    
-      10
-      40
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c
-      compress.c
-      1
-      0
-    
-    
-      10
-      41
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c
-      des3.c
-      1
-      0
-    
-    
-      10
-      42
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c
-      dh.c
-      1
-      0
-    
-    
-      10
-      43
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c
-      dsa.c
-      1
-      0
-    
-    
-      10
-      44
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c
-      ecc.c
-      1
-      0
-    
-    
-      10
-      45
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c
-      ecc_fp.c
-      1
-      0
-    
-    
-      10
-      46
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c
-      error.c
-      1
-      0
-    
-    
-      10
-      47
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c
-      hc128.c
-      1
-      0
-    
-    
-      10
-      48
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c
-      hmac.c
-      1
-      0
-    
-    
-      10
-      49
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c
-      integer.c
-      1
-      0
-    
-    
-      10
-      50
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c
-      logging.c
-      1
-      0
-    
-    
-      10
-      51
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c
-      md2.c
-      1
-      0
-    
-    
-      10
-      52
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c
-      md4.c
-      1
-      0
-    
-    
-      10
-      53
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c
-      md5.c
-      1
-      0
-    
-    
-      10
-      54
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c
-      memory.c
-      1
-      0
-    
-    
-      10
-      55
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c
-      misc.c
-      1
-      0
-    
-    
-      10
-      56
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c
-      pwdbased.c
-      1
-      0
-    
-    
-      10
-      57
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c
-      rabbit.c
-      1
-      0
-    
-    
-      10
-      58
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c
-      random.c
-      1
-      0
-    
-    
-      10
-      59
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c
-      ripemd.c
-      1
-      0
-    
-    
-      10
-      60
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c
-      rsa.c
-      1
-      0
-    
-    
-      10
-      61
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c
-      sha.c
-      1
-      0
-    
-    
-      10
-      62
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c
-      sha256.c
-      1
-      0
-    
-    
-      10
-      63
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c
-      sha512.c
-      1
-      0
-    
-    
-      10
-      64
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c
-      tfm.c
-      1
-      0
-    
-    
-      10
-      65
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c
-      wc_port.c
-      1
-      0
-    
-    
-      10
-      66
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c
-      crl.c
-      1
-      0
-    
-    
-      10
-      67
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c
-      internal.c
-      1
-      0
-    
-    
-      10
-      68
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c
-      io.c
-      1
-      0
-    
-    
-      10
-      69
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c
-      keys.c
-      1
-      0
-    
-    
-      10
-      70
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c
-      ocsp.c
-      1
-      0
-    
-    
-      10
-      71
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c
-      sniffer.c
-      1
-      0
-    
-    
-      10
-      72
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c
-      ssl.c
-      1
-      0
-    
-    
-      10
-      73
-      1
-      0
-      0
-      0
-      0
-      C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c
-      tls.c
-      1
-      0
-    
   
 
 
diff --git a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx
index 4ea465518..8815b7c69 100644
--- a/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx
+++ b/IDE/MDK5-ARM/Projects/EchoClient/EchoClient.uvprojx
@@ -7,19 +7,21 @@
 
   
     
-      EchoClient
+      STM32F207 Flash
       0x4
       ARM-ADS
       
         
-          STM32F207IG
+          STM32F207IGHx
           STMicroelectronics
-          IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE
+          Keil.STM32F2xx_DFP.2.2.0
+          http://www.keil.com/pack
+          IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE
           
           
-          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm))
+          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM))
           0
-          $$Device:STM32F207IG$Device\Include\stm32f2xx.h
+          $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h
           
           
           
@@ -29,7 +31,7 @@
           
           
           
-          $$Device:STM32F207IG$SVD\STM32F20x.svd
+          $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd
           0
           0
           
@@ -104,11 +106,11 @@
         
         
           SARMCM3.DLL
-          -REMAP -MPU
+           -REMAP -MPU
           DCM.DLL
           -pCM3
           SARMCM3.DLL
-          -REMAP -MPU
+           -MPU
           TCM.DLL
           -pCM3
         
@@ -143,10 +145,9 @@
             1
             1
             1
-            1
           
           0
-          8
+          1
           
             
             
@@ -160,7 +161,7 @@
             
             
             .\STM32_SWO.ini
-            BIN\ULP2CM3.DLL
+            BIN\UL2CM3.DLL
           
         
         
@@ -173,8 +174,8 @@
             4100
           
           1
-          BIN\ULP2CM3.DLL
-          "" ()
+          BIN\UL2CM3.DLL
+          
           
           
           
@@ -355,14 +356,14 @@
             0
             0
             0
-            0
+            2
             0
             0
-            0
+            1
             0
             
-              
-              HAVE_CONFIG_H  MDK_CONF_EchoClient
+              --diag_suppress=1293
+              HSE_VALUE=25000000 HAVE_CONFIG_H  MDK_CONF_EchoClient WOLFSSL_USER_SETTINGS
               
               
             
@@ -412,30 +413,25 @@
               1
               .\main.c
             
-            
-              echoclient.c
-              1
-              .\echoclient.c
-            
           
         
         
           Configuration
           
-            
-              config-CyaSSL.h
-              5
-              .\RTE\wolfSSL\config-CyaSSL.h
-            
             
               config-Crypt.h
               5
               .\RTE\wolfSSL\config-Crypt.h
             
             
-              Net_Config_ETH_0.h
+              config-wolfSSL.h
               5
-              .\RTE\Network\Net_Config_ETH_0.h
+              .\RTE\wolfSSL\config-wolfSSL.h
+            
+            
+              user_settings.h
+              5
+              .\RTE\wolfSSL\user_settings.h
             
           
         
@@ -450,647 +446,397 @@
           
         
         
-          Devices
-          
-            
-              time-dummy.c
-              1
-              .\time-dummy.c
-            
-          
+          ::CMSIS
         
         
-          ::CMSIS
-          
-            
-              RTX_Conf_CM.c
-              1
-              RTE\CMSIS\RTX_Conf_CM.c
-            
-            
-              RTX_CM3.lib
-              4
-              C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib
-            
-          
+          ::CMSIS Driver
+        
+        
+          ::Compiler
         
         
           ::Device
-          
-            
-              RTE_Device.h
-              5
-              RTE\Device\STM32F207IG\RTE_Device.h
-            
-            
-              startup_stm32f2xx.s
-              2
-              RTE\Device\STM32F207IG\startup_stm32f2xx.s
-            
-            
-              system_stm32f2xx.c
-              1
-              RTE\Device\STM32F207IG\system_stm32f2xx.c
-            
-            
-              DMA_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c
-            
-            
-              GPIO_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c
-            
-          
-        
-        
-          ::Drivers
-          
-            
-              EMAC_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c
-            
-            
-              MCI_STM32F2xx.c
-              1
-              C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c
-            
-            
-              PHY_ST802RT1.c
-              1
-              C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c
-            
-          
         
         
           ::File System
-          
-            
-              FS_Config.c
-              1
-              RTE\File_System\FS_Config.c
-            
-            
-              FS_Config_MC_0.h
-              5
-              RTE\File_System\FS_Config_MC_0.h
-            
-            
-              FS_LFN_CM3_L.lib
-              4
-              C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib
-            
-          
         
         
           ::Network
-          
-            
-              Net_Config.c
-              1
-              RTE\Network\Net_Config.c
-            
-            
-              Net_Config_BSD.h
-              5
-              RTE\Network\Net_Config_BSD.h
-            
-            
-              Net_Config_DNS_Client.h
-              5
-              RTE\Network\Net_Config_DNS_Client.h
-            
-            
-              Net_Config_ETH_0.h
-              5
-              RTE\Network\Net_Config_ETH_0.h
-            
-            
-              Net_Config_TCP.h
-              5
-              RTE\Network\Net_Config_TCP.h
-            
-            
-              Net_Config_UDP.h
-              5
-              RTE\Network\Net_Config_UDP.h
-            
-            
-              Net_Debug.c
-              1
-              RTE\Network\Net_Debug.c
-            
-            
-              Net_Dbg_CM3_L.lib
-              4
-              C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib
-            
-          
         
         
           ::wolfSSL
-          
-            
-              config-Crypt.h
-              5
-              RTE\wolfSSL\config-Crypt.h
-            
-            
-              config-CyaSSL.h
-              5
-              RTE\wolfSSL\config-CyaSSL.h
-            
-            
-              settings.h
-              5
-              RTE\wolfSSL\settings.h
-            
-            
-              cyassl_MDK_ARM.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c
-            
-            
-              aes.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c
-            
-            
-              arc4.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c
-            
-            
-              asm.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c
-            
-            
-              asn.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c
-            
-            
-              blake2b.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c
-            
-            
-              camellia.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c
-            
-            
-              coding.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c
-            
-            
-              compress.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c
-            
-            
-              des3.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c
-            
-            
-              dh.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c
-            
-            
-              dsa.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c
-            
-            
-              ecc.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c
-            
-            
-              ecc_fp.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c
-            
-            
-              error.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c
-            
-            
-              hc128.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c
-            
-            
-              hmac.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c
-            
-            
-              integer.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c
-            
-            
-              logging.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c
-            
-            
-              md2.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c
-            
-            
-              md4.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c
-            
-            
-              md5.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c
-            
-            
-              memory.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c
-            
-            
-              misc.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c
-            
-            
-              pwdbased.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c
-            
-            
-              rabbit.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c
-            
-            
-              random.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c
-            
-            
-              ripemd.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c
-            
-            
-              rsa.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c
-            
-            
-              sha.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c
-            
-            
-              sha256.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c
-            
-            
-              sha512.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c
-            
-            
-              tfm.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c
-            
-            
-              wc_port.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c
-            
-            
-              crl.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c
-            
-            
-              internal.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c
-            
-            
-              io.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c
-            
-            
-              keys.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c
-            
-            
-              ocsp.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c
-            
-            
-              sniffer.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c
-            
-            
-              ssl.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c
-            
-            
-              tls.c
-              1
-              C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c
-            
-          
         
       
     
   
 
   
-    
-      
-        
-          
-        
-      
-      
-        
-          
-        
-      
-      
-        
-          
-        
-      
-      
-        
-          
-        
-      
-      
-        
-          
-        
-      
-    
     
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
       
         
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
-        
-      
-      
-        
-        
-          
-        
-      
-      
-        
-        
-          
+          
         
       
     
     
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
         
       
-      
-        
+      
+        
         
-          
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
+        
+      
+      
+        
+        
+          
         
       
     
     
-      
+      
         RTE\CMSIS\RTX_Conf_CM.c
-        
-        
+        
+        
         
-          
+          
+        
+      
+      
+        RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s
+        
+        
+        
+      
+      
+        RTE\Device\MK70FN1M0xxx12\system_MK70F12.c
+        
+        
+        
+      
+      
+        RTE\Device\STM32F207IGHx\RTE_Device.h
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGHx\startup_stm32f207xx.s
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h
+        
+        
+        
+          
+        
+      
+      
+        RTE\Device\STM32F207IGHx\system_stm32f2xx.c
+        
+        
+        
+          
         
       
       
-        RTE\Device\STM32F207IG\RTE_Device.h
-        
-        
-        
-          
-        
+        RTE\Device\STM32F207IG\RTE_Device.h
+        
+        
+        
+      
+      
+        RTE\Device\STM32F207IG\startup_stm32f207xx.s
+        
+        
+        
       
       
-        RTE\Device\STM32F207IG\startup_stm32f2xx.s
-        
-        
-        
-          
-        
+        RTE\Device\STM32F207IG\startup_stm32f2xx.s
+        
+        
+        
       
-      
-        RTE\Device\STM32F207IG\system_stm32f2xx.c
-        
-        
-        
-          
-        
+      
+        RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h
+        
+        
+        
       
-      
+      
+        RTE\Device\STM32F207IG\system_stm32f2xx.c
+        
+        
+        
+      
+      
+        RTE\Device\TM4C129ENCPDT\startup_TM4C129.s
+        
+        
+        
+      
+      
+        RTE\Device\TM4C129ENCPDT\system_tm4c129.c
+        
+        
+        
+      
+      
         RTE\File_System\FS_Config.c
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\File_System\FS_Config_MC_0.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config.c
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_BSD.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_DNS_Client.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_ETH_0.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_TCP.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
+      
         RTE\Network\Net_Config_UDP.h
-        
-        
+        
+        
         
-          
+          
         
       
-      
-        RTE\Network\Net_Debug.c
-        
-        
-        
-          
-        
+      
+        RTE\Network\Net_Debug.c
+        
+        
+        
       
       
         RTE\Other\config-Crypt.h
@@ -1116,20 +862,26 @@
         
         
       
-      
+      
         RTE\wolfSSL\config-Crypt.h
-        
-        
+        
+        
         
-          
+          
         
       
       
-        RTE\wolfSSL\config-CyaSSL.h
+        RTE\wolfSSL\config-CyaSSL.h
         
         
+        
+      
+      
+        RTE\wolfSSL\config-wolfSSL.h
+        
+        
         
-          
+          
         
       
       
@@ -1138,12 +890,18 @@
         
         
       
-      
-        RTE\wolfSSL\settings.h
-        
-        
+      
+        RTE\wolfSSL\settings.h
+        
+        
+        
+      
+      
+        RTE\wolfSSL\user_settings.h
+        
+        
         
-          
+          
         
       
     
diff --git a/IDE/MDK5-ARM/Projects/EchoClient/echoclient.c b/IDE/MDK5-ARM/Projects/EchoClient/echoclient.c
deleted file mode 100644
index 73c46ab18..000000000
--- a/IDE/MDK5-ARM/Projects/EchoClient/echoclient.c
+++ /dev/null
@@ -1,282 +0,0 @@
-/* echoclient.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 
-#endif
-
-#include 
-
-#include 
-
-#if defined(CYASSL_MDK_ARM)
-        #include 
-        #include 
-
-        #if defined(CYASSL_MDK5)
-            #include "cmsis_os.h"
-            #include "rl_fs.h" 
-            #include "rl_net.h" 
-        #else
-            #include "rtl.h"
-        #endif
-
-        #include "cyassl_MDK_ARM.h"
-#endif
-
-#include 
-
-#include "examples/echoclient/echoclient.h"
-
-void echoclient_test(void* args)
-{
-    SOCKET_T sockfd = 0;
-
-    FILE* fin   = stdin  ;
-    FILE* fout = stdout;
-
-    int inCreated  = 0;
-    int outCreated = 0;
-
-    char msg[1024];
-    char reply[1024+1];
-
-    SSL_METHOD* method = 0;
-    SSL_CTX*    ctx    = 0;
-    SSL*        ssl    = 0;
-
-    int doDTLS = 0;
-    int doPSK = 0;
-    int sendSz;
-    int argc    = 0;
-    char** argv = 0;
-    word16 port = yasslPort;
-
-    ((func_args*)args)->return_code = -1; /* error state */
-    
-#ifndef CYASSL_MDK_SHELL
-    argc = ((func_args*)args)->argc;
-    argv = ((func_args*)args)->argv;
-#endif
-
-    if (argc >= 2) {
-        fin  = fopen(argv[1], "r"); 
-        inCreated = 1;
-    }
-    if (argc >= 3) {
-        fout = fopen(argv[2], "w");
-        outCreated = 1;
-    }
-
-    if (!fin)  err_sys("can't open input file");
-    if (!fout) err_sys("can't open output file");
-
-#ifdef CYASSL_DTLS
-    doDTLS  = 1;
-#endif
-
-#ifdef CYASSL_LEANPSK 
-    doPSK = 1;
-#endif
-
-#if defined(NO_RSA) && !defined(HAVE_ECC)
-    doPSK = 1;
-#endif
-
-#if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && !defined(CYASSL_MDK_SHELL)
-    port = ((func_args*)args)->signal->port;
-#endif
-
-#if defined(CYASSL_DTLS)
-    method  = DTLSv1_client_method();
-#elif  !defined(NO_TLS)
-    method = CyaSSLv23_client_method();
-#else
-    method = SSLv3_client_method();
-#endif
-    ctx    = SSL_CTX_new(method);
-
-#ifndef NO_FILESYSTEM
-    #ifndef NO_RSA
-    if (SSL_CTX_load_verify_locations(ctx, caCert, 0) != SSL_SUCCESS)
-        err_sys("can't load ca file, Please run from CyaSSL home dir");
-    #endif
-    #ifdef HAVE_ECC
-        if (SSL_CTX_load_verify_locations(ctx, eccCert, 0) != SSL_SUCCESS)
-            err_sys("can't load ca file, Please run from CyaSSL home dir");
-    #endif
-#elif !defined(NO_CERTS)
-    if (!doPSK)
-        load_buffer(ctx, caCert, CYASSL_CA);
-#endif
-
-#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC)
-    /* don't use EDH, can't sniff tmp keys */
-    SSL_CTX_set_cipher_list(ctx, "AES256-SHA");
-#endif
-    if (doPSK) {
-#ifndef NO_PSK
-        const char *defaultCipherList;
-
-        CyaSSL_CTX_set_psk_client_callback(ctx, my_psk_client_cb);
-        #ifdef HAVE_NULL_CIPHER
-            defaultCipherList = "PSK-NULL-SHA256";
-        #else
-            defaultCipherList = "PSK-AES128-CBC-SHA256";
-        #endif
-        if (CyaSSL_CTX_set_cipher_list(ctx,defaultCipherList) !=SSL_SUCCESS)
-            err_sys("client can't set cipher list 2");
-#endif
-    }
-
-#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER)
-    SSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack);
-#endif
-
-    #if defined(CYASSL_MDK_ARM)
-    CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0);
-    #endif
-
-    ssl = SSL_new(ctx);
-        
-
-    if (doDTLS) {
-        SOCKADDR_IN_T addr;
-        build_addr(&addr, yasslIP, port, 1);
-        CyaSSL_dtls_set_peer(ssl, &addr, sizeof(addr));
-        tcp_socket(&sockfd, 1);
-    }
-    else {
-        tcp_connect(&sockfd, yasslIP, port, 0);
-    }
-        
-    SSL_set_fd(ssl, sockfd);
-#if defined(USE_WINDOWS_API) && defined(CYASSL_DTLS) && defined(NO_MAIN_DRIVER)
-    /* let echoserver bind first, TODO: add Windows signal like pthreads does */
-    Sleep(100);
-#endif
-
-    if (SSL_connect(ssl) != SSL_SUCCESS) err_sys("SSL_connect failed");
-
-    while (fgets(msg, sizeof(msg), fin) != 0) {
-     
-        sendSz = (int)strlen(msg);
-
-        if (SSL_write(ssl, msg, sendSz) != sendSz)
-            err_sys("SSL_write failed");
-
-        if (strncmp(msg, "quit", 4) == 0) {
-            fputs("sending server shutdown command: quit!\n", fout);
-            break;
-        }
-
-        if (strncmp(msg, "break", 5) == 0) {
-            fputs("sending server session close: break!\n", fout);
-            break;
-        }
-
-        #ifndef CYASSL_MDK_SHELL
-        while (sendSz) {
-            int got;
-            if ( (got = SSL_read(ssl, reply, sizeof(reply)-1)) > 0) {
-                reply[got] = 0;
-                fputs(reply, fout);
-                fflush(fout) ;
-                sendSz -= got;
-            }
-            else
-                break;
-        }
-        #else
-        {
-            int got;
-            if ( (got = SSL_read(ssl, reply, sizeof(reply)-1)) > 0) {
-                reply[got] = 0;
-                fputs(reply, fout);
-                fflush(fout) ;
-                sendSz -= got;
-            }
-        }
-        #endif
-    }
-
-
-#ifdef CYASSL_DTLS
-    strncpy(msg, "break", 6);
-    sendSz = (int)strlen(msg);
-    /* try to tell server done */
-    SSL_write(ssl, msg, sendSz);
-#else
-    SSL_shutdown(ssl);
-#endif
-
-    SSL_free(ssl);
-    SSL_CTX_free(ctx);
-
-    fflush(fout);
-    if (inCreated)  fclose(fin);
-    if (outCreated) fclose(fout);
-
-    CloseSocket(sockfd);
-    ((func_args*)args)->return_code = 0; 
-}
-
-
-/* so overall tests can pull in test function */
-#ifndef NO_MAIN_DRIVER
-
-    int main(int argc, char** argv)
-    {
-        func_args args;
-
-#ifdef HAVE_CAVIUM
-        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
-        if (ret != 0)
-            err_sys("Cavium OpenNitroxDevice failed");
-#endif /* HAVE_CAVIUM */
-
-        StartTCP();
-
-        args.argc = argc;
-        args.argv = argv;
-
-        CyaSSL_Init();
-#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL)
-        CyaSSL_Debugging_ON();
-#endif
-
-        if (CurrentDir("echoclient"))
-            ChangeDirBack(2);
-        else if (CurrentDir("Debug") || CurrentDir("Release"))
-            ChangeDirBack(3);
-        echoclient_test(&args);
-
-        CyaSSL_Cleanup();
-
-#ifdef HAVE_CAVIUM
-        CspShutdown(CAVIUM_DEV_ID);
-#endif
-        return args.return_code;
-    }
-        
-#endif /* NO_MAIN_DRIVER */
-
-
diff --git a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx
index ae9dc9356..1645ff076 100644
--- a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx
+++ b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvoptx
@@ -13,6 +13,7 @@
     *.txt; *.h; *.inc
     *.plm
     *.cpp
+    0
   
 
   
@@ -21,16 +22,17 @@
   
 
   
-    EchoServer
+    STM32F207 Flash
     0x4
     ARM-ADS
     
-      120000000
+      12000000
       
         1
         1
         0
         1
+        0
       
       
         1
@@ -75,17 +77,17 @@
         0
         1
       
-      255
+      18
       
         
           0
           Schematics (MCBSTM32F200)
-          C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf
+          C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf
         
         
           1
           User Manual (MCBSTM32F200)
-          C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm
+          C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm
         
         
           2
@@ -113,10 +115,9 @@
         1
         1
         1
-        1
         0
         0
-        8
+        1
         
         
         
@@ -127,9 +128,14 @@
         
         
         .\STM32_SWO.ini
-        BIN\ULP2CM3.DLL
+        BIN\UL2CM3.DLL
       
       
+        
+          0
+          ARMRTXEVENTFLAGS
+          -L70 -Z18 -C0 -M0 -T1
+        
         
           0
           DLGTARM
@@ -143,58 +149,26 @@
         
           0
           ULP2CM3
-          -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)
+          -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM)
         
         
           0
           DLGUARM
-          
+          (105=-1,-1,-1,-1,0)
         
         
           0
           UL2CM3
-          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm))
+          -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)
         
       
-      
-        
-          0
-          0
-          96
-          1
-          
134218906
- 0 - 0 - 0 - 0 - 0 - 1 - .\main.c - - -
- - 1 - 0 - 85 - 1 -
134218858
- 0 - 0 - 0 - 0 - 0 - 1 - .\main.c - - -
-
+ 1 8 - 0x20000408 + port + 0 @@ -202,6 +176,7 @@ 2 8 0x8004dc8 + 0 @@ -228,7 +203,7 @@ 0 0 1 - 0 + 1 0 0 0 @@ -257,19 +232,6 @@ 0 0
- - 1 - 2 - 1 - 0 - 0 - 0 - 0 - .\echoserver.c - echoserver.c - 0 - 0 - @@ -280,20 +242,7 @@ 0 2 - 3 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 0 - 0 - - - 2 - 4 + 2 5 0 0 @@ -306,28 +255,41 @@ 2 - 5 + 3 5 0 0 0 0 - .\RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h + .\RTE\wolfSSL\config-wolfSSL.h + config-wolfSSL.h + 0 + 0 + + + 2 + 4 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\user_settings.h + user_settings.h 0 0 - Documentation + Dcumentation 1 0 0 0 3 - 6 + 5 5 0 0 @@ -340,179 +302,36 @@ - - Devices - 1 - 0 - 0 - 0 - - 4 - 7 - 1 - 0 - 0 - 0 - 0 - .\time-dummy.c - time-dummy.c - 0 - 0 - - - ::CMSIS 1 0 0 1 - - 5 - 8 - 1 - 0 - 0 - 0 - 0 - RTE\CMSIS\RTX_Conf_CM.c - RTX_Conf_CM.c - 1 - 0 - - - 5 - 9 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - RTX_CM3.lib - 1 - 0 - + + + + ::CMSIS Driver + 1 + 0 + 0 + 1 + + + + ::Compiler + 1 + 0 + 0 + 1 ::Device - 0 + 1 0 0 1 - - 6 - 10 - 5 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\RTE_Device.h - RTE_Device.h - 1 - 0 - - - 6 - 11 - 2 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - startup_stm32f2xx.s - 1 - 0 - - - 6 - 12 - 1 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\system_stm32f2xx.c - system_stm32f2xx.c - 1 - 0 - - - 6 - 13 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - DMA_STM32F2xx.c - 1 - 0 - - - 6 - 14 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - GPIO_STM32F2xx.c - 1 - 0 - - - - - ::Drivers - 0 - 0 - 0 - 1 - - 7 - 15 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - EMAC_STM32F2xx.c - 1 - 0 - - - 7 - 16 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - MCI_STM32F2xx.c - 1 - 0 - - - 7 - 17 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - PHY_ST802RT1.c - 1 - 0 - @@ -521,157 +340,14 @@ 0 0 1 - - 8 - 18 - 1 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config.c - FS_Config.c - 1 - 0 - - - 8 - 19 - 5 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config_MC_0.h - FS_Config_MC_0.h - 1 - 0 - - - 8 - 20 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - FS_LFN_CM3_L.lib - 1 - 0 - ::Network - 0 + 1 0 0 1 - - 9 - 21 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config.c - Net_Config.c - 1 - 0 - - - 9 - 22 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_BSD.h - Net_Config_BSD.h - 1 - 0 - - - 9 - 23 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_DNS_Client.h - Net_Config_DNS_Client.h - 1 - 0 - - - 9 - 24 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h - 1 - 0 - - - 9 - 25 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_TCP.h - Net_Config_TCP.h - 1 - 0 - - - 9 - 26 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_UDP.h - Net_Config_UDP.h - 1 - 0 - - - 9 - 27 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Debug.c - Net_Debug.c - 1 - 0 - - - 9 - 28 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - Net_Dbg_CM3_L.lib - 1 - 0 - @@ -680,591 +356,6 @@ 0 0 1 - - 10 - 29 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 1 - 0 - - - 10 - 30 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 1 - 0 - - - 10 - 31 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\settings.h - settings.h - 1 - 0 - - - 10 - 32 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - cyassl_MDK_ARM.c - 1 - 0 - - - 10 - 33 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - aes.c - 1 - 0 - - - 10 - 34 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - arc4.c - 1 - 0 - - - 10 - 35 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - asm.c - 1 - 0 - - - 10 - 36 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - asn.c - 1 - 0 - - - 10 - 37 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - blake2b.c - 1 - 0 - - - 10 - 38 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - camellia.c - 1 - 0 - - - 10 - 39 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - coding.c - 1 - 0 - - - 10 - 40 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - compress.c - 1 - 0 - - - 10 - 41 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - des3.c - 1 - 0 - - - 10 - 42 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - dh.c - 1 - 0 - - - 10 - 43 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - dsa.c - 1 - 0 - - - 10 - 44 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - ecc.c - 1 - 0 - - - 10 - 45 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - ecc_fp.c - 1 - 0 - - - 10 - 46 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - error.c - 1 - 0 - - - 10 - 47 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - hc128.c - 1 - 0 - - - 10 - 48 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - hmac.c - 1 - 0 - - - 10 - 49 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - integer.c - 1 - 0 - - - 10 - 50 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - logging.c - 1 - 0 - - - 10 - 51 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - md2.c - 1 - 0 - - - 10 - 52 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - md4.c - 1 - 0 - - - 10 - 53 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - md5.c - 1 - 0 - - - 10 - 54 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - memory.c - 1 - 0 - - - 10 - 55 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - misc.c - 1 - 0 - - - 10 - 56 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - pwdbased.c - 1 - 0 - - - 10 - 57 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - rabbit.c - 1 - 0 - - - 10 - 58 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - random.c - 1 - 0 - - - 10 - 59 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - ripemd.c - 1 - 0 - - - 10 - 60 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - rsa.c - 1 - 0 - - - 10 - 61 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - sha.c - 1 - 0 - - - 10 - 62 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - sha256.c - 1 - 0 - - - 10 - 63 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - sha512.c - 1 - 0 - - - 10 - 64 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - tfm.c - 1 - 0 - - - 10 - 65 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - wc_port.c - 1 - 0 - - - 10 - 66 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - crl.c - 1 - 0 - - - 10 - 67 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - internal.c - 1 - 0 - - - 10 - 68 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - io.c - 1 - 0 - - - 10 - 69 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - keys.c - 1 - 0 - - - 10 - 70 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - ocsp.c - 1 - 0 - - - 10 - 71 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - sniffer.c - 1 - 0 - - - 10 - 72 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - ssl.c - 1 - 0 - - - 10 - 73 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - tls.c - 1 - 0 - diff --git a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx index 646373a09..f1c972b75 100644 --- a/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx +++ b/IDE/MDK5-ARM/Projects/EchoServer/EchoServer.uvprojx @@ -7,19 +7,21 @@ - EchoServer + STM32F207 Flash 0x4 ARM-ADS - STM32F207IG + STM32F207IGHx STMicroelectronics - IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE + Keil.STM32F2xx_DFP.2.2.0 + http://www.keil.com/pack + IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) 0 - $$Device:STM32F207IG$Device\Include\stm32f2xx.h + $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h @@ -29,7 +31,7 @@ - $$Device:STM32F207IG$SVD\STM32F20x.svd + $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd 0 0 @@ -45,7 +47,7 @@ 1 .\Object\ - EchoServer + EchoClient 1 0 0 @@ -104,11 +106,11 @@ SARMCM3.DLL - -REMAP -MPU + -REMAP -MPU DCM.DLL -pCM3 SARMCM3.DLL - -REMAP -MPU + -MPU TCM.DLL -pCM3 @@ -143,10 +145,9 @@ 1 1 1 - 1 0 - 8 + 1 @@ -160,7 +161,7 @@ .\STM32_SWO.ini - BIN\ULP2CM3.DLL + BIN\UL2CM3.DLL @@ -173,8 +174,8 @@ 4100 1 - BIN\ULP2CM3.DLL - "" () + BIN\UL2CM3.DLL + @@ -355,14 +356,14 @@ 0 0 0 - 0 + 2 0 0 - 0 + 1 0 - - HAVE_CONFIG_H MDK_CONF_SimpleClient + --diag_suppress=1293 + HSE_VALUE=25000000 HAVE_CONFIG_H MDK_CONF_EchoClient WOLFSSL_USER_SETTINGS @@ -412,35 +413,30 @@ 1 .\main.c - - echoserver.c - 1 - .\echoserver.c - Configuration - - config-CyaSSL.h - 5 - .\RTE\wolfSSL\config-CyaSSL.h - config-Crypt.h 5 .\RTE\wolfSSL\config-Crypt.h - Net_Config_ETH_0.h + config-wolfSSL.h 5 - .\RTE\Network\Net_Config_ETH_0.h + .\RTE\wolfSSL\config-wolfSSL.h + + + user_settings.h + 5 + .\RTE\wolfSSL\user_settings.h - Documentation + Dcumentation Abstract.txt @@ -450,647 +446,397 @@ - Devices - - - time-dummy.c - 1 - .\time-dummy.c - - + ::CMSIS - ::CMSIS - - - RTX_Conf_CM.c - 1 - RTE\CMSIS\RTX_Conf_CM.c - - - RTX_CM3.lib - 4 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - - + ::CMSIS Driver + + + ::Compiler ::Device - - - RTE_Device.h - 5 - RTE\Device\STM32F207IG\RTE_Device.h - - - startup_stm32f2xx.s - 2 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - system_stm32f2xx.c - 1 - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - DMA_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - - - GPIO_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - - - - - ::Drivers - - - EMAC_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - - - MCI_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - - - PHY_ST802RT1.c - 1 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - - ::File System - - - FS_Config.c - 1 - RTE\File_System\FS_Config.c - - - FS_Config_MC_0.h - 5 - RTE\File_System\FS_Config_MC_0.h - - - FS_LFN_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - - ::Network - - - Net_Config.c - 1 - RTE\Network\Net_Config.c - - - Net_Config_BSD.h - 5 - RTE\Network\Net_Config_BSD.h - - - Net_Config_DNS_Client.h - 5 - RTE\Network\Net_Config_DNS_Client.h - - - Net_Config_ETH_0.h - 5 - RTE\Network\Net_Config_ETH_0.h - - - Net_Config_TCP.h - 5 - RTE\Network\Net_Config_TCP.h - - - Net_Config_UDP.h - 5 - RTE\Network\Net_Config_UDP.h - - - Net_Debug.c - 1 - RTE\Network\Net_Debug.c - - - Net_Dbg_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - - ::wolfSSL - - - config-Crypt.h - 5 - RTE\wolfSSL\config-Crypt.h - - - config-CyaSSL.h - 5 - RTE\wolfSSL\config-CyaSSL.h - - - settings.h - 5 - RTE\wolfSSL\settings.h - - - cyassl_MDK_ARM.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - - - aes.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - - - arc4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - - - asm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - - - asn.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - - - blake2b.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - - - camellia.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - - - coding.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - - - compress.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - - - des3.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - - - dh.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - - - dsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - - - ecc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - - - ecc_fp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - - - error.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - - - hc128.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - - - hmac.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - - - integer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - - - logging.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - - - md2.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - - - md4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - - - md5.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - - - memory.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - - - misc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - - - pwdbased.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - - - rabbit.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - - - random.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - - - ripemd.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - - - rsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - - - sha.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - - - sha256.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - - - sha512.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - - - tfm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - - - wc_port.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - - - crl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - - - internal.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - - - io.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - - - keys.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - - - ocsp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - - - sniffer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - - - ssl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - - - tls.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + - - + + - - - - - - - - - - - - - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + RTE\CMSIS\RTX_Conf_CM.c - - + + - + + + + + RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s + + + + + + RTE\Device\MK70FN1M0xxx12\system_MK70F12.c + + + + + + RTE\Device\STM32F207IGHx\RTE_Device.h + + + + + + + + RTE\Device\STM32F207IGHx\startup_stm32f207xx.s + + + + + + + + RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h + + + + + + + + RTE\Device\STM32F207IGHx\system_stm32f2xx.c + + + + - RTE\Device\STM32F207IG\RTE_Device.h - - - - - + RTE\Device\STM32F207IG\RTE_Device.h + + + + + + RTE\Device\STM32F207IG\startup_stm32f207xx.s + + + - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - + RTE\Device\STM32F207IG\startup_stm32f2xx.s + + + - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - + + RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h + + + - + + RTE\Device\STM32F207IG\system_stm32f2xx.c + + + + + + RTE\Device\TM4C129ENCPDT\startup_TM4C129.s + + + + + + RTE\Device\TM4C129ENCPDT\system_tm4c129.c + + + + + RTE\File_System\FS_Config.c - - + + - + - + RTE\File_System\FS_Config_MC_0.h - - + + - + - + RTE\Network\Net_Config.c - - + + - + - + RTE\Network\Net_Config_BSD.h - - + + - + - + RTE\Network\Net_Config_DNS_Client.h - - + + - + - + RTE\Network\Net_Config_ETH_0.h - - + + - + - + RTE\Network\Net_Config_TCP.h - - + + - + - + RTE\Network\Net_Config_UDP.h - - + + - + - - RTE\Network\Net_Debug.c - - - - - + + RTE\Network\Net_Debug.c + + + RTE\Other\config-Crypt.h @@ -1116,20 +862,26 @@ - + RTE\wolfSSL\config-Crypt.h - - + + - + - RTE\wolfSSL\config-CyaSSL.h + RTE\wolfSSL\config-CyaSSL.h + + + + RTE\wolfSSL\config-wolfSSL.h + + - + @@ -1138,12 +890,18 @@ - - RTE\wolfSSL\settings.h - - + + RTE\wolfSSL\settings.h + + + + + + RTE\wolfSSL\user_settings.h + + - + diff --git a/IDE/MDK5-ARM/Projects/EchoServer/echoserver.c b/IDE/MDK5-ARM/Projects/EchoServer/echoserver.c deleted file mode 100644 index 407018964..000000000 --- a/IDE/MDK5-ARM/Projects/EchoServer/echoserver.c +++ /dev/null @@ -1,368 +0,0 @@ -/* echoserver.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 -#endif - -#include - -#if defined(CYASSL_MDK_ARM) - #include - #include - - #if defined(CYASSL_MDK5) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #endif - - #include "cyassl_MDK_ARM.h" -#endif - -#include -#include - -#ifndef NO_MAIN_DRIVER - #define ECHO_OUT -#endif - -#include "examples/echoserver/echoserver.h" - - -#ifdef SESSION_STATS - CYASSL_API void PrintSessionStats(void); -#endif - -#define SVR_COMMAND_SIZE 256 - -static void SignalReady(void* args, word16 port) -{ -#if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER) && !defined(__MINGW32__) - /* signal ready to tcp_accept */ - func_args* server_args = (func_args*)args; - tcp_ready* ready = server_args->signal; - pthread_mutex_lock(&ready->mutex); - ready->ready = 1; - ready->port = port; - pthread_cond_signal(&ready->cond); - pthread_mutex_unlock(&ready->mutex); -#endif - (void)args; - (void)port; -} - - -THREAD_RETURN CYASSL_THREAD echoserver_test(void* args) -{ - SOCKET_T sockfd = 0; - CYASSL_METHOD* method = 0; - CYASSL_CTX* ctx = 0; - - int doDTLS = 0; - int doPSK = 0; - int outCreated = 0; - int shutDown = 0; - int useAnyAddr = 0; - word16 port = yasslPort; - int argc = ((func_args*)args)->argc; - char** argv = ((func_args*)args)->argv; - -#ifdef ECHO_OUT - FILE* fout = stdout; - if (argc >= 2) { - fout = fopen(argv[1], "w"); - outCreated = 1; - } - if (!fout) err_sys("can't open output file"); -#endif - (void)outCreated; - (void)argc; - (void)argv; - - ((func_args*)args)->return_code = -1; /* error state */ - -#ifdef CYASSL_DTLS - doDTLS = 1; -#endif - -#ifdef CYASSL_LEANPSK - doPSK = 1; -#endif - -#if defined(NO_RSA) && !defined(HAVE_ECC) - doPSK = 1; -#endif - - #if defined(NO_MAIN_DRIVER) && !defined(USE_WINDOWS_API) && \ - !defined(CYASSL_SNIFFER) && !defined(CYASSL_MDK_ARM) - port = 0; - #endif - #if defined(USE_ANY_ADDR) - useAnyAddr = 1; - #endif - tcp_listen(&sockfd, &port, useAnyAddr, doDTLS); - -#if defined(CYASSL_DTLS) - method = CyaDTLSv1_server_method(); -#elif !defined(NO_TLS) - method = CyaSSLv23_server_method(); -#else - method = wolfSSLv3_server_method(); -#endif - ctx = CyaSSL_CTX_new(method); - /* CyaSSL_CTX_set_session_cache_mode(ctx, SSL_SESS_CACHE_OFF); */ - -#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) - CyaSSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack); -#endif - -#ifndef NO_FILESYSTEM - if (doPSK == 0) { - #ifdef HAVE_NTRU - /* ntru */ - if (CyaSSL_CTX_use_certificate_file(ctx, ntruCert, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load ntru cert file, " - "Please run from CyaSSL home dir"); - - if (CyaSSL_CTX_use_NTRUPrivateKey_file(ctx, ntruKey) - != SSL_SUCCESS) - err_sys("can't load ntru key file, " - "Please run from CyaSSL home dir"); - #elif defined(HAVE_ECC) - /* ecc */ - if (CyaSSL_CTX_use_certificate_file(ctx, eccCert, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server cert file, " - "Please run from CyaSSL home dir"); - - if (CyaSSL_CTX_use_PrivateKey_file(ctx, eccKey, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server key file, " - "Please run from CyaSSL home dir"); - #elif defined(NO_CERTS) - /* do nothing, just don't load cert files */ - #else - /* normal */ - if (CyaSSL_CTX_use_certificate_file(ctx, svrCert, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server cert file, " - "Please run from CyaSSL home dir"); - - if (CyaSSL_CTX_use_PrivateKey_file(ctx, svrKey, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server key file, " - "Please run from CyaSSL home dir"); - #endif - } /* doPSK */ -#elif !defined(NO_CERTS) - if (!doPSK) { - load_buffer(ctx, svrCert, CYASSL_CERT); - load_buffer(ctx, svrKey, CYASSL_KEY); - } -#endif - -#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC) - /* don't use EDH, can't sniff tmp keys */ - CyaSSL_CTX_set_cipher_list(ctx, "AES256-SHA"); -#endif - - if (doPSK) { -#ifndef NO_PSK - const char *defaultCipherList; - - CyaSSL_CTX_set_psk_server_callback(ctx, my_psk_server_cb); - CyaSSL_CTX_use_psk_identity_hint(ctx, "cyassl server"); - #ifdef HAVE_NULL_CIPHER - defaultCipherList = "PSK-NULL-SHA256"; - #else - defaultCipherList = "PSK-AES128-CBC-SHA256"; - #endif - if (CyaSSL_CTX_set_cipher_list(ctx, defaultCipherList) != SSL_SUCCESS) - err_sys("server can't set cipher list 2"); -#endif - } - - SignalReady(args, port); - - while (!shutDown) { - CYASSL* ssl = 0; - char command[SVR_COMMAND_SIZE+1]; - int echoSz = 0; - int clientfd; - int firstRead = 1; - int gotFirstG = 0; - -#ifndef CYASSL_DTLS - SOCKADDR_IN_T client; - socklen_t client_len = sizeof(client); - clientfd = accept(sockfd, (struct sockaddr*)&client, - (ACCEPT_THIRD_T)&client_len); -#else - clientfd = udp_read_connect(sockfd); -#endif - if (clientfd == -1) err_sys("tcp accept failed"); - - ssl = CyaSSL_new(ctx); - if (ssl == NULL) err_sys("SSL_new failed"); - CyaSSL_set_fd(ssl, clientfd); - #if !defined(NO_FILESYSTEM) && !defined(NO_DH) - CyaSSL_SetTmpDH_file(ssl, dhParam, SSL_FILETYPE_PEM); - #elif !defined(NO_DH) - SetDH(ssl); /* will repick suites with DHE, higher than PSK */ - #endif - if (CyaSSL_accept(ssl) != SSL_SUCCESS) { - printf("SSL_accept failed\n"); - CyaSSL_free(ssl); - CloseSocket(clientfd); - continue; - } -#if defined(PEER_INFO) - showPeer(ssl); -#endif - - while ( (echoSz = CyaSSL_read(ssl, command, sizeof(command)-1)) > 0) { - - if (firstRead == 1) { - firstRead = 0; /* browser may send 1 byte 'G' to start */ - if (echoSz == 1 && command[0] == 'G') { - gotFirstG = 1; - continue; - } - } - else if (gotFirstG == 1 && strncmp(command, "ET /", 4) == 0) { - strncpy(command, "GET", 4); - /* fall through to normal GET */ - } - - if ( strncmp(command, "quit", 4) == 0) { - printf("client sent quit command: shutting down!\n"); - shutDown = 1; - break; - } - if ( strncmp(command, "break", 5) == 0) { - printf("client sent break command: closing session!\n"); - break; - } -#ifdef SESSION_STATS - if ( strncmp(command, "printstats", 10) == 0) { - PrintSessionStats(); - break; - } -#endif - if ( strncmp(command, "GET", 3) == 0) { - char type[] = "HTTP/1.0 200 ok\r\nContent-type:" - " text/html\r\n\r\n"; - char header[] = "\n
\n";
-                char body[]   = "greetings from CyaSSL\n";
-                char footer[] = "\r\n\r\n";
-            
-                strncpy(command, type, sizeof(type));
-                echoSz = sizeof(type) - 1;
-
-                strncpy(&command[echoSz], header, sizeof(header));
-                echoSz += (int)sizeof(header) - 1;
-                strncpy(&command[echoSz], body, sizeof(body));
-                echoSz += (int)sizeof(body) - 1;
-                strncpy(&command[echoSz], footer, sizeof(footer));
-                echoSz += (int)sizeof(footer);
-
-                if (CyaSSL_write(ssl, command, echoSz) != echoSz)
-                    err_sys("SSL_write failed");
-                break;
-            }
-            command[echoSz] = 0;
-
-            #ifdef ECHO_OUT
-                fputs(command, fout);
-            #endif
-
-            if (CyaSSL_write(ssl, command, echoSz) != echoSz)
-                err_sys("SSL_write failed");
-        }
-#ifndef CYASSL_DTLS
-        CyaSSL_shutdown(ssl);
-#endif
-        CyaSSL_free(ssl);
-        CloseSocket(clientfd);
-#ifdef CYASSL_DTLS
-        tcp_listen(&sockfd, &port, useAnyAddr, doDTLS);
-        SignalReady(args, port);
-#endif
-    }
-
-    CloseSocket(sockfd);
-    CyaSSL_CTX_free(ctx);
-
-#ifdef ECHO_OUT
-    if (outCreated)
-        fclose(fout);
-#endif
-
-    ((func_args*)args)->return_code = 0;
-    return 0;
-}
-
-
-/* so overall tests can pull in test function */
-#ifndef NO_MAIN_DRIVER
-
-    int main(int argc, char** argv)
-    {
-        func_args args;
-
-#ifdef HAVE_CAVIUM
-        int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID);
-        if (ret != 0)
-            err_sys("Cavium OpenNitroxDevice failed");
-#endif /* HAVE_CAVIUM */
-
-        StartTCP();
-
-        args.argc = argc;
-        args.argv = argv;
-
-        CyaSSL_Init();
-#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL)
-        CyaSSL_Debugging_ON();
-#endif
-        if (CurrentDir("echoserver"))
-            ChangeDirBack(2);
-        else if (CurrentDir("Debug") || CurrentDir("Release"))
-            ChangeDirBack(3);
-        echoserver_test(&args);
-        CyaSSL_Cleanup();
-
-#ifdef HAVE_CAVIUM
-        CspShutdown(CAVIUM_DEV_ID);
-#endif
-        return args.return_code;
-    }
-
-        
-#endif /* NO_MAIN_DRIVER */
-
-
-
-
diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx
index 46654d1ce..92b94982a 100644
--- a/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx
+++ b/IDE/MDK5-ARM/Projects/SimpleClient/SimpleClient.uvoptx
@@ -13,6 +13,7 @@
     *.txt; *.h; *.inc
     *.plm
     *.cpp
+    0
   
 
   
@@ -21,16 +22,17 @@
   
 
   
-    SimpleClient
+    STM32F207 Flash
     0x4
     ARM-ADS
     
-      120000000
+      12000000
       
         1
         1
         0
         1
+        0
       
       
         1
@@ -75,17 +77,17 @@
         0
         1
       
-      255
+      18
       
         
           0
           Schematics (MCBSTM32F200)
-          C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf
+          C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf
         
         
           1
           User Manual (MCBSTM32F200)
-          C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm
+          C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm
         
         
           2
@@ -113,10 +115,9 @@
         1
         1
         1
-        1
         0
         0
-        8
+        1
         
         
         
@@ -127,9 +128,14 @@
         
         
         .\STM32_SWO.ini
-        BIN\ULP2CM3.DLL
+        BIN\UL2CM3.DLL
       
       
+        
+          0
+          ARMRTXEVENTFLAGS
+          -L70 -Z18 -C0 -M0 -T1
+        
         
           0
           DLGTARM
@@ -143,25 +149,43 @@
         
           0
           ULP2CM3
-          -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)
+          -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM)
         
         
           0
           DLGUARM
-          
+          (105=-1,-1,-1,-1,0)
         
         
           0
           UL2CM3
-          UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm))
+          -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)
         
       
-      
+      
+        
+          0
+          0
+          109
+          1
+          
0
+ 0 + 0 + 0 + 0 + 0 + 0 + .\main.c + + +
+
1 8 - 0x20000408 + port + 0 @@ -169,6 +193,7 @@ 2 8 0x8004dc8 + 0 @@ -195,7 +220,7 @@ 0 0 1 - 0 + 1 0 0 0 @@ -232,8 +257,8 @@ 0 0 0 - .\client.c - client.c + .\time-CortexM3-4.c + time-CortexM3-4.c 0 0 @@ -253,8 +278,8 @@ 0 0 0 - .\config-SimpleClient.h - config-SimpleClient.h + .\RTE\wolfSSL\config-Crypt.h + config-Crypt.h 0 0 @@ -266,8 +291,8 @@ 0 0 0 - .\RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h + .\RTE\wolfSSL\config-wolfSSL.h + config-wolfSSL.h 0 0 @@ -279,8 +304,8 @@ 0 0 0 - .\RTE\wolfSSL\config-Crypt.h - config-Crypt.h + .\RTE\wolfSSL\user_settings.h + user_settings.h 0 0 @@ -292,15 +317,15 @@ 0 0 0 - .\RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h + .\config-SimpleClient.h + config-SimpleClient.h 0 0 - Documentation + Dcumentation 1 0 0 @@ -320,192 +345,36 @@ - - Devices - 1 - 0 - 0 - 0 - - 4 - 8 - 1 - 0 - 0 - 0 - 0 - .\time-dummy.c - time-dummy.c - 0 - 0 - - - 4 - 9 - 1 - 0 - 0 - 0 - 0 - .\time-CortexM3-4.c - time-CortexM3-4.c - 0 - 0 - - - ::CMSIS 1 0 0 1 - - 5 - 10 - 1 - 0 - 0 - 0 - 0 - RTE\CMSIS\RTX_Conf_CM.c - RTX_Conf_CM.c - 1 - 0 - - - 5 - 11 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - RTX_CM3.lib - 1 - 0 - + + + + ::CMSIS Driver + 1 + 0 + 0 + 1 + + + + ::Compiler + 1 + 0 + 0 + 1 ::Device - 0 + 1 0 0 1 - - 6 - 12 - 5 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\RTE_Device.h - RTE_Device.h - 1 - 0 - - - 6 - 13 - 2 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - startup_stm32f2xx.s - 1 - 0 - - - 6 - 14 - 1 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\system_stm32f2xx.c - system_stm32f2xx.c - 1 - 0 - - - 6 - 15 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - DMA_STM32F2xx.c - 1 - 0 - - - 6 - 16 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - GPIO_STM32F2xx.c - 1 - 0 - - - - - ::Drivers - 0 - 0 - 0 - 1 - - 7 - 17 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - EMAC_STM32F2xx.c - 1 - 0 - - - 7 - 18 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - MCI_STM32F2xx.c - 1 - 0 - - - 7 - 19 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - PHY_ST802RT1.c - 1 - 0 - @@ -514,157 +383,14 @@ 0 0 1 - - 8 - 20 - 1 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config.c - FS_Config.c - 1 - 0 - - - 8 - 21 - 5 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config_MC_0.h - FS_Config_MC_0.h - 1 - 0 - - - 8 - 22 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - FS_LFN_CM3_L.lib - 1 - 0 - ::Network - 0 + 1 0 0 1 - - 9 - 23 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config.c - Net_Config.c - 1 - 0 - - - 9 - 24 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_BSD.h - Net_Config_BSD.h - 1 - 0 - - - 9 - 25 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_DNS_Client.h - Net_Config_DNS_Client.h - 1 - 0 - - - 9 - 26 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h - 1 - 0 - - - 9 - 27 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_TCP.h - Net_Config_TCP.h - 1 - 0 - - - 9 - 28 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_UDP.h - Net_Config_UDP.h - 1 - 0 - - - 9 - 29 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Debug.c - Net_Debug.c - 1 - 0 - - - 9 - 30 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - Net_Dbg_CM3_L.lib - 1 - 0 - @@ -673,591 +399,6 @@ 0 0 1 - - 10 - 31 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 1 - 0 - - - 10 - 32 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 1 - 0 - - - 10 - 33 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\settings.h - settings.h - 1 - 0 - - - 10 - 34 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - cyassl_MDK_ARM.c - 1 - 0 - - - 10 - 35 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - aes.c - 1 - 0 - - - 10 - 36 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - arc4.c - 1 - 0 - - - 10 - 37 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - asm.c - 1 - 0 - - - 10 - 38 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - asn.c - 1 - 0 - - - 10 - 39 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - blake2b.c - 1 - 0 - - - 10 - 40 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - camellia.c - 1 - 0 - - - 10 - 41 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - coding.c - 1 - 0 - - - 10 - 42 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - compress.c - 1 - 0 - - - 10 - 43 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - des3.c - 1 - 0 - - - 10 - 44 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - dh.c - 1 - 0 - - - 10 - 45 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - dsa.c - 1 - 0 - - - 10 - 46 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - ecc.c - 1 - 0 - - - 10 - 47 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - ecc_fp.c - 1 - 0 - - - 10 - 48 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - error.c - 1 - 0 - - - 10 - 49 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - hc128.c - 1 - 0 - - - 10 - 50 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - hmac.c - 1 - 0 - - - 10 - 51 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - integer.c - 1 - 0 - - - 10 - 52 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - logging.c - 1 - 0 - - - 10 - 53 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - md2.c - 1 - 0 - - - 10 - 54 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - md4.c - 1 - 0 - - - 10 - 55 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - md5.c - 1 - 0 - - - 10 - 56 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - memory.c - 1 - 0 - - - 10 - 57 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - misc.c - 1 - 0 - - - 10 - 58 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - pwdbased.c - 1 - 0 - - - 10 - 59 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - rabbit.c - 1 - 0 - - - 10 - 60 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - random.c - 1 - 0 - - - 10 - 61 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - ripemd.c - 1 - 0 - - - 10 - 62 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - rsa.c - 1 - 0 - - - 10 - 63 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - sha.c - 1 - 0 - - - 10 - 64 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - sha256.c - 1 - 0 - - - 10 - 65 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - sha512.c - 1 - 0 - - - 10 - 66 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - tfm.c - 1 - 0 - - - 10 - 67 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - wc_port.c - 1 - 0 - - - 10 - 68 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - crl.c - 1 - 0 - - - 10 - 69 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - internal.c - 1 - 0 - - - 10 - 70 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - io.c - 1 - 0 - - - 10 - 71 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - keys.c - 1 - 0 - - - 10 - 72 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - ocsp.c - 1 - 0 - - - 10 - 73 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - sniffer.c - 1 - 0 - - - 10 - 74 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - ssl.c - 1 - 0 - - - 10 - 75 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - tls.c - 1 - 0 - diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/client.c b/IDE/MDK5-ARM/Projects/SimpleClient/client.c deleted file mode 100644 index 8382a540f..000000000 --- a/IDE/MDK5-ARM/Projects/SimpleClient/client.c +++ /dev/null @@ -1,862 +0,0 @@ -/* client.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 -#endif - -#if defined(CYASSL_MDK_ARM) - #include - #include - - #if defined(CYASSL_MDK5) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #endif - - #include "cyassl_MDK_ARM.h" -#endif - -#include - -#if !defined(CYASSL_TRACK_MEMORY) && !defined(NO_MAIN_DRIVER) - /* in case memory tracker wants stats */ - #define CYASSL_TRACK_MEMORY -#endif - -#include - -#include - -#include "examples/client/client.h" - - -#ifdef CYASSL_CALLBACKS - int handShakeCB(HandShakeInfo*); - int timeoutCB(TimeoutInfo*); - Timeval timeout; -#endif - - -static void NonBlockingSSL_Connect(CYASSL* ssl) -{ -#ifndef CYASSL_CALLBACKS - int ret = CyaSSL_connect(ssl); -#else - int ret = CyaSSL_connect_ex(ssl, handShakeCB, timeoutCB, timeout); -#endif - int error = CyaSSL_get_error(ssl, 0); - SOCKET_T sockfd = (SOCKET_T)CyaSSL_get_fd(ssl); - int select_ret; - - while (ret != SSL_SUCCESS && (error == SSL_ERROR_WANT_READ || - error == SSL_ERROR_WANT_WRITE)) { - int currTimeout = 1; - - if (error == SSL_ERROR_WANT_READ) - printf("... client would read block\n"); - else - printf("... client would write block\n"); - -#ifdef CYASSL_DTLS - currTimeout = CyaSSL_dtls_get_current_timeout(ssl); -#endif - select_ret = tcp_select(sockfd, currTimeout); - - if ((select_ret == TEST_RECV_READY) || - (select_ret == TEST_ERROR_READY)) { - #ifndef CYASSL_CALLBACKS - ret = CyaSSL_connect(ssl); - #else - ret = CyaSSL_connect_ex(ssl,handShakeCB,timeoutCB,timeout); - #endif - error = CyaSSL_get_error(ssl, 0); - } - else if (select_ret == TEST_TIMEOUT && !CyaSSL_dtls(ssl)) { - error = SSL_ERROR_WANT_READ; - } -#ifdef CYASSL_DTLS - else if (select_ret == TEST_TIMEOUT && CyaSSL_dtls(ssl) && - CyaSSL_dtls_got_timeout(ssl) >= 0) { - error = SSL_ERROR_WANT_READ; - } -#endif - else { - error = SSL_FATAL_ERROR; - } - } - if (ret != SSL_SUCCESS) - err_sys("SSL_connect failed"); -} - - -static void Usage(void) -{ - printf("client " LIBCYASSL_VERSION_STRING - " NOTE: All files relative to CyaSSL home dir\n"); - printf("-? Help, print this usage\n"); - printf("-h Host to connect to, default %s\n", yasslIP); - printf("-p Port to connect on, not 0, default %d\n", yasslPort); - printf("-v SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n", - CLIENT_DEFAULT_VERSION); - printf("-l Cipher list\n"); - printf("-c Certificate file, default %s\n", cliCert); - printf("-k Key file, default %s\n", cliKey); - printf("-A Certificate Authority file, default %s\n", caCert); - printf("-b Benchmark connections and print stats\n"); - printf("-s Use pre Shared keys\n"); - printf("-t Track CyaSSL memory use\n"); - printf("-d Disable peer checks\n"); - printf("-D Override Date Errors example\n"); - printf("-g Send server HTTP GET\n"); - printf("-u Use UDP DTLS," - " add -v 2 for DTLSv1 (default), -v 3 for DTLSv1.2\n"); - printf("-m Match domain name in cert\n"); - printf("-N Use Non-blocking sockets\n"); - printf("-r Resume session\n"); - printf("-f Fewer packets/group messages\n"); - printf("-x Disable client cert/key loading\n"); -#ifdef SHOW_SIZES - printf("-z Print structure sizes\n"); -#endif -#ifdef HAVE_SNI - printf("-S Use Host Name Indication\n"); -#endif -#ifdef HAVE_MAX_FRAGMENT - printf("-L Use Maximum Fragment Length [1-5]\n"); -#endif -#ifdef HAVE_TRUNCATED_HMAC - printf("-T Use Truncated HMAC\n"); -#endif -#ifdef HAVE_OCSP - printf("-o Perform OCSP lookup on peer certificate\n"); - printf("-O Perform OCSP lookup using as responder\n"); -#endif -#ifdef ATOMIC_USER - printf("-U Atomic User Record Layer Callbacks\n"); -#endif -#ifdef HAVE_PK_CALLBACKS - printf("-P Public Key Callbacks\n"); -#endif -} - -THREAD_RETURN CYASSL_THREAD client_test(void* args) -{ - SOCKET_T sockfd = 0; - - CYASSL_METHOD* method = 0; - CYASSL_CTX* ctx = 0; - CYASSL* ssl = 0; - - CYASSL* sslResume = 0; - CYASSL_SESSION* session = 0; - char resumeMsg[] = "resuming cyassl!"; - int resumeSz = sizeof(resumeMsg); - - char msg[32] = "hello cyassl!"; /* GET may make bigger */ - char reply[80]; - int input; - int msgSz = (int)strlen(msg); - - word16 port = yasslPort; - char* host = (char*)yasslIP; - const char* domain = "www.yassl.com"; - - int ch; - int version = CLIENT_INVALID_VERSION; - int usePsk = 0; - int sendGET = 0; - int benchmark = 0; - int doDTLS = 0; - int matchName = 0; - int doPeerCheck = 1; - int nonBlocking = 0; - int resumeSession = 0; - int trackMemory = 0; - int useClientCert = 1; - int fewerPackets = 0; - int atomicUser = 0; - int pkCallbacks = 0; - int overrideDateErrors = 0; - char* cipherList = NULL; - const char* verifyCert = caCert; - const char* ourCert = cliCert; - const char* ourKey = cliKey; - -#ifdef HAVE_SNI - char* sniHostName = NULL; -#endif -#ifdef HAVE_MAX_FRAGMENT - byte maxFragment = 0; -#endif -#ifdef HAVE_TRUNCATED_HMAC - byte truncatedHMAC = 0; -#endif - - -#ifdef HAVE_OCSP - int useOcsp = 0; - char* ocspUrl = NULL; -#endif - - int argc = ((func_args*)args)->argc; - char** argv = ((func_args*)args)->argv; - - ((func_args*)args)->return_code = -1; /* error state */ - -#ifdef NO_RSA - verifyCert = (char*)eccCert; - ourCert = (char*)cliEccCert; - ourKey = (char*)cliEccKey; -#endif - (void)resumeSz; - (void)session; - (void)sslResume; - (void)trackMemory; - (void)atomicUser; - (void)pkCallbacks; - - StackTrap(); - - while ((ch = mygetopt(argc, argv, - "?gdDusmNrtfxUPh:p:v:l:A:c:k:b:zS:L:ToO:")) != -1) { - switch (ch) { - case '?' : - Usage(); - exit(EXIT_SUCCESS); - - case 'g' : - sendGET = 1; - break; - - case 'd' : - doPeerCheck = 0; - break; - - case 'D' : - overrideDateErrors = 1; - break; - - case 'u' : - doDTLS = 1; - break; - - case 's' : - usePsk = 1; - break; - - case 't' : - #ifdef USE_CYASSL_MEMORY - trackMemory = 1; - #endif - break; - - case 'm' : - matchName = 1; - break; - - case 'x' : - useClientCert = 0; - break; - - case 'f' : - fewerPackets = 1; - break; - - case 'U' : - #ifdef ATOMIC_USER - atomicUser = 1; - #endif - break; - - case 'P' : - #ifdef HAVE_PK_CALLBACKS - pkCallbacks = 1; - #endif - break; - - case 'h' : - host = myoptarg; - domain = myoptarg; - break; - - case 'p' : - port = (word16)atoi(myoptarg); - #if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API) - if (port == 0) - err_sys("port number cannot be 0"); - #endif - break; - - case 'v' : - version = atoi(myoptarg); - if (version < 0 || version > 3) { - Usage(); - exit(MY_EX_USAGE); - } - break; - - case 'l' : - cipherList = myoptarg; - break; - - case 'A' : - verifyCert = myoptarg; - break; - - case 'c' : - ourCert = myoptarg; - break; - - case 'k' : - ourKey = myoptarg; - break; - - case 'b' : - benchmark = atoi(myoptarg); - if (benchmark < 0 || benchmark > 1000000) { - Usage(); - exit(MY_EX_USAGE); - } - break; - - case 'N' : - nonBlocking = 1; - break; - - case 'r' : - resumeSession = 1; - break; - - case 'z' : - #ifndef CYASSL_LEANPSK - CyaSSL_GetObjectSize(); - #endif - break; - - case 'S' : - #ifdef HAVE_SNI - sniHostName = myoptarg; - #endif - break; - - case 'L' : - #ifdef HAVE_MAX_FRAGMENT - maxFragment = atoi(myoptarg); - if (maxFragment < CYASSL_MFL_2_9 || - maxFragment > CYASSL_MFL_2_13) { - Usage(); - exit(MY_EX_USAGE); - } - #endif - break; - - case 'T' : - #ifdef HAVE_TRUNCATED_HMAC - truncatedHMAC = 1; - #endif - break; - - case 'o' : - #ifdef HAVE_OCSP - useOcsp = 1; - #endif - break; - - case 'O' : - #ifdef HAVE_OCSP - useOcsp = 1; - ocspUrl = myoptarg; - #endif - break; - - default: - Usage(); - exit(MY_EX_USAGE); - } - } - - myoptind = 0; /* reset for test cases */ - - /* sort out DTLS versus TLS versions */ - if (version == CLIENT_INVALID_VERSION) { - if (doDTLS) - version = CLIENT_DTLS_DEFAULT_VERSION; - else - version = CLIENT_DEFAULT_VERSION; - } - else { - if (doDTLS) { - if (version == 3) - version = -2; - else - version = -1; - } - } - -#ifdef USE_CYASSL_MEMORY - if (trackMemory) - InitMemoryTracker(); -#endif - - switch (version) { -#ifndef NO_OLD_TLS - case 0: - method = wolfSSLv3_client_method(); - break; - - - #ifndef NO_TLS - case 1: - method = CyaTLSv1_client_method(); - break; - - case 2: - method = CyaTLSv1_1_client_method(); - break; - #endif /* NO_TLS */ - -#endif /* NO_OLD_TLS */ - -#ifndef NO_TLS - case 3: - method = CyaTLSv1_2_client_method(); - break; -#endif - -#ifdef CYASSL_DTLS - case -1: - method = CyaDTLSv1_client_method(); - break; - - case -2: - method = CyaDTLSv1_2_client_method(); - break; -#endif - - default: - err_sys("Bad SSL version"); - break; - } - - if (method == NULL) - err_sys("unable to get method"); - - ctx = CyaSSL_CTX_new(method); - if (ctx == NULL) - err_sys("unable to get ctx"); - - if (cipherList) - if (CyaSSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS) - err_sys("client can't set cipher list 1"); - -#ifdef CYASSL_LEANPSK - usePsk = 1; -#endif - -#if defined(NO_RSA) && !defined(HAVE_ECC) - usePsk = 1; -#endif - - if (fewerPackets) - CyaSSL_CTX_set_group_messages(ctx); - - if (usePsk) { -#ifndef NO_PSK - CyaSSL_CTX_set_psk_client_callback(ctx, my_psk_client_cb); - if (cipherList == NULL) { - const char *defaultCipherList; - #ifdef HAVE_NULL_CIPHER - defaultCipherList = "PSK-NULL-SHA256"; - #else - defaultCipherList = "PSK-AES128-CBC-SHA256"; - #endif - if (CyaSSL_CTX_set_cipher_list(ctx,defaultCipherList) !=SSL_SUCCESS) - err_sys("client can't set cipher list 2"); - } -#endif - useClientCert = 0; - } - -#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) - CyaSSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack); -#endif - -#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC) - if (cipherList == NULL) { - /* don't use EDH, can't sniff tmp keys */ - if (CyaSSL_CTX_set_cipher_list(ctx, "AES256-SHA256") != SSL_SUCCESS) { - err_sys("client can't set cipher list 3"); - } - } -#endif - -#ifdef HAVE_OCSP - if (useOcsp) { - if (ocspUrl != NULL) { - CyaSSL_CTX_SetOCSP_OverrideURL(ctx, ocspUrl); - CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE - | CYASSL_OCSP_URL_OVERRIDE); - } - else - CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE); - } -#endif - -#ifdef USER_CA_CB - CyaSSL_CTX_SetCACb(ctx, CaCb); -#endif - -#ifdef VERIFY_CALLBACK - CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, myVerify); -#endif -#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) - if (useClientCert){ - if (CyaSSL_CTX_use_certificate_chain_file(ctx, ourCert) != SSL_SUCCESS) - err_sys("can't load client cert file, check file and run from" - " CyaSSL home dir"); - - if (CyaSSL_CTX_use_PrivateKey_file(ctx, ourKey, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load client private key file, check file and run " - "from CyaSSL home dir"); - } - - if (!usePsk) { - if (CyaSSL_CTX_load_verify_locations(ctx, verifyCert, 0) != SSL_SUCCESS) - err_sys("can't load ca file, Please run from CyaSSL home dir"); - } -#endif -#if !defined(NO_CERTS) - if (!usePsk && doPeerCheck == 0) - CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); - if (!usePsk && overrideDateErrors == 1) - CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, myDateCb); -#endif - -#ifdef HAVE_CAVIUM - CyaSSL_CTX_UseCavium(ctx, CAVIUM_DEV_ID); -#endif - -#ifdef HAVE_SNI - if (sniHostName) - if (CyaSSL_CTX_UseSNI(ctx, 0, sniHostName, XSTRLEN(sniHostName)) - != SSL_SUCCESS) - err_sys("UseSNI failed"); -#endif -#ifdef HAVE_MAX_FRAGMENT - if (maxFragment) - if (CyaSSL_CTX_UseMaxFragment(ctx, maxFragment) != SSL_SUCCESS) - err_sys("UseMaxFragment failed"); -#endif -#ifdef HAVE_TRUNCATED_HMAC - if (truncatedHMAC) - if (CyaSSL_CTX_UseTruncatedHMAC(ctx) != SSL_SUCCESS) - err_sys("UseTruncatedHMAC failed"); -#endif - - if (benchmark) { - /* time passed in number of connects give average */ - int times = benchmark; - int i = 0; - - double start = current_time(), avg; - - for (i = 0; i < times; i++) { - tcp_connect(&sockfd, host, port, doDTLS); - - ssl = CyaSSL_new(ctx); - CyaSSL_set_fd(ssl, sockfd); - if (CyaSSL_connect(ssl) != SSL_SUCCESS) - err_sys("SSL_connect failed"); - - CyaSSL_shutdown(ssl); - CyaSSL_free(ssl); - CloseSocket(sockfd); - } - avg = current_time() - start; - avg /= times; - avg *= 1000; /* milliseconds */ - printf("CyaSSL_connect avg took: %8.3f milliseconds\n", avg); - - CyaSSL_CTX_free(ctx); - ((func_args*)args)->return_code = 0; - - exit(EXIT_SUCCESS); - } - - #if defined(CYASSL_MDK_ARM) - CyaSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); - #endif - - ssl = CyaSSL_new(ctx); - if (ssl == NULL) - err_sys("unable to get SSL object"); - if (doDTLS) { - SOCKADDR_IN_T addr; - build_addr(&addr, host, port, 1); - CyaSSL_dtls_set_peer(ssl, &addr, sizeof(addr)); - tcp_socket(&sockfd, 1); - } - else { - tcp_connect(&sockfd, host, port, 0); - } - CyaSSL_set_fd(ssl, sockfd); -#ifdef HAVE_CRL - if (CyaSSL_EnableCRL(ssl, CYASSL_CRL_CHECKALL) != SSL_SUCCESS) - err_sys("can't enable crl check"); - if (CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, 0) != SSL_SUCCESS) - err_sys("can't load crl, check crlfile and date validity"); - if (CyaSSL_SetCRL_Cb(ssl, CRL_CallBack) != SSL_SUCCESS) - err_sys("can't set crl callback"); -#endif -#ifdef ATOMIC_USER - if (atomicUser) - SetupAtomicUser(ctx, ssl); -#endif -#ifdef HAVE_PK_CALLBACKS - if (pkCallbacks) - SetupPkCallbacks(ctx, ssl); -#endif - if (matchName && doPeerCheck) - CyaSSL_check_domain_name(ssl, domain); -#ifndef CYASSL_CALLBACKS - if (nonBlocking) { - CyaSSL_set_using_nonblock(ssl, 1); - tcp_set_nonblocking(&sockfd); - NonBlockingSSL_Connect(ssl); - } - else if (CyaSSL_connect(ssl) != SSL_SUCCESS) { - /* see note at top of README */ - int err = CyaSSL_get_error(ssl, 0); - char buffer[CYASSL_MAX_ERROR_SZ]; - printf("err = %d, %s\n", err, - CyaSSL_ERR_error_string(err, buffer)); - err_sys("SSL_connect failed"); - /* if you're getting an error here */ - } -#else - timeout.tv_sec = 2; - timeout.tv_usec = 0; - NonBlockingSSL_Connect(ssl); /* will keep retrying on timeout */ -#endif - showPeer(ssl); - - if (sendGET) { - printf("SSL connect ok, sending GET...\n"); - msgSz = 28; - strncpy(msg, "GET /index.html HTTP/1.0\r\n\r\n", msgSz); - msg[msgSz] = '\0'; - } - if (CyaSSL_write(ssl, msg, msgSz) != msgSz) - err_sys("SSL_write failed"); - - input = CyaSSL_read(ssl, reply, sizeof(reply)-1); - if (input > 0) { - reply[input] = 0; - printf("Server response: %s\n", reply); - - if (sendGET) { /* get html */ - while (1) { - input = CyaSSL_read(ssl, reply, sizeof(reply)-1); - if (input > 0) { - reply[input] = 0; - printf("%s\n", reply); - } - else - break; - } - } - } - else if (input < 0) { - int readErr = CyaSSL_get_error(ssl, 0); - if (readErr != SSL_ERROR_WANT_READ) - err_sys("CyaSSL_read failed"); - } - -#ifndef NO_SESSION_CACHE - if (resumeSession) { - if (doDTLS) { - strncpy(msg, "break", 6); - msgSz = (int)strlen(msg); - /* try to send session close */ - CyaSSL_write(ssl, msg, msgSz); - } - session = CyaSSL_get_session(ssl); - sslResume = CyaSSL_new(ctx); - } -#endif - - if (doDTLS == 0) /* don't send alert after "break" command */ - CyaSSL_shutdown(ssl); /* echoserver will interpret as new conn */ -#ifdef ATOMIC_USER - if (atomicUser) - FreeAtomicUser(ssl); -#endif - CyaSSL_free(ssl); - CloseSocket(sockfd); - -#ifndef NO_SESSION_CACHE - if (resumeSession) { - if (doDTLS) { - SOCKADDR_IN_T addr; - #ifdef USE_WINDOWS_API - Sleep(500); - #else - sleep(1); - #endif - build_addr(&addr, host, port, 1); - CyaSSL_dtls_set_peer(sslResume, &addr, sizeof(addr)); - tcp_socket(&sockfd, 1); - } - else { - tcp_connect(&sockfd, host, port, 0); - } - CyaSSL_set_fd(sslResume, sockfd); - CyaSSL_set_session(sslResume, session); - - showPeer(sslResume); -#ifndef CYASSL_CALLBACKS - if (nonBlocking) { - CyaSSL_set_using_nonblock(sslResume, 1); - tcp_set_nonblocking(&sockfd); - NonBlockingSSL_Connect(sslResume); - } - else if (CyaSSL_connect(sslResume) != SSL_SUCCESS) - err_sys("SSL resume failed"); -#else - timeout.tv_sec = 2; - timeout.tv_usec = 0; - NonBlockingSSL_Connect(ssl); /* will keep retrying on timeout */ -#endif - - if (CyaSSL_session_reused(sslResume)) - printf("reused session id\n"); - else - printf("didn't reuse session id!!!\n"); - - if (CyaSSL_write(sslResume, resumeMsg, resumeSz) != resumeSz) - err_sys("SSL_write failed"); - - if (nonBlocking) { - /* give server a chance to bounce a message back to client */ - #ifdef USE_WINDOWS_API - Sleep(500); - #else - sleep(1); - #endif - } - - input = CyaSSL_read(sslResume, reply, sizeof(reply)-1); - if (input > 0) { - reply[input] = 0; - printf("Server resume response: %s\n", reply); - } - - /* try to send session break */ - CyaSSL_write(sslResume, msg, msgSz); - - CyaSSL_shutdown(sslResume); - CyaSSL_free(sslResume); - CloseSocket(sockfd); - } -#endif /* NO_SESSION_CACHE */ - - CyaSSL_CTX_free(ctx); - - ((func_args*)args)->return_code = 0; - -#ifdef USE_CYASSL_MEMORY - if (trackMemory) - ShowMemoryTracker(); -#endif /* USE_CYASSL_MEMORY */ - - return 0; -} - - -/* so overall tests can pull in test function */ -#ifndef NO_MAIN_DRIVER - - int main(int argc, char** argv) - { - func_args args; - -#ifdef HAVE_CAVIUM - int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); - if (ret != 0) - err_sys("Cavium OpenNitroxDevice failed"); -#endif /* HAVE_CAVIUM */ - - StartTCP(); - - args.argc = argc; - args.argv = argv; - - CyaSSL_Init(); -#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL) && !defined(STACK_TRAP) - CyaSSL_Debugging_ON(); -#endif - if (CurrentDir("client")) - ChangeDirBack(2); - else if (CurrentDir("Debug") || CurrentDir("Release")) - ChangeDirBack(3); - -#ifdef HAVE_STACK_SIZE - StackSizeCheck(&args, client_test); -#else - client_test(&args); -#endif - CyaSSL_Cleanup(); - -#ifdef HAVE_CAVIUM - CspShutdown(CAVIUM_DEV_ID); -#endif - return args.return_code; - } - - int myoptind = 0; - char* myoptarg = NULL; - -#endif /* NO_MAIN_DRIVER */ - - - -#ifdef CYASSL_CALLBACKS - - int handShakeCB(HandShakeInfo* info) - { - (void)info; - return 0; - } - - - int timeoutCB(TimeoutInfo* info) - { - (void)info; - return 0; - } - -#endif - diff --git a/IDE/MDK5-ARM/Projects/SimpleClient/simpleClient.uvprojx b/IDE/MDK5-ARM/Projects/SimpleClient/simpleClient.uvprojx index 26744456f..9eefd4c71 100644 --- a/IDE/MDK5-ARM/Projects/SimpleClient/simpleClient.uvprojx +++ b/IDE/MDK5-ARM/Projects/SimpleClient/simpleClient.uvprojx @@ -7,19 +7,21 @@ - SimpleClient + STM32F207 Flash 0x4 ARM-ADS - STM32F207IG + STM32F207IGHx STMicroelectronics - IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE + Keil.STM32F2xx_DFP.2.2.0 + http://www.keil.com/pack + IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) 0 - $$Device:STM32F207IG$Device\Include\stm32f2xx.h + $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h @@ -29,7 +31,7 @@ - $$Device:STM32F207IG$SVD\STM32F20x.svd + $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd 0 0 @@ -45,7 +47,7 @@ 1 .\Object\ - SimpleClient + EchoClient 1 0 0 @@ -104,11 +106,11 @@ SARMCM3.DLL - -REMAP -MPU + -REMAP -MPU DCM.DLL -pCM3 SARMCM3.DLL - -REMAP -MPU + -MPU TCM.DLL -pCM3 @@ -143,10 +145,9 @@ 1 1 1 - 1 0 - 8 + 1 @@ -160,7 +161,7 @@ .\STM32_SWO.ini - BIN\ULP2CM3.DLL + BIN\UL2CM3.DLL @@ -173,8 +174,8 @@ 4100 1 - BIN\ULP2CM3.DLL - "" () + BIN\UL2CM3.DLL + @@ -355,14 +356,14 @@ 0 0 0 - 0 + 2 0 0 - 0 + 1 0 - - HAVE_CONFIG_H MDK_CONF_SimpleClient + --diag_suppress=1293 + HSE_VALUE=25000000 HAVE_CONFIG_H MDK_CONF_SimpleClient WOLFSSL_USER_SETTINGS @@ -413,39 +414,39 @@ .\main.c - client.c + time-CortexM3-4.c 1 - .\client.c + .\time-CortexM3-4.c Configuration - - config-SimpleClient.h - 5 - .\config-SimpleClient.h - - - config-CyaSSL.h - 5 - .\RTE\wolfSSL\config-CyaSSL.h - config-Crypt.h 5 .\RTE\wolfSSL\config-Crypt.h - Net_Config_ETH_0.h + config-wolfSSL.h 5 - .\RTE\Network\Net_Config_ETH_0.h + .\RTE\wolfSSL\config-wolfSSL.h + + + user_settings.h + 5 + .\RTE\wolfSSL\user_settings.h + + + config-SimpleClient.h + 5 + .\config-SimpleClient.h - Documentation + Dcumentation Abstract.txt @@ -455,652 +456,397 @@ - Devices - - - time-dummy.c - 1 - .\time-dummy.c - - - time-CortexM3-4.c - 1 - .\time-CortexM3-4.c - - + ::CMSIS - ::CMSIS - - - RTX_Conf_CM.c - 1 - RTE\CMSIS\RTX_Conf_CM.c - - - RTX_CM3.lib - 4 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - - + ::CMSIS Driver + + + ::Compiler ::Device - - - RTE_Device.h - 5 - RTE\Device\STM32F207IG\RTE_Device.h - - - startup_stm32f2xx.s - 2 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - system_stm32f2xx.c - 1 - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - DMA_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - - - GPIO_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - - - - - ::Drivers - - - EMAC_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - - - MCI_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - - - PHY_ST802RT1.c - 1 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - - ::File System - - - FS_Config.c - 1 - RTE\File_System\FS_Config.c - - - FS_Config_MC_0.h - 5 - RTE\File_System\FS_Config_MC_0.h - - - FS_LFN_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - - ::Network - - - Net_Config.c - 1 - RTE\Network\Net_Config.c - - - Net_Config_BSD.h - 5 - RTE\Network\Net_Config_BSD.h - - - Net_Config_DNS_Client.h - 5 - RTE\Network\Net_Config_DNS_Client.h - - - Net_Config_ETH_0.h - 5 - RTE\Network\Net_Config_ETH_0.h - - - Net_Config_TCP.h - 5 - RTE\Network\Net_Config_TCP.h - - - Net_Config_UDP.h - 5 - RTE\Network\Net_Config_UDP.h - - - Net_Debug.c - 1 - RTE\Network\Net_Debug.c - - - Net_Dbg_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - - ::wolfSSL - - - config-Crypt.h - 5 - RTE\wolfSSL\config-Crypt.h - - - config-CyaSSL.h - 5 - RTE\wolfSSL\config-CyaSSL.h - - - settings.h - 5 - RTE\wolfSSL\settings.h - - - cyassl_MDK_ARM.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - - - aes.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - - - arc4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - - - asm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - - - asn.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - - - blake2b.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - - - camellia.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - - - coding.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - - - compress.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - - - des3.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - - - dh.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - - - dsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - - - ecc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - - - ecc_fp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - - - error.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - - - hc128.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - - - hmac.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - - - integer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - - - logging.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - - - md2.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - - - md4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - - - md5.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - - - memory.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - - - misc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - - - pwdbased.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - - - rabbit.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - - - random.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - - - ripemd.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - - - rsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - - - sha.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - - - sha256.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - - - sha512.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - - - tfm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - - - wc_port.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - - - crl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - - - internal.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - - - io.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - - - keys.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - - - ocsp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - - - sniffer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - - - ssl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - - - tls.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - + - - + + - - - - - - - - - - - - - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + RTE\CMSIS\RTX_Conf_CM.c - - + + - + + + + + RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s + + + + + + RTE\Device\MK70FN1M0xxx12\system_MK70F12.c + + + + + + RTE\Device\STM32F207IGHx\RTE_Device.h + + + + + + + + RTE\Device\STM32F207IGHx\startup_stm32f207xx.s + + + + + + + + RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h + + + + + + + + RTE\Device\STM32F207IGHx\system_stm32f2xx.c + + + + - RTE\Device\STM32F207IG\RTE_Device.h - - - - - + RTE\Device\STM32F207IG\RTE_Device.h + + + + + + RTE\Device\STM32F207IG\startup_stm32f207xx.s + + + - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - + RTE\Device\STM32F207IG\startup_stm32f2xx.s + + + - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - + + RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h + + + - + + RTE\Device\STM32F207IG\system_stm32f2xx.c + + + + + + RTE\Device\TM4C129ENCPDT\startup_TM4C129.s + + + + + + RTE\Device\TM4C129ENCPDT\system_tm4c129.c + + + + + RTE\File_System\FS_Config.c - - + + - + - + RTE\File_System\FS_Config_MC_0.h - - + + - + - + RTE\Network\Net_Config.c - - + + - + - + RTE\Network\Net_Config_BSD.h - - + + - + - + RTE\Network\Net_Config_DNS_Client.h - - + + - + - + RTE\Network\Net_Config_ETH_0.h - - + + - + - + RTE\Network\Net_Config_TCP.h - - + + - + - + RTE\Network\Net_Config_UDP.h - - + + - + - - RTE\Network\Net_Debug.c - - - - - + + RTE\Network\Net_Debug.c + + + RTE\Other\config-Crypt.h @@ -1126,34 +872,46 @@ - + RTE\wolfSSL\config-Crypt.h - - + + - + - - RTE\wolfSSL\config-CyaSSL.h + + RTE\wolfSSL\config-CyaSSL.h - + + + + + RTE\wolfSSL\config-wolfSSL.h + + - + RTE\wolfSSL\config.h - - + + - - RTE\wolfSSL\settings.h - - + + RTE\wolfSSL\settings.h + + + + + + RTE\wolfSSL\user_settings.h + + - + diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx index e58d8495e..ff25d6393 100644 --- a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx +++ b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvoptx @@ -13,6 +13,7 @@ *.txt; *.h; *.inc *.plm *.cpp + 0 @@ -21,16 +22,17 @@ - SimpleServer + STM32F207 Flash 0x4 ARM-ADS - 120000000 + 12000000 1 1 0 1 + 0 1 @@ -75,17 +77,17 @@ 0 1 - 255 + 18 0 Schematics (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200-schematics.pdf + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf 1 User Manual (MCBSTM32F200) - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\Documents\mcbstm32f200.chm + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm 2 @@ -113,10 +115,9 @@ 1 1 1 - 1 0 0 - 8 + 1 @@ -127,9 +128,14 @@ .\STM32_SWO.ini - BIN\ULP2CM3.DLL + BIN\UL2CM3.DLL + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + 0 DLGTARM @@ -143,17 +149,17 @@ 0 ULP2CM3 - -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) + -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) 0 DLGUARM - + (105=-1,-1,-1,-1,0) 0 UL2CM3 - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) @@ -161,7 +167,8 @@ 1 8 - 0x20000408 + port + 0 @@ -169,6 +176,7 @@ 2 8 0x8004dc8 + 0 @@ -195,7 +203,7 @@ 0 0 1 - 0 + 1 0 0 0 @@ -207,7 +215,7 @@ Source - 0 + 1 0 0 0 @@ -224,19 +232,6 @@ 0 0 - - 1 - 2 - 1 - 0 - 0 - 0 - 0 - .\server.c - server.c - 0 - 0 - @@ -247,20 +242,7 @@ 0 2 - 3 - 5 - 0 - 0 - 0 - 0 - .\RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 0 - 0 - - - 2 - 4 + 2 5 0 0 @@ -273,20 +255,33 @@ 2 - 5 + 3 5 0 0 0 0 - .\RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h + .\RTE\wolfSSL\config-wolfSSL.h + config-wolfSSL.h 0 0 2 - 6 + 4 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\user_settings.h + user_settings.h + 0 + 0 + + + 2 + 5 5 0 0 @@ -300,14 +295,14 @@ - Documentation - 0 + Dcumentation + 1 0 0 0 3 - 7 + 6 5 0 0 @@ -321,178 +316,35 @@ - Devices + ::CMSIS 1 0 0 - 0 - - 4 - 8 - 1 - 0 - 0 - 0 - 0 - .\time-dummy.c - time-dummy.c - 0 - 0 - + 1 - ::CMSIS - 0 + ::CMSIS Driver + 1 + 0 + 0 + 1 + + + + ::Compiler + 1 0 0 1 - - 5 - 9 - 1 - 0 - 0 - 0 - 0 - RTE\CMSIS\RTX_Conf_CM.c - RTX_Conf_CM.c - 1 - 0 - - - 5 - 10 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - RTX_CM3.lib - 1 - 0 - ::Device - 0 + 1 0 0 1 - - 6 - 11 - 5 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\RTE_Device.h - RTE_Device.h - 1 - 0 - - - 6 - 12 - 2 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - startup_stm32f2xx.s - 1 - 0 - - - 6 - 13 - 1 - 0 - 0 - 0 - 0 - RTE\Device\STM32F207IG\system_stm32f2xx.c - system_stm32f2xx.c - 1 - 0 - - - 6 - 14 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - DMA_STM32F2xx.c - 1 - 0 - - - 6 - 15 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - GPIO_STM32F2xx.c - 1 - 0 - - - - - ::Drivers - 0 - 0 - 0 - 1 - - 7 - 16 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - EMAC_STM32F2xx.c - 1 - 0 - - - 7 - 17 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - MCI_STM32F2xx.c - 1 - 0 - - - 7 - 18 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - PHY_ST802RT1.c - 1 - 0 - @@ -501,750 +353,22 @@ 0 0 1 - - 8 - 19 - 1 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config.c - FS_Config.c - 1 - 0 - - - 8 - 20 - 5 - 0 - 0 - 0 - 0 - RTE\File_System\FS_Config_MC_0.h - FS_Config_MC_0.h - 1 - 0 - - - 8 - 21 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - FS_LFN_CM3_L.lib - 1 - 0 - ::Network - 0 + 1 0 0 1 - - 9 - 22 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config.c - Net_Config.c - 1 - 0 - - - 9 - 23 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_BSD.h - Net_Config_BSD.h - 1 - 0 - - - 9 - 24 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_DNS_Client.h - Net_Config_DNS_Client.h - 1 - 0 - - - 9 - 25 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_ETH_0.h - Net_Config_ETH_0.h - 1 - 0 - - - 9 - 26 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_TCP.h - Net_Config_TCP.h - 1 - 0 - - - 9 - 27 - 5 - 0 - 0 - 0 - 0 - RTE\Network\Net_Config_UDP.h - Net_Config_UDP.h - 1 - 0 - - - 9 - 28 - 1 - 0 - 0 - 0 - 0 - RTE\Network\Net_Debug.c - Net_Debug.c - 1 - 0 - - - 9 - 29 - 4 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - Net_Dbg_CM3_L.lib - 1 - 0 - ::wolfSSL - 0 + 1 0 0 1 - - 10 - 30 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-Crypt.h - config-Crypt.h - 1 - 0 - - - 10 - 31 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\config-CyaSSL.h - config-CyaSSL.h - 1 - 0 - - - 10 - 32 - 5 - 0 - 0 - 0 - 0 - RTE\wolfSSL\settings.h - settings.h - 1 - 0 - - - 10 - 33 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - cyassl_MDK_ARM.c - 1 - 0 - - - 10 - 34 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - aes.c - 1 - 0 - - - 10 - 35 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - arc4.c - 1 - 0 - - - 10 - 36 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - asm.c - 1 - 0 - - - 10 - 37 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - asn.c - 1 - 0 - - - 10 - 38 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - blake2b.c - 1 - 0 - - - 10 - 39 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - camellia.c - 1 - 0 - - - 10 - 40 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - coding.c - 1 - 0 - - - 10 - 41 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - compress.c - 1 - 0 - - - 10 - 42 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - des3.c - 1 - 0 - - - 10 - 43 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - dh.c - 1 - 0 - - - 10 - 44 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - dsa.c - 1 - 0 - - - 10 - 45 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - ecc.c - 1 - 0 - - - 10 - 46 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - ecc_fp.c - 1 - 0 - - - 10 - 47 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - error.c - 1 - 0 - - - 10 - 48 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - hc128.c - 1 - 0 - - - 10 - 49 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - hmac.c - 1 - 0 - - - 10 - 50 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - integer.c - 1 - 0 - - - 10 - 51 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - logging.c - 1 - 0 - - - 10 - 52 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - md2.c - 1 - 0 - - - 10 - 53 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - md4.c - 1 - 0 - - - 10 - 54 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - md5.c - 1 - 0 - - - 10 - 55 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - memory.c - 1 - 0 - - - 10 - 56 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - misc.c - 1 - 0 - - - 10 - 57 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - pwdbased.c - 1 - 0 - - - 10 - 58 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - rabbit.c - 1 - 0 - - - 10 - 59 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - random.c - 1 - 0 - - - 10 - 60 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - ripemd.c - 1 - 0 - - - 10 - 61 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - rsa.c - 1 - 0 - - - 10 - 62 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - sha.c - 1 - 0 - - - 10 - 63 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - sha256.c - 1 - 0 - - - 10 - 64 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - sha512.c - 1 - 0 - - - 10 - 65 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - tfm.c - 1 - 0 - - - 10 - 66 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - wc_port.c - 1 - 0 - - - 10 - 67 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - crl.c - 1 - 0 - - - 10 - 68 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - internal.c - 1 - 0 - - - 10 - 69 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - io.c - 1 - 0 - - - 10 - 70 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - keys.c - 1 - 0 - - - 10 - 71 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - ocsp.c - 1 - 0 - - - 10 - 72 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - sniffer.c - 1 - 0 - - - 10 - 73 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - ssl.c - 1 - 0 - - - 10 - 74 - 1 - 0 - 0 - 0 - 0 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - tls.c - 1 - 0 - diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx index 6480847b4..3a6c23fb5 100644 --- a/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx +++ b/IDE/MDK5-ARM/Projects/SimpleServer/SimpleServer.uvprojx @@ -7,19 +7,21 @@ - SimpleServer + STM32F207 Flash 0x4 ARM-ADS - STM32F207IG + STM32F207IGHx STMicroelectronics - IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE + Keil.STM32F2xx_DFP.2.2.0 + http://www.keil.com/pack + IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) 0 - $$Device:STM32F207IG$Device\Include\stm32f2xx.h + $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h @@ -29,7 +31,7 @@ - $$Device:STM32F207IG$SVD\STM32F20x.svd + $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd 0 0 @@ -45,7 +47,7 @@ 1 .\Object\ - SimpleServer + EchoClient 1 0 0 @@ -104,11 +106,11 @@ SARMCM3.DLL - -REMAP -MPU + -REMAP -MPU DCM.DLL -pCM3 SARMCM3.DLL - -REMAP -MPU + -MPU TCM.DLL -pCM3 @@ -143,10 +145,9 @@ 1 1 1 - 1 0 - 8 + 1 @@ -160,7 +161,7 @@ .\STM32_SWO.ini - BIN\ULP2CM3.DLL + BIN\UL2CM3.DLL @@ -173,8 +174,8 @@ 4100 1 - BIN\ULP2CM3.DLL - "" () + BIN\UL2CM3.DLL + @@ -355,14 +356,14 @@ 0 0 0 - 0 + 2 0 0 - 0 + 1 0 - - HAVE_CONFIG_H MDK_CONF_SimpleServer + --diag_suppress=1293 + HSE_VALUE=25000000 HAVE_CONFIG_H MDK_CONF_EchoClient WOLFSSL_USER_SETTINGS @@ -412,30 +413,25 @@ 1 .\main.c - - server.c - 1 - .\server.c - Configuration - - config-CyaSSL.h - 5 - .\RTE\wolfSSL\config-CyaSSL.h - config-Crypt.h 5 .\RTE\wolfSSL\config-Crypt.h - Net_Config_ETH_0.h + config-wolfSSL.h 5 - .\RTE\Network\Net_Config_ETH_0.h + .\RTE\wolfSSL\config-wolfSSL.h + + + user_settings.h + 5 + .\RTE\wolfSSL\user_settings.h config-SimpleServer.h @@ -445,7 +441,7 @@ - Documentation + Dcumentation Abstract.txt @@ -455,374 +451,25 @@ - Devices - - - time-dummy.c - 1 - .\time-dummy.c - - + ::CMSIS - ::CMSIS - - - RTX_Conf_CM.c - 1 - RTE\CMSIS\RTX_Conf_CM.c - - - RTX_CM3.lib - 4 - C:\Keil5\ARM\PACK\ARM\CMSIS\3.20.4\CMSIS_RTX\Lib\ARM\RTX_CM3.lib - - + ::CMSIS Driver + + + ::Compiler ::Device - - - RTE_Device.h - 5 - RTE\Device\STM32F207IG\RTE_Device.h - - - startup_stm32f2xx.s - 2 - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - system_stm32f2xx.c - 1 - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - DMA_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\DMA_STM32F2xx.c - - - GPIO_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\GPIO_STM32F2xx.c - - - - - ::Drivers - - - EMAC_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\EMAC_STM32F2xx.c - - - MCI_STM32F2xx.c - 1 - C:\Keil5\ARM\PACK\Keil\STM32F2xx_DFP\1.0.7\RTE_Driver\MCI_STM32F2xx.c - - - PHY_ST802RT1.c - 1 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Driver\PHY_ST802RT1.c - - ::File System - - - FS_Config.c - 1 - RTE\File_System\FS_Config.c - - - FS_Config_MC_0.h - 5 - RTE\File_System\FS_Config_MC_0.h - - - FS_LFN_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\FileSystem\Lib\ARM\FS_LFN_CM3_L.lib - - ::Network - - - Net_Config.c - 1 - RTE\Network\Net_Config.c - - - Net_Config_BSD.h - 5 - RTE\Network\Net_Config_BSD.h - - - Net_Config_DNS_Client.h - 5 - RTE\Network\Net_Config_DNS_Client.h - - - Net_Config_ETH_0.h - 5 - RTE\Network\Net_Config_ETH_0.h - - - Net_Config_TCP.h - 5 - RTE\Network\Net_Config_TCP.h - - - Net_Config_UDP.h - 5 - RTE\Network\Net_Config_UDP.h - - - Net_Debug.c - 1 - RTE\Network\Net_Debug.c - - - Net_Dbg_CM3_L.lib - 4 - C:\Keil5\ARM\PACK\Keil\MDK-Middleware\5.1.6\Network\Lib\ARM\Net_Dbg_CM3_L.lib - - ::wolfSSL - - - config-Crypt.h - 5 - RTE\wolfSSL\config-Crypt.h - - - config-CyaSSL.h - 5 - RTE\wolfSSL\config-CyaSSL.h - - - settings.h - 5 - RTE\wolfSSL\settings.h - - - cyassl_MDK_ARM.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\IDE\MDK5-ARM\Src\cyassl_MDK_ARM.c - - - aes.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\aes.c - - - arc4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\arc4.c - - - asm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asm.c - - - asn.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\asn.c - - - blake2b.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\blake2b.c - - - camellia.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\camellia.c - - - coding.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\coding.c - - - compress.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\compress.c - - - des3.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\des3.c - - - dh.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dh.c - - - dsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\dsa.c - - - ecc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc.c - - - ecc_fp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ecc_fp.c - - - error.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\error.c - - - hc128.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hc128.c - - - hmac.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\hmac.c - - - integer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\integer.c - - - logging.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\logging.c - - - md2.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md2.c - - - md4.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md4.c - - - md5.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\md5.c - - - memory.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\memory.c - - - misc.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\misc.c - - - pwdbased.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\pwdbased.c - - - rabbit.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rabbit.c - - - random.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\random.c - - - ripemd.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\ripemd.c - - - rsa.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\rsa.c - - - sha.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha.c - - - sha256.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha256.c - - - sha512.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\sha512.c - - - tfm.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\tfm.c - - - wc_port.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\ctaocrypt\src\wc_port.c - - - crl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\crl.c - - - internal.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\internal.c - - - io.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\io.c - - - keys.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\keys.c - - - ocsp.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ocsp.c - - - sniffer.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\sniffer.c - - - ssl.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\ssl.c - - - tls.c - 1 - C:\Keil5\ARM\PACK\wolfSSL\CyaSSL\3.1.0\cyassl\src\tls.c - - @@ -830,272 +477,406 @@ - + + + + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + + - + - - + + - - - - - - - - - - - - - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + - - + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + RTE\CMSIS\RTX_Conf_CM.c - - + + - + + + + + RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s + + + + + + RTE\Device\MK70FN1M0xxx12\system_MK70F12.c + + + + + + RTE\Device\STM32F207IGHx\RTE_Device.h + + + + + + + + RTE\Device\STM32F207IGHx\startup_stm32f207xx.s + + + + + + + + RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h + + + + + + + + RTE\Device\STM32F207IGHx\system_stm32f2xx.c + + + + - RTE\Device\STM32F207IG\RTE_Device.h - - - - - + RTE\Device\STM32F207IG\RTE_Device.h + + + + + + RTE\Device\STM32F207IG\startup_stm32f207xx.s + + + - RTE\Device\STM32F207IG\startup_stm32f2xx.s - - - - - + RTE\Device\STM32F207IG\startup_stm32f2xx.s + + + - - RTE\Device\STM32F207IG\system_stm32f2xx.c - - - - - + + RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h + + + - + + RTE\Device\STM32F207IG\system_stm32f2xx.c + + + + + + RTE\Device\TM4C129ENCPDT\startup_TM4C129.s + + + + + + RTE\Device\TM4C129ENCPDT\system_tm4c129.c + + + + + RTE\File_System\FS_Config.c - - + + - + - + RTE\File_System\FS_Config_MC_0.h - - + + - + - + RTE\Network\Net_Config.c - - + + - + - + RTE\Network\Net_Config_BSD.h - - + + - + - + RTE\Network\Net_Config_DNS_Client.h - - + + - + - + RTE\Network\Net_Config_ETH_0.h - - + + - + - + RTE\Network\Net_Config_TCP.h - - + + - + - + RTE\Network\Net_Config_UDP.h - - + + - + - - RTE\Network\Net_Debug.c - - - - - + + RTE\Network\Net_Debug.c + + + RTE\Other\config-Crypt.h @@ -1121,20 +902,26 @@ - + RTE\wolfSSL\config-Crypt.h - - + + - + - - RTE\wolfSSL\config-CyaSSL.h + + RTE\wolfSSL\config-CyaSSL.h + + + + RTE\wolfSSL\config-wolfSSL.h + + - + @@ -1143,12 +930,18 @@ - - RTE\wolfSSL\settings.h - - + + RTE\wolfSSL\settings.h + + + + + + RTE\wolfSSL\user_settings.h + + - + diff --git a/IDE/MDK5-ARM/Projects/SimpleServer/server.c b/IDE/MDK5-ARM/Projects/SimpleServer/server.c deleted file mode 100644 index b1a694400..000000000 --- a/IDE/MDK5-ARM/Projects/SimpleServer/server.c +++ /dev/null @@ -1,605 +0,0 @@ -/* server.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 -#endif - -#include - -#if !defined(CYASSL_TRACK_MEMORY) && !defined(NO_MAIN_DRIVER) - /* in case memory tracker wants stats */ - #define CYASSL_TRACK_MEMORY -#endif - -#if defined(CYASSL_MDK_ARM) - #include - #include - - #if defined(CYASSL_MDK5) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" - #else - #include "rtl.h" - #endif - - #include "cyassl_MDK_ARM.h" -#endif -#include -#include - -#include "examples/server/server.h" - - -#ifdef CYASSL_CALLBACKS - int srvHandShakeCB(HandShakeInfo*); - int srvTimeoutCB(TimeoutInfo*); - Timeval srvTo; -#endif - -static void NonBlockingSSL_Accept(SSL* ssl) -{ -#ifndef CYASSL_CALLBACKS - int ret = SSL_accept(ssl); -#else - int ret = CyaSSL_accept_ex(ssl, srvHandShakeCB, srvTimeoutCB, srvTo); -#endif - int error = SSL_get_error(ssl, 0); - SOCKET_T sockfd = (SOCKET_T)CyaSSL_get_fd(ssl); - int select_ret; - - while (ret != SSL_SUCCESS && (error == SSL_ERROR_WANT_READ || - error == SSL_ERROR_WANT_WRITE)) { - int currTimeout = 1; - - if (error == SSL_ERROR_WANT_READ) - printf("... server would read block\n"); - else - printf("... server would write block\n"); - -#ifdef CYASSL_DTLS - currTimeout = CyaSSL_dtls_get_current_timeout(ssl); -#endif - select_ret = tcp_select(sockfd, currTimeout); - - if ((select_ret == TEST_RECV_READY) || - (select_ret == TEST_ERROR_READY)) { - #ifndef CYASSL_CALLBACKS - ret = SSL_accept(ssl); - #else - ret = CyaSSL_accept_ex(ssl, - srvHandShakeCB, srvTimeoutCB, srvTo); - #endif - error = SSL_get_error(ssl, 0); - } - else if (select_ret == TEST_TIMEOUT && !CyaSSL_dtls(ssl)) { - error = SSL_ERROR_WANT_READ; - } -#ifdef CYASSL_DTLS - else if (select_ret == TEST_TIMEOUT && CyaSSL_dtls(ssl) && - CyaSSL_dtls_got_timeout(ssl) >= 0) { - error = SSL_ERROR_WANT_READ; - } -#endif - else { - error = SSL_FATAL_ERROR; - } - } - if (ret != SSL_SUCCESS) - err_sys("SSL_accept failed"); -} - - -static void Usage(void) -{ - printf("server " LIBCYASSL_VERSION_STRING - " NOTE: All files relative to CyaSSL home dir\n"); - printf("-? Help, print this usage\n"); - printf("-p Port to listen on, not 0, default %d\n", yasslPort); - printf("-v SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n", - SERVER_DEFAULT_VERSION); - printf("-l Cipher list\n"); - printf("-c Certificate file, default %s\n", svrCert); - printf("-k Key file, default %s\n", svrKey); - printf("-A Certificate Authority file, default %s\n", cliCert); - printf("-d Disable client cert check\n"); - printf("-b Bind to any interface instead of localhost only\n"); - printf("-s Use pre Shared keys\n"); - printf("-t Track CyaSSL memory use\n"); - printf("-u Use UDP DTLS," - " add -v 2 for DTLSv1 (default), -v 3 for DTLSv1.2\n"); - printf("-f Fewer packets/group messages\n"); - printf("-N Use Non-blocking sockets\n"); - printf("-S Use Host Name Indication\n"); -#ifdef HAVE_OCSP - printf("-o Perform OCSP lookup on peer certificate\n"); - printf("-O Perform OCSP lookup using as responder\n"); -#endif -#ifdef HAVE_PK_CALLBACKS - printf("-P Public Key Callbacks\n"); -#endif -} - -THREAD_RETURN CYASSL_THREAD server_test(void* args) -{ - SOCKET_T sockfd = 0; - SOCKET_T clientfd = 0; - - SSL_METHOD* method = 0; - SSL_CTX* ctx = 0; - SSL* ssl = 0; - - char msg[] = "I hear you fa shizzle!"; - char input[80]; - int idx; - int ch; - int version = SERVER_DEFAULT_VERSION; - int doCliCertCheck = 1; - int useAnyAddr = 0; - word16 port = yasslPort; - int usePsk = 0; - int doDTLS = 0; - int useNtruKey = 0; - int nonBlocking = 0; - int trackMemory = 0; - int fewerPackets = 0; - int pkCallbacks = 0; - char* cipherList = NULL; - const char* verifyCert = cliCert; - const char* ourCert = svrCert; - const char* ourKey = svrKey; - int argc = ((func_args*)args)->argc; - char** argv = ((func_args*)args)->argv; - -#ifdef HAVE_SNI - char* sniHostName = NULL; -#endif - -#ifdef HAVE_OCSP - int useOcsp = 0; - char* ocspUrl = NULL; -#endif - - ((func_args*)args)->return_code = -1; /* error state */ - -#ifdef NO_RSA - verifyCert = (char*)cliEccCert; - ourCert = (char*)eccCert; - ourKey = (char*)eccKey; -#endif - (void)trackMemory; - (void)pkCallbacks; - - while ((ch = mygetopt(argc, argv, "?dbstnNufPp:v:l:A:c:k:S:oO:")) != -1) { - switch (ch) { - case '?' : - Usage(); - exit(EXIT_SUCCESS); - - case 'd' : - doCliCertCheck = 0; - break; - - case 'b' : - useAnyAddr = 1; - break; - - case 's' : - usePsk = 1; - break; - - case 't' : - #ifdef USE_CYASSL_MEMORY - trackMemory = 1; - #endif - break; - - case 'n' : - useNtruKey = 1; - break; - - case 'u' : - doDTLS = 1; - break; - - case 'f' : - fewerPackets = 1; - break; - - case 'P' : - #ifdef HAVE_PK_CALLBACKS - pkCallbacks = 1; - #endif - break; - - case 'p' : - port = (word16)atoi(myoptarg); - #if !defined(NO_MAIN_DRIVER) || defined(USE_WINDOWS_API) - if (port == 0) - err_sys("port number cannot be 0"); - #endif - break; - - case 'v' : - version = atoi(myoptarg); - if (version < 0 || version > 3) { - Usage(); - exit(MY_EX_USAGE); - } - break; - - case 'l' : - cipherList = myoptarg; - break; - - case 'A' : - verifyCert = myoptarg; - break; - - case 'c' : - ourCert = myoptarg; - break; - - case 'k' : - ourKey = myoptarg; - break; - - case 'N': - nonBlocking = 1; - break; - - case 'S' : - #ifdef HAVE_SNI - sniHostName = myoptarg; - #endif - break; - - case 'o' : - #ifdef HAVE_OCSP - useOcsp = 1; - #endif - break; - - case 'O' : - #ifdef HAVE_OCSP - useOcsp = 1; - ocspUrl = myoptarg; - #endif - break; - - default: - Usage(); - exit(MY_EX_USAGE); - } - } - - myoptind = 0; /* reset for test cases */ - - /* sort out DTLS versus TLS versions */ - if (version == CLIENT_INVALID_VERSION) { - if (doDTLS) - version = CLIENT_DTLS_DEFAULT_VERSION; - else - version = CLIENT_DEFAULT_VERSION; - } - else { - if (doDTLS) { - if (version == 3) - version = -2; - else - version = -1; - } - } - -#ifdef USE_CYASSL_MEMORY - if (trackMemory) - InitMemoryTracker(); -#endif - - switch (version) { -#ifndef NO_OLD_TLS - case 0: - method = SSLv3_server_method(); - break; - - #ifndef NO_TLS - case 1: - method = TLSv1_server_method(); - break; - - - case 2: - method = TLSv1_1_server_method(); - break; - - #endif -#endif - -#ifndef NO_TLS - case 3: - method = TLSv1_2_server_method(); - break; -#endif - -#ifdef CYASSL_DTLS - case -1: - method = DTLSv1_server_method(); - break; - - case -2: - method = DTLSv1_2_server_method(); - break; -#endif - - default: - err_sys("Bad SSL version"); - } - - if (method == NULL) - err_sys("unable to get method"); - - ctx = SSL_CTX_new(method); - if (ctx == NULL) - err_sys("unable to get ctx"); - - if (cipherList) - if (SSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS) - err_sys("server can't set cipher list 1"); - -#ifdef CYASSL_LEANPSK - usePsk = 1; -#endif - -#if defined(NO_RSA) && !defined(HAVE_ECC) - usePsk = 1; -#endif - - if (fewerPackets) - CyaSSL_CTX_set_group_messages(ctx); - -#if defined(OPENSSL_EXTRA) || defined(HAVE_WEBSERVER) - SSL_CTX_set_default_passwd_cb(ctx, PasswordCallBack); -#endif - -#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) - if (!usePsk) { - if (SSL_CTX_use_certificate_file(ctx, ourCert, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server cert file, check file and run from" - " CyaSSL home dir"); - } -#endif - -#ifdef HAVE_NTRU - if (useNtruKey) { - if (CyaSSL_CTX_use_NTRUPrivateKey_file(ctx, ourKey) - != SSL_SUCCESS) - err_sys("can't load ntru key file, " - "Please run from CyaSSL home dir"); - } -#endif - -#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) - if (!useNtruKey && !usePsk) { - if (SSL_CTX_use_PrivateKey_file(ctx, ourKey, SSL_FILETYPE_PEM) - != SSL_SUCCESS) - err_sys("can't load server private key file, check file and run " - "from CyaSSL home dir"); - } -#endif - - if (usePsk) { -#ifndef NO_PSK - SSL_CTX_set_psk_server_callback(ctx, my_psk_server_cb); - SSL_CTX_use_psk_identity_hint(ctx, "cyassl server"); - if (cipherList == NULL) { - const char *defaultCipherList; - #ifdef HAVE_NULL_CIPHER - defaultCipherList = "PSK-NULL-SHA256"; - #else - defaultCipherList = "PSK-AES128-CBC-SHA256"; - #endif - if (SSL_CTX_set_cipher_list(ctx, defaultCipherList) != SSL_SUCCESS) - err_sys("server can't set cipher list 2"); - } -#endif - } - -#if !defined(NO_FILESYSTEM) && !defined(NO_CERTS) - /* if not using PSK, verify peer with certs */ - if (doCliCertCheck && usePsk == 0) { - SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER | - SSL_VERIFY_FAIL_IF_NO_PEER_CERT,0); - if (SSL_CTX_load_verify_locations(ctx, verifyCert, 0) != SSL_SUCCESS) - err_sys("can't load ca file, Please run from CyaSSL home dir"); - } -#endif - -#if defined(CYASSL_SNIFFER) && !defined(HAVE_NTRU) && !defined(HAVE_ECC) - /* don't use EDH, can't sniff tmp keys */ - if (cipherList == NULL) { - if (SSL_CTX_set_cipher_list(ctx, "AES256-SHA256") != SSL_SUCCESS) - err_sys("server can't set cipher list 3"); - } -#endif - -#ifdef HAVE_SNI - if (sniHostName) - if (CyaSSL_CTX_UseSNI(ctx, CYASSL_SNI_HOST_NAME, sniHostName, - XSTRLEN(sniHostName)) != SSL_SUCCESS) - err_sys("UseSNI failed"); -#endif - - ssl = SSL_new(ctx); - if (ssl == NULL) - err_sys("unable to get SSL"); - -#ifdef HAVE_CRL - CyaSSL_EnableCRL(ssl, 0); - CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, CYASSL_CRL_MONITOR | - CYASSL_CRL_START_MON); - CyaSSL_SetCRL_Cb(ssl, CRL_CallBack); -#endif -#ifdef HAVE_OCSP - if (useOcsp) { - if (ocspUrl != NULL) { - CyaSSL_CTX_SetOCSP_OverrideURL(ctx, ocspUrl); - CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE - | CYASSL_OCSP_URL_OVERRIDE); - } - else - CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE); - } -#endif -#ifdef HAVE_PK_CALLBACKS - if (pkCallbacks) - SetupPkCallbacks(ctx, ssl); -#endif - - tcp_accept(&sockfd, &clientfd, (func_args*)args, port, useAnyAddr, doDTLS, - 0); - if (!doDTLS) - CloseSocket(sockfd); - - SSL_set_fd(ssl, clientfd); - if (usePsk == 0 || cipherList != NULL) { - #if !defined(NO_FILESYSTEM) && !defined(NO_DH) - CyaSSL_SetTmpDH_file(ssl, dhParam, SSL_FILETYPE_PEM); - #elif !defined(NO_DH) - SetDH(ssl); /* repick suites with DHE, higher priority than PSK */ - #endif - } - -#ifndef CYASSL_CALLBACKS - if (nonBlocking) { - CyaSSL_set_using_nonblock(ssl, 1); - tcp_set_nonblocking(&clientfd); - NonBlockingSSL_Accept(ssl); - } else if (SSL_accept(ssl) != SSL_SUCCESS) { - int err = SSL_get_error(ssl, 0); - char buffer[CYASSL_MAX_ERROR_SZ]; - printf("error = %d, %s\n", err, ERR_error_string(err, buffer)); - err_sys("SSL_accept failed"); - } -#else - NonBlockingSSL_Accept(ssl); -#endif - showPeer(ssl); - - idx = SSL_read(ssl, input, sizeof(input)-1); - if (idx > 0) { - input[idx] = 0; - printf("Client message: %s\n", input); - - } - else if (idx < 0) { - int readErr = SSL_get_error(ssl, 0); - if (readErr != SSL_ERROR_WANT_READ) - err_sys("SSL_read failed"); - } - - if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg)) - err_sys("SSL_write failed"); - - #if defined(CYASSL_MDK_SHELL) && defined(HAVE_MDK_RTX) - os_dly_wait(500) ; - #endif - - SSL_shutdown(ssl); - SSL_free(ssl); - SSL_CTX_free(ctx); - - CloseSocket(clientfd); - ((func_args*)args)->return_code = 0; - -#ifdef USE_CYASSL_MEMORY - if (trackMemory) - ShowMemoryTracker(); -#endif /* USE_CYASSL_MEMORY */ - - return 0; -} - - -/* so overall tests can pull in test function */ -#ifndef NO_MAIN_DRIVER - - int main(int argc, char** argv) - { - func_args args; - -#ifdef HAVE_CAVIUM - int ret = OpenNitroxDevice(CAVIUM_DIRECT, CAVIUM_DEV_ID); - if (ret != 0) - err_sys("Cavium OpenNitroxDevice failed"); -#endif /* HAVE_CAVIUM */ - - StartTCP(); - - args.argc = argc; - args.argv = argv; - - CyaSSL_Init(); -#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL) - CyaSSL_Debugging_ON(); -#endif - if (CurrentDir("server")) - ChangeDirBack(2); - else if (CurrentDir("Debug") || CurrentDir("Release")) - ChangeDirBack(3); - -#ifdef HAVE_STACK_SIZE - StackSizeCheck(&args, server_test); -#else - server_test(&args); -#endif - CyaSSL_Cleanup(); - -#ifdef HAVE_CAVIUM - CspShutdown(CAVIUM_DEV_ID); -#endif - return args.return_code; - } - - int myoptind = 0; - char* myoptarg = NULL; - -#endif /* NO_MAIN_DRIVER */ - - -#ifdef CYASSL_CALLBACKS - - int srvHandShakeCB(HandShakeInfo* info) - { - (void)info; - return 0; - } - - - int srvTimeoutCB(TimeoutInfo* info) - { - (void)info; - return 0; - } - -#endif - diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/Abstract.txt b/IDE/MDK5-ARM/Projects/wolfSSL-Full/Abstract.txt similarity index 100% rename from IDE/MDK5-ARM/Projects/CyaSSL-Full/Abstract.txt rename to IDE/MDK5-ARM/Projects/wolfSSL-Full/Abstract.txt diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/main.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c similarity index 53% rename from IDE/MDK5-ARM/Projects/CyaSSL-Full/main.c rename to IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c index ae487e705..2ee3de735 100644 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/main.c +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/main.c @@ -23,22 +23,56 @@ #include #endif -#include -#include +#include +#include +#include +#define __CORTEX_M3__ + +#include +#include "wolfcrypt/src/misc.c" +#include "stm32f2xx_hal.h" #include "cmsis_os.h" -#if !defined(NO_FILESYSTEM) -#include "rl_fs.h" -#endif #include "rl_net.h" #include -#include "cyassl_MDK_ARM.h" -#include + +#include + + +/*----------------------------------------------------------------------------- + * Initialize Clock Configuration + *----------------------------------------------------------------------------*/ +void SystemClock_Config(void) { + RCC_OscInitTypeDef RCC_OscInitStruct; + RCC_ClkInitTypeDef RCC_ClkInitStruct; + + /* Enable HSE Oscillator and activate PLL with HSE as source */ + RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; + RCC_OscInitStruct.HSEState = RCC_HSE_ON; + RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; + RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; + RCC_OscInitStruct.PLL.PLLM = 25; + RCC_OscInitStruct.PLL.PLLN = 240; + RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; + RCC_OscInitStruct.PLL.PLLQ = 5; + HAL_RCC_OscConfig(&RCC_OscInitStruct); + + /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 + clocks dividers */ + RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | + RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; + RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; + RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; + RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; + RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; + HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_3); +} /*----------------------------------------------------------------------------- * Initialize a Flash Memory Card *----------------------------------------------------------------------------*/ #if !defined(NO_FILESYSTEM) +#include "rl_fs.h" static void init_filesystem (void) { int32_t retv; @@ -58,22 +92,14 @@ static void init_filesystem (void) { } #endif -/*----------------------------------------------------------------------------- - * TCP/IP tasks - *----------------------------------------------------------------------------*/ -void tcp_poll (void const *arg) -{ - CYASSL_MSG("TCP polling started.\n") ; - while (1) { - net_main (); - osDelay(1) ; - } -} +typedef struct func_args { + int argc; + char** argv; +} func_args; -extern void shell_main(void * args) ; -extern void init_time(void) ; -osThreadDef (tcp_poll, osPriorityHigh, 1, 0) ; +extern void shell_main(func_args * args) ; + /*----------------------------------------------------------------------------- * mian entry *----------------------------------------------------------------------------*/ @@ -83,18 +109,18 @@ char* myoptarg = NULL; int main() { void *arg = NULL ; + + SystemClock_Config() ; + #if !defined(NO_FILESYSTEM) + init_filesystem (); + #endif - #if !defined(NO_FILESYSTEM) - init_filesystem (); - #endif - - net_initialize() ; - - osThreadCreate (osThread (tcp_poll), NULL); - osDelay(10000) ; /* wait for DHCP */ - #if defined(DEBUG_CYASSL) + netInitialize() ; + osDelay(300) ; + + #if defined(DEBUG_WOLFSSL) printf("Turning ON Debug message\n") ; - CyaSSL_Debugging_ON() ; + wolfSSL_Debugging_ON() ; #endif shell_main(arg) ; diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/shell.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c similarity index 80% rename from IDE/MDK5-ARM/Projects/CyaSSL-Full/shell.c rename to IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c index 7103e5731..f9550c2a6 100644 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/shell.c +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/shell.c @@ -19,31 +19,30 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - /*** tiny Shell for CyaSSL apps ***/ + /*** tiny Shell for wolfSSL apps ***/ #ifdef HAVE_CONFIG_H #include #endif -#include "cyassl/internal.h" -#undef RNG -#include -#if defined(CYASSL_MDK_ARM) +#include "wolfssl/internal.h" +#include + +#if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #include #include #include - #if defined(CYASSL_MDK5) + #if defined(WOLFSSL_MDK5) || defined(WOLFSSL_KEIL_TCP_NET) #include "cmsis_os.h" #include "rl_fs.h" #else #include #endif - #include "cyassl_MDK_ARM.h" #endif -#ifdef CYASSL_KEIL_NET -#include "cyassl/test.h" +#ifdef WOLFSSL_KEIL_TCP_NET +#include "wolfssl/test.h" #else typedef struct func_args { int argc; @@ -52,6 +51,10 @@ typedef struct func_args { } func_args; #endif +#if defined(WOLFSSL_CMSIS_RTOS) +#define HAVE_KEIL_RTX +#endif + #ifdef NO_ECHOCLIENT #define echoclient_test command_not_found #endif @@ -71,7 +74,7 @@ typedef struct func_args { #define ctaocrypt_test command_not_found #endif -#ifndef CYASSL_KEIL_NET +#ifndef WOLFSSL_KEIL_TCP_NET #define ipaddr_comm command_not_found #endif @@ -80,7 +83,7 @@ typedef struct func_args { #endif -#if !defined(DEBUG_CYASSL) +#if !defined(DEBUG_WOLFSSL) #define dbg_comm command_not_found #endif @@ -92,7 +95,7 @@ void command_not_found(void *argv) { extern void echoclient_test(void *args) ; extern void echoserver_test(void *args) ; extern void benchmark_test(void *args) ; -extern void ctaocrypt_test(void *args) ; +extern void wolfcrypt_test(void *args) ; extern void client_test(void *args) ; extern void server_test(void *args) ; extern void kill_task(void *args) ; @@ -107,7 +110,7 @@ extern void help_comm(void *arg) ; #ifndef NO_MD5 extern void md5_test(void *arg) ; #endif -#ifdef CYASSL_MD2 +#ifdef WOLFSSL_MD2 extern void md2_test(void *arg) ; #endif #ifndef NO_MD4 @@ -119,15 +122,15 @@ extern void sha_test(void *arg) ; #ifndef NO_SHA256 extern void sha256_test(void *arg) ; #endif -#ifdef CYASSL_SHA384 +#ifdef WOLFSSL_SHA384 extern void sha384_test(void *arg) ; #endif -#ifdef CYASSL_SHA512 +#ifdef WOLFSSL_SHA512 extern void sha512_test(void *arg) ; #endif -#ifdef CYASSL_RIPEMD +#ifdef WOLFSSL_RIPEMD extern void ripemd_test(void *arg) ; #endif #ifndef NO_HMAC @@ -140,7 +143,7 @@ extern void hmac_sha_test(void *arg) ; extern void hmac_sha256_test(void *arg) ; #endif - #ifdef CYASSL_SHA384 + #ifdef WOLFSSL_SHA384 extern void hmac_sha384_test(void *arg) ; #endif #endif @@ -210,7 +213,7 @@ static struct { "echoclient", echoclient_test, "echoserver", echoserver_test, "benchmark", benchmark_test, - "test", ctaocrypt_test, + "test", wolfcrypt_test, "client", client_test, "server", server_test, "ipaddr", ipaddr_comm, /* TBD */ @@ -223,7 +226,7 @@ static struct { "ec", echoclient_test, "es", echoserver_test, "bm", benchmark_test, - "te", ctaocrypt_test, + "te", wolfcrypt_test, "cl", client_test, "sv", server_test, "ip", ipaddr_comm, @@ -236,7 +239,7 @@ static struct { #ifndef NO_MD5 "md5", md5_test, #endif -#ifdef CYASSL_MD2 +#ifdef WOLFSSL_MD2 "md2", md2_test, #endif #ifndef NO_MD4 @@ -246,13 +249,13 @@ static struct { #ifndef NO_SHA256 "sha256", sha256_test, #endif -#ifdef CYASSL_SHA384 +#ifdef WOLFSSL_SHA384 "sha384", sha384_test, #endif -#ifdef CYASSL_SHA512 +#ifdef WOLFSSL_SHA512 "sha512", sha512_test, #endif -#ifdef CYASSL_RIPEMD +#ifdef WOLFSSL_RIPEMD "ripemd", ripemd_test, #endif #ifndef NO_HMAC @@ -263,7 +266,7 @@ static struct { #ifndef NO_SHA256 "hmac_sha256", hmac_sha256_test, #endif - #ifdef CYASSL_SHA384 + #ifdef WOLFSSL_SHA384 "hmac_sha384", hmac_sha384_test, #endif #endif @@ -324,6 +327,38 @@ enum jobtype { FORGROUND, BACKGROUND } ; static int BackGround = 0 ; /* 1: background job is running */ +char * wolfssl_fgets ( char * str, int num, FILE * f ) +{ + int i ; + + for(i = 0 ; i< num ; i++) { + while((str[i] = getchar()) == 0) { + #if defined (HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS) + os_tsk_pass (); + #else + osThreadYield (); + #endif + } + if(str[i] == '\n' || str[i] == '\012' || str[i] == '\015') { + putchar('\n') ; + str[i++] = '\n' ; + str[i] = '\0' ; + break ; + } else if(str[i] == '\010') { /* BS */ + if(i) { /* erace one char */ + putchar('\010') ; putchar(' ') ; putchar('\010') ; + i = (i>0 ? (i-2) : -1 ) ; + continue ; + } + } else if(str[i] == '\033' || str[i] == '\004' ) { /* ESC or ^D */ + str[i] = '\0' ; + return(0) ; + } + putchar(str[i]) ; + } + return(str) ; +} + /******* Get Command Line *****************************/ static int getline(char * line, int sz, func_args *args, int*bf_flg) { @@ -337,7 +372,7 @@ static int getline(char * line, int sz, func_args *args, int*bf_flg) putchar('>') ; fflush(stdout) ; - ret = fgets(line, sz, stdin) ; + ret = wolfssl_fgets(line, sz, stdin) ; #define SHELL_ERROR_FGETS -102 if(ret != line) return(SHELL_ERROR_FGETS) ; @@ -367,11 +402,11 @@ static int getline(char * line, int sz, func_args *args, int*bf_flg) /************* Embedded Shell Commands **********************************/ #define IP_SIZE 16 -#ifdef CYASSL_KEIL_NET +#ifdef WOLFSSL_KEIL_TCP_NET static void ipaddr_comm(void *args) { if(((func_args *)args)->argc == 1) { - printf("IP addr: %s, port %d\n", yasslIP, yasslPort) ; + printf("IP addr: %s, port %d\n", wolfSSLIP, wolfSSLPort) ; } else { if(BackGround != 0) { printf("Cannot change IP addr while background server is running\n") ; @@ -447,20 +482,20 @@ static void for_command(void *args) } -#if defined(DEBUG_CYASSL) +#if defined(DEBUG_WOLFSSL) -static int CyasslDebug = 1 ; +static int wolfsslDebug = 1 ; static void dbg_comm(void *args) { - if(CyasslDebug == 1) { - CyasslDebug = 0 ; + if(wolfsslDebug == 1) { + wolfsslDebug = 0 ; printf("Turning OFF Debug message\n") ; - CyaSSL_Debugging_OFF() ; + wolfSSL_Debugging_OFF() ; } else { - CyasslDebug = 1 ; + wolfasslDebug = 1 ; printf("Turning ON Debug message\n") ; - CyaSSL_Debugging_ON() ; + wolfSSL_Debugging_ON() ; } } #endif @@ -489,28 +524,28 @@ static void help_comm(void *args) -#define BG_JOB_STACK_SIZE 8000 +#define BG_JOB_STACK_SIZE 16000 #if (!defined(NO_SIMPLE_SERVER) && !defined(NO_ECHOSERVER)) && \ defined(HAVE_KEIL_RTX) -#if !defined(CYASSL_CMSIS_RTOS) +#if !defined(WOLFSSL_CMSIS_RTOS) static char bg_job_stack[BG_JOB_STACK_SIZE] ; #endif #endif -#define COMMAND_STACK_SIZE 10000 -#if defined(HAVE_KEIL_RTX) && !defined(CYASSL_CMSIS_RTOS) +#define COMMAND_STACK_SIZE 24000 +#if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS) static char command_stack[COMMAND_STACK_SIZE] ; #endif -#ifdef HAVE_KEIL_RTX -static CyaSSL_Mutex command_mutex ; +#if defined(HAVE_KEIL_RTX) || defined(WOLFSSL_CMSIS_RTOS) +static wolfSSL_Mutex command_mutex ; #endif void exit_command(void) { printf("Command Aborted\n") ; - #ifdef CYASSL_CMSIS_RTOS + #ifdef WOLFSSL_CMSIS_RTOS osThreadTerminate(osThreadGetId()) ; #else os_tsk_delete_self() ; @@ -525,19 +560,19 @@ static void command_invoke(void const *args) int i,iteration ; func = (void(*)(void const *))((func_args *)args)->argv[0] ; - #ifdef HAVE_KEIL_RTX - LockMutex((CyaSSL_Mutex *)&command_mutex) ; + #if defined(HAVE_KEIL_RTX) + LockMutex((wolfSSL_Mutex *)&command_mutex) ; #endif iteration = for_iteration ; for(i=0; i< iteration; i++) { if(iteration > 1) printf("--- Start for %d ---->\n", i) ; - #if defined(HAVE_KEIL_RTX) && !defined(CYASSL_CMSIS_RTOS) + #if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS) stack_fill(command_stack, COMMAND_STACK_SIZE) ; #endif func(args) ; /* invoke command */ - #if defined(HAVE_KEIL_RTX)&& !defined(CYASSL_CMSIS_RTOS) + #if defined(HAVE_KEIL_RTX)&& !defined(WOLFSSL_CMSIS_RTOS) stack_check(command_stack, COMMAND_STACK_SIZE) ; #endif } @@ -546,8 +581,8 @@ static void command_invoke(void const *args) for_iteration = 1 ; osDelay(20000) ; #ifdef HAVE_KEIL_RTX - UnLockMutex((CyaSSL_Mutex *)&command_mutex) ; - #ifdef CYASSL_CMSIS_RTOS + UnLockMutex((wolfSSL_Mutex *)&command_mutex) ; + #ifdef WOLFSSL_CMSIS_RTOS osThreadTerminate(osThreadGetId()) ; #else os_tsk_delete_self() ; @@ -555,26 +590,26 @@ static void command_invoke(void const *args) #endif } -#if defined(HAVE_KEIL_RTX) +#if defined(HAVE_KEIL_RTX) || defined(WOLFSSL_CMSIS_RTOS) /******* Invoke Background Job *******************************/ static void bg_job_invoke(void const *args) { void (*func)(void const * ) ; BackGround = 1 ; - #if defined(HAVE_KEIL_RTX)&& !defined(CYASSL_CMSIS_RTOS) + #if defined(HAVE_KEIL_RTX)&& !defined(WOLFSSL_CMSIS_RTOS) stack_fill(bg_job_stack, BG_JOB_STACK_SIZE) ; #endif func = (void(*)(void const *))((func_args *)args)->argv[0] ; func(args) ; /* invoke command */ - #if defined(HAVE_KEIL_RTX) && !defined(CYASSL_CMSIS_RTOS) + #if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS) stack_check(bg_job_stack, BG_JOB_STACK_SIZE) ; #endif osDelay(20000) ; BackGround = 0 ; - #ifdef CYASSL_CMSIS_RTOS + #ifdef WOLFSSL_CMSIS_RTOS osThreadTerminate(osThreadGetId()) ; #else os_tsk_delete_self() ; ; @@ -585,7 +620,7 @@ static void bg_job_invoke(void const *args) #define LINESIZE 100 static char line[LINESIZE] ; -#if defined(CYASSL_CMSIS_RTOS) +#if defined(WOLFSSL_CMSIS_RTOS) osThreadDef (command_invoke, osPriorityAboveNormal , 1, COMMAND_STACK_SIZE) ; osThreadDef (bg_job_invoke, osPriorityNormal , 1 , BG_JOB_STACK_SIZE) ; #endif @@ -594,11 +629,11 @@ void shell_main(void *arg) { int i ; func_args args ; int bf_flg ; - + osThreadId cmd ; i = BackGround ; /* Dummy for avoiding warning: BackGround is defined but not used. */ - #if defined(HAVE_KEIL_RTX) + #if defined(HAVE_KEIL_RTX) InitMutex(&command_mutex) ; #endif help_comm(NULL) ; @@ -610,20 +645,25 @@ void shell_main(void *arg) { if(strcmp(commandTable[i].command, args.argv[0]) == 0) { args.argv[0] = (char *) commandTable[i].func ; if(bf_flg == FORGROUND) { - #if defined(HAVE_KEIL_RTX) && !defined(CYASSL_CMSIS_RTOS) - UnLockMutex((CyaSSL_Mutex *)&command_mutex) ; + #if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS) + UnLockMutex((wolfSSL_Mutex *)&command_mutex) ; os_tsk_create_user_ex( (void(*)(void *))&command_invoke, 7, command_stack, COMMAND_STACK_SIZE, &args) ; + os_tsk_pass (); #else - #if defined(CYASSL_CMSIS_RTOS) - UnLockMutex((CyaSSL_Mutex *)&command_mutex) ; - osThreadCreate (osThread (command_invoke) , &args); + #if defined(WOLFSSL_CMSIS_RTOS) + UnLockMutex((wolfSSL_Mutex *)&command_mutex) ; + cmd = osThreadCreate (osThread (command_invoke) , &args); + if(cmd == NULL) { + printf("Cannon create command thread\n") ; + } + osThreadYield (); #else command_invoke(&args) ; #endif #endif #ifdef HAVE_KEIL_RTX - LockMutex((CyaSSL_Mutex *)&command_mutex) ; + LockMutex((wolfSSL_Mutex *)&command_mutex) ; #endif } else { #if (!defined(NO_SIMPLE_SERVER) && \ @@ -634,7 +674,7 @@ void shell_main(void *arg) { } else { printf("\"%s\" is running with the background mode.\n", commandTable[i].command) ; - #if defined(HAVE_KEIL_RTX) && !defined(CYASSL_CMSIS_RTOS) + #if defined(HAVE_KEIL_RTX) && !defined(WOLFSSL_CMSIS_RTOS) os_tsk_create_user_ex( (void(*)(void *))&bg_job_invoke, 6, bg_job_stack, BG_JOB_STACK_SIZE, &args) ; #else diff --git a/IDE/MDK5-ARM/Projects/CyaSSL-Full/time-CortexM3-4.c b/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c similarity index 97% rename from IDE/MDK5-ARM/Projects/CyaSSL-Full/time-CortexM3-4.c rename to IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c index ca5046138..c825387dd 100644 --- a/IDE/MDK5-ARM/Projects/CyaSSL-Full/time-CortexM3-4.c +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/time-CortexM3-4.c @@ -23,6 +23,7 @@ #include #endif +#include #include #define DWT ((DWT_Type *) (0xE0001000UL) ) @@ -39,3 +40,4 @@ double current_time(int reset) if(reset) DWT->CYCCNT = 0 ; return ((double)DWT->CYCCNT/SystemCoreClock) ; } + diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx new file mode 100644 index 000000000..91b3e7f9a --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvoptx @@ -0,0 +1,387 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + STM32F207 Flash + 0x4 + ARM-ADS + + 12000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\Object\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + + 0 + Schematics (MCBSTM32F200) + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf + + + 1 + User Manual (MCBSTM32F200) + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm + + + 2 + MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) + http://www.keil.com/mcbstm32f200/ + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 1 + + + + + + + + + + .\STM32_SWO.ini + BIN\UL2CM3.DLL + + + + 0 + ARMRTXEVENTFLAGS + -L70 -Z18 -C0 -M0 -T1 + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + ULP2CM3 + -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$CMSIS/Flash/STM32F2xx_1024.FLM) + + + 0 + DLGUARM + (105=-1,-1,-1,-1,0) + + + 0 + UL2CM3 + -UM1020ADE -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO19 -TC120000000 -TP21 -TDS801F -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM) + + + + + + 1 + 8 + port + 0 + + + + + 2 + 8 + 0x8004dc8 + 0 + + + + 0 + + + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + + + + + + + + Source + 1 + 0 + 0 + 0 + + 1 + 1 + 1 + 0 + 0 + 0 + 0 + .\main.c + main.c + 0 + 0 + + + 1 + 2 + 1 + 0 + 0 + 0 + 0 + .\shell.c + shell.c + 0 + 0 + + + 1 + 3 + 1 + 0 + 0 + 0 + 0 + .\time-CortexM3-4.c + time-CortexM3-4.c + 0 + 0 + + + + + Configuration + 1 + 0 + 0 + 0 + + 2 + 4 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\config-Crypt.h + config-Crypt.h + 0 + 0 + + + 2 + 5 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\config-wolfSSL.h + config-wolfSSL.h + 0 + 0 + + + 2 + 6 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\user_settings.h + user_settings.h + 0 + 0 + + + + + Dcumentation + 1 + 0 + 0 + 0 + + 3 + 7 + 5 + 0 + 0 + 0 + 0 + .\Abstract.txt + Abstract.txt + 0 + 0 + + + + + ::CMSIS + 1 + 0 + 0 + 1 + + + + ::CMSIS Driver + 1 + 0 + 0 + 1 + + + + ::Compiler + 1 + 0 + 0 + 1 + + + + ::Device + 1 + 0 + 0 + 1 + + + + ::File System + 1 + 0 + 0 + 1 + + + + ::Network + 1 + 0 + 0 + 1 + + + + ::wolfSSL + 1 + 0 + 0 + 1 + + +
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx new file mode 100644 index 000000000..29b8b698e --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Full/wolfsslFull.uvprojx @@ -0,0 +1,950 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + STM32F207 Flash + 0x4 + ARM-ADS + + + STM32F207IGHx + STMicroelectronics + Keil.STM32F2xx_DFP.2.2.0 + http://www.keil.com/pack + IROM(0x08000000,0x100000) IRAM(0x20000000,0x20000) CPUTYPE("Cortex-M3") CLOCK(12000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IGHx$CMSIS/Flash/STM32F2xx_1024.FLM)) + 0 + $$Device:STM32F207IGHx$Drivers/CMSIS/Device/ST/STM32F2xx/Include/stm32f2xx.h + + + + + + + + + + $$Device:STM32F207IGHx$CMSIS\SVD\STM32F20x.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\Object\ + wolfssl-Full + 1 + 0 + 0 + 1 + 1 + .\Object\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM3 + SARMCM3.DLL + -MPU + TCM.DLL + -pCM3 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + + + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + + 0 + 1 + + + + + + + + + + + + + .\STM32_SWO.ini + BIN\UL2CM3.DLL + + + + + 1 + 0 + 0 + 1 + 1 + 4100 + + 1 + BIN\UL2CM3.DLL + + + + + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M3" + + 1 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 8 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 1 + 0x8000000 + 0x100000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x100000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 2 + 0 + 0 + 1 + 0 + + --diag_suppress=1293 + HSE_VALUE=25000000 HAVE_CONFIG_H MDK_CONF_full WOLFSSL_USER_SETTINGS + + + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + + + + + + + + + + + + Source + + + main.c + 1 + .\main.c + + + shell.c + 1 + .\shell.c + + + time-CortexM3-4.c + 1 + .\time-CortexM3-4.c + + + + + Configuration + + + config-Crypt.h + 5 + .\RTE\wolfSSL\config-Crypt.h + + + config-wolfSSL.h + 5 + .\RTE\wolfSSL\config-wolfSSL.h + + + user_settings.h + 5 + .\RTE\wolfSSL\user_settings.h + + + + + Dcumentation + + + Abstract.txt + 5 + .\Abstract.txt + + + + + ::CMSIS + + + ::CMSIS Driver + + + ::Compiler + + + ::Device + + + ::File System + + + ::Network + + + ::wolfSSL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RTE\CMSIS\RTX_Conf_CM.c + + + + + + + + RTE\Device\MK70FN1M0xxx12\startup_MK70F12.s + + + + + + RTE\Device\MK70FN1M0xxx12\system_MK70F12.c + + + + + + RTE\Device\STM32F207IGHx\RTE_Device.h + + + + + + + + RTE\Device\STM32F207IGHx\startup_stm32f207xx.s + + + + + + + + RTE\Device\STM32F207IGHx\stm32f2xx_hal_conf.h + + + + + + + + RTE\Device\STM32F207IGHx\system_stm32f2xx.c + + + + + + + + RTE\Device\STM32F207IG\RTE_Device.h + + + + + + RTE\Device\STM32F207IG\startup_stm32f207xx.s + + + + + + RTE\Device\STM32F207IG\startup_stm32f2xx.s + + + + + + RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h + + + + + + RTE\Device\STM32F207IG\system_stm32f2xx.c + + + + + + RTE\Device\TM4C129ENCPDT\startup_TM4C129.s + + + + + + RTE\Device\TM4C129ENCPDT\system_tm4c129.c + + + + + + RTE\File_System\FS_Config.c + + + + + + + + RTE\File_System\FS_Config_MC_0.h + + + + + + + + RTE\Network\Net_Config.c + + + + + + + + RTE\Network\Net_Config_BSD.h + + + + + + + + RTE\Network\Net_Config_DNS_Client.h + + + + + + + + RTE\Network\Net_Config_ETH_0.h + + + + + + + + RTE\Network\Net_Config_TCP.h + + + + + + + + RTE\Network\Net_Config_UDP.h + + + + + + + + RTE\Network\Net_Debug.c + + + + + + RTE\Other\config-Crypt.h + + + + + + RTE\Other\config-CyaSSL.h + + + + + + RTE\Other\config-RTX-TCP-FS.h + + + + + + RTE\Other\config.h + + + + + + RTE\wolfSSL\config-Crypt.h + + + + + + + + RTE\wolfSSL\config-CyaSSL.h + + + + + + RTE\wolfSSL\config-wolfSSL.h + + + + + + + + RTE\wolfSSL\config.h + + + + + + RTE\wolfSSL\settings.h + + + + + + RTE\wolfSSL\user_settings.h + + + + + + + + + +
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx new file mode 100644 index 000000000..5308bcfa7 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvoptx @@ -0,0 +1,314 @@ + + + + 1.0 + +
### uVision Project, (C) Keil Software
+ + + *.c + *.s*; *.src; *.a* + *.obj + *.lib + *.txt; *.h; *.inc + *.plm + *.cpp + 0 + + + + 0 + 0 + + + + wolfSSL-Lib + 0x4 + ARM-ADS + + 120000000 + + 1 + 1 + 0 + 1 + 0 + + + 1 + 65535 + 0 + 0 + 0 + + + 79 + 66 + 8 + .\Object\ + + + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 0 + 0 + 0 + 0 + + + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + + + 1 + 0 + 1 + + 18 + + + 0 + Schematics (MCBSTM32F200) + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200-schematics.pdf + + + 1 + User Manual (MCBSTM32F200) + C:\Keil_v5\ARM\PACK\Keil\STM32F2xx_DFP\2.2.0\MDK/Boards/Keil/MCBSTM32F200/Documentation/mcbstm32f200.chm + + + 2 + MCBSTM32F200 Evaluation Board Web Page (MCBSTM32F200) + http://www.keil.com/mcbstm32f200/ + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + 1 + 0 + 0 + 7 + + + + + + + + + + + BIN\ULP2CM3.DLL + + + + 0 + DLGUARM + + + + 0 + DLGTARM + (1010=-1,-1,-1,-1,0)(1007=-1,-1,-1,-1,0)(1008=-1,-1,-1,-1,0)(1009=-1,-1,-1,-1,0)(1012=-1,-1,-1,-1,0) + + + 0 + ARMDBGFLAGS + + + + 0 + ULP2CM3 + -UP1135060 -O206 -S8 -C0 -P00 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO3 -TC10000000 -TP18 -TDX0 -TDD0 -TDS8000 -TDT0 -TDC1F -TIE1 -TIP1 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024.flm -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm) + + + 0 + UL2CM3 + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + + + + + + 1 + 8 + 0x20000408 + 0 + + + + + 2 + 8 + 0x8004dc8 + 0 + + + + 0 + + + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + + + + + + + + Configuration + 1 + 0 + 0 + 0 + + 1 + 1 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\config-Crypt.h + config-Crypt.h + 0 + 0 + + + 1 + 2 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\config-wolfSSL.h + config-wolfSSL.h + 0 + 0 + + + 1 + 3 + 5 + 0 + 0 + 0 + 0 + .\RTE\wolfSSL\user_settings.h + user_settings.h + 0 + 0 + + + + + Documentation + 1 + 0 + 0 + 0 + + + + wolfSSL-lib + 1 + 0 + 0 + 0 + + + + ::CMSIS + 0 + 0 + 0 + 1 + + + + ::CMSIS Driver + 0 + 0 + 0 + 1 + + + + ::Device + 0 + 0 + 0 + 1 + + + + ::Network + 0 + 0 + 0 + 1 + + + + ::wolfSSL + 1 + 0 + 0 + 1 + + +
diff --git a/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx new file mode 100644 index 000000000..92e12d017 --- /dev/null +++ b/IDE/MDK5-ARM/Projects/wolfSSL-Lib/wolfSSL-Lib.uvprojx @@ -0,0 +1,782 @@ + + + + 2.1 + +
### uVision Project, (C) Keil Software
+ + + + wolfSSL-Lib + 0x4 + ARM-ADS + + + STM32F207IG + STMicroelectronics + Keil.STM32F2xx_DFP.2.2.0 + http://www.keil.com/pack + IRAM(0x20000000,0x20000) IROM(0x08000000,0x100000) CPUTYPE("Cortex-M3") CLOCK(120000000) ELITTLE + + + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32F2xx_1024 -FS08000000 -FL0100000 -FP0($$Device:STM32F207IG$Flash\STM32F2xx_1024.flm)) + 0 + $$Device:STM32F207IG$Device\Include\stm32f2xx.h + + + + + + + + + + $$Device:STM32F207IG$SVD\STM32F20x.svd + 0 + 0 + + + + + + + 0 + 0 + 0 + 0 + 1 + + .\Object\ + wolfSSL + 0 + 1 + 0 + 0 + 0 + .\Object\ + 1 + 0 + 0 + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + 0 + 0 + + + 0 + 0 + + + 0 + 0 + + 0 + + + + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 3 + + + 1 + + + SARMCM3.DLL + -REMAP -MPU + DCM.DLL + -pCM3 + SARMCM3.DLL + -REMAP -MPU + TCM.DLL + -pCM3 + + + + 1 + 0 + 0 + 0 + 16 + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + + + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 1 + + 0 + 7 + + + + + + + + + + + + + + BIN\ULP2CM3.DLL + + + + + 1 + 0 + 0 + 1 + 1 + 4100 + + 1 + BIN\ULP2CM3.DLL + "" () + + + wolfSSL-lib + + 0 + + + + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 1 + 1 + 0 + 1 + 1 + 0 + 0 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 0 + 0 + "Cortex-M3" + + 1 + 0 + 0 + 1 + 1 + 0 + 0 + 0 + 0 + 0 + 8 + 0 + 0 + 0 + 3 + 3 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 1 + 0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 1 + 0x8000000 + 0x100000 + + + 0 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x0 + 0x0 + + + 1 + 0x8000000 + 0x100000 + + + 1 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x0 + 0x0 + + + 0 + 0x20000000 + 0x20000 + + + 0 + 0x0 + 0x0 + + + + + + 1 + 4 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + --diag_suppress=1293 + HAVE_CONFIG_H MDK_CONF_WOLFLIB WOLFSSL_USER_SETTINGS + + + + + + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + 1 + 0 + 0 + 0 + 1 + 0 + 0x08000000 + 0x20000000 + + + + + + + + + + + + + Configuration + + + config-Crypt.h + 5 + .\RTE\wolfSSL\config-Crypt.h + + + config-wolfSSL.h + 5 + .\RTE\wolfSSL\config-wolfSSL.h + + + user_settings.h + 5 + .\RTE\wolfSSL\user_settings.h + + + + + Documentation + + + wolfSSL-lib + + + ::CMSIS + + + ::CMSIS Driver + + + ::Device + + + ::Network + + + ::wolfSSL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + RTE\CMSIS\RTX_Conf_CM.c + + + + + + + + RTE\Device\STM32F207IG\RTE_Device.h + + + + + + RTE\Device\STM32F207IG\startup_stm32f207xx.s + + + + + + + + RTE\Device\STM32F207IG\startup_stm32f2xx.s + + + + + + RTE\Device\STM32F207IG\stm32f2xx_hal_conf.h + + + + + + + + RTE\Device\STM32F207IG\system_stm32f2xx.c + + + + + + + + RTE\File_System\FS_Config.c + + + + + + RTE\File_System\FS_Config_MC_0.h + + + + + + RTE\Network\Net_Config.c + + + + + + + + RTE\Network\Net_Config_BSD.h + + + + + + + + RTE\Network\Net_Config_DNS_Client.h + + + + + + + + RTE\Network\Net_Config_ETH_0.h + + + + + + + + RTE\Network\Net_Config_TCP.h + + + + + + + + RTE\Network\Net_Config_UDP.h + + + + + + + + RTE\Network\Net_Debug.c + + + + + + RTE\Other\config-Crypt.h + + + + + + RTE\Other\config-FS.h + + + + + + RTE\Other\config-RTX-TCP-FS.h + + + + + + RTE\Other\config.h + + + + + + RTE\wolfSSL\config-Crypt.h + + + + + + + + RTE\wolfSSL\config-wolfSSL.h + + + + + + + + RTE\wolfSSL\config.h + + + + + + RTE\wolfSSL\settings.h + + + + + + RTE\wolfSSL\user_settings.h + + + + + + + + + +
diff --git a/IDE/MDK5-ARM/Src/cert_data.c b/IDE/MDK5-ARM/Src/cert_data.c deleted file mode 100644 index d6cef016d..000000000 --- a/IDE/MDK5-ARM/Src/cert_data.c +++ /dev/null @@ -1,28 +0,0 @@ -/* certs_test.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 -#endif - -/* Define initial data for cert buffers */ -#include - diff --git a/IDE/MDK5-ARM/Src/cyassl_MDK_ARM.c b/IDE/MDK5-ARM/Src/cyassl_MDK_ARM.c deleted file mode 100644 index 5a2776cc0..000000000 --- a/IDE/MDK5-ARM/Src/cyassl_MDK_ARM.c +++ /dev/null @@ -1,247 +0,0 @@ -/* cyassl_KEIL_RL.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 - */ - - -/***************************************************************************************/ -/** This file is for defining functions for specific to KEIL-RL. **/ -/***************************************************************************************/ -#ifdef HAVE_CONFIG_H - #include -#endif - -#include -#if defined (CYASSL_MDK5) - #include "cmsis_os.h" - #if defined(CYASSL_KEIL_TCP_NET) - #include "rl_net.h" - #endif -#else - #include -#endif - -#include "cyassl_MDK_ARM.h" - -#include -#include - -#if defined (CYASSL_CMSIS_RTOS) - #define os_dly_wait(t) osDelay(10*t) -#endif - - -/** KEIL-RL TCPnet ****/ -/** TCPnet BSD socket does not have following functions. **/ - -#if defined(CYASSL_KEIL_TCP_NET) -char *inet_ntoa(struct in_addr in) -{ - #define NAMESIZE 16 - static char name[NAMESIZE] ; - sprintf(name, "%d.%d.%d.%d", (in.s_addr>>24)&0xff, (in.s_addr>>16)&0xff, (in.s_addr>>8)&0xff, in.s_addr&0xff) ; - return name ; -} - -unsigned long inet_addr(const char *cp) -{ - unsigned int a[4] ; unsigned long ret ; - sscanf(cp, "%d.%d.%d.%d", &a[0], &a[1], &a[2], &a[3]) ; - ret = ((a[3]<<24) + (a[2]<<16) + (a[1]<<8) + a[0]) ; - return(ret) ; -} - - -/*** tcp_connect is actually associated with following syassl_tcp_connect. ***/ -int Cyassl_connect(int sd, const struct sockaddr* sa, int sz) -{ - int ret = 0 ; - #if defined(CYASSL_KEIL_TCP_NET) - - SOCKADDR_IN addr ; - - addr = *(SOCKADDR_IN *)sa ; - - do { - #undef connect /* Go to KEIL TCPnet connect */ - ret = connect(sd, (SOCKADDR *)&addr, sizeof(addr)) ; - os_dly_wait(50); - } while(ret == SCK_EWOULDBLOCK) ; - #ifdef DEBUG_CYASSL - { - char msg[50] ; - sprintf(msg, "BSD Connect return code: %d\n", ret) ; - CYASSL_MSG(msg) ; - } - #endif - - #endif /* CYASSL_KEIL_TCP_NET */ - return(ret ) ; -} - - -int Cyassl_accept(int sd, struct sockaddr *addr, int *addrlen) -{ - int ret = 0 ; - - #if defined(CYASSL_KEIL_TCP_NET) - while(1) { - #undef accept /* Go to KEIL TCPnet accept */ - ret = accept(sd, addr, addrlen) ; - if(ret != SCK_EWOULDBLOCK) break ; - os_dly_wait(1); - } - #ifdef DEBUG_CYASSL - { - char msg[50] ; - sprintf(msg, "BSD Accept return code: %d\n", ret) ; - CYASSL_MSG(msg) ; - } - #endif - - #endif /* CYASSL_KEIL_TCP_NET */ - return(ret ) ; - -} - -int Cyassl_recv(int sd, void *buf, size_t len, int flags) -{ - int ret = 0; - #if defined(CYASSL_KEIL_TCP_NET) - while(1) { - #undef recv /* Go to KEIL TCPnet recv */ - ret = recv(sd, buf, len, flags) ; - if((ret != SCK_EWOULDBLOCK) &&( ret != SCK_ETIMEOUT)) break ; - os_dly_wait(1); - } - #ifdef DEBUG_CYASSL - { - char msg[50] ; - sprintf(msg, "BSD Recv return code: %d\n", ret) ; - CYASSL_MSG(msg) ; - } - #endif - - #endif /* CYASSL_KEIL_TCP_NET */ - return(ret ) ; -} - -int Cyassl_send(int sd, const void *buf, size_t len, int flags) -{ - int ret = 0 ; - - #if defined(CYASSL_KEIL_TCP_NET) - while(1) { - #undef send /* Go to KEIL TCPnet send */ - ret = send(sd, buf, len, flags) ; - if(ret != SCK_EWOULDBLOCK) break ; - os_dly_wait(1); - } - #ifdef DEBUG_CYASSL - { - char msg[50] ; - sprintf(msg, "BSD Send return code: %d\n", ret) ; - CYASSL_MSG(msg) ; - } - #endif - -#endif /* CYASSL_KEIL_TCP_NET */ - return(ret) ; - -} - -#endif /* CYASSL_KEIL_TCP_NET */ - -#if defined(CYASSL_KEIL_TCP_NET) -void Cyassl_sleep(int t) -{ - #if defined(HAVE_KEIL_RTX) - os_dly_wait(t/1000+1) ; - #endif -} - -int Cyassl_tcp_select(int sd, int timeout) -{ - - return 0 ; - -} -#endif - -extern int strlen(const char *s) ; - -FILE * CyaSSL_fopen(const char *name, const char *openmode) -{ - int i ; FILE * ret ; - #define PATHSIZE 100 - char path[PATHSIZE] ; char *p ; - - if(strlen(name) > PATHSIZE)return(NULL) ; - - for(i = 0; i<= strlen(name); i++) { - if(name[i] == '/')path[i] = '\\' ; - else path[i] = name[i] ; - } - if(path[0] == '.' && path[1] == '\\') p = path + 2 ; - else p = path ; - - ret = fopen (p, openmode) ; - - return(ret) ; -} - -#if defined (CYASSL_MDK5) -#define getkey getchar -#define sendchar putchar -#else -extern int getkey(void) ; -extern int sendchar(int c) ; -#endif - -char * Cyassl_fgets ( char * str, int num, FILE * f ) -{ - int i ; - - for(i = 0 ; i< num ; i++) { - while((str[i] = getkey()) == 0) { - #if defined (HAVE_KEIL_RTX) && !defined(CYASSL_CMSIS_RTOS) - os_tsk_pass (); - #else - osThreadYield (); - #endif - } - if(str[i] == '\n' || str[i] == '\012' || str[i] == '\015') { - sendchar('\n') ; - str[i++] = '\n' ; - str[i] = '\0' ; - break ; - } else if(str[i] == '\010') { /* BS */ - if(i) { /* erace one char */ - sendchar('\010') ; sendchar(' ') ; sendchar('\010') ; - i = (i>0 ? (i-2) : -1 ) ; - continue ; - } - } else if(str[i] == '\033' || str[i] == '\004' ) { /* ESC or ^D */ - str[i] = '\0' ; - return(0) ; - } - sendchar(str[i]) ; - } - return(str) ; -} diff --git a/IDE/iOS/README.md b/IDE/iOS/README.md index f4525176c..b2bfae757 100644 --- a/IDE/iOS/README.md +++ b/IDE/iOS/README.md @@ -1,14 +1,35 @@ -# wolfSSL and wolfCrypt iOS Xcode Projects +# wolfSSL and wolfCrypt Xcode Projects for OS X and iOS -This directory contains two xcodeproj: +This directory contains the following files: -1. `wolfssl.xcodeproj` -- builds wolfSSL and wolfCrypt -2. `wolfssl-FIPS.xcodeproj` -- builds wolfSSL and wolfCrypt-FIPS if available +1. `wolfssl.xcworkspace` -- workspace with library and testsuite client +2. `wolfssl_testsuite.xcodeproj` -- project to run the testsuite. +3. `wolfssl.xcodeproj` -- project to build OS/x and iOS libraries for wolfSSL and/or wolfCrypt +4. `wolfssl-FIPS.xcodeproj` -- project to build wolfSSL and wolfCrypt-FIPS if available +5. `user_settings.h` -- custom library settings, which are shared across projects -Both projects will build the library `libwolfssl.a` and produce a directory -named `include` with the wolfSSL and wolfCrypt headers, and the CyaSSL and -CtaoCrypt compatibility headers. Specific build options may be added to the -`IPHONE` section of the file `wolfssl/wolfcrypt/settings.h`. +The library will output as `libwolfssl_osx.a` or 'libwolfssl_ios.a` depending on +the target. It will also copy the wolfSSL/wolfCrypt (and the CyaSSL/CtaoCrypt +compatibility) headers into an `include` directory located in +`Build/Products/Debug` or `Build/Products/Release`. + +For the library and testsuite to link properly the build location needs to be +configured as realitive to workspace. +1. File -> Workspace Settings (or Xcode -> Preferences -> Locations -> Locations) +2. Derived Data -> Advanced +3. Custom -> Relative to Workspace +4. Products -> Build/Products + +These Xcode projects define the `WOLFSSL_USER_SETTINGS` preprocessor +to enable the `user_settings.h` file for setting macros across +multiple projects. + +If needed the Xcode preprocessors can be modifed with these steps: +1. Click on the Project in "Project Navigator". +2. Click on the "Build Settings" tab. +3. Scroll down to the "Apple LLVM 6.0 - Preprocessing" section. +4. Open the disclosure for "Preprocessor Macros" and use the "+" and +"-" buttons to modify. Remember to do this for both Debug and Release. ## wolfSSL @@ -35,7 +56,7 @@ You can make an archive for a device, as well. That is a release build. # Installing libwolfssl.a -Simply drag the file libwolfssl.a and the directory `include` and drop it into +Simply drag the file libwolfssl_XXX_.a and the directory `include` and drop it into your project file list pane where it makes sense for you. Allow it to copy the files over to the project directory. This should automatically add the library to the list of libraries to link against. @@ -52,10 +73,7 @@ Add the path to the include directory to the list "Header Search Paths". ## When using FIPS -When using the FIPS version, on the target window, in the "Build Settings" tab, -scroll down to the "Apple LLVM 6.0 - Preprocessing" section. Open the disclosure -for "Preprocessor Macros" and add the following under both `Release` and -`Debug`: +When using the FIPS version the following preprocessors need to be defined: * `IPHONE` * `HAVE_FIPS` diff --git a/IDE/iOS/include.am b/IDE/iOS/include.am index 504b4d19c..10c1b403f 100644 --- a/IDE/iOS/include.am +++ b/IDE/iOS/include.am @@ -5,3 +5,6 @@ EXTRA_DIST+= IDE/iOS/README.md EXTRA_DIST+= IDE/iOS/wolfssl-FIPS.xcodeproj/project.pbxproj EXTRA_DIST+= IDE/iOS/wolfssl.xcodeproj/project.pbxproj +EXTRA_DIST+= IDE/iOS/wolfssl.xcworkspace +EXTRA_DIST+= IDE/iOS/wolfssl_testsuite.xcodeproj +EXTRA_DIST+= IDE/iOS/user_settings.h diff --git a/IDE/iOS/user_settings.h b/IDE/iOS/user_settings.h new file mode 100644 index 000000000..627188c81 --- /dev/null +++ b/IDE/iOS/user_settings.h @@ -0,0 +1,16 @@ +/* Configuration */ +#define IPHONE /* Needed for Xcode */ +#define HAVE_HASHDRBG +#define HAVE_AESGCM +#define WOLFSSL_SHA512 +#define WOLFSSL_SHA384 + +#ifdef HAVE_FIPS +#define NO_MD4 +#define NO_HC128 +#define NO_RABBIT +#define NO_DSA +#define NO_PWDBASED +#else +#define USE_FAST_MATH +#endif diff --git a/IDE/iOS/wolfssl-FIPS.xcodeproj/project.pbxproj b/IDE/iOS/wolfssl-FIPS.xcodeproj/project.pbxproj index e2ae6f02b..325443d41 100644 --- a/IDE/iOS/wolfssl-FIPS.xcodeproj/project.pbxproj +++ b/IDE/iOS/wolfssl-FIPS.xcodeproj/project.pbxproj @@ -169,6 +169,168 @@ 522DBE131B792A190031F454 /* wc_encrypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 522DBE121B7929E70031F454 /* wc_encrypt.h */; }; 525BE5BA1B38853E0054BBCD /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 525BE5B91B38853E0054BBCD /* hash.c */; }; 525BE5BC1B3885750054BBCD /* hash.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 525BE5BB1B3885580054BBCD /* hash.h */; }; + A4A54DF71BC5C3E0002866CD /* wolfcrypt_first.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216481B1A8AC2990062516A /* wolfcrypt_first.c */; }; + A4A54DF81BC5C3E0002866CD /* hmac.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648141A8AC2990062516A /* hmac.c */; }; + A4A54DF91BC5C3E0002866CD /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648161A8AC2990062516A /* random.c */; }; + A4A54DFA1BC5C3E0002866CD /* sha256.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648191A8AC2990062516A /* sha256.c */; }; + A4A54DFB1BC5C3E0002866CD /* rsa.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648171A8AC2990062516A /* rsa.c */; }; + A4A54DFC1BC5C3E0002866CD /* aes.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648101A8AC2990062516A /* aes.c */; }; + A4A54DFD1BC5C3E0002866CD /* des3.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648111A8AC2990062516A /* des3.c */; }; + A4A54DFE1BC5C3E0002866CD /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 525BE5B91B38853E0054BBCD /* hash.c */; }; + A4A54DFF1BC5C3E0002866CD /* sha.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648181A8AC2990062516A /* sha.c */; }; + A4A54E001BC5C3E0002866CD /* sha512.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216481A1A8AC2990062516A /* sha512.c */; }; + A4A54E011BC5C3E0002866CD /* fips.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648131A8AC2990062516A /* fips.c */; }; + A4A54E021BC5C3E0002866CD /* fips_test.c in Sources */ = {isa = PBXBuildFile; fileRef = 521648121A8AC2990062516A /* fips_test.c */; }; + A4A54E031BC5C3E0002866CD /* wolfcrypt_last.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216481C1A8AC2990062516A /* wolfcrypt_last.c */; }; + A4A54E041BC5C3E0002866CD /* dsa.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461A1A8992CC0062516A /* dsa.c */; }; + A4A54E051BC5C3E0002866CD /* logging.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646201A8992CC0062516A /* logging.c */; }; + A4A54E061BC5C3E0002866CD /* sha.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462D1A8992CC0062516A /* sha.c */; }; + A4A54E071BC5C3E0002866CD /* poly1305.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646271A8992CC0062516A /* poly1305.c */; }; + A4A54E081BC5C3E0002866CD /* dh.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646191A8992CC0062516A /* dh.c */; }; + A4A54E091BC5C3E0002866CD /* camellia.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646151A8992CC0062516A /* camellia.c */; }; + A4A54E0A1BC5C3E0002866CD /* wc_port.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646311A8992CC0062516A /* wc_port.c */; }; + A4A54E0B1BC5C3E0002866CD /* pwdbased.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646281A8992CC0062516A /* pwdbased.c */; }; + A4A54E0C1BC5C3E0002866CD /* misc.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646251A8992CC0062516A /* misc.c */; }; + A4A54E0D1BC5C3E0002866CD /* hc128.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461D1A8992CC0062516A /* hc128.c */; }; + A4A54E0E1BC5C3E0002866CD /* asn.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646131A8992CC0062516A /* asn.c */; }; + A4A54E0F1BC5C3E0002866CD /* sha512.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462F1A8992CC0062516A /* sha512.c */; }; + A4A54E101BC5C3E0002866CD /* rabbit.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646291A8992CC0062516A /* rabbit.c */; }; + A4A54E111BC5C3E0002866CD /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646231A8992CC0062516A /* md5.c */; }; + A4A54E121BC5C3E0002866CD /* ssl.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646071A89928E0062516A /* ssl.c */; }; + A4A54E131BC5C3E0002866CD /* rsa.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462C1A8992CC0062516A /* rsa.c */; }; + A4A54E141BC5C3E0002866CD /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462A1A8992CC0062516A /* random.c */; }; + A4A54E151BC5C3E0002866CD /* tls.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646081A89928E0062516A /* tls.c */; }; + A4A54E161BC5C3E0002866CD /* ocsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646051A89928E0062516A /* ocsp.c */; }; + A4A54E171BC5C3E0002866CD /* md4.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646221A8992CC0062516A /* md4.c */; }; + A4A54E181BC5C3E0002866CD /* aes.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646111A8992CC0062516A /* aes.c */; }; + A4A54E191BC5C3E0002866CD /* des3.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646181A8992CC0062516A /* des3.c */; }; + A4A54E1A1BC5C3E0002866CD /* blake2b.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646141A8992CC0062516A /* blake2b.c */; }; + A4A54E1B1BC5C3E0002866CD /* ripemd.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462B1A8992CC0062516A /* ripemd.c */; }; + A4A54E1C1BC5C3E0002866CD /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646241A8992CC0062516A /* memory.c */; }; + A4A54E1D1BC5C3E0002866CD /* wc_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 522DBE101B7929C80031F454 /* wc_encrypt.c */; }; + A4A54E1E1BC5C3E0002866CD /* ecc.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461B1A8992CC0062516A /* ecc.c */; }; + A4A54E1F1BC5C3E0002866CD /* sha256.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462E1A8992CC0062516A /* sha256.c */; }; + A4A54E201BC5C3E0002866CD /* chacha.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646161A8992CC0062516A /* chacha.c */; }; + A4A54E211BC5C3E0002866CD /* pkcs7.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646261A8992CC0062516A /* pkcs7.c */; }; + A4A54E221BC5C3E0002866CD /* sniffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646061A89928E0062516A /* sniffer.c */; }; + A4A54E231BC5C3E0002866CD /* md2.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646211A8992CC0062516A /* md2.c */; }; + A4A54E241BC5C3E0002866CD /* coding.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646171A8992CC0062516A /* coding.c */; }; + A4A54E251BC5C3E0002866CD /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461C1A8992CC0062516A /* error.c */; }; + A4A54E261BC5C3E0002866CD /* hmac.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461E1A8992CC0062516A /* hmac.c */; }; + A4A54E271BC5C3E0002866CD /* arc4.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646121A8992CC0062516A /* arc4.c */; }; + A4A54E281BC5C3E0002866CD /* integer.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461F1A8992CC0062516A /* integer.c */; }; + A4A54E291BC5C3E0002866CD /* internal.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646021A89928E0062516A /* internal.c */; }; + A4A54E2A1BC5C3E0002866CD /* io.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646031A89928E0062516A /* io.c */; }; + A4A54E2B1BC5C3E0002866CD /* tfm.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646301A8992CC0062516A /* tfm.c */; }; + A4A54E2C1BC5C3E0002866CD /* crl.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646011A89928E0062516A /* crl.c */; }; + A4A54E2D1BC5C3E0002866CD /* keys.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646041A89928E0062516A /* keys.c */; }; + A4A54E301BC5C3E0002866CD /* callbacks.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646531A8993290062516A /* callbacks.h */; }; + A4A54E311BC5C3E0002866CD /* certs_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646541A8993290062516A /* certs_test.h */; }; + A4A54E321BC5C3E0002866CD /* crl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646551A8993290062516A /* crl.h */; }; + A4A54E331BC5C3E0002866CD /* error-ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646561A8993290062516A /* error-ssl.h */; }; + A4A54E341BC5C3E0002866CD /* internal.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646571A8993290062516A /* internal.h */; }; + A4A54E351BC5C3E0002866CD /* ocsp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646581A8993290062516A /* ocsp.h */; }; + A4A54E361BC5C3E0002866CD /* ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465B1A8993290062516A /* ssl.h */; }; + A4A54E371BC5C3E0002866CD /* test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465C1A8993290062516A /* test.h */; }; + A4A54E381BC5C3E0002866CD /* version.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465D1A8993290062516A /* version.h */; }; + A4A54E3A1BC5C3E0002866CD /* wc_encrypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 522DBE121B7929E70031F454 /* wc_encrypt.h */; }; + A4A54E3B1BC5C3E0002866CD /* hash.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 525BE5BB1B3885580054BBCD /* hash.h */; }; + A4A54E3C1BC5C3E0002866CD /* aes.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465E1A8993770062516A /* aes.h */; }; + A4A54E3D1BC5C3E0002866CD /* arc4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465F1A8993770062516A /* arc4.h */; }; + A4A54E3E1BC5C3E0002866CD /* asn_public.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646601A8993770062516A /* asn_public.h */; }; + A4A54E3F1BC5C3E0002866CD /* asn.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646611A8993770062516A /* asn.h */; }; + A4A54E401BC5C3E0002866CD /* blake2-impl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646621A8993770062516A /* blake2-impl.h */; }; + A4A54E411BC5C3E0002866CD /* blake2-int.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646631A8993770062516A /* blake2-int.h */; }; + A4A54E421BC5C3E0002866CD /* blake2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646641A8993770062516A /* blake2.h */; }; + A4A54E431BC5C3E0002866CD /* camellia.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646651A8993770062516A /* camellia.h */; }; + A4A54E441BC5C3E0002866CD /* chacha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646661A8993770062516A /* chacha.h */; }; + A4A54E451BC5C3E0002866CD /* coding.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646671A8993770062516A /* coding.h */; }; + A4A54E461BC5C3E0002866CD /* compress.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646681A8993770062516A /* compress.h */; }; + A4A54E471BC5C3E0002866CD /* des3.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646691A8993770062516A /* des3.h */; }; + A4A54E481BC5C3E0002866CD /* dh.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466A1A8993770062516A /* dh.h */; }; + A4A54E491BC5C3E0002866CD /* dsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466B1A8993770062516A /* dsa.h */; }; + A4A54E4A1BC5C3E0002866CD /* ecc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466C1A8993770062516A /* ecc.h */; }; + A4A54E4B1BC5C3E0002866CD /* error-crypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466D1A8993770062516A /* error-crypt.h */; }; + A4A54E4C1BC5C3E0002866CD /* fips_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466E1A8993770062516A /* fips_test.h */; }; + A4A54E4D1BC5C3E0002866CD /* hc128.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466F1A8993770062516A /* hc128.h */; }; + A4A54E4E1BC5C3E0002866CD /* hmac.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646701A8993770062516A /* hmac.h */; }; + A4A54E4F1BC5C3E0002866CD /* integer.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646721A8993770062516A /* integer.h */; }; + A4A54E501BC5C3E0002866CD /* logging.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646731A8993770062516A /* logging.h */; }; + A4A54E511BC5C3E0002866CD /* md2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646741A8993770062516A /* md2.h */; }; + A4A54E521BC5C3E0002866CD /* md4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646751A8993770062516A /* md4.h */; }; + A4A54E531BC5C3E0002866CD /* md5.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646761A8993770062516A /* md5.h */; }; + A4A54E541BC5C3E0002866CD /* memory.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646771A8993770062516A /* memory.h */; }; + A4A54E551BC5C3E0002866CD /* misc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646781A8993770062516A /* misc.h */; }; + A4A54E561BC5C3E0002866CD /* mpi_class.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646791A8993770062516A /* mpi_class.h */; }; + A4A54E571BC5C3E0002866CD /* mpi_superclass.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467A1A8993770062516A /* mpi_superclass.h */; }; + A4A54E581BC5C3E0002866CD /* pkcs7.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467B1A8993770062516A /* pkcs7.h */; }; + A4A54E591BC5C3E0002866CD /* poly1305.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467C1A8993770062516A /* poly1305.h */; }; + A4A54E5A1BC5C3E0002866CD /* pwdbased.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467D1A8993770062516A /* pwdbased.h */; }; + A4A54E5B1BC5C3E0002866CD /* rabbit.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467E1A8993770062516A /* rabbit.h */; }; + A4A54E5C1BC5C3E0002866CD /* random.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467F1A8993770062516A /* random.h */; }; + A4A54E5D1BC5C3E0002866CD /* ripemd.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646801A8993770062516A /* ripemd.h */; }; + A4A54E5E1BC5C3E0002866CD /* rsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646811A8993770062516A /* rsa.h */; }; + A4A54E5F1BC5C3E0002866CD /* settings.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646821A8993770062516A /* settings.h */; }; + A4A54E601BC5C3E0002866CD /* sha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646831A8993770062516A /* sha.h */; }; + A4A54E611BC5C3E0002866CD /* sha256.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646841A8993770062516A /* sha256.h */; }; + A4A54E621BC5C3E0002866CD /* sha512.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646851A8993770062516A /* sha512.h */; }; + A4A54E631BC5C3E0002866CD /* tfm.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646861A8993770062516A /* tfm.h */; }; + A4A54E641BC5C3E0002866CD /* types.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646871A8993770062516A /* types.h */; }; + A4A54E651BC5C3E0002866CD /* visibility.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646881A8993770062516A /* visibility.h */; }; + A4A54E661BC5C3E0002866CD /* wc_port.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646891A8993770062516A /* wc_port.h */; }; + A4A54E681BC5C3E0002866CD /* callbacks.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468A1A8993BB0062516A /* callbacks.h */; }; + A4A54E691BC5C3E0002866CD /* certs_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468B1A8993BB0062516A /* certs_test.h */; }; + A4A54E6A1BC5C3E0002866CD /* crl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468C1A8993BB0062516A /* crl.h */; }; + A4A54E6B1BC5C3E0002866CD /* error-ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468D1A8993BB0062516A /* error-ssl.h */; }; + A4A54E6C1BC5C3E0002866CD /* internal.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468E1A8993BB0062516A /* internal.h */; }; + A4A54E6D1BC5C3E0002866CD /* ocsp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468F1A8993BB0062516A /* ocsp.h */; }; + A4A54E6E1BC5C3E0002866CD /* ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646921A8993BB0062516A /* ssl.h */; }; + A4A54E6F1BC5C3E0002866CD /* test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646931A8993BB0062516A /* test.h */; }; + A4A54E701BC5C3E0002866CD /* version.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646941A8993BB0062516A /* version.h */; }; + A4A54E721BC5C3E0002866CD /* aes.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646951A8993F50062516A /* aes.h */; }; + A4A54E731BC5C3E0002866CD /* arc4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646961A8993F50062516A /* arc4.h */; }; + A4A54E741BC5C3E0002866CD /* asn_public.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646971A8993F50062516A /* asn_public.h */; }; + A4A54E751BC5C3E0002866CD /* asn.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646981A8993F50062516A /* asn.h */; }; + A4A54E761BC5C3E0002866CD /* blake2-impl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646991A8993F50062516A /* blake2-impl.h */; }; + A4A54E771BC5C3E0002866CD /* blake2-int.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469A1A8993F50062516A /* blake2-int.h */; }; + A4A54E781BC5C3E0002866CD /* blake2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469B1A8993F50062516A /* blake2.h */; }; + A4A54E791BC5C3E0002866CD /* camellia.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469C1A8993F50062516A /* camellia.h */; }; + A4A54E7A1BC5C3E0002866CD /* chacha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469D1A8993F50062516A /* chacha.h */; }; + A4A54E7B1BC5C3E0002866CD /* coding.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469E1A8993F50062516A /* coding.h */; }; + A4A54E7C1BC5C3E0002866CD /* compress.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469F1A8993F50062516A /* compress.h */; }; + A4A54E7D1BC5C3E0002866CD /* des3.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A01A8993F50062516A /* des3.h */; }; + A4A54E7E1BC5C3E0002866CD /* dh.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A11A8993F50062516A /* dh.h */; }; + A4A54E7F1BC5C3E0002866CD /* dsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A21A8993F50062516A /* dsa.h */; }; + A4A54E801BC5C3E0002866CD /* ecc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A31A8993F50062516A /* ecc.h */; }; + A4A54E811BC5C3E0002866CD /* error-crypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A41A8993F50062516A /* error-crypt.h */; }; + A4A54E821BC5C3E0002866CD /* fips_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A51A8993F50062516A /* fips_test.h */; }; + A4A54E831BC5C3E0002866CD /* hc128.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A61A8993F50062516A /* hc128.h */; }; + A4A54E841BC5C3E0002866CD /* hmac.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A71A8993F50062516A /* hmac.h */; }; + A4A54E851BC5C3E0002866CD /* integer.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A81A8993F50062516A /* integer.h */; }; + A4A54E861BC5C3E0002866CD /* logging.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A91A8993F50062516A /* logging.h */; }; + A4A54E871BC5C3E0002866CD /* md2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AA1A8993F50062516A /* md2.h */; }; + A4A54E881BC5C3E0002866CD /* md4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AB1A8993F50062516A /* md4.h */; }; + A4A54E891BC5C3E0002866CD /* md5.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AC1A8993F50062516A /* md5.h */; }; + A4A54E8A1BC5C3E0002866CD /* memory.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AD1A8993F50062516A /* memory.h */; }; + A4A54E8B1BC5C3E0002866CD /* misc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AE1A8993F50062516A /* misc.h */; }; + A4A54E8C1BC5C3E0002866CD /* mpi_class.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AF1A8993F50062516A /* mpi_class.h */; }; + A4A54E8D1BC5C3E0002866CD /* mpi_superclass.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B01A8993F50062516A /* mpi_superclass.h */; }; + A4A54E8E1BC5C3E0002866CD /* pkcs7.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B11A8993F50062516A /* pkcs7.h */; }; + A4A54E8F1BC5C3E0002866CD /* poly1305.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B21A8993F50062516A /* poly1305.h */; }; + A4A54E901BC5C3E0002866CD /* pwdbased.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B31A8993F50062516A /* pwdbased.h */; }; + A4A54E911BC5C3E0002866CD /* rabbit.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B41A8993F50062516A /* rabbit.h */; }; + A4A54E921BC5C3E0002866CD /* random.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B51A8993F50062516A /* random.h */; }; + A4A54E931BC5C3E0002866CD /* ripemd.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B61A8993F50062516A /* ripemd.h */; }; + A4A54E941BC5C3E0002866CD /* rsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B71A8993F50062516A /* rsa.h */; }; + A4A54E951BC5C3E0002866CD /* settings_comp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B81A8993F50062516A /* settings_comp.h */; }; + A4A54E961BC5C3E0002866CD /* settings.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B91A8993F50062516A /* settings.h */; }; + A4A54E971BC5C3E0002866CD /* sha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BA1A8993F50062516A /* sha.h */; }; + A4A54E981BC5C3E0002866CD /* sha256.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BB1A8993F50062516A /* sha256.h */; }; + A4A54E991BC5C3E0002866CD /* sha512.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BC1A8993F50062516A /* sha512.h */; }; + A4A54E9A1BC5C3E0002866CD /* tfm.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BD1A8993F50062516A /* tfm.h */; }; + A4A54E9B1BC5C3E0002866CD /* types.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BE1A8993F50062516A /* types.h */; }; + A4A54E9C1BC5C3E0002866CD /* visibility.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BF1A8993F50062516A /* visibility.h */; }; + A4A54E9D1BC5C3E0002866CD /* wc_port.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646C01A8993F50062516A /* wc_port.h */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -315,6 +477,149 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + A4A54E2F1BC5C3E0002866CD /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = include/wolfssl; + dstSubfolderSpec = 7; + files = ( + A4A54E301BC5C3E0002866CD /* callbacks.h in CopyFiles */, + A4A54E311BC5C3E0002866CD /* certs_test.h in CopyFiles */, + A4A54E321BC5C3E0002866CD /* crl.h in CopyFiles */, + A4A54E331BC5C3E0002866CD /* error-ssl.h in CopyFiles */, + A4A54E341BC5C3E0002866CD /* internal.h in CopyFiles */, + A4A54E351BC5C3E0002866CD /* ocsp.h in CopyFiles */, + A4A54E361BC5C3E0002866CD /* ssl.h in CopyFiles */, + A4A54E371BC5C3E0002866CD /* test.h in CopyFiles */, + A4A54E381BC5C3E0002866CD /* version.h in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A4A54E391BC5C3E0002866CD /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = include/wolfssl/wolfcrypt; + dstSubfolderSpec = 7; + files = ( + A4A54E3A1BC5C3E0002866CD /* wc_encrypt.h in CopyFiles */, + A4A54E3B1BC5C3E0002866CD /* hash.h in CopyFiles */, + A4A54E3C1BC5C3E0002866CD /* aes.h in CopyFiles */, + A4A54E3D1BC5C3E0002866CD /* arc4.h in CopyFiles */, + A4A54E3E1BC5C3E0002866CD /* asn_public.h in CopyFiles */, + A4A54E3F1BC5C3E0002866CD /* asn.h in CopyFiles */, + A4A54E401BC5C3E0002866CD /* blake2-impl.h in CopyFiles */, + A4A54E411BC5C3E0002866CD /* blake2-int.h in CopyFiles */, + A4A54E421BC5C3E0002866CD /* blake2.h in CopyFiles */, + A4A54E431BC5C3E0002866CD /* camellia.h in CopyFiles */, + A4A54E441BC5C3E0002866CD /* chacha.h in CopyFiles */, + A4A54E451BC5C3E0002866CD /* coding.h in CopyFiles */, + A4A54E461BC5C3E0002866CD /* compress.h in CopyFiles */, + A4A54E471BC5C3E0002866CD /* des3.h in CopyFiles */, + A4A54E481BC5C3E0002866CD /* dh.h in CopyFiles */, + A4A54E491BC5C3E0002866CD /* dsa.h in CopyFiles */, + A4A54E4A1BC5C3E0002866CD /* ecc.h in CopyFiles */, + A4A54E4B1BC5C3E0002866CD /* error-crypt.h in CopyFiles */, + A4A54E4C1BC5C3E0002866CD /* fips_test.h in CopyFiles */, + A4A54E4D1BC5C3E0002866CD /* hc128.h in CopyFiles */, + A4A54E4E1BC5C3E0002866CD /* hmac.h in CopyFiles */, + A4A54E4F1BC5C3E0002866CD /* integer.h in CopyFiles */, + A4A54E501BC5C3E0002866CD /* logging.h in CopyFiles */, + A4A54E511BC5C3E0002866CD /* md2.h in CopyFiles */, + A4A54E521BC5C3E0002866CD /* md4.h in CopyFiles */, + A4A54E531BC5C3E0002866CD /* md5.h in CopyFiles */, + A4A54E541BC5C3E0002866CD /* memory.h in CopyFiles */, + A4A54E551BC5C3E0002866CD /* misc.h in CopyFiles */, + A4A54E561BC5C3E0002866CD /* mpi_class.h in CopyFiles */, + A4A54E571BC5C3E0002866CD /* mpi_superclass.h in CopyFiles */, + A4A54E581BC5C3E0002866CD /* pkcs7.h in CopyFiles */, + A4A54E591BC5C3E0002866CD /* poly1305.h in CopyFiles */, + A4A54E5A1BC5C3E0002866CD /* pwdbased.h in CopyFiles */, + A4A54E5B1BC5C3E0002866CD /* rabbit.h in CopyFiles */, + A4A54E5C1BC5C3E0002866CD /* random.h in CopyFiles */, + A4A54E5D1BC5C3E0002866CD /* ripemd.h in CopyFiles */, + A4A54E5E1BC5C3E0002866CD /* rsa.h in CopyFiles */, + A4A54E5F1BC5C3E0002866CD /* settings.h in CopyFiles */, + A4A54E601BC5C3E0002866CD /* sha.h in CopyFiles */, + A4A54E611BC5C3E0002866CD /* sha256.h in CopyFiles */, + A4A54E621BC5C3E0002866CD /* sha512.h in CopyFiles */, + A4A54E631BC5C3E0002866CD /* tfm.h in CopyFiles */, + A4A54E641BC5C3E0002866CD /* types.h in CopyFiles */, + A4A54E651BC5C3E0002866CD /* visibility.h in CopyFiles */, + A4A54E661BC5C3E0002866CD /* wc_port.h in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A4A54E671BC5C3E0002866CD /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = include/cyassl; + dstSubfolderSpec = 7; + files = ( + A4A54E681BC5C3E0002866CD /* callbacks.h in CopyFiles */, + A4A54E691BC5C3E0002866CD /* certs_test.h in CopyFiles */, + A4A54E6A1BC5C3E0002866CD /* crl.h in CopyFiles */, + A4A54E6B1BC5C3E0002866CD /* error-ssl.h in CopyFiles */, + A4A54E6C1BC5C3E0002866CD /* internal.h in CopyFiles */, + A4A54E6D1BC5C3E0002866CD /* ocsp.h in CopyFiles */, + A4A54E6E1BC5C3E0002866CD /* ssl.h in CopyFiles */, + A4A54E6F1BC5C3E0002866CD /* test.h in CopyFiles */, + A4A54E701BC5C3E0002866CD /* version.h in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A4A54E711BC5C3E0002866CD /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = include/cyassl/ctaocrypt; + dstSubfolderSpec = 7; + files = ( + A4A54E721BC5C3E0002866CD /* aes.h in CopyFiles */, + A4A54E731BC5C3E0002866CD /* arc4.h in CopyFiles */, + A4A54E741BC5C3E0002866CD /* asn_public.h in CopyFiles */, + A4A54E751BC5C3E0002866CD /* asn.h in CopyFiles */, + A4A54E761BC5C3E0002866CD /* blake2-impl.h in CopyFiles */, + A4A54E771BC5C3E0002866CD /* blake2-int.h in CopyFiles */, + A4A54E781BC5C3E0002866CD /* blake2.h in CopyFiles */, + A4A54E791BC5C3E0002866CD /* camellia.h in CopyFiles */, + A4A54E7A1BC5C3E0002866CD /* chacha.h in CopyFiles */, + A4A54E7B1BC5C3E0002866CD /* coding.h in CopyFiles */, + A4A54E7C1BC5C3E0002866CD /* compress.h in CopyFiles */, + A4A54E7D1BC5C3E0002866CD /* des3.h in CopyFiles */, + A4A54E7E1BC5C3E0002866CD /* dh.h in CopyFiles */, + A4A54E7F1BC5C3E0002866CD /* dsa.h in CopyFiles */, + A4A54E801BC5C3E0002866CD /* ecc.h in CopyFiles */, + A4A54E811BC5C3E0002866CD /* error-crypt.h in CopyFiles */, + A4A54E821BC5C3E0002866CD /* fips_test.h in CopyFiles */, + A4A54E831BC5C3E0002866CD /* hc128.h in CopyFiles */, + A4A54E841BC5C3E0002866CD /* hmac.h in CopyFiles */, + A4A54E851BC5C3E0002866CD /* integer.h in CopyFiles */, + A4A54E861BC5C3E0002866CD /* logging.h in CopyFiles */, + A4A54E871BC5C3E0002866CD /* md2.h in CopyFiles */, + A4A54E881BC5C3E0002866CD /* md4.h in CopyFiles */, + A4A54E891BC5C3E0002866CD /* md5.h in CopyFiles */, + A4A54E8A1BC5C3E0002866CD /* memory.h in CopyFiles */, + A4A54E8B1BC5C3E0002866CD /* misc.h in CopyFiles */, + A4A54E8C1BC5C3E0002866CD /* mpi_class.h in CopyFiles */, + A4A54E8D1BC5C3E0002866CD /* mpi_superclass.h in CopyFiles */, + A4A54E8E1BC5C3E0002866CD /* pkcs7.h in CopyFiles */, + A4A54E8F1BC5C3E0002866CD /* poly1305.h in CopyFiles */, + A4A54E901BC5C3E0002866CD /* pwdbased.h in CopyFiles */, + A4A54E911BC5C3E0002866CD /* rabbit.h in CopyFiles */, + A4A54E921BC5C3E0002866CD /* random.h in CopyFiles */, + A4A54E931BC5C3E0002866CD /* ripemd.h in CopyFiles */, + A4A54E941BC5C3E0002866CD /* rsa.h in CopyFiles */, + A4A54E951BC5C3E0002866CD /* settings_comp.h in CopyFiles */, + A4A54E961BC5C3E0002866CD /* settings.h in CopyFiles */, + A4A54E971BC5C3E0002866CD /* sha.h in CopyFiles */, + A4A54E981BC5C3E0002866CD /* sha256.h in CopyFiles */, + A4A54E991BC5C3E0002866CD /* sha512.h in CopyFiles */, + A4A54E9A1BC5C3E0002866CD /* tfm.h in CopyFiles */, + A4A54E9B1BC5C3E0002866CD /* types.h in CopyFiles */, + A4A54E9C1BC5C3E0002866CD /* visibility.h in CopyFiles */, + A4A54E9D1BC5C3E0002866CD /* wc_port.h in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ @@ -480,7 +785,9 @@ 522DBE121B7929E70031F454 /* wc_encrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wc_encrypt.h; path = ../../wolfssl/wolfcrypt/wc_encrypt.h; sourceTree = ""; }; 525BE5B91B38853E0054BBCD /* hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hash.c; path = ../../wolfcrypt/src/hash.c; sourceTree = ""; }; 525BE5BB1B3885580054BBCD /* hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hash.h; path = ../../wolfssl/wolfcrypt/hash.h; sourceTree = ""; }; - 52B1344D16F3C9E800C07B32 /* libwolfssl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwolfssl.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 52B1344D16F3C9E800C07B32 /* libwolfssl_fips_ios.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwolfssl_fips_ios.a; sourceTree = BUILT_PRODUCTS_DIR; }; + A4A54DF41BC5C380002866CD /* user_settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = user_settings.h; sourceTree = ""; }; + A4A54EA11BC5C3E0002866CD /* libwolfssl_fips_osx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwolfssl_fips_osx.a; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -491,6 +798,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + A4A54E2E1BC5C3E0002866CD /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -643,6 +957,7 @@ 521645FB1A8991990062516A /* Source */ = { isa = PBXGroup; children = ( + A4A54DF41BC5C380002866CD /* user_settings.h */, 521646001A89924A0062516A /* wolfSSL */, 521645FF1A8992470062516A /* wolfCrypt */, 5216480F1A8ABDA50062516A /* CtaoCrypt */, @@ -738,7 +1053,8 @@ 52B1344E16F3C9E800C07B32 /* Products */ = { isa = PBXGroup; children = ( - 52B1344D16F3C9E800C07B32 /* libwolfssl.a */, + 52B1344D16F3C9E800C07B32 /* libwolfssl_fips_ios.a */, + A4A54EA11BC5C3E0002866CD /* libwolfssl_fips_osx.a */, ); name = Products; sourceTree = ""; @@ -746,9 +1062,9 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 52B1344C16F3C9E800C07B32 /* wolfssl */ = { + 52B1344C16F3C9E800C07B32 /* wolfssl_fips_ios */ = { isa = PBXNativeTarget; - buildConfigurationList = 52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl" */; + buildConfigurationList = 52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl_fips_ios" */; buildPhases = ( 52B1344916F3C9E800C07B32 /* Sources */, 52B1344A16F3C9E800C07B32 /* Frameworks */, @@ -761,9 +1077,29 @@ ); dependencies = ( ); - name = wolfssl; + name = wolfssl_fips_ios; productName = "wolfssl-ios"; - productReference = 52B1344D16F3C9E800C07B32 /* libwolfssl.a */; + productReference = 52B1344D16F3C9E800C07B32 /* libwolfssl_fips_ios.a */; + productType = "com.apple.product-type.library.static"; + }; + A4A54DF51BC5C3E0002866CD /* wolfssl_fips_osx */ = { + isa = PBXNativeTarget; + buildConfigurationList = A4A54E9E1BC5C3E0002866CD /* Build configuration list for PBXNativeTarget "wolfssl_fips_osx" */; + buildPhases = ( + A4A54DF61BC5C3E0002866CD /* Sources */, + A4A54E2E1BC5C3E0002866CD /* Frameworks */, + A4A54E2F1BC5C3E0002866CD /* CopyFiles */, + A4A54E391BC5C3E0002866CD /* CopyFiles */, + A4A54E671BC5C3E0002866CD /* CopyFiles */, + A4A54E711BC5C3E0002866CD /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = wolfssl_fips_osx; + productName = "wolfssl-ios"; + productReference = A4A54EA11BC5C3E0002866CD /* libwolfssl_fips_osx.a */; productType = "com.apple.product-type.library.static"; }; /* End PBXNativeTarget section */ @@ -787,7 +1123,8 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 52B1344C16F3C9E800C07B32 /* wolfssl */, + 52B1344C16F3C9E800C07B32 /* wolfssl_fips_ios */, + A4A54DF51BC5C3E0002866CD /* wolfssl_fips_osx */, ); }; /* End PBXProject section */ @@ -855,6 +1192,68 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + A4A54DF61BC5C3E0002866CD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A4A54DF71BC5C3E0002866CD /* wolfcrypt_first.c in Sources */, + A4A54DF81BC5C3E0002866CD /* hmac.c in Sources */, + A4A54DF91BC5C3E0002866CD /* random.c in Sources */, + A4A54DFA1BC5C3E0002866CD /* sha256.c in Sources */, + A4A54DFB1BC5C3E0002866CD /* rsa.c in Sources */, + A4A54DFC1BC5C3E0002866CD /* aes.c in Sources */, + A4A54DFD1BC5C3E0002866CD /* des3.c in Sources */, + A4A54DFE1BC5C3E0002866CD /* hash.c in Sources */, + A4A54DFF1BC5C3E0002866CD /* sha.c in Sources */, + A4A54E001BC5C3E0002866CD /* sha512.c in Sources */, + A4A54E011BC5C3E0002866CD /* fips.c in Sources */, + A4A54E021BC5C3E0002866CD /* fips_test.c in Sources */, + A4A54E031BC5C3E0002866CD /* wolfcrypt_last.c in Sources */, + A4A54E041BC5C3E0002866CD /* dsa.c in Sources */, + A4A54E051BC5C3E0002866CD /* logging.c in Sources */, + A4A54E061BC5C3E0002866CD /* sha.c in Sources */, + A4A54E071BC5C3E0002866CD /* poly1305.c in Sources */, + A4A54E081BC5C3E0002866CD /* dh.c in Sources */, + A4A54E091BC5C3E0002866CD /* camellia.c in Sources */, + A4A54E0A1BC5C3E0002866CD /* wc_port.c in Sources */, + A4A54E0B1BC5C3E0002866CD /* pwdbased.c in Sources */, + A4A54E0C1BC5C3E0002866CD /* misc.c in Sources */, + A4A54E0D1BC5C3E0002866CD /* hc128.c in Sources */, + A4A54E0E1BC5C3E0002866CD /* asn.c in Sources */, + A4A54E0F1BC5C3E0002866CD /* sha512.c in Sources */, + A4A54E101BC5C3E0002866CD /* rabbit.c in Sources */, + A4A54E111BC5C3E0002866CD /* md5.c in Sources */, + A4A54E121BC5C3E0002866CD /* ssl.c in Sources */, + A4A54E131BC5C3E0002866CD /* rsa.c in Sources */, + A4A54E141BC5C3E0002866CD /* random.c in Sources */, + A4A54E151BC5C3E0002866CD /* tls.c in Sources */, + A4A54E161BC5C3E0002866CD /* ocsp.c in Sources */, + A4A54E171BC5C3E0002866CD /* md4.c in Sources */, + A4A54E181BC5C3E0002866CD /* aes.c in Sources */, + A4A54E191BC5C3E0002866CD /* des3.c in Sources */, + A4A54E1A1BC5C3E0002866CD /* blake2b.c in Sources */, + A4A54E1B1BC5C3E0002866CD /* ripemd.c in Sources */, + A4A54E1C1BC5C3E0002866CD /* memory.c in Sources */, + A4A54E1D1BC5C3E0002866CD /* wc_encrypt.c in Sources */, + A4A54E1E1BC5C3E0002866CD /* ecc.c in Sources */, + A4A54E1F1BC5C3E0002866CD /* sha256.c in Sources */, + A4A54E201BC5C3E0002866CD /* chacha.c in Sources */, + A4A54E211BC5C3E0002866CD /* pkcs7.c in Sources */, + A4A54E221BC5C3E0002866CD /* sniffer.c in Sources */, + A4A54E231BC5C3E0002866CD /* md2.c in Sources */, + A4A54E241BC5C3E0002866CD /* coding.c in Sources */, + A4A54E251BC5C3E0002866CD /* error.c in Sources */, + A4A54E261BC5C3E0002866CD /* hmac.c in Sources */, + A4A54E271BC5C3E0002866CD /* arc4.c in Sources */, + A4A54E281BC5C3E0002866CD /* integer.c in Sources */, + A4A54E291BC5C3E0002866CD /* internal.c in Sources */, + A4A54E2A1BC5C3E0002866CD /* io.c in Sources */, + A4A54E2B1BC5C3E0002866CD /* tfm.c in Sources */, + A4A54E2C1BC5C3E0002866CD /* crl.c in Sources */, + A4A54E2D1BC5C3E0002866CD /* keys.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ @@ -921,17 +1320,8 @@ GCC_PREFIX_HEADER = ""; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", - IPHONE, HAVE_FIPS, - HAVE_HASHDRBG, - HAVE_AESGCM, - WOLFSSL_SHA512, - WOLFSSL_SHA384, - NO_MD4, - NO_HC128, - NO_RABBIT, - NO_DSA, - NO_PWDBASED, + WOLFSSL_USER_SETTINGS, ); HEADER_SEARCH_PATHS = ( $SRCROOT, @@ -940,7 +1330,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.1; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; - PRODUCT_NAME = wolfssl; + PRODUCT_NAME = wolfssl_fips_ios; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl"; @@ -956,17 +1346,8 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; GCC_PREPROCESSOR_DEFINITIONS = ( - IPHONE, HAVE_FIPS, - HAVE_HASHDRBG, - HAVE_AESGCM, - WOLFSSL_SHA512, - WOLFSSL_SHA384, - NO_MD4, - NO_HC128, - NO_RABBIT, - NO_DSA, - NO_PWDBASED, + WOLFSSL_USER_SETTINGS, ); HEADER_SEARCH_PATHS = ( $SRCROOT, @@ -975,7 +1356,62 @@ IPHONEOS_DEPLOYMENT_TARGET = 8.1; OTHER_CFLAGS = ""; OTHER_LDFLAGS = ""; - PRODUCT_NAME = wolfssl; + PRODUCT_NAME = wolfssl_fips_ios; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl"; + }; + name = Release; + }; + A4A54E9F1BC5C3E0002866CD /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + CLANG_LINK_OBJC_RUNTIME = NO; + DSTROOT = /tmp/wolfssl_ios.dst; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + HAVE_FIPS, + WOLFSSL_USER_SETTINGS, + ); + HEADER_SEARCH_PATHS = ( + $SRCROOT, + $PROJECT_DIR/../.., + ); + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl"; + }; + name = Debug; + }; + A4A54EA01BC5C3E0002866CD /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + CLANG_LINK_OBJC_RUNTIME = NO; + DSTROOT = /tmp/wolfssl_ios.dst; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + GCC_PREPROCESSOR_DEFINITIONS = ( + HAVE_FIPS, + WOLFSSL_USER_SETTINGS, + ); + HEADER_SEARCH_PATHS = ( + $SRCROOT, + $PROJECT_DIR/../.., + ); + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl"; @@ -994,7 +1430,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl" */ = { + 52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl_fips_ios" */ = { isa = XCConfigurationList; buildConfigurations = ( 52B1347316F3C9E800C07B32 /* Debug */, @@ -1003,6 +1439,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + A4A54E9E1BC5C3E0002866CD /* Build configuration list for PBXNativeTarget "wolfssl_fips_osx" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A4A54E9F1BC5C3E0002866CD /* Debug */, + A4A54EA01BC5C3E0002866CD /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 52B1344516F3C9E800C07B32 /* Project object */; diff --git a/IDE/iOS/wolfssl.xcodeproj/project.pbxproj b/IDE/iOS/wolfssl.xcodeproj/project.pbxproj index 9b6943fda..ab88276a0 100644 --- a/IDE/iOS/wolfssl.xcodeproj/project.pbxproj +++ b/IDE/iOS/wolfssl.xcodeproj/project.pbxproj @@ -157,6 +157,156 @@ 522DBE0F1B7927A50031F454 /* wc_encrypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 522DBE0E1B7927290031F454 /* wc_encrypt.h */; }; 525BE5341B3869110054BBCD /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 525BE5331B3869110054BBCD /* hash.c */; }; 525BE5361B3869780054BBCD /* hash.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 525BE5351B3869430054BBCD /* hash.h */; }; + A4F318501BC58B1700FDF2BB /* dsa.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461A1A8992CC0062516A /* dsa.c */; }; + A4F318511BC58B1700FDF2BB /* logging.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646201A8992CC0062516A /* logging.c */; }; + A4F318521BC58B1700FDF2BB /* sha.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462D1A8992CC0062516A /* sha.c */; }; + A4F318531BC58B1700FDF2BB /* poly1305.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646271A8992CC0062516A /* poly1305.c */; }; + A4F318541BC58B1700FDF2BB /* dh.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646191A8992CC0062516A /* dh.c */; }; + A4F318551BC58B1700FDF2BB /* camellia.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646151A8992CC0062516A /* camellia.c */; }; + A4F318561BC58B1700FDF2BB /* wc_port.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646311A8992CC0062516A /* wc_port.c */; }; + A4F318571BC58B1700FDF2BB /* pwdbased.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646281A8992CC0062516A /* pwdbased.c */; }; + A4F318581BC58B1700FDF2BB /* misc.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646251A8992CC0062516A /* misc.c */; }; + A4F318591BC58B1700FDF2BB /* hc128.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461D1A8992CC0062516A /* hc128.c */; }; + A4F3185A1BC58B1700FDF2BB /* asn.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646131A8992CC0062516A /* asn.c */; }; + A4F3185B1BC58B1700FDF2BB /* sha512.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462F1A8992CC0062516A /* sha512.c */; }; + A4F3185C1BC58B1700FDF2BB /* rabbit.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646291A8992CC0062516A /* rabbit.c */; }; + A4F3185D1BC58B1700FDF2BB /* hash.c in Sources */ = {isa = PBXBuildFile; fileRef = 525BE5331B3869110054BBCD /* hash.c */; }; + A4F3185E1BC58B1700FDF2BB /* md5.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646231A8992CC0062516A /* md5.c */; }; + A4F3185F1BC58B1700FDF2BB /* ssl.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646071A89928E0062516A /* ssl.c */; }; + A4F318601BC58B1700FDF2BB /* rsa.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462C1A8992CC0062516A /* rsa.c */; }; + A4F318611BC58B1700FDF2BB /* random.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462A1A8992CC0062516A /* random.c */; }; + A4F318621BC58B1700FDF2BB /* wc_encrypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 522DBE0C1B7926FB0031F454 /* wc_encrypt.c */; }; + A4F318631BC58B1700FDF2BB /* tls.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646081A89928E0062516A /* tls.c */; }; + A4F318641BC58B1700FDF2BB /* ocsp.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646051A89928E0062516A /* ocsp.c */; }; + A4F318651BC58B1700FDF2BB /* md4.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646221A8992CC0062516A /* md4.c */; }; + A4F318661BC58B1700FDF2BB /* aes.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646111A8992CC0062516A /* aes.c */; }; + A4F318671BC58B1700FDF2BB /* des3.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646181A8992CC0062516A /* des3.c */; }; + A4F318681BC58B1700FDF2BB /* blake2b.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646141A8992CC0062516A /* blake2b.c */; }; + A4F318691BC58B1700FDF2BB /* ripemd.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462B1A8992CC0062516A /* ripemd.c */; }; + A4F3186A1BC58B1700FDF2BB /* memory.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646241A8992CC0062516A /* memory.c */; }; + A4F3186B1BC58B1700FDF2BB /* ecc.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461B1A8992CC0062516A /* ecc.c */; }; + A4F3186C1BC58B1700FDF2BB /* sha256.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216462E1A8992CC0062516A /* sha256.c */; }; + A4F3186D1BC58B1700FDF2BB /* chacha.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646161A8992CC0062516A /* chacha.c */; }; + A4F3186E1BC58B1700FDF2BB /* pkcs7.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646261A8992CC0062516A /* pkcs7.c */; }; + A4F3186F1BC58B1700FDF2BB /* sniffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646061A89928E0062516A /* sniffer.c */; }; + A4F318701BC58B1700FDF2BB /* md2.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646211A8992CC0062516A /* md2.c */; }; + A4F318711BC58B1700FDF2BB /* coding.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646171A8992CC0062516A /* coding.c */; }; + A4F318721BC58B1700FDF2BB /* error.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461C1A8992CC0062516A /* error.c */; }; + A4F318731BC58B1700FDF2BB /* hmac.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461E1A8992CC0062516A /* hmac.c */; }; + A4F318741BC58B1700FDF2BB /* arc4.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646121A8992CC0062516A /* arc4.c */; }; + A4F318751BC58B1700FDF2BB /* integer.c in Sources */ = {isa = PBXBuildFile; fileRef = 5216461F1A8992CC0062516A /* integer.c */; }; + A4F318761BC58B1700FDF2BB /* internal.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646021A89928E0062516A /* internal.c */; }; + A4F318771BC58B1700FDF2BB /* io.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646031A89928E0062516A /* io.c */; }; + A4F318781BC58B1700FDF2BB /* tfm.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646301A8992CC0062516A /* tfm.c */; }; + A4F318791BC58B1700FDF2BB /* crl.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646011A89928E0062516A /* crl.c */; }; + A4F3187A1BC58B1700FDF2BB /* keys.c in Sources */ = {isa = PBXBuildFile; fileRef = 521646041A89928E0062516A /* keys.c */; }; + A4F3187D1BC58B1700FDF2BB /* callbacks.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646531A8993290062516A /* callbacks.h */; }; + A4F3187E1BC58B1700FDF2BB /* certs_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646541A8993290062516A /* certs_test.h */; }; + A4F3187F1BC58B1700FDF2BB /* crl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646551A8993290062516A /* crl.h */; }; + A4F318801BC58B1700FDF2BB /* error-ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646561A8993290062516A /* error-ssl.h */; }; + A4F318811BC58B1700FDF2BB /* internal.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646571A8993290062516A /* internal.h */; }; + A4F318821BC58B1700FDF2BB /* ocsp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646581A8993290062516A /* ocsp.h */; }; + A4F318831BC58B1700FDF2BB /* ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465B1A8993290062516A /* ssl.h */; }; + A4F318841BC58B1700FDF2BB /* test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465C1A8993290062516A /* test.h */; }; + A4F318851BC58B1700FDF2BB /* version.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465D1A8993290062516A /* version.h */; }; + A4F318871BC58B1700FDF2BB /* wc_encrypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 522DBE0E1B7927290031F454 /* wc_encrypt.h */; }; + A4F318881BC58B1700FDF2BB /* hash.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 525BE5351B3869430054BBCD /* hash.h */; }; + A4F318891BC58B1700FDF2BB /* aes.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465E1A8993770062516A /* aes.h */; }; + A4F3188A1BC58B1700FDF2BB /* arc4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216465F1A8993770062516A /* arc4.h */; }; + A4F3188B1BC58B1700FDF2BB /* asn_public.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646601A8993770062516A /* asn_public.h */; }; + A4F3188C1BC58B1700FDF2BB /* asn.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646611A8993770062516A /* asn.h */; }; + A4F3188D1BC58B1700FDF2BB /* blake2-impl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646621A8993770062516A /* blake2-impl.h */; }; + A4F3188E1BC58B1700FDF2BB /* blake2-int.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646631A8993770062516A /* blake2-int.h */; }; + A4F3188F1BC58B1700FDF2BB /* blake2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646641A8993770062516A /* blake2.h */; }; + A4F318901BC58B1700FDF2BB /* camellia.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646651A8993770062516A /* camellia.h */; }; + A4F318911BC58B1700FDF2BB /* chacha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646661A8993770062516A /* chacha.h */; }; + A4F318921BC58B1700FDF2BB /* coding.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646671A8993770062516A /* coding.h */; }; + A4F318931BC58B1700FDF2BB /* compress.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646681A8993770062516A /* compress.h */; }; + A4F318941BC58B1700FDF2BB /* des3.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646691A8993770062516A /* des3.h */; }; + A4F318951BC58B1700FDF2BB /* dh.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466A1A8993770062516A /* dh.h */; }; + A4F318961BC58B1700FDF2BB /* dsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466B1A8993770062516A /* dsa.h */; }; + A4F318971BC58B1700FDF2BB /* ecc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466C1A8993770062516A /* ecc.h */; }; + A4F318981BC58B1700FDF2BB /* error-crypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466D1A8993770062516A /* error-crypt.h */; }; + A4F318991BC58B1700FDF2BB /* fips_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466E1A8993770062516A /* fips_test.h */; }; + A4F3189A1BC58B1700FDF2BB /* hc128.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216466F1A8993770062516A /* hc128.h */; }; + A4F3189B1BC58B1700FDF2BB /* hmac.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646701A8993770062516A /* hmac.h */; }; + A4F3189C1BC58B1700FDF2BB /* integer.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646721A8993770062516A /* integer.h */; }; + A4F3189D1BC58B1700FDF2BB /* logging.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646731A8993770062516A /* logging.h */; }; + A4F3189E1BC58B1700FDF2BB /* md2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646741A8993770062516A /* md2.h */; }; + A4F3189F1BC58B1700FDF2BB /* md4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646751A8993770062516A /* md4.h */; }; + A4F318A01BC58B1700FDF2BB /* md5.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646761A8993770062516A /* md5.h */; }; + A4F318A11BC58B1700FDF2BB /* memory.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646771A8993770062516A /* memory.h */; }; + A4F318A21BC58B1700FDF2BB /* misc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646781A8993770062516A /* misc.h */; }; + A4F318A31BC58B1700FDF2BB /* mpi_class.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646791A8993770062516A /* mpi_class.h */; }; + A4F318A41BC58B1700FDF2BB /* mpi_superclass.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467A1A8993770062516A /* mpi_superclass.h */; }; + A4F318A51BC58B1700FDF2BB /* pkcs7.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467B1A8993770062516A /* pkcs7.h */; }; + A4F318A61BC58B1700FDF2BB /* poly1305.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467C1A8993770062516A /* poly1305.h */; }; + A4F318A71BC58B1700FDF2BB /* pwdbased.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467D1A8993770062516A /* pwdbased.h */; }; + A4F318A81BC58B1700FDF2BB /* rabbit.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467E1A8993770062516A /* rabbit.h */; }; + A4F318A91BC58B1700FDF2BB /* random.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216467F1A8993770062516A /* random.h */; }; + A4F318AA1BC58B1700FDF2BB /* ripemd.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646801A8993770062516A /* ripemd.h */; }; + A4F318AB1BC58B1700FDF2BB /* rsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646811A8993770062516A /* rsa.h */; }; + A4F318AC1BC58B1700FDF2BB /* settings.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646821A8993770062516A /* settings.h */; }; + A4F318AD1BC58B1700FDF2BB /* sha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646831A8993770062516A /* sha.h */; }; + A4F318AE1BC58B1700FDF2BB /* sha256.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646841A8993770062516A /* sha256.h */; }; + A4F318AF1BC58B1700FDF2BB /* sha512.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646851A8993770062516A /* sha512.h */; }; + A4F318B01BC58B1700FDF2BB /* tfm.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646861A8993770062516A /* tfm.h */; }; + A4F318B11BC58B1700FDF2BB /* types.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646871A8993770062516A /* types.h */; }; + A4F318B21BC58B1700FDF2BB /* visibility.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646881A8993770062516A /* visibility.h */; }; + A4F318B31BC58B1700FDF2BB /* wc_port.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646891A8993770062516A /* wc_port.h */; }; + A4F318B51BC58B1700FDF2BB /* callbacks.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468A1A8993BB0062516A /* callbacks.h */; }; + A4F318B61BC58B1700FDF2BB /* certs_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468B1A8993BB0062516A /* certs_test.h */; }; + A4F318B71BC58B1700FDF2BB /* crl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468C1A8993BB0062516A /* crl.h */; }; + A4F318B81BC58B1700FDF2BB /* error-ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468D1A8993BB0062516A /* error-ssl.h */; }; + A4F318B91BC58B1700FDF2BB /* internal.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468E1A8993BB0062516A /* internal.h */; }; + A4F318BA1BC58B1700FDF2BB /* ocsp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216468F1A8993BB0062516A /* ocsp.h */; }; + A4F318BB1BC58B1700FDF2BB /* ssl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646921A8993BB0062516A /* ssl.h */; }; + A4F318BC1BC58B1700FDF2BB /* test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646931A8993BB0062516A /* test.h */; }; + A4F318BD1BC58B1700FDF2BB /* version.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646941A8993BB0062516A /* version.h */; }; + A4F318BF1BC58B1700FDF2BB /* aes.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646951A8993F50062516A /* aes.h */; }; + A4F318C01BC58B1700FDF2BB /* arc4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646961A8993F50062516A /* arc4.h */; }; + A4F318C11BC58B1700FDF2BB /* asn_public.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646971A8993F50062516A /* asn_public.h */; }; + A4F318C21BC58B1700FDF2BB /* asn.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646981A8993F50062516A /* asn.h */; }; + A4F318C31BC58B1700FDF2BB /* blake2-impl.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646991A8993F50062516A /* blake2-impl.h */; }; + A4F318C41BC58B1700FDF2BB /* blake2-int.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469A1A8993F50062516A /* blake2-int.h */; }; + A4F318C51BC58B1700FDF2BB /* blake2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469B1A8993F50062516A /* blake2.h */; }; + A4F318C61BC58B1700FDF2BB /* camellia.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469C1A8993F50062516A /* camellia.h */; }; + A4F318C71BC58B1700FDF2BB /* chacha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469D1A8993F50062516A /* chacha.h */; }; + A4F318C81BC58B1700FDF2BB /* coding.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469E1A8993F50062516A /* coding.h */; }; + A4F318C91BC58B1700FDF2BB /* compress.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 5216469F1A8993F50062516A /* compress.h */; }; + A4F318CA1BC58B1700FDF2BB /* des3.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A01A8993F50062516A /* des3.h */; }; + A4F318CB1BC58B1700FDF2BB /* dh.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A11A8993F50062516A /* dh.h */; }; + A4F318CC1BC58B1700FDF2BB /* dsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A21A8993F50062516A /* dsa.h */; }; + A4F318CD1BC58B1700FDF2BB /* ecc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A31A8993F50062516A /* ecc.h */; }; + A4F318CE1BC58B1700FDF2BB /* error-crypt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A41A8993F50062516A /* error-crypt.h */; }; + A4F318CF1BC58B1700FDF2BB /* fips_test.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A51A8993F50062516A /* fips_test.h */; }; + A4F318D01BC58B1700FDF2BB /* hc128.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A61A8993F50062516A /* hc128.h */; }; + A4F318D11BC58B1700FDF2BB /* hmac.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A71A8993F50062516A /* hmac.h */; }; + A4F318D21BC58B1700FDF2BB /* integer.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A81A8993F50062516A /* integer.h */; }; + A4F318D31BC58B1700FDF2BB /* logging.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646A91A8993F50062516A /* logging.h */; }; + A4F318D41BC58B1700FDF2BB /* md2.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AA1A8993F50062516A /* md2.h */; }; + A4F318D51BC58B1700FDF2BB /* md4.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AB1A8993F50062516A /* md4.h */; }; + A4F318D61BC58B1700FDF2BB /* md5.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AC1A8993F50062516A /* md5.h */; }; + A4F318D71BC58B1700FDF2BB /* memory.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AD1A8993F50062516A /* memory.h */; }; + A4F318D81BC58B1700FDF2BB /* misc.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AE1A8993F50062516A /* misc.h */; }; + A4F318D91BC58B1700FDF2BB /* mpi_class.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646AF1A8993F50062516A /* mpi_class.h */; }; + A4F318DA1BC58B1700FDF2BB /* mpi_superclass.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B01A8993F50062516A /* mpi_superclass.h */; }; + A4F318DB1BC58B1700FDF2BB /* pkcs7.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B11A8993F50062516A /* pkcs7.h */; }; + A4F318DC1BC58B1700FDF2BB /* poly1305.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B21A8993F50062516A /* poly1305.h */; }; + A4F318DD1BC58B1700FDF2BB /* pwdbased.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B31A8993F50062516A /* pwdbased.h */; }; + A4F318DE1BC58B1700FDF2BB /* rabbit.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B41A8993F50062516A /* rabbit.h */; }; + A4F318DF1BC58B1700FDF2BB /* random.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B51A8993F50062516A /* random.h */; }; + A4F318E01BC58B1700FDF2BB /* ripemd.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B61A8993F50062516A /* ripemd.h */; }; + A4F318E11BC58B1700FDF2BB /* rsa.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B71A8993F50062516A /* rsa.h */; }; + A4F318E21BC58B1700FDF2BB /* settings_comp.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B81A8993F50062516A /* settings_comp.h */; }; + A4F318E31BC58B1700FDF2BB /* settings.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646B91A8993F50062516A /* settings.h */; }; + A4F318E41BC58B1700FDF2BB /* sha.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BA1A8993F50062516A /* sha.h */; }; + A4F318E51BC58B1700FDF2BB /* sha256.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BB1A8993F50062516A /* sha256.h */; }; + A4F318E61BC58B1700FDF2BB /* sha512.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BC1A8993F50062516A /* sha512.h */; }; + A4F318E71BC58B1700FDF2BB /* tfm.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BD1A8993F50062516A /* tfm.h */; }; + A4F318E81BC58B1700FDF2BB /* types.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BE1A8993F50062516A /* types.h */; }; + A4F318E91BC58B1700FDF2BB /* visibility.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646BF1A8993F50062516A /* visibility.h */; }; + A4F318EA1BC58B1700FDF2BB /* wc_port.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 521646C01A8993F50062516A /* wc_port.h */; }; /* End PBXBuildFile section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -303,6 +453,149 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + A4F3187C1BC58B1700FDF2BB /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = include/wolfssl; + dstSubfolderSpec = 7; + files = ( + A4F3187D1BC58B1700FDF2BB /* callbacks.h in CopyFiles */, + A4F3187E1BC58B1700FDF2BB /* certs_test.h in CopyFiles */, + A4F3187F1BC58B1700FDF2BB /* crl.h in CopyFiles */, + A4F318801BC58B1700FDF2BB /* error-ssl.h in CopyFiles */, + A4F318811BC58B1700FDF2BB /* internal.h in CopyFiles */, + A4F318821BC58B1700FDF2BB /* ocsp.h in CopyFiles */, + A4F318831BC58B1700FDF2BB /* ssl.h in CopyFiles */, + A4F318841BC58B1700FDF2BB /* test.h in CopyFiles */, + A4F318851BC58B1700FDF2BB /* version.h in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A4F318861BC58B1700FDF2BB /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = include/wolfssl/wolfcrypt; + dstSubfolderSpec = 7; + files = ( + A4F318871BC58B1700FDF2BB /* wc_encrypt.h in CopyFiles */, + A4F318881BC58B1700FDF2BB /* hash.h in CopyFiles */, + A4F318891BC58B1700FDF2BB /* aes.h in CopyFiles */, + A4F3188A1BC58B1700FDF2BB /* arc4.h in CopyFiles */, + A4F3188B1BC58B1700FDF2BB /* asn_public.h in CopyFiles */, + A4F3188C1BC58B1700FDF2BB /* asn.h in CopyFiles */, + A4F3188D1BC58B1700FDF2BB /* blake2-impl.h in CopyFiles */, + A4F3188E1BC58B1700FDF2BB /* blake2-int.h in CopyFiles */, + A4F3188F1BC58B1700FDF2BB /* blake2.h in CopyFiles */, + A4F318901BC58B1700FDF2BB /* camellia.h in CopyFiles */, + A4F318911BC58B1700FDF2BB /* chacha.h in CopyFiles */, + A4F318921BC58B1700FDF2BB /* coding.h in CopyFiles */, + A4F318931BC58B1700FDF2BB /* compress.h in CopyFiles */, + A4F318941BC58B1700FDF2BB /* des3.h in CopyFiles */, + A4F318951BC58B1700FDF2BB /* dh.h in CopyFiles */, + A4F318961BC58B1700FDF2BB /* dsa.h in CopyFiles */, + A4F318971BC58B1700FDF2BB /* ecc.h in CopyFiles */, + A4F318981BC58B1700FDF2BB /* error-crypt.h in CopyFiles */, + A4F318991BC58B1700FDF2BB /* fips_test.h in CopyFiles */, + A4F3189A1BC58B1700FDF2BB /* hc128.h in CopyFiles */, + A4F3189B1BC58B1700FDF2BB /* hmac.h in CopyFiles */, + A4F3189C1BC58B1700FDF2BB /* integer.h in CopyFiles */, + A4F3189D1BC58B1700FDF2BB /* logging.h in CopyFiles */, + A4F3189E1BC58B1700FDF2BB /* md2.h in CopyFiles */, + A4F3189F1BC58B1700FDF2BB /* md4.h in CopyFiles */, + A4F318A01BC58B1700FDF2BB /* md5.h in CopyFiles */, + A4F318A11BC58B1700FDF2BB /* memory.h in CopyFiles */, + A4F318A21BC58B1700FDF2BB /* misc.h in CopyFiles */, + A4F318A31BC58B1700FDF2BB /* mpi_class.h in CopyFiles */, + A4F318A41BC58B1700FDF2BB /* mpi_superclass.h in CopyFiles */, + A4F318A51BC58B1700FDF2BB /* pkcs7.h in CopyFiles */, + A4F318A61BC58B1700FDF2BB /* poly1305.h in CopyFiles */, + A4F318A71BC58B1700FDF2BB /* pwdbased.h in CopyFiles */, + A4F318A81BC58B1700FDF2BB /* rabbit.h in CopyFiles */, + A4F318A91BC58B1700FDF2BB /* random.h in CopyFiles */, + A4F318AA1BC58B1700FDF2BB /* ripemd.h in CopyFiles */, + A4F318AB1BC58B1700FDF2BB /* rsa.h in CopyFiles */, + A4F318AC1BC58B1700FDF2BB /* settings.h in CopyFiles */, + A4F318AD1BC58B1700FDF2BB /* sha.h in CopyFiles */, + A4F318AE1BC58B1700FDF2BB /* sha256.h in CopyFiles */, + A4F318AF1BC58B1700FDF2BB /* sha512.h in CopyFiles */, + A4F318B01BC58B1700FDF2BB /* tfm.h in CopyFiles */, + A4F318B11BC58B1700FDF2BB /* types.h in CopyFiles */, + A4F318B21BC58B1700FDF2BB /* visibility.h in CopyFiles */, + A4F318B31BC58B1700FDF2BB /* wc_port.h in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A4F318B41BC58B1700FDF2BB /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = include/cyassl; + dstSubfolderSpec = 7; + files = ( + A4F318B51BC58B1700FDF2BB /* callbacks.h in CopyFiles */, + A4F318B61BC58B1700FDF2BB /* certs_test.h in CopyFiles */, + A4F318B71BC58B1700FDF2BB /* crl.h in CopyFiles */, + A4F318B81BC58B1700FDF2BB /* error-ssl.h in CopyFiles */, + A4F318B91BC58B1700FDF2BB /* internal.h in CopyFiles */, + A4F318BA1BC58B1700FDF2BB /* ocsp.h in CopyFiles */, + A4F318BB1BC58B1700FDF2BB /* ssl.h in CopyFiles */, + A4F318BC1BC58B1700FDF2BB /* test.h in CopyFiles */, + A4F318BD1BC58B1700FDF2BB /* version.h in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + A4F318BE1BC58B1700FDF2BB /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = include/cyassl/ctaocrypt; + dstSubfolderSpec = 7; + files = ( + A4F318BF1BC58B1700FDF2BB /* aes.h in CopyFiles */, + A4F318C01BC58B1700FDF2BB /* arc4.h in CopyFiles */, + A4F318C11BC58B1700FDF2BB /* asn_public.h in CopyFiles */, + A4F318C21BC58B1700FDF2BB /* asn.h in CopyFiles */, + A4F318C31BC58B1700FDF2BB /* blake2-impl.h in CopyFiles */, + A4F318C41BC58B1700FDF2BB /* blake2-int.h in CopyFiles */, + A4F318C51BC58B1700FDF2BB /* blake2.h in CopyFiles */, + A4F318C61BC58B1700FDF2BB /* camellia.h in CopyFiles */, + A4F318C71BC58B1700FDF2BB /* chacha.h in CopyFiles */, + A4F318C81BC58B1700FDF2BB /* coding.h in CopyFiles */, + A4F318C91BC58B1700FDF2BB /* compress.h in CopyFiles */, + A4F318CA1BC58B1700FDF2BB /* des3.h in CopyFiles */, + A4F318CB1BC58B1700FDF2BB /* dh.h in CopyFiles */, + A4F318CC1BC58B1700FDF2BB /* dsa.h in CopyFiles */, + A4F318CD1BC58B1700FDF2BB /* ecc.h in CopyFiles */, + A4F318CE1BC58B1700FDF2BB /* error-crypt.h in CopyFiles */, + A4F318CF1BC58B1700FDF2BB /* fips_test.h in CopyFiles */, + A4F318D01BC58B1700FDF2BB /* hc128.h in CopyFiles */, + A4F318D11BC58B1700FDF2BB /* hmac.h in CopyFiles */, + A4F318D21BC58B1700FDF2BB /* integer.h in CopyFiles */, + A4F318D31BC58B1700FDF2BB /* logging.h in CopyFiles */, + A4F318D41BC58B1700FDF2BB /* md2.h in CopyFiles */, + A4F318D51BC58B1700FDF2BB /* md4.h in CopyFiles */, + A4F318D61BC58B1700FDF2BB /* md5.h in CopyFiles */, + A4F318D71BC58B1700FDF2BB /* memory.h in CopyFiles */, + A4F318D81BC58B1700FDF2BB /* misc.h in CopyFiles */, + A4F318D91BC58B1700FDF2BB /* mpi_class.h in CopyFiles */, + A4F318DA1BC58B1700FDF2BB /* mpi_superclass.h in CopyFiles */, + A4F318DB1BC58B1700FDF2BB /* pkcs7.h in CopyFiles */, + A4F318DC1BC58B1700FDF2BB /* poly1305.h in CopyFiles */, + A4F318DD1BC58B1700FDF2BB /* pwdbased.h in CopyFiles */, + A4F318DE1BC58B1700FDF2BB /* rabbit.h in CopyFiles */, + A4F318DF1BC58B1700FDF2BB /* random.h in CopyFiles */, + A4F318E01BC58B1700FDF2BB /* ripemd.h in CopyFiles */, + A4F318E11BC58B1700FDF2BB /* rsa.h in CopyFiles */, + A4F318E21BC58B1700FDF2BB /* settings_comp.h in CopyFiles */, + A4F318E31BC58B1700FDF2BB /* settings.h in CopyFiles */, + A4F318E41BC58B1700FDF2BB /* sha.h in CopyFiles */, + A4F318E51BC58B1700FDF2BB /* sha256.h in CopyFiles */, + A4F318E61BC58B1700FDF2BB /* sha512.h in CopyFiles */, + A4F318E71BC58B1700FDF2BB /* tfm.h in CopyFiles */, + A4F318E81BC58B1700FDF2BB /* types.h in CopyFiles */, + A4F318E91BC58B1700FDF2BB /* visibility.h in CopyFiles */, + A4F318EA1BC58B1700FDF2BB /* wc_port.h in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ @@ -456,7 +749,9 @@ 522DBE0E1B7927290031F454 /* wc_encrypt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wc_encrypt.h; path = ../../wolfssl/wolfcrypt/wc_encrypt.h; sourceTree = ""; }; 525BE5331B3869110054BBCD /* hash.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = hash.c; path = ../../wolfcrypt/src/hash.c; sourceTree = ""; }; 525BE5351B3869430054BBCD /* hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = hash.h; path = ../../wolfssl/wolfcrypt/hash.h; sourceTree = ""; }; - 52B1344D16F3C9E800C07B32 /* libwolfssl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwolfssl.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 52B1344D16F3C9E800C07B32 /* libwolfssl_ios.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwolfssl_ios.a; sourceTree = BUILT_PRODUCTS_DIR; }; + A45EA7091BC5995E00A8614A /* user_settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = user_settings.h; sourceTree = ""; }; + A4F318EE1BC58B1700FDF2BB /* libwolfssl_osx.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libwolfssl_osx.a; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -467,6 +762,13 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + A4F3187B1BC58B1700FDF2BB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -619,6 +921,7 @@ 521645FB1A8991990062516A /* Source */ = { isa = PBXGroup; children = ( + A45EA7091BC5995E00A8614A /* user_settings.h */, 521646001A89924A0062516A /* wolfSSL */, 521645FF1A8992470062516A /* wolfCrypt */, ); @@ -694,7 +997,8 @@ 52B1344E16F3C9E800C07B32 /* Products */ = { isa = PBXGroup; children = ( - 52B1344D16F3C9E800C07B32 /* libwolfssl.a */, + 52B1344D16F3C9E800C07B32 /* libwolfssl_ios.a */, + A4F318EE1BC58B1700FDF2BB /* libwolfssl_osx.a */, ); name = Products; sourceTree = ""; @@ -702,9 +1006,9 @@ /* End PBXGroup section */ /* Begin PBXNativeTarget section */ - 52B1344C16F3C9E800C07B32 /* wolfssl */ = { + 52B1344C16F3C9E800C07B32 /* wolfssl_ios */ = { isa = PBXNativeTarget; - buildConfigurationList = 52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl" */; + buildConfigurationList = 52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl_ios" */; buildPhases = ( 52B1344916F3C9E800C07B32 /* Sources */, 52B1344A16F3C9E800C07B32 /* Frameworks */, @@ -717,9 +1021,29 @@ ); dependencies = ( ); - name = wolfssl; + name = wolfssl_ios; productName = "wolfssl-ios"; - productReference = 52B1344D16F3C9E800C07B32 /* libwolfssl.a */; + productReference = 52B1344D16F3C9E800C07B32 /* libwolfssl_ios.a */; + productType = "com.apple.product-type.library.static"; + }; + A4F3184E1BC58B1700FDF2BB /* wolfssl_osx */ = { + isa = PBXNativeTarget; + buildConfigurationList = A4F318EB1BC58B1700FDF2BB /* Build configuration list for PBXNativeTarget "wolfssl_osx" */; + buildPhases = ( + A4F3184F1BC58B1700FDF2BB /* Sources */, + A4F3187B1BC58B1700FDF2BB /* Frameworks */, + A4F3187C1BC58B1700FDF2BB /* CopyFiles */, + A4F318861BC58B1700FDF2BB /* CopyFiles */, + A4F318B41BC58B1700FDF2BB /* CopyFiles */, + A4F318BE1BC58B1700FDF2BB /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = wolfssl_osx; + productName = "wolfssl-osx"; + productReference = A4F318EE1BC58B1700FDF2BB /* libwolfssl_osx.a */; productType = "com.apple.product-type.library.static"; }; /* End PBXNativeTarget section */ @@ -743,7 +1067,8 @@ projectDirPath = ""; projectRoot = ""; targets = ( - 52B1344C16F3C9E800C07B32 /* wolfssl */, + 52B1344C16F3C9E800C07B32 /* wolfssl_ios */, + A4F3184E1BC58B1700FDF2BB /* wolfssl_osx */, ); }; /* End PBXProject section */ @@ -799,6 +1124,56 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + A4F3184F1BC58B1700FDF2BB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A4F318501BC58B1700FDF2BB /* dsa.c in Sources */, + A4F318511BC58B1700FDF2BB /* logging.c in Sources */, + A4F318521BC58B1700FDF2BB /* sha.c in Sources */, + A4F318531BC58B1700FDF2BB /* poly1305.c in Sources */, + A4F318541BC58B1700FDF2BB /* dh.c in Sources */, + A4F318551BC58B1700FDF2BB /* camellia.c in Sources */, + A4F318561BC58B1700FDF2BB /* wc_port.c in Sources */, + A4F318571BC58B1700FDF2BB /* pwdbased.c in Sources */, + A4F318581BC58B1700FDF2BB /* misc.c in Sources */, + A4F318591BC58B1700FDF2BB /* hc128.c in Sources */, + A4F3185A1BC58B1700FDF2BB /* asn.c in Sources */, + A4F3185B1BC58B1700FDF2BB /* sha512.c in Sources */, + A4F3185C1BC58B1700FDF2BB /* rabbit.c in Sources */, + A4F3185D1BC58B1700FDF2BB /* hash.c in Sources */, + A4F3185E1BC58B1700FDF2BB /* md5.c in Sources */, + A4F3185F1BC58B1700FDF2BB /* ssl.c in Sources */, + A4F318601BC58B1700FDF2BB /* rsa.c in Sources */, + A4F318611BC58B1700FDF2BB /* random.c in Sources */, + A4F318621BC58B1700FDF2BB /* wc_encrypt.c in Sources */, + A4F318631BC58B1700FDF2BB /* tls.c in Sources */, + A4F318641BC58B1700FDF2BB /* ocsp.c in Sources */, + A4F318651BC58B1700FDF2BB /* md4.c in Sources */, + A4F318661BC58B1700FDF2BB /* aes.c in Sources */, + A4F318671BC58B1700FDF2BB /* des3.c in Sources */, + A4F318681BC58B1700FDF2BB /* blake2b.c in Sources */, + A4F318691BC58B1700FDF2BB /* ripemd.c in Sources */, + A4F3186A1BC58B1700FDF2BB /* memory.c in Sources */, + A4F3186B1BC58B1700FDF2BB /* ecc.c in Sources */, + A4F3186C1BC58B1700FDF2BB /* sha256.c in Sources */, + A4F3186D1BC58B1700FDF2BB /* chacha.c in Sources */, + A4F3186E1BC58B1700FDF2BB /* pkcs7.c in Sources */, + A4F3186F1BC58B1700FDF2BB /* sniffer.c in Sources */, + A4F318701BC58B1700FDF2BB /* md2.c in Sources */, + A4F318711BC58B1700FDF2BB /* coding.c in Sources */, + A4F318721BC58B1700FDF2BB /* error.c in Sources */, + A4F318731BC58B1700FDF2BB /* hmac.c in Sources */, + A4F318741BC58B1700FDF2BB /* arc4.c in Sources */, + A4F318751BC58B1700FDF2BB /* integer.c in Sources */, + A4F318761BC58B1700FDF2BB /* internal.c in Sources */, + A4F318771BC58B1700FDF2BB /* io.c in Sources */, + A4F318781BC58B1700FDF2BB /* tfm.c in Sources */, + A4F318791BC58B1700FDF2BB /* crl.c in Sources */, + A4F3187A1BC58B1700FDF2BB /* keys.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; /* End PBXSourcesBuildPhase section */ /* Begin XCBuildConfiguration section */ @@ -813,6 +1188,7 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CONFIGURATION_BUILD_DIR = "$(SYMROOT)"; COPY_PHASE_STRIP = NO; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; @@ -825,8 +1201,8 @@ GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; ONLY_ACTIVE_ARCH = YES; + PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; SDKROOT = iphoneos; USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl include"; }; @@ -843,12 +1219,13 @@ CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CONFIGURATION_BUILD_DIR = "$(SYMROOT)"; COPY_PHASE_STRIP = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; + PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; SDKROOT = iphoneos; USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl include"; VALIDATE_PRODUCT = NO; @@ -864,22 +1241,19 @@ GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", "$(inherited)", - IPHONE, - HAVE_HASHDRBG, - USE_FAST_MATH, - HAVE_HASHDRBG, - HAVE_AESGCM, - WOLFSSL_SHA512, - WOLFSSL_SHA384, + WOLFSSL_USER_SETTINGS, ); HEADER_SEARCH_PATHS = ( $SRCROOT, $PROJECT_DIR/../.., ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/DerivedData/wolfssl/Build/Products/Debug", + ); OTHER_LDFLAGS = ""; - PRODUCT_NAME = wolfssl; + PRODUCT_NAME = wolfssl_ios; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl"; @@ -894,21 +1268,66 @@ DSTROOT = /tmp/wolfssl_ios.dst; GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PREFIX_HEADER = ""; + GCC_PREPROCESSOR_DEFINITIONS = WOLFSSL_USER_SETTINGS; + HEADER_SEARCH_PATHS = ( + $SRCROOT, + $PROJECT_DIR/../.., + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/DerivedData/wolfssl/Build/Products/Debug", + ); + OTHER_LDFLAGS = ""; + PRODUCT_NAME = wolfssl_ios; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl"; + }; + name = Release; + }; + A4F318EC1BC58B1700FDF2BB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + CLANG_LINK_OBJC_RUNTIME = NO; + DSTROOT = /tmp/wolfssl_osx.dst; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; GCC_PREPROCESSOR_DEFINITIONS = ( - IPHONE, - HAVE_HASHDRBG, - USE_FAST_MATH, - HAVE_HASHDRBG, - HAVE_AESGCM, - WOLFSSL_SHA512, - WOLFSSL_SHA384, + "$(inherited)", + WOLFSSL_USER_SETTINGS, ); HEADER_SEARCH_PATHS = ( $SRCROOT, $PROJECT_DIR/../.., ); OTHER_LDFLAGS = ""; - PRODUCT_NAME = wolfssl; + PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = "1,2"; + USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl"; + }; + name = Debug; + }; + A4F318ED1BC58B1700FDF2BB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = YES; + CLANG_LINK_OBJC_RUNTIME = NO; + DSTROOT = /tmp/wolfssl_osx.dst; + GCC_PRECOMPILE_PREFIX_HEADER = NO; + GCC_PREFIX_HEADER = ""; + GCC_PREPROCESSOR_DEFINITIONS = WOLFSSL_USER_SETTINGS; + HEADER_SEARCH_PATHS = ( + $SRCROOT, + $PROJECT_DIR/../.., + ); + OTHER_LDFLAGS = ""; + PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = NO; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; SKIP_INSTALL = YES; TARGETED_DEVICE_FAMILY = "1,2"; USER_HEADER_SEARCH_PATHS = "wolfssl/wolfcrypt wolfssl"; @@ -927,7 +1346,7 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - 52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl" */ = { + 52B1347216F3C9E800C07B32 /* Build configuration list for PBXNativeTarget "wolfssl_ios" */ = { isa = XCConfigurationList; buildConfigurations = ( 52B1347316F3C9E800C07B32 /* Debug */, @@ -936,6 +1355,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + A4F318EB1BC58B1700FDF2BB /* Build configuration list for PBXNativeTarget "wolfssl_osx" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A4F318EC1BC58B1700FDF2BB /* Debug */, + A4F318ED1BC58B1700FDF2BB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; /* End XCConfigurationList section */ }; rootObject = 52B1344516F3C9E800C07B32 /* Project object */; diff --git a/IDE/iOS/wolfssl.xcworkspace/contents.xcworkspacedata b/IDE/iOS/wolfssl.xcworkspace/contents.xcworkspacedata new file mode 100644 index 000000000..602c4aaac --- /dev/null +++ b/IDE/iOS/wolfssl.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,13 @@ + + + + + + + + + diff --git a/IDE/iOS/wolfssl_testsuite.xcodeproj/project.pbxproj b/IDE/iOS/wolfssl_testsuite.xcodeproj/project.pbxproj new file mode 100644 index 000000000..e19e92576 --- /dev/null +++ b/IDE/iOS/wolfssl_testsuite.xcodeproj/project.pbxproj @@ -0,0 +1,347 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + A44566701BC59CA50053D0CB /* libwolfssl_osx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A445666F1BC59CA50053D0CB /* libwolfssl_osx.a */; }; + A45EA6DF1BC5922C00A8614A /* client.c in Sources */ = {isa = PBXBuildFile; fileRef = A45EA69D1BC5922C00A8614A /* client.c */; settings = {ASSET_TAGS = (); }; }; + A45EA6E31BC5922C00A8614A /* echoclient.c in Sources */ = {isa = PBXBuildFile; fileRef = A45EA6B01BC5922C00A8614A /* echoclient.c */; settings = {ASSET_TAGS = (); }; }; + A45EA6E61BC5922C00A8614A /* echoserver.c in Sources */ = {isa = PBXBuildFile; fileRef = A45EA6C31BC5922C00A8614A /* echoserver.c */; settings = {ASSET_TAGS = (); }; }; + A45EA6E91BC5922C00A8614A /* server.c in Sources */ = {isa = PBXBuildFile; fileRef = A45EA6D71BC5922C00A8614A /* server.c */; settings = {ASSET_TAGS = (); }; }; + A45EA6FD1BC5929500A8614A /* test.c in Sources */ = {isa = PBXBuildFile; fileRef = A45EA6F61BC5929500A8614A /* test.c */; settings = {ASSET_TAGS = (); }; }; + A4C7CBF51BC58BD600E591AE /* testsuite.c in Sources */ = {isa = PBXBuildFile; fileRef = A4C7CBF41BC58BD600E591AE /* testsuite.c */; settings = {ASSET_TAGS = (); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXCopyFilesBuildPhase section */ + A4F318F61BC58B8100FDF2BB /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = /usr/share/man/man1/; + dstSubfolderSpec = 0; + files = ( + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + A445666F1BC59CA50053D0CB /* libwolfssl_osx.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwolfssl_osx.a; path = Build/Products/libwolfssl_osx.a; sourceTree = ""; }; + A45EA69D1BC5922C00A8614A /* client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = client.c; sourceTree = ""; }; + A45EA69E1BC5922C00A8614A /* client.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = client.h; sourceTree = ""; }; + A45EA6B01BC5922C00A8614A /* echoclient.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = echoclient.c; sourceTree = ""; }; + A45EA6B11BC5922C00A8614A /* echoclient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = echoclient.h; sourceTree = ""; }; + A45EA6C31BC5922C00A8614A /* echoserver.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = echoserver.c; sourceTree = ""; }; + A45EA6C41BC5922C00A8614A /* echoserver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = echoserver.h; sourceTree = ""; }; + A45EA6D71BC5922C00A8614A /* server.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = server.c; sourceTree = ""; }; + A45EA6D81BC5922C00A8614A /* server.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = server.h; sourceTree = ""; }; + A45EA6F61BC5929500A8614A /* test.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = test.c; sourceTree = ""; }; + A45EA6F71BC5929500A8614A /* test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = test.h; sourceTree = ""; }; + A45EA7081BC5995800A8614A /* user_settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = user_settings.h; sourceTree = ""; }; + A4C7CBF41BC58BD600E591AE /* testsuite.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testsuite.c; path = ../../testsuite/testsuite.c; sourceTree = ""; }; + A4F318F81BC58B8100FDF2BB /* wolfssl_testsuite */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = wolfssl_testsuite; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + A4F318F51BC58B8100FDF2BB /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A44566701BC59CA50053D0CB /* libwolfssl_osx.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + A45EA6921BC5922C00A8614A /* client */ = { + isa = PBXGroup; + children = ( + A45EA69D1BC5922C00A8614A /* client.c */, + A45EA69E1BC5922C00A8614A /* client.h */, + ); + name = client; + path = ../../examples/client; + sourceTree = ""; + }; + A45EA6A61BC5922C00A8614A /* echoclient */ = { + isa = PBXGroup; + children = ( + A45EA6B01BC5922C00A8614A /* echoclient.c */, + A45EA6B11BC5922C00A8614A /* echoclient.h */, + ); + name = echoclient; + path = ../../examples/echoclient; + sourceTree = ""; + }; + A45EA6B91BC5922C00A8614A /* echoserver */ = { + isa = PBXGroup; + children = ( + A45EA6C31BC5922C00A8614A /* echoserver.c */, + A45EA6C41BC5922C00A8614A /* echoserver.h */, + ); + name = echoserver; + path = ../../examples/echoserver; + sourceTree = ""; + }; + A45EA6CB1BC5922C00A8614A /* server */ = { + isa = PBXGroup; + children = ( + A45EA6D71BC5922C00A8614A /* server.c */, + A45EA6D81BC5922C00A8614A /* server.h */, + ); + name = server; + path = ../../examples/server; + sourceTree = ""; + }; + A45EA6ED1BC5929500A8614A /* test */ = { + isa = PBXGroup; + children = ( + A45EA6F61BC5929500A8614A /* test.c */, + A45EA6F71BC5929500A8614A /* test.h */, + ); + name = test; + path = ../../wolfcrypt/test; + sourceTree = ""; + }; + A4C7CBF31BC58BC300E591AE /* Source */ = { + isa = PBXGroup; + children = ( + A45EA7081BC5995800A8614A /* user_settings.h */, + A45EA6ED1BC5929500A8614A /* test */, + A45EA6921BC5922C00A8614A /* client */, + A45EA6A61BC5922C00A8614A /* echoclient */, + A45EA6B91BC5922C00A8614A /* echoserver */, + A45EA6CB1BC5922C00A8614A /* server */, + A4C7CBF41BC58BD600E591AE /* testsuite.c */, + ); + name = Source; + sourceTree = ""; + }; + A4F318EF1BC58B8100FDF2BB = { + isa = PBXGroup; + children = ( + A445666F1BC59CA50053D0CB /* libwolfssl_osx.a */, + A4C7CBF31BC58BC300E591AE /* Source */, + A4F318F91BC58B8100FDF2BB /* Products */, + ); + sourceTree = ""; + }; + A4F318F91BC58B8100FDF2BB /* Products */ = { + isa = PBXGroup; + children = ( + A4F318F81BC58B8100FDF2BB /* wolfssl_testsuite */, + ); + name = Products; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + A4F318F71BC58B8100FDF2BB /* wolfssl_testsuite */ = { + isa = PBXNativeTarget; + buildConfigurationList = A4F318FF1BC58B8100FDF2BB /* Build configuration list for PBXNativeTarget "wolfssl_testsuite" */; + buildPhases = ( + A4F318F41BC58B8100FDF2BB /* Sources */, + A4F318F51BC58B8100FDF2BB /* Frameworks */, + A4F318F61BC58B8100FDF2BB /* CopyFiles */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = wolfssl_testsuite; + productName = wolfssl_testsuite; + productReference = A4F318F81BC58B8100FDF2BB /* wolfssl_testsuite */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + A4F318F01BC58B8100FDF2BB /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0700; + ORGANIZATIONNAME = WolfSSL; + TargetAttributes = { + A4F318F71BC58B8100FDF2BB = { + CreatedOnToolsVersion = 7.0.1; + }; + }; + }; + buildConfigurationList = A4F318F31BC58B8100FDF2BB /* Build configuration list for PBXProject "wolfssl_testsuite" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = A4F318EF1BC58B8100FDF2BB; + productRefGroup = A4F318F91BC58B8100FDF2BB /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + A4F318F71BC58B8100FDF2BB /* wolfssl_testsuite */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + A4F318F41BC58B8100FDF2BB /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + A45EA6DF1BC5922C00A8614A /* client.c in Sources */, + A45EA6E31BC5922C00A8614A /* echoclient.c in Sources */, + A4C7CBF51BC58BD600E591AE /* testsuite.c in Sources */, + A45EA6FD1BC5929500A8614A /* test.c in Sources */, + A45EA6E91BC5922C00A8614A /* server.c in Sources */, + A45EA6E61BC5922C00A8614A /* echoserver.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + A4F318FD1BC58B8100FDF2BB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = macosx; + }; + name = Debug; + }; + A4F318FE1BC58B8100FDF2BB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = macosx; + }; + name = Release; + }; + A4F319001BC58B8100FDF2BB /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PREPROCESSOR_DEFINITIONS = ( + "$(inherited)", + NO_MAIN_DRIVER, + WOLFSSL_USER_SETTINGS, + ); + HEADER_SEARCH_PATHS = ( + $SRCROOT, + $PROJECT_DIR/../.., + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Build/Products", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + A4F319011BC58B8100FDF2BB /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + GCC_PREPROCESSOR_DEFINITIONS = ( + NO_MAIN_DRIVER, + WOLFSSL_USER_SETTINGS, + ); + HEADER_SEARCH_PATHS = ( + $SRCROOT, + $PROJECT_DIR/../.., + ); + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Build/Products", + ); + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + A4F318F31BC58B8100FDF2BB /* Build configuration list for PBXProject "wolfssl_testsuite" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A4F318FD1BC58B8100FDF2BB /* Debug */, + A4F318FE1BC58B8100FDF2BB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + A4F318FF1BC58B8100FDF2BB /* Build configuration list for PBXNativeTarget "wolfssl_testsuite" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + A4F319001BC58B8100FDF2BB /* Debug */, + A4F319011BC58B8100FDF2BB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = A4F318F01BC58B8100FDF2BB /* Project object */; +} diff --git a/Makefile.am b/Makefile.am index 65b4d3d82..f3ad8ecd5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -113,9 +113,6 @@ tests/unit.log: testsuite/testsuite.log DISTCLEANFILES+= cyassl-config DISTCLEANFILES+= wolfssl-config -# fips files shouldn't be left after make distclean -DISTCLEANFILES+= ctaocrypt/src/fips.c -DISTCLEANFILES+= ctaocrypt/src/fips_test.c maintainer-clean-local: -rm Makefile.in diff --git a/autogen.sh b/autogen.sh index 89e475c0b..196764e1f 100755 --- a/autogen.sh +++ b/autogen.sh @@ -15,6 +15,9 @@ fi # If this is a source checkout then call autoreconf with error as well if test -d .git; then WARNINGS="all,error" + # touch fips files for non fips distribution + touch ./ctaocrypt/src/fips.c + touch ./ctaocrypt/src/fips_test.c else WARNINGS="all" fi diff --git a/configure.ac b/configure.ac index 0a5a27c50..0c505b85b 100644 --- a/configure.ac +++ b/configure.ac @@ -1902,6 +1902,7 @@ then if test "x$ENABLED_ECC" = "xno" then ENABLED_OPENSSLEXTRA="yes" + ENABLED_ECC="yes" AM_CFLAGS="$AM_CFLAGS -DHAVE_ECC -DTFM_ECC256 -DECC_SHAMIR" AM_CONDITIONAL([BUILD_ECC], [test "x$ENABLED_ECC" = "xyes"]) fi @@ -2318,11 +2319,6 @@ AC_OUTPUT echo "---" echo "Running make clean..." make clean >/dev/null 2>&1 -# Touch files that may not be in repository -echo "Touching File..." -touch ctaocrypt/src/fips.c -touch ctaocrypt/src/fips_test.c -echo # generate user options header echo "---" diff --git a/cyassl/ctaocrypt/settings_comp.h b/cyassl/ctaocrypt/settings_comp.h index 89278a2db..f1832c3f0 100644 --- a/cyassl/ctaocrypt/settings_comp.h +++ b/cyassl/ctaocrypt/settings_comp.h @@ -50,9 +50,22 @@ #if defined(NO_WOLFSSL_MEMORY) && !defined(NO_CYASSL_MEMORY) #define NO_CYASSL_MEMORY #endif -#ifdef WOLFSSL_KEY_GEN +#if defined(WOLFSSL_KEY_GEN) && !defined(CYASSL_KEY_GEN) #define CYASSL_KEY_GEN #endif +/* AES */ +#if defined(WOLFSSL_AES_DIRECT) && !defined(CYASSL_AES_DIRECT) + #define CYASSL_AES_DIRECT +#endif +#if defined(WOLFSSL_AES_COUNTER) && !defined(CYASSL_AES_COUNTER) + #define CYASSL_AES_COUNTER +#endif + +/* DES */ +#if defined(WOLFSSL_DES_ECB) && !defined(CYASSL_DES_ECB) + #define CYASSL_DES_ECB +#endif + #endif /* CTAO_CRYPT_SETTINGS_C_H */ diff --git a/examples/client/client.c b/examples/client/client.c index 1c665613f..fbb9cb979 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -146,6 +146,9 @@ static void Usage(void) DEFAULT_MIN_DHKEY_BITS); #endif printf("-b Benchmark connections and print stats\n"); +#ifdef HAVE_ALPN + printf("-L Application-Layer Protocole Name ({C,F}:)\n"); +#endif printf("-s Use pre Shared keys\n"); printf("-t Track wolfSSL memory use\n"); printf("-d Disable peer checks\n"); @@ -172,7 +175,7 @@ static void Usage(void) printf("-S Use Host Name Indication\n"); #endif #ifdef HAVE_MAX_FRAGMENT - printf("-L Use Maximum Fragment Length [1-5]\n"); + printf("-F Use Maximum Fragment Length [1-5]\n"); #endif #ifdef HAVE_TRUNCATED_HMAC printf("-T Use Truncated HMAC\n"); @@ -193,9 +196,6 @@ static void Usage(void) #ifdef HAVE_CRL printf("-C Disable CRL\n"); #endif -#ifdef HAVE_ALPN - printf("-n Application-Layer Protocole Name ({C,F}:)\n"); -#endif } THREAD_RETURN WOLFSSL_THREAD client_test(void* args) @@ -463,7 +463,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) #endif break; - case 'L' : + case 'F' : #ifdef HAVE_MAX_FRAGMENT maxFragment = atoi(myoptarg); if (maxFragment < WOLFSSL_MFL_2_9 || @@ -909,7 +909,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) printf("Received ALPN protocol : %s (%d)\n", protocol_name, protocol_nameSz); else if (err == SSL_ALPN_NOT_FOUND) - printf("Not received ALPN response (no match with server)\n"); + printf("No ALPN response received (no match with server)\n"); else printf("Getting ALPN protocol name failed\n"); } diff --git a/examples/echoclient/echoclient.c b/examples/echoclient/echoclient.c index 5757fb18d..e855999c1 100644 --- a/examples/echoclient/echoclient.c +++ b/examples/echoclient/echoclient.c @@ -22,28 +22,30 @@ #ifdef HAVE_CONFIG_H #include #endif - + #include /* let's use cyassl layer AND cyassl openssl layer */ #include #include -#if defined(WOLFSSL_MDK_ARM) +#if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #include #include - #if defined(WOLFSSL_MDK5) - #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" + #if defined(WOLFSSL_MDK5) || defined(WOLFSSL_KEIL_TCP_NET) + #include "cmsis_os.h" + #include "rl_net.h" #else #include "rtl.h" #endif - - #include "wolfssl_MDK_ARM.h" + #if defined(WOLFSSL_MDK_SHELL) + char * wolfssl_fgets ( char * str, int num, FILE * f ) ; + #define fgets wolfssl_fgets + #endif #endif + #include #include "examples/echoclient/echoclient.h" diff --git a/examples/server/server.c b/examples/server/server.c index 6ef02412d..014342af3 100644 --- a/examples/server/server.c +++ b/examples/server/server.c @@ -135,6 +135,9 @@ static void Usage(void) printf("-D Diffie-Hellman Params file, default %s\n", dhParam); printf("-Z Minimum DH key bits, default %d\n", DEFAULT_MIN_DHKEY_BITS); +#endif +#ifdef HAVE_ALPN + printf("-L Application-Layer Protocole Name ({C,F}:)\n"); #endif printf("-d Disable client cert check\n"); printf("-b Bind to any interface instead of localhost only\n"); @@ -161,9 +164,6 @@ static void Usage(void) #ifndef NO_PSK printf("-I Do not send PSK identity hint\n"); #endif -#ifdef HAVE_ALPN - printf("-L Application-Layer Protocole Name ({C,F}:)\n"); -#endif } THREAD_RETURN CYASSL_THREAD server_test(void* args) @@ -704,10 +704,10 @@ while (1) { /* allow resume option */ err = wolfSSL_ALPN_GetProtocol(ssl, &protocol_name, &protocol_nameSz); if (err == SSL_SUCCESS) - printf("Send ALPN protocol : %s (%d)\n", + printf("Sent ALPN protocol : %s (%d)\n", protocol_name, protocol_nameSz); else if (err == SSL_ALPN_NOT_FOUND) - printf("Not send ALPN response (no match with server)\n"); + printf("No ALPN response sent (no match)\n"); else printf("Getting ALPN protocol name failed\n"); } diff --git a/src/internal.c b/src/internal.c index 1b0391af9..0f20143de 100644 --- a/src/internal.c +++ b/src/internal.c @@ -2577,7 +2577,7 @@ ProtocolVersion MakeDTLSv1_2(void) word32 LowResTimer(void) { - NET_SECURE_OS_TICK clk; + NET_SECURE_OS_TICK clk = 0; #if (NET_SECURE_MGR_CFG_EN == DEF_ENABLED) clk = NetSecure_OS_TimeGet(); @@ -2679,6 +2679,7 @@ ProtocolVersion MakeDTLSv1_2(void) #endif /* USE_WINDOWS_API */ +#ifndef NO_CERTS static int HashOutputRaw(WOLFSSL* ssl, const byte* output, int sz) { #ifdef HAVE_FUZZER @@ -2716,6 +2717,7 @@ static int HashOutputRaw(WOLFSSL* ssl, const byte* output, int sz) return 0; } +#endif /* NO_CERTS */ /* add output to md5 and sha handshake hashes, exclude record header */ @@ -2886,6 +2888,7 @@ static void AddHeaders(byte* output, word32 length, byte type, WOLFSSL* ssl) } +#ifndef NO_CERTS static void AddFragHeaders(byte* output, word32 fragSz, word32 fragOffset, word32 length, byte type, WOLFSSL* ssl) { @@ -2903,6 +2906,7 @@ static void AddFragHeaders(byte* output, word32 fragSz, word32 fragOffset, AddRecordHeader(output, fragSz + lengthAdj, handshake, ssl); AddHandShakeHeader(output + outputAdj, length, fragOffset, fragSz, type, ssl); } +#endif /* NO_CERTS */ /* return bytes received, -1 on error */ @@ -5264,9 +5268,22 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx, word32 totalSz) { int ret = 0; + word32 inputLength; WOLFSSL_ENTER("DoHandShakeMsg()"); + if (ssl->arrays == NULL) { + byte type; + word32 size; + + if (GetHandShakeHeader(ssl,input,inOutIdx,&type, &size, totalSz) != 0) + return PARSE_ERROR; + + return DoHandShakeMsgType(ssl, input, inOutIdx, type, size, totalSz); + } + + inputLength = ssl->buffers.inputBuffer.length - *inOutIdx; + /* If there is a pending fragmented handshake message, * pending message size will be non-zero. */ if (ssl->arrays->pendingMsgSz == 0) { @@ -5285,7 +5302,7 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx, } /* size is the size of the certificate message payload */ - if (ssl->curSize < size) { + if (inputLength - HANDSHAKE_HEADER_SZ < size) { ssl->arrays->pendingMsgType = type; ssl->arrays->pendingMsgSz = size + HANDSHAKE_HEADER_SZ; ssl->arrays->pendingMsg = (byte*)XMALLOC(size + HANDSHAKE_HEADER_SZ, @@ -5294,25 +5311,26 @@ static int DoHandShakeMsg(WOLFSSL* ssl, byte* input, word32* inOutIdx, if (ssl->arrays->pendingMsg == NULL) return MEMORY_E; XMEMCPY(ssl->arrays->pendingMsg, - input + *inOutIdx - HANDSHAKE_HEADER_SZ, ssl->curSize); - ssl->arrays->pendingMsgOffset = ssl->curSize; - *inOutIdx += ssl->curSize - HANDSHAKE_HEADER_SZ; + input + *inOutIdx - HANDSHAKE_HEADER_SZ, + inputLength); + ssl->arrays->pendingMsgOffset = inputLength; + *inOutIdx += inputLength - HANDSHAKE_HEADER_SZ; return 0; } ret = DoHandShakeMsgType(ssl, input, inOutIdx, type, size, totalSz); } else { - if (ssl->curSize + ssl->arrays->pendingMsgOffset + if (inputLength + ssl->arrays->pendingMsgOffset > ssl->arrays->pendingMsgSz) { return BUFFER_ERROR; } else { XMEMCPY(ssl->arrays->pendingMsg + ssl->arrays->pendingMsgOffset, - input + *inOutIdx, ssl->curSize); - ssl->arrays->pendingMsgOffset += ssl->curSize; - *inOutIdx += ssl->curSize; + input + *inOutIdx, inputLength); + ssl->arrays->pendingMsgOffset += inputLength; + *inOutIdx += inputLength; } if (ssl->arrays->pendingMsgOffset == ssl->arrays->pendingMsgSz) diff --git a/src/io.c b/src/io.c index c78883836..3df6570b9 100644 --- a/src/io.c +++ b/src/io.c @@ -61,20 +61,15 @@ #include #elif defined(FREESCALE_KSDK_MQX) #include - #elif defined(WOLFSSL_MDK_ARM) - #if defined(WOLFSSL_MDK5) + #elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) + #if defined(WOLFSSL_MDK5) || defined(WOLFSSL_KEIL_TCP_NET) #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" #else #include #endif - #undef RNG - #include "WOLFSSL_MDK_ARM.h" - #undef RNG - #define RNG wolfSSL_RNG - /* for avoiding name conflict in "stm32f2xx.h" */ - static int errno; + #include "errno.h" + #define SOCKET_T int + #include "rl_net.h" #elif defined(WOLFSSL_TIRTOS) #include #elif defined(FREERTOS_TCP) @@ -157,8 +152,8 @@ #define SOCKET_ECONNREFUSED NIO_ECONNREFUSED #define SOCKET_ECONNABORTED NIO_ECONNABORTED #endif -#elif defined(WOLFSSL_MDK_ARM) - #if defined(WOLFSSL_MDK5) +#elif defined(WOLFSSL_MDK_ARM)|| defined(WOLFSSL_KEIL_TCP_NET) + #if defined(WOLFSSL_MDK5)|| defined(WOLFSSL_KEIL_TCP_NET) #define SOCKET_EWOULDBLOCK BSD_ERROR_WOULDBLOCK #define SOCKET_EAGAIN BSD_ERROR_LOCKED #define SOCKET_ECONNRESET BSD_ERROR_CLOSED diff --git a/src/ssl.c b/src/ssl.c index 6410aa3d0..e96705102 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -2349,7 +2349,8 @@ static int wolfssl_decrypt_buffer_key(buffer* der, byte* password, #endif return SSL_FATAL_ERROR; } - +#else + (void) passwordSz; #endif /* NO_MD5 */ #ifndef NO_DES3 @@ -2425,7 +2426,8 @@ static int wolfssl_encrypt_buffer_key(byte* der, word32 derSz, byte* password, #endif return SSL_FATAL_ERROR; } - +#else + (void) passwordSz; #endif /* NO_MD5 */ #ifndef NO_DES3 @@ -3562,13 +3564,6 @@ int wolfSSL_CTX_SetOCSP_Cb(WOLFSSL_CTX* ctx, CbOCSPIO ioCb, #ifndef NO_FILESYSTEM - #if defined(WOLFSSL_MDK_ARM) - extern FILE * wolfSSL_fopen(const char *name, const char *mode) ; - #define XFOPEN wolfSSL_fopen - #else - #define XFOPEN fopen - #endif - /* process a file with name fname into ctx of format and type userChain specifies a user certificate chain to pass during handshake */ int ProcessFile(WOLFSSL_CTX* ctx, const char* fname, int format, int type, @@ -7648,7 +7643,7 @@ int wolfSSL_set_compression(WOLFSSL* ssl) #ifdef USE_WINDOWS_API #define CloseSocket(s) closesocket(s) -#elif defined(WOLFSSL_MDK_ARM) +#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #define CloseSocket(s) closesocket(s) extern int closesocket(int) ; #else diff --git a/src/tls.c b/src/tls.c index cece0696c..4c7683fc5 100644 --- a/src/tls.c +++ b/src/tls.c @@ -567,7 +567,7 @@ static INLINE void ato16(const byte* c, word16* u16) *u16 = (c[0] << 8) | (c[1]); } -#ifdef HAVE_SNI +#if defined(HAVE_SNI) && !defined(NO_WOLFSSL_SERVER) /* convert a 24 bit integer into a 32 bit one */ static INLINE void c24to32(const word24 u24, word32* u32) { @@ -1282,6 +1282,8 @@ static word16 TLSX_SNI_Write(SNI* list, byte* output) return offset; } +#ifndef NO_WOLFSSL_SERVER + /** Finds a SNI object in the provided list. */ static SNI* TLSX_SNI_Find(SNI *list, byte type) { @@ -1293,7 +1295,6 @@ static SNI* TLSX_SNI_Find(SNI *list, byte type) return sni; } -#ifndef NO_WOLFSSL_SERVER /** Sets the status of a SNI object. */ static void TLSX_SNI_SetStatus(TLSX* extensions, byte type, byte status) @@ -1334,7 +1335,8 @@ static int TLSX_SNI_Parse(WOLFSSL* ssl, byte* input, word16 length, if (!extension) extension = TLSX_Find(ssl->ctx->extensions, SERVER_NAME_INDICATION); - + (void)isRequest; + (void)input; if (!extension || !extension->data) { #if defined(WOLFSSL_ALWAYS_KEEP_SNI) && !defined(NO_WOLFSSL_SERVER) @@ -1429,6 +1431,8 @@ static int TLSX_SNI_Parse(WOLFSSL* ssl, byte* input, word16 length, static int TLSX_SNI_VerifyParse(WOLFSSL* ssl, byte isRequest) { + (void)ssl; + if (isRequest) { #ifndef NO_WOLFSSL_SERVER TLSX* ctx_ext = TLSX_Find(ssl->ctx->extensions, SERVER_NAME_INDICATION); @@ -1721,6 +1725,8 @@ static word16 TLSX_MFL_Write(byte* data, byte* output) static int TLSX_MFL_Parse(WOLFSSL* ssl, byte* input, word16 length, byte isRequest) { + (void)isRequest; + if (length != ENUM_LEN) return BUFFER_ERROR; @@ -1795,6 +1801,8 @@ int TLSX_UseMaxFragment(TLSX** extensions, byte mfl) static int TLSX_THM_Parse(WOLFSSL* ssl, byte* input, word16 length, byte isRequest) { + (void)isRequest; + if (length != 0 || input == NULL) return BUFFER_ERROR; diff --git a/testsuite/testsuite.c b/testsuite/testsuite.c index dc756377c..c0304e324 100644 --- a/testsuite/testsuite.c +++ b/testsuite/testsuite.c @@ -29,6 +29,25 @@ #include #include "wolfcrypt/test/test.h" +/* This function changes the current directory to the wolfssl root */ +static void ChangeDirToRoot(void) +{ + /* Normal Command Line=_build, Visual Studio=testsuite */ + if (CurrentDir("testsuite") || CurrentDir("_build")) { + ChangeDirBack(1); + } + + /* Xcode: To output application to correct location: */ + /* 1. Xcode->Preferences->Locations->Locations */ + /* 2. Derived Data Advanced -> Custom */ + /* 3. Relative to Workspace, Build/Products */ + /* Build/Products/Debug or Build/Products/Release */ + else if (CurrentDir("Debug") || CurrentDir("Release")) { + ChangeDirBack(5); + } +} + + #ifndef SINGLE_THREADED #include @@ -53,7 +72,6 @@ static const char *outputName; int myoptind = 0; char* myoptarg = NULL; - #ifndef NO_TESTSUITE_MAIN_DRIVER static int testsuite_test(int argc, char** argv); @@ -100,13 +118,7 @@ int testsuite_test(int argc, char** argv) #endif #if !defined(WOLFSSL_TIRTOS) - if (CurrentDir("testsuite") || CurrentDir("_build")) - ChangeDirBack(1); - else if (CurrentDir("Debug") || CurrentDir("Release")) - ChangeDirBack(3); /* Xcode->Preferences->Locations->Locations*/ - /* Derived Data Advanced -> Custom */ - /* Relative to Workspace, Build/Products */ - /* Debug or Release */ + ChangeDirToRoot(); #endif #ifdef WOLFSSL_TIRTOS @@ -382,6 +394,7 @@ void file_test(const char* file, byte* check) ret = wc_Sha256Update(&sha256, buf, i); if (ret != 0) { printf("Can't wc_Sha256Update %d\n", ret); + fclose(f); return; } } @@ -389,6 +402,7 @@ void file_test(const char* file, byte* check) ret = wc_Sha256Final(&sha256, shasum); if (ret != 0) { printf("Can't wc_Sha256Final %d\n", ret); + fclose(f); return; } @@ -417,13 +431,7 @@ int main(int argc, char** argv) server_args.argc = argc; server_args.argv = argv; - if (CurrentDir("testsuite") || CurrentDir("_build")) - ChangeDirBack(1); - else if (CurrentDir("Debug") || CurrentDir("Release")) - ChangeDirBack(3); /* Xcode->Preferences->Locations->Locations*/ - /* Derived Data Advanced -> Custom */ - /* Relative to Workspace, Build/Products */ - /* Debug or Release */ + ChangeDirToRoot(); wolfcrypt_test(&server_args); if (server_args.return_code != 0) return server_args.return_code; diff --git a/wolfcrypt/src/aes.c b/wolfcrypt/src/aes.c index 9487132d0..0550d6118 100644 --- a/wolfcrypt/src/aes.c +++ b/wolfcrypt/src/aes.c @@ -217,6 +217,25 @@ void wc_AesFreeCavium(Aes* aes) * Guide (See note in README). * NOTE: no support for AES-CTR */ #include "cau_api.h" + + static int wc_AesEncrypt(Aes* aes, const byte* inBlock, byte* outBlock) + { + int ret = wolfSSL_CryptHwMutexLock(); + if(ret == 0) { + cau_aes_encrypt(inBlock, (byte*)aes->key, aes->rounds, outBlock); + wolfSSL_CryptHwMutexUnLock(); + } + return ret; + } + static int wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock) + { + int ret = wolfSSL_CryptHwMutexLock(); + if(ret == 0) { + cau_aes_decrypt(inBlock, (byte*)aes->key, aes->rounds, outBlock); + wolfSSL_CryptHwMutexUnLock(); + } + return ret; + } #elif defined(WOLFSSL_PIC32MZ_CRYPT) /* NOTE: no support for AES-CCM/Direct */ #define DEBUG_WOLFSSL @@ -1490,6 +1509,7 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock) int wc_AesSetKey(Aes* aes, const byte* userKey, word32 keylen, const byte* iv, int dir) { + int ret; byte *rk = (byte*)aes->key; if (!((keylen == 16) || (keylen == 24) || (keylen == 32))) @@ -1499,9 +1519,16 @@ static void wc_AesDecrypt(Aes* aes, const byte* inBlock, byte* outBlock) return BAD_FUNC_ARG; aes->rounds = keylen/4 + 6; - cau_aes_set_key(userKey, keylen*8, rk); - - return wc_AesSetIV(aes, iv); + + ret = wolfSSL_CryptHwMutexLock(); + if(ret == 0) { + cau_aes_set_key(userKey, keylen*8, rk); + wolfSSL_CryptHwMutexUnLock(); + + ret = wc_AesSetIV(aes, iv); + } + + return ret; } int wc_AesSetKeyDirect(Aes* aes, const byte* userKey, word32 keylen, @@ -1724,27 +1751,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv) /* AES-DIRECT */ #if defined(WOLFSSL_AES_DIRECT) - #if defined(FREESCALE_MMCAU) - - /* Allow direct access to one block encrypt */ - void wc_AesEncryptDirect(Aes* aes, byte* out, const byte* in) - { - byte* key; - key = (byte*)aes->key; - - return cau_aes_encrypt(in, key, aes->rounds, out); - } - - /* Allow direct access to one block decrypt */ - void wc_AesDecryptDirect(Aes* aes, byte* out, const byte* in) - { - byte* key; - key = (byte*)aes->key; - - return cau_aes_decrypt(in, key, aes->rounds, out); - } - - #elif defined(STM32F2_CRYPTO) + #if defined(STM32F2_CRYPTO) #error "STM32F2 crypto doesn't yet support AES direct" #elif defined(HAVE_COLDFIRE_SEC) @@ -1766,7 +1773,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv) wc_AesDecrypt(aes, in, out); } - #endif /* FREESCALE_MMCAU, AES direct block */ + #endif /* AES direct block */ #endif /* WOLFSSL_AES_DIRECT */ @@ -2109,11 +2116,10 @@ int wc_AesSetIV(Aes* aes, const byte* iv) int offset = 0; int len = sz; - byte *iv, *enc_key; + byte *iv; byte temp_block[AES_BLOCK_SIZE]; iv = (byte*)aes->reg; - enc_key = (byte*)aes->key; if ((wolfssl_word)out % WOLFSSL_MMCAU_ALIGNMENT) { WOLFSSL_MSG("Bad cau_aes_encrypt alignment"); @@ -2128,7 +2134,7 @@ int wc_AesSetIV(Aes* aes, const byte* iv) for (i = 0; i < AES_BLOCK_SIZE; i++) temp_block[i] ^= iv[i]; - cau_aes_encrypt(temp_block, enc_key, aes->rounds, out + offset); + wc_AesEncrypt(aes, temp_block, out + offset); len -= AES_BLOCK_SIZE; offset += AES_BLOCK_SIZE; @@ -2146,11 +2152,10 @@ int wc_AesSetIV(Aes* aes, const byte* iv) int offset = 0; int len = sz; - byte* iv, *dec_key; + byte* iv; byte temp_block[AES_BLOCK_SIZE]; iv = (byte*)aes->reg; - dec_key = (byte*)aes->key; if ((wolfssl_word)out % WOLFSSL_MMCAU_ALIGNMENT) { WOLFSSL_MSG("Bad cau_aes_decrypt alignment"); @@ -2161,8 +2166,8 @@ int wc_AesSetIV(Aes* aes, const byte* iv) { XMEMCPY(temp_block, in + offset, AES_BLOCK_SIZE); - cau_aes_decrypt(in + offset, dec_key, aes->rounds, out + offset); - + wc_AesEncrypt(aes, in + offset, out + offset); + /* XOR block with IV for CBC */ for (i = 0; i < AES_BLOCK_SIZE; i++) (out + offset)[i] ^= iv[i]; @@ -2741,10 +2746,6 @@ int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len) int ret; byte iv[AES_BLOCK_SIZE]; - #ifdef FREESCALE_MMCAU - byte* rk = (byte*)aes->key; - #endif - if (!((len == 16) || (len == 24) || (len == 32))) return BAD_FUNC_ARG; @@ -2752,11 +2753,7 @@ int wc_AesGcmSetKey(Aes* aes, const byte* key, word32 len) ret = wc_AesSetKey(aes, key, len, iv, AES_ENCRYPTION); if (ret == 0) { - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(iv, rk, aes->rounds, aes->H); - #else wc_AesEncrypt(aes, iv, aes->H); - #endif #ifdef GCM_TABLE GenerateM0(aes); #endif /* GCM_TABLE */ @@ -3282,10 +3279,6 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz, byte *ctr ; byte scratch[AES_BLOCK_SIZE]; -#ifdef FREESCALE_MMCAU - byte* key = (byte*)aes->key; -#endif - WOLFSSL_ENTER("AesGcmEncrypt"); #ifdef WOLFSSL_PIC32MZ_CRYPT @@ -3306,13 +3299,9 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz, while (blocks--) { IncrementGcmCounter(ctr); #ifndef WOLFSSL_PIC32MZ_CRYPT - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(ctr, key, aes->rounds, scratch); - #else - wc_AesEncrypt(aes, ctr, scratch); - #endif - xorbuf(scratch, p, AES_BLOCK_SIZE); - XMEMCPY(c, scratch, AES_BLOCK_SIZE); + wc_AesEncrypt(aes, ctr, scratch); + xorbuf(scratch, p, AES_BLOCK_SIZE); + XMEMCPY(c, scratch, AES_BLOCK_SIZE); #endif p += AES_BLOCK_SIZE; c += AES_BLOCK_SIZE; @@ -3320,11 +3309,7 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz, if (partial != 0) { IncrementGcmCounter(ctr); - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(ctr, key, aes->rounds, scratch); - #else - wc_AesEncrypt(aes, ctr, scratch); - #endif + wc_AesEncrypt(aes, ctr, scratch); xorbuf(scratch, p, partial); XMEMCPY(c, scratch, partial); @@ -3332,11 +3317,7 @@ int wc_AesGcmEncrypt(Aes* aes, byte* out, const byte* in, word32 sz, GHASH(aes, authIn, authInSz, out, sz, authTag, authTagSz); InitGcmCounter(ctr); - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(ctr, key, aes->rounds, scratch); - #else - wc_AesEncrypt(aes, ctr, scratch); - #endif + wc_AesEncrypt(aes, ctr, scratch); xorbuf(authTag, scratch, authTagSz); return 0; @@ -3356,10 +3337,6 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz, byte *ctr ; byte scratch[AES_BLOCK_SIZE]; -#ifdef FREESCALE_MMCAU - byte* key = (byte*)aes->key; -#endif - WOLFSSL_ENTER("AesGcmDecrypt"); #ifdef WOLFSSL_PIC32MZ_CRYPT @@ -3379,11 +3356,7 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz, byte EKY0[AES_BLOCK_SIZE]; GHASH(aes, authIn, authInSz, in, sz, Tprime, sizeof(Tprime)); - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(ctr, key, aes->rounds, EKY0); - #else - wc_AesEncrypt(aes, ctr, EKY0); - #endif + wc_AesEncrypt(aes, ctr, EKY0); xorbuf(Tprime, EKY0, sizeof(Tprime)); if (ConstantCompare(authTag, Tprime, authTagSz) != 0) { @@ -3400,24 +3373,16 @@ int wc_AesGcmDecrypt(Aes* aes, byte* out, const byte* in, word32 sz, while (blocks--) { IncrementGcmCounter(ctr); #ifndef WOLFSSL_PIC32MZ_CRYPT - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(ctr, key, aes->rounds, scratch); - #else - wc_AesEncrypt(aes, ctr, scratch); - #endif - xorbuf(scratch, c, AES_BLOCK_SIZE); - XMEMCPY(p, scratch, AES_BLOCK_SIZE); + wc_AesEncrypt(aes, ctr, scratch); + xorbuf(scratch, c, AES_BLOCK_SIZE); + XMEMCPY(p, scratch, AES_BLOCK_SIZE); #endif p += AES_BLOCK_SIZE; c += AES_BLOCK_SIZE; } if (partial != 0) { IncrementGcmCounter(ctr); - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(ctr, key, aes->rounds, scratch); - #else - wc_AesEncrypt(aes, ctr, scratch); - #endif + wc_AesEncrypt(aes, ctr, scratch); xorbuf(scratch, c, partial); XMEMCPY(p, scratch, partial); } @@ -3470,31 +3435,19 @@ void wc_AesCcmSetKey(Aes* aes, const byte* key, word32 keySz) static void roll_x(Aes* aes, const byte* in, word32 inSz, byte* out) { - #ifdef FREESCALE_MMCAU - byte* key = (byte*)aes->key; - #endif - /* process the bulk of the data */ while (inSz >= AES_BLOCK_SIZE) { xorbuf(out, in, AES_BLOCK_SIZE); in += AES_BLOCK_SIZE; inSz -= AES_BLOCK_SIZE; - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(out, key, aes->rounds, out); - #else - wc_AesEncrypt(aes, out, out); - #endif + wc_AesEncrypt(aes, out, out); } /* process remainder of the data */ if (inSz > 0) { xorbuf(out, in, inSz); - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(out, key, aes->rounds, out); - #else - wc_AesEncrypt(aes, out, out); - #endif + wc_AesEncrypt(aes, out, out); } } @@ -3504,10 +3457,6 @@ static void roll_auth(Aes* aes, const byte* in, word32 inSz, byte* out) word32 authLenSz; word32 remainder; - #ifdef FREESCALE_MMCAU - byte* key = (byte*)aes->key; - #endif - /* encode the length in */ if (inSz <= 0xFEFF) { authLenSz = 2; @@ -3541,11 +3490,7 @@ static void roll_auth(Aes* aes, const byte* in, word32 inSz, byte* out) xorbuf(out + authLenSz, in, inSz); inSz = 0; } - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(out, key, aes->rounds, out); - #else - wc_AesEncrypt(aes, out, out); - #endif + wc_AesEncrypt(aes, out, out); if (inSz > 0) roll_x(aes, in, inSz, out); @@ -3575,19 +3520,11 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, byte mask = 0xFF; word32 wordSz = (word32)sizeof(word32); - #ifdef FREESCALE_MMCAU - byte* key; - #endif - /* sanity check on arugments */ if (aes == NULL || out == NULL || in == NULL || nonce == NULL || authTag == NULL || nonceSz < 7 || nonceSz > 13) return BAD_FUNC_ARG; - #ifdef FREESCALE_MMCAU - key = (byte*)aes->key; - #endif - XMEMCPY(B+1, nonce, nonceSz); lenSz = AES_BLOCK_SIZE - 1 - (byte)nonceSz; B[0] = (authInSz > 0 ? 64 : 0) @@ -3599,11 +3536,8 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, B[AES_BLOCK_SIZE - 1 - i] = (inSz >> ((8 * i) & mask)) & mask; } - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(B, key, aes->rounds, A); - #else - wc_AesEncrypt(aes, B, A); - #endif + wc_AesEncrypt(aes, B, A); + if (authInSz > 0) roll_auth(aes, authIn, authInSz, A); if (inSz > 0) @@ -3613,20 +3547,12 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, B[0] = lenSz - 1; for (i = 0; i < lenSz; i++) B[AES_BLOCK_SIZE - 1 - i] = 0; - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(B, key, aes->rounds, A); - #else - wc_AesEncrypt(aes, B, A); - #endif + wc_AesEncrypt(aes, B, A); xorbuf(authTag, A, authTagSz); B[15] = 1; while (inSz >= AES_BLOCK_SIZE) { - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(B, key, aes->rounds, A); - #else - wc_AesEncrypt(aes, B, A); - #endif + wc_AesEncrypt(aes, B, A); xorbuf(A, in, AES_BLOCK_SIZE); XMEMCPY(out, A, AES_BLOCK_SIZE); @@ -3636,11 +3562,7 @@ int wc_AesCcmEncrypt(Aes* aes, byte* out, const byte* in, word32 inSz, out += AES_BLOCK_SIZE; } if (inSz > 0) { - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(B, key, aes->rounds, A); - #else - wc_AesEncrypt(aes, B, A); - #endif + wc_AesEncrypt(aes, B, A); xorbuf(A, in, inSz); XMEMCPY(out, A, inSz); } @@ -3666,19 +3588,11 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz, byte mask = 0xFF; word32 wordSz = (word32)sizeof(word32); - #ifdef FREESCALE_MMCAU - byte* key; - #endif - /* sanity check on arugments */ if (aes == NULL || out == NULL || in == NULL || nonce == NULL || authTag == NULL || nonceSz < 7 || nonceSz > 13) return BAD_FUNC_ARG; - #ifdef FREESCALE_MMCAU - key = (byte*)aes->key; - #endif - o = out; oSz = inSz; XMEMCPY(B+1, nonce, nonceSz); @@ -3690,11 +3604,7 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz, B[15] = 1; while (oSz >= AES_BLOCK_SIZE) { - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(B, key, aes->rounds, A); - #else - wc_AesEncrypt(aes, B, A); - #endif + wc_AesEncrypt(aes, B, A); xorbuf(A, in, AES_BLOCK_SIZE); XMEMCPY(o, A, AES_BLOCK_SIZE); @@ -3704,22 +3614,14 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz, o += AES_BLOCK_SIZE; } if (inSz > 0) { - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(B, key, aes->rounds, A); - #else - wc_AesEncrypt(aes, B, A); - #endif + wc_AesEncrypt(aes, B, A); xorbuf(A, in, oSz); XMEMCPY(o, A, oSz); } for (i = 0; i < lenSz; i++) B[AES_BLOCK_SIZE - 1 - i] = 0; - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(B, key, aes->rounds, A); - #else - wc_AesEncrypt(aes, B, A); - #endif + wc_AesEncrypt(aes, B, A); o = out; oSz = inSz; @@ -3733,11 +3635,8 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz, B[AES_BLOCK_SIZE - 1 - i] = (inSz >> ((8 * i) & mask)) & mask; } - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(B, key, aes->rounds, A); - #else - wc_AesEncrypt(aes, B, A); - #endif + wc_AesEncrypt(aes, B, A); + if (authInSz > 0) roll_auth(aes, authIn, authInSz, A); if (inSz > 0) @@ -3746,11 +3645,7 @@ int wc_AesCcmDecrypt(Aes* aes, byte* out, const byte* in, word32 inSz, B[0] = lenSz - 1; for (i = 0; i < lenSz; i++) B[AES_BLOCK_SIZE - 1 - i] = 0; - #ifdef FREESCALE_MMCAU - cau_aes_encrypt(B, key, aes->rounds, B); - #else - wc_AesEncrypt(aes, B, B); - #endif + wc_AesEncrypt(aes, B, B); xorbuf(A, B, authTagSz); if (ConstantCompare(A, authTag, authTagSz) != 0) { diff --git a/wolfcrypt/src/asn.c b/wolfcrypt/src/asn.c index 0b41d5d58..5eeae21d4 100644 --- a/wolfcrypt/src/asn.c +++ b/wolfcrypt/src/asn.c @@ -8100,6 +8100,10 @@ int wc_EccPrivateKeyDecode(const byte* input, word32* inOutIdx, ecc_key* key, else if (GetLength(input, inOutIdx, &length, inSz) < 0) { ret = ASN_PARSE_E; } + else if (length <= 0) { + /* pubkey needs some size */ + ret = ASN_INPUT_E; + } else { b = input[*inOutIdx]; *inOutIdx += 1; diff --git a/wolfcrypt/src/des3.c b/wolfcrypt/src/des3.c index 423afb4a0..e1199ef13 100644 --- a/wolfcrypt/src/des3.c +++ b/wolfcrypt/src/des3.c @@ -654,6 +654,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir) int i; int offset = 0; int len = sz; + int ret = 0; byte *iv; byte temp_block[DES_BLOCK_SIZE]; @@ -672,7 +673,12 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir) for (i = 0; i < DES_BLOCK_SIZE; i++) temp_block[i] ^= iv[i]; + ret = wolfSSL_CryptHwMutexLock(); + if(ret != 0) { + return ret; + } cau_des_encrypt(temp_block, (byte*)des->key, out + offset); + wolfSSL_CryptHwMutexUnLock(); len -= DES_BLOCK_SIZE; offset += DES_BLOCK_SIZE; @@ -681,7 +687,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir) XMEMCPY(iv, out + offset - DES_BLOCK_SIZE, DES_BLOCK_SIZE); } - return 0; + return ret; } int wc_Des_CbcDecrypt(Des* des, byte* out, const byte* in, word32 sz) @@ -689,6 +695,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir) int i; int offset = 0; int len = sz; + int ret = 0; byte* iv; byte temp_block[DES_BLOCK_SIZE]; @@ -703,7 +710,12 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir) { XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE); + ret = wolfSSL_CryptHwMutexLock(); + if(ret != 0) { + return ret; + } cau_des_decrypt(in + offset, (byte*)des->key, out + offset); + wolfSSL_CryptHwMutexUnLock(); /* XOR block with IV for CBC */ for (i = 0; i < DES_BLOCK_SIZE; i++) @@ -716,7 +728,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir) offset += DES_BLOCK_SIZE; } - return 0; + return ret; } int wc_Des3_CbcEncrypt(Des3* des, byte* out, const byte* in, word32 sz) @@ -724,6 +736,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir) int i; int offset = 0; int len = sz; + int ret = 0; byte *iv; byte temp_block[DES_BLOCK_SIZE]; @@ -743,9 +756,14 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir) for (i = 0; i < DES_BLOCK_SIZE; i++) temp_block[i] ^= iv[i]; + ret = wolfSSL_CryptHwMutexLock(); + if(ret != 0) { + return ret; + } cau_des_encrypt(temp_block , (byte*)des->key[0], out + offset); cau_des_decrypt(out + offset, (byte*)des->key[1], out + offset); cau_des_encrypt(out + offset, (byte*)des->key[2], out + offset); + wolfSSL_CryptHwMutexUnLock(); len -= DES_BLOCK_SIZE; offset += DES_BLOCK_SIZE; @@ -754,7 +772,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir) XMEMCPY(iv, out + offset - DES_BLOCK_SIZE, DES_BLOCK_SIZE); } - return 0; + return ret; } int wc_Des3_CbcDecrypt(Des3* des, byte* out, const byte* in, word32 sz) @@ -762,6 +780,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir) int i; int offset = 0; int len = sz; + int ret = 0; byte* iv; byte temp_block[DES_BLOCK_SIZE]; @@ -777,9 +796,14 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir) { XMEMCPY(temp_block, in + offset, DES_BLOCK_SIZE); + ret = wolfSSL_CryptHwMutexLock(); + if(ret != 0) { + return ret; + } cau_des_decrypt(in + offset , (byte*)des->key[2], out + offset); cau_des_encrypt(out + offset, (byte*)des->key[1], out + offset); cau_des_decrypt(out + offset, (byte*)des->key[0], out + offset); + wolfSSL_CryptHwMutexUnLock(); /* XOR block with IV for CBC */ for (i = 0; i < DES_BLOCK_SIZE; i++) @@ -792,7 +816,7 @@ int wc_Des3_SetKey(Des3* des3, const byte* key, const byte* iv, int dir) offset += DES_BLOCK_SIZE; } - return 0; + return ret; } diff --git a/wolfcrypt/src/md5.c b/wolfcrypt/src/md5.c index fbf732add..5d1339a8f 100644 --- a/wolfcrypt/src/md5.c +++ b/wolfcrypt/src/md5.c @@ -49,7 +49,7 @@ #ifdef FREESCALE_MMCAU #include "cau_api.h" - #define XTRANSFORM(S,B) cau_md5_hash_n((B), 1, (unsigned char*)(S)->digest) + #define XTRANSFORM(S,B) Transform((S), (B)) #else #define XTRANSFORM(S,B) Transform((S)) #endif @@ -192,6 +192,18 @@ void wc_InitMd5(Md5* md5) md5->hiLen = 0; } +#ifdef FREESCALE_MMCAU +static int Transform(Md5* md5, byte* data) +{ + int ret = wolfSSL_CryptHwMutexLock(); + if(ret == 0) { + cau_md5_hash_n(data, 1, (unsigned char*)md5->digest); + wolfSSL_CryptHwMutexUnLock(); + } + return ret; +} +#endif /* FREESCALE_MMCAU */ + #ifndef FREESCALE_MMCAU static void Transform(Md5* md5) diff --git a/wolfcrypt/src/sha.c b/wolfcrypt/src/sha.c index 984d7343d..bde6376c8 100644 --- a/wolfcrypt/src/sha.c +++ b/wolfcrypt/src/sha.c @@ -72,7 +72,7 @@ #ifdef FREESCALE_MMCAU #include "cau_api.h" - #define XTRANSFORM(S,B) cau_sha1_hash_n((B), 1, ((S))->digest) + #define XTRANSFORM(S,B) Transform((S), (B)) #else #define XTRANSFORM(S,B) Transform((S)) #endif @@ -210,8 +210,14 @@ int wc_ShaFinal(Sha* sha, byte* hash) int wc_InitSha(Sha* sha) { + int ret = 0; #ifdef FREESCALE_MMCAU + ret = wolfSSL_CryptHwMutexLock(); + if(ret != 0) { + return ret; + } cau_sha1_initialize_output(sha->digest); + wolfSSL_CryptHwMutexUnLock(); #else sha->digest[0] = 0x67452301L; sha->digest[1] = 0xEFCDAB89L; @@ -224,9 +230,21 @@ int wc_InitSha(Sha* sha) sha->loLen = 0; sha->hiLen = 0; - return 0; + return ret; } +#ifdef FREESCALE_MMCAU +static int Transform(Sha* sha, byte* data) +{ + int ret = wolfSSL_CryptHwMutexLock(); + if(ret == 0) { + cau_sha1_hash_n(data, 1, sha->digest); + wolfSSL_CryptHwMutexUnLock(); + } + return ret; +} +#endif /* FREESCALE_MMCAU */ + #ifndef FREESCALE_MMCAU #define blk0(i) (W[i] = sha->buffer[i]) diff --git a/wolfcrypt/src/sha256.c b/wolfcrypt/src/sha256.c index 3dc1f4a8e..2cdad7d88 100644 --- a/wolfcrypt/src/sha256.c +++ b/wolfcrypt/src/sha256.c @@ -301,8 +301,14 @@ static void set_Transform(void) { int wc_InitSha256(Sha256* sha256) { + int ret = 0; #ifdef FREESCALE_MMCAU + ret = wolfSSL_CryptHwMutexLock(); + if(ret != 0) { + return ret; + } cau_sha256_initialize_output(sha256->digest); + wolfSSL_CryptHwMutexUnLock(); #else sha256->digest[0] = 0x6A09E667L; sha256->digest[1] = 0xBB67AE85L; @@ -322,7 +328,7 @@ int wc_InitSha256(Sha256* sha256) set_Transform() ; /* choose best Transform function under this runtime environment */ #endif - return 0; + return ret; } @@ -349,9 +355,12 @@ static const ALIGN32 word32 K[64] = { static int Transform(Sha256* sha256, byte* buf) { - cau_sha256_hash_n(buf, 1, sha256->digest); - - return 0; + int ret = wolfSSL_CryptHwMutexLock(); + if(ret == 0) { + cau_sha256_hash_n(buf, 1, sha256->digest); + wolfSSL_CryptHwMutexUnLock(); + } + return ret; } #endif /* FREESCALE_MMCAU */ diff --git a/wolfcrypt/src/wc_port.c b/wolfcrypt/src/wc_port.c index 72a014065..8a6d7513a 100644 --- a/wolfcrypt/src/wc_port.c +++ b/wolfcrypt/src/wc_port.c @@ -34,6 +34,44 @@ #endif +#if WOLFSSL_CRYPT_HW_MUTEX +/* Mutex for protection of cryptograpghy hardware */ +static wolfSSL_Mutex wcCryptHwMutex; +static int wcCryptHwMutexInit = 0; + +int wolfSSL_CryptHwMutexInit(void) { + int ret = 0; + if(wcCryptHwMutexInit == 0) { + ret = InitMutex(&wcCryptHwMutex); + if(ret == 0) { + wcCryptHwMutexInit = 1; + } + } + return ret; +} + +int wolfSSL_CryptHwMutexLock(void) { + int ret = BAD_MUTEX_E; + + /* Make sure HW Mutex has been initialized */ + wolfSSL_CryptHwMutexInit(); + + if(wcCryptHwMutexInit) { + ret = LockMutex(&wcCryptHwMutex); + } + return ret; +} + +int wolfSSL_CryptHwMutexUnLock(void) { + int ret = BAD_MUTEX_E; + + if(wcCryptHwMutexInit) { + ret = UnLockMutex(&wcCryptHwMutex); + } + return ret; +} +#endif /* WOLFSSL_CRYPT_HW_MUTEX */ + #ifdef SINGLE_THREADED diff --git a/wolfcrypt/test/test.c b/wolfcrypt/test/test.c index e3e89a73e..f804e6d9f 100644 --- a/wolfcrypt/test/test.c +++ b/wolfcrypt/test/test.c @@ -4447,6 +4447,7 @@ int rsa_test(void) free(derCert); free(pem); free(tmp); + fclose(pemFile); wc_FreeRsaKey(&caKey); return -415; } diff --git a/wolfssl/test.h b/wolfssl/test.h index f0196a323..248f0ce18 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -32,8 +32,27 @@ #endif #define SOCKET_T SOCKET #define SNPRINTF _snprintf -#elif defined(WOLFSSL_MDK_ARM) +#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #include + #include "rl_net.h" + #define SOCKET_T int + typedef int socklen_t ; + static unsigned long inet_addr(const char *cp) + { + unsigned int a[4] ; unsigned long ret ; + sscanf(cp, "%d.%d.%d.%d", &a[0], &a[1], &a[2], &a[3]) ; + ret = ((a[3]<<24) + (a[2]<<16) + (a[1]<<8) + a[0]) ; + return(ret) ; + } + #if defined(HAVE_KEIL_RTX) + #define sleep(t) os_dly_wait(t/1000+1) ; + #elif defined (WOLFSSL_CMSIS_RTOS) + #define sleep(t) osDelay(t/1000+1) ; + #endif + + static int wolfssl_tcp_select(int sd, int timeout) + { return 0 ; } + #define tcp_select(sd,t) wolfssl_tcp_select(sd, t) /* avoid conflicting Keil TCP tcp_select */ #elif defined(WOLFSSL_TIRTOS) #include #include @@ -109,8 +128,8 @@ /* HPUX doesn't use socklent_t for third parameter to accept, unless _XOPEN_SOURCE_EXTENDED is defined */ -#if !defined(__hpux__) && !defined(WOLFSSL_MDK_ARM) && \ - !defined(WOLFSSL_IAR_ARM) && !defined(WOLFSSL_ROWLEY_ARM) +#if !defined(__hpux__) && !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_IAR_ARM)\ + && !defined(WOLFSSL_ROWLEY_ARM) && !defined(WOLFSSL_KEIL_TCP_NET) typedef socklen_t* ACCEPT_THIRD_T; #else #if defined _XOPEN_SOURCE_EXTENDED @@ -124,12 +143,12 @@ #ifdef USE_WINDOWS_API #define CloseSocket(s) closesocket(s) #define StartTCP() { WSADATA wsd; WSAStartup(0x0002, &wsd); } -#elif defined(WOLFSSL_MDK_ARM) +#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) #define CloseSocket(s) closesocket(s) - #define StartTCP() + #define StartTCP() #else #define CloseSocket(s) close(s) - #define StartTCP() + #define StartTCP() #endif @@ -144,7 +163,7 @@ #define WOLFSSL_THREAD #define INFINITE -1 #define WAIT_OBJECT_0 0L - #elif defined(WOLFSSL_MDK_ARM) + #elif defined(WOLFSSL_MDK_ARM)|| defined(WOLFSSL_KEIL_TCP_NET) typedef unsigned int THREAD_RETURN; typedef int THREAD_TYPE; #define WOLFSSL_THREAD @@ -182,6 +201,21 @@ #endif /* all certs relative to wolfSSL home directory now */ +#if defined(WOLFSSL_NO_CURRDIR) || defined(WOLFSSL_MDK_SHELL) +#define caCert "certs/ca-cert.pem" +#define eccCert "certs/server-ecc.pem" +#define eccKey "certs/ecc-key.pem" +#define svrCert "certs/server-cert.pem" +#define svrKey "certs/server-key.pem" +#define cliCert "certs/client-cert.pem" +#define cliKey "certs/client-key.pem" +#define ntruCert "certs/ntru-cert.pem" +#define ntruKey "certs/ntru-key.raw" +#define dhParam "certs/dh2048.pem" +#define cliEccKey "certs/ecc-client-key.pem" +#define cliEccCert "certs/client-ecc-cert.pem" +#define crlPemDir "certs/crl" +#else #define caCert "./certs/ca-cert.pem" #define eccCert "./certs/server-ecc.pem" #define eccKey "./certs/ecc-key.pem" @@ -195,6 +229,7 @@ #define cliEccKey "./certs/ecc-client-key.pem" #define cliEccCert "./certs/client-ecc-cert.pem" #define crlPemDir "./certs/crl" +#endif typedef struct tcp_ready { word16 ready; /* predicate */ @@ -429,7 +464,7 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer, #ifndef TEST_IPV6 /* peer could be in human readable form */ if ( (peer != INADDR_ANY) && isalpha((int)peer[0])) { - #ifdef WOLFSSL_MDK_ARM + #if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) int err; struct hostent* entry = gethostbyname(peer, &err); #elif defined(WOLFSSL_TIRTOS) @@ -452,7 +487,7 @@ static INLINE void build_addr(SOCKADDR_IN_T* addr, const char* peer, #ifndef TEST_IPV6 - #if defined(WOLFSSL_MDK_ARM) + #if defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) addr->sin_family = PF_INET; #else addr->sin_family = AF_INET_V; @@ -527,7 +562,8 @@ static INLINE void tcp_socket(SOCKET_T* sockfd, int udp) if (res < 0) err_sys("setsockopt SO_NOSIGPIPE failed\n"); } -#elif defined(WOLFSSL_MDK_ARM) || defined (WOLFSSL_TIRTOS) +#elif defined(WOLFSSL_MDK_ARM) || defined (WOLFSSL_TIRTOS) ||\ + defined(WOLFSSL_KEIL_TCP_NET) /* nothing to define */ #else /* no S_NOSIGPIPE */ signal(SIGPIPE, SIG_IGN); @@ -575,7 +611,8 @@ enum { }; -#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_TIRTOS) +#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_TCP_NET) && \ + !defined(WOLFSSL_TIRTOS) static INLINE int tcp_select(SOCKET_T socketfd, int to_sec) { fd_set recvfds, errfds; @@ -619,7 +656,8 @@ static INLINE void tcp_listen(SOCKET_T* sockfd, word16* port, int useAnyAddr, build_addr(&addr, (useAnyAddr ? INADDR_ANY : wolfSSLIP), *port, udp); tcp_socket(sockfd, udp); -#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_MDK_ARM) +#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_MDK_ARM)\ + && !defined(WOLFSSL_KEIL_TCP_NET) { int res, on = 1; socklen_t len = sizeof(on); @@ -682,7 +720,8 @@ static INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, tcp_socket(sockfd, 1); -#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_MDK_ARM) +#if !defined(USE_WINDOWS_API) && !defined(WOLFSSL_MDK_ARM) \ + && !defined(WOLFSSL_KEIL_TCP_NET) { int res, on = 1; socklen_t len = sizeof(on); @@ -788,14 +827,14 @@ static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, static INLINE void tcp_set_nonblocking(SOCKET_T* sockfd) { - #ifdef USE_WINDOWS_API + #ifdef USE_WINDOWS_API unsigned long blocking = 1; int ret = ioctlsocket(*sockfd, FIONBIO, &blocking); if (ret == SOCKET_ERROR) err_sys("ioctlsocket failed"); - #elif defined(WOLFSSL_MDK_ARM) || defined (WOLFSSL_TIRTOS) \ - || defined(WOLFSSL_VXWORKS) - /* non blocking not suppported, for now */ + #elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) \ + || defined (WOLFSSL_TIRTOS)|| defined(WOLFSSL_VXWORKS) + /* non blocking not suppported, for now */ #else int flags = fcntl(*sockfd, F_GETFL, 0); if (flags < 0) @@ -881,7 +920,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity, extern double current_time(); #else -#if !defined(WOLFSSL_MDK_ARM) +#if !defined(WOLFSSL_MDK_ARM) && !defined(WOLFSSL_KEIL_TCP_NET) #include static INLINE double current_time(void) @@ -918,7 +957,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity, sz = ftell(file); rewind(file); fread(buff, sizeof(buff), 1, file); - + if (type == WOLFSSL_CA) { if (wolfSSL_CTX_load_verify_buffer(ctx, buff, sz, SSL_FILETYPE_PEM) != SSL_SUCCESS) @@ -934,6 +973,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity, SSL_FILETYPE_PEM) != SSL_SUCCESS) err_sys("can't load buffer key file"); } + fclose(file); } #endif /* NO_FILESYSTEM */ @@ -1098,20 +1138,13 @@ static INLINE int OpenNitroxDevice(int dma_mode,int dev_id) /* do back x number of directories */ static INLINE void ChangeDirBack(int x) { - char path[MAX_PATH]; - - if (x == 1) - strncpy(path, "..\\", MAX_PATH); - else if (x == 2) - strncpy(path, "..\\..\\", MAX_PATH); - else if (x == 3) - strncpy(path, "..\\..\\..\\", MAX_PATH); - else if (x == 4) - strncpy(path, "..\\..\\..\\..\\", MAX_PATH); - else - strncpy(path, ".\\", MAX_PATH); - - SetCurrentDirectoryA(path); + char path[MAX_PATH]; + XMEMSET(path, 0, MAX_PATH); + XSTRNCAT(path, ".\\", MAX_PATH); + while (x-- > 0) { + XSTRNCAT(path, "..\\", MAX_PATH); + } + SetCurrentDirectoryA(path); } /* does current dir contain str */ @@ -1134,7 +1167,7 @@ static INLINE int CurrentDir(const char* str) return 0; } -#elif defined(WOLFSSL_MDK_ARM) +#elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_FS) /* KEIL-RL File System does not support relative directry */ #elif defined(WOLFSSL_TIRTOS) #else @@ -1147,20 +1180,14 @@ static INLINE int CurrentDir(const char* str) static INLINE void ChangeDirBack(int x) { char path[MAX_PATH]; - - if (x == 1) - strncpy(path, "../", MAX_PATH); - else if (x == 2) - strncpy(path, "../../", MAX_PATH); - else if (x == 3) - strncpy(path, "../../../", MAX_PATH); - else if (x == 4) - strncpy(path, "../../../../", MAX_PATH); - else - strncpy(path, "./", MAX_PATH); - - if (chdir(path) < 0) - printf("chdir to %s failed\n", path); + XMEMSET(path, 0, MAX_PATH); + XSTRNCAT(path, "./", MAX_PATH); + while (x-- > 0) { + XSTRNCAT(path, "../", MAX_PATH); + } + if (chdir(path) < 0) { + printf("chdir to %s failed\n", path); + } } /* does current dir contain str */ diff --git a/wolfssl/wolfcrypt/rsa.h b/wolfssl/wolfcrypt/rsa.h index 9da3becf2..8141367c9 100644 --- a/wolfssl/wolfcrypt/rsa.h +++ b/wolfssl/wolfcrypt/rsa.h @@ -99,13 +99,13 @@ WOLFSSL_API int wc_RsaPublicKeyDecodeRaw(const byte* n, word32 nSz, const byte* e, word32 eSz, RsaKey* key); #ifdef WOLFSSL_KEY_GEN WOLFSSL_API int wc_RsaKeyToDer(RsaKey*, byte* output, word32 inLen); - WOLFSSL_API int wc_RsaKeyToPublicDer(RsaKey*, byte* output, word32 inLen); #endif #endif /* HAVE_FIPS*/ WOLFSSL_API int wc_RsaFlattenPublicKey(RsaKey*, byte*, word32*, byte*, word32*); #ifdef WOLFSSL_KEY_GEN + WOLFSSL_API int wc_RsaKeyToPublicDer(RsaKey*, byte* output, word32 inLen); WOLFSSL_API int wc_MakeRsaKey(RsaKey* key, int size, long e, WC_RNG* rng); #endif diff --git a/wolfssl/wolfcrypt/wc_port.h b/wolfssl/wolfcrypt/wc_port.h index 4989d19f1..7e260f923 100644 --- a/wolfssl/wolfcrypt/wc_port.h +++ b/wolfssl/wolfcrypt/wc_port.h @@ -136,7 +136,34 @@ #error Need a mutex type in multithreaded mode #endif /* USE_WINDOWS_API */ #endif /* SINGLE_THREADED */ + +/* Enable crypt HW mutex for Freescale MMCAU */ +#if defined(FREESCALE_MMCAU) + #ifndef WOLFSSL_CRYPT_HW_MUTEX + #define WOLFSSL_CRYPT_HW_MUTEX 1 + #endif +#endif /* FREESCALE_MMCAU */ +#ifndef WOLFSSL_CRYPT_HW_MUTEX + #define WOLFSSL_CRYPT_HW_MUTEX 0 +#endif + +#if WOLFSSL_CRYPT_HW_MUTEX + /* wolfSSL_CryptHwMutexInit is called on first wolfSSL_CryptHwMutexLock, + however it's recommended to call this directly on Hw init to avoid possible + race condition where two calls to wolfSSL_CryptHwMutexLock are made at + the same time. */ + int wolfSSL_CryptHwMutexInit(void); + int wolfSSL_CryptHwMutexLock(void); + int wolfSSL_CryptHwMutexUnLock(void); +#else + /* Define stubs, since HW mutex is disabled */ + #define wolfSSL_CryptHwMutexInit() 0 /* Success */ + #define wolfSSL_CryptHwMutexLock() 0 /* Success */ + #define wolfSSL_CryptHwMutexUnLock() 0 /* Success */ +#endif /* WOLFSSL_CRYPT_HW_MUTEX */ + +/* Mutex functions */ WOLFSSL_LOCAL int InitMutex(wolfSSL_Mutex*); WOLFSSL_LOCAL int FreeMutex(wolfSSL_Mutex*); WOLFSSL_LOCAL int LockMutex(wolfSSL_Mutex*); From fdab3943be210994e3f5a77f22e3a7c2fa7ec8c0 Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 14 Oct 2015 19:13:45 -0700 Subject: [PATCH 65/77] Added throughput benchmarking for client/server examples and added helper script "scripts/benchmark.test". Added example client option: "-B " Benchmarking throughput. Added example server options: "-B " Benchmark throughput, "-e" Echo data, "-i" Loop / Accept multiple connections. Cleanup of the include.am for examples. Cleanup of tcp_connect with DTLS enabled. Cleanup of the valid socket checking. Cleanup trailing whitespace. --- Makefile.am | 5 +- examples/client/client.c | 281 ++++++++++++++++------- examples/client/client.h | 8 + examples/echoclient/echoclient.c | 11 +- examples/echoserver/echoserver.c | 2 +- examples/include.am | 7 + examples/server/server.c | 369 +++++++++++++++++++------------ examples/server/server.h | 4 + scripts/benchmark.test | 115 ++++++++++ scripts/include.am | 1 + tests/api.c | 10 +- wolfssl/test.h | 215 ++++++++++-------- 12 files changed, 700 insertions(+), 328 deletions(-) create mode 100644 examples/include.am create mode 100755 scripts/benchmark.test diff --git a/Makefile.am b/Makefile.am index f3ad8ecd5..6f0457615 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,10 +72,7 @@ include support/include.am include wolfcrypt/benchmark/include.am include wolfcrypt/src/include.am include wolfcrypt/test/include.am -include examples/client/include.am -include examples/server/include.am -include examples/echoclient/include.am -include examples/echoserver/include.am +include examples/include.am include testsuite/include.am include tests/include.am include sslSniffer/sslSnifferTest/include.am diff --git a/examples/client/client.c b/examples/client/client.c index fbb9cb979..b105d7822 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -31,8 +31,8 @@ #if defined(WOLFSSL_MDK5) #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" + #include "rl_fs.h" + #include "rl_net.h" #else #include "rtl.h" #endif @@ -127,6 +127,165 @@ static void ShowCiphers(void) printf("%s\n", ciphers); } +int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port, + int doDTLS, int benchmark, int resumeSession) +{ + /* time passed in number of connects give average */ + int times = benchmark; + int loops = resumeSession ? 2 : 1; + int i = 0; + WOLFSSL_SESSION* benchSession = NULL; + + while (loops--) { + int benchResume = resumeSession && loops == 0; + double start = current_time(), avg; + + for (i = 0; i < times; i++) { + SOCKET_T sockfd; + WOLFSSL* ssl = wolfSSL_new(ctx); + + tcp_connect(&sockfd, host, port, doDTLS, ssl); + + if (benchResume) + wolfSSL_set_session(ssl, benchSession); + wolfSSL_set_fd(ssl, sockfd); + if (wolfSSL_connect(ssl) != SSL_SUCCESS) + err_sys("SSL_connect failed"); + + wolfSSL_shutdown(ssl); + if (i == (times-1) && resumeSession) { + benchSession = wolfSSL_get_session(ssl); + } + wolfSSL_free(ssl); + CloseSocket(sockfd); + } + avg = current_time() - start; + avg /= times; + avg *= 1000; /* milliseconds */ + if (benchResume) + printf("wolfSSL_resume avg took: %8.3f milliseconds\n", avg); + else + printf("wolfSSL_connect avg took: %8.3f milliseconds\n", avg); + } + + return EXIT_SUCCESS; +} + +int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port, + int doDTLS, int throughput) +{ + double start, conn_time = 0, tx_time = 0, rx_time = 0; + SOCKET_T sockfd; + WOLFSSL* ssl; + int ret; + + start = current_time(); + ssl = wolfSSL_new(ctx); + tcp_connect(&sockfd, host, port, doDTLS, ssl); + wolfSSL_set_fd(ssl, sockfd); + if (wolfSSL_connect(ssl) == SSL_SUCCESS) { + /* Perform throughput test */ + char *tx_buffer, *rx_buffer; + + /* Record connection time */ + conn_time = current_time() - start; + + /* Allocate TX/RX buffers */ + tx_buffer = (char*)XMALLOC(TEST_BUFFER_SIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER); + rx_buffer = (char*)XMALLOC(TEST_BUFFER_SIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER); + if(tx_buffer && rx_buffer) { + WC_RNG rng; + + /* Startup the RNG */ + ret = wc_InitRng(&rng); + if(ret == 0) { + int xfer_bytes; + + /* Generate random data to send */ + ret = wc_RNG_GenerateBlock(&rng, (byte*)tx_buffer, TEST_BUFFER_SIZE); + wc_FreeRng(&rng); + if(ret != 0) { + err_sys("wc_RNG_GenerateBlock failed"); + } + + /* Perform TX and RX of bytes */ + xfer_bytes = 0; + while(throughput > xfer_bytes) { + int len, rx_pos; + + /* Determine packet size */ + len = min(TEST_BUFFER_SIZE, throughput - xfer_bytes); + + /* Perform TX */ + start = current_time(); + if (wolfSSL_write(ssl, tx_buffer, len) != len) { + int writeErr = wolfSSL_get_error(ssl, 0); + printf("wolfSSL_write error %d!\n", writeErr); + err_sys("wolfSSL_write failed"); + } + tx_time += current_time() - start; + + /* Perform RX */ + int select_ret = tcp_select(sockfd, 1); /* Timeout=1 second */ + if (select_ret == TEST_RECV_READY) { + start = current_time(); + rx_pos = 0; + while(rx_pos < len) { + ret = wolfSSL_read(ssl, &rx_buffer[rx_pos], len - rx_pos); + if(ret <= 0) { + int readErr = wolfSSL_get_error(ssl, 0); + if (readErr != SSL_ERROR_WANT_READ) { + printf("wolfSSL_read error %d!\n", readErr); + err_sys("wolfSSL_read failed"); + } + } + else { + rx_pos += ret; + } + } + rx_time += current_time() - start; + } + + /* Compare TX and RX buffers */ + if(XMEMCMP(tx_buffer, rx_buffer, len) != 0) { + err_sys("Compare TX and RX buffers failed"); + } + + /* Update overall position */ + xfer_bytes += len; + } + } + else { + err_sys("wc_InitRng failed"); + } + } + else { + err_sys("Buffer alloc failed"); + } + if(tx_buffer) XFREE(tx_buffer, NULL, DYNAMIC_TYPE_TMP_BUFFER); + if(rx_buffer) XFREE(rx_buffer, NULL, DYNAMIC_TYPE_TMP_BUFFER); + } + else { + err_sys("wolfSSL_connect failed"); + } + + wolfSSL_shutdown(ssl); + wolfSSL_free(ssl); + CloseSocket(sockfd); + + printf("wolfSSL Client Benchmark %d bytes\n" + "\tConnect %8.3f ms\n" + "\tTX %8.3f ms (%8.3f MBps)\n" + "\tRX %8.3f ms (%8.3f MBps)\n", + throughput, + conn_time * 1000, + tx_time * 1000, throughput / tx_time / 1024 / 1024, + rx_time * 1000, throughput / rx_time / 1024 / 1024 + ); + + return EXIT_SUCCESS; +} + static void Usage(void) { @@ -137,7 +296,7 @@ static void Usage(void) printf("-p Port to connect on, not 0, default %d\n", wolfSSLPort); printf("-v SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n", CLIENT_DEFAULT_VERSION); - printf("-l Cipher list\n"); + printf("-l Cipher suite list (: delimited)\n"); printf("-c Certificate file, default %s\n", cliCert); printf("-k Key file, default %s\n", cliKey); printf("-A Certificate Authority file, default %s\n", caCert); @@ -149,6 +308,7 @@ static void Usage(void) #ifdef HAVE_ALPN printf("-L Application-Layer Protocole Name ({C,F}:)\n"); #endif + printf("-B Benchmark throughput using bytes and print stats\n"); printf("-s Use pre Shared keys\n"); printf("-t Track wolfSSL memory use\n"); printf("-d Disable peer checks\n"); @@ -156,7 +316,7 @@ static void Usage(void) printf("-e List Every cipher suite available, \n"); printf("-g Send server HTTP GET\n"); printf("-u Use UDP DTLS," - " add -v 2 for DTLSv1 (default), -v 3 for DTLSv1.2\n"); + " add -v 2 for DTLSv1, -v 3 for DTLSv1.2 (default)\n"); printf("-m Match domain name in cert\n"); printf("-N Use Non-blocking sockets\n"); printf("-r Resume session\n"); @@ -187,7 +347,7 @@ static void Usage(void) #ifdef ATOMIC_USER printf("-U Atomic User Record Layer Callbacks\n"); #endif -#ifdef HAVE_PK_CALLBACKS +#ifdef HAVE_PK_CALLBACKS printf("-P Public Key Callbacks\n"); #endif #ifdef HAVE_ANON @@ -200,12 +360,12 @@ static void Usage(void) THREAD_RETURN WOLFSSL_THREAD client_test(void* args) { - SOCKET_T sockfd = 0; + SOCKET_T sockfd = WOLFSSL_SOCKET_INVALID; WOLFSSL_METHOD* method = 0; WOLFSSL_CTX* ctx = 0; WOLFSSL* ssl = 0; - + WOLFSSL* sslResume = 0; WOLFSSL_SESSION* session = 0; char resumeMsg[] = "resuming wolfssl!"; @@ -228,6 +388,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) int useAnon = 0; int sendGET = 0; int benchmark = 0; + int throughput = 0; int doDTLS = 0; int matchName = 0; int doPeerCheck = 1; @@ -300,7 +461,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) StackTrap(); while ((ch = mygetopt(argc, argv, - "?gdeDusmNrwRitfxXUPCh:p:v:l:A:c:k:Z:b:zS:L:ToO:an:")) + "?gdeDusmNrwRitfxXUPCh:p:v:l:A:c:k:Z:b:zS:L:ToO:an:B:")) != -1) { switch (ch) { case '?' : @@ -366,7 +527,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) break; case 'P' : - #ifdef HAVE_PK_CALLBACKS + #ifdef HAVE_PK_CALLBACKS pkCallbacks = 1; #endif break; @@ -426,6 +587,14 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) } break; + case 'B' : + throughput = atoi(myoptarg); + if (throughput <= 0) { + Usage(); + exit(MY_EX_USAGE); + } + break; + case 'N' : nonBlocking = 1; break; @@ -633,9 +802,10 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) if (ctx == NULL) err_sys("unable to get ctx"); - if (cipherList) + if (cipherList) { if (wolfSSL_CTX_set_cipher_list(ctx, cipherList) != SSL_SUCCESS) err_sys("client can't set cipher list 1"); + } #ifdef WOLFSSL_LEANPSK usePsk = 1; @@ -770,52 +940,23 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) #endif if (benchmark) { - /* time passed in number of connects give average */ - int times = benchmark; - int loops = resumeSession ? 2 : 1; - int i = 0; - WOLFSSL_SESSION* benchSession = NULL; - - while (loops--) { - int benchResume = resumeSession && loops == 0; - double start = current_time(), avg; - - for (i = 0; i < times; i++) { - tcp_connect(&sockfd, host, port, doDTLS); - - ssl = wolfSSL_new(ctx); - if (benchResume) - wolfSSL_set_session(ssl, benchSession); - wolfSSL_set_fd(ssl, sockfd); - if (wolfSSL_connect(ssl) != SSL_SUCCESS) - err_sys("SSL_connect failed"); - - wolfSSL_shutdown(ssl); - if (i == (times-1) && resumeSession) { - benchSession = wolfSSL_get_session(ssl); - } - wolfSSL_free(ssl); - CloseSocket(sockfd); - } - avg = current_time() - start; - avg /= times; - avg *= 1000; /* milliseconds */ - if (benchResume) - printf("wolfSSL_resume avg took: %8.3f milliseconds\n", avg); - else - printf("wolfSSL_connect avg took: %8.3f milliseconds\n", avg); - } - + ((func_args*)args)->return_code = + ClientBenchmarkConnections(ctx, host, port, doDTLS, benchmark, resumeSession); wolfSSL_CTX_free(ctx); - ((func_args*)args)->return_code = 0; - exit(EXIT_SUCCESS); } - + + if(throughput) { + ((func_args*)args)->return_code = + ClientBenchmarkThroughput(ctx, host, port, doDTLS, throughput); + wolfSSL_CTX_free(ctx); + exit(EXIT_SUCCESS); + } + #if defined(WOLFSSL_MDK_ARM) wolfSSL_CTX_set_verify(ctx, SSL_VERIFY_NONE, 0); #endif - + ssl = wolfSSL_new(ctx); if (ssl == NULL) err_sys("unable to get SSL object"); @@ -830,15 +971,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) } #endif - if (doDTLS) { - SOCKADDR_IN_T addr; - build_addr(&addr, host, port, 1); - wolfSSL_dtls_set_peer(ssl, &addr, sizeof(addr)); - tcp_socket(&sockfd, 1); - } - else { - tcp_connect(&sockfd, host, port, 0); - } + tcp_connect(&sockfd, host, port, doDTLS, ssl); #ifdef HAVE_POLY1305 /* use old poly to connect with google and wolfssl.com server */ @@ -986,21 +1119,15 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) #ifndef NO_SESSION_CACHE if (resumeSession) { if (doDTLS) { - SOCKADDR_IN_T addr; - #ifdef USE_WINDOWS_API - Sleep(500); - #elif defined(WOLFSSL_TIRTOS) - Task_sleep(1); - #else - sleep(1); - #endif - build_addr(&addr, host, port, 1); - wolfSSL_dtls_set_peer(sslResume, &addr, sizeof(addr)); - tcp_socket(&sockfd, 1); - } - else { - tcp_connect(&sockfd, host, port, 0); +#ifdef USE_WINDOWS_API + Sleep(500); +#elif defined(WOLFSSL_TIRTOS) + Task_sleep(1); +#else + sleep(1); +#endif } + tcp_connect(&sockfd, host, port, doDTLS, sslResume); wolfSSL_set_fd(sslResume, sockfd); #ifdef HAVE_ALPN if (alpnList != NULL) { @@ -1020,7 +1147,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) wolfSSL_set_SessionTicket_cb(sslResume, sessionTicketCB, (void*)"resumed session"); #endif - + showPeer(sslResume); #ifndef WOLFSSL_CALLBACKS if (nonBlocking) { @@ -1080,7 +1207,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) } /* try to send session break */ - wolfSSL_write(sslResume, msg, msgSz); + wolfSSL_write(sslResume, msg, msgSz); ret = wolfSSL_shutdown(sslResume); if (wc_shutdown && ret == SSL_SHUTDOWN_NOT_DONE) @@ -1134,10 +1261,10 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) ChangeDirBack(2); else if (CurrentDir("Debug") || CurrentDir("Release")) ChangeDirBack(3); - + #ifdef HAVE_STACK_SIZE StackSizeCheck(&args, client_test); -#else +#else client_test(&args); #endif wolfSSL_Cleanup(); diff --git a/examples/client/client.h b/examples/client/client.h index e4b13be48..25881aab8 100644 --- a/examples/client/client.h +++ b/examples/client/client.h @@ -23,3 +23,11 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args); +/* Measures average time to create, connect and disconnect a connection (TPS). +Benchmark = number of connections. */ +int ClientBenchmarkConnections(WOLFSSL_CTX* ctx, char* host, word16 port, + int doDTLS, int benchmark, int resumeSession); + +/* Measures throughput in kbps. Throughput = number of bytes */ +int ClientBenchmarkThroughput(WOLFSSL_CTX* ctx, char* host, word16 port, + int doDTLS, int throughput); diff --git a/examples/echoclient/echoclient.c b/examples/echoclient/echoclient.c index e855999c1..8cf05c26c 100644 --- a/examples/echoclient/echoclient.c +++ b/examples/echoclient/echoclient.c @@ -164,16 +164,7 @@ void echoclient_test(void* args) #endif ssl = SSL_new(ctx); - - if (doDTLS) { - SOCKADDR_IN_T addr; - build_addr(&addr, yasslIP, port, 1); - CyaSSL_dtls_set_peer(ssl, &addr, sizeof(addr)); - tcp_socket(&sockfd, 1); - } - else { - tcp_connect(&sockfd, yasslIP, port, 0); - } + tcp_connect(&sockfd, yasslIP, port, doDTLS, ssl); SSL_set_fd(ssl, sockfd); #if defined(USE_WINDOWS_API) && defined(CYASSL_DTLS) && defined(NO_MAIN_DRIVER) diff --git a/examples/echoserver/echoserver.c b/examples/echoserver/echoserver.c index 453e162bb..e510e1387 100644 --- a/examples/echoserver/echoserver.c +++ b/examples/echoserver/echoserver.c @@ -248,7 +248,7 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args) err_sys("recvfrom failed"); } #endif - if (clientfd == -1) err_sys("tcp accept failed"); + if (WOLFSSL_SOCKET_IS_INVALID(clientfd)) err_sys("tcp accept failed"); ssl = CyaSSL_new(ctx); if (ssl == NULL) err_sys("SSL_new failed"); diff --git a/examples/include.am b/examples/include.am new file mode 100644 index 000000000..e06bc86a1 --- /dev/null +++ b/examples/include.am @@ -0,0 +1,7 @@ +# vim:ft=automake +# All paths should be given relative to the root + +include examples/client/include.am +include examples/echoclient/include.am +include examples/echoserver/include.am +include examples/server/include.am diff --git a/examples/server/server.c b/examples/server/server.c index 014342af3..dfa751a6c 100644 --- a/examples/server/server.c +++ b/examples/server/server.c @@ -40,8 +40,8 @@ #if defined(WOLFSSL_MDK5) #include "cmsis_os.h" - #include "rl_fs.h" - #include "rl_net.h" + #include "rl_fs.h" + #include "rl_net.h" #else #include "rtl.h" #endif @@ -81,10 +81,11 @@ static void NonBlockingSSL_Accept(SSL* ssl) error == SSL_ERROR_WANT_WRITE)) { int currTimeout = 1; - if (error == SSL_ERROR_WANT_READ) - printf("... server would read block\n"); - else - printf("... server would write block\n"); + if (error == SSL_ERROR_WANT_READ) { + /* printf("... server would read block\n"); */ + } else { + /* printf("... server would write block\n"); */ + } #ifdef CYASSL_DTLS currTimeout = CyaSSL_dtls_get_current_timeout(ssl); @@ -118,6 +119,68 @@ static void NonBlockingSSL_Accept(SSL* ssl) err_sys("SSL_accept failed"); } +/* Echo number of bytes specified by -e arg */ +int ServerEchoData(SSL* ssl, int clientfd, int echoData, int throughput) +{ + int ret = 0; + char* buffer = (char*)XMALLOC(TEST_BUFFER_SIZE, NULL, DYNAMIC_TYPE_TMP_BUFFER); + if(buffer) { + double start, rx_time = 0, tx_time = 0; + int xfer_bytes = 0; + while((echoData && throughput == 0) || (!echoData && xfer_bytes < throughput)) { + int select_ret = tcp_select(clientfd, 1); /* Timeout=1 second */ + if (select_ret == TEST_RECV_READY) { + int len = min(TEST_BUFFER_SIZE, throughput - xfer_bytes); + int rx_pos = 0; + if(throughput) { + start = current_time(); + } + while(rx_pos < len) { + ret = SSL_read(ssl, &buffer[rx_pos], len - rx_pos); + if (ret <= 0) { + int readErr = SSL_get_error(ssl, 0); + if (readErr != SSL_ERROR_WANT_READ) { + printf("SSL_read error %d!\n", readErr); + err_sys("SSL_read failed"); + } + } + else { + rx_pos += ret; + } + } + if(throughput) { + rx_time += current_time() - start; + start = current_time(); + } + if (SSL_write(ssl, buffer, len) != len) { + err_sys("SSL_write failed"); + } + if(throughput) { + tx_time += current_time() - start; + } + + xfer_bytes += len; + } + } + XFREE(buffer, NULL, DYNAMIC_TYPE_TMP_BUFFER); + + if(throughput) { + printf("wolfSSL Server Benchmark %d bytes\n" + "\tRX %8.3f ms (%8.3f MBps)\n" + "\tTX %8.3f ms (%8.3f MBps)\n", + throughput, + tx_time * 1000, throughput / tx_time / 1024 / 1024, + rx_time * 1000, throughput / rx_time / 1024 / 1024 + ); + } + } + else { + err_sys("Server buffer XMALLOC failed"); + } + + return EXIT_SUCCESS; +} + static void Usage(void) { @@ -127,7 +190,7 @@ static void Usage(void) printf("-p Port to listen on, not 0, default %d\n", yasslPort); printf("-v SSL version [0-3], SSLv3(0) - TLS1.2(3)), default %d\n", SERVER_DEFAULT_VERSION); - printf("-l Cipher list\n"); + printf("-l Cipher suite list (: delimited)\n"); printf("-c Certificate file, default %s\n", svrCert); printf("-k Key file, default %s\n", svrKey); printf("-A Certificate Authority file, default %s\n", cliCert); @@ -144,7 +207,7 @@ static void Usage(void) printf("-s Use pre Shared keys\n"); printf("-t Track wolfSSL memory use\n"); printf("-u Use UDP DTLS," - " add -v 2 for DTLSv1 (default), -v 3 for DTLSv1.2\n"); + " add -v 2 for DTLSv1, -v 3 for DTLSv1.2 (default)\n"); printf("-f Fewer packets/group messages\n"); printf("-R Create server ready file, for external monitor\n"); printf("-r Allow one client Resumption\n"); @@ -155,7 +218,7 @@ static void Usage(void) printf("-o Perform OCSP lookup on peer certificate\n"); printf("-O Perform OCSP lookup using as responder\n"); #endif -#ifdef HAVE_PK_CALLBACKS +#ifdef HAVE_PK_CALLBACKS printf("-P Public Key Callbacks\n"); #endif #ifdef HAVE_ANON @@ -164,20 +227,22 @@ static void Usage(void) #ifndef NO_PSK printf("-I Do not send PSK identity hint\n"); #endif + printf("-i Loop indefinitely (allow repeated connections)\n"); + printf("-e Echo data mode (return raw bytes received)\n"); + printf("-B Benchmark throughput using bytes and print stats\n"); } THREAD_RETURN CYASSL_THREAD server_test(void* args) { - SOCKET_T sockfd = 0; - SOCKET_T clientfd = 0; + SOCKET_T sockfd = WOLFSSL_SOCKET_INVALID; + SOCKET_T clientfd = WOLFSSL_SOCKET_INVALID; SSL_METHOD* method = 0; SSL_CTX* ctx = 0; SSL* ssl = 0; - char msg[] = "I hear you fa shizzle!"; + const char msg[] = "I hear you fa shizzle!"; char input[80]; - int idx; int ch; int version = SERVER_DEFAULT_VERSION; int doCliCertCheck = 1; @@ -194,8 +259,13 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args) int pkCallbacks = 0; int serverReadyFile = 0; int wc_shutdown = 0; - int resume = 0; /* do resume, and resume count */ + int resume = 0; + int resumeCount = 0; + int loopIndefinitely = 0; + int echoData = 0; + int throughput; int minDhKeyBits = DEFAULT_MIN_DHKEY_BITS; + int doListen = 1; int ret; char* alpnList = NULL; unsigned char alpn_opt = 0; @@ -244,7 +314,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args) fdOpenSession(Task_self()); #endif - while ((ch = mygetopt(argc, argv, "?dbstnNufrRawPIp:v:l:A:c:k:Z:S:oO:D:L:")) + while ((ch = mygetopt(argc, argv, "?dbstnNufrRawPIp:v:l:A:c:k:Z:S:oO:D:L:ieB:")) != -1) { switch (ch) { case '?' : @@ -292,7 +362,7 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args) break; case 'P' : - #ifdef HAVE_PK_CALLBACKS + #ifdef HAVE_PK_CALLBACKS pkCallbacks = 1; #endif break; @@ -400,6 +470,23 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args) #endif break; + + case 'i' : + loopIndefinitely = 1; + break; + + case 'e' : + echoData = 1; + break; + + case 'B': + throughput = atoi(myoptarg); + if (throughput <= 0) { + Usage(); + exit(MY_EX_USAGE); + } + break; + default: Usage(); exit(MY_EX_USAGE); @@ -593,164 +680,174 @@ THREAD_RETURN CYASSL_THREAD server_test(void* args) err_sys("UseSNI failed"); #endif -while (1) { /* allow resume option */ - if (resume > 1) { /* already did listen, just do accept */ - if (doDTLS == 0) { - SOCKADDR_IN_T client; - socklen_t client_len = sizeof(client); - clientfd = accept(sockfd, (struct sockaddr*)&client, - (ACCEPT_THIRD_T)&client_len); - } else { - tcp_listen(&sockfd, &port, useAnyAddr, doDTLS); - clientfd = sockfd; + while (1) { + /* allow resume option */ + if(resumeCount > 1) { + if (doDTLS == 0) { + SOCKADDR_IN_T client; + socklen_t client_len = sizeof(client); + clientfd = accept(sockfd, (struct sockaddr*)&client, + (ACCEPT_THIRD_T)&client_len); + } else { + tcp_listen(&sockfd, &port, useAnyAddr, doDTLS); + clientfd = sockfd; + } + if(WOLFSSL_SOCKET_IS_INVALID(clientfd)) { + err_sys("tcp accept failed"); + } + resumeCount = 0; } - #ifdef USE_WINDOWS_API - if (clientfd == INVALID_SOCKET) err_sys("tcp accept failed"); - #else - if (clientfd == -1) err_sys("tcp accept failed"); - #endif - } - ssl = SSL_new(ctx); - if (ssl == NULL) - err_sys("unable to get SSL"); + ssl = SSL_new(ctx); + if (ssl == NULL) + err_sys("unable to get SSL"); #ifndef NO_HANDSHAKE_DONE_CB - wolfSSL_SetHsDoneCb(ssl, myHsDoneCb, NULL); + wolfSSL_SetHsDoneCb(ssl, myHsDoneCb, NULL); #endif #ifdef HAVE_CRL - CyaSSL_EnableCRL(ssl, 0); - CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, CYASSL_CRL_MONITOR | - CYASSL_CRL_START_MON); - CyaSSL_SetCRL_Cb(ssl, CRL_CallBack); + CyaSSL_EnableCRL(ssl, 0); + CyaSSL_LoadCRL(ssl, crlPemDir, SSL_FILETYPE_PEM, CYASSL_CRL_MONITOR | + CYASSL_CRL_START_MON); + CyaSSL_SetCRL_Cb(ssl, CRL_CallBack); #endif #ifdef HAVE_OCSP - if (useOcsp) { - if (ocspUrl != NULL) { - CyaSSL_CTX_SetOCSP_OverrideURL(ctx, ocspUrl); - CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE - | CYASSL_OCSP_URL_OVERRIDE); + if (useOcsp) { + if (ocspUrl != NULL) { + CyaSSL_CTX_SetOCSP_OverrideURL(ctx, ocspUrl); + CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE + | CYASSL_OCSP_URL_OVERRIDE); + } + else + CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE); } - else - CyaSSL_CTX_EnableOCSP(ctx, CYASSL_OCSP_NO_NONCE); - } #endif #ifdef HAVE_PK_CALLBACKS - if (pkCallbacks) - SetupPkCallbacks(ctx, ssl); + if (pkCallbacks) + SetupPkCallbacks(ctx, ssl); #endif - if (resume < 2) { /* do listen and accept */ + /* do accept */ tcp_accept(&sockfd, &clientfd, (func_args*)args, port, useAnyAddr, - doDTLS, serverReadyFile); - } + doDTLS, serverReadyFile, doListen); + doListen = 0; /* Don't listen next time */ - SSL_set_fd(ssl, clientfd); + SSL_set_fd(ssl, clientfd); #ifdef HAVE_ALPN - if (alpnList != NULL) { - printf("ALPN accepted protocols list : %s\n", alpnList); - wolfSSL_UseALPN(ssl, alpnList, (word32)XSTRLEN(alpnList), alpn_opt); - } + if (alpnList != NULL) { + printf("ALPN accepted protocols list : %s\n", alpnList); + wolfSSL_UseALPN(ssl, alpnList, (word32)XSTRLEN(alpnList), alpn_opt); + } #endif #ifdef WOLFSSL_DTLS - if (doDTLS) { - SOCKADDR_IN_T cliaddr; - byte b[1500]; - int n; - socklen_t len = sizeof(cliaddr); + if (doDTLS) { + SOCKADDR_IN_T cliaddr; + byte b[1500]; + int n; + socklen_t len = sizeof(cliaddr); - /* For DTLS, peek at the next datagram so we can get the client's - * address and set it into the ssl object later to generate the - * cookie. */ - n = (int)recvfrom(sockfd, (char*)b, sizeof(b), MSG_PEEK, - (struct sockaddr*)&cliaddr, &len); - if (n <= 0) - err_sys("recvfrom failed"); + /* For DTLS, peek at the next datagram so we can get the client's + * address and set it into the ssl object later to generate the + * cookie. */ + n = (int)recvfrom(sockfd, (char*)b, sizeof(b), MSG_PEEK, + (struct sockaddr*)&cliaddr, &len); + if (n <= 0) + err_sys("recvfrom failed"); - wolfSSL_dtls_set_peer(ssl, &cliaddr, len); - } + wolfSSL_dtls_set_peer(ssl, &cliaddr, len); + } #endif - if (usePsk == 0 || useAnon == 1 || cipherList != NULL || needDH == 1) { - #if !defined(NO_FILESYSTEM) && !defined(NO_DH) && !defined(NO_ASN) - CyaSSL_SetTmpDH_file(ssl, ourDhParam, SSL_FILETYPE_PEM); - #elif !defined(NO_DH) - SetDH(ssl); /* repick suites with DHE, higher priority than PSK */ - #endif - } + if (usePsk == 0 || useAnon == 1 || cipherList != NULL || needDH == 1) { + #if !defined(NO_FILESYSTEM) && !defined(NO_DH) && !defined(NO_ASN) + CyaSSL_SetTmpDH_file(ssl, ourDhParam, SSL_FILETYPE_PEM); + #elif !defined(NO_DH) + SetDH(ssl); /* repick suites with DHE, higher priority than PSK */ + #endif + } #ifndef CYASSL_CALLBACKS - if (nonBlocking) { - CyaSSL_set_using_nonblock(ssl, 1); - tcp_set_nonblocking(&clientfd); - NonBlockingSSL_Accept(ssl); - } else if (SSL_accept(ssl) != SSL_SUCCESS) { - int err = SSL_get_error(ssl, 0); - char buffer[CYASSL_MAX_ERROR_SZ]; - printf("error = %d, %s\n", err, ERR_error_string(err, buffer)); - err_sys("SSL_accept failed"); - } + if (nonBlocking) { + CyaSSL_set_using_nonblock(ssl, 1); + tcp_set_nonblocking(&clientfd); + NonBlockingSSL_Accept(ssl); + } else if (SSL_accept(ssl) != SSL_SUCCESS) { + int err = SSL_get_error(ssl, 0); + char buffer[CYASSL_MAX_ERROR_SZ]; + printf("error = %d, %s\n", err, ERR_error_string(err, buffer)); + err_sys("SSL_accept failed"); + } #else - NonBlockingSSL_Accept(ssl); + NonBlockingSSL_Accept(ssl); #endif - showPeer(ssl); + showPeer(ssl); #ifdef HAVE_ALPN - if (alpnList != NULL) { - int err; - char *protocol_name = NULL; - word16 protocol_nameSz = 0; + if (alpnList != NULL) { + int err; + char *protocol_name = NULL; + word16 protocol_nameSz = 0; - err = wolfSSL_ALPN_GetProtocol(ssl, &protocol_name, &protocol_nameSz); - if (err == SSL_SUCCESS) - printf("Sent ALPN protocol : %s (%d)\n", - protocol_name, protocol_nameSz); - else if (err == SSL_ALPN_NOT_FOUND) - printf("No ALPN response sent (no match)\n"); - else - printf("Getting ALPN protocol name failed\n"); - } + err = wolfSSL_ALPN_GetProtocol(ssl, &protocol_name, &protocol_nameSz); + if (err == SSL_SUCCESS) + printf("Sent ALPN protocol : %s (%d)\n", + protocol_name, protocol_nameSz); + else if (err == SSL_ALPN_NOT_FOUND) + printf("No ALPN response sent (no match)\n"); + else + printf("Getting ALPN protocol name failed\n"); + } #endif - idx = SSL_read(ssl, input, sizeof(input)-1); - if (idx > 0) { - input[idx] = 0; - printf("Client message: %s\n", input); + if(echoData == 0 && throughput == 0) { + ret = SSL_read(ssl, input, sizeof(input)-1); + if (ret > 0) { + input[ret] = 0; + printf("Client message: %s\n", input); - } - else if (idx < 0) { - int readErr = SSL_get_error(ssl, 0); - if (readErr != SSL_ERROR_WANT_READ) - err_sys("SSL_read failed"); - } + } + else if (ret < 0) { + int readErr = SSL_get_error(ssl, 0); + if (readErr != SSL_ERROR_WANT_READ) + err_sys("SSL_read failed"); + } - if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg)) - err_sys("SSL_write failed"); - - #if defined(WOLFSSL_MDK_SHELL) && defined(HAVE_MDK_RTX) + if (SSL_write(ssl, msg, sizeof(msg)) != sizeof(msg)) + err_sys("SSL_write failed"); + } + else { + ServerEchoData(ssl, clientfd, echoData, throughput); + } + +#if defined(WOLFSSL_MDK_SHELL) && defined(HAVE_MDK_RTX) os_dly_wait(500) ; - #elif defined (CYASSL_TIRTOS) +#elif defined (CYASSL_TIRTOS) Task_yield(); - #endif +#endif + + if (doDTLS == 0) { + ret = SSL_shutdown(ssl); + if (wc_shutdown && ret == SSL_SHUTDOWN_NOT_DONE) + SSL_shutdown(ssl); /* bidirectional shutdown */ + } + SSL_free(ssl); - if (doDTLS == 0) { - ret = SSL_shutdown(ssl); - if (wc_shutdown && ret == SSL_SHUTDOWN_NOT_DONE) - SSL_shutdown(ssl); /* bidirectional shutdown */ - } - SSL_free(ssl); - if (resume == 1) { CloseSocket(clientfd); - resume++; /* only do one resume for testing */ - continue; - } - break; /* out of while loop, done with normal and resume option */ -} + + if (resume == 1) { + resumeCount++; /* only do one resume for testing */ + continue; + } + + if(!loopIndefinitely) { + break; /* out of while loop, done with normal and resume option */ + } + } /* while(1) */ + + CloseSocket(sockfd); SSL_CTX_free(ctx); - CloseSocket(clientfd); - CloseSocket(sockfd); ((func_args*)args)->return_code = 0; @@ -807,10 +904,10 @@ while (1) { /* allow resume option */ ChangeDirBack(2); else if (CurrentDir("Debug") || CurrentDir("Release")) ChangeDirBack(3); - + #ifdef HAVE_STACK_SIZE StackSizeCheck(&args, server_test); -#else +#else server_test(&args); #endif CyaSSL_Cleanup(); diff --git a/examples/server/server.h b/examples/server/server.h index c42260fce..3cba4c004 100644 --- a/examples/server/server.h +++ b/examples/server/server.h @@ -22,3 +22,7 @@ #pragma once THREAD_RETURN WOLFSSL_THREAD server_test(void* args); + +/* Echo bytes using buffer of TEST_BUFFER_SIZE until [echoData] bytes are complete. */ +/* If [bechmarkThroughput] set the statistcs will be output at the end */ +int ServerEchoData(WOLFSSL* ssl, int clientfd, int echoData, int benchmarkThroughput); diff --git a/scripts/benchmark.test b/scripts/benchmark.test new file mode 100755 index 000000000..8e4cff9ab --- /dev/null +++ b/scripts/benchmark.test @@ -0,0 +1,115 @@ +#!/bin/sh + +#benchmark.test + +if [ "$#" -lt 2 ]; then + echo "Usage: $0 [mode] [num] [clientargs] [serverargs]" >&2 + echo " [mode]: 1=Connection Rate (TPS), 2=Throughput Bytes" >&2 + echo " [num]: Mode 1=Connection Count, Mode 2=Bytes to TX/RX" >&2 + echo " [clientargs]: Passed to client (see \"./example/client/client -?\" for help)" >&2 + echo " Example: Use different cipher suite: \"-l DHE-RSA-AES256-SHA\"" >&2 + echo " [serverargs]: Passed to server (see \"./example/server/server -?\" for help)" >&2 + echo " Example: Disable client certificate check: \"-d\"" >&2 + echo "Note: If additional client or server args contains spaces wrap with double quotes" >&2 + exit 1 +fi + +# Use unique benchmark port so it won't conflict with any other tests +bench_port=11113 +no_pid=-1 +server_pid=$no_pid +counter=0 +client_result=-1 + +remove_ready_file() { + if test -e /tmp/wolfssl_server_ready; then + echo "removing exisitng server_ready file" + rm /tmp/wolfssl_server_ready + fi +} + + +do_cleanup() { + echo "in cleanup" + + if [ $server_pid != $no_pid ] + then + echo "killing server" + kill -9 $server_pid + fi + remove_ready_file +} + +do_trap() { + echo "got trap" + do_cleanup + exit -1 +} + +trap do_trap INT TERM + +# Start server in loop continuous mode (-L) with echo data (-e) enabled and non-blocking (-N) +echo "\nStarting example server for benchmark test" +remove_ready_file +# benchmark connections +if [ $1 == 1 ] +then + # start server in loop mode with port + ./examples/server/server -i -p $bench_port $4 & + server_pid=$! +fi + +# benchmark throughput +if [ $1 == 2 ] +then + # start server in loop mode, non-blocking, benchmark throughput with port + ./examples/server/server -i -N -B $2 -p $bench_port $4 & + server_pid=$! +fi + + +echo "Waiting for server_ready file..." +while [ ! -s /tmp/wolfssl_server_ready -a "$counter" -lt 20 ]; do + sleep 0.1 + counter=$((counter+ 1)) +done + +# benchmark connections +if [ $1 == 1 ] +then + echo "Starting example client to benchmark connection average time" + # start client to benchmark average time for each connection using port + ./examples/client/client -b $2 -p $bench_port $3 + client_result=$? +fi + +# benchmark throughput +if [ $1 == 2 ] +then + echo "Starting example client to benchmark throughput" + # start client in non-blocking mode, benchmark throughput using port + ./examples/client/client -N -B $2 -p $bench_port $3 + client_result=$? +fi + +if [ $client_result != 0 ] +then + echo "Client failed!" + do_cleanup + exit 1 +fi + +# End server +kill -6 $server_pid +server_result=$? +remove_ready_file + +if [ $server_result != 0 ] +then + echo "Server failed!" + exit 1 +fi + +echo "\nSuccess!\n" + +exit 0 diff --git a/scripts/include.am b/scripts/include.am index 915baf63a..94232516b 100644 --- a/scripts/include.am +++ b/scripts/include.am @@ -10,6 +10,7 @@ endif if BUILD_EXAMPLES dist_noinst_SCRIPTS+= scripts/resume.test +EXTRA_DIST+= scripts/benchmark.test if BUILD_CRL # make revoked test rely on completion of resume test diff --git a/tests/api.c b/tests/api.c index 8feb84a39..4103bb25b 100644 --- a/tests/api.c +++ b/tests/api.c @@ -357,7 +357,7 @@ static THREAD_RETURN WOLFSSL_THREAD test_server_nofail(void* args) } ssl = wolfSSL_new(ctx); - tcp_accept(&sockfd, &clientfd, (func_args*)args, port, 0, 0, 0); + tcp_accept(&sockfd, &clientfd, (func_args*)args, port, 0, 0, 0, 1); CloseSocket(sockfd); wolfSSL_set_fd(ssl, clientfd); @@ -467,9 +467,8 @@ static void test_client_nofail(void* args) goto done2; } - tcp_connect(&sockfd, wolfSSLIP, ((func_args*)args)->signal->port, 0); - ssl = wolfSSL_new(ctx); + tcp_connect(&sockfd, wolfSSLIP, ((func_args*)args)->signal->port, 0, ssl); wolfSSL_set_fd(ssl, sockfd); if (wolfSSL_connect(ssl) != SSL_SUCCESS) { @@ -557,7 +556,7 @@ static THREAD_RETURN WOLFSSL_THREAD run_wolfssl_server(void* args) ssl = wolfSSL_new(ctx); - tcp_accept(&sfd, &cfd, (func_args*)args, port, 0, 0, 0); + tcp_accept(&sfd, &cfd, (func_args*)args, port, 0, 0, 0, 1); CloseSocket(sfd); wolfSSL_set_fd(ssl, cfd); @@ -650,9 +649,8 @@ static void run_wolfssl_client(void* args) if (callbacks->ctx_ready) callbacks->ctx_ready(ctx); - tcp_connect(&sfd, wolfSSLIP, ((func_args*)args)->signal->port, 0); - ssl = wolfSSL_new(ctx); + tcp_connect(&sfd, wolfSSLIP, ((func_args*)args)->signal->port, 0, ssl); wolfSSL_set_fd(ssl, sfd); if (callbacks->ssl_ready) diff --git a/wolfssl/test.h b/wolfssl/test.h index 248f0ce18..83218fe1e 100644 --- a/wolfssl/test.h +++ b/wolfssl/test.h @@ -23,7 +23,7 @@ #endif /* HAVE_ECC */ #endif /*HAVE_PK_CALLBACKS */ -#ifdef USE_WINDOWS_API +#ifdef USE_WINDOWS_API #include #include #ifdef TEST_IPV6 /* don't require newer SDK for IPV4 */ @@ -61,11 +61,11 @@ #include #include struct hostent { - char *h_name; /* official name of host */ - char **h_aliases; /* alias list */ - int h_addrtype; /* host address type */ - int h_length; /* length of address */ - char **h_addr_list; /* list of addresses from name server */ + char *h_name; /* official name of host */ + char **h_aliases; /* alias list */ + int h_addrtype; /* host address type */ + int h_length; /* length of address */ + char **h_addr_list; /* list of addresses from name server */ }; #define SOCKET_T int #elif defined(WOLFSSL_VXWORKS) @@ -79,7 +79,7 @@ #include #include #include - #include + #include #define SOCKET_T int #else #include @@ -118,6 +118,39 @@ #pragma warning(disable:4244 4996) #endif +/* Buffer for benchmark tests */ +#ifndef TEST_BUFFER_SIZE +#define TEST_BUFFER_SIZE 16384 +#endif + +#ifndef WOLFSSL_HAVE_MIN + #define WOLFSSL_HAVE_MIN + static INLINE word32 min(word32 a, word32 b) + { + return a > b ? b : a; + } +#endif /* WOLFSSL_HAVE_MIN */ + +/* Socket Handling */ +#ifndef WOLFSSL_SOCKET_INVALID +#ifdef USE_WINDOWS_API + #define WOLFSSL_SOCKET_INVALID INVALID_SOCKET +#elif defined(WOLFSSL_TIRTOS) + #define WOLFSSL_SOCKET_INVALID -1 +#else + #define WOLFSSL_SOCKET_INVALID 0 +#endif +#endif /* WOLFSSL_SOCKET_INVALID */ + +#ifndef WOLFSSL_SOCKET_IS_INVALID +#ifdef USE_WINDOWS_API + #define WOLFSSL_SOCKET_IS_INVALID(s) ((s) == WOLFSSL_SOCKET_INVALID) +#elif defined(WOLFSSL_TIRTOS) + #define WOLFSSL_SOCKET_IS_INVALID(s) ((s) == WOLFSSL_SOCKET_INVALID) +#else + #define WOLFSSL_SOCKET_IS_INVALID(s) ((s) < WOLFSSL_SOCKET_INVALID) +#endif +#endif /* WOLFSSL_SOCKET_IS_INVALID */ #if defined(__MACH__) || defined(USE_WINDOWS_API) #ifndef _SOCKLEN_T @@ -140,7 +173,7 @@ #endif -#ifdef USE_WINDOWS_API +#ifdef USE_WINDOWS_API #define CloseSocket(s) closesocket(s) #define StartTCP() { WSADATA wsd; WSAStartup(0x0002, &wsd); } #elif defined(WOLFSSL_MDK_ARM) || defined(WOLFSSL_KEIL_TCP_NET) @@ -186,7 +219,7 @@ typedef struct sockaddr_in SOCKADDR_IN_T; #define AF_INET_V AF_INET #endif - + #define SERVER_DEFAULT_VERSION 3 #define SERVER_DTLS_DEFAULT_VERSION (-2) @@ -238,7 +271,7 @@ typedef struct tcp_ready { pthread_mutex_t mutex; pthread_cond_t cond; #endif -} tcp_ready; +} tcp_ready; void InitTcpReady(tcp_ready*); @@ -333,7 +366,7 @@ static INLINE int mygetopt(int argc, char** argv, const char* optstring) /* The C++ strchr can return a different value */ cp = (char*)strchr(optstring, c); - if (cp == NULL || c == ':') + if (cp == NULL || c == ':') return '?'; cp++; @@ -347,7 +380,7 @@ static INLINE int mygetopt(int argc, char** argv, const char* optstring) myoptarg = argv[myoptind]; myoptind++; } - else + else return '?'; } @@ -380,7 +413,7 @@ static INLINE void ShowX509(WOLFSSL_X509* x509, const char* hdr) byte serial[32]; int ret; int sz = sizeof(serial); - + printf("%s\n issuer : %s\n subject: %s\n", hdr, issuer, subject); while ( (altName = wolfSSL_X509_get_next_altname(x509)) != NULL) @@ -542,18 +575,11 @@ static INLINE void tcp_socket(SOCKET_T* sockfd, int udp) else *sockfd = socket(AF_INET_V, SOCK_STREAM, 0); -#ifdef USE_WINDOWS_API - if (*sockfd == INVALID_SOCKET) + if(WOLFSSL_SOCKET_IS_INVALID(*sockfd)) { err_sys("socket failed\n"); -#elif defined(WOLFSSL_TIRTOS) - if (*sockfd == -1) - err_sys("socket failed\n"); -#else - if (*sockfd < 0) - err_sys("socket failed\n"); -#endif + } -#ifndef USE_WINDOWS_API +#ifndef USE_WINDOWS_API #ifdef SO_NOSIGPIPE { int on = 1; @@ -583,10 +609,13 @@ static INLINE void tcp_socket(SOCKET_T* sockfd, int udp) } static INLINE void tcp_connect(SOCKET_T* sockfd, const char* ip, word16 port, - int udp) + int udp, WOLFSSL* ssl) { SOCKADDR_IN_T addr; build_addr(&addr, ip, port, udp); + if(udp) { + wolfSSL_dtls_set_peer(ssl, &addr, sizeof(addr)); + } tcp_socket(sockfd, udp); if (!udp) { @@ -769,7 +798,7 @@ static INLINE void udp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, func_args* args, word16 port, int useAnyAddr, - int udp, int ready_file) + int udp, int ready_file, int do_listen) { SOCKADDR_IN_T client; socklen_t client_len = sizeof(client); @@ -779,49 +808,47 @@ static INLINE void tcp_accept(SOCKET_T* sockfd, SOCKET_T* clientfd, return; } - tcp_listen(sockfd, &port, useAnyAddr, udp); + if(do_listen) { + tcp_listen(sockfd, &port, useAnyAddr, udp); -#if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER) && !defined(__MINGW32__) - /* signal ready to tcp_accept */ - { - tcp_ready* ready = args->signal; - pthread_mutex_lock(&ready->mutex); - ready->ready = 1; - ready->port = port; - pthread_cond_signal(&ready->cond); - pthread_mutex_unlock(&ready->mutex); - } -#elif defined (WOLFSSL_TIRTOS) - /* Need mutex? */ - tcp_ready* ready = args->signal; - ready->ready = 1; - ready->port = port; -#endif - - if (ready_file) { -#ifndef NO_FILESYSTEM - #ifndef USE_WINDOWS_API - FILE* srf = fopen("/tmp/wolfssl_server_ready", "w"); - #else - FILE* srf = fopen("wolfssl_server_ready", "w"); + #if defined(_POSIX_THREADS) && defined(NO_MAIN_DRIVER) && !defined(__MINGW32__) + /* signal ready to tcp_accept */ + { + tcp_ready* ready = args->signal; + pthread_mutex_lock(&ready->mutex); + ready->ready = 1; + ready->port = port; + pthread_cond_signal(&ready->cond); + pthread_mutex_unlock(&ready->mutex); + } + #elif defined (WOLFSSL_TIRTOS) + /* Need mutex? */ + tcp_ready* ready = args->signal; + ready->ready = 1; + ready->port = port; #endif - if (srf) { - fputs("ready", srf); - fclose(srf); + if (ready_file) { + #ifndef NO_FILESYSTEM + #ifndef USE_WINDOWS_API + FILE* srf = fopen("/tmp/wolfssl_server_ready", "w"); + #else + FILE* srf = fopen("wolfssl_server_ready", "w"); + #endif + + if (srf) { + fputs("ready", srf); + fclose(srf); + } + #endif } -#endif } *clientfd = accept(*sockfd, (struct sockaddr*)&client, (ACCEPT_THIRD_T)&client_len); -#ifdef USE_WINDOWS_API - if (*clientfd == INVALID_SOCKET) + if(WOLFSSL_SOCKET_IS_INVALID(*clientfd)) { err_sys("tcp accept failed"); -#else - if (*clientfd == -1) - err_sys("tcp accept failed"); -#endif + } } @@ -894,7 +921,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity, #endif /* NO_PSK */ -#ifdef USE_WINDOWS_API +#ifdef USE_WINDOWS_API #define WIN32_LEAN_AND_MEAN #include @@ -903,7 +930,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity, { static int init = 0; static LARGE_INTEGER freq; - + LARGE_INTEGER count; if (!init) { @@ -930,7 +957,7 @@ static INLINE unsigned int my_psk_server_cb(WOLFSSL* ssl, const char* identity, return (double)tv.tv_sec + (double)tv.tv_usec / 1000000; } - + #endif #endif /* USE_WINDOWS_API */ @@ -1133,18 +1160,18 @@ static INLINE int OpenNitroxDevice(int dma_mode,int dev_id) #endif /* HAVE_CAVIUM */ -#ifdef USE_WINDOWS_API +#ifdef USE_WINDOWS_API /* do back x number of directories */ static INLINE void ChangeDirBack(int x) { - char path[MAX_PATH]; - XMEMSET(path, 0, MAX_PATH); - XSTRNCAT(path, ".\\", MAX_PATH); - while (x-- > 0) { - XSTRNCAT(path, "..\\", MAX_PATH); - } - SetCurrentDirectoryA(path); + char path[MAX_PATH]; + XMEMSET(path, 0, MAX_PATH); + XSTRNCAT(path, ".\\", MAX_PATH); + while (x-- > 0) { + XSTRNCAT(path, "..\\", MAX_PATH); + } + SetCurrentDirectoryA(path); } /* does current dir contain str */ @@ -1180,14 +1207,14 @@ static INLINE int CurrentDir(const char* str) static INLINE void ChangeDirBack(int x) { char path[MAX_PATH]; - XMEMSET(path, 0, MAX_PATH); - XSTRNCAT(path, "./", MAX_PATH); - while (x-- > 0) { + XMEMSET(path, 0, MAX_PATH); + XSTRNCAT(path, "./", MAX_PATH); + while (x-- > 0) { XSTRNCAT(path, "../", MAX_PATH); - } - if (chdir(path) < 0) { - printf("chdir to %s failed\n", path); - } + } + if (chdir(path) < 0) { + printf("chdir to %s failed\n", path); + } } /* does current dir contain str */ @@ -1278,8 +1305,8 @@ static INLINE int CurrentDir(const char* str) mt = (memoryTrack*)ptr; --mt; /* same as minus sizeof(memoryTrack), removes header */ -#ifdef DO_MEM_STATS - ourMemStats.currentBytes -= mt->u.hint.thisSize; +#ifdef DO_MEM_STATS + ourMemStats.currentBytes -= mt->u.hint.thisSize; #endif free(mt); @@ -1308,7 +1335,7 @@ static INLINE int CurrentDir(const char* str) return ret; } - static INLINE void InitMemoryTracker(void) + static INLINE void InitMemoryTracker(void) { if (wolfSSL_SetAllocators(TrackMalloc, TrackFree, TrackRealloc) != 0) err_sys("wolfSSL SetAllocators failed for track memory"); @@ -1321,9 +1348,9 @@ static INLINE int CurrentDir(const char* str) #endif } - static INLINE void ShowMemoryTracker(void) + static INLINE void ShowMemoryTracker(void) { - #ifdef DO_MEM_STATS + #ifdef DO_MEM_STATS printf("total Allocs = %9lu\n", (unsigned long)ourMemStats.totalAllocs); printf("total Bytes = %9lu\n", @@ -1357,8 +1384,8 @@ static INLINE void StackSizeCheck(func_args* args, thread_func tf) #endif ret = posix_memalign((void**)&myStack, sysconf(_SC_PAGESIZE), stackSize); - if (ret != 0) - err_sys("posix_memalign failed\n"); + if (ret != 0) + err_sys("posix_memalign failed\n"); memset(myStack, 0x01, stackSize); @@ -1445,8 +1472,8 @@ typedef struct AtomicDecCtx { } AtomicDecCtx; -static INLINE int myMacEncryptCb(WOLFSSL* ssl, unsigned char* macOut, - const unsigned char* macIn, unsigned int macInSz, int macContent, +static INLINE int myMacEncryptCb(WOLFSSL* ssl, unsigned char* macOut, + const unsigned char* macIn, unsigned int macInSz, int macContent, int macVerify, unsigned char* encOut, const unsigned char* encIn, unsigned int encSz, void* ctx) { @@ -1513,7 +1540,7 @@ static INLINE int myMacEncryptCb(WOLFSSL* ssl, unsigned char* macOut, } -static INLINE int myDecryptVerifyCb(WOLFSSL* ssl, +static INLINE int myDecryptVerifyCb(WOLFSSL* ssl, unsigned char* decOut, const unsigned char* decIn, unsigned int decSz, int macContent, int macVerify, unsigned int* padSz, void* ctx) @@ -1668,8 +1695,8 @@ static INLINE int myEccSign(WOLFSSL* ssl, const byte* in, word32 inSz, return ret; wc_ecc_init(&myKey); - - ret = wc_EccPrivateKeyDecode(key, &idx, &myKey, keySz); + + ret = wc_EccPrivateKeyDecode(key, &idx, &myKey, keySz); if (ret == 0) ret = wc_ecc_sign_hash(in, inSz, out, outSz, &rng, &myKey); wc_ecc_free(&myKey); @@ -1690,7 +1717,7 @@ static INLINE int myEccVerify(WOLFSSL* ssl, const byte* sig, word32 sigSz, (void)ctx; wc_ecc_init(&myKey); - + ret = wc_ecc_import_x963(key, keySz, &myKey); if (ret == 0) ret = wc_ecc_verify_hash(sig, sigSz, hash, hashSz, result, &myKey); @@ -1719,8 +1746,8 @@ static INLINE int myRsaSign(WOLFSSL* ssl, const byte* in, word32 inSz, return ret; wc_InitRsaKey(&myKey, NULL); - - ret = wc_RsaPrivateKeyDecode(key, &idx, &myKey, keySz); + + ret = wc_RsaPrivateKeyDecode(key, &idx, &myKey, keySz); if (ret == 0) ret = wc_RsaSSL_Sign(in, inSz, out, *outSz, &myKey, &rng); if (ret > 0) { /* save and convert to 0 success */ @@ -1774,7 +1801,7 @@ static INLINE int myRsaEnc(WOLFSSL* ssl, const byte* in, word32 inSz, return ret; wc_InitRsaKey(&myKey, NULL); - + ret = wc_RsaPublicKeyDecode(key, &idx, &myKey, keySz); if (ret == 0) { ret = wc_RsaPublicEncrypt(in, inSz, out, *outSz, &myKey, &rng); @@ -1822,7 +1849,7 @@ static INLINE void SetupPkCallbacks(WOLFSSL_CTX* ctx, WOLFSSL* ssl) wolfSSL_CTX_SetEccSignCb(ctx, myEccSign); wolfSSL_CTX_SetEccVerifyCb(ctx, myEccVerify); #endif /* HAVE_ECC */ - #ifndef NO_RSA + #ifndef NO_RSA wolfSSL_CTX_SetRsaSignCb(ctx, myRsaSign); wolfSSL_CTX_SetRsaVerifyCb(ctx, myRsaVerify); wolfSSL_CTX_SetRsaEncCb(ctx, myRsaEnc); From 32171997e773613b5195011b8051b3691ee0010f Mon Sep 17 00:00:00 2001 From: David Garske Date: Wed, 14 Oct 2015 19:19:13 -0700 Subject: [PATCH 66/77] Updated Rowley CrossWorks README.md for enabling FREESCALE_MMCAU. Added sample benchmark output with MMCAU enabled. --- IDE/ROWLEY-CROSSWORKS-ARM/README.md | 4 ++-- IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c | 15 +++++++++++++++ IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp | 4 ---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/README.md b/IDE/ROWLEY-CROSSWORKS-ARM/README.md index 14bf47c3b..9fa89a27b 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/README.md +++ b/IDE/ROWLEY-CROSSWORKS-ARM/README.md @@ -31,8 +31,8 @@ To enable Freescale MMCAU: 1. [Download the MMCAU library](http://www.freescale.com/products/arm-processors/kinetis-cortex-m/k-series/k7x-glcd-mcus/crypto-acceleration-unit-cau-and-mmcau-software-library:CAUAP). 2. Copy the `lib_mmcau.a` and `cau_api.h` files into the project. -3. Add `-L $(ProjectDir) -l lib_mmcau.a` to project "Additional Linker Options" OR goto "Build Configuration" and check "MMCAU". -4. Enable the "FREESCALE_MMCAU" define in "user_settings.h" and make sure its value is 1. +3. Enable the `FREESCALE_MMCAU` define in `user_settings.h` and make sure its value is `1`. +4. Add the `lib_mmcau.a` file to `Source Files` in the application project. # Project Files diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c b/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c index 584acf933..99cf1fbc9 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c +++ b/IDE/ROWLEY-CROSSWORKS-ARM/benchmark_main.c @@ -66,4 +66,19 @@ RSA 1024 decryption took 573.000 milliseconds, avg over 1 iterations DH 1024 key generation 253.000 milliseconds, avg over 1 iterations DH 1024 key agreement 311.000 milliseconds, avg over 1 iterations Benchmark Test 1: Return code 0 + +SAMPLE OUTPUT: Freescale K64 running at 96MHz with MMCAU enabled: +Benchmark Test 1: +AES 25 kB took 0.019 seconds, 1.285 MB/s +ARC4 25 kB took 0.033 seconds, 0.740 MB/s +RABBIT 25 kB took 0.028 seconds, 0.872 MB/s +3DES 25 kB took 0.026 seconds, 0.939 MB/s +MD5 25 kB took 0.005 seconds, 4.883 MB/s +SHA 25 kB took 0.008 seconds, 3.052 MB/s +SHA-256 25 kB took 0.013 seconds, 1.878 MB/s +RSA 1024 encryption took 89.000 milliseconds, avg over 1 iterations +RSA 1024 decryption took 573.000 milliseconds, avg over 1 iterations +DH 1024 key generation 250.000 milliseconds, avg over 1 iterations +DH 1024 key agreement 308.000 milliseconds, avg over 1 iterations +Benchmark Test 1: Return code 0 */ diff --git a/IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp b/IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp index 4ec9e06d3..9d20a1ba5 100644 --- a/IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp +++ b/IDE/ROWLEY-CROSSWORKS-ARM/wolfssl.hzp @@ -306,10 +306,6 @@ Name="ARM_Release" batch_build_configurations="V7EM THUMB * Release" inherited_configurations="ARM;V7EM;Release;Kineits;Flash;THUMB" /> -