Commit graph

66 commits

Author SHA1 Message Date
Alex Gaynor
dcf6ac240d
Updates for ruff 0.3.1 (#10548) 2024-03-07 10:57:37 -08:00
Alex Gaynor
d844fd4556
Split wycheproof tests up by file (#10025)
This provides greater parallelism. 25% faster at running wycheproof tests locally
2023-12-21 12:16:49 -06:00
Alex Gaynor
fb4c72c8bf
Added wycheproof vectors for pbkdf2 (#10024) 2023-12-21 08:30:36 -06:00
Alex Gaynor
f31e309a07
Update comment (#9529) 2023-09-01 13:15:39 -05:00
Alex Gaynor
986f0b19b5
Added several tests and cleanups for serialization and EC (#9049) 2023-06-10 13:35:24 -06:00
Alex Gaynor
5e3061c05e
Stop validating keys in ECDH exchange (#8490)
The theory here is that we're already doing sufficient validation key loading, and this is purely duplicative.

Note that there's at least _some_ validationg that was previously occurring only ECDH, the LowOrderPublic check that can be seen in wycheproof.
2023-03-11 12:14:27 +08:00
Paul Kehrer
ce05282e58
cache ECDH values in wycheproof too (#8487)
this alters and renames the caching function a bit since it caches *to
the group* object but the actual values (in ECDH) come from the testcase
itself
2023-03-10 07:31:10 -05:00
Alex Gaynor
31f0dcabda
Cache some keys that are reused in wycheproof tests (#8479) 2023-03-10 05:17:42 +08:00
Alex Gaynor
d05a8ac6cd
Update to the new wycheproof (#8403) 2023-02-28 05:07:54 +00:00
Paul Kehrer
50df392f3b
add support for centos9-fips (#8216)
* add support for centos9-fips

Requires a variety of new FIPS constraints on our tests, including the
addition of rsa_encryption_supported

* review comments
2023-02-06 16:42:54 +00:00
Alex Gaynor
e7fc8abe98
don't run dsa wycheproof without dsa (#8201) 2023-02-02 22:14:35 -08:00
Alex Gaynor
5d3db676cf
Use the ruff 'pyupgrade' checks (#8104) 2023-01-20 05:36:01 +08:00
Alex Gaynor
3f1b55b165
Update formatting for new ruff (#7937) 2022-12-26 22:08:28 +07:00
Alex Gaynor
7ff729ecf2
Switch from flake8 to ruff (#7920)
It's more than 60x faster.
2022-12-21 09:44:47 +07:00
Alex Gaynor
7e33b0e773
Bump OpenSSL/BoringSSL and adapt for OpenSSL RSA bleichenbacher mitigation (#7895)
* Bump BoringSSL and/or OpenSSL in CI

* Attempt to work-around wycheproof tests

Co-authored-by: pyca-boringbot[bot] <pyca-boringbot[bot]+106132319@users.noreply.github.com>
2022-12-14 15:50:06 +09:00
Paul Kehrer
01687d63a5
add unsafe_skip_rsa_key_validation (#7667)
* add unsafe_skip_rsa_key_validation

This allows users to skip RSA key validation when calling
load_pem_private_key, load_der_private_key, and
RSAPrivateNumbers.private_key. This is a significant performance
improvement but is **only safe if you know the key is valid**. If you
use this when the key is invalid OpenSSL makes no guarantees about what
might happen. Infinite loops, crashes, and all manner of terrible things
become possible if that occurs. Beware, beware, beware.

* Apply suggestions from code review

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>

* remove unneeded variable

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2022-10-03 14:29:45 +00:00
Alex Gaynor
07bb910f6f
fix typo in test name (#7426) 2022-07-16 21:31:50 +00:00
Alex Gaynor
790661f54d
update comment now that we dropped 1.0.2 (#7242)
* remove error handling for 1.0.2

* Update test_ecdsa.py
2022-05-21 06:25:35 +08:00
Alex Gaynor
31dd9e0fca
Drop supported for older LibreSSL (#6660)
* Drop supported for older LibreSSL

3.1 covers the oldest version used by versions of Alpine and OpenBSD that are supported by their upstreams.

* Remove tests that are now unused

* Update CHANGELOG.rst

Co-authored-by: Paul Kehrer <paul.l.kehrer@gmail.com>

Co-authored-by: Paul Kehrer <paul.l.kehrer@gmail.com>
2021-11-26 23:05:04 +00:00
Paul Kehrer
3225358d15
x509 tests for boring (#6590) 2021-11-12 00:38:16 -05:00
Paul Kehrer
27374c62c7
FIPS 3.0.0 support (#6012)
* FIPS 3.0.0 support

* comments

* remove unneeded error clear

* review comments

* small refactor

* black

* flake8 too

* review feedback

* oops

* fix
2021-08-29 10:05:32 -04:00
Paul Kehrer
b93f405c07
Speed up RSA tests in 3.0.0 (#6206)
* Speed up RSA tests in 3.0.0

RSA_check_key is slower in OpenSSL 3.0.0 due to improved
primality checking. In normal use this is unlikely to be a problem
since users don't load new keys constantly, but we do in our tests.
This adds some private flags to allow skipping those checks for
performance reasons.

On my laptop with this patch it takes 16s to run test_rsa.py. The
previous commit takes 72s.

* black

* different approach

* skip rsa key checks in wycheproof

wycheproof's tets don't rely on broken keys
2021-08-11 22:47:25 -04:00
Alex Gaynor
245d15b563
Remove requires_backend_interface from tests because it was useless (#5884) 2021-03-01 11:59:24 -06:00
Alex Gaynor
0b41cb2b61
Added typing for a bunch of random stuff (#5743) 2021-02-04 17:43:41 -06:00
Paul Kehrer
ba9beaa8cd
rsa type hinting (#5733)
* rsa type hinting

* remove unused import

* missed return type

* type fixes

* ignores no longer required

* black gets me every time

* Update src/cryptography/hazmat/backends/openssl/rsa.py

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2021-02-01 17:08:48 -05:00
Paul Kehrer
c9ec582aeb
add EC type hinting (#5729) 2021-01-31 23:19:34 -05:00
Paul Kehrer
343ac1344a
enable mypy over tests (#5721)
* clean mypy with tests dir

* remove most no_type_check annotations

* le sigh

* remove unneeded comments
2021-01-31 19:27:41 -05:00
Alex Gaynor
057a9fcf34
fixes #5611 -- use subtests for wycheproof tests for speed (#5616) 2020-12-09 10:04:47 -06:00
Alex Gaynor
e0477596f7
Remove __future__ import from our code (#5610) 2020-12-09 00:35:11 -06:00
Alex Gaynor
2b85c4d915
Simplify wycheproof pytest code (#5579) 2020-11-20 11:22:47 -06:00
Paul Kehrer
b59d2de9cf
GCM IV size limits (#5553)
* GCM IV size limits

OpenSSL 3.0.0 is going to enforce these size limits so we might as well
put them in now.

* fix the tests

* black

* these cases can't happen if we're limiting IV size already
2020-11-09 13:56:53 -05:00
Alex Gaynor
d3eae8d7db
Delete all the 1.0.2 code (#5511) 2020-10-25 22:41:40 -07:00
Paul Kehrer
bda138768a
new black, actually slightly different than the old black (#5429) 2020-08-26 22:59:43 -04:00
Alex Gaynor
60aa04481f
Paint it Black by the Rolling Stones (#5324) 2020-07-20 13:06:29 -05:00
Paul Kehrer
4a245a657a
test FIPS mode on centos8 (#5323)
* test FIPS mode on centos8

* remove branch we don't take

* simpler

* better comment

* rename

* revert some things that don't matter

* small cleanups
2020-07-20 12:10:29 -04:00
Alex Gaynor
12e85b5916
Added wycheproof hmac vectors (#5238) 2020-04-26 15:53:58 -05:00
Alex Gaynor
263bad82ed
Refs #5075 -- added the remainder of the wycheproof rsa tests (#5237) 2020-04-26 12:36:11 -05:00
Alex Gaynor
069691a27b
Added wycheproof RSA PKCSv1 encryption tests (#5234) 2020-04-26 10:44:49 -05:00
Alex Gaynor
01eb304b08
Dropped support for LibreSSL 2.7, 2.8, and 2.9.0 (2.9.1+ are still supported) (#5231) 2020-04-25 22:42:20 -05:00
Alex Gaynor
37e11ccb99
Refs #5075 -- use ed448_test.json from wycheproof (#5191) 2020-04-12 10:02:02 -05:00
Alex Gaynor
ebb04592d2
Refs #5075 -- use hkdf_*.json from wycheproof (#5190) 2020-04-12 09:58:07 -05:00
Alex Gaynor
b77145a009
Refs #5075 -- use rsa_oaep_*.json from wycheproof (#5100) 2020-04-11 20:57:56 -05:00
Alex Gaynor
aece5b3d47
Drop support for OpenSSL 1.0.1 (#5178) 2020-04-04 16:08:08 -05:00
Alex Gaynor
c0dbbb52fb Refs #5075 -- use ecdsa_*.json from wycheproof (#5099) 2020-01-12 22:42:21 -05:00
Alex Gaynor
c8c78bb4c5 Refs #5075 -- use dsa_*.json from wycheproof (#5098) 2020-01-12 21:33:25 -05:00
Alex Gaynor
f95abfeb61 Refs #5075 -- use rsa_signature_*.json from wycheproof (#5078)
* Refs #5075 -- use rsa_signature_*.json from wycheproof

* for azure
2020-01-12 19:35:51 -05:00
Alex Gaynor
fdd80ec89a Refs #5075 -- use x448_test.json from wycheproof (#5077)
* Refs #5075 -- use x448_test.json from wycheproof

* Fixed test

* crypto libraries from people who can't math, it's fine

* Skip teh weirdo 57 byte public keys
2020-01-12 19:35:16 -05:00
Alex Gaynor
9dc710e65a Get tests passing with latest wycheproof clone (#5076)
* Get tests passing with latest wycheproof clone

* Fix x25519 wycheproof tests

* Fix for acme repo changes
2019-11-26 11:48:35 +08:00
David Benjamin
9a09f96908 Fix some backend feature checks in tests (#4931)
* Remove irrelevant DHBackend test conditions

DHBackend provides functions for plain finite-field Diffie-Hellman.
X25519 and X448 are their own algorithms, and Ed25519 and Ed448 aren't
even Diffie-Hellman primitives.

* Add missing backend support checks.

Some new AES and EC tests did not check for whether the corresponding
mode or curve was supported by the backend.

* Add a DummyMode for coverage
2019-07-08 15:42:00 -05:00
Paul Kehrer
cd05e2ac5b ed25519 support (#4114)
* ed25519 support

* review feedback
2019-02-26 23:33:07 -05:00