h2o / picotls

TLS 1.3 implementation in C (master supports RFC8446 as well as draft-26, -27, -28)
540 stars 143 forks source link

[async signing] support cancellation #423

Closed kazuho closed 2 years ago

kazuho commented 2 years ago

Under the new design, picotls supplies jobs and weak references to ptls_t associated to each job. It is up to the user to run those jobs. Once the job is complete, the user calls ptls_handshake if the weak reference is still valid. Otherwise, resources are reclaimed automatically.

The upside of the design is that the API (ptls_openssl_async_runner_t) is agnostic of the type of the job. At the moment only RSA signature generation is offloaded, but we have the opportunity to offload other stuff without changing the API.

The downside is that each user has to implement their own job handling code (e.g., call ASYNC_start_job). Though, it might be possible to argue that the design is simpler and easier to understand because picotls does not abstract how OpenSSL runs async jobs.

For more information, please refer to the definition of ptls_openssl_async_runner_t (found here) as well the async code is t/openssl.c.