From 7dce9816699b932fc69764133d1b4ca889257bf1 Mon Sep 17 00:00:00 2001 From: Ken MacKay Date: Sat, 17 May 2014 23:27:09 -0700 Subject: [PATCH] Add some code size and performance measurements. --- README.md | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 134 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 1e0893f..68cdbc7 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,12 @@ Features Usage Notes ----------- -#### Point Representation #### +### Point Representation ### Compressed points are represented in the standard format as defined in http://www.secg.org/collateral/sec1_final.pdf; uncompressed points are represented in standard format, but without the `0x04` prefix. `uECC_make_key()`, `uECC_shared_secret()`, `uECC_sign()`, and `uECC_verify()` only handle uncompressed points; you can use `uECC_compress()` and `uECC_decompress()` to convert between compressed and uncompressed point representations. Private keys are represented in the standard format. -#### Using the Code #### +### Using the Code ### I recommend just copying (or symlink) uECC.h, uECC.c, and the appropriate asm\_<arch>\_.inc (if any) into your project. Then just `#include "uECC.h"` to use the micro-ecc functions. @@ -31,9 +31,139 @@ For use with Arduino, you can just create a symlink to the `uECC` directory in y See uECC.h for documentation for each function. -#### Compilation Notes #### +### Compilation Notes ### * Should compile with any C/C++ compiler that supports stdint.h (this includes Visual Studio 2013). * When compiling for a Thumb-1 platform with inline assembly enabled (ie, `uECC_ASM` is defined to `uECC_asm_small` or `uECC_asm_fast`), you must use the `-fomit-frame-pointer` GCC option (this is enabled by default when compiling with `-O1` or higher). * When compiling for AVR with inline assembly enabled, you must have optimizations enabled (compile with `-O1` or higher). - * When building on Windows, you will need to link in the `advapi32.lib` system library. + * When building for Windows, you will need to link in the `advapi32.lib` system library. + +### AVR Performance ### + +All tests were built using avr-gcc 4.8.1 with `-Os`, and were run on a 16 MHz ATmega256RFR2. Code size refers to the space used by micro-ecc code and data. + +#### ECDH (fast) #### + +In these tests, `uECC_ASM` was defined to `uECC_asm_fast` and `ECC_SQUARE_FUNC` was defined to `1` in all cases. + + + + + + + + + + + + + + + + + + + + + + + +
secp160r1secp192r1secp256r1secp256k1
ECDH time (ms):47081022201615
Code size (bytes):10768131122088621126
+ +#### ECDH (small) #### + +In these tests, `uECC_ASM` was defined to `uECC_asm_small` and `ECC_SQUARE_FUNC` was defined to `0` in all cases. + + + + + + + + + + + + + + + + + + + + + + + +
secp160r1secp192r1secp256r1secp256k1
ECDH time (ms):1250181047904700
Code size (bytes):3244340052743426
+ +#### ECDSA (fast) #### + +In these tests, `uECC_ASM` was defined to `uECC_asm_fast` and `ECC_SQUARE_FUNC` was defined to `1` in all cases. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
secp160r1secp192r1secp256r1secp256k1
ECDSA sign time (ms):55590223861773
ECDSA verify time (ms):59099026501800
Code size (bytes):13246147982259422826
+ +#### ECDSA (small) #### + +In these tests, `uECC_ASM` was defined to `uECC_asm_small` and `ECC_SQUARE_FUNC` was defined to `0` in all cases. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
secp160r1secp192r1secp256r1secp256k1
ECDSA sign time (ms):1359193149984904
ECDSA verify time (ms):1515216057005220
Code size (bytes):5690505469805080