Skip to content

Commit

Permalink
crypto: mark binding as worker-enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian White committed Jun 15, 2022
1 parent 9cd7159 commit 24b497d
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions lib/protocol/crypto/src/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2221,37 +2221,45 @@ NAN_MODULE_INIT(init) {
#else
# define load_sym(name) dlsym(RTLD_DEFAULT, name)
#endif
ctx_iv_len = reinterpret_cast<ctx_iv_len_func>(
load_sym("EVP_CIPHER_CTX_get_iv_length")
);
if (!ctx_iv_len) {
ctx_iv_len = reinterpret_cast<ctx_iv_len_func>(
load_sym("EVP_CIPHER_CTX_iv_length")
load_sym("EVP_CIPHER_CTX_get_iv_length")
);
if (!ctx_iv_len) {
ctx_iv_len = reinterpret_cast<ctx_iv_len_func>(
load_sym("EVP_CIPHER_CTX_iv_length")
);
}
}
ctx_key_len = reinterpret_cast<ctx_key_len_func>(
load_sym("EVP_CIPHER_CTX_get_key_length")
);
if (!ctx_key_len) {
ctx_key_len = reinterpret_cast<ctx_key_len_func>(
load_sym("EVP_CIPHER_CTX_key_length")
load_sym("EVP_CIPHER_CTX_get_key_length")
);
if (!ctx_key_len) {
ctx_key_len = reinterpret_cast<ctx_key_len_func>(
load_sym("EVP_CIPHER_CTX_key_length")
);
}
}
cipher_flags = reinterpret_cast<cipher_flags_func>(
load_sym("EVP_CIPHER_get_flags")
);
if (!cipher_flags) {
cipher_flags = reinterpret_cast<cipher_flags_func>(
load_sym("EVP_CIPHER_flags")
load_sym("EVP_CIPHER_get_flags")
);
if (!cipher_flags) {
cipher_flags = reinterpret_cast<cipher_flags_func>(
load_sym("EVP_CIPHER_flags")
);
}
}
ctx_get_block_size = reinterpret_cast<ctx_get_block_size_func>(
load_sym("EVP_CIPHER_CTX_get_block_size")
);
if (!ctx_get_block_size) {
ctx_get_block_size = reinterpret_cast<ctx_get_block_size_func>(
load_sym("EVP_CIPHER_CTX_block_size")
load_sym("EVP_CIPHER_CTX_get_block_size")
);
if (!ctx_get_block_size) {
ctx_get_block_size = reinterpret_cast<ctx_get_block_size_func>(
load_sym("EVP_CIPHER_CTX_block_size")
);
}
}

ChaChaPolyCipher::Init(target);
Expand All @@ -2264,5 +2272,5 @@ NAN_MODULE_INIT(init) {
}

DISABLE_WCAST_FUNCTION_TYPE
NODE_MODULE(sshcrypto, init)
NAN_MODULE_WORKER_ENABLED(sshcrypto, init)
DISABLE_WCAST_FUNCTION_TYPE_END

0 comments on commit 24b497d

Please sign in to comment.