Skip to content

Commit

Permalink
policy: fix hardcoded size in description
Browse files Browse the repository at this point in the history
Fixes: tpm2-software#546

Signed-off-by: William Roberts <[email protected]>
  • Loading branch information
William Roberts committed Nov 6, 2023
1 parent 96a94c0 commit 7497038
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/tpm2_pytss/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,13 +570,16 @@ def get_calculated_json(self) -> bytes:

cjson = ffi.new("uint8_t[]", size[0])
_chkrc(lib.Tss2_PolicyGetCalculatedJSON(self._ctx, cjson, size))

return ffi.string(cjson, size[0])

@property
def description(self) -> bytes:
"""bytes: The policy description."""
size = ffi.new("size_t *", 8096)
desc = ffi.new("uint8_t[]", 8096)
size = ffi.new("size_t *")
_chkrc(lib.Tss2_PolicyGetDescription(self._ctx, ffi.NULL, size))

desc = ffi.new("uint8_t[]", size[0])
_chkrc(lib.Tss2_PolicyGetDescription(self._ctx, desc, size))
return ffi.string(desc, size[0])

Expand Down

0 comments on commit 7497038

Please sign in to comment.