[issue47102] explore hashlib use of the Linux Kernel CryptoAPI
Christian Heimes
report at bugs.python.org
Wed Mar 23 15:45:38 EDT 2022
Christian Heimes <lists at cheimes.de> added the comment:
We don't need libkcapi. I added AF_ALG support a while ago:
import binascii
import os
import socket
with socket.socket(socket.AF_ALG, socket.SOCK_SEQPACKET, 0) as cfgsock:
cfgsock.bind(("hash", "sha256"))
opsock, _ = cfgsock.accept()
with opsock:
with open("/etc/os-release") as f:
st = os.fstat(f.fileno())
# blindly assumes that sendfile() exhausts the fd.
os.sendfile(
opsock.fileno(), f.fileno(), offset=0, count=st.st_size
)
res = opsock.recv(512)
print(binascii.hexlify(res))
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue47102>
_______________________________________
More information about the Python-bugs-list
mailing list