Address more review comments.

pull/125/head
Robert de Vries 2026-07-06 22:27:34 +02:00
parent 47b0ac5af9
commit 397725336e
2 changed files with 8 additions and 1 deletions

View File

@ -60,7 +60,6 @@ setup(
packages=find_packages(),
setup_requires=["cffi>=1.17"],
install_requires=["cffi>=1.17"],
cffi_modules=["./scripts/build_ffi.py:ffibuilder"],
package_data={"wolfcrypt": ["*.dll", "**/*.pyi", "py.typed"]},

View File

@ -2092,6 +2092,14 @@ if _lib.ML_KEM_ENABLED:
:return: tuple of a shared secret (first element) and the cipher text (second element)
:rtype: tuple[bytes, bytes]
"""
try:
memoryview(rand)
except TypeError as exception:
raise TypeError("rand must support the buffer protocol, such as `bytes` or `bytearray`") from exception
rand = bytes(rand)
ct_size = self.ct_size
ss_size = self.ss_size
ct = _ffi.new(f"unsigned char[{ct_size}]")