mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 17:25:38 +00:00
crypto: skcipher - remove remnants of internal IV generators
Remove dead code related to internal IV generators, which are no longer used since they've been replaced with the "seqiv" and "echainiv" templates. The removed code includes: - The "givcipher" (GIVCIPHER) algorithm type. No algorithms are registered with this type anymore, so it's unneeded. - The "const char *geniv" member of aead_alg, ablkcipher_alg, and blkcipher_alg. A few algorithms still set this, but it isn't used anymore except to show via /proc/crypto and CRYPTO_MSG_GETALG. Just hardcode "<default>" or "<none>" in those cases. - The 'skcipher_givcrypt_request' structure, which is never used. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
dec5d0db0d
commit
c79b411eaa
@ -1,15 +1,6 @@
|
||||
Programming Interface
|
||||
=====================
|
||||
|
||||
Please note that the kernel crypto API contains the AEAD givcrypt API
|
||||
(crypto_aead_giv\* and aead_givcrypt\* function calls in
|
||||
include/crypto/aead.h). This API is obsolete and will be removed in the
|
||||
future. To obtain the functionality of an AEAD cipher with internal IV
|
||||
generation, use the IV generator as a regular cipher. For example,
|
||||
rfc4106(gcm(aes)) is the AEAD cipher with external IV generation and
|
||||
seqniv(rfc4106(gcm(aes))) implies that the kernel crypto API generates
|
||||
the IV. Different IV generators are available.
|
||||
|
||||
.. class:: toc-title
|
||||
|
||||
Table of contents
|
||||
|
@ -157,10 +157,6 @@ applicable to a cipher, it is not displayed:
|
||||
|
||||
- rng for random number generator
|
||||
|
||||
- givcipher for cipher with associated IV generator (see the geniv
|
||||
entry below for the specification of the IV generator type used by
|
||||
the cipher implementation)
|
||||
|
||||
- kpp for a Key-agreement Protocol Primitive (KPP) cipher such as
|
||||
an ECDH or DH implementation
|
||||
|
||||
@ -174,16 +170,7 @@ applicable to a cipher, it is not displayed:
|
||||
|
||||
- digestsize: output size of the message digest
|
||||
|
||||
- geniv: IV generation type:
|
||||
|
||||
- eseqiv for encrypted sequence number based IV generation
|
||||
|
||||
- seqiv for sequence number based IV generation
|
||||
|
||||
- chainiv for chain iv generation
|
||||
|
||||
- <builtin> is a marker that the cipher implements IV generation and
|
||||
handling as it is specific to the given cipher
|
||||
- geniv: IV generator (obsolete)
|
||||
|
||||
Key Sizes
|
||||
---------
|
||||
@ -218,10 +205,6 @@ the aforementioned cipher types:
|
||||
|
||||
- CRYPTO_ALG_TYPE_ABLKCIPHER Asynchronous multi-block cipher
|
||||
|
||||
- CRYPTO_ALG_TYPE_GIVCIPHER Asynchronous multi-block cipher packed
|
||||
together with an IV generator (see geniv field in the /proc/crypto
|
||||
listing for the known IV generators)
|
||||
|
||||
- CRYPTO_ALG_TYPE_KPP Key-agreement Protocol Primitive (KPP) such as
|
||||
an ECDH or DH implementation
|
||||
|
||||
@ -338,18 +321,14 @@ uses the API applicable to the cipher type specified for the block.
|
||||
|
||||
The following call sequence is applicable when the IPSEC layer triggers
|
||||
an encryption operation with the esp_output function. During
|
||||
configuration, the administrator set up the use of rfc4106(gcm(aes)) as
|
||||
the cipher for ESP. The following call sequence is now depicted in the
|
||||
ASCII art above:
|
||||
configuration, the administrator set up the use of seqiv(rfc4106(gcm(aes)))
|
||||
as the cipher for ESP. The following call sequence is now depicted in
|
||||
the ASCII art above:
|
||||
|
||||
1. esp_output() invokes crypto_aead_encrypt() to trigger an
|
||||
encryption operation of the AEAD cipher with IV generator.
|
||||
|
||||
In case of GCM, the SEQIV implementation is registered as GIVCIPHER
|
||||
in crypto_rfc4106_alloc().
|
||||
|
||||
The SEQIV performs its operation to generate an IV where the core
|
||||
function is seqiv_geniv().
|
||||
The SEQIV generates the IV.
|
||||
|
||||
2. Now, SEQIV uses the AEAD API function calls to invoke the associated
|
||||
AEAD cipher. In our case, during the instantiation of SEQIV, the
|
||||
|
@ -368,8 +368,7 @@ static int crypto_ablkcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
|
||||
memset(&rblkcipher, 0, sizeof(rblkcipher));
|
||||
|
||||
strscpy(rblkcipher.type, "ablkcipher", sizeof(rblkcipher.type));
|
||||
strscpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<default>",
|
||||
sizeof(rblkcipher.geniv));
|
||||
strscpy(rblkcipher.geniv, "<default>", sizeof(rblkcipher.geniv));
|
||||
|
||||
rblkcipher.blocksize = alg->cra_blocksize;
|
||||
rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
|
||||
@ -399,7 +398,7 @@ static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg)
|
||||
seq_printf(m, "min keysize : %u\n", ablkcipher->min_keysize);
|
||||
seq_printf(m, "max keysize : %u\n", ablkcipher->max_keysize);
|
||||
seq_printf(m, "ivsize : %u\n", ablkcipher->ivsize);
|
||||
seq_printf(m, "geniv : %s\n", ablkcipher->geniv ?: "<default>");
|
||||
seq_printf(m, "geniv : <default>\n");
|
||||
}
|
||||
|
||||
const struct crypto_type crypto_ablkcipher_type = {
|
||||
@ -411,74 +410,3 @@ const struct crypto_type crypto_ablkcipher_type = {
|
||||
.report = crypto_ablkcipher_report,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(crypto_ablkcipher_type);
|
||||
|
||||
static int crypto_init_givcipher_ops(struct crypto_tfm *tfm, u32 type,
|
||||
u32 mask)
|
||||
{
|
||||
struct ablkcipher_alg *alg = &tfm->__crt_alg->cra_ablkcipher;
|
||||
struct ablkcipher_tfm *crt = &tfm->crt_ablkcipher;
|
||||
|
||||
if (alg->ivsize > PAGE_SIZE / 8)
|
||||
return -EINVAL;
|
||||
|
||||
crt->setkey = tfm->__crt_alg->cra_flags & CRYPTO_ALG_GENIV ?
|
||||
alg->setkey : setkey;
|
||||
crt->encrypt = alg->encrypt;
|
||||
crt->decrypt = alg->decrypt;
|
||||
crt->base = __crypto_ablkcipher_cast(tfm);
|
||||
crt->ivsize = alg->ivsize;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
|
||||
{
|
||||
struct crypto_report_blkcipher rblkcipher;
|
||||
|
||||
memset(&rblkcipher, 0, sizeof(rblkcipher));
|
||||
|
||||
strscpy(rblkcipher.type, "givcipher", sizeof(rblkcipher.type));
|
||||
strscpy(rblkcipher.geniv, alg->cra_ablkcipher.geniv ?: "<built-in>",
|
||||
sizeof(rblkcipher.geniv));
|
||||
|
||||
rblkcipher.blocksize = alg->cra_blocksize;
|
||||
rblkcipher.min_keysize = alg->cra_ablkcipher.min_keysize;
|
||||
rblkcipher.max_keysize = alg->cra_ablkcipher.max_keysize;
|
||||
rblkcipher.ivsize = alg->cra_ablkcipher.ivsize;
|
||||
|
||||
return nla_put(skb, CRYPTOCFGA_REPORT_BLKCIPHER,
|
||||
sizeof(rblkcipher), &rblkcipher);
|
||||
}
|
||||
#else
|
||||
static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
|
||||
{
|
||||
return -ENOSYS;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
|
||||
__maybe_unused;
|
||||
static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
|
||||
{
|
||||
struct ablkcipher_alg *ablkcipher = &alg->cra_ablkcipher;
|
||||
|
||||
seq_printf(m, "type : givcipher\n");
|
||||
seq_printf(m, "async : %s\n", alg->cra_flags & CRYPTO_ALG_ASYNC ?
|
||||
"yes" : "no");
|
||||
seq_printf(m, "blocksize : %u\n", alg->cra_blocksize);
|
||||
seq_printf(m, "min keysize : %u\n", ablkcipher->min_keysize);
|
||||
seq_printf(m, "max keysize : %u\n", ablkcipher->max_keysize);
|
||||
seq_printf(m, "ivsize : %u\n", ablkcipher->ivsize);
|
||||
seq_printf(m, "geniv : %s\n", ablkcipher->geniv ?: "<built-in>");
|
||||
}
|
||||
|
||||
const struct crypto_type crypto_givcipher_type = {
|
||||
.ctxsize = crypto_ablkcipher_ctxsize,
|
||||
.init = crypto_init_givcipher_ops,
|
||||
#ifdef CONFIG_PROC_FS
|
||||
.show = crypto_givcipher_show,
|
||||
#endif
|
||||
.report = crypto_givcipher_report,
|
||||
};
|
||||
EXPORT_SYMBOL_GPL(crypto_givcipher_type);
|
||||
|
@ -510,8 +510,7 @@ static int crypto_blkcipher_report(struct sk_buff *skb, struct crypto_alg *alg)
|
||||
memset(&rblkcipher, 0, sizeof(rblkcipher));
|
||||
|
||||
strscpy(rblkcipher.type, "blkcipher", sizeof(rblkcipher.type));
|
||||
strscpy(rblkcipher.geniv, alg->cra_blkcipher.geniv ?: "<default>",
|
||||
sizeof(rblkcipher.geniv));
|
||||
strscpy(rblkcipher.geniv, "<default>", sizeof(rblkcipher.geniv));
|
||||
|
||||
rblkcipher.blocksize = alg->cra_blocksize;
|
||||
rblkcipher.min_keysize = alg->cra_blkcipher.min_keysize;
|
||||
@ -537,8 +536,7 @@ static void crypto_blkcipher_show(struct seq_file *m, struct crypto_alg *alg)
|
||||
seq_printf(m, "min keysize : %u\n", alg->cra_blkcipher.min_keysize);
|
||||
seq_printf(m, "max keysize : %u\n", alg->cra_blkcipher.max_keysize);
|
||||
seq_printf(m, "ivsize : %u\n", alg->cra_blkcipher.ivsize);
|
||||
seq_printf(m, "geniv : %s\n", alg->cra_blkcipher.geniv ?:
|
||||
"<default>");
|
||||
seq_printf(m, "geniv : <default>\n");
|
||||
}
|
||||
|
||||
const struct crypto_type crypto_blkcipher_type = {
|
||||
|
@ -422,8 +422,6 @@ static int cryptd_create_blkcipher(struct crypto_template *tmpl,
|
||||
inst->alg.cra_ablkcipher.min_keysize = alg->cra_blkcipher.min_keysize;
|
||||
inst->alg.cra_ablkcipher.max_keysize = alg->cra_blkcipher.max_keysize;
|
||||
|
||||
inst->alg.cra_ablkcipher.geniv = alg->cra_blkcipher.geniv;
|
||||
|
||||
inst->alg.cra_ctxsize = sizeof(struct cryptd_blkcipher_ctx);
|
||||
|
||||
inst->alg.cra_init = cryptd_blkcipher_init_tfm;
|
||||
@ -1174,7 +1172,7 @@ struct cryptd_ablkcipher *cryptd_alloc_ablkcipher(const char *alg_name,
|
||||
return ERR_PTR(-EINVAL);
|
||||
type = crypto_skcipher_type(type);
|
||||
mask &= ~CRYPTO_ALG_TYPE_MASK;
|
||||
mask |= (CRYPTO_ALG_GENIV | CRYPTO_ALG_TYPE_BLKCIPHER_MASK);
|
||||
mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK;
|
||||
tfm = crypto_alloc_base(cryptd_alg_name, type, mask);
|
||||
if (IS_ERR(tfm))
|
||||
return ERR_CAST(tfm);
|
||||
|
@ -233,8 +233,6 @@ static struct crypto_instance *crypto_ctr_alloc(struct rtattr **tb)
|
||||
inst->alg.cra_blkcipher.encrypt = crypto_ctr_crypt;
|
||||
inst->alg.cra_blkcipher.decrypt = crypto_ctr_crypt;
|
||||
|
||||
inst->alg.cra_blkcipher.geniv = "chainiv";
|
||||
|
||||
out:
|
||||
crypto_mod_put(alg);
|
||||
return inst;
|
||||
|
@ -579,8 +579,7 @@ static unsigned int crypto_skcipher_extsize(struct crypto_alg *alg)
|
||||
if (alg->cra_type == &crypto_blkcipher_type)
|
||||
return sizeof(struct crypto_blkcipher *);
|
||||
|
||||
if (alg->cra_type == &crypto_ablkcipher_type ||
|
||||
alg->cra_type == &crypto_givcipher_type)
|
||||
if (alg->cra_type == &crypto_ablkcipher_type)
|
||||
return sizeof(struct crypto_ablkcipher *);
|
||||
|
||||
return crypto_alg_extsize(alg);
|
||||
@ -844,8 +843,7 @@ static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm)
|
||||
if (tfm->__crt_alg->cra_type == &crypto_blkcipher_type)
|
||||
return crypto_init_skcipher_ops_blkcipher(tfm);
|
||||
|
||||
if (tfm->__crt_alg->cra_type == &crypto_ablkcipher_type ||
|
||||
tfm->__crt_alg->cra_type == &crypto_givcipher_type)
|
||||
if (tfm->__crt_alg->cra_type == &crypto_ablkcipher_type)
|
||||
return crypto_init_skcipher_ops_ablkcipher(tfm);
|
||||
|
||||
skcipher->setkey = skcipher_setkey;
|
||||
|
@ -3868,7 +3868,6 @@ static struct iproc_alg_s driver_algs[] = {
|
||||
.cra_driver_name = "ctr-aes-iproc",
|
||||
.cra_blocksize = AES_BLOCK_SIZE,
|
||||
.cra_ablkcipher = {
|
||||
/* .geniv = "chainiv", */
|
||||
.min_keysize = AES_MIN_KEY_SIZE,
|
||||
.max_keysize = AES_MAX_KEY_SIZE,
|
||||
.ivsize = AES_BLOCK_SIZE,
|
||||
|
@ -3816,7 +3816,6 @@ static struct chcr_alg_template driver_algs[] = {
|
||||
.setkey = chcr_aes_rfc3686_setkey,
|
||||
.encrypt = chcr_aes_encrypt,
|
||||
.decrypt = chcr_aes_decrypt,
|
||||
.geniv = "seqiv",
|
||||
}
|
||||
}
|
||||
},
|
||||
|
@ -1194,7 +1194,6 @@ static struct ixp_alg ixp4xx_algos[] = {
|
||||
.min_keysize = DES_KEY_SIZE,
|
||||
.max_keysize = DES_KEY_SIZE,
|
||||
.ivsize = DES_BLOCK_SIZE,
|
||||
.geniv = "eseqiv",
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1221,7 +1220,6 @@ static struct ixp_alg ixp4xx_algos[] = {
|
||||
.min_keysize = DES3_EDE_KEY_SIZE,
|
||||
.max_keysize = DES3_EDE_KEY_SIZE,
|
||||
.ivsize = DES3_EDE_BLOCK_SIZE,
|
||||
.geniv = "eseqiv",
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1247,7 +1245,6 @@ static struct ixp_alg ixp4xx_algos[] = {
|
||||
.min_keysize = AES_MIN_KEY_SIZE,
|
||||
.max_keysize = AES_MAX_KEY_SIZE,
|
||||
.ivsize = AES_BLOCK_SIZE,
|
||||
.geniv = "eseqiv",
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1273,7 +1270,6 @@ static struct ixp_alg ixp4xx_algos[] = {
|
||||
.min_keysize = AES_MIN_KEY_SIZE,
|
||||
.max_keysize = AES_MAX_KEY_SIZE,
|
||||
.ivsize = AES_BLOCK_SIZE,
|
||||
.geniv = "eseqiv",
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -1287,7 +1283,6 @@ static struct ixp_alg ixp4xx_algos[] = {
|
||||
.min_keysize = AES_MIN_KEY_SIZE,
|
||||
.max_keysize = AES_MAX_KEY_SIZE,
|
||||
.ivsize = AES_BLOCK_SIZE,
|
||||
.geniv = "eseqiv",
|
||||
.setkey = ablk_rfc3686_setkey,
|
||||
.encrypt = ablk_rfc3686_crypt,
|
||||
.decrypt = ablk_rfc3686_crypt }
|
||||
|
@ -159,7 +159,6 @@ struct crypto_alg nx_ctr3686_aes_alg = {
|
||||
.min_keysize = AES_MIN_KEY_SIZE + CTR_RFC3686_NONCE_SIZE,
|
||||
.max_keysize = AES_MAX_KEY_SIZE + CTR_RFC3686_NONCE_SIZE,
|
||||
.ivsize = CTR_RFC3686_IV_SIZE,
|
||||
.geniv = "seqiv",
|
||||
.setkey = ctr3686_aes_nx_set_key,
|
||||
.encrypt = ctr3686_aes_nx_crypt,
|
||||
.decrypt = ctr3686_aes_nx_crypt,
|
||||
|
@ -749,7 +749,6 @@ static struct crypto_alg algs_ctr[] = {
|
||||
.cra_u.ablkcipher = {
|
||||
.min_keysize = AES_MIN_KEY_SIZE,
|
||||
.max_keysize = AES_MAX_KEY_SIZE,
|
||||
.geniv = "eseqiv",
|
||||
.ivsize = AES_BLOCK_SIZE,
|
||||
.setkey = omap_aes_setkey,
|
||||
.encrypt = omap_aes_ctr_encrypt,
|
||||
|
@ -1585,8 +1585,7 @@ static struct spacc_alg l2_engine_algs[] = {
|
||||
.cra_name = "f8(kasumi)",
|
||||
.cra_driver_name = "f8-kasumi-picoxcell",
|
||||
.cra_priority = SPACC_CRYPTO_ALG_PRIORITY,
|
||||
.cra_flags = CRYPTO_ALG_TYPE_GIVCIPHER |
|
||||
CRYPTO_ALG_ASYNC |
|
||||
.cra_flags = CRYPTO_ALG_ASYNC |
|
||||
CRYPTO_ALG_KERN_DRIVER_ONLY,
|
||||
.cra_blocksize = 8,
|
||||
.cra_ctxsize = sizeof(struct spacc_ablk_ctx),
|
||||
|
@ -3155,7 +3155,6 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,
|
||||
alg->cra_ablkcipher.setkey = ablkcipher_setkey;
|
||||
alg->cra_ablkcipher.encrypt = ablkcipher_encrypt;
|
||||
alg->cra_ablkcipher.decrypt = ablkcipher_decrypt;
|
||||
alg->cra_ablkcipher.geniv = "eseqiv";
|
||||
break;
|
||||
case CRYPTO_ALG_TYPE_AEAD:
|
||||
alg = &t_alg->algt.alg.aead.base;
|
||||
|
@ -115,7 +115,6 @@ struct aead_request {
|
||||
* @setkey: see struct skcipher_alg
|
||||
* @encrypt: see struct skcipher_alg
|
||||
* @decrypt: see struct skcipher_alg
|
||||
* @geniv: see struct skcipher_alg
|
||||
* @ivsize: see struct skcipher_alg
|
||||
* @chunksize: see struct skcipher_alg
|
||||
* @init: Initialize the cryptographic transformation object. This function
|
||||
@ -142,8 +141,6 @@ struct aead_alg {
|
||||
int (*init)(struct crypto_aead *tfm);
|
||||
void (*exit)(struct crypto_aead *tfm);
|
||||
|
||||
const char *geniv;
|
||||
|
||||
unsigned int ivsize;
|
||||
unsigned int maxauthsize;
|
||||
unsigned int chunksize;
|
||||
|
@ -70,8 +70,6 @@ struct skcipher_walk {
|
||||
unsigned int alignmask;
|
||||
};
|
||||
|
||||
extern const struct crypto_type crypto_givcipher_type;
|
||||
|
||||
static inline struct crypto_instance *skcipher_crypto_instance(
|
||||
struct skcipher_instance *inst)
|
||||
{
|
||||
|
@ -39,19 +39,6 @@ struct skcipher_request {
|
||||
void *__ctx[] CRYPTO_MINALIGN_ATTR;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct skcipher_givcrypt_request - Crypto request with IV generation
|
||||
* @seq: Sequence number for IV generation
|
||||
* @giv: Space for generated IV
|
||||
* @creq: The crypto request itself
|
||||
*/
|
||||
struct skcipher_givcrypt_request {
|
||||
u64 seq;
|
||||
u8 *giv;
|
||||
|
||||
struct ablkcipher_request creq;
|
||||
};
|
||||
|
||||
struct crypto_skcipher {
|
||||
int (*setkey)(struct crypto_skcipher *tfm, const u8 *key,
|
||||
unsigned int keylen);
|
||||
|
@ -49,7 +49,6 @@
|
||||
#define CRYPTO_ALG_TYPE_BLKCIPHER 0x00000004
|
||||
#define CRYPTO_ALG_TYPE_ABLKCIPHER 0x00000005
|
||||
#define CRYPTO_ALG_TYPE_SKCIPHER 0x00000005
|
||||
#define CRYPTO_ALG_TYPE_GIVCIPHER 0x00000006
|
||||
#define CRYPTO_ALG_TYPE_KPP 0x00000008
|
||||
#define CRYPTO_ALG_TYPE_ACOMPRESS 0x0000000a
|
||||
#define CRYPTO_ALG_TYPE_SCOMPRESS 0x0000000b
|
||||
@ -76,12 +75,6 @@
|
||||
*/
|
||||
#define CRYPTO_ALG_NEED_FALLBACK 0x00000100
|
||||
|
||||
/*
|
||||
* This bit is set for symmetric key ciphers that have already been wrapped
|
||||
* with a generic IV generator to prevent them from being wrapped again.
|
||||
*/
|
||||
#define CRYPTO_ALG_GENIV 0x00000200
|
||||
|
||||
/*
|
||||
* Set if the algorithm has passed automated run-time testing. Note that
|
||||
* if there is no run-time testing for a given algorithm it is considered
|
||||
@ -157,7 +150,6 @@ struct crypto_async_request;
|
||||
struct crypto_blkcipher;
|
||||
struct crypto_tfm;
|
||||
struct crypto_type;
|
||||
struct skcipher_givcrypt_request;
|
||||
|
||||
typedef void (*crypto_completion_t)(struct crypto_async_request *req, int err);
|
||||
|
||||
@ -246,31 +238,16 @@ struct cipher_desc {
|
||||
* be called in parallel with the same transformation object.
|
||||
* @decrypt: Decrypt a single block. This is a reverse counterpart to @encrypt
|
||||
* and the conditions are exactly the same.
|
||||
* @givencrypt: Update the IV for encryption. With this function, a cipher
|
||||
* implementation may provide the function on how to update the IV
|
||||
* for encryption.
|
||||
* @givdecrypt: Update the IV for decryption. This is the reverse of
|
||||
* @givencrypt .
|
||||
* @geniv: The transformation implementation may use an "IV generator" provided
|
||||
* by the kernel crypto API. Several use cases have a predefined
|
||||
* approach how IVs are to be updated. For such use cases, the kernel
|
||||
* crypto API provides ready-to-use implementations that can be
|
||||
* referenced with this variable.
|
||||
* @ivsize: IV size applicable for transformation. The consumer must provide an
|
||||
* IV of exactly that size to perform the encrypt or decrypt operation.
|
||||
*
|
||||
* All fields except @givencrypt , @givdecrypt , @geniv and @ivsize are
|
||||
* mandatory and must be filled.
|
||||
* All fields except @ivsize are mandatory and must be filled.
|
||||
*/
|
||||
struct ablkcipher_alg {
|
||||
int (*setkey)(struct crypto_ablkcipher *tfm, const u8 *key,
|
||||
unsigned int keylen);
|
||||
int (*encrypt)(struct ablkcipher_request *req);
|
||||
int (*decrypt)(struct ablkcipher_request *req);
|
||||
int (*givencrypt)(struct skcipher_givcrypt_request *req);
|
||||
int (*givdecrypt)(struct skcipher_givcrypt_request *req);
|
||||
|
||||
const char *geniv;
|
||||
|
||||
unsigned int min_keysize;
|
||||
unsigned int max_keysize;
|
||||
@ -284,10 +261,9 @@ struct ablkcipher_alg {
|
||||
* @setkey: see struct ablkcipher_alg
|
||||
* @encrypt: see struct ablkcipher_alg
|
||||
* @decrypt: see struct ablkcipher_alg
|
||||
* @geniv: see struct ablkcipher_alg
|
||||
* @ivsize: see struct ablkcipher_alg
|
||||
*
|
||||
* All fields except @geniv and @ivsize are mandatory and must be filled.
|
||||
* All fields except @ivsize are mandatory and must be filled.
|
||||
*/
|
||||
struct blkcipher_alg {
|
||||
int (*setkey)(struct crypto_tfm *tfm, const u8 *key,
|
||||
@ -299,8 +275,6 @@ struct blkcipher_alg {
|
||||
struct scatterlist *dst, struct scatterlist *src,
|
||||
unsigned int nbytes);
|
||||
|
||||
const char *geniv;
|
||||
|
||||
unsigned int min_keysize;
|
||||
unsigned int max_keysize;
|
||||
unsigned int ivsize;
|
||||
@ -931,14 +905,14 @@ static inline struct crypto_ablkcipher *__crypto_ablkcipher_cast(
|
||||
|
||||
static inline u32 crypto_skcipher_type(u32 type)
|
||||
{
|
||||
type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV);
|
||||
type &= ~CRYPTO_ALG_TYPE_MASK;
|
||||
type |= CRYPTO_ALG_TYPE_BLKCIPHER;
|
||||
return type;
|
||||
}
|
||||
|
||||
static inline u32 crypto_skcipher_mask(u32 mask)
|
||||
{
|
||||
mask &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV);
|
||||
mask &= ~CRYPTO_ALG_TYPE_MASK;
|
||||
mask |= CRYPTO_ALG_TYPE_BLKCIPHER_MASK;
|
||||
return mask;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user