Hi! Yes that works perfectly. I've added the bounds checking.
Thanks and cheers!
Sincerely,
David
On Tuesday, August 23, 2022 at 3:51:39 AM UTC-4 progl...@gmail.com wrote:
> Assuming that `p.privateKey = *((*C.private_key)(key))` is making a full
> copy, not shallow. I think you could avoid
Assuming that `p.privateKey = *((*C.private_key)(key))` is making a full
copy, not shallow. I think you could avoid using `C.CBytes`.
You can get the address of the start of the backing array via [0] as
per https://pkg.go.dev/cmd/cgo
So maybe something like this:
p.privateKey =
I recently wrote cgo bindings to the CTIDH C library (a bleeding edge post
quantum non-interactive key exchange) copies the data twice. First in the
call to C.CBytes and then again in the assignment to p.privateKey via that
pointer dereference.
The performance hit for the twice copy is not