90 Commits

Author SHA1 Message Date
Ken MacKay a24112de66 Implement mitigation for hcca attack 2024-11-12 08:44:34 -08:00
Ken MacKay 24c60e2435 Add test vector for ECDSA secp256k1 2020-12-24 17:45:25 -08:00
Jaroslav Ban 71563d854c Added RNG for nRF52 series. Fixed infinite for loop because of int - wordcount_t mismatch 2020-10-27 23:51:07 +01:00
Ken MacKay d1ab664e02 Random initial Z when calculating the public key 2020-10-12 16:49:35 -07:00
Ken MacKay c1402e768a Merge pull request #143 from westin123/master
Conditionally removed vararg related macros for platforms where they …
2020-10-07 11:50:05 -07:00
westin123 66ef25a371 Update uECC.c
Added uECC_arm_thumb2
2020-10-07 13:02:43 -05:00
Ken MacKay 1b5f5cea51 Fix for #168 2020-10-07 10:47:40 -07:00
Westin Sykes 867e40b21e Conditionally removed vararg related macros for platforms where they are not used to prevent issues with compilers that don't support GCC features. 2018-08-23 16:06:19 -05:00
Vitali Lovich d2f1bd6766 Fix static annotation for uECC_valid_point
Resolves #124
2017-08-16 17:34:23 -07:00
Mathias Tausig 8d0af43866 Renamed variables named 'private' and 'public' to prevent compilation problems with C++ 2016-07-27 16:54:07 +02:00
Ken MacKay b6c0cdbe7d Add functions to get the private/public key size for a curve (#73) 2016-03-08 21:29:40 -08:00
cacu af1a5c75a0 Avoid warnings when compiling without uECC_VLI_NATIVE_LITTLE_ENDIAN 2016-03-08 20:30:59 +01:00
cacu ceae2ca088 Fix curly brace placement 2016-03-08 09:49:04 +01:00
cacu eff564675d Fix code formatting and document the fact that input arrays must be word
aligned
2016-03-08 09:47:02 +01:00
cacu 289a8e0340 Several fixes singled out in the pull request discussion thread. 2016-03-07 18:08:08 +01:00
cacu 778effd967 Add a new uECC_VLI_NATIVE_LITTLE_ENDIAN compile-time macro that enables
fully native little endian platforms interfacing with little endian byte
streams to avoid using additional stack space and pre and post byte
reversals
2016-03-07 13:09:22 +01:00
cacu 01f15fb6b3 Add a new compile-time macro to use the local native format for VLI
handling. This is useful for little-endian machines that have to
interface with protocol stacks using little-endian byte ordering.
2016-03-01 22:29:41 +01:00
Sean Wilson 35423ba878 Provide API access to the built-in RNG code. 2016-01-15 14:50:31 -05:00
Andrew Ruder 451d53a62e uECC_HashContext => const uECC_HashContext
This is an important piece of "documentation" as it indicates to the
caller that a uECC_HashContext can be initialized and subsequently
used multiple times (for multiple signatures).
2015-12-23 15:42:14 -06:00
Andrew Ruder 6b0566beb6 uECC.h uECC.c: whitespace cleanups
Just removing trailing whitespace.
2015-12-23 10:24:53 -06:00
Evgeni Margolis 61bd1ada6f Added new API functions: uECC_curve_num_bytes() and uECC_curve_num_n_bytes(). 2015-11-01 01:39:57 -07:00
Ken MacKay 1affc1b75c Add AVR asm implementations for runtime curve selection.
Fast mult/square are not yet supported.
2015-10-12 21:29:57 -07:00
Ken MacKay 4014bbd378 Fix formatting. 2015-10-12 21:29:57 -07:00
Evgeni Margolis 12651728ea Addressed review comments to PR #58. Main change:
Removed clamping via subtraction update in the uECC_generate_random_int function.
2015-10-12 21:29:57 -07:00
Evgeni Margolis 7b115fdf93 Updated and generalized random number generation function
(uECC_generate_random_int). This function is also used internally.
In the new implementation when the random number is outside of the
requested range it is corrected by subtraction instead of requesting
new random number.
2015-10-12 21:29:57 -07:00
Evgeni Margolis 8b3838ea5f Removed unused "curve" parameter from uECC_vli_nativeToBytes and
uECC_vli_bytesToNative functions.
2015-10-12 21:29:57 -07:00
Ken MacKay 6826dd4789 Make bits2int reduce mod n (#53) 2015-10-12 21:29:57 -07:00
Ken MacKay 0283b542ef Convert hash to int in sign/verify (#53)
Previously, callers would need to manually convert the hash value
appropriately if it was not the same length as curve_n. Now, callers
just pass in the full hash value and the length; uECC will convert
the hash as appropriate.
2015-10-12 21:29:57 -07:00
Ken MacKay 4ae15e365b Updated so that private keys are always the correct length.
Specifically, the private key for secp160r1 is now required to be
21 bytes. Added some comments about buffer sizes.
2015-10-12 21:29:57 -07:00
Ken MacKay 1341d3dce5 Fix fast ARM mult/square asm for Xcode 2015-10-12 21:29:57 -07:00
Ken MacKay f58c04fdec Minor cleanup 2015-10-12 21:29:57 -07:00
Ken MacKay 69744ae539 Added uECC_generate_random_int(), and made uECC_vli_cmp() constant-time. 2015-10-12 21:29:56 -07:00
Ken MacKay 856a90df3b Cache the values of curve->num_words and curve->num_n_words.
Apparently the optimizer is not as smart as I thought.
2015-10-12 21:29:56 -07:00
Ken MacKay e9ac0d230b Make uECC_RNG_NUM_TRIES modifiable at compile time. 2015-10-12 21:29:56 -07:00
Ken MacKay 74f6d2d9d7 Directly expose vli functions if uECC_ENABLE_VLI_API != 0
Added a header file for those functions as well.
2015-10-12 21:29:56 -07:00
Evgeni Margolis ca9e456f42 Added new define (uECC_SUPPORT_COMPRESSED_POINT) and new API functions. 2015-10-12 21:29:56 -07:00
Ken MacKay 2cc5e9211a Add an intermediate optimization level where only add/sub are "fast".
Also made uECC_SQUARE_FUNC separately controllable for now.
2015-10-12 21:29:56 -07:00
Ken MacKay 5d6644e23f Make wordcount_t signed, and remove swordcount_t. 2015-10-12 21:29:56 -07:00
Ken MacKay c250083ccd Use constant-time vli_isZero() and vli_equal() functions. 2015-10-12 21:29:56 -07:00
Ken MacKay a6a4bdd5e0 Default POSIX/Windows RNG should be treated as user-set RNG.
The default RNG functions on POSIX and windows are secure, and
should be used as if the user had set an RNG. Also, don't set an
RNG at all on other platforms.
2015-10-12 21:29:56 -07:00
Ken MacKay 4fed9753f0 Add API for internal functions. 2015-10-12 21:29:56 -07:00
Ken MacKay dfcc9b4ec5 Generate the correct number of bits for k when num_n_words != num_words. 2015-10-12 21:29:56 -07:00
Ken MacKay ac6de20ea5 Only declare functions if needed. (#50) 2015-10-12 21:29:56 -07:00
Ken MacKay 5f01beb717 Add fast ARM asm; cleaned up code. Added optimization setting. (#50) 2015-10-12 21:29:56 -07:00
Ken MacKay 08ae3fd516 Add small ARM asm. (#50) 2015-10-12 21:28:44 -07:00
Ken MacKay 876e32ccce Add curve-specific mmod functions. (#50) 2015-10-12 21:28:44 -07:00
Ken MacKay 25941ccc4d Initial, unreasonably slow implementation of multiple curve support. (#50) 2015-10-12 21:28:44 -07:00
Josh Datko 3345d505ad Removes unused variables.
Produced compiler warning with unused variables.
2015-09-01 14:42:55 -06:00
Josh Datko e3caebc792 Whitespace cleanup. 2015-09-01 14:42:18 -06:00
Evgeni Margolis 85d858cb09 Added compile time checks to skip vli_square() and muladd() functions when they are not used 2015-07-08 20:14:05 -07:00