aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/crypto
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2017-10-03 06:18:45 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2017-10-03 06:20:48 +0200
commit9eaec6d8f5cba1a95c7072c95d0a13726352aaea (patch)
tree12d7f4829c92bd535543698308466285b4bd8942 /src/crypto
parentreceive: simplify message type validation (diff)
downloadwireguard-monolithic-historical-9eaec6d8f5cba1a95c7072c95d0a13726352aaea.tar.xz
wireguard-monolithic-historical-9eaec6d8f5cba1a95c7072c95d0a13726352aaea.zip
global: satisfy bitshift pedantry
Suggested-by: Sultan Alsawaf <sultanxda@gmail.com>
Diffstat (limited to 'src/crypto')
-rw-r--r--src/crypto/chacha20poly1305.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/crypto/chacha20poly1305.c b/src/crypto/chacha20poly1305.c
index 9e74784..7227617 100644
--- a/src/crypto/chacha20poly1305.c
+++ b/src/crypto/chacha20poly1305.c
@@ -459,7 +459,7 @@ static void poly1305_simd_mult(u32 *a, const u32 *b)
memset(m, 0, sizeof(m));
/* The poly1305 block function adds a hi-bit to the accumulator which
* we don't need for key multiplication; compensate for it. */
- a[4] -= 1 << 24;
+ a[4] -= 1U << 24;
poly1305_asm_block_sse2(a, m, b, 1);
}
@@ -523,7 +523,7 @@ static void poly1305_update(struct poly1305_ctx *ctx, const u8 *src, unsigned in
poly1305_simd_blocks(ctx, ctx->buf, POLY1305_BLOCK_SIZE);
else
#endif
- poly1305_generic_blocks(ctx, ctx->buf, POLY1305_BLOCK_SIZE, 1 << 24);
+ poly1305_generic_blocks(ctx, ctx->buf, POLY1305_BLOCK_SIZE, 1U << 24);
ctx->buflen = 0;
}
}
@@ -534,7 +534,7 @@ static void poly1305_update(struct poly1305_ctx *ctx, const u8 *src, unsigned in
bytes = poly1305_simd_blocks(ctx, src, srclen);
else
#endif
- bytes = poly1305_generic_blocks(ctx, src, srclen, 1 << 24);
+ bytes = poly1305_generic_blocks(ctx, src, srclen, 1U << 24);
src += srclen - bytes;
srclen = bytes;
}
@@ -574,10 +574,10 @@ static void poly1305_finish(struct poly1305_ctx *ctx, u8 *dst)
/* compute h + -p */
g0 = h0 + 5;
- g1 = h1 + (g0 >> 26); g0 &= 0x3ffffff;
- g2 = h2 + (g1 >> 26); g1 &= 0x3ffffff;
- g3 = h3 + (g2 >> 26); g2 &= 0x3ffffff;
- g4 = h4 + (g3 >> 26) - (1 << 26); g3 &= 0x3ffffff;
+ g1 = h1 + (g0 >> 26); g0 &= 0x3ffffff;
+ g2 = h2 + (g1 >> 26); g1 &= 0x3ffffff;
+ g3 = h3 + (g2 >> 26); g2 &= 0x3ffffff;
+ g4 = h4 + (g3 >> 26) - (1U << 26); g3 &= 0x3ffffff;
/* select h if h < p, or h + -p if h >= p */
mask = (g4 >> ((sizeof(u32) * 8) - 1)) - 1;