diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2007-08-26 07:12:47 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:55:41 -0400 |
commit | 2de98e75449fc1c43d2fbb857668ae62d4f5eece (patch) | |
tree | da472cafdc8688664011cf05b655db55a051b4e7 | |
parent | 791b4d5f73cbc16ee532ebac5bd82d51524d4f99 (diff) |
[CRYPTO] ablkcipher: Remove queue pointer from common alg object
Since not everyone needs a queue pointer and those who need it can
always get it from the context anyway the queue pointer in the
common alg object is redundant.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
-rw-r--r-- | crypto/ablkcipher.c | 4 | ||||
-rw-r--r-- | crypto/cryptd.c | 7 | ||||
-rw-r--r-- | include/crypto/algapi.h | 14 | ||||
-rw-r--r-- | include/linux/crypto.h | 3 |
4 files changed, 10 insertions, 18 deletions
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c index 47438b650c92..2731acb86e7d 100644 --- a/crypto/ablkcipher.c +++ b/crypto/ablkcipher.c | |||
@@ -94,10 +94,6 @@ static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg) | |||
94 | seq_printf(m, "min keysize : %u\n", ablkcipher->min_keysize); | 94 | seq_printf(m, "min keysize : %u\n", ablkcipher->min_keysize); |
95 | seq_printf(m, "max keysize : %u\n", ablkcipher->max_keysize); | 95 | seq_printf(m, "max keysize : %u\n", ablkcipher->max_keysize); |
96 | seq_printf(m, "ivsize : %u\n", ablkcipher->ivsize); | 96 | seq_printf(m, "ivsize : %u\n", ablkcipher->ivsize); |
97 | if (ablkcipher->queue) { | ||
98 | seq_printf(m, "qlen : %u\n", ablkcipher->queue->qlen); | ||
99 | seq_printf(m, "max qlen : %u\n", ablkcipher->queue->max_qlen); | ||
100 | } | ||
101 | } | 97 | } |
102 | 98 | ||
103 | const struct crypto_type crypto_ablkcipher_type = { | 99 | const struct crypto_type crypto_ablkcipher_type = { |
diff --git a/crypto/cryptd.c b/crypto/cryptd.c index ac6dce2e7596..8bf2da835f7b 100644 --- a/crypto/cryptd.c +++ b/crypto/cryptd.c | |||
@@ -131,7 +131,7 @@ static int cryptd_blkcipher_enqueue(struct ablkcipher_request *req, | |||
131 | req->base.complete = complete; | 131 | req->base.complete = complete; |
132 | 132 | ||
133 | spin_lock_bh(&state->lock); | 133 | spin_lock_bh(&state->lock); |
134 | err = ablkcipher_enqueue_request(crypto_ablkcipher_alg(tfm), req); | 134 | err = ablkcipher_enqueue_request(&state->queue, req); |
135 | spin_unlock_bh(&state->lock); | 135 | spin_unlock_bh(&state->lock); |
136 | 136 | ||
137 | wake_up_process(state->task); | 137 | wake_up_process(state->task); |
@@ -173,7 +173,8 @@ static void cryptd_blkcipher_exit_tfm(struct crypto_tfm *tfm) | |||
173 | int active; | 173 | int active; |
174 | 174 | ||
175 | mutex_lock(&state->mutex); | 175 | mutex_lock(&state->mutex); |
176 | active = ablkcipher_tfm_in_queue(__crypto_ablkcipher_cast(tfm)); | 176 | active = ablkcipher_tfm_in_queue(&state->queue, |
177 | __crypto_ablkcipher_cast(tfm)); | ||
177 | mutex_unlock(&state->mutex); | 178 | mutex_unlock(&state->mutex); |
178 | 179 | ||
179 | BUG_ON(active); | 180 | BUG_ON(active); |
@@ -251,8 +252,6 @@ static struct crypto_instance *cryptd_alloc_blkcipher( | |||
251 | inst->alg.cra_ablkcipher.encrypt = cryptd_blkcipher_encrypt_enqueue; | 252 | inst->alg.cra_ablkcipher.encrypt = cryptd_blkcipher_encrypt_enqueue; |
252 | inst->alg.cra_ablkcipher.decrypt = cryptd_blkcipher_decrypt_enqueue; | 253 | inst->alg.cra_ablkcipher.decrypt = cryptd_blkcipher_decrypt_enqueue; |
253 | 254 | ||
254 | inst->alg.cra_ablkcipher.queue = &state->queue; | ||
255 | |||
256 | out_put_alg: | 255 | out_put_alg: |
257 | crypto_mod_put(alg); | 256 | crypto_mod_put(alg); |
258 | return inst; | 257 | return inst; |
diff --git a/include/crypto/algapi.h b/include/crypto/algapi.h index 290bce0c5bd5..cd721a7ce78f 100644 --- a/include/crypto/algapi.h +++ b/include/crypto/algapi.h | |||
@@ -234,16 +234,16 @@ static inline struct crypto_async_request *crypto_get_backlog( | |||
234 | container_of(queue->backlog, struct crypto_async_request, list); | 234 | container_of(queue->backlog, struct crypto_async_request, list); |
235 | } | 235 | } |
236 | 236 | ||
237 | static inline int ablkcipher_enqueue_request(struct ablkcipher_alg *alg, | 237 | static inline int ablkcipher_enqueue_request(struct crypto_queue *queue, |
238 | struct ablkcipher_request *request) | 238 | struct ablkcipher_request *request) |
239 | { | 239 | { |
240 | return crypto_enqueue_request(alg->queue, &request->base); | 240 | return crypto_enqueue_request(queue, &request->base); |
241 | } | 241 | } |
242 | 242 | ||
243 | static inline struct ablkcipher_request *ablkcipher_dequeue_request( | 243 | static inline struct ablkcipher_request *ablkcipher_dequeue_request( |
244 | struct ablkcipher_alg *alg) | 244 | struct crypto_queue *queue) |
245 | { | 245 | { |
246 | return ablkcipher_request_cast(crypto_dequeue_request(alg->queue)); | 246 | return ablkcipher_request_cast(crypto_dequeue_request(queue)); |
247 | } | 247 | } |
248 | 248 | ||
249 | static inline void *ablkcipher_request_ctx(struct ablkcipher_request *req) | 249 | static inline void *ablkcipher_request_ctx(struct ablkcipher_request *req) |
@@ -251,10 +251,10 @@ static inline void *ablkcipher_request_ctx(struct ablkcipher_request *req) | |||
251 | return req->__ctx; | 251 | return req->__ctx; |
252 | } | 252 | } |
253 | 253 | ||
254 | static inline int ablkcipher_tfm_in_queue(struct crypto_ablkcipher *tfm) | 254 | static inline int ablkcipher_tfm_in_queue(struct crypto_queue *queue, |
255 | struct crypto_ablkcipher *tfm) | ||
255 | { | 256 | { |
256 | return crypto_tfm_in_queue(crypto_ablkcipher_alg(tfm)->queue, | 257 | return crypto_tfm_in_queue(queue, crypto_ablkcipher_tfm(tfm)); |
257 | crypto_ablkcipher_tfm(tfm)); | ||
258 | } | 258 | } |
259 | 259 | ||
260 | #endif /* _CRYPTO_ALGAPI_H */ | 260 | #endif /* _CRYPTO_ALGAPI_H */ |
diff --git a/include/linux/crypto.h b/include/linux/crypto.h index da09b4ac3ae9..b1c7f4187c5b 100644 --- a/include/linux/crypto.h +++ b/include/linux/crypto.h | |||
@@ -95,7 +95,6 @@ struct crypto_async_request; | |||
95 | struct crypto_aead; | 95 | struct crypto_aead; |
96 | struct crypto_blkcipher; | 96 | struct crypto_blkcipher; |
97 | struct crypto_hash; | 97 | struct crypto_hash; |
98 | struct crypto_queue; | ||
99 | struct crypto_tfm; | 98 | struct crypto_tfm; |
100 | struct crypto_type; | 99 | struct crypto_type; |
101 | 100 | ||
@@ -178,8 +177,6 @@ struct ablkcipher_alg { | |||
178 | int (*encrypt)(struct ablkcipher_request *req); | 177 | int (*encrypt)(struct ablkcipher_request *req); |
179 | int (*decrypt)(struct ablkcipher_request *req); | 178 | int (*decrypt)(struct ablkcipher_request *req); |
180 | 179 | ||
181 | struct crypto_queue *queue; | ||
182 | |||
183 | unsigned int min_keysize; | 180 | unsigned int min_keysize; |
184 | unsigned int max_keysize; | 181 | unsigned int max_keysize; |
185 | unsigned int ivsize; | 182 | unsigned int ivsize; |