Skip to content

Commit

Permalink
[python] Pass bytes to cryptography.io's RSAPrivateKey.sign()
Browse files Browse the repository at this point in the history
In versions 42.0.0 and 42.0.1, cryptography.io accepted only bytes for
arguments in various methods like `RSAPrivateKey.sign()`. This bug was
fixed in v42.0.2, but let's fix Gramine to supply bytes instead of
bytearray, so that `Sigstruct.to_bytes()` doesn't fail on those affected
versions of cryptography.io.

Corresponding upstream commit in `pyca/cryptography` repository that
introduced the bug: 0000b402dd5edffa6a86ca560464e83a66fd91f5, and commit
that fixed this bug: 08b24d87a64734ac7f5c575b309ad7d49c246353

Signed-off-by: Wojtek Porczyk <woju@invisiblethingslab.com>
  • Loading branch information
woju authored and dimakuv committed Jan 26, 2024
1 parent 36676a7 commit 5286f20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python/graminelibos/sigstruct.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def to_bytes(self, verify=True, verify_sig_fields=False):
struct.pack_into(fmt, buffer, offset, int(f'{self[key]}', 16))
continue
struct.pack_into(fmt, buffer, offset, self[key])
return buffer
return bytes(buffer)


@classmethod
Expand Down

0 comments on commit 5286f20

Please sign in to comment.