Commit Graph

913 Commits (1729e0205fde5cccb94cbbc99c95b51aec308f46)

Author SHA1 Message Date
Jacob Barthelmeh f06a392764 COMPAT. LAYER : DES set key and malloc/free 2016-11-07 13:21:05 -07:00
toddouska 70b227011d Merge pull request #604 from JacobBarthelmeh/PKCS12
Pkcs12
2016-11-04 15:50:50 -07:00
Jacob Barthelmeh 0839925797 PKCS12 : visibility, check on key match, sanity check on malloc 2016-11-03 11:14:29 -06:00
toddouska 3780f452e8 Merge pull request #609 from JacobBarthelmeh/ARMv8
ARMv8 : clang build with ARMv8
2016-11-03 09:02:20 -07:00
Chris Conlon 9a735fc873 allow PKCS#7 to be compiled with AES disabled 2016-11-02 12:18:45 -06:00
JacobBarthelmeh 6f06b60bc0 ARMv8 : clang build with ARMv8 2016-11-01 13:38:01 -07:00
toddouska 624ec3d492 Merge pull request #607 from cconlon/pkcs7
add AES content encryption support to PKCS#7 EnvelopedData
2016-11-01 12:03:24 -07:00
Jacob Barthelmeh 70e7e34c87 RNG : change to --disable-rng, non-autoconf scenario, help msg 2016-11-01 10:21:29 -06:00
Jacob Barthelmeh 09c32de412 RNG : option to not use RNG 2016-10-31 16:51:02 -06:00
Chris Conlon fa9a9175d0 add AES-256-CBC to PKCS#7 Encode/DecodeEnvelopedData 2016-10-31 14:45:57 -06:00
Chris Conlon 8c23c3cdd0 add AES-192-CBC to PKCS#7 Encode/DecodeEnvelopedData 2016-10-31 14:27:21 -06:00
Chris Conlon 17c184e720 add AES-128-CBC to PKCS#7 Encode/DecodeEnvelopedData 2016-10-31 14:27:14 -06:00
Jacob Barthelmeh b686deecbe PKCS12 : Add PKCS12 parsing 2016-10-29 13:12:26 -06:00
John Safranek 849ae72d3a expand the AES-CTR test to 4 blocks for 192 and 256 bit cases 2016-10-27 15:54:22 -07: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 2ecf7090ca Merge pull request #595 from JacobBarthelmeh/Testing
static analysis : Fix warnings with wc_AesCcmSetKey
2016-10-12 11:27:29 -07:00
toddouska ffb2a8ff12 Merge pull request #593 from JacobBarthelmeh/ARMv8
ARMv8 : sanity checks
2016-10-12 11:23:27 -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
toddouska 9cf4d7ca8e Merge pull request #584 from kaleb-himes/aes-gcm-bo
sanity check on memcpy and xorbuf
2016-10-12 11:18:03 -07:00
Jacob Barthelmeh 54c51ec4a0 static analysis : Fix warnings with wc_AesCcmSetKey 2016-10-12 10:02:53 -06:00
Jacob Barthelmeh eb9161d8a7 ARMv8 : sanity checks 2016-10-10 15:08:59 -06:00
Chris Conlon ab966a72da fix ecc_check_privkey_gen() parameters with WOLFSSL_VALIDATE_ECC_IMPORT 2016-10-07 14:14:50 -06:00
kaleb-himes 05fcbb001a move sanity check and remove silent truncation 2016-10-06 15:01:16 -06:00
keton ef5f55f6e4 Optimize memory usage for ARM Cortex M and similar embedded systems (#578)
* Changed ge_precomp data to const to reduce RAM usage on embedded systems.
* Add configuration option "WOLFSSL_NRF5x" for Nordic nRF5x platform in settings.h
2016-10-06 12:49:14 -07:00
toddouska f4c654dd6e Merge pull request #590 from JacobBarthelmeh/ARMv8
ARMv8 additions
2016-10-06 10:04:07 -07:00
Jacob Barthelmeh d07746de09 ARMv8 : Remove dependency on load 2016-10-05 11:02:51 -06:00
Nickolas Lapp 89aec2c565 Add cast for g++ compiler 2016-10-05 09:37:44 -06:00
Jacob Barthelmeh 21dd236ef2 ARMv8 : increase performance 2016-10-05 09:04:18 -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
kaleb-himes a630fda509 Sanity check on memcpy and xorbuf
Sanity check on memcpy and xorbuf
2016-09-29 13:26:50 -06:00
Jacob Barthelmeh 6f4b704552 ARMv8 : Aarch32 support, SHA256 speedup 2016-09-28 10:22:27 -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
Jacob Barthelmeh 91580552bc ARMv8 : AES-GCM encryption speed ups 2016-09-23 10:20:52 -06:00
toddouska d9163e4554 add dsa sign sanity check on r/s 2016-09-22 12:04:48 -07:00
toddouska 9e4e08d7a7 fix dsa pre padding 2016-09-21 18:51:11 -07:00
toddouska 2368d49678 Merge pull request #572 from ejohnstown/pathlen
CA Certificate Path Length Checking
2016-09-21 14:36:24 -07:00
John Safranek a42bd30278 CA Certificate Path Length Checking
1. Check the path length between an intermediate CA cert and its
   signer's path length.
2. Always decode the path length if present and store it in the decoded
   certificate.
3. Save the path length into the signer list.
4. Path length capped at 127.
5. Added some test certs for checking CA path lengths.
2016-09-20 21:36:37 -07:00
John Safranek 65a7978dec Merge pull request #567 from toddouska/rng
RDSEED enhancements
2016-09-20 12:09:01 -07:00
toddouska 0718aba655 fix comment typo 2016-09-19 13:28:14 -07:00
toddouska 485d814aed Merge pull request #563 from JacobBarthelmeh/ARMv8
ARMv8 : AES-GCM constraint fix
2016-09-19 09:30:08 -07:00
Jacob Barthelmeh 6d73175b22 Benchmark App : fixed some invalid set key sizes 2016-09-17 15:07:38 -06:00
toddouska c51444bec5 update rdseed to 64bit get, more retries, fallback to /dev/urandom on failure 2016-09-16 18:54:47 -07:00
Jacob Barthelmeh f755591316 ARMv8 : AES-GCM constraint fix 2016-09-16 19:43:47 +00:00
toddouska c85b3b84d9 Merge pull request #554 from JacobBarthelmeh/ARMv8
ARMv8 : AES-CTR/CBC/GCM speed ups and refactor AES
2016-09-16 09:34:24 -07:00
John Safranek 03ebb4825e Merge pull request #552 from toddouska/aesca
prevent compiler from optimzing out PreFetch Td4
2016-09-16 09:16:07 -07:00
Jacob Barthelmeh 6d82cba29c ARMv8 : AES-CTR/CBC/GCM speed ups and refactor AES 2016-09-15 22:50:00 +00:00
toddouska c1ac0c0f8c Merge pull request #545 from ejohnstown/ems
Extended Master Secret
2016-09-15 11:25:41 -07:00
toddouska 8cdaa06127 prevent compiler from optimzing out PreFetch Td4 2016-09-15 10:02:30 -07:00
toddouska dc337946d5 make sure rsa rng is null on init 2016-09-14 14:33:08 -07:00
John Safranek 7410b5784f Merge pull request #548 from toddouska/nocache
add WC_NO_CACHE_RESISTANT option for old code paths
2016-09-14 10:24:29 -07:00
Jacob Barthelmeh 109642fef4 aes.c : check ILP32 macro defined 2016-09-14 09:33:48 -06:00
toddouska b6937626b4 don't require uneeded temp with WC_NO_CACHE_RESISTANT 2016-09-13 17:01:50 -07:00
toddouska 7b3fc558ec add WC_NO_CACHE_RESISTANT option for old code path 2016-09-13 16:45:15 -07:00
John Safranek b77c350153 Merge pull request #547 from toddouska/mathca
Remove timing resistant cache key bit monitor leaks
2016-09-13 14:34:23 -07:00
toddouska 05d78dc2ce Merge pull request #544 from cconlon/rsafix
include MAX_RSA_INT_SZ in wc_RsaKeyToPublicDer(), for 4096-bit keys
2016-09-13 11:24:03 -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
John Safranek 0477d5379e Merge pull request #546 from toddouska/aesca
AES T table cache preload.
2016-09-13 11:05:28 -07:00
toddouska 6ef9e79ff5 switch timing resistant exptmod to use temp for square instead of leaking key bit to cache monitor 2016-09-13 09:13:39 -07:00
toddouska 6ae1a14c9f do aes cache line stride by bytes, not word32s 2016-09-12 21:09:08 -07:00
toddouska c6256211d6 compress aes last round decrypt table, prefetch Td tables before aes decrypt rounds, prefecth compressed table before last round 2016-09-12 13:04:30 -07:00
toddouska 97a64bcc7c remove unique aes last round Te table, pre fetch Te tables during software aes encrypt 2016-09-12 12:03:37 -07:00
Chris Conlon a149d83bff include MAX_RSA_INT_SZ in wc_RsaKeyToPublicDer(), for 4096-bit keys 2016-09-09 16:11:56 -06:00
toddouska fc54c53f38 Merge pull request #543 from JacobBarthelmeh/ARMv8
ARMv8 : increase performance with SHA256
2016-09-09 10:23:44 -07:00
Jacob Barthelmeh 3ec66dd662 ARMv8 : sanity checks and change constraint type 2016-09-09 00:27:40 +00:00
Jacob Barthelmeh f4e604dec3 verify case with unexpected input 2016-09-08 15:32:09 -06:00
Jacob Barthelmeh 79af4d30e0 ARMv8 : increase performance with SHA256 2016-09-08 18:00:24 +00:00
toddouska baebec4ca4 Merge pull request #538 from JacobBarthelmeh/ARMv8
initial ARMv8 instructions
2016-09-07 09:20:14 -07:00
Jacob Barthelmeh 09b29cb1d4 ARMv8 AES: remove extra memcpy during encrypt/decrypt 2016-09-02 22:55:17 +00:00
Chris Conlon 5bf8806655 add wc_Sha384/512GetHash() functions 2016-09-01 15:05:27 -06:00
Jacob Barthelmeh 41912b92c6 initial ARMv8 instructions 2016-09-01 18:10:06 +00:00
John Safranek 963b9d4c4d OCSP Fixes
1. When using Cert Manager OCSP lookup, the issuer key hash wasn't
being set correctly. This could lead to unknown responses from lookup.
2. Default OCSP lookup callback could get blocked waiting for server
to close socket.
2016-09-01 09:58:34 -07:00
Chris Conlon a0b02236b8 Merge pull request #527 from danielinux/master
Support for Frosted OS
2016-08-31 10:07:25 -06:00
David Garske 6a70403547 Fix for "not used" devId in benchmark. 2016-08-29 11:01:16 -07:00
David Garske 2ecd80ce23 Added support for static memory with wolfCrypt. Adds new "wc_LoadStaticMemory" function and moves "wolfSSL_init_memory_heap" into wolfCrypt layer. Enhanced wolfCrypt test and benchmark to use the static memory tool if enabled. Added support for static memory with "WOLFSSL_DEBUG_MEMORY" defined. Fixed issue with have-iopool and XMALLOC/XFREE. Added check to prevent using WOLFSSL_STATIC_MEMORY with HAVE_IO_POOL, XMALLOC_USER or NO_WOLFSSL_MEMORY defined. 2016-08-29 10:38:06 -07:00
toddouska bd312cb766 Merge pull request #533 from dgarske/dg_fixes
Fixes for HMAC/small stack heap and disable RSA warnings
2016-08-26 14:30:55 -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 925e5e3484 Fixes typo issue with heap in hmac and small stack enabled. Fixed "never read" scan-build warnings with typeH and verify when RSA is disabled. 2016-08-26 10:33:01 -07:00
David Garske a9278fe492 Added check for GetLength result in asn GetIntRsa function. Fixed return code in random.c for "wolfAsync_DevCtxInit" due to copy/paste error. Added RSA wc_RsaCleanup to make sure allocated tmp buffer is always free'd. Eliminated invalid RSA key type checks and "RSA_CHECK_KEYTYPE". 2016-08-23 11:31:15 -07:00
Daniele Lacamera 3d3f8c9dd3 Support for Frosted OS 2016-08-18 14:56:14 +02:00
David Garske 3e6be9bf2c Fix in "wc_InitRsaKey_ex" for normal math so mp_init isn't called to defer allocation. 2016-08-15 14:07:16 -06: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
dgarske b38218a0b9 Merge pull request #524 from kaleb-himes/certs-buffs-and-tests
cert updates, new buffers, new test with buffers
2016-08-14 08:39:37 -07:00
kaleb-himes da18e463ed remove constraints on inclusion of certs_test.h 2016-08-12 17:00:22 -06:00
kaleb-himes 03295ec6d7 update certs, extend ntru to 1000 days, add der formatted ecc, new ecc buffer test
changes from first review

move to 256 bit defines
2016-08-12 13:00:52 -06:00
Jacob Barthelmeh b502d9dcf7 help static analysis tools 2016-08-10 14:23:27 -06:00
David Garske 317a7f2662 Change misc.c error to warning and exclude the misc.c code from being compiled. Most people include all .c files and by default inlining is allowed, which in turn causes an #error in misc.c and it must be excluded. Since we know its already been properly included there is no reason to throw error here. Instead, show warning and exclude code in .c file. 2016-08-08 13:13:59 -07:00
toddouska 49fb0d56b0 Merge pull request #516 from dgarske/fix_asn_wo_hmac
Fix build issue with ASN enabled and no HMAC
2016-08-06 10:07:00 -07:00
toddouska c8cfe1ffa1 Merge pull request #511 from dgarske/openssl_compat_fixes
Various improvements to support openssl compatibility
2016-08-06 09:59:31 -07:00
toddouska dd03af2cf4 Merge pull request #512 from dgarske/fix_crl_pad
Fixed issue with CRL check and zero pad
2016-08-06 09:56:59 -07:00
dgarske cc462e2c50 Merge pull request #513 from kojo1/Der2Pem
Adds "wc_DerToPem" CRL_TYPE support
2016-08-05 14:35:15 -07:00
David Garske d8c63b8e66 Various improvements to support openssl compatibility.
* Fixed bug with "wolfSSL_get_cipher_name_internal" for loop using incorrect max length for "cipher_name_idx" (this caused fault when library built with NO_ERROR_STRINGS and calling it).
* Adds new "GetCipherNameInternal" function to get cipher name using internal "cipherSuite" index only (for scenario where WOLFSSL object does not exist).
* Implements API's for "wolf_OBJ_nid2sn" and "wolf_OBJ_sn2nid". Uses the ecc.c "ecc_sets" table to locate NID (ECC ID and NID are same).
* Added "WOLFSSL*" to HandShakeInfo.
* Allowed "SetName" to be exposed.
* Added "wolfSSL_X509_load_certificate_buffer". Refactor "wolfSSL_X509_load_certificate_file" to use new function (no duplicate code).
2016-08-05 14:15:47 -07:00
David Garske 6b1ff8e9d7 Only try and return serial number or check padding if the serial number size is greater than 1. 2016-08-05 12:53:26 -07:00
David Garske a17bc2a42e Fix build issue with ASN enabled and no HMAC (missing MAX_DIGEST_SIZE). Switch to using WC_MAX_DIGEST_SIZE from hash.h, which is always available. Added small stack option for digest in MakeSignature. Fixed build error with unused "testVerifyCount" if "NO_ECC_SIGN" or "NO_ECC_VERIFY". 2016-08-05 12:19:30 -07:00
David Garske 96da2df7ec Additional max index and serial number size checks in "GetSerialNumber". 2016-08-03 17:04:44 -07:00
David Garske 2c1309ffc7 Fixes for warnings when cross-compiling with GCC ARM. 2016-08-03 16:53:53 -07:00
Takashi Kojo ed4cd2438f CRL_Type to wc_DerToPem 2016-08-03 10:53:54 +09:00
David Garske 9ddfe93c43 Fixed issue with CRL check and zero pad (the GetRevoked function was not trimming pad). Added new ASN "GetSerialNumber" function and implemented it in three places in asn.c. 2016-08-02 16:47:21 -07: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
dgarske 303561c1a1 Merge pull request #505 from toddouska/timing
fix scan-build warning on ecc memory alloc failure
2016-07-27 15:52:01 -07: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 b0e72dd692 Fix for "OID Check Failed". This restores behavior to what it was prior to commit "7a1acc7". If an OID is not known internally skip the verify and return success and the OID sum. 2016-07-27 10:39:42 -07:00
John Safranek 993838153e Merge pull request #487 from moisesguimaraes/fix-ocspstapling-getca
fixes ocsp signer lookup in the cert manager.
2016-07-26 12:42:47 -07:00
David Garske c80f1805f0 Fix for failing OID check with "ocspstapling2" enabled. Found OID type in "ToTraditional" that should be keyType, not sigType. Added optional OID decode function and optional OID info dump in "GetObjectId" (both off by default). 2016-07-26 10:35:40 -07:00
toddouska a274386693 fix user rsa no error codes? 2016-07-25 19:19:46 -07:00
toddouska cd5486a4e6 fix user_rsa with blinding API addition 2016-07-25 15:33:28 -07:00
Jacob Barthelmeh e8f7d78fc4 add helper functions for choosing static buffer size 2016-07-21 12:11:15 -06:00
toddouska 1b980867d6 fix rsablind other builds 2016-07-20 11:35:57 -07:00
David Garske e0f2bbd1b4 Added comment about why 0's test is disabled. ECC without Shamir fails with fast or normal math. 2016-07-19 19:12:45 -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
toddouska f88f501923 add unique RNG missing error 2016-07-18 18:10:38 -07:00
Moisés Guimarães e866b55bb7 removes fallback. 2016-07-18 22:02:41 -03:00
toddouska 1c71fb4ad1 scope tmpa/b with blinding, document RSA options 2016-07-18 17:37:03 -07:00
toddouska c2b55f69fa fix 32bit mp_add_d need 2016-07-18 12:49:31 -07:00
toddouska d235a5f0cc add WC_RSA_BLINDING, wc_RsaSetRNG() for RSA Private Decrypt which doesn't have an RNG 2016-07-18 11:57:47 -07:00
Moisés Guimarães dd329ac97b fixes ocsp signer lookup in the cert manager. 2016-07-15 17:12:04 -03:00
dgarske c20551cc56 Merge pull request #478 from toddouska/flatten-fix
fix rsa flatten eSz check
2016-07-13 08:50:39 -07:00
toddouska 7a906e47ed fix rsa flatten eSz check 2016-07-12 16:28:59 -06:00
Jacob Barthelmeh 92341292c7 remove hard tabs and replace with spaces 2016-07-12 14:12:44 -06: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 8da8c87fa4 don't include comba includes if FP_SIZE is too small for index 2016-07-08 12:29:38 -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 dcdc28e014 Remove double call to "wolfCrypt_Init()" in test.c. Appears to have been added in static memory merge on 6/10. 2016-06-30 16:51:13 -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
Jacob Barthelmeh f18ff8bfa4 update mysql patch 2016-06-27 15:44:52 -06:00
John Safranek ffb537c33f removed dependency on AES-NI for the AES-direct test 2016-06-23 15:34:09 -06:00
John Safranek 0d031fcbd7 added parameter checking to Generate and Verify 2016-06-23 15:34:09 -06: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 d294dc363e Fix scan-build warning with "redundant redeclaration of 'fp_isprime'". Changed "fp_isprime" and "fp_isprime_ex" to local static only. Also made "fp_gcd", "fp_lcm", and "fp_randprime" static functions. 2016-06-21 19:35:25 -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 7c5483ba0b Performance improvements in fp_mulmod, fp_submod and fp_submod to handle ALT_ECC_SIZE better. Revert fp_clear to fp_add_d, since it isn't required and slows it down. 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
David Garske bb17bac018 Updated the naming for the ECC curve sets. Additional comments for each curve parameter. 2016-06-14 16:56:22 -07:00
David Garske 87c00eb3f3 Math updates from libtom. Fixes in mp_read_radix for to include char 36 and clear the destination before checks. Fix to clear tmp value on fp_sub_d and fp_add_d. Fixes in assembly for x86-32 INNERMUL, PPC32 INNERMUL and PROPCARRY and x86-64 SQRADD. Added mp_isneg. Refactor of mp_iszero, mp_iseven, mp_isodd and mp_isneg to check using MP_YES or MP_NO. Changed fp_read_unsigned_bin "b" arg to const. Removal of the "register" on stack variables to let compiler determine best optimization. 2016-06-14 16:56:22 -07:00
Jacob Barthelmeh 03de8e3464 prepare for version 3.9.6 2016-06-14 14:35:12 -06:00
toddouska a156cedabc Merge pull request #435 from JacobBarthelmeh/staticmemory
Staticmemory
2016-06-10 17:03:49 -07:00