Commit f12e4ed8 authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu

crypto: doc - fix documentation for bulk registration functions

Update the documentation for crypto_register_algs() and
crypto_unregister_algs() to match the actual behavior.
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent d89a6713
...@@ -797,7 +797,8 @@ kernel crypto API | Caller ...@@ -797,7 +797,8 @@ kernel crypto API | Caller
include/linux/crypto.h and their definition can be seen below. include/linux/crypto.h and their definition can be seen below.
The former function registers a single transformation, while The former function registers a single transformation, while
the latter works on an array of transformation descriptions. the latter works on an array of transformation descriptions.
The latter is useful when registering transformations in bulk. The latter is useful when registering transformations in bulk,
for example when a driver implements multiple transformations.
</para> </para>
<programlisting> <programlisting>
...@@ -822,18 +823,31 @@ kernel crypto API | Caller ...@@ -822,18 +823,31 @@ kernel crypto API | Caller
</para> </para>
<para> <para>
The bulk registration / unregistration functions require The bulk registration/unregistration functions
that struct crypto_alg is an array of count size. These register/unregister each transformation in the given array of
functions simply loop over that array and register / length count. They handle errors as follows:
unregister each individual algorithm. If an error occurs,
the loop is terminated at the offending algorithm definition.
That means, the algorithms prior to the offending algorithm
are successfully registered. Note, the caller has no way of
knowing which cipher implementations have successfully
registered. If this is important to know, the caller should
loop through the different implementations using the single
instance *_alg functions for each individual implementation.
</para> </para>
<itemizedlist>
<listitem>
<para>
crypto_register_algs() succeeds if and only if it
successfully registers all the given transformations. If an
error occurs partway through, then it rolls back successful
registrations before returning the error code. Note that if
a driver needs to handle registration errors for individual
transformations, then it will need to use the non-bulk
function crypto_register_alg() instead.
</para>
</listitem>
<listitem>
<para>
crypto_unregister_algs() tries to unregister all the given
transformations, continuing on error. It logs errors and
always returns zero.
</para>
</listitem>
</itemizedlist>
</sect1> </sect1>
<sect1><title>Single-Block Symmetric Ciphers [CIPHER]</title> <sect1><title>Single-Block Symmetric Ciphers [CIPHER]</title>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment