diff options
author | George Melikov <[email protected]> | 2017-01-21 00:17:55 +0300 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2017-01-22 13:25:40 -0800 |
commit | 4ea3f86426f76e59244ec6f66504da688d90193c (patch) | |
tree | ff907fb2ce89e00b8b89a0a653c9b4e7005f6935 /module/icp | |
parent | ec441a9c534815b379468a2d349011cbd5bcd884 (diff) |
codebase style improvements for OpenZFS 6459 port
Diffstat (limited to 'module/icp')
-rw-r--r-- | module/icp/algs/aes/aes_impl.c | 6 | ||||
-rw-r--r-- | module/icp/algs/modes/ctr.c | 2 | ||||
-rw-r--r-- | module/icp/algs/skein/skein_block.c | 37 | ||||
-rw-r--r-- | module/icp/asm-x86_64/aes/aeskey.c | 4 | ||||
-rw-r--r-- | module/icp/io/aes.c | 6 | ||||
-rw-r--r-- | module/icp/io/edonr_mod.c | 3 | ||||
-rw-r--r-- | module/icp/io/skein_mod.c | 3 |
7 files changed, 32 insertions, 29 deletions
diff --git a/module/icp/algs/aes/aes_impl.c b/module/icp/algs/aes/aes_impl.c index a68a02cdf..8592386dd 100644 --- a/module/icp/algs/aes/aes_impl.c +++ b/module/icp/algs/aes/aes_impl.c @@ -988,7 +988,8 @@ aes_setupkeys(aes_key_t *key, const uint32_t *keyarr32, int keybits) */ static void rijndael_encrypt(const uint32_t rk[], int Nr, const uint32_t pt[4], - uint32_t ct[4], int flags) { + uint32_t ct[4], int flags) +{ if (flags & INTEL_AES_NI_CAPABLE) { KPREEMPT_DISABLE; aes_encrypt_intel(rk, Nr, pt, ct); @@ -1015,7 +1016,8 @@ rijndael_encrypt(const uint32_t rk[], int Nr, const uint32_t pt[4], */ static void rijndael_decrypt(const uint32_t rk[], int Nr, const uint32_t ct[4], - uint32_t pt[4], int flags) { + uint32_t pt[4], int flags) +{ if (flags & INTEL_AES_NI_CAPABLE) { KPREEMPT_DISABLE; aes_decrypt_intel(rk, Nr, ct, pt); diff --git a/module/icp/algs/modes/ctr.c b/module/icp/algs/modes/ctr.c index 77ba28ddd..e3b0e1238 100644 --- a/module/icp/algs/modes/ctr.c +++ b/module/icp/algs/modes/ctr.c @@ -198,7 +198,7 @@ ctr_mode_final(ctr_ctx_t *ctx, crypto_data_t *out, int ctr_init_ctx(ctr_ctx_t *ctr_ctx, ulong_t count, uint8_t *cb, -void (*copy_block)(uint8_t *, uint8_t *)) + void (*copy_block)(uint8_t *, uint8_t *)) { uint64_t upper_mask = 0; uint64_t lower_mask = 0; diff --git a/module/icp/algs/skein/skein_block.c b/module/icp/algs/skein/skein_block.c index d2e811963..6d85cb7d9 100644 --- a/module/icp/algs/skein/skein_block.c +++ b/module/icp/algs/skein/skein_block.c @@ -57,11 +57,10 @@ /* Skein_256 */ #if !(SKEIN_USE_ASM & 256) - void Skein_256_Process_Block(Skein_256_Ctxt_t *ctx, const uint8_t *blkPtr, size_t blkCnt, size_t byteCntAdd) -{ /* do it in C */ +{ enum { WCNT = SKEIN_256_STATE_WORDS }; @@ -132,24 +131,24 @@ Skein_256_Process_Block(Skein_256_Ctxt_t *ctx, const uint8_t *blkPtr, /* run the rounds */ #define Round256(p0, p1, p2, p3, ROT, rNum) \ - X##p0 += X##p1; X##p1 = RotL_64(X##p1, ROT##_0); X##p1 ^= X##p0; \ - X##p2 += X##p3; X##p3 = RotL_64(X##p3, ROT##_1); X##p3 ^= X##p2; \ + X##p0 += X##p1; X##p1 = RotL_64(X##p1, ROT##_0); X##p1 ^= X##p0; \ + X##p2 += X##p3; X##p3 = RotL_64(X##p3, ROT##_1); X##p3 ^= X##p2; \ #if SKEIN_UNROLL_256 == 0 #define R256(p0, p1, p2, p3, ROT, rNum) /* fully unrolled */ \ - Round256(p0, p1, p2, p3, ROT, rNum) \ - Skein_Show_R_Ptr(BLK_BITS, &ctx->h, rNum, Xptr); + Round256(p0, p1, p2, p3, ROT, rNum) \ + Skein_Show_R_Ptr(BLK_BITS, &ctx->h, rNum, Xptr); #define I256(R) \ - X0 += ks[((R) + 1) % 5]; /* inject the key schedule value */ \ - X1 += ks[((R) + 2) % 5] + ts[((R) + 1) % 3]; \ - X2 += ks[((R) + 3) % 5] + ts[((R) + 2) % 3]; \ - X3 += ks[((R) + 4) % 5] + (R) + 1; \ - Skein_Show_R_Ptr(BLK_BITS, &ctx->h, SKEIN_RND_KEY_INJECT, Xptr); + X0 += ks[((R) + 1) % 5]; /* inject the key schedule value */ \ + X1 += ks[((R) + 2) % 5] + ts[((R) + 1) % 3]; \ + X2 += ks[((R) + 3) % 5] + ts[((R) + 2) % 3]; \ + X3 += ks[((R) + 4) % 5] + (R) + 1; \ + Skein_Show_R_Ptr(BLK_BITS, &ctx->h, SKEIN_RND_KEY_INJECT, Xptr); #else /* looping version */ #define R256(p0, p1, p2, p3, ROT, rNum) \ - Round256(p0, p1, p2, p3, ROT, rNum) \ - Skein_Show_R_Ptr(BLK_BITS, &ctx->h, 4 * (r - 1) + rNum, Xptr); + Round256(p0, p1, p2, p3, ROT, rNum) \ + Skein_Show_R_Ptr(BLK_BITS, &ctx->h, 4 * (r - 1) + rNum, Xptr); #define I256(R) \ X0 += ks[r + (R) + 0]; /* inject the key schedule value */ \ @@ -157,8 +156,8 @@ Skein_256_Process_Block(Skein_256_Ctxt_t *ctx, const uint8_t *blkPtr, X2 += ks[r + (R) + 2] + ts[r + (R) + 1]; \ X3 += ks[r + (R) + 3] + r + (R); \ ks[r + (R) + 4] = ks[r + (R) - 1]; /* rotate key schedule */ \ - ts[r + (R) + 2] = ts[r + (R) - 1]; \ - Skein_Show_R_Ptr(BLK_BITS, &ctx->h, SKEIN_RND_KEY_INJECT, Xptr); + ts[r + (R) + 2] = ts[r + (R) - 1]; \ + Skein_Show_R_Ptr(BLK_BITS, &ctx->h, SKEIN_RND_KEY_INJECT, Xptr); /* loop thru it */ for (r = 1; r < 2 * RCNT; r += 2 * SKEIN_UNROLL_256) @@ -239,8 +238,7 @@ Skein_256_Process_Block(Skein_256_Ctxt_t *ctx, const uint8_t *blkPtr, Skein_Show_Round(BLK_BITS, &ctx->h, SKEIN_RND_FEED_FWD, ctx->X); ts[1] &= ~SKEIN_T1_FLAG_FIRST; - } - while (--blkCnt); + } while (--blkCnt); ctx->h.T[0] = ts[0]; ctx->h.T[1] = ts[1]; } @@ -266,7 +264,7 @@ Skein_256_Unroll_Cnt(void) void Skein_512_Process_Block(Skein_512_Ctxt_t *ctx, const uint8_t *blkPtr, size_t blkCnt, size_t byteCntAdd) -{ /* do it in C */ +{ enum { WCNT = SKEIN_512_STATE_WORDS }; @@ -470,8 +468,7 @@ Skein_512_Process_Block(Skein_512_Ctxt_t *ctx, const uint8_t *blkPtr, Skein_Show_Round(BLK_BITS, &ctx->h, SKEIN_RND_FEED_FWD, ctx->X); ts[1] &= ~SKEIN_T1_FLAG_FIRST; - } - while (--blkCnt); + } while (--blkCnt); ctx->h.T[0] = ts[0]; ctx->h.T[1] = ts[1]; } diff --git a/module/icp/asm-x86_64/aes/aeskey.c b/module/icp/asm-x86_64/aes/aeskey.c index 96767fbea..c3d1f2990 100644 --- a/module/icp/asm-x86_64/aes/aeskey.c +++ b/module/icp/asm-x86_64/aes/aeskey.c @@ -212,7 +212,7 @@ aes_encrypt_key256(const unsigned char *key, uint32_t rk[]) */ int rijndael_key_setup_enc_amd64(uint32_t rk[], const uint32_t cipherKey[], - int keyBits) + int keyBits) { switch (keyBits) { case 128: @@ -560,7 +560,7 @@ aes_decrypt_key256(const unsigned char *key, uint32_t rk[]) */ int rijndael_key_setup_dec_amd64(uint32_t rk[], const uint32_t cipherKey[], - int keyBits) + int keyBits) { switch (keyBits) { case 128: diff --git a/module/icp/io/aes.c b/module/icp/io/aes.c index 7fd66be3e..12d57ed79 100644 --- a/module/icp/io/aes.c +++ b/module/icp/io/aes.c @@ -321,14 +321,16 @@ aes_provider_status(crypto_provider_handle_t provider, uint_t *status) static int aes_encrypt_init(crypto_ctx_t *ctx, crypto_mechanism_t *mechanism, crypto_key_t *key, crypto_spi_ctx_template_t template, - crypto_req_handle_t req) { + crypto_req_handle_t req) +{ return (aes_common_init(ctx, mechanism, key, template, req, B_TRUE)); } static int aes_decrypt_init(crypto_ctx_t *ctx, crypto_mechanism_t *mechanism, crypto_key_t *key, crypto_spi_ctx_template_t template, - crypto_req_handle_t req) { + crypto_req_handle_t req) +{ return (aes_common_init(ctx, mechanism, key, template, req, B_FALSE)); } diff --git a/module/icp/io/edonr_mod.c b/module/icp/io/edonr_mod.c index 19b5c963d..cb748a954 100644 --- a/module/icp/io/edonr_mod.c +++ b/module/icp/io/edonr_mod.c @@ -57,6 +57,7 @@ edonr_mod_init(void) } int -edonr_mod_fini(void) { +edonr_mod_fini(void) +{ return (mod_remove(&modlinkage)); } diff --git a/module/icp/io/skein_mod.c b/module/icp/io/skein_mod.c index 705b1e819..6db31c355 100644 --- a/module/icp/io/skein_mod.c +++ b/module/icp/io/skein_mod.c @@ -230,7 +230,8 @@ skein_mod_init(void) } int -skein_mod_fini(void) { +skein_mod_fini(void) +{ int ret; if (skein_prov_handle != 0) { |