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/ecb.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/ecb.c')
-rw-r--r-- | crypto/ecb.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/crypto/ecb.c b/crypto/ecb.c index 839a0aed8c22..6310387a872c 100644 --- a/crypto/ecb.c +++ b/crypto/ecb.c | |||
@@ -115,13 +115,18 @@ static void crypto_ecb_exit_tfm(struct crypto_tfm *tfm) | |||
115 | crypto_free_cipher(ctx->child); | 115 | crypto_free_cipher(ctx->child); |
116 | } | 116 | } |
117 | 117 | ||
118 | static struct crypto_instance *crypto_ecb_alloc(void *param, unsigned int len) | 118 | static struct crypto_instance *crypto_ecb_alloc(struct rtattr **tb) |
119 | { | 119 | { |
120 | struct crypto_instance *inst; | 120 | struct crypto_instance *inst; |
121 | struct crypto_alg *alg; | 121 | struct crypto_alg *alg; |
122 | int err; | ||
123 | |||
124 | err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_BLKCIPHER); | ||
125 | if (err) | ||
126 | return ERR_PTR(err); | ||
122 | 127 | ||
123 | alg = crypto_get_attr_alg(param, len, CRYPTO_ALG_TYPE_CIPHER, | 128 | alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER, |
124 | CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC); | 129 | CRYPTO_ALG_TYPE_MASK); |
125 | if (IS_ERR(alg)) | 130 | if (IS_ERR(alg)) |
126 | return ERR_PTR(PTR_ERR(alg)); | 131 | return ERR_PTR(PTR_ERR(alg)); |
127 | 132 | ||