Skip to content

Commit

Permalink
otpbp_crypto: add start/0, stop/0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ledest committed Jul 2, 2024
1 parent 51ffcde commit 3777888
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions rebar.config.script
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ Funs = [{application, get_supervisor, 1},
{crypto, sha384_mac, 3},
{crypto, sha512_mac, 2},
{crypto, sha512_mac, 3},
{crypto, start, 0},
{crypto, stop, 0},
{crypto, stream_init, 2},
{crypto, stream_init, 3},
{crypto, stream_decrypt, 2},
Expand Down
15 changes: 15 additions & 0 deletions src/otpbp_crypto.erl
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@
-export([hash_equals/2]).
-endif.

-ifndef(HAVE_crypto__start_0).
-export([start/0]).
-endif.
-ifndef(HAVE_crypto__stop_0).
-export([stop/0]).
-endif.

-ifndef(HAVE_crypto__mac_3).
-ifdef(HAVE_crypto__mac_4).
-import(crypto, [mac/4]).
Expand Down Expand Up @@ -791,6 +798,14 @@ stream_encrypt({_Cipher, Ref} = State, Data) ->
end.
-endif.

-ifndef(HAVE_crypto__start_0).
start() -> application:start(crypto).
-endif.

-ifndef(HAVE_crypto__stop_0).
stop() -> application:stop(crypto).
-endif.

-ifdef(NEED_ALIAS_2).
alias(aes_cbc128, _) -> aes_128_cbc;
alias(aes_cbc256, _) -> aes_256_cbc;
Expand Down
1 change: 1 addition & 0 deletions src/otpbp_pt.erl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
{{code, replace_path, 3}, otpbp_code},
{{code, is_module_native, 1}, otpbp_code},
{{compile, iofile, 1}, otpbp_compile},
{{crypto, [start, stop], 0}, otpbp_crypto},
{{crypto, [block_encrypt, block_decrypt], [3, 4]}, otpbp_crypto},
{{crypto, [cipher_info, hash_info], 1}, otpbp_crypto},
{{crypto, crypto_one_time, [4, 5]}, otpbp_crypto},
Expand Down

0 comments on commit 3777888

Please sign in to comment.