Permalink
Browse files

Replace OpenSSL

Use much smaller, portable micro-ECC and SHA2 libraries.
  • Loading branch information...
past-due authored and perim committed Aug 16, 2017
1 parent 3d0bf00 commit f1c474153f7c55b5b39a9fdb805a7a7a4c1819c8
Showing with 39,070 additions and 221 deletions.
  1. +7 −0 3rdparty/micro-ecc/CMakeLists.txt
  2. +21 −0 3rdparty/micro-ecc/LICENSE.txt
  3. +21 −0 3rdparty/micro-ecc/Makefile.am
  4. +41 −0 3rdparty/micro-ecc/README.md
  5. +820 −0 3rdparty/micro-ecc/asm_arm.inc
  6. +2,311 −0 3rdparty/micro-ecc/asm_arm_mult_square.inc
  7. +1,202 −0 3rdparty/micro-ecc/asm_arm_mult_square_umaal.inc
  8. +1,089 −0 3rdparty/micro-ecc/asm_avr.inc
  9. +26,311 −0 3rdparty/micro-ecc/asm_avr_mult_square.inc
  10. +1,248 −0 3rdparty/micro-ecc/curve-specific.inc
  11. +127 −0 3rdparty/micro-ecc/emk_project.py
  12. +3 −0 3rdparty/micro-ecc/emk_rules.py
  13. +85 −0 3rdparty/micro-ecc/examples/ecc_test/ecc_test.ino
  14. +9 −0 3rdparty/micro-ecc/library.properties
  15. +71 −0 3rdparty/micro-ecc/platform-specific.inc
  16. +188 −0 3rdparty/micro-ecc/scripts/mult_arm.py
  17. +203 −0 3rdparty/micro-ecc/scripts/mult_avr.py
  18. +143 −0 3rdparty/micro-ecc/scripts/mult_avr_extra.py
  19. +242 −0 3rdparty/micro-ecc/scripts/square_arm.py
  20. +327 −0 3rdparty/micro-ecc/scripts/square_avr.py
  21. +4 −0 3rdparty/micro-ecc/test/emk_rules.py
  22. +79 −0 3rdparty/micro-ecc/test/test_compress.c
  23. +81 −0 3rdparty/micro-ecc/test/test_compute.c
  24. +90 −0 3rdparty/micro-ecc/test/test_ecdh.c
  25. +59 −0 3rdparty/micro-ecc/test/test_ecdsa.c
  26. +93 −0 3rdparty/micro-ecc/test/test_ecdsa_deterministic.c.example
  27. +108 −0 3rdparty/micro-ecc/types.h
  28. +1,634 −0 3rdparty/micro-ecc/uECC.c
  29. +365 −0 3rdparty/micro-ecc/uECC.h
  30. +172 −0 3rdparty/micro-ecc/uECC_vli.h
  31. +7 −0 3rdparty/sha2/CMakeLists.txt
  32. +17 −0 3rdparty/sha2/Makefile.am
  33. +136 −0 3rdparty/sha2/brg_endian.h
  34. +184 −0 3rdparty/sha2/brg_types.h
  35. +772 −0 3rdparty/sha2/sha2.c
  36. +151 −0 3rdparty/sha2/sha2.h
  37. +2 −0 CMakeLists.txt
  38. +4 −0 COPYING.NONGPL
  39. +2 −0 Makefile.am
  40. +3 −2 configure.ac
  41. +1 −1 docker/cross-compile/dockerfile
  42. +2 −2 lib/framework/CMakeLists.txt
  43. +560 −174 lib/framework/crc.cpp
  44. +14 −0 lib/framework/crc.h
  45. +8 −0 lib/framework/framework.vcxproj
  46. +30 −0 lib/framework/framework.vcxproj.filters
  47. +1 −3 src/CMakeLists.txt
  48. +20 −11 src/Makefile.am
  49. +0 −26 src/main.cpp
  50. +2 −2 tests/Makefile.am
@@ -0,0 +1,7 @@
cmake_minimum_required (VERSION 3.5)
file(GLOB HEADERS "*.h")
file(GLOB SRC "*.c")
add_library(microecc STATIC ${HEADERS} ${SRC})
target_include_directories(microecc PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
@@ -0,0 +1,21 @@
Copyright (c) 2014, Kenneth MacKay
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,21 @@
if MINGW32
WZ_CPPFLAGS += -D_WIN32_WINNT=0x0501 -DSTATICLIB
WZ_CFLAGS += -D_WIN32_WINNT=0x0501 -DSTATICLIB
WZ_CXXFLAGS += -D_WIN32_WINNT=0x0501 -DSTATICLIB
endif
AM_CPPFLAGS = $(WZ_CPPFLAGS)
AM_CFLAGS = $(WZ_CFLAGS) $(WZ_C99FLAGS) -UDEBUG
noinst_LIBRARIES = libmicroecc.a
noinst_HEADERS = \
types.h \
uECC_vli.h \
uECC.h
libmicroecc_a_SOURCES = \
uECC.c
EXTRA_DIST = \
LICENSE.txt \
README.md
@@ -0,0 +1,41 @@
micro-ecc
==========
A small and fast ECDH and ECDSA implementation for 8-bit, 32-bit, and 64-bit processors.
The static version of micro-ecc (ie, where the curve was selected at compile-time) can be found in the "static" branch.
Features
--------
* Resistant to known side-channel attacks.
* Written in C, with optional GCC inline assembly for AVR, ARM and Thumb platforms.
* Supports 8, 32, and 64-bit architectures.
* Small code size.
* No dynamic memory allocation.
* Support for 5 standard curves: secp160r1, secp192r1, secp224r1, secp256r1, and secp256k1.
* BSD 2-clause license.
Usage Notes
-----------
### Point Representation ###
Compressed points are represented in the standard format as defined in http://www.secg.org/sec1-v2.pdf; uncompressed points are represented in standard format, but without the `0x04` prefix. All functions except `uECC_compress()` only accept uncompressed points; 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 ###
I recommend just copying (or symlink) the uECC files into your project. Then just `#include "uECC.h"` to use the micro-ecc functions.
For use with Arduino, you can use the Library Manager to download micro-ecc (**Sketch**=>**Include Library**=>**Manage Libraries**). You can then use uECC just like any other Arduino library (uECC should show up in the **Sketch**=>**Import Library** submenu).
See uECC.h for documentation for each function.
### Compilation Notes ###
* Should compile with any C/C++ compiler that supports stdint.h (this includes Visual Studio 2013).
* If you want to change the defaults for any of the uECC compile-time options (such as `uECC_OPTIMIZATION_LEVEL`), you must change them in your Makefile or similar so that uECC.c is compiled with the desired values (ie, compile uECC.c with `-DuECC_OPTIMIZATION_LEVEL=3` or whatever).
* When compiling for a Thumb-1 platform, you must use the `-fomit-frame-pointer` GCC option (this is enabled by default when compiling with `-O1` or higher).
* When compiling for an ARM/Thumb-2 platform with `uECC_OPTIMIZATION_LEVEL` >= 3, you must use the `-fomit-frame-pointer` GCC option (this is enabled by default when compiling with `-O1` or higher).
* When compiling for AVR, you must have optimizations enabled (compile with `-O1` or higher).
* When building for Windows, you will need to link in the `advapi32.lib` system library.
Oops, something went wrong.

0 comments on commit f1c4741

Please sign in to comment.