Commit Graph

638 Commits

Author SHA1 Message Date
Takashi Kojo bf950198f2 api.c: option conditions 2018-04-18 13:02:40 +09:00
Takashi Kojo 56af3a5b36 add HMAC SHA2 2018-04-18 08:47:39 +09:00
toddouska 09706a4ed2
Merge pull request #1488 from SparkiDev/tls13_perf
Changes for interop and performance
2018-04-16 09:16:13 -07:00
Jacob Barthelmeh e895bacbba update before/after dates with certificates 2018-04-13 09:31:32 -06:00
Jacob Barthelmeh f9eda5d790 free test certificate after use 2018-04-13 09:16:22 -06:00
Eric Blankenhorn a0d8327320 Coverity fixes 2 (#1493)
* Coverity fixes for wolfcrypt folder
* Fixes for remaining issues
* Fixes for test files
2018-04-13 05:35:18 -07:00
Sean Parkinson 0b47811c46 Changes for interop and performance
Changes made to test.h to allow interop of PSK with OpenSSL.
Changes to allow server to pre-generate key share and perform other
operations at later time.
Fix ChaCha20 code header to have bigger state to support assembly code
for AVX1.
Fix Curve25519 code to use define instead.
Change Curve25519 to memset all object data on init.
Change Poly1305 to put both sizes into one buffer to avoid a second call
to wc_Poly1305Update().
Added WOLFSSL_START and WOLFSSL_END API and calls to show time of
protocol message function enter and leave to analyse performance
differences.
Moved Curve25519 code in KeyShare extension out of general ECC code.
2018-04-13 12:01:20 +10:00
Jacob Barthelmeh cfaed48f90 adjust GetInt call with ASN1 integer to big number 2018-04-12 14:40:20 -06:00
Jacob Barthelmeh df06707496 Handle larger values with ASN1 INTEGER structure 2018-04-12 14:07:29 -06:00
David Garske ce6728951f Added a new `--enable-opensslall` option, which ensures all openssl features are enabled. Documented and tested building the various open source defines we support in our build. 2018-04-11 13:54:07 -07:00
David Garske a38576146e * Added support for disabling PEM to DER functionality using `WOLFSSL_PEM_TO_DER`. This allows way to use with DER (ASN.1) certificates only in an embedded environment. This option builds, but internal make check requires PEM support for tests.
* More cleanup to move PEM functions from ssl.c to asn.c (`wolfSSL_CertPemToDer`, `wolfSSL_KeyPemToDer`, `wolfSSL_PubKeyPemToDer`). Renamed these API's to `wc_` and added backwards compatability macro for old function names.
2018-04-09 13:28:15 -07:00
David Garske 5a46bdf6f6 Added unit test for using encrypted keys with TLS. Only works with `--enable-des3`, since the keys are all encrypted with DES3 (also requires either `--enable-opensslextra or --enable-enckeys`). 2018-04-09 13:28:15 -07:00
David Garske 6de8348918 Fixes for various build configurations. Added `--enable-enckeys` option to enable support for encrypted PEM private keys using password callback without having to use opensslextra. Moved ASN `CryptKey` function to wc_encrypt.c as `wc_CryptKey`. Fixup some missing heap args on XMALLOC/XFREE in asn.c. 2018-04-09 13:28:15 -07:00
David Garske c83e63853d Refactor unqiue hash types to use same internal values (ex WC_MD5 == WC_HASH_TYPE_MD5). Refactor the Sha3 types to use wc_ naming. 2018-04-09 13:28:15 -07:00
David Garske 21833e245f Fix TLS 1.3 with ECC disabled and CURVE25519 enabled. Resolves issue with using `./configure --disable-ecc --enable-curve25519 --enable-ed25519 --enable-tls13`. Refactor `TLSX_KeyShare_GenEccKey` to support either ECC or CURVE25519. Fix for `PemToDer` to handle ED25519 without ECC enabled. 2018-04-09 10:10:08 -07:00
David Garske c288d0815d Added support for building and using PKCS7 without RSA (assuming ECC is enabled). 2018-04-03 09:26:57 -07:00
jrblixt 1cd6075b9d Nightly build fix. 2018-03-27 16:54:14 -06:00
Chris Conlon c08f5b86cf
Merge pull request #1444 from jrblixt/unitTest_api_addPkcs-PR03162018
Unit test functions for PKCS#7.
2018-03-23 10:00:33 -06:00
jrblixt 316a2b9fb4 Review changes: Chris. 2018-03-22 15:35:25 -06:00
toddouska a92696edec
Merge pull request #1454 from dgarske/noprivkey
Support for not loading a private key when using `HAVE_PK_CALLBACKS`
2018-03-22 12:47:22 -07:00
David Garske dbb34126f6 * Added support for not loading a private key for server or client when `HAVE_PK_CALLBACK` is defined and the private PK callback is set. Tested with all cipher suites, TLS 1.2/1.3, client/server certs, RSA/ECC/ED25519.
* Added PK callback context tests for client/server examples (`SetupPkCallbackContexts`).
* Added new test define for `TEST_PK_PRIVKEY` to allows simulating hardware based private key.
* Added new test.h function for loading PEM key file and converting to DER (`load_key_file`).
* Added way to get private key signature size (`GetPrivateKeySigSize`).
* Added new ECC API `wc_ecc_sig_size_calc` to return max signature size for a key size.
* Added inline comments to help track down handshake message types.
* Cleanup of RSS PSS terminating byte (0xbc) to use enum value.
* Fixed bug with PK callback for `myEccVerify` public key format.
* Fixed bug with PK callback for ED25519 verify key buffer in DoServerKeyExchange.
2018-03-21 11:27:08 -07:00
Jacob Barthelmeh df6ea54cd5 add support for PKCS8 decryption to OPENSSL_EXTRA_X509_SMALL build 2018-03-20 15:06:35 -06:00
jrblixt 2788183e79 Known config. tests fix. 2018-03-20 14:35:26 -06:00
jrblixt 1aba6e9b44 Prepare for PR. 2018-03-16 17:07:28 -06:00
toddouska 15805d626d
Merge pull request #1430 from SparkiDev/srp_test_fix
Fix SRP test to have 2048 bit test data
2018-03-12 11:33:50 -07:00
Sean Parkinson 00203d66d5 Fix SRP test to have 2048 bit test data 2018-03-12 17:32:27 +10:00
Jacob Barthelmeh e0afec0600 fix RSA macro, tickets without server, and add test case 2018-03-08 14:36:43 -07:00
toddouska 442430d39e
Merge pull request #1392 from ejohnstown/rsa-decrypt-check
RSA Decrypt Bounds Checking
2018-02-26 12:19:37 -08:00
John Safranek a49553df6a RSA Decrypt Bounds Checking
1. Added some bounds checking on the ciphertext passed into the RSA decrypt function. NIST SP 800-56B specifies that the ciphertext shouldn't be a number larger than the modulus.
2. Added an API test to check that the direct RSA decrypt function returns an error with a "bad" message.
3. Added an ifndef guard to disable the bounds check. Default is to keep the bounds check.
4. RSA Decrypt bounds check only checked the first time into wc_RsaFunction().
2018-02-23 17:04:05 -08:00
JacobBarthelmeh 89390180a0
Merge branch 'master' into Compatibility-Layer 2018-02-22 15:24:31 -07:00
Jacob Barthelmeh fd7ffc992f fix for unused variables 2018-02-21 11:19:49 -07:00
Jacob Barthelmeh 2a15b3912b revert pkcs7 attrib structure for scep and add more macro guards for AES key size 2018-02-19 17:32:39 -07:00
Jacob Barthelmeh c9525d9c1d add opensslextra=x509small build option 2018-02-19 17:32:39 -07:00
Jacob Barthelmeh f569645212 add wolfSSL_SHA256 function 2018-02-16 16:57:45 -07:00
Jacob Barthelmeh a651b08afa add wolfSSL_AES_ecb_encrypt function 2018-02-16 15:08:31 -07:00
JacobBarthelmeh 223edab6d9
Merge pull request #1378 from dgarske/evp_gcc7_async_test
Fixes a few build errors with EVP/wolfCrypt test and async API test hang
2018-02-16 13:11:36 -07:00
David Garske ae5dac8994 Fixes for GCC 7 build errors with evp.c and switch fall through. General EVP code formatting cleanup. Fix for wolfCrypt test un-used var when `HAVE_AES_CBC` not defined. Fix for async in `test_wolfSSL_SESSION` with `err` not being initialized. 2018-02-16 09:32:40 -08:00
Jacob Barthelmeh 488a795747 add wolfSSL_PEM_read_bio_RSAPrivateKey function 2018-02-15 22:34:50 -07:00
John Safranek d8eff923f1
Merge pull request #1372 from JacobBarthelmeh/UnitTests
clear error node queue after test case and initialize logging buffer
2018-02-15 08:40:45 -08:00
David Garske 9ff97997a6
Merge pull request #1360 from SparkiDev/sp_math
Minimal implementation of MP when using SP.
2018-02-14 15:49:23 -08:00
Jacob Barthelmeh c1b1fbaf7e clear error node queue after test case 2018-02-14 13:55:43 -07:00
Jacob Barthelmeh c09e55c749 add check for having ECC enabled when testing with ECC certificate 2018-02-12 09:59:35 -07:00
toddouska d827e93af9
Merge pull request #1329 from JacobBarthelmeh/PKCS12
PKCS12 reverse order that certificates are compared for keypair
2018-02-09 13:15:07 -08:00
Sean Parkinson a3a4f2d59c Minimal implementation of MP when using SP.
--enable-sp-math to include minimal implementation of MP (only with
--enable-sp.)
Add futher functionality for ECC (conditionally compiled):
- check key
- is point on curve
- API to add and double projective points
- API to map from project to affine
- Uncompress point (including sqrt)
Some configuration options will not work with SP math - configure.ac
detects this and errors out.
Change test code to better support SP sizes only.
2018-02-08 15:50:17 +10:00
Jacob Barthelmeh 62b8c0c3fd add test case for order of certificates with PKCS12 parse 2018-02-07 16:52:39 -07:00
toddouska d63373066b
Merge pull request #1331 from JacobBarthelmeh/Compatibility-Layer
add comments and better error checking for PKCS8 strip
2018-02-02 10:50:29 -08:00
Takashi Kojo 162326dfcb fix shadow global 2018-01-22 01:19:45 +09:00
Jacob Barthelmeh 1428934ad5 add comments and better error checking for PKCS8 strip 2018-01-19 16:53:12 -07:00
toddouska 2efe7f6d96
Merge pull request #1319 from JacobBarthelmeh/Compatibility-Layer-Part5
Compatibility layer part4
2018-01-19 14:49:12 -08:00
John Safranek 9654f19075 RSA Key Gen Test Fix
A recent change to the RSA key generation process is capping the number of attempts of finding a probable prime to a multiple of the prime's size, in FIPS builds. This means it might fail once in a while. (It could also fail for a couple other reasons but this is the most likely.) The API is changed to retry key generation until it succeeds. Non-FIPS builds keep trying until they find a prime.
2018-01-18 12:20:25 -08:00
Jacob Barthelmeh 19288ea127 casting values, update names, g++ build 2018-01-17 12:18:00 -07:00
Jacob Barthelmeh 676e2f1f63 add comments and remove 2999 bit rsa key test for now 2018-01-17 11:19:21 -07:00
Jacob Barthelmeh bf57da1914 static analysis fixes, free buffer return in test case, fips build 2018-01-17 09:28:25 -07:00
Takashi Kojo 56efe657fc save iPad, oPad. test long key 2018-01-16 14:57:53 -07:00
Takashi Kojo 30e6ec5396 HMAC_CTX_copy, copy save_len, save_key 2018-01-16 14:54:44 -07:00
Takashi Kojo c80cadb25f DES_set_odd_parity to MLB 2018-01-16 14:12:43 -07:00
Jacob Barthelmeh a643ae1907 return code of sk num, X509 store peer chain, and get text by NID fix 2018-01-16 13:49:58 -07:00
Jacob Barthelmeh 19244fc0c9 fix memory management 2018-01-16 13:44:53 -07:00
Jacob Barthelmeh 01cd58cc43 fix wolfSSL_DH_1536_prime 2018-01-16 13:44:53 -07:00
Jacob Barthelmeh 479b7e5ca8 SHA1 implementation and test 2018-01-16 10:39:22 -07:00
Jacob Barthelmeh 7cc7de9d4a add set msg callback tests 2018-01-16 10:39:21 -07:00
Jacob Barthelmeh 990e1f3ddf implement wolfSSL set msg callback function 2018-01-16 10:39:20 -07:00
Jacob Barthelmeh 01e6feb060 add hmac ctx copy testing to unit tests 2018-01-16 09:27:39 -07:00
Jacob Barthelmeh b9001d3c4d implement X509 store ctx set error function 2018-01-16 09:12:02 -07:00
Jacob Barthelmeh 86112a574f implement X509 store ctx get ssl idx 2018-01-16 02:29:51 -07:00
Jacob Barthelmeh c8381afdc1 implement asn1 object to nid function 2018-01-16 02:17:43 -07:00
Jacob Barthelmeh 189a4d74c0 implement get error line data function 2018-01-16 02:17:42 -07:00
Jacob Barthelmeh f393eb9176 implement ssl set session id context 2018-01-16 02:17:42 -07:00
Jacob Barthelmeh ede8127569 implement function for setting CTX verify depth 2018-01-16 02:17:40 -07:00
Jacob Barthelmeh 762b7144e0 implement WOLFSSL get app data and set app data functions 2018-01-16 02:13:16 -07:00
Jacob Barthelmeh 3089fa2d27 group sk x509 functions together and implement sk x509 pop free 2018-01-16 02:10:15 -07:00
Jacob Barthelmeh b369112ed3 implement CTX check private key function 2018-01-16 01:53:05 -07:00
Jacob Barthelmeh 86deb23d2f put a macro guard on stub functions and implement quick ones, alo update macro guards on recent BN and RSA tests 2018-01-16 01:51:00 -07:00
Jacob Barthelmeh 266132521c implement RSA key generation compatibility function and BN get word 2018-01-16 01:50:58 -07:00
Jacob Barthelmeh 47f234dce2 add wolfSSL_EVP_md4 function 2018-01-16 01:22:48 -07:00
Jacob Barthelmeh ad6cc6be2e fix clang build warnings and change return type 2018-01-16 01:12:11 -07:00
Jacob Barthelmeh db3badb73a add GENERAL NAME stack functions and fix WOLFSSL_BIO free with files 2018-01-16 01:12:09 -07:00
Takashi Kojo 32ca91cd2f fix return value type of fread 2018-01-16 00:16:34 -07:00
Jacob Barthelmeh d1c05c1883 fix DER to internal private key function 2018-01-16 00:14:08 -07:00
Jacob Barthelmeh 46a0cedb08 return value for printing asn1 time 2018-01-15 23:17:03 -07:00
Jacob Barthelmeh 32bf163633 update base64 WOLFSSL_BIO encoding and checking session context ID 2018-01-15 17:54:46 -07:00
Jacob Barthelmeh b5ab505d1e testing with WOLFSSL_BIO write 2018-01-15 17:40:51 -07:00
Jacob Barthelmeh dc4159546b refactor WOLFSSL_BIO read/write to bio.c and update read and write for base64 formating 2018-01-15 17:22:54 -07:00
Jacob Barthelmeh 52a89349dd resolves redefinition warnings with clang builds 2018-01-15 16:13:45 -07:00
Jacob Barthelmeh 930930ebc4 update DER to internal function with private RSA key 2018-01-15 13:46:18 -07:00
Jacob Barthelmeh e9f3d7f898 add the function ERR remove state and test for it 2018-01-15 10:56:54 -07:00
toddouska 2e6f97621a
Merge pull request #764 from JacobBarthelmeh/Compatibility-Layer-Part3
Compatibility layer part3
2018-01-13 09:57:14 -08:00
Jacob Barthelmeh 2945213871 update to d2i_PUBKEY function 2018-01-12 16:01:23 -07:00
toddouska 0590f2493e
Merge pull request #1314 from dgarske/cleanups
Minor fixes and cleanups for hash digest/block size
2018-01-12 13:00:53 -08:00
dgarske 3f8ecb4e70
Merge pull request #1313 from JacobBarthelmeh/Testing
DHE suite with test case and set server/client method
2018-01-12 10:03:03 -08:00
Jacob Barthelmeh d04775ecfb Add check for AES with using AES cipher suite 2018-01-12 09:10:55 -07:00
Jacob Barthelmeh 064a54f552 static analysis and windows fix 2018-01-11 14:08:22 -07:00
Jacob Barthelmeh 4a9f5f3a7e add DES cksum and DES set odd parity 2018-01-11 11:32:00 -07:00
David Garske 481f4765eb Cleanup to remove duplicate MAX_DIGEST_SIZE in hmac.h and refactor to use WC_MAX_DIGEST_SIZE. Cleanup for HMAC to include hash.h and refactor HMAC_BLOCK_SIZE to WC_HMAC_BLOCK_SIZE. Fix build warning in benchmark.c with unused variable if features are disabled. 2018-01-11 09:52:49 -08:00
Jacob Barthelmeh e442f8dccf DHE suite with test case and set server/client method 2018-01-11 10:24:48 -07:00
toddouska bb52b0a7b9
Merge pull request #724 from JacobBarthelmeh/Compatibility-Layer-Part2
Compatibility layer part2
2018-01-11 08:28:54 -08:00
toddouska 2cdcd560a2
Merge pull request #1307 from JacobBarthelmeh/Testing
fix check key pair match with ECC
2018-01-11 08:26:25 -08:00
toddouska df3c775f1d
Merge pull request #1304 from cconlon/dsa1864
DSA 186-4 Key Generation, raw params and key import/export
2018-01-11 08:25:27 -08:00
Chris Conlon d78a6cebd8 allow DSA raw export functions to return buffer sizes 2018-01-10 10:21:58 -07:00
Jacob Barthelmeh e9432005d4 build for no old names and fix valgrind report 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh 23b271da84 clean up after rebase 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh ab0bc32d4c resolve rebase by adding an error node pull function 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh 00670233af account for fast rsa when testing get rsa size 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh c8233177c3 fix bio gets and enhance x509 get public key 2018-01-10 09:28:56 -07:00
Takashi Kojo 150481699f add BIO_new_file: ssl.c, tests/api.c 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh 1765246cf7 bio gets test, certificate buffer tests, and increase max static memory bucket size with sessioncerts 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh 79ea6b78bb add name entry and fix build without RSA 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh 54246053de WOLFSSL_RSA in EVP_PKEY structure and fixes for PKCS12 build 2018-01-10 09:28:56 -07:00
Takashi Kojo 49816b95e0 Type mismatch AssertInt(x, y, op, er) in api.c 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh 7252a138e0 ASN1 object functions 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh 35ad1269a8 expand compatibility layer, hmac, dsa gen, pubkey from bio, pseudo rand 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh e391931711 error put function 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh 704d765501 adjust compat. layer to not include wolfSSL headers where possible, add d2i for X509's, clang-3.3 build 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh e213e60471 PKCS 8 info function 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh 03b0a07adb add BN pseudo random function 2018-01-10 09:28:56 -07:00
Jacob Barthelmeh c552de77f4 PKCS12 create function 2018-01-10 09:28:56 -07:00
David Garske aac050369a Added API unit tests for new BUF_MEM. Fixed wolfSSL_BUF_MEM_grow handling of negative “len” input. Added GPLv2 header to new buffer.h. 2018-01-10 09:28:30 -07:00
Jacob Barthelmeh 921eb03a01 add PEM read bio private key function and update reading a memory bio 2018-01-10 09:26:58 -07:00
Takashi Kojo f9eb8f8f6d missing rename SSL_check_private_key, DSA_dup_DH 2018-01-10 09:26:58 -07:00
Jacob Barthelmeh 9290b2e464 RAND cleanup and no-op functions for compatibility -- brackets added to ssl.c if statements for gcc-6 2018-01-10 09:26:58 -07:00
Jacob Barthelmeh 54af9fb884 compatibility mapping for STORE_CTX functions and added test case 2018-01-10 09:26:58 -07:00
Jacob Barthelmeh f0c19ba9b2 add internal to DER X509 function 2018-01-10 09:26:58 -07:00
Jacob Barthelmeh 7da0f50457 tests for added DES functions and fix check on DES key 2018-01-10 09:26:58 -07:00
Jacob Barthelmeh 2b75d0faf3 asn1 string compatibility 2018-01-10 09:26:58 -07:00
Jacob Barthelmeh 0bfa399b6c fix check key pair match with ECC 2018-01-09 16:13:46 -07:00
Chris Conlon e42fea8710 add unit tests for DSA raw key and param import/export functions 2018-01-08 13:36:06 -07:00
Jacob Barthelmeh b22ae9de4c add DH callback to example server and client 2018-01-05 11:56:59 -07:00
Jacob Barthelmeh 915f628bc7 add DH Agree callback 2018-01-03 16:47:15 -07:00
jrblixt 6c76a89785 Add ECC unit test functions.
Change per David RE: WOLFSSL_ATECC508A
Jenkins fix.
Changes per Chris.
2017-12-29 13:03:45 -07:00
jrblixt 8a51df9fd8 Spacing issue per Chris. 2017-12-29 09:48:35 -07:00
jrblixt 555551b745 Added Ed25519 to unit test functions. 2017-12-28 09:42:51 -07:00
Chris Conlon 83cb000958
Merge pull request #1289 from jrblixt/unitTest_api_addCmac-PR08162017
AES_CMAC unit test functions added.
2017-12-27 15:54:32 -07:00
Chris Conlon 0c709a9088
Merge pull request #1098 from jrblixt/unitTest_api_addSha3-PR08112017
Sha3 unit test functions.
2017-12-27 15:23:14 -07:00
Chris Conlon 2660ff0b93
Merge pull request #1251 from kojo1/openSSL-Compat-201711
openSSL compatibility 201711
2017-12-21 16:25:46 -07:00
jrblixt 4552c8a4a7 AES_CMAC unit test functions added. 2017-12-20 15:44:44 -07:00
Chris Conlon adc8ca0f16 api.c fix for fast-rsa 2017-12-20 15:13:13 -07:00
jrblixt 98603d9e74 Sha3 unit test functions.
Code review changes per Chris.
2017-12-20 10:49:24 -07:00
Go Hosohara bfed9f28d3 Modification for compliling application with libsignal-protocol-c. 2017-12-19 13:19:05 +09:00
David Garske 57c0b5d4ac Adjustment to fix for --enable-32bit where time_t is not long. 2017-12-18 14:34:40 -08:00
David Garske bbd27b491e Fix for building with --enable-32bit where test assumes time_t is long. 2017-12-18 11:04:40 -08:00
Takashi Kojo 98235f9e36 fix hard tabs 2017-11-30 09:08:59 +09:00
Takashi Kojo b664a1187b fix hard tabs, new line 2017-11-29 07:03:00 +09:00
Takashi Kojo 64caf325f8 add ctx == NULL checks, fix spacing 2017-11-28 10:16:24 +09:00
Takashi Kojo 8f31d36bcd gurde SSL_get_peer_cert_chain->count check by macro option 2017-11-25 06:25:15 +09:00
Takashi Kojo eb85accea9 Fix 'buffer' shadows a global (2) 2017-11-25 03:59:35 +09:00
Takashi Kojo 79b648c006 Fix ‘buffer’ shadows a global 2017-11-24 18:21:32 +09:00
Takashi Kojo a320ca92fb fix rebase miss 2017-11-24 08:21:27 +09:00
Takashi Kojo fce1b90b63 SSL_get_peer_cert_chain(ssl)->count value check in api.c 2017-11-24 08:09:41 +09:00
Takashi Kojo 803bd7c612 Review feedbacks: refactor test_SSL_set_options and add SSL_clear_option 2017-11-24 08:07:32 +09:00
Takashi Kojo c6988b74b1 Remove unused files 2017-11-24 08:03:16 +09:00