Commit Graph

475 Commits (master)

Author SHA1 Message Date
Robert de Vries 26203d77d2 Fix mutable arguments passed as default arguments.
Function defaults are evaluated once, when the function is defined.

The same mutable object is then shared across all calls to the function.
If the object is modified, those modifications will persist across calls,
which can lead to unexpected behavior.
2026-04-17 23:18:58 +02:00
Jeremiah Mackey ec8ce54e1f
Merge pull request #106 from roberthdevries/fix-duplicate-error-strings
Remove duplicate definitions of ERROR_STRINGS/ERROR_STRINGS_ENABLED.
2026-04-17 14:02:22 -06:00
Robert de Vries 6e248338b9 Remove duplicate definitions of ERROR_STRINGS/ERROR_STRINGS_ENABLED. 2026-04-17 20:43:08 +02:00
David Garske 2dd22e3500
Merge pull request #103 from roberthdevries/add-support-for-wcGetErrorString
Add support for wcGetErrorString() including error codes.
2026-04-17 09:37:15 -07:00
David Garske 8d00f5f19b
Merge pull request #91 from JeremiahM37/fenrir-fixes-2
Fenrir fixes
2026-04-16 15:40:07 -07:00
Robert de Vries ac7f6fd844 Fix conditional execution of test_error_string.
The pytest.mark.skipif does not prevent evaluation of parameters
on the next line.
2026-04-16 23:28:22 +02:00
Jeremiah Mackey 664e887f09 Fix hash copy semantics and add tests 2026-04-16 14:34:26 +00:00
Jeremiah Mackey 88bd75957d Add tests and fix build issues 2026-04-16 14:34:26 +00:00
Jeremiah Mackey cbdc388cc4 Fix low severity static analysis issues 2026-04-16 14:34:26 +00:00
Jeremiah Mackey c65ceaabd0 Fix resource leaks 2026-04-16 14:33:55 +00:00
Jeremiah Mackey c4a3c89df1 Fix error handling gaps 2026-04-16 14:33:55 +00:00
Jeremiah Mackey 3eafda78f6 Fix cipher logic and validation 2026-04-16 14:33:55 +00:00
David Garske 3a675bb91a
Merge pull request #104 from roberthdevries/remove-inherit-from-object
Remove parent class object everywhere.
2026-04-15 15:04:24 -07:00
David Garske 1ec10b3c0d
Merge pull request #102 from roberthdevries/fix-various-minor-issues-caught-by-ruff
Fix various minor issues caught by `ruff check` in default mode.
2026-04-15 15:00:53 -07:00
David Garske 0297859652
Merge pull request #90 from mjdemilliano/ml-dsa-sign-with-context
ML-DSA: Add optional context to signing and verification
2026-04-15 14:59:20 -07:00
David Garske e5242a8aa1
Merge pull request #89 from mjdemilliano/ml-dsa-generate-from-seed
ML-DSA: Support (re-)generating MlDsaPrivate from seed
2026-04-15 14:58:44 -07:00
Robert de Vries 81a80a4958 Created a function to retrieve error strings for an error code.
This should address all review comments.
2026-04-15 16:11:26 +02:00
Daniele Lacamera 1de8b0c6f4 Removed import after merge 2026-04-15 07:16:31 +02:00
Daniele Lacamera 90f21e1d13
Merge branch 'master' into ml-dsa-generate-from-seed 2026-04-15 06:56:56 +02:00
Daniele Lacamera 9ebe2fe266
Merge branch 'master' into ml-dsa-sign-with-context 2026-04-15 06:51:11 +02:00
Martijn de Milliano ac6eee4f84 Process Copilot comments
- Use constant from ciphers.py
- Raise ValueError or TypeError in sign_with_seed instead of assert
- Add missing test case
2026-04-15 06:48:36 +02:00
Martijn de Milliano e36859cb9c ML-DSA: Support deterministic signing 2026-04-15 06:48:36 +02:00
Robert de Vries 4813648e74 Add support for wcGetErrorString() including error codes.
It was already used, but not compiled in.
A unit test is added.

As wcGetErrorString() always returns a string the error handling
in class _Hmac  has been removed.
2026-04-12 22:10:36 +02:00
Robert de Vries e6c5afaaa9 Remove parent class object everywhere.
Since Python 3, all classes inherit from `object` by default, so `object` can
be omitted from the list of base classes.
2026-04-12 21:30:44 +02:00
Robert de Vries da0eb45df7 Fix various minor issues caught by `ruff check` in default mode.
Fixing these minor issues helps in adding more checks to fix-up
the code without being bothered by these issues.

