Skip to content

Commit 23508e1

Browse files
committed
[CRYPTO] skcipher: Added geniv field
This patch introduces the geniv field which indicates the default IV generator for each algorithm. It should point to a string that is not freed as long as the algorithm is registered. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 61da88e commit 23508e1

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

‎crypto/ablkcipher.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg)
9696
seq_printf(m, "min keysize : %u\n", ablkcipher->min_keysize);
9797
seq_printf(m, "max keysize : %u\n", ablkcipher->max_keysize);
9898
seq_printf(m, "ivsize : %u\n", ablkcipher->ivsize);
99+
seq_printf(m, "geniv : %s\n", ablkcipher->geniv ?: "<default>");
99100
}
100101

101102
const struct crypto_type crypto_ablkcipher_type = {
@@ -142,6 +143,7 @@ static void crypto_givcipher_show(struct seq_file *m, struct crypto_alg *alg)
142143
seq_printf(m, "min keysize : %u\n", ablkcipher->min_keysize);
143144
seq_printf(m, "max keysize : %u\n", ablkcipher->max_keysize);
144145
seq_printf(m, "ivsize : %u\n", ablkcipher->ivsize);
146+
seq_printf(m, "geniv : %s\n", ablkcipher->geniv ?: "<built-in>");
145147
}
146148

147149
const struct crypto_type crypto_givcipher_type = {

‎crypto/blkcipher.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,8 @@ static void crypto_blkcipher_show(struct seq_file *m, struct crypto_alg *alg)
496496
seq_printf(m, "min keysize : %u\n", alg->cra_blkcipher.min_keysize);
497497
seq_printf(m, "max keysize : %u\n", alg->cra_blkcipher.max_keysize);
498498
seq_printf(m, "ivsize : %u\n", alg->cra_blkcipher.ivsize);
499+
seq_printf(m, "geniv : %s\n", alg->cra_blkcipher.geniv ?:
500+
"<default>");
499501
}
500502

501503
const struct crypto_type crypto_blkcipher_type = {

‎include/linux/crypto.h‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ struct ablkcipher_alg {
183183
int (*givencrypt)(struct skcipher_givcrypt_request *req);
184184
int (*givdecrypt)(struct skcipher_givcrypt_request *req);
185185

186+
const char *geniv;
187+
186188
unsigned int min_keysize;
187189
unsigned int max_keysize;
188190
unsigned int ivsize;
@@ -209,6 +211,8 @@ struct blkcipher_alg {
209211
struct scatterlist *dst, struct scatterlist *src,
210212
unsigned int nbytes);
211213

214+
const char *geniv;
215+
212216
unsigned int min_keysize;
213217
unsigned int max_keysize;
214218
unsigned int ivsize;

0 commit comments

Comments
 (0)