diff options
author | James Morris <james.l.morris@oracle.com> | 2017-09-24 22:41:55 -0700 |
---|---|---|
committer | James Morris <james.l.morris@oracle.com> | 2017-09-24 22:41:55 -0700 |
commit | fe6ec4634c4b41ea65f055ea709a6f3d5bf67bec (patch) | |
tree | 9ba289bdd8831b061743a8d48b13e6128306b8f1 /crypto/algapi.c | |
parent | f960b5ebd9ed09bc12e10c712bce82ab58ef0435 (diff) | |
parent | 508f8d23a372beae647185ce896a0c1109406b83 (diff) | |
download | linux-crypto-fe6ec4634c4b41ea65f055ea709a6f3d5bf67bec.tar.gz linux-crypto-fe6ec4634c4b41ea65f055ea709a6f3d5bf67bec.zip |
Merge tag 'v4.14-rc2' into next-general
Linux 4.14-rc2
Sync to v4.14-rc2 for security subsystem developers to track.
Diffstat (limited to 'crypto/algapi.c')
-rw-r--r-- | crypto/algapi.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/crypto/algapi.c b/crypto/algapi.c index e4cc7615..aa699ff6 100644 --- a/crypto/algapi.c +++ b/crypto/algapi.c @@ -975,13 +975,15 @@ void crypto_inc(u8 *a, unsigned int size) } EXPORT_SYMBOL_GPL(crypto_inc); -void __crypto_xor(u8 *dst, const u8 *src, unsigned int len) +void __crypto_xor(u8 *dst, const u8 *src1, const u8 *src2, unsigned int len) { int relalign = 0; if (!IS_ENABLED(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS)) { int size = sizeof(unsigned long); - int d = ((unsigned long)dst ^ (unsigned long)src) & (size - 1); + int d = (((unsigned long)dst ^ (unsigned long)src1) | + ((unsigned long)dst ^ (unsigned long)src2)) & + (size - 1); relalign = d ? 1 << __ffs(d) : size; @@ -992,34 +994,37 @@ void __crypto_xor(u8 *dst, const u8 *src, unsigned int len) * process the remainder of the input using optimal strides. */ while (((unsigned long)dst & (relalign - 1)) && len > 0) { - *dst++ ^= *src++; + *dst++ = *src1++ ^ *src2++; len--; } } while (IS_ENABLED(CONFIG_64BIT) && len >= 8 && !(relalign & 7)) { - *(u64 *)dst ^= *(u64 *)src; + *(u64 *)dst = *(u64 *)src1 ^ *(u64 *)src2; dst += 8; - src += 8; + src1 += 8; + src2 += 8; len -= 8; } while (len >= 4 && !(relalign & 3)) { - *(u32 *)dst ^= *(u32 *)src; + *(u32 *)dst = *(u32 *)src1 ^ *(u32 *)src2; dst += 4; - src += 4; + src1 += 4; + src2 += 4; len -= 4; } while (len >= 2 && !(relalign & 1)) { - *(u16 *)dst ^= *(u16 *)src; + *(u16 *)dst = *(u16 *)src1 ^ *(u16 *)src2; dst += 2; - src += 2; + src1 += 2; + src2 += 2; len -= 2; } while (len--) - *dst++ ^= *src++; + *dst++ = *src1++ ^ *src2++; } EXPORT_SYMBOL_GPL(__crypto_xor); |