[issue47102] explore hashlib use of the Linux Kernel CryptoAPI

2022-03-29 Thread Christian Heimes
Change by Christian Heimes : -- pull_requests: +30253 pull_request: https://github.com/python/cpython/pull/32176 ___ Python tracker ___

[issue47102] explore hashlib use of the Linux Kernel CryptoAPI

2022-03-29 Thread Christian Heimes
Christian Heimes added the comment: I figured out how to implement copy(). dup() does not work as expected, but accept() on an AF_ALG client socket creates an independent copy. -- ___ Python tracker

[issue47102] explore hashlib use of the Linux Kernel CryptoAPI

2022-03-29 Thread Christian Heimes
Change by Christian Heimes : -- keywords: +patch pull_requests: +30251 stage: -> patch review pull_request: https://github.com/python/cpython/pull/32173 ___ Python tracker

[issue47102] explore hashlib use of the Linux Kernel CryptoAPI

2022-03-23 Thread Christian Heimes
Christian Heimes added the comment: And sendfile() is zero-copy. Data does not have to leave Kernel space. -- ___ Python tracker ___

[issue47102] explore hashlib use of the Linux Kernel CryptoAPI

2022-03-23 Thread Christian Heimes
Christian Heimes added the comment: test_socket has examples for HMAC, AES-CBC, and AES-GCM. with self.create_alg('hash', 'hmac(sha1)') as algo: algo.setsockopt(socket.SOL_ALG, socket.ALG_SET_KEY, b"Jefe") op, _ = algo.accept() with op: op.sendall(b"what do ya want for

[issue47102] explore hashlib use of the Linux Kernel CryptoAPI

2022-03-23 Thread Gregory P. Smith
Gregory P. Smith added the comment: Neat. I've never used the API, just filing a breadcrumb suggesting we see if it makes sense. Being I/O based, that even takes care of GIL releasing from Python. :) -- ___ Python tracker

[issue47102] explore hashlib use of the Linux Kernel CryptoAPI

2022-03-23 Thread Christian Heimes
Christian Heimes 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

[issue47102] explore hashlib use of the Linux Kernel CryptoAPI

2022-03-23 Thread Gregory P. Smith
New submission from Gregory P. Smith : Linux kernels provide a CryptoAPI. This is a common place for platform specific hardware accelerated hash algorithms to be exposed to the user (especially on SoCs which often have non-standard hardware).