Skip to content

Commit 2de98e7

Browse files
herbertxDavid S. Miller
authored andcommitted
[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>
1 parent 791b4d5 commit 2de98e7

4 files changed

Lines changed: 10 additions & 18 deletions

File tree

‎crypto/ablkcipher.c‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,6 @@ static void crypto_ablkcipher_show(struct seq_file *m, struct crypto_alg *alg)
9494
seq_printf(m, "min keysize : %u\n", ablkcipher->min_keysize);
9595
seq_printf(m, "max keysize : %u\n", ablkcipher->max_keysize);
9696
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-
}
10197
}
10298

10399
const struct crypto_type crypto_ablkcipher_type = {

‎crypto/cryptd.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ static int cryptd_blkcipher_enqueue(struct ablkcipher_request *req,
131131
req->base.complete = complete;
132132

133133
spin_lock_bh(&state->lock);
134-
err = ablkcipher_enqueue_request(crypto_ablkcipher_alg(tfm), req);
134+
err = ablkcipher_enqueue_request(&state->queue, req);
135135
spin_unlock_bh(&state->lock);
136136

137137
wake_up_process(state->task);
@@ -173,7 +173,8 @@ static void cryptd_blkcipher_exit_tfm(struct crypto_tfm *tfm)
173173
int active;
174174

175175
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));
177178
mutex_unlock(&state->mutex);
178179

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

254-
inst->alg.cra_ablkcipher.queue = &state->queue;
255-
256255
out_put_alg:
257256
crypto_mod_put(alg);
258257
return inst;

‎include/crypto/algapi.h‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -234,27 +234,27 @@ static inline struct crypto_async_request *crypto_get_backlog(
234234
container_of(queue->backlog, struct crypto_async_request, list);
235235
}
236236

237-
static inline int ablkcipher_enqueue_request(struct ablkcipher_alg *alg,
237+
static inline int ablkcipher_enqueue_request(struct crypto_queue *queue,
238238
struct ablkcipher_request *request)
239239
{
240-
return crypto_enqueue_request(alg->queue, &request->base);
240+
return crypto_enqueue_request(queue, &request->base);
241241
}
242242

243243
static inline struct ablkcipher_request *ablkcipher_dequeue_request(
244-
struct ablkcipher_alg *alg)
244+
struct crypto_queue *queue)
245245
{
246-
return ablkcipher_request_cast(crypto_dequeue_request(alg->queue));
246+
return ablkcipher_request_cast(crypto_dequeue_request(queue));
247247
}
248248

249249
static inline void *ablkcipher_request_ctx(struct ablkcipher_request *req)
250250
{
251251
return req->__ctx;
252252
}
253253

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)
255256
{
256-
return crypto_tfm_in_queue(crypto_ablkcipher_alg(tfm)->queue,
257-
crypto_ablkcipher_tfm(tfm));
257+
return crypto_tfm_in_queue(queue, crypto_ablkcipher_tfm(tfm));
258258
}
259259

260260
#endif /* _CRYPTO_ALGAPI_H */

‎include/linux/crypto.h‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ struct crypto_async_request;
9595
struct crypto_aead;
9696
struct crypto_blkcipher;
9797
struct crypto_hash;
98-
struct crypto_queue;
9998
struct crypto_tfm;
10099
struct crypto_type;
101100

@@ -178,8 +177,6 @@ struct ablkcipher_alg {
178177
int (*encrypt)(struct ablkcipher_request *req);
179178
int (*decrypt)(struct ablkcipher_request *req);
180179

181-
struct crypto_queue *queue;
182-
183180
unsigned int min_keysize;
184181
unsigned int max_keysize;
185182
unsigned int ivsize;

0 commit comments

Comments
 (0)