Commit graph

108 commits

Author SHA1 Message Date
David Buchanan
56933bf61a
utils.int_to_bytes: guard against zero-length (#11173)
* utils: guard against zero-length int_to_bytes

* add tests for HBKDF with llen=0

* kbkdf: guard against llen==0

* test that kbkdf rejects llen==0 at __init__

* add standalone test for zero-length int_to_bytes

* Update src/cryptography/hazmat/primitives/kdf/kbkdf.py

typo

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

---------

Co-authored-by: Alex Gaynor <alex.gaynor@gmail.com>
2024-06-29 15:23:57 +00:00
Dimitri Papadopoulos Orfanos
9321740c2a
Apply ruff/flake8-implicit-str-concat rule ISC001 (#10932)
ISC001 Implicitly concatenated string literals on one line

This rule is currently disabled because it conflicts with the formatter:
	https://github.com/astral-sh/ruff/issues/8272
2024-05-05 16:11:26 +00: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
fdb3a434c7
Resolve new flake8 errors (#7462) 2022-07-30 16:29:00 -10:00
Alex Gaynor
02783d2297
Remove explicit subclassing of object now that all classes are new-style (#6830)
As someone who first with Python in 2.4 or so, this habit is going to be hard to break.
2022-01-30 16:29:24 +00:00
Alex Gaynor
c8dc74c5eb
Finally remove deprecated int_from_bytes (#6652) 2021-11-25 08:13:15 +08:00
Sándor Jenei
bacf23f3ed
_ModuleWithDeprecations should inherit from types.ModuleType (#6267) (#6268)
* _ModuleWithDeprecations should inherit from types.ModuleType (#6267)

Update utils.py

* fix typos reported by black

* flake8 fix

* Test should fail when int_from_bytes will be removed.

Because this test would become pointless then.
2021-09-13 17:08:34 +08:00
Alex Gaynor
e0477596f7
Remove __future__ import from our code (#5610) 2020-12-09 00:35:11 -06: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
Alex Gaynor
f7567f6207 HTTPS a bunch of links in random places (#4666)
* HTTPS a bunch of links in random places

* What the heck happened here?
2018-12-31 10:10:09 -06:00
Paul Kehrer
0322962e14 update pytest config (#4463)
* update pytest config

pytest 3.8.0 was just released and officially deprecates some of the way
we do pytest marks. They introduced a new way to do this in 3.6 so this
PR switches to that mechanism and updates our minimum pytest requirement

* update the stubs

* also update wycheproof test config to remove deprecated paths

* don't need this any more
2018-09-06 23:56:46 -04:00
Paul Kehrer
47a66f19bd Allow DSA q=224 (#4147)
* load Q=224 vectors

* DSA parameters should support 224 for q length

* oxford comma
2018-03-18 10:12:14 -04:00
Paul Kehrer
33a41e75d2 implement CCM vector parser (#3699) 2017-06-21 07:39:20 -04:00
Paul Kehrer
a923b005a1 ed25519 vector loader (#3707)
* ed25519 vector loader

* refactor to use unpacking
2017-06-20 07:12:35 -04:00
Alex Gaynor
e6055fbfb2 call check_backend_support directly from backend fixture (#3666) 2017-06-03 16:02:50 -10:00
Alex Gaynor
133a17971a Switched our backend to be a normal fixture in tests (#3665) 2017-06-03 14:38:22 -10:00
Alex Gaynor
f9b3b1592d Delete some code (#3563)
* Delete some code

* removed import

* delete more code
2017-05-20 18:36:19 -07:00
Jared
cd258d531c Adding CAVP vector parsing for NIST SP 800-108 KDF vectors. (#2865) 2016-04-13 16:03:52 -05:00
Simo Sorce
6e3b155bb6 Fix load_kasvs_ecdh_vectors() COUNT sourcing
COUNT is a decimal number in test files, but was erroneously read
and converted as if the source was a hexadecimal number.

Fix the loader and test the fix.

Signed-off-by: Simo Sorce <simo@redhat.com>
2015-10-13 14:50:17 -04:00
Alex Gaynor
ace036dc67 Some cleanups 2015-09-24 20:23:08 -04:00
Simo Sorce
7600dee648 Add vector loader for X9.63 vectors
Signed-off-by: Simo Sorce <simo@redhat.com>
2015-09-24 19:38:41 -04:00
Paul Kehrer
ac78c866d3 add test to cover partial branch in load_kasvs_ecdh_vectors
The loop to find supported parameter sets is partially covered otherwise
2015-08-01 20:26:00 +01:00
Paul Kehrer
fcd7d707fe add a line for the ecdh vector loader to cover a missed branch 2015-08-01 19:50:08 +01:00
Alex Gaynor
50ebb48985 fixed tests 2015-07-02 00:21:41 -04:00
Simo Sorce
83e563e6a8 Modify ECDH Test vector loader for KDF vectors
Also add tests for the new vectors

Signed-off-by: Simo Sorce <simo@redhat.com>
2015-05-06 16:37:44 -04:00
Simo Sorce
917addbb06 Add loader for ECDH test vectors
Also fix test vector files, they had a truncated line for the EE set in
both init and resp files.

Signed-off-by: Simo Sorce <simo@redhat.com>
2015-05-01 15:58:35 -04:00
Paul Kehrer
aa7dacaf53 add encode_rfc6979_signature and refactor tests to use it 2014-11-27 10:43:49 -10:00
Alex Gaynor
5951f46be6 Update the license header for every source file, as well as the documentation.
Fixes #1209
2014-11-16 09:08:42 -08:00
Paul Kehrer
902d8cfd58 move skip_if_empty to separate function for test coverage 2014-10-25 12:22:10 -07:00
Alex Gaynor
7aab8b4ae4 Change how we represented that a test requires a backend.
This way is more extensible and requires less maintaince
2014-10-23 11:01:25 -07:00
Alex Stapleton
839c09d53e KASVS vector loader 2014-08-10 13:53:30 +01:00
Paul Kehrer
be8ce55717 negative test 2014-04-30 14:12:26 -05:00
Paul Kehrer
14951f4252 rename dss_sig_value -> der_encode_dsa_signature 2014-04-30 12:14:48 -05:00
Paul Kehrer
d3e3df9308 use pyasn1 for creating the dss-sig-value structure 2014-04-30 11:13:17 -05:00
Paul Kehrer
3fc686ea06 dss_sig_value: Pure python conversion of (r, s) to byte stream 2014-04-30 09:07:27 -05:00
Alex Gaynor
462bd60731 Fix some typos.
Found with https://github.com/intgr/topy/
2014-04-25 07:49:08 -07:00
Paul Kehrer
7ef2f8f6c8 fix a coverage miss in the dsa sig vector loader 2014-04-22 08:37:58 -05:00
Mohammed Attia
3c9e15857d Modify DSA SigVer loader to be able to load SigGen vectors 2014-04-22 16:25:11 +02:00
Mohammed Attia
0fb5d85c6c Add DSA SigVer vectors loader 2014-04-22 12:52:26 +02:00
Alex Stapleton
6f729490b1 SigVer.rsp loading 2014-04-19 09:06:20 +01:00
Alex Stapleton
24a2f07246 Missed an unhexlify 2014-04-16 10:00:12 +01:00
Alex Stapleton
fb812d66a9 Use binascii.hexlify instead of just hexlify 2014-04-15 16:07:25 +01:00
Alex Stapleton
c387cf7e57 ECDSA SigGen.{txt,rsp} vector loader 2014-04-13 19:42:16 +01:00
Alex Stapleton
cf0486082b ECDSA vector loader 2014-04-12 14:39:09 +01:00
Paul Kehrer
3fe9150c1c expand pkcs1 loader to support OAEP as well 2014-03-29 12:48:25 -05:00
Alex Stapleton
85a791f0fa Pain the bikeshed a different colour 2014-03-27 16:55:41 +00:00
Alex Stapleton
5e4c8c3666 Fixes to @alex's comments 2014-03-27 16:38:00 +00:00
Alex Stapleton
d80195e171 Update tests 2014-03-27 12:53:55 +00:00
Alex Stapleton
112963e296 Address most of my own comments 2014-03-27 07:31:12 +00:00