You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When parsing/creating encryption keys there is a variable amount of parameters needed depending on the selected scheme (rsa, rsapps, etc). Node implements the argument parsing by reading directly from the passed arguments from JS, this is also necessary because some data needs to be read/passed/transformed by OpenSSL (BIOPointers and some EVP functions) before actually generating/reading the key.
This is however problematic when using the JSI, because we need to pass the runtime to the threaded implementation. Accessing the runtime from a std::thread can cause crashes. The solution is clear, we need to read all the arguments before doing threaded work. This however is a big big big change, since the number of arguments and their types will change depending on the scheme, we basically need to duplicate/de-attach a lot of the logic and then re-apply it as pure c++ values when doing the key parsing. Basically a from-the-ground up implementation.
One possible path is reading the data from JS without a thread and only doing the key generation step in a thread, here however not sure how much performance we would lose, but it wouldn't require a major re-write. This should be explored first.
I already faced some trouble with race conditions accessing data, I have changed the data parsed to occur before spawning the thread, this seems to work fine for now. But we still need to keep an eye open.
The text was updated successfully, but these errors were encountered:
When parsing/creating encryption keys there is a variable amount of parameters needed depending on the selected scheme (rsa, rsapps, etc). Node implements the argument parsing by reading directly from the passed arguments from JS, this is also necessary because some data needs to be read/passed/transformed by OpenSSL (BIOPointers and some EVP functions) before actually generating/reading the key.
This is however problematic when using the JSI, because we need to pass the runtime to the threaded implementation. Accessing the runtime from a std::thread can cause crashes. The solution is clear, we need to read all the arguments before doing threaded work. This however is a big big big change, since the number of arguments and their types will change depending on the scheme, we basically need to duplicate/de-attach a lot of the logic and then re-apply it as pure c++ values when doing the key parsing. Basically a from-the-ground up implementation.
One possible path is reading the data from JS without a thread and only doing the key generation step in a thread, here however not sure how much performance we would lose, but it wouldn't require a major re-write. This should be explored first.I already faced some trouble with race conditions accessing data, I have changed the data parsed to occur before spawning the thread, this seems to work fine for now. But we still need to keep an eye open.
The text was updated successfully, but these errors were encountered: