summaryrefslogtreecommitdiff
path: root/crypto/morus640.c
diff options
context:
space:
mode:
authorJames Morris <james.morris@microsoft.com>2019-03-26 16:28:01 -0700
committerJames Morris <james.morris@microsoft.com>2019-03-26 16:28:01 -0700
commit0d79d47e75b64925d32d790a0907fbbaeb16cf1a (patch)
tree92cc49cb728ae789fcf1306a4a36206cd0f7a098 /crypto/morus640.c
parentaaf6aed3ef1a735e34339a51f26f5f3e5fe9a478 (diff)
parent1d5d6bd2502dff39b91d2280711ecbf86c1287a8 (diff)
downloadlinux-crypto-0d79d47e75b64925d32d790a0907fbbaeb16cf1a.tar.gz
linux-crypto-0d79d47e75b64925d32d790a0907fbbaeb16cf1a.zip
Merge tag 'v5.1-rc2' into next-general
Merge to Linux 5.1-rc2 for subsystems to work with.
Diffstat (limited to '')
-rw-r--r--crypto/morus640.c19
1 files changed, 8 insertions, 11 deletions
diff --git a/crypto/morus640.c b/crypto/morus640.c
index da06ec2f..1617a1eb 100644
--- a/crypto/morus640.c
+++ b/crypto/morus640.c
@@ -1,13 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* The MORUS-640 Authenticated-Encryption Algorithm
*
* Copyright (c) 2016-2018 Ondrej Mosnacek <omosnacek@gmail.com>
* Copyright (C) 2017-2018 Red Hat, Inc. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 2 of the License, or (at your option)
- * any later version.
*/
#include <asm/unaligned.h>
@@ -365,18 +361,19 @@ static void crypto_morus640_process_crypt(struct morus640_state *state,
const struct morus640_ops *ops)
{
struct skcipher_walk walk;
- u8 *dst;
- const u8 *src;
ops->skcipher_walk_init(&walk, req, false);
while (walk.nbytes) {
- src = walk.src.virt.addr;
- dst = walk.dst.virt.addr;
+ unsigned int nbytes = walk.nbytes;
+
+ if (nbytes < walk.total)
+ nbytes = round_down(nbytes, walk.stride);
- ops->crypt_chunk(state, dst, src, walk.nbytes);
+ ops->crypt_chunk(state, walk.dst.virt.addr, walk.src.virt.addr,
+ nbytes);
- skcipher_walk_done(&walk, 0);
+ skcipher_walk_done(&walk, walk.nbytes - nbytes);
}
}