aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/ablkcipher.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/ablkcipher.c')
-rw-r--r--crypto/ablkcipher.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c
index 8f48b4d58fca..092d9659b861 100644
--- a/crypto/ablkcipher.c
+++ b/crypto/ablkcipher.c
@@ -80,6 +80,7 @@ static int crypto_init_ablkcipher_ops(struct crypto_tfm *tfm, u32 type,
80 crt->setkey = setkey; 80 crt->setkey = setkey;
81 crt->encrypt = alg->encrypt; 81 crt->encrypt = alg->encrypt;
82 crt->decrypt = alg->decrypt; 82 crt->decrypt = alg->decrypt;
83 crt->base = __crypto_ablkcipher_cast(tfm);
83 crt->ivsize = alg->ivsize; 84 crt->ivsize = alg->ivsize;
84 85
85 return 0; 86 return 0;
@@ -122,11 +123,13 @@ static int crypto_init_givcipher_ops(struct crypto_tfm *tfm, u32 type,
122 if (alg->ivsize > PAGE_SIZE / 8) 123 if (alg->ivsize > PAGE_SIZE / 8)
123 return -EINVAL; 124 return -EINVAL;
124 125
125 crt->setkey = setkey; 126 crt->setkey = tfm->__crt_alg->cra_flags & CRYPTO_ALG_GENIV ?
127 alg->setkey : setkey;
126 crt->encrypt = alg->encrypt; 128 crt->encrypt = alg->encrypt;
127 crt->decrypt = alg->decrypt; 129 crt->decrypt = alg->decrypt;
128 crt->givencrypt = alg->givencrypt; 130 crt->givencrypt = alg->givencrypt;
129 crt->givdecrypt = alg->givdecrypt ?: no_givdecrypt; 131 crt->givdecrypt = alg->givdecrypt ?: no_givdecrypt;
132 crt->base = __crypto_ablkcipher_cast(tfm);
130 crt->ivsize = alg->ivsize; 133 crt->ivsize = alg->ivsize;
131 134
132 return 0; 135 return 0;
@@ -155,6 +158,11 @@ const struct crypto_type crypto_givcipher_type = {
155}; 158};
156EXPORT_SYMBOL_GPL(crypto_givcipher_type); 159EXPORT_SYMBOL_GPL(crypto_givcipher_type);
157 160
161const char *crypto_default_geniv(const struct crypto_alg *alg)
162{
163 return alg->cra_flags & CRYPTO_ALG_ASYNC ? "eseqiv" : "chainiv";
164}
165
158int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name, 166int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name,
159 u32 type, u32 mask) 167 u32 type, u32 mask)
160{ 168{