ocaml-ssl icon indicating copy to clipboard operation
ocaml-ssl copied to clipboard

Add a way to set context mode when creating context

Open craff opened this issue 2 years ago • 5 comments

create_context has distinct default mode for blocking and Runtime_lock.

Also add tests for Runtime_lock

craff avatar Jun 02 '23 11:06 craff

This addresses issue #122

craff avatar Jun 02 '23 11:06 craff

@anmonteiro This PR coould be extended with a set_mode function ?

craff avatar Jun 02 '23 11:06 craff

can you move the tests to a separate PR?

I don't know if this is what you asked in the other PR but I'd prefer:

* 1 PR for `modes` handling

* 1 PR with tests for `Runtime_lock`

done

craff avatar Jun 05 '23 00:06 craff

Antonio Nuno Monteiro writes:

@anmonteiro commented on this pull request.

@@ -77,6 +77,26 @@ type verify_error = | Error_v_keyusage_no_certsign | Error_v_application_verification

+module Modes = struct

we can probably make it non-allocating if it's just pattern matches to convert to int, no?

You allocate when you build the list of modes. And moreover, you need to convert the OCaml constant to the proper power of 2. I really think the proposed pattern for C <-> OCaml constant is better. I even usually use cpp to generate the ml file, making the pattern type safe by design.

-- Christophe Raffalli tél: +689 87 23 11 48 web: http://raffalli.eu

Ce mail est signé avec pgp (Pièce jointe signature.asc, clef sur https://raffalli.eu/pgp) This mail is signed with pgp (Attachment signature.asc, key on https://raffalli.eu/pgp)

craff avatar Jun 05 '23 00:06 craff

I have investigate async mode more. It seems that openssl can do async computation even when the user does not require async_job manually, if async mode is enabled (the doc is not really clear).

craff avatar Jun 05 '23 00:06 craff