Skip to content

Commit ce6a4ef

Browse files
committed
Merge branch 'maint'
2 parents 0022ee3 + 61e4a22 commit ce6a4ef

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

lib/crypto/src/crypto.erl

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1742,7 +1742,14 @@ crypto_one_time(Cipher, Key, IV, Data, FlagOrOptions) ->
17421742
{}).
17431743

17441744
%%%----------------------------------------------------------------
1745-
-doc(#{equiv => crypto_one_time_aead/7}).
1745+
-doc """
1746+
Do a complete encrypt with an AEAD cipher of the full text
1747+
with the default tag length.
1748+
1749+
Equivalent to
1750+
`crypto_one_time_aead(Cipher, Key, IV, InText, AAD, TagLength, true)`
1751+
where `TagLength` is the default tag length for the given `Cipher`.
1752+
""".
17461753
-doc(#{group => <<"Cipher API">>,
17471754
since => <<"OTP 22.0">>}).
17481755
-spec crypto_one_time_aead(Cipher, Key, IV, InText, AAD, EncFlag::true) ->
@@ -1772,6 +1779,13 @@ length is wanted, the `crypto_one_time_aead/6` form may be used.
17721779
For decryption, set the `EncryptFlag` to `false` and put the tag to be checked
17731780
in the argument `TagOrTagLength`.
17741781

1782+
> #### Warning {: .warning }
1783+
>
1784+
> The length of the tag at decryption is not checked by the function. It is the
1785+
> caller's responsibility to ensure that the length of the tag matches the
1786+
> length of the tag used when the data was encrypted. Otherwise the decryption
1787+
> may succeed if the given tag only matches the start of the proper tag.
1788+
17751789
Additional Authentication Data (AAD) is plaintext data that will not be
17761790
encrypted, but will be covered by authenticity protection. It should be provided
17771791
through the `AAD` argument, but can be an empty binary as well (`<<>>`) if not

0 commit comments

Comments
 (0)