Source
1
+
// SPDX-License-Identifier: GPL-2.0-or-later
1
2
/*
2
3
* echainiv: Encrypted Chain IV Generator
3
4
*
4
5
* This generator generates an IV based on a sequence number by multiplying
5
6
* it with a salt and then encrypting it with the same key as used to encrypt
6
7
* the plain text. This algorithm requires that the block size be equal
7
8
* to the IV size. It is mainly useful for CBC.
8
9
*
9
10
* This generator can only be used by algorithms where authentication
10
11
* is performed after encryption (i.e., authenc).
11
12
*
12
13
* Copyright (c) 2015 Herbert Xu <herbert@gondor.apana.org.au>
13
-
*
14
-
* This program is free software; you can redistribute it and/or modify it
15
-
* under the terms of the GNU General Public License as published by the Free
16
-
* Software Foundation; either version 2 of the License, or (at your option)
17
-
* any later version.
18
-
*
19
14
*/
20
15
​
21
16
#include <crypto/internal/geniv.h>
22
17
#include <crypto/scatterwalk.h>
23
18
#include <crypto/skcipher.h>
24
19
#include <linux/err.h>
25
20
#include <linux/init.h>
26
21
#include <linux/kernel.h>
27
22
#include <linux/module.h>
28
23
#include <linux/slab.h>