Commit Graph

36 Commits (e1bdcab5ea3c5e428c45f4e5b59dc5a5ff1f02ff)

Author SHA1 Message Date
sebastian-carpenter a59a4f8b96 update license to GPLv3 2026-07-09 18:24:23 +02:00
Robert de Vries 1a2829a4cd Fixed a few type annotations and added bad type tests.
Also added one note to the ChangeLog.
2026-07-08 15:22:37 +02:00
Robert de Vries 47b0ac5af9 Fix ruff issues. 2026-07-06 22:13:48 +02:00
Robert de Vries 00c57b5e91 Rebased on master and fixed any (extra) issues found with ruff and ty. 2026-07-06 22:02:48 +02:00
Robert de Vries 1fb34e5cd8 Address review comments and annotate overrides. 2026-07-06 22:02:48 +02:00
Robert de Vries d1ac3d5f37 Add typing: asn, exceptions, hashes, hkdf, pwdbased, utils. 2026-07-06 22:02:46 +02:00
Juliusz Sosinowicz 2ecf721695 Reject unsafe HMAC copy() (F-5428)
_Hmac inherited _Hash.copy(), which - lacking a wolfCrypt copy function
for Hmac - fell back to a byte-level memmove and returned an object
marked _shallow_copy that aliases the original's internal C state. In
async or hardware-accelerated builds those internal pointers are shared,
so freeing the original leaves the copy with stale state
(use-after-free, wrong MACs, or corruption). wolfCrypt exposes no safe
public Hmac copy, so override copy() to raise NotImplementedError.
digest()/hexdigest() are unaffected. Update the shared hash tests to
expect this for HMAC.
2026-06-23 12:43:03 +00:00
Robert de Vries 18701e3b62 Use format specifiers instead of percent format.
printf-style string formatting has a number of quirks, and leads to less
readable code than using str.format calls or f-strings.
In general, prefer the newer str.format and f-strings constructs over
printf-style string formatting.
2026-05-17 16:14:52 +02:00
David Garske 4ec45a6511
Merge pull request #110 from roberthdevries/special-wc-api-retval-exceptions
Raise specialized WolfCryptApiError for failed API calls.
2026-05-08 15:59:50 -07:00
Robert de Vries 0ac207d34a Raise specialized WolfCryptApiError for failed API calls.
This exception takes the return value and converts that to
a human-readable string (if error string support is compiled in.)

The specialized exception is derived from WolfCryptError meaning
that existing users will not notice the difference except for the
nicer description.
2026-04-24 22:01:02 +02:00
Kareem f6c27bf55d Wrap _delete/_copy class attrs in staticmethod so self isn't bound as an extra arg.
Fixes #108.
2026-04-22 16:19:41 -07: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
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
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
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
JeremiahM37 f8f96983e2 Fix Sha3.copy() losing digest_size for non-384 variants 2026-03-18 18:27:11 +00:00
Hayden Roche 5c28f695e1 Improve the RSA PSS code.
- sign_pss and verify_pss need to digest the data before calling into their
respective wolfCrypt functions. Those wolfCrypt functions expect digests, not
plaintext.
- RsaPrivate make_key should take an optional hash_type parameter for the case
where the key will be used to create PSS signatures.
- test_rsa_pss_sign_verify appears to have been deliberately coded to have the
input plaintext length line up with the digest size, which masked the problem
where we weren't digesting the plaintext. I modified the plaintext so that this
is no longer the case.
2022-10-12 19:10:40 +02: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
Moisés Guimarães bf298548ab move files to wolfssl/wrappers/python 2016-05-15 15:23:21 -03:00
Moisés Guimarães f84d395d69 finished docs for v0.1.0 rc1 2016-05-03 00:01:18 -03:00
Moisés Guimarães 6f202cdfe3 updates docs with hashes and random 2016-05-02 22:37:10 -03:00
Moisés Guimarães b50afa900c adds ciphers docstrings 2016-05-01 12:11:58 -03:00
Moisés Guimarães 9af1f0d034 adds random and hashes docstrings. 2016-05-01 11:17:37 -03:00
Moisés Guimarães 2287ebad58 renames utils functions 2016-05-01 10:14:56 -03:00
Moisés Guimarães 7cab8863d6 adds error handling with Exceptions. 2016-05-01 09:13:57 -03:00
Moisés Guimarães 647f65c0cc fixes python3 issues 2016-04-30 23:14:51 -03:00
Moisés Guimarães 765a8f8aff removes constructor restrictions in hashes and ciphers 2016-04-29 17:50:36 -03:00
Moisés Guimarães 919cc67a9d fixes multiple ffi instances error 2016-04-24 20:49:07 -03:00
Moisés Guimarães 7e5efb125f adds tests; simplifies hashes and fixes ciphers to retain state. 2016-04-18 20:20:50 -03:00
Moisés Guimarães 6a78b4f41d fixes import * making some variables 'private' 2016-04-16 19:32:39 -03:00
Moisés Guimarães efa336be2b adds Hmac wrappers 2016-04-14 21:00:44 -03:00
Moisés Guimarães 949995c0cb implements Sha[1:256:384:512] wrappers; adds buiding scripts 2016-04-11 23:45:22 -03:00
Moisés Guimarães cd72991147 eliminates src folder 2016-04-11 21:34:20 -03:00