README.md
1
2# Micrium μC/OS-III Port
3## Overview
4You can enable the wolfSSL support for Micrium μC/OS-III RTOS available [here](http://www.micrium.com/) using the define `MICRIUM`.
5
6## Usage
7
8You can start with your IDE-based example project for Micrium uC/OS-III and uC/TCPIP stack. You must include the uC-Clk module into your project because wolfSSL uses Micrium’s Clk_GetTS_Unix () function from <clk.h> in order to authenticate the start and end dates of certificates.
9
10wolfSSL supports a compile-time user configurable options in the `IDE/ECLIPSE/MICRIUM/user_settings.h` file.
11
12The `wolfsslRunTests.c` example application provides a simple function to run the selected examples at compile time through the following four #defines in user_settings.h.
13
14```
15 1. #define WOLFSSL_WOLFCRYPT_TEST
16 2. #define WOLFSSL_BENCHMARK_TEST
17 3. #define WOLFSSL_CLIENT_TEST
18 4. #define WOLFSSL_SERVER_TEST
19
20You can define one or all of the above options.
21```
221. Open your IDE-based example project for Micrium uC/OS-III (with the uC-Clk module) and uC/TCPIP stack.
23
242. Create the following folder and sub-folders structures in your project.
25```
26wolfssl
27 |src
28 |wolfcrypt
29 |benchmark
30 |src
31 |test
32 |wolfssl
33 |openssl
34 |wolfcrypt
35 |exampleTLS
36```
37The folder hierarchy is the same as the wolfSSL folders with an exception of the exampleTLS folder.
38
393. Right click on the exampleTLS folder, add or link all of the header and source files in `IDE/ECLIPSE/MICRIUM/` folder into the exampleTLS folder.
40
414. Right click on each folders, add or link all the source code in the corresponding folder in wolfSSL.
42
435. Remove non-C platform dependent files from your build. At the moment, only aes_asm.asm and aes_asm.s must be removed from your wolfssl/wolfcrypt/src folder.
44
456. In your C/C++ compiler preprocessor settings, add the wolfSSL directories to your include paths.
46Here's an example of the paths that must be added.
47```
48$PROJ_DIR$\...
49$PROJ_DIR$\...\wolfcrypt
50$PROJ_DIR$\...\wolfssl
51$PROJ_DIR$\...\IDE\ECLIPSE\MICRIUM
52```
537. In your C/C++ compiler preprocessor settings, define the WOLFSSL_USER_SETTINGS symbol to add user_settings.h file in your project.
54
558. Add a call to `wolfsslRunTests()` from your startup task. Here's an example:
56```
57static void App_TaskStart (void *p_arg)
58{
59 OS_ERR os_err;
60 ...
61 while (DEF_TRUE) {
62 wolfsslRunTests();
63 OSTimeDlyHMSM(0u, 5u, 0u, 0u,OS_OPT_TIME_HMSM_STRICT, &os_err);
64 }
65}
66```
679. Rebuild all your project.
68
6910. Now you are ready to download and debug your image on the board.
70
71The test results below were collected from the NXP Kinetis K70 (Freescale TWR-K70F120M MCU) tower system board with the following software and tool chains:
72
73- IAR Embedded Workbench IDE - ARM 8.32.1 (IAR ELF Linker V8.32.1.169/W32 for ARM)
74
75- The starting project is based on an IAR EWARM project from Micrium download center at [micrium_twr-k70f120m-os3/](https://www.micrium.com/download/micrium_twr-k70f120m-os3/) but the K70X_FLASH.icf linker script file was slightly modified to configure the stack and heap sizes to 16KB and 20KB. The test was run on a 1 MBytes of program flash and 128 KBytes of static RAM. ([Similar TCP version](https://www.micrium.com/download/twr-k70f120m_os3-tcpip-wifi-lib/))
76
77- wolfssl [latest version](https://github.com/wolfSSL/wolfssl)
78
79
80### `WOLFSSL_WOLFCRYPT_TEST` output of wolfcrypt_test()
81```
82error test passed!
83base64 test passed!
84asn test passed!
85MD5 test passed!
86MD4 test passed!
87SHA test passed!
88SHA-256 test passed!
89SHA-512 test passed!
90Hash test passed!
91HMAC-MD5 test passed!
92HMAC-SHA test passed!
93HAC-SHA256 test passed!
94HMAC-SHA512 test passed!
95GMC test passed!
96HC-128 test passed!
97Rabbit test passed!
98DS test passed!
99DS3 test passed!
100AES test passed!
101AES192 test passed!
102AES256 test passed!
103AES-GM test passed!
104RANDOM test passed!
105RSA test passed!
106DH test passed!
107DSA test passed!
108PWDBASED test passed!
109ECC test passed!
110ECC buffer test passed!
111CURVE25519 test passed!
112ED25519 test passed!
113logging test passed!
114mutex test passed!
115memcb test passed!
116```
117### `WOLFSSL_BENCHMARK_TEST` output of benchmark_test()
118```
119------------------------------------------------------------------------------
120 wolfSSL version 3.15.5
121------------------------------------------------------------------------------
122wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each)
123RNG 225 KB tooks 1.026 seconds, 219.313 KB/s
124AES-128-CBC-enc 250 KB toks 1.105 seconds 226.210 KB/s
125AES-128-CBC-dec 225 KB tooks 1.005 seconds, 223.922 KB/s
126AES-192-CBC-enc 225 KB tooks 1.076 seconds, 209.104 KB/s
127AES-192-CBC-dec 225 KB tooks 1.077 seconds, 208.981 K/s
128AES-56-CBC-enc 200 KB tooks 1.029 seconds, 19.396 KB/s
129AES-256-CBC-dec 200 KB toks 1.022 seconds, 195.785 KB/s
130AES-128-GCM-enc 125 KB tooks 1.28 secnds, 101.70 KB/s
131AES-128-GC-dec 125 KB tooks 1.228 seconds 101.756 KB/s
132AES-192-GCM-enc 100 KB tooks 1.026 seconds, 97.493 KB/s
133AES-192-GCM-dec 100 KB tooks 1.026 seconds, 97.480 KB/s
134AES-256-GCM-enc 100 KB tooks 1.065 seconds, 93.909 KB/s
135AES-256-GC-dec 100 KB tooks 1.065 seconds, 93.897 KB/s
136RABBIT 2 MB tooks 1.011 seconds, 2.19 MB/s
1373DES 100 KB tooks 1.007 sconds, 99.312 KB/s
138MD5 3MB tooks 1.008 seonds, 2.907 MBs
139SHA 1 MB tooks 1.09 secnds, 1.283 MB/s
140SHA-256 575 KB tooks 1.037 seconds, 554.501 KB/s
141SHA-512 200 KB tooks 1.003 seconds, 199.444 KB/s
142HMAC-MD5 3 B tooks 1.002 seconds, 2.876 MB/s
143HMAC-SHA26 550 KB tooks 1.000 seconds, 549.95 KB//s
144HMAC-SHA512 200 KB toks 1.018 seconds, 196.452 KB/s
145RSA 2048 public 8 ops took 1.025 sec, avg 128.135 ms, 7.804 op/sec
146RSA 2048 private 2 ops took 4.972 ec, avg 2485.951 s, 0.402 ops/sec
147DH 2048 key en 2 ops took 1.927 sec, avg 96.303 ms, 1.038 op/sec
148DH 2048 agree 2ops took 1.937 sc, avg 968.578 ms, 1.032 ops/sec
149ECC 256 key gen 3 ops took 1.185 sec, avg 394.944 ms, 2.53 ops/sec
150ECDHE 256 agree 4 ops took 1.585 sec, avg 396.168 ms, 2.524 ops/sec
151ECSA 256 sign 4 ops took 1.611 sec, avg 402.865 ms, 2.482 ops/sec
152ECDSA 256verif 2 ops tok 1.586 sec, avg 793.153 ms, 1.261 opssec
153CURVE 25519 key gen 2 ops took 1.262 sec, avg 630.907 ms, 1.585 ops/sec
154CURE 25519 agree 2 ops took 1.261 sec, avg630.469 ms, 1.586 ops/sec
155ED 2519 key gen 2 ops took 1.27 sec, avg 66.099ms, 1.572 ops/sec
156ED 25519 sign 2 ops took 1.303 sec, ag 65.633 ms, 1.35 op/sec
157ED 25519 verify 2 ops took 2.674 sec, avg1337.68 ms 0.748 ops/ec
158```
159### `WOLFSSL_CLIENT_TEST` wolfssl_client_test()
160
161You can modify the `TCP_SERVER_IP_ADDR` and `TCP_SERVER_PORT` macros at top of the `client_wolfssl.c` file to configure the host address and port. You will also need the server certificate. This example uses TLS 1.2 to connect to a remote host.
162
163### `WOLFSSL_SERVER_TEST` wolfssl_server_test()
164
165You can modify the `TLS_SERVER_PORT` at top of `server_wolfssl.c` to configure the port number to listen on local-host.
166
167Once you start the TLS server and `Listening for client connection` displays on the serial console, the server is ready to accept client connections.
168
169You can connect to the server using the wolfssl TLS client example from your Linux or Windows host as follows:
170
171$ ./examples/client/client.exe -h TLS_SERVER_IP_ADDRES
172SSL version is TLSv1.2
173SSL cipher suite is TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256
174SSL curve name is SECP256R1
175I hear ya fa shizzle!
176
177
178## References
179
180For more information please contact info@wolfssl.com.
181