Two minor issues are fixed:
- Mark unused variables with a leading underscore
- Use idiomatic boolean expressions
2026-04-11 18:38:09 +02:00
David Garske 6fbdf3d6d7
Merge pull request #99 from roberthdevries/fix-missing-format-argument
Fix missing format argument in exception message.
2026-04-10 10:06:24 -07:00
Martijn de Milliano 44efa4b465 Process Copilot comments
- Move+rename constant for seed length and use it in test_mldsa
- Replace assert by raising TypeError and ValueError in
  make_key_from_seed, and change type check to use memoryview.
2026-04-10 17:30:10 +02:00
Martijn de Milliano 2cf0b70768 Also fix error message for ML-DSA verify 2026-04-10 17:08:34 +02:00
Martijn de Milliano 168498471b Resolve comments by Copilot 2026-04-10 17:01:13 +02:00
David Garske ca83d63ed2
Merge pull request #98 from roberthdevries/remove-dead-code
Remove check for None in RsaPrivate.make_key().
2026-04-09 15:21:35 -07:00
David Garske cc7108f6c6
Merge pull request #97 from roberthdevries/clean-up-imports
Clean up import statements.
2026-04-09 15:21:25 -07:00
Robert de Vries 9fe81ec773 Fix missing format argument in exception message. 2026-04-09 20:26:42 +02:00
Robert de Vries f03380a644 Remove check for None in RsaPrivate.make_key().
The variable rsa is never None if it is successfully created.
Under all other circumstances an exception is raised which will skip the
execution of the remainder of this method.
2026-04-09 20:12:42 +02:00
Robert de Vries 2f630a4353 Clean up import statements.
* Remove unused imports.
* Move import statements together at the top of the file.
2026-04-09 20:02:01 +02:00
David Garske 4c1c578fbe
Merge pull request #92 from roberthdevries/add-support-for-random-with-nonce
Add support for nonce in random number generation.
2026-04-08 15:43:12 -07:00
David Garske 65e133ca9a
Merge pull request #94 from roberthdevries/remove-unneeded-semicolons
Remove unneeded semicolons.
2026-04-08 15:42:46 -07:00
David Garske f3ddd1a0bb
Merge pull request #95 from roberthdevries/fix-various-boolean-expressions
Fix various boolean expressions involving None among others.
2026-04-08 15:42:29 -07:00
David Garske ab15863d83
Merge pull request #96 from roberthdevries/add-missing-import
Add missing import of WolfCryptError.
2026-04-08 15:42:26 -07:00
Robert de Vries df6fa02e61 Add missing import of WolfCryptError. 2026-04-08 16:15:46 +02:00
Robert de Vries dc92410de9 Fix various boolean expressions involving None among others.
Includes also some other minor fixes in boolean expressions involving "in".
2026-04-08 16:10:07 +02:00
Robert de Vries 1f39cdf700 Remove unneeded semicolons.
Static checker "ruff" complains about these.
2026-04-08 15:56:06 +02:00
Robert de Vries 4564459a9e Prepare python interface for use of device_id callbacks. 2026-04-06 20:20:21 +02:00
Robert de Vries 01fcd2af6c Add support for nonce in random number generation. 2026-04-05 23:10:29 +02:00
Martijn de Milliano 1c034b20d8 ML-DSA: Support (re-)generating MlDsaPrivate from seed
As specified in FIPS 204, implementations can store the seed from
which the key can be deterministically generated.
2026-03-24 22:08:57 +01:00
Martijn de Milliano 9a10f58601 ML-DSA: Add optional context to signing and verification 2026-03-24 21:32:17 +01:00
David Garske 5b13e52d57
Merge pull request #87 from JeremiahM37/fenrir-fixes
Fix Fenrir findings in SHA3, RSA-PSS, FFI feature detection, and ChaCha
2026-03-19 11:17:20 -07:00
JeremiahM37 6e8c43bde4 Add nonce length validation to ChaCha.set_iv 2026-03-18 18:27:11 +00:00
JeremiahM37 3ca2548ec5 Move wc_RsaSSL_Sign/Verify declarations out of RSA_PSS block 2026-03-18 18:27:11 +00:00
JeremiahM37 48fe5aefe0 Fix re.search on list instead of string in FIPS version detection 2026-03-18 18:27:11 +00:00
JeremiahM37 6892321faf Fix CHACHA20_POLY1305 feature check ignoring HAVE_CHACHA 2026-03-18 18:27:11 +00:00