mirage / hacl

Archived. Curve25519 support has been integrated into mirage-crypto-ec (via fiat-crypto). Hacl bindings are available from the hacl-star opam package. OCaml bindings for HACL* elliptic curves
https://github.com/mirage/mirage-crypto
Other
20 stars 5 forks source link

Add key_exchange_inplace to avoid allocation #12

Closed dinosaure closed 4 years ago

dinosaure commented 5 years ago

See #11

avsm commented 5 years ago

Would it make sense to just have one function with an optional ?shared argument if no allocation is desired?

hannesm commented 5 years ago

as mentioned in #11, I'm rather sceptical this is a good idea. The potential error of shared not being big enough needs to be handled (in here, it is an invalid_arg -- which is slightly in contrast to design goals "no leaking exceptions"). what should the semantics of shared being too big be - should the remaining bytes be cleared out with 0, or remain as they are?

FWIW, if allocation is an issue due to bigarrays, I suggest to put this on hold for post-cstruct-5, which has this very nice interface with an abstract type t that allows us to implement cstruct in terms of strings/bytes (which should to my knowledge behave much smoother with the ocaml runtime system). to me, such an API with sharing mutable data structures in mind are worrying.