File 8653-crypto-mac-error-ERR-error-ERR-FileInfo-Description.patch of Package erlang
From 113da09d1994465b77cfc908238838bcf9edb4a9 Mon Sep 17 00:00:00 2001
From: Hans Nilsson <hans@erlang.org>
Date: Tue, 8 Mar 2022 16:42:58 +0100
Subject: [PATCH 3/8] crypto:mac*/*: error:ERR ->
error:{ERR,FileInfo,Description}
---
lib/crypto/doc/src/crypto.xml | 8 ++++++++
lib/crypto/src/crypto.erl | 10 +++++-----
2 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/lib/crypto/doc/src/crypto.xml b/lib/crypto/doc/src/crypto.xml
index d8d26fffb0..0b20d715df 100644
--- a/lib/crypto/doc/src/crypto.xml
+++ b/lib/crypto/doc/src/crypto.xml
@@ -851,6 +851,7 @@ end
<name name="mac" arity="3" since="OTP 22.1"/>
<fsummary></fsummary>
<desc>
+ <p>Uses the <seeerl marker="#error_3tup">3-tuple style</seeerl> for error handling.</p>
<p>Short for <seemfa marker="#mac/4">mac(Type, undefined, Key, Data)</seemfa>.
</p>
</desc>
@@ -860,6 +861,7 @@ end
<name name="mac" arity="4" since="OTP 22.1"/>
<fsummary></fsummary>
<desc>
+ <p>Uses the <seeerl marker="#error_3tup">3-tuple style</seeerl> for error handling.</p>
<p>Computes a MAC (Message Authentication Code) of type <c>Type</c> from <c>Data</c>.
</p>
@@ -901,6 +903,7 @@ end
<name name="macN" arity="4" since="OTP 22.1"/>
<fsummary></fsummary>
<desc>
+ <p>Uses the <seeerl marker="#error_3tup">3-tuple style</seeerl> for error handling.</p>
<p>Short for <seemfa marker="#macN/5">macN(Type, undefined, Key, Data, MacLength)</seemfa>.
</p>
</desc>
@@ -929,6 +932,7 @@ end
<name name="mac_init" arity="2" since="OTP 22.1"/>
<fsummary></fsummary>
<desc>
+ <p>Uses the <seeerl marker="#error_3tup">3-tuple style</seeerl> for error handling.</p>
<p>Short for <seemfa marker="#mac_init/3">mac_init(Type, undefined, Key)</seemfa>.
</p>
</desc>
@@ -938,6 +942,7 @@ end
<name name="mac_init" arity="3" since="OTP 22.1"/>
<fsummary></fsummary>
<desc>
+ <p>Uses the <seeerl marker="#error_3tup">3-tuple style</seeerl> for error handling.</p>
<p>Initializes the context for streaming MAC operations.
</p>
<p><c>Type</c> determines which mac algorithm to use in the MAC operation.
@@ -984,6 +989,7 @@ end
<name name="mac_update" arity="2" since="OTP 22.1"/>
<fsummary></fsummary>
<desc>
+ <p>Uses the <seeerl marker="#error_3tup">3-tuple style</seeerl> for error handling.</p>
<p>Updates the MAC represented by <c>State0</c> using the given <c>Data</c> which
could be of any length.
</p>
@@ -1000,6 +1006,7 @@ end
<name name="mac_final" arity="1" since="OTP 22.1"/>
<fsummary></fsummary>
<desc>
+ <p>Uses the <seeerl marker="#error_3tup">3-tuple style</seeerl> for error handling.</p>
<p>Finalizes the MAC operation referenced by <c>State</c>. The <c>Mac</c> result will have
a default length depending on the <c>Type</c> and <c>SubType</c> in the
<seemfa marker="#mac_init/3">mac_init/2,3</seemfa> call.
@@ -1015,6 +1022,7 @@ end
<name name="mac_finalN" arity="2" since="OTP 22.1"/>
<fsummary></fsummary>
<desc>
+ <p>Uses the <seeerl marker="#error_3tup">3-tuple style</seeerl> for error handling.</p>
<p>Finalizes the MAC operation referenced by <c>State</c>.
</p>
<p><c>Mac</c> will be a binary with at most <c>MacLength</c> bytes.
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index 3ecd0777d6..bfdc8b784c 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -665,7 +665,7 @@ mac(poly1305, Key, Data) -> mac(poly1305, undefined, Key, Data).
mac(Type, SubType, Key0, Data) ->
Key = iolist_to_binary(Key0),
- mac_nif(Type, alias(SubType,Key), Key, Data).
+ ?nif_call(mac_nif(Type, alias(SubType,Key), Key, Data)).
-spec macN(Type :: poly1305, Key, Data, MacLength) -> Mac
@@ -699,7 +699,7 @@ macN(Type, SubType, Key, Data, MacLength) ->
when Key :: iodata(),
State :: mac_state() .
mac_init(poly1305, Key) ->
- mac_init_nif(poly1305, undefined, Key).
+ ?nif_call(mac_init_nif(poly1305, undefined, Key)).
-spec mac_init(Type, SubType, Key) -> State
@@ -709,7 +709,7 @@ mac_init(poly1305, Key) ->
State :: mac_state() .
mac_init(Type, SubType, Key0) ->
Key = iolist_to_binary(Key0),
- mac_init_nif(Type, alias(SubType,Key), Key).
+ ?nif_call(mac_init_nif(Type, alias(SubType,Key), Key)).
-spec mac_update(State0, Data) -> State
@@ -717,7 +717,7 @@ mac_init(Type, SubType, Key0) ->
State0 :: mac_state(),
State :: mac_state().
mac_update(Ref, Data) ->
- mac_update_nif(Ref, Data).
+ ?nif_call(mac_update_nif(Ref, Data)).
@@ -725,7 +725,7 @@ mac_update(Ref, Data) ->
when State :: mac_state(),
Mac :: binary().
mac_final(Ref) ->
- mac_final_nif(Ref).
+ ?nif_call(mac_final_nif(Ref)).
-spec mac_finalN(State, MacLength) -> Mac
--
2.34.1