Commit Graph

186 Commits (863e6836a9ca8772964a3cf5a15a2e6794cc3e1e)

Author SHA1 Message Date
Andrew Hutchings 863e6836a9 Add RSA OAEP and PSS padding
Functions added:
* `encrypt_oaep(self, plaintext, hash_type, mgf, label)`
* `decrypt_oaep(self, ciphertext, hash_type, mgf, label)`
* `sign_pss(self, plaintext, hash_type, mgf)`
* `verify_pss(self, plaintext, signature, hash_type, mgf)`

Constants added:
* MGF1SHA224
* MGF1SHA256
* MGF1SHA384
* MGF1SHA512
* HASH_TYPE_NONE
* HASH_TYPE_MD2
* HASH_TYPE_MD4
* HASH_TYPE_MD5
* HASH_TYPE_SHA
* HASH_TYPE_SHA224
* HASH_TYPE_SHA256
* HASH_TYPE_SHA384
* HASH_TYPE_SHA512
* HASH_TYPE_MD5_SHA
* HASH_TYPE_SHA3_224
* HASH_TYPE_SHA3_256
* HASH_TYPE_SHA3_384
* HASH_TYPE_SHA3_512
* HASH_TYPE_BLAKE2B
* HASH_TYPE_BLAKE2S
2022-02-03 15:43:04 +00:00
Hayden Roche 726c37e9e7
Merge pull request #33 from danielinux/aes-ctr 2022-02-01 15:43:12 -08:00
Andrew Hutchings 16334bf5e6 Add support for AES GCM streaming 2022-02-01 07:45:21 -08:00
Andrew Hutchings cbbe08b256 Minor fixups to tox
1. sdist based build/test works now. Better to use that.
2. switch to py3 instead of py39 to better suit older versions.
3. remove pep8 testing for now, some more work needed for that.
2022-01-31 23:42:45 -08:00
Daniele Lacamera 59a1d5c825 Removed stale comment 2022-02-01 08:37:03 +01:00
Andrew Hutchings c7125b04b1 Fix sdist and packaging
wolfcrypt was not being packaged in the sdist and the build system did
not work if the source wasn't a git checkout. Both fixed.
2022-01-31 04:34:03 -08:00
Daniele Lacamera 8a514e0f8e Added support for AES-CTR 2022-01-31 13:32:14 +01:00
Andrew Hutchings bd4432b7be Refactor build for better platform support
* Fix some path and compiler things for Windows
* Move source code to align better with Python standards
* Have setup.py build wolfSSL and FFI
* Update Python versions in tox
* Add CMake building for Windows build
* Add missing __init__.py for tox
* Make wolfSSL a git submodule
2022-01-31 00:51:45 -08:00
Daniele Lacamera 40a6da2b1b
Merge pull request #30 from haydenroche5/fipsv5
Call wolfCrypt_SetPrivateKeyReadEnable_fips at init, if necessary.
2022-01-25 01:44:19 -08:00
Hayden Roche 4c59f4fb72 Call wolfCrypt_SetPrivateKeyReadEnable_fips at init, if necessary.
This is another FIPS v5 change. This function needs to be called before we can
do private key ops with the new FIPS module.
2022-01-24 13:38:30 -08:00
Daniele Lacamera d2668d507a
Merge pull request #29 from haydenroche5/fipsv5
Call wc_SetSeed_Cb in __init__.py if needed.
2022-01-24 01:52:13 -08:00
Hayden Roche c4bba33ab3 Call wc_SetSeed_Cb in __init__.py if needed.
When using wolfCrypt FIPS v5 with an application (e.g. wolfcrypt-py), the
application needs to set an RNG seed generation callback with wc_SetSeed_Cb.
This can simply be wc_GenerateSeed. This commit adds code to __init__.py
to do just that.
2022-01-20 19:29:33 -08:00
Hayden Roche 2916871003
Merge pull request #28 from danielinux/version-up-pwdbased-on 2022-01-18 08:29:50 -08:00
Daniele Lacamera e8e49f4cb9 Updated wolfcrypt, copyright notes. Add pwdbased on by default. 2022-01-10 21:23:12 +01:00
Daniele Lacamera 5da42db7a9 wolfCrypt version update, enabled pwdbased by default 2022-01-10 21:23:12 +01:00
Daniele Lacamera 9c57867f5e
Merge pull request #27 from haydenroche5/signature
Add signature generation and verification.
2022-01-04 10:13:20 -08:00
Hayden Roche 7a847cf9b1 Add signature generation and verification. 2021-12-21 14:35:42 -08:00
Daniele Lacamera 10ba23046b
Merge pull request #26 from haydenroche5/pem
Add a pem_to_der function and support for PEM RSA keys.
2021-12-21 03:25:32 -08:00
Hayden Roche ab332f5869 Add a pem_to_der function and support for PEM RSA keys. 2021-12-20 15:23:04 -08:00
David Garske 7900cf7dc0
Merge pull request #25 from danielinux/ed448
Adding support for ed448
2021-12-13 09:44:50 -08:00
Daniele Lacamera e3968d1932 Adding support for ed448 2021-12-13 13:40:12 +01:00
Daniele Lacamera e5a2bbe738
Merge pull request #24 from haydenroche5/fips
Make wolfcrypt-py work with FIPS ready and other improvements.
2021-09-27 10:18:06 -07:00
Hayden Roche b79527f876 Make wolfcrypt-py work with FIPS ready and other improvements.
- Detect ECC timing resistance and call wc_ecc_set_rng where appropriate.
- Detect FIPS version and use that information to figure out how to map hash
enum values (see _TYPE_SHA and friends).
- Don't call wc_HmacSetKey in the _Hmac constructor if the key passed to _init
is length 0. This can happen, for example, when the _Hmac object is being
copied. The copy operation copies over the raw memory from the underlying C
object, so it's not important that we call wc_HmacSetKey in this case.
- Removed a unit test that expected importing an ECC public key from a private
key to fail. This does fail in the default wolfSSL version for wolfcrypt-py,
v4.1.0-stable, but we added the feature to be able to import public from
private with wolfSSL PR #2916. As a result, this test fails with v4.8.1-stable.
We should upgrade wolfcrypt-py's default wolfSSL version (and the wolfcrypt-py
version itself) in the near future.
- The array slicing in test_key_encoding was wrong in many places. This likely
stemmed from the author thinking slices were inclusive, but that's only true
for the first element of the slice (e.g. [0:31] is elements 0-30 inclusive, not
elements 0-31 inclusive). This was uncovered by testing with FIPS ready, which
adds -DWOLFSSL_VALIDATE_ECC_IMPORT, causing us to check ECC keys with
wc_ecc_check_key. wc_ecc_check_key kept saying, "hey, that point's not on the
curve." The array slicing problem was the culprit.
- Fixed tests that were doing HMAC with a key less than HMAC_FIPS_MIN_KEY.
2021-09-16 12:55:47 -07:00
Daniele Lacamera 8ed0316993
Merge pull request #23 from haydenroche5/fips
Modify hashes.py to use correct hash type values when FIPS is enabled.
2021-07-14 06:37:02 -07:00
Hayden Roche 5598580b1b Modify hashes.py to use correct hash type values when FIPS is enabled. 2021-07-12 15:25:40 -07:00
Daniele Lacamera 3569c39d35
Merge pull request #22 from haydenroche5/rsa_blinding
Added detection of FIPS and RSA blinding. Fixed wc_PBKDF2.
2021-07-08 22:56:57 -07:00
Hayden Roche 812d359700 Make several improvements.
- Refactor the feature detection section of _build_ffi.py to be more Pythonic.
- Add detection of FIPS and RSA blinding. Don't enable RSA blinding if FIPS is
enabled. Full-fledged FIPS checks for other features are not included; this just
helps with RSA blinding, for now. Use this to determine if wc_RsaSetRNG is
available.
- Change the various *_ENABLED variables to have extern, since they're
declared in a header and initialized in a source file.
- Add a missing include of pwdbased.h to provide the declaration of wc_PBKDF2.
2021-07-01 14:57:59 -07:00
Chris Conlon 270a7903eb
Merge pull request #20 from haydenroche5/PBKDF2
Add module pwdbased.py and expose wc_PBKDF2.
2021-02-25 15:49:14 -07:00
Hayden Roche 2d7c43714e Add module pwdbased.py and expose wc_PBKDF2. 2021-02-25 16:40:30 -06:00
Hayden Roche 4d03ebbf9c
Merge pull request #21 from cconlon/rmpython2.7
remove python 2.7 from make/osx scripts
2021-02-25 10:03:42 -06:00
Chris Conlon a3c809d585 remove python 2.7 from make/osx scripts 2021-02-24 09:50:44 -07:00
Chris Conlon 4d8e4a3dd5
Merge pull request #19 from haydenroche5/RsaPrivate
Add support for RSA private keys in PKCS #8 format.
2021-01-21 15:49:28 -07:00
Hayden Roche 46b6d6ac0b Add support for RSA private keys in PKCS #8 format. 2021-01-21 10:53:36 -06:00
Chris Conlon 78ee7f77ec
Merge pull request #16 from ejohnstown/update-build
Modernize
2020-11-05 17:15:43 -07:00
John Safranek 947bdf4bbf
Modernize
1. Update the travis script to follow their multi-OS example.
2. Set the path to Python in the osx bulid wheels script.
3. For osx, removed all versions of python except 2.7, 3.7,
   and 3.8.
