haskell-cryptography / botan

Haskell bindings for the Botan cryptography library
BSD 3-Clause "New" or "Revised" License
34 stars 6 forks source link

Improve cipherUpdate #8

Closed arybczak closed 1 year ago

arybczak commented 1 year ago

1) Don't use unsafe import for functions which pass control to C for unbounded amount of time since then a Haskell thread that runs them can't be preempted. In fact, it might be best to import everything as safe and change some functions to unsafe later as an optimization pass (if it's even needed).

2) Don't make a copy of the input text - when performing operations on large ByteStringS, duplicating the memory used by them is not desirable. This also applies to other relevant functions that use asBytesLen where unsafeAsBytesLen is sufficient. ByteStringS are pinned, so doing this is fine.

arybczak commented 1 year ago

ping

ldillinger commented 1 year ago

Pong! I've been a little too focused on the X509 stuff lately. This will be included in the next update; I left off doing it immediately because there is also this PR to consider but that PR has breaking changes and more, whereas I can pull this in now. I realized this, and do not want to be a blocker.