Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove extra copy when creating public keys and signatures #17

Closed
James-E-A opened this issue Jan 30, 2024 · 2 comments
Closed

Remove extra copy when creating public keys and signatures #17

James-E-A opened this issue Jan 30, 2024 · 2 comments
Labels
enhancement New feature or request help wanted Extra attention is needed wontfix This will not be worked on

Comments

@James-E-A
Copy link
Owner

Should get rid of the non-lazy """casts""" from FFI-Owned Memory to Python Bytes Objects

Obviously this is a nearly irrelevant performance improvement, premature optimization yadda yadda, but it's still something that's clearly the wrong thing to do, so we should do the right thing at some point.

@James-E-A James-E-A added the enhancement New feature or request label Feb 14, 2024
@James-E-A
Copy link
Owner Author

Not gonna be so easy.

What I tried:

  • A function with signature PyObject* f(PyObject* m, PyObject* sk); apparently cannot be exposed by CFFI.
  • A function with signature PyObject* f(uint8_t* m, size_t mlen, uint8_t* sk) apparently does not allow actually "exfiltrating" the created object. Even ffi.from_handle(f(…)) raises TypeError: expected a 'cdata' object with a 'void *' out of new_handle(), got 'PyObject *'

I think if we want to construct the PyBytes object manually to avoid the extra copy, we'll have to ditch CFFI and just do things raw.

@James-E-A
Copy link
Owner Author

As much as I'd like to ditch CFFI due to its throwing a wrench in #1, that would be a lot of work I'm not up for.

I'm closing this as "I won't fix it right now", but I would be glad to re-open this if anyone wants to help.

@James-E-A James-E-A added help wanted Extra attention is needed wontfix This will not be worked on labels Feb 16, 2024
@James-E-A James-E-A closed this as not planned Won't fix, can't repro, duplicate, stale Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant