aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto
diff options
context:
space:
mode:
authorHans Nilsson <[email protected]>2019-04-09 12:16:28 +0200
committerHans Nilsson <[email protected]>2019-04-11 13:02:30 +0200
commitbd8abd7b5cfb55bcc7becc2bf2344ec5f9a0185f (patch)
treea334d9ed7777105aff47ece0c7470190a258ea5f /lib/crypto
parentdc4c62ca5220cfc8def7ec5275036c7fb7dc370d (diff)
downloadotp-bd8abd7b5cfb55bcc7becc2bf2344ec5f9a0185f.tar.gz
otp-bd8abd7b5cfb55bcc7becc2bf2344ec5f9a0185f.tar.bz2
otp-bd8abd7b5cfb55bcc7becc2bf2344ec5f9a0185f.zip
crypto: Rename 'crypto_(init|update)_dyn_iv' to 'crypto_dyn_iv_(init|update)'
Diffstat (limited to 'lib/crypto')
-rw-r--r--lib/crypto/doc/src/crypto.xml8
-rw-r--r--lib/crypto/doc/src/new_api.xml4
-rw-r--r--lib/crypto/src/crypto.erl12
-rw-r--r--lib/crypto/test/crypto_SUITE.erl12
4 files changed, 18 insertions, 18 deletions
diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml
index d607679ff5..641738247e 100644
--- a/lib/crypto/doc/src/crypto.xml
+++ b/lib/crypto/doc/src/crypto.xml
@@ -702,13 +702,13 @@
</func>
<func>
- <name name="crypto_init_dyn_iv" arity="3" since="OTP 22.0"/>
+ <name name="crypto_dyn_iv_init" arity="3" since="OTP 22.0"/>
<fsummary>Initializes a series of encryptions or decryptions where the IV is provided later</fsummary>
<desc>
<p>Part of the <seealso marker="crypto:new_api#the-new-api">new API</seealso>.
Initializes a series of encryptions or decryptions where the IV is provided later.
The actual encryption or decryption is done by
- <seealso marker="crypto#crypto_update_dyn_iv/3">crypto_update_dyn_iv/3</seealso>.
+ <seealso marker="crypto#crypto_dyn_iv_update/3">crypto_dyn_iv_update/3</seealso>.
</p>
<p>For encryption, set the <c>EncryptFlag</c> to <c>true</c>. For decryption, set it to <c>false</c>.
</p>
@@ -718,13 +718,13 @@
</func>
<func>
- <name name="crypto_update_dyn_iv" arity="3" since="OTP 22.0"/>
+ <name name="crypto_dyn_iv_update" arity="3" since="OTP 22.0"/>
<fsummary>Do an actual crypto operation on a part of the full text and the IV is supplied for each part</fsummary>
<desc>
<p>Part of the <seealso marker="crypto:new_api#the-new-api">new API</seealso>.
Do an actual crypto operation on a part of the full text and the IV is supplied for each part.
The <c>State</c> should be created with
- <seealso marker="crypto#crypto_init_dyn_iv/3">crypto_init_dyn_iv/3</seealso>.
+ <seealso marker="crypto#crypto_dyn_iv_init/3">crypto_dyn_iv_init/3</seealso>.
</p>
<p>See <seealso marker="crypto:new_api#the-new-api">examples in the User's Guide.</seealso>
</p>
diff --git a/lib/crypto/doc/src/new_api.xml b/lib/crypto/doc/src/new_api.xml
index 7b062310f2..79096b55e8 100644
--- a/lib/crypto/doc/src/new_api.xml
+++ b/lib/crypto/doc/src/new_api.xml
@@ -99,8 +99,8 @@
for each part, the functions are:
</p>
<list>
- <item><seealso marker="crypto#crypto_init_dyn_iv/3">crypto_init_dyn_iv/3</seealso></item>
- <item><seealso marker="crypto#crypto_update_dyn_iv/3">crypto_update_dyn_iv/3</seealso></item>
+ <item><seealso marker="crypto#crypto_dyn_iv_init/3">crypto_dyn_iv_init/3</seealso></item>
+ <item><seealso marker="crypto#crypto_dyn_iv_update/3">crypto_dyn_iv_update/3</seealso></item>
</list>
<p>An example of where those functions are needed, is when handling the TLS protocol.</p>
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index 133636c0af..3b431cceba 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -60,8 +60,8 @@
crypto_update/2,
crypto_one_time/4, crypto_one_time/5,
crypto_one_time_aead/6, crypto_one_time_aead/7,
- crypto_init_dyn_iv/3,
- crypto_update_dyn_iv/3
+ crypto_dyn_iv_init/3,
+ crypto_dyn_iv_update/3
]).
@@ -901,12 +901,12 @@ crypto_init(Cipher, Key, IV, EncryptFlag) ->
%%%----------------------------------------------------------------
--spec crypto_init_dyn_iv(Cipher, Key, EncryptFlag) -> State | descriptive_error()
+-spec crypto_dyn_iv_init(Cipher, Key, EncryptFlag) -> State | descriptive_error()
when Cipher :: cipher_iv(),
Key :: iodata(),
EncryptFlag :: boolean(),
State :: crypto_state() .
-crypto_init_dyn_iv(Cipher, Key, EncryptFlag) ->
+crypto_dyn_iv_init(Cipher, Key, EncryptFlag) ->
%% The IV is supposed to be supplied by calling crypto_update/3
ng_crypto_init_nif(Cipher, iolist_to_binary(Key), undefined, EncryptFlag).
@@ -931,12 +931,12 @@ crypto_update(State, Data0) ->
%%%----------------------------------------------------------------
--spec crypto_update_dyn_iv(State, Data, IV) -> Result | descriptive_error()
+-spec crypto_dyn_iv_update(State, Data, IV) -> Result | descriptive_error()
when State :: crypto_state(),
Data :: iodata(),
IV :: iodata(),
Result :: binary() .
-crypto_update_dyn_iv(State, Data0, IV) ->
+crypto_dyn_iv_update(State, Data0, IV) ->
%% When State is from State = crypto_init(Cipher, Key, undefined, EncryptFlag)
case iolist_to_binary(Data0) of
<<>> ->
diff --git a/lib/crypto/test/crypto_SUITE.erl b/lib/crypto/test/crypto_SUITE.erl
index b7d6d0805f..880fd7ab0b 100644
--- a/lib/crypto/test/crypto_SUITE.erl
+++ b/lib/crypto/test/crypto_SUITE.erl
@@ -621,15 +621,15 @@ do_api_ng_tls({Type, Key, IV, PlainTexts}=_X) ->
do_api_ng_tls({Type, Key, IV, PlainText0, ExpectedEncText}=_X) ->
ct:log("~p",[_X]),
PlainText = iolist_to_binary(lazy_eval(PlainText0)),
- Renc = crypto:crypto_init_dyn_iv(Type, Key, true),
- Rdec = crypto:crypto_init_dyn_iv(Type, Key, false),
- EncTxt = crypto:crypto_update_dyn_iv(Renc, PlainText, IV),
+ Renc = crypto:crypto_dyn_iv_init(Type, Key, true),
+ Rdec = crypto:crypto_dyn_iv_init(Type, Key, false),
+ EncTxt = crypto:crypto_dyn_iv_update(Renc, PlainText, IV),
case ExpectedEncText of
undefined ->
ok;
EncTxt ->
%% Now check that the state is NOT updated:
- case crypto:crypto_update_dyn_iv(Renc, PlainText, IV) of
+ case crypto:crypto_dyn_iv_update(Renc, PlainText, IV) of
EncTxt ->
ok;
EncTxt2 ->
@@ -640,10 +640,10 @@ do_api_ng_tls({Type, Key, IV, PlainText0, ExpectedEncText}=_X) ->
ct:log("1st encode~nIn: ~p~nExpected: ~p~nEnc: ~p~n", [{Type,Key,IV,PlainText}, ExpectedEncText, OtherEnc]),
ct:fail("api_ng_tls (encode)",[])
end,
- case crypto:crypto_update_dyn_iv(Rdec, EncTxt, IV) of
+ case crypto:crypto_dyn_iv_update(Rdec, EncTxt, IV) of
PlainText ->
%% Now check that the state is NOT updated:
- case crypto:crypto_update_dyn_iv(Rdec, EncTxt, IV) of
+ case crypto:crypto_dyn_iv_update(Rdec, EncTxt, IV) of
PlainText ->
ok;
PlainText2 ->