2020-11-05 15:38:37 -08:00
Chris Conlon 4d6a32bc70
Merge pull request #9 from ejohnstown/build-update
Build Update
2020-11-03 16:47:04 -07:00
David Garske aecdddc833
Merge pull request #15 from wolfSSL/chacha
Fixed arguments in Chacha.set_iv(nonce, counter=0)
2020-06-18 07:34:18 -07:00
Daniele Lacamera 6954491dbd Fixed arguments in Chacha.set_iv(nonce, counter=0) 2020-06-18 10:01:28 +02:00
David Garske e993b65fe4
Merge pull request #14 from wolfSSL/chacha
Added support for ChaCha stream cipher
2020-06-10 14:42:21 -07:00
Daniele Lacamera 1852a13c7f Added support for ChaCha stream cipher 2020-06-09 16:47:17 +02:00
David Garske 7181c60f7a
Merge pull request #10 from cconlon/copyright2020
update copyright to 2020
2020-03-30 06:29:47 -07:00
David Garske 0b8eda9e27
Merge pull request #11 from wolfSSL/keccak
Added support for SHA3
2020-01-07 20:36:58 -08:00
Daniele Lacamera 19cf0db33e Removed magic numbers 2020-01-07 20:20:04 +01:00
Daniele Lacamera 0b4cbfcb4d Added support for SHA3 2020-01-07 20:02:50 +01:00
Chris Conlon e7601183c4 update copyright to 2020 2020-01-03 16:29:04 -08:00
David Garske a4d6dc6d27 Fix spelling error. 2019-12-06 07:49:58 -08:00
John Safranek 255b5bce3b Build Update
One more update to make the build_wheels scripts the same.
2019-09-27 16:25:47 -07:00
John Safranek d89a715622 Build Update
1. Use the same docker image as the wolfSSL python project.
2. Remove the absolute path to the python interpreter. They just need to
be in the path. (For example, you might install old versions in /opt and
add their subdirs to the path while the latest runs out of its location.)
3. Build the name of python, pip, and venv_ based on the version.
2019-09-27 15:44:48 -07:00
Daniele Lacamera c57c4aeba9 update to 'wolfssl-version-4.1.0-stable' 2019-09-26 19:53:24 +02:00
Daniele Lacamera 78ad3f35e5
Merge pull request #8 from cconlon/05.23.19
Native feature detection, CFFI cleanup
2019-09-26 19:52:33 +02:00