Re: [PATCH v5 3/7] staging: skein: Adds CryptoAPI Support

From: Jason Cooper
Date: Fri Oct 24 2014 - 10:35:15 EST


Eric,

We're almost there... :)

On Fri, Oct 24, 2014 at 06:55:33AM -0500, Eric Rost wrote:
> Adds CryptoAPI support to the Skein Hashing Algorithm driver.
>
> Signed-off-by: Eric Rost <eric.rost@xxxxxxxxxxxxx>
> ---
> drivers/staging/skein/Makefile | 3 +-
> drivers/staging/skein/skein_generic.c | 191 ++++++++++++++++++++++++++++++++++
> 2 files changed, 193 insertions(+), 1 deletion(-)
> create mode 100644 drivers/staging/skein/skein_generic.c
>
> diff --git a/drivers/staging/skein/Makefile b/drivers/staging/skein/Makefile
> index ca746a9..d8177cc 100644
> --- a/drivers/staging/skein/Makefile
> +++ b/drivers/staging/skein/Makefile
> @@ -5,4 +5,5 @@ obj-$(CONFIG_CRYPTO_SKEIN) += skein_base.o \
> skein_api.o \
> skein_block.o \
> threefish_block.o \
> - threefish_api.o
> + threefish_api.o \
> + skein_generic.o
> diff --git a/drivers/staging/skein/skein_generic.c b/drivers/staging/skein/skein_generic.c
> new file mode 100644
> index 0000000..39332e8
> --- /dev/null
> +++ b/drivers/staging/skein/skein_generic.c
...
> +static int __init skein_generic_init(void)
> +{
> + if (crypto_register_shash(&alg256) || crypto_register_shash(&alg512)
> + || crypto_register_shash(&alg1024)) {
> + crypto_unregister_shash(&alg256);
> + crypto_unregister_shash(&alg512);
> + crypto_unregister_shash(&alg1024);
> + return -1;
> + }
> + return 0;
> +}

This really needs to be something like:

if (crypto_register_shash(&alg256))
goto bail;
if (crypto_register_shash(&alg512))
goto unreg256;
if (crypto_register_shash(&alg1024))
goto unreg512;

return 0;

unreg512:
crypto_unregister_shash(&alg512);
unreg256:
crypto_unregister_shash(&alg256);
bail:
return -1;

thx,

Jason.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/