summaryrefslogtreecommitdiff
path: root/crypto/aegis128l.c
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2019-04-01 13:12:09 +0200
committerBartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>2019-04-01 13:12:09 +0200
commit831fd9fdce82ad6727c15552b430c5e54420d92f (patch)
tree92cc49cb728ae789fcf1306a4a36206cd0f7a098 /crypto/aegis128l.c
parentfa52b9919271e59a73b989df5c92bbf0bb983c3d (diff)
parent1d5d6bd2502dff39b91d2280711ecbf86c1287a8 (diff)
downloadlinux-crypto-831fd9fdce82ad6727c15552b430c5e54420d92f.tar.gz
linux-crypto-831fd9fdce82ad6727c15552b430c5e54420d92f.zip
Merge tag 'v5.1-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into fbdev-for-next
Linux 5.1-rc3 Sync with upstream (which now contains fbdev-v5.1 changes) to prepare a base for fbdev-v5.2 changes.
Diffstat (limited to 'crypto/aegis128l.c')
-rw-r--r--crypto/aegis128l.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/crypto/aegis128l.c b/crypto/aegis128l.c
index b6fb21eb..275a8616 100644
--- a/crypto/aegis128l.c
+++ b/crypto/aegis128l.c
@@ -1,13 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* The AEGIS-128L Authenticated-Encryption Algorithm
*
* Copyright (c) 2017-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 <crypto/algapi.h>
@@ -353,19 +349,19 @@ static void crypto_aegis128l_process_crypt(struct aegis_state *state,
const struct aegis128l_ops *ops)
{
struct skcipher_walk walk;
- u8 *src, *dst;
- unsigned int chunksize;
ops->skcipher_walk_init(&walk, req, false);
while (walk.nbytes) {
- src = walk.src.virt.addr;
- dst = walk.dst.virt.addr;
- chunksize = walk.nbytes;
+ unsigned int nbytes = walk.nbytes;
+
+ if (nbytes < walk.total)
+ nbytes = round_down(nbytes, walk.stride);
- ops->crypt_chunk(state, dst, src, chunksize);
+ 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);
}
}