Simon Butcher | df81924 | 2015-08-19 19:33:27 +0100 | [diff] [blame] | 1 | # mbed TLS Benchmark Example |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 2 | |
| 3 | This application benchmarks the various cryptographic primitives offered by mbed TLS. |
| 4 | |
| 5 | ## Pre-requisites |
| 6 | |
Irit Arkin | cd8c0fb | 2015-08-27 15:44:11 +0100 | [diff] [blame^] | 7 | To build and run this example you must have: |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 8 | |
| 9 | * A computer with the following software installed: |
| 10 | * [CMake](http://www.cmake.org/download/). |
| 11 | * [yotta](https://github.com/ARMmbed/yotta). Please note that **yotta has its own set of dependencies**, listed in the [installation instructions](http://armmbed.github.io/yotta/#installing-on-windows). |
| 12 | * [Python](https://www.python.org/downloads/). |
Irit Arkin | cd8c0fb | 2015-08-27 15:44:11 +0100 | [diff] [blame^] | 13 | * [The ARM GCC toolchain](https://launchpad.net/gcc-arm-embedded). |
| 14 | * A serial terminal emulator (Like screen, pySerial and cu). |
Simon Butcher | df81924 | 2015-08-19 19:33:27 +0100 | [diff] [blame] | 15 | * An [FRDM-K64F](http://developer.mbed.org/platforms/FRDM-K64F/) development board, or another board supported by mbed OS (in which case you'll have to substitute frdm-k64f-gcc with the appropriate target in the instructions below). |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 16 | * A micro-USB cable. |
| 17 | * If your OS is Windows, please follow the installation instructions [for the serial port driver](https://developer.mbed.org/handbook/Windows-serial-configuration). |
| 18 | |
| 19 | ## Getting started |
| 20 | |
Simon Butcher | df81924 | 2015-08-19 19:33:27 +0100 | [diff] [blame] | 21 | 1. Connect the FRDM-K64F to the computer with the micro-USB cable, being careful to use the "OpenSDA" connector on the target board. |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 22 | |
| 23 | 2. Navigate to the mbedtls directory supplied with your release and open a terminal. |
| 24 | |
| 25 | 3. Set the yotta target: |
| 26 | |
| 27 | ``` |
| 28 | yotta target frdm-k64f-gcc |
| 29 | ``` |
| 30 | |
Simon Butcher | a150050 | 2015-08-19 20:29:31 +0100 | [diff] [blame] | 31 | 4. Build mbedtls and the examples. This may take a long time if this is your first compilation: |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 32 | |
| 33 | ``` |
Simon Butcher | df81924 | 2015-08-19 19:33:27 +0100 | [diff] [blame] | 34 | $ yotta build |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 35 | ``` |
| 36 | |
Brian Daniels | 3c405ae | 2015-08-18 10:52:57 -0700 | [diff] [blame] | 37 | 5. Copy `build/frdm-k64f-gcc/test/mbedtls-test-example-benchmark.bin` to your mbed board and wait until the LED next to the USB port stops blinking. |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 38 | |
Irit Arkin | cd8c0fb | 2015-08-27 15:44:11 +0100 | [diff] [blame^] | 39 | 6. Start the serial terminal emulator and connect to the virtual serial port presented by FRDM-K64F. |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 40 | |
Irit Arkin | cd8c0fb | 2015-08-27 15:44:11 +0100 | [diff] [blame^] | 41 | Use the following settings: |
| 42 | |
| 43 | * 115200 baud (not 9600). |
| 44 | * 8N1. |
| 45 | * No flow control. |
| 46 | |
| 47 | 7. Press the Reset button on the board. |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 48 | |
Brian Daniels | 3c405ae | 2015-08-18 10:52:57 -0700 | [diff] [blame] | 49 | 8. The output in the terminal window should look like: |
Manuel Pégourié-Gonnard | 63e7eba | 2015-07-28 14:17:48 +0200 | [diff] [blame] | 50 | |
| 51 | ``` |
| 52 | {{timeout;150}} |
| 53 | {{host_test_name;default}} |
| 54 | {{description;mbed TLS benchmark program}} |
| 55 | {{test_id;MBEDTLS_BENCHMARK}} |
| 56 | {{start}} |
| 57 | |
| 58 | |
| 59 | SHA-1 : 3644 Kb/s, 32 cycles/byte |
| 60 | SHA-256 : 1957 Kb/s, 59 cycles/byte |
| 61 | SHA-512 : 587 Kb/s, 200 cycles/byte |
| 62 | AES-CBC-128 : 1359 Kb/s, 86 cycles/byte |
| 63 | AES-CBC-192 : 1183 Kb/s, 99 cycles/byte |
| 64 | AES-CBC-256 : 1048 Kb/s, 111 cycles/byte |
| 65 | AES-GCM-128 : 421 Kb/s, 279 cycles/byte |
| 66 | AES-GCM-192 : 403 Kb/s, 292 cycles/byte |
| 67 | AES-GCM-256 : 385 Kb/s, 305 cycles/byte |
| 68 | AES-CCM-128 : 542 Kb/s, 216 cycles/byte |
| 69 | AES-CCM-192 : 484 Kb/s, 242 cycles/byte |
| 70 | AES-CCM-256 : 437 Kb/s, 268 cycles/byte |
| 71 | CTR_DRBG (NOPR) : 1002 Kb/s, 117 cycles/byte |
| 72 | CTR_DRBG (PR) : 705 Kb/s, 166 cycles/byte |
| 73 | HMAC_DRBG SHA-1 (NOPR) : 228 Kb/s, 517 cycles/byte |
| 74 | HMAC_DRBG SHA-1 (PR) : 210 Kb/s, 561 cycles/byte |
| 75 | HMAC_DRBG SHA-256 (NOPR) : 212 Kb/s, 557 cycles/byte |
| 76 | HMAC_DRBG SHA-256 (PR) : 185 Kb/s, 637 cycles/byte |
| 77 | RSA-2048 : 41 ms/ public |
| 78 | RSA-2048 : 1349 ms/private |
| 79 | RSA-4096 : 134 ms/ public |
| 80 | RSA-4096 : 7149 ms/private |
| 81 | ECDSA-secp384r1 : 640 ms/sign |
| 82 | ECDSA-secp256r1 : 387 ms/sign |
| 83 | ECDSA-secp384r1 : 1233 ms/verify |
| 84 | ECDSA-secp256r1 : 751 ms/verify |
| 85 | ECDHE-secp384r1 : 1191 ms/handshake |
| 86 | ECDHE-secp256r1 : 730 ms/handshake |
| 87 | ECDHE-Curve25519 : 611 ms/handshake |
| 88 | ECDH-secp384r1 : 584 ms/handshake |
| 89 | ECDH-secp256r1 : 365 ms/handshake |
| 90 | ECDH-Curve25519 : 303 ms/handshake |
| 91 | |
| 92 | {{success}} |
| 93 | {{end}} |
| 94 | ``` |