These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / staging / skein / skein_api.c
index 5bfce07..36f849f 100644 (file)
@@ -1,28 +1,27 @@
 /*
-Copyright (c) 2010 Werner Dittmann
-
-Permission is hereby granted, free of charge, to any person
-obtaining a copy of this software and associated documentation
-files (the "Software"), to deal in the Software without
-restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the
-Software is furnished to do so, subject to the following
-conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
-HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-OTHER DEALINGS IN THE SOFTWARE.
-
-*/
+ * Copyright (c) 2010 Werner Dittmann
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
 
 #include <linux/string.h>
 #include "skein_api.h"
@@ -51,7 +50,7 @@ int skein_init(struct skein_ctx *ctx, size_t hash_bit_len)
         * memory available.  The beauty of C :-) .
         */
        x = ctx->m.s256.x;
-       x_len = ctx->skein_size/8;
+       x_len = ctx->skein_size / 8;
        /*
         * If size is the same and hash bit length is zero then reuse
         * the save chaining variables.
@@ -92,7 +91,7 @@ int skein_mac_init(struct skein_ctx *ctx, const u8 *key, size_t key_len,
        skein_assert_ret(ctx, SKEIN_FAIL);
 
        x = ctx->m.s256.x;
-       x_len = ctx->skein_size/8;
+       x_len = ctx->skein_size / 8;
 
        skein_assert_ret(hash_bit_len, SKEIN_BAD_HASHLEN);
 
@@ -128,7 +127,7 @@ int skein_mac_init(struct skein_ctx *ctx, const u8 *key, size_t key_len,
 void skein_reset(struct skein_ctx *ctx)
 {
        size_t x_len = 0;
-       u64 *x = NULL;
+       u64 *x;
 
        /*
         * The following two lines rely of the fact that the real Skein
@@ -136,7 +135,7 @@ void skein_reset(struct skein_ctx *ctx)
         * memory available.  The beautiy of C :-) .
         */
        x = ctx->m.s256.x;
-       x_len = ctx->skein_size/8;
+       x_len = ctx->skein_size / 8;
        /* Restore the chaing variable, reset byte counter */
        memcpy(x, ctx->x_save, x_len);
 
@@ -213,7 +212,7 @@ int skein_update_bits(struct skein_ctx *ctx, const u8 *msg,
        /* partial byte bit mask */
        mask = (u8) (1u << (7 - (msg_bit_cnt & 7)));
        /* apply bit padding on final byte (in the buffer) */
-       up[length-1]  = (u8)((up[length-1] & (0-mask))|mask);
+       up[length - 1]  = (u8)((up[length - 1] & (0 - mask)) | mask);
 
        return SKEIN_SUCCESS;
 }