Skip to content

Commit

Permalink
[CRYPTO] ablkcipher: Remove queue pointer from common alg object
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Herbert Xu authored and David S. Miller committed Oct 10, 2007
1 parent 791b4d5 commit 2de98e7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 18 deletions.
4 changes: 0 additions & 4 deletions crypto/ablkcipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,6 @@ static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg)
seq_printf(m, "min keysize : %u\n", ablkcipher->min_keysize);
seq_printf(m, "max keysize : %u\n", ablkcipher->max_keysize);
seq_printf(m, "ivsize : %u\n", ablkcipher->ivsize);
if (ablkcipher->queue) {
seq_printf(m, "qlen : %u\n", ablkcipher->queue->qlen);
seq_printf(m, "max qlen : %u\n", ablkcipher->queue->max_qlen);
}
}

const struct crypto_type crypto_ablkcipher_type = {
Expand Down
7 changes: 3 additions & 4 deletions crypto/cryptd.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ static int cryptd_blkcipher_enqueue(struct ablkcipher_request *req,
req->base.complete = complete;

spin_lock_bh(&state->lock);
err = ablkcipher_enqueue_request(crypto_ablkcipher_alg(tfm), req);
err = ablkcipher_enqueue_request(&state->queue, req);
spin_unlock_bh(&state->lock);

wake_up_process(state->task);
Expand Down Expand Up @@ -173,7 +173,8 @@ static void cryptd_blkcipher_exit_tfm(struct crypto_tfm *tfm)
int active;

mutex_lock(&state->mutex);
active = ablkcipher_tfm_in_queue(__crypto_ablkcipher_cast(tfm));
active = ablkcipher_tfm_in_queue(&state->queue,
__crypto_ablkcipher_cast(tfm));
mutex_unlock(&state->mutex);

BUG_ON(active);
Expand Down Expand Up @@ -251,8 +252,6 @@ static struct crypto_instance *cryptd_alloc_blkcipher(
inst->alg.cra_ablkcipher.encrypt = cryptd_blkcipher_encrypt_enqueue;
inst->alg.cra_ablkcipher.decrypt = cryptd_blkcipher_decrypt_enqueue;

inst->alg.cra_ablkcipher.queue = &state->queue;

out_put_alg:
crypto_mod_put(alg);
return inst;
Expand Down
14 changes: 7 additions & 7 deletions include/crypto/algapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,27 +234,27 @@ static inline struct crypto_async_request *crypto_get_backlog(
container_of(queue->backlog, struct crypto_async_request, list);
}

static inline int ablkcipher_enqueue_request(struct ablkcipher_alg *alg,
static inline int ablkcipher_enqueue_request(struct crypto_queue *queue,
struct ablkcipher_request *request)
{
return crypto_enqueue_request(alg->queue, &request->base);
return crypto_enqueue_request(queue, &request->base);
}

static inline struct ablkcipher_request *ablkcipher_dequeue_request(
struct ablkcipher_alg *alg)
struct crypto_queue *queue)
{
return ablkcipher_request_cast(crypto_dequeue_request(alg->queue));
return ablkcipher_request_cast(crypto_dequeue_request(queue));
}

static inline void *ablkcipher_request_ctx(struct ablkcipher_request *req)
{
return req->__ctx;
}

static inline int ablkcipher_tfm_in_queue(struct crypto_ablkcipher *tfm)
static inline int ablkcipher_tfm_in_queue(struct crypto_queue *queue,
struct crypto_ablkcipher *tfm)
{
return crypto_tfm_in_queue(crypto_ablkcipher_alg(tfm)->queue,
crypto_ablkcipher_tfm(tfm));
return crypto_tfm_in_queue(queue, crypto_ablkcipher_tfm(tfm));
}

#endif /* _CRYPTO_ALGAPI_H */
Expand Down
3 changes: 0 additions & 3 deletions include/linux/crypto.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ struct crypto_async_request;
struct crypto_aead;
struct crypto_blkcipher;
struct crypto_hash;
struct crypto_queue;
struct crypto_tfm;
struct crypto_type;

Expand Down Expand Up @@ -178,8 +177,6 @@ struct ablkcipher_alg {
int (*encrypt)(struct ablkcipher_request *req);
int (*decrypt)(struct ablkcipher_request *req);

struct crypto_queue *queue;

unsigned int min_keysize;
unsigned int max_keysize;
unsigned int ivsize;
Expand Down

0 comments on commit 2de98e7

Please sign in to comment.