Chris Conlon
2db7bf0dc0
use static digest for X9.63 KDF, add smallstack support
2016-12-08 17:28:53 -07:00
Chris Conlon
a5b267087f
add ANSI-X9.63-KDF support [SEC1]
2016-12-07 20:26:09 -07:00
David Garske
eaca90db28
New Atmel support (WOLFSSL_ATMEL) and port for ATECC508A (WOLFSSL_ATECC508A). Adds wolfCrypt support for ECC Hardware acceleration using the ATECC508A. Adds new PK callback for ECC shared secret. Fixed missing "wc_InitRng_ex" when using "CUSTOM_RAND_GENERATE_BLOCK". Added ATECC508A RNG block function for P-RNG bypass ability. Added internal "wolfSSL_GetEccPrivateKey" function for getting reference to private key for ECC shared secret (used in test.h for testing PK_CALLBACK mode). Added README.md for using the Atmel ATECC508A port.
2016-12-07 07:57:55 -08:00
David Garske
ae75842021
Fix build issues with rebase for ECC and RSA. Changed user_settings.h example when LTC is enabled to disable Shamir and ECC-521. Cleanup to add USE_NXP_MMCAU and USE_NXP_LTC for the example user_settings.h, so the project file can automatically configure.
2016-12-05 09:01:59 -08:00
David Garske
a6b96b17ff
Fixes to include path for NXP ksdk_port. Fixes for time USER/OVERRIDES so their #ifdef's are checked first. Fix to initialize LTC via new "ksdk_port_init" function. Cleanup of the ksdk_port.c for formatting, macros, statics and line length. Cleanup of the AES code for key size. Cleanup of the wolfCrypt sha.c for readability. Added support for the KSDK bare metal drivers to the IDE Rowley CrossWorks example. Updated the settings.h to allow for overrides in Freescale section. Updated README with info for using LTC.
2016-12-05 09:01:59 -08:00
David Garske
8e64d564dc
NXP/Freescale K8X MMCAU / LTC core support for RSA, ECC, Ed/Curve25519, AES, DSA, DES3, MD5, RNG, SHA and SHA2.
2016-12-05 09:01:59 -08:00
David Garske
13cf313001
ECC performance increase with custom curves enabled (WOLFSSL_CUSTOM_CURVES) when A param is 3.
2016-11-22 13:43:18 -08:00
dgarske
ee53853d2f
Merge pull request #632 from toddouska/init_multi
...
fix non ecc_make_key init_mulit potential problems
2016-11-14 19:34:14 -08:00
toddouska
cbb2ce6baf
Merge pull request #626 from dgarske/fix_ecc_make_rngfail
...
Fix for "wc_ecc_make_key_ex" if call to rng fails
2016-11-14 17:35:15 -08:00
toddouska
1a7fe0d4c5
fix non ecc_make_key init_mulit potential problems
2016-11-14 12:49:42 -08:00
David Garske
cee321323a
Better handle "mp_init_multi" failure in "wc_ecc_make_key_ex".
2016-11-14 12:38:01 -08:00
toddouska
fa816f0460
Merge pull request #631 from dgarske/ecc_privkey_import_oid
...
Fix for "wc_EccPrivateKeyDecode" to handle custom curve OID.
2016-11-14 11:52:48 -08:00
David Garske
07efd88e4d
Fix for "wc_EccPrivateKeyDecode" to handle custom curve OID.
2016-11-14 09:53:31 -08:00
Jacob Barthelmeh
dad628cb0d
remove include of ec.h in ecc.c
2016-11-14 10:03:19 -07:00
Sean Parkinson
8a7bb3fad4
Z will be 0 not 1
2016-11-11 12:53:48 +10:00
Sean Parkinson
71259113b2
ECC improvements/fixes
...
When checking for 1 actually check for 1 and not the digit count.
When checking for negative use a macro - for speed.
2016-11-11 12:41:25 +10:00
David Garske
1aca9a6079
Fix for "wc_ecc_make_key_ex" if call to rng fails. Issue only applies to !USE_FAST_MATH case on failure response from call to "wc_RNG_GenerateBlock".
2016-11-10 11:39:29 -08:00
David Garske
d2a6c6838e
Fix for ECC with !WC_NO_CACHE_RESISTANT and ALT_ECC_SIZE causing invalid mp_int*. An ecc_point with ALT_ECC_SIZE is "mp_int* x" vs. "mp_int x[1]". The resulting pointer for &M[0]->x is not valid in the ALT_ECC_SIZE case. This was found while testing ECC on a Cortex M4 (32-bit) and caused a hard fault.
2016-10-14 16:44:57 -07:00
toddouska
11102b6726
Merge pull request #585 from NickolasLapp/master
...
Rename *Mutex Functions with wc_ prefix. Expose these functions for Stunnel.
2016-10-12 11:19:32 -07:00
Chris Conlon
ab966a72da
fix ecc_check_privkey_gen() parameters with WOLFSSL_VALIDATE_ECC_IMPORT
2016-10-07 14:14:50 -06:00
Nickolas Lapp
1792eba1a2
Rename *Mutex Functions with wc_ prefix. Expose these functions for
...
Stunnel. Various other changes to enable stunnel compling
2016-10-03 16:36:05 -06:00
John Safranek
5e852dc1a1
Fixes for building the library with a C++ compiler with TLSX enabled
...
1. Add many typecasts for malloc() data to proper pointer type.
2. Add many typecasts for constants in tertiary operators.
3. ECC to use local copy of wc_off_on_addr instead of extern copy.
2016-09-23 23:22:58 -07:00
toddouska
7b3fc558ec
add WC_NO_CACHE_RESISTANT option for old code path
2016-09-13 16:45:15 -07:00
toddouska
46a0ee8e69
switch ecc timising resistant mulmod double to use temp instead of leaking key bit to cache monitor
2016-09-13 11:10:10 -07:00
David Garske
bf23b2f9d1
Fix issue with "wc_ecc_set_custom_curve" function not setting index as "ECC_CUSTOM_IDX". Cleanup of the ECC tests to return actual error code (when available) and make sure keys are free'd. Some trailing whitespace cleanup.
2016-08-26 12:35:47 -07:00
David Garske
17a34c5899
Added asynchronous wolfCrypt RSA, TLS client and Cavium Nitrox V support. Asynchronous wolfSSL client support for "DoServerKeyExchange", "SendClientKeyExchange", "SendCertificateVerify" and "DoCertificateVerify". Fixes for async DTLS. Refactor of the wolf event and async handling for use in wolfCrypt. Refactor of the async device support so its hardware agnostic. Added Cavium Nitrox V support (Nitrox tested using SDK v0.2 CNN55XX-SDK with new configure "--with-cavium-v=/dir" option). Moved Nitrox specific functions to new port file "port/cavium/cavium_nitrox.c". RSA refactor to handle async with states. RSA optimization for using dpraw for private key decode. Use double linked list in wolf event for faster/cleaner code. Use typedef for wolf event flag. Cleanup of the async error codes. wolfCrypt test and benchmark support for async RSA. Asynchronous mode enabled using "./configure --enable-asynccrypt". If no async hardware is defined then the internal async simulator (WOLFSSL_ASYNC_CRYPT_TEST) is used. Note: Using async mode requires async.c/h files from wolfSSL. If interested in using asynchronous mode please send email to info@wolfssl.com.
2016-08-15 13:59:41 -06:00
JacobBarthelmeh
dcc0f87ce6
Merge pull request #506 from toddouska/del_point
...
fix remaining non fpecc ecc_del_point w/o heap
2016-07-27 18:54:46 -06:00
toddouska
a94f34c8e2
fix remaining non fpecc ecc_del_point w/o heap
2016-07-27 14:24:34 -07:00
toddouska
7cf0b8fe85
fix scan-build warning on ecc memory alloc failure
2016-07-27 11:20:08 -07:00
David Garske
5e2502fa95
ECC without Shamir has issues testing all zero's digest, so disable this test if not using Shamir method. Fixed comment about "NO_ECC_SECP".
2016-07-19 14:34:32 -07:00
toddouska
7a419ba6d8
Merge pull request #472 from dgarske/ecc_brainpool_koblitz
...
ECC and TLS support for all SECP, Koblitz and Brainpool curves
2016-07-19 11:44:53 -07:00
David Garske
acc5389f9a
Fixed possible issue with OID pointer returned from "wc_ecc_get_oid" if "HAVE_OID_ENCODING" enabled. Was previously returning static pointer, which was shared for all OID's. Now uses cache for each OID, which also improves performance on subsequent calls to the same OID.
2016-07-08 14:22:21 -07:00
David Garske
19db78fc76
Moved the ECC OID's into separate static const array to reduce ecc_sets size. Added "ecc_oid_t" typedef to determine "oid" size based on HAVE_OID_ENCODING option. Reduced the encoded variable size to word16.
2016-07-08 14:15:54 -07:00
toddouska
c7318c8576
fix fpecc thread local storage size with clang
2016-07-08 12:01:52 -07:00
toddouska
68d66d12d6
fix ecc timming missing variable
2016-07-08 11:57:24 -07:00
David Garske
7a1acc7e56
Added TLS support for all SECP and Brainpool curves. Added ECC curve specs for all Brainpool, Koblitz and R2/R3. Adds new "HAVE_ECC_BRAINPOOL", "HAVE_ECC_KOBLITZ", "HAVE_ECC_SECPR2" and "HAVE_ECC_SECPR3" options. ECC refactor to use curve_id in _ex functions. NID and ECC Id's match now. Added ability to encode OID (HAVE_OID_ENCODING), but leave off by default and will use pre-encoded value for best performance.
2016-07-07 10:59:45 -07:00
David Garske
5b3a72d482
Cleanup of stdlib function calls in the wolfSSL library to use our cross-platform "X*" style macros in types.h.
2016-06-29 11:11:25 -07:00
David Garske
47c1f4e68f
Fix possible use of ForceZero with NULL pointer. Improve init of "kb" when small stack disabled, so memset isn't performed twice.
2016-06-22 07:22:30 -07:00
David Garske
69db94d668
Fix build error for un-initialized "kb" variable when built with fixed point cache and small stack enabled.
2016-06-22 07:06:07 -07:00
David Garske
1db880b6bf
Fixed issue with compressed keys and custom curves. The inLen adjustment for compressed curves was only be done for built-in curves.
2016-06-21 15:55:17 -07:00
David Garske
dd52af0872
ECC cleanup / fixes. Improvements to ECC with fast math enabled to avoid mp_clear on stack variables. Refactor of ECC failure cleanup (fixes possible mem leaks with small stack enabled). Refactor of "fp_is*" response checks to use FP_YES or FP_NO. Pulled libtom enhancement/cleanup of fp_isprime. Fix for compressed keys import with custom curves (still having some issues though).
2016-06-21 15:27:51 -07:00
David Garske
aa1a405dd1
Fixes for compressed keys. Fix to fast math "mp_cnt_lsb" to return proper value, which fixes "mp_jacobi", which fixes "mp_sqrtmod_prime", which fixes compressed keys for 224-bit key. Removed workarounds for compressed keys. Added new configure option "--enable-compkey". Fixed issue with normal math and custom curves where "t2" could be free'd and used. Fixed issue with mp_dump in integer.c, with not allocating correctly sized buffer for toradix.
2016-06-21 14:06:02 -07:00
toddouska
de4448c59b
Merge pull request #452 from dgarske/fixeccscanbuildwarning
...
Fixes scan-build warning in ecc.c line 2208
2016-06-20 09:09:21 -07:00
David Garske
3789d9913c
Fixes scan-build warning "wolfcrypt/src/ecc.c:2208:6: warning: Use of memory after it is freed". This is due to a rebase issue with static memory changes after the new ECC custom curves changes. The precomp[] is init to NULL at top so cleanup can always be done at end (shouldn't be done in middle).
2016-06-18 22:35:52 -07:00
David Garske
eb1d8d5df6
Fix for NID names on NIST prime 192 and 256 curves. Cleanup of the memcpy/memset in .i files to use portable names.
2016-06-17 15:59:25 -07:00
David Garske
6da166d83b
Enhancement / cleanup of the "wc_ecc_make_key_ex" API so it can be used with "keysize" or "dp" and allows compatibility with existing "wc_ecc_make_key". Note: "wc_ecc_make_key_ex" was not previously public, so changing it at this point is okay.
2016-06-16 10:38:15 -07:00
David Garske
d55663eaee
Added ECC API's for using custom curves that are not in the "ecc_sets" list. Added wolfCrypt test to validate/demonstrate custom curve using BRAINPOOL256R1. Exposed "wc_ecc_make_key_ex" and added "wc_ecc_import_x963_ex" / "wc_ecc_import_raw_ex" API's that accept "const ecc_set_type*" for custom curve. Internally use "ECC_CUSTOM_IDX" (-1) to define custom curve is used. Added "--enable-ecccustcurves" option to configure.ac.
2016-06-16 10:09:41 -07:00
David Garske
69b6ac504f
Fixes for ecc heap errors after rebase.
2016-06-16 06:46:22 -07:00
David Garske
237193fdee
Fixed scan-build warning about "len" being used un-initialized in ecc_mul2add. Cleanup of the "mu" variable handling.
2016-06-15 08:41:51 -07:00
David Garske
5703e5eadb
ECC changes to support custom curves. Added new "WOLFSSL_CUSTOM_CURVES" option to support non-standard ECC curves in ecc_is_point and ecc_projective_dbl_point. Refactor to load and pass curve "a" parameter down through ECC functions. Relocated mp_submod and added mp_addmod. Refactor to pass mp variable directly (not pointer) for montgomery variable. Fix in mp_jacobi to also handle case of a == 0. Cleanup of *_ecc_mulmod and wc_ecc_make_key_ex error handling. Cleanup of ecc_map for handling normal, fast and alt_ecc math for optimization of performance and allowing reduced ecc_size.
2016-06-15 08:41:51 -07:00