diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-01-01 02:37:02 -0500 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2007-05-02 00:38:31 -0400 |
commit | ebc610e5bc76df073221e64e86c3f7533a09ea40 (patch) | |
tree | d53f4fa3da412f6df4b5891e23ca7c7607a3a5ce /crypto/lrw.c | |
parent | 6158efc09016d3186263f6fd3a50667446ec4008 (diff) |
[CRYPTO] templates: Pass type/mask when creating instances
This patch passes the type/mask along when constructing instances of
templates. This is in preparation for templates that may support
multiple types of instances depending on what is requested. For example,
the planned software async crypto driver will use this construct.
For the moment this allows us to check whether the instance constructed
is of the correct type and avoid returning success if the type does not
match.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/lrw.c')
-rw-r--r-- | crypto/lrw.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crypto/lrw.c b/crypto/lrw.c index b4105080ac7a..621095db28b3 100644 --- a/crypto/lrw.c +++ b/crypto/lrw.c | |||
@@ -228,13 +228,18 @@ static void exit_tfm(struct crypto_tfm *tfm) | |||
228 | crypto_free_cipher(ctx->child); | 228 | crypto_free_cipher(ctx->child); |
229 | } | 229 | } |
230 | 230 | ||
231 | static struct crypto_instance *alloc(void *param, unsigned int len) | 231 | static struct crypto_instance *alloc(struct rtattr **tb) |
232 | { | 232 | { |
233 | struct crypto_instance *inst; | 233 | struct crypto_instance *inst; |
234 | struct crypto_alg *alg; | 234 | struct crypto_alg *alg; |
235 | int err; | ||
236 | |||
237 | err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_BLKCIPHER); | ||
238 | if (err) | ||
239 | return ERR_PTR(err); | ||
235 | 240 | ||
236 | alg = crypto_get_attr_alg(param, len, CRYPTO_ALG_TYPE_CIPHER, | 241 | alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER, |
237 | CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC); | 242 | CRYPTO_ALG_TYPE_MASK); |
238 | if (IS_ERR(alg)) | 243 | if (IS_ERR(alg)) |
239 | return ERR_PTR(PTR_ERR(alg)); | 244 | return ERR_PTR(PTR_ERR(alg)); |
240 | 245 | ||