File 0911-Improve-crypto-docs-around-AAD.patch of Package erlang
From bc16d8a973c11c0b6473ff634e1e2af8916660df Mon Sep 17 00:00:00 2001
From: Andrea Leopardi <an.leopardi@gmail.com>
Date: Thu, 16 Nov 2023 12:37:26 +0100
Subject: [PATCH 1/2] Improve crypto docs around "AAD"
---
lib/crypto/doc/src/crypto.xml | 2 ++
lib/crypto/doc/src/new_api.xml | 4 ++--
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml
index d97d02163b..bd393eedbc 100644
--- a/lib/crypto/doc/src/crypto.xml
+++ b/lib/crypto/doc/src/crypto.xml
@@ -835,6 +835,8 @@ end
<p>For decryption, set the <c>EncryptFlag</c> to <c>false</c> and put the tag to be checked
in the argument <c>TagOrTagLength</c>.
</p>
+ <p>The <c>AAD</c> argument represents the Additional Authentication Data. It's optional. If it's
+ not needed, it can be set to an empty binary (<c><<>></c>).
<p>See <seeguide marker="crypto:new_api#example-of-crypto_one_time_aead-6">examples in the User's Guide.</seeguide>
</p>
</desc>
diff --git a/lib/crypto/doc/src/new_api.xml b/lib/crypto/doc/src/new_api.xml
index 49946dff00..37bf6a9121 100644
--- a/lib/crypto/doc/src/new_api.xml
+++ b/lib/crypto/doc/src/new_api.xml
@@ -257,8 +257,8 @@
<<0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0>>
3> Txt = [<<"First bytes">>,<<"Second bytes">>].
[<<"First bytes">>,<<"Second bytes">>]
- 4> AAD = <<"Some bytes">>.
- <<"Some bytes">>
+ 4> AAD = <<"Some additional auth data">>.
+ <<"Some additional auth data">>
5> crypto:crypto_one_time_aead(aes_128_gcm, Key, IV, Txt, AAD, true).
{<<240,130,38,96,130,241,189,52,3,190,179,213,132,1,72,
192,103,176,90,104,15,71,158>>,
--
2.35.3