From e456f4ea9be7572ff4b6248d7b7646db7f7957e6 Mon Sep 17 00:00:00 2001 From: Jesper Louis Andersen Date: Wed, 17 Dec 2014 15:50:02 +0100 Subject: [PATCH] Introduce blocking variants. --- c_src/enacl_nif.c | 6 ++++-- src/enacl_nif.erl | 4 ++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/c_src/enacl_nif.c b/c_src/enacl_nif.c index d81027d..92c0af4 100644 --- a/c_src/enacl_nif.c +++ b/c_src/enacl_nif.c @@ -759,8 +759,10 @@ static ErlNifFunc nif_funcs[] = { {"crypto_box_open_b", 4, enif_crypto_box_open}, {"crypto_box_open", 4, enif_crypto_box_open, ERL_NIF_DIRTY_JOB_CPU_BOUND}, {"crypto_box_beforenm", 2, enif_crypto_box_beforenm}, - {"crypto_box_afternm", 3, enif_crypto_box_afternm}, - {"crypto_box_open_afternm", 3, enif_crypto_box_open_afternm}, + {"crypto_box_afternm_b", 3, enif_crypto_box_afternm}, + {"crypto_box_afternm", 3, enif_crypto_box_afternm, ERL_NIF_DIRTY_JOB_CPU_BOUND}, + {"crypto_box_open_afternm_b", 3, enif_crypto_box_open_afternm}, + {"crypto_box_open_afternm", 3, enif_crypto_box_open_afternm, ERL_NIF_DIRTY_JOB_CPU_BOUND}, {"crypto_sign_PUBLICKEYBYTES", 0, enif_crypto_sign_PUBLICKEYBYTES}, {"crypto_sign_SECRETKEYBYTES", 0, enif_crypto_sign_SECRETKEYBYTES}, diff --git a/src/enacl_nif.erl b/src/enacl_nif.erl index 8cd69a4..06f8a0a 100644 --- a/src/enacl_nif.erl +++ b/src/enacl_nif.erl @@ -20,7 +20,9 @@ crypto_box_beforenm/2, crypto_box_afternm/3, + crypto_box_afternm_b/3, crypto_box_open_afternm/3, + crypto_box_open_afternm_b/3, crypto_sign_PUBLICKEYBYTES/0, crypto_sign_SECRETKEYBYTES/0, @@ -115,7 +117,9 @@ crypto_box_open_b(_CipherText, _Nonce, _PK, _SK) -> erlang:nif_error(nif_not_loa crypto_box_beforenm(_PK, _SK) -> erlang:nif_error(nif_not_loaded). crypto_box_afternm(_M, _Nonce, _K) -> erlang:nif_error(nif_not_loaded). +crypto_box_afternm_b(_M, _Nonce, _K) -> erlang:nif_error(nif_not_loaded). crypto_box_open_afternm(_CipherText, _Nonce, _K) -> erlang:nif_error(nif_not_loaded). +crypto_box_open_afternm_b(_CipherText, _Nonce, _K) -> erlang:nif_error(nif_not_loaded). crypto_sign_PUBLICKEYBYTES() -> erlang:nif_error(nif_not_loaded). crypto_sign_SECRETKEYBYTES() -> erlang:nif_error(nif_not_loaded).