crypto: aead - Add aead_queue interface
This patch adds a type-safe queueing interface for AEAD. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
31d228cc64
commit
2c11a3f970
@ -34,6 +34,10 @@ struct crypto_aead_spawn {
|
|||||||
struct crypto_spawn base;
|
struct crypto_spawn base;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct aead_queue {
|
||||||
|
struct crypto_queue base;
|
||||||
|
};
|
||||||
|
|
||||||
extern const struct crypto_type crypto_aead_type;
|
extern const struct crypto_type crypto_aead_type;
|
||||||
extern const struct crypto_type crypto_nivaead_type;
|
extern const struct crypto_type crypto_nivaead_type;
|
||||||
|
|
||||||
@ -157,6 +161,37 @@ static inline unsigned int crypto_aead_maxauthsize(struct crypto_aead *aead)
|
|||||||
return crypto_aead_alg_maxauthsize(crypto_aead_alg(aead));
|
return crypto_aead_alg_maxauthsize(crypto_aead_alg(aead));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void aead_init_queue(struct aead_queue *queue,
|
||||||
|
unsigned int max_qlen)
|
||||||
|
{
|
||||||
|
crypto_init_queue(&queue->base, max_qlen);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int aead_enqueue_request(struct aead_queue *queue,
|
||||||
|
struct aead_request *request)
|
||||||
|
{
|
||||||
|
return crypto_enqueue_request(&queue->base, &request->base);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct aead_request *aead_dequeue_request(
|
||||||
|
struct aead_queue *queue)
|
||||||
|
{
|
||||||
|
struct crypto_async_request *req;
|
||||||
|
|
||||||
|
req = crypto_dequeue_request(&queue->base);
|
||||||
|
|
||||||
|
return req ? container_of(req, struct aead_request, base) : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline struct aead_request *aead_get_backlog(struct aead_queue *queue)
|
||||||
|
{
|
||||||
|
struct crypto_async_request *req;
|
||||||
|
|
||||||
|
req = crypto_get_backlog(&queue->base);
|
||||||
|
|
||||||
|
return req ? container_of(req, struct aead_request, base) : NULL;
|
||||||
|
}
|
||||||
|
|
||||||
int crypto_register_aead(struct aead_alg *alg);
|
int crypto_register_aead(struct aead_alg *alg);
|
||||||
void crypto_unregister_aead(struct aead_alg *alg);
|
void crypto_unregister_aead(struct aead_alg *alg);
|
||||||
int crypto_register_aeads(struct aead_alg *algs, int count);
|
int crypto_register_aeads(struct aead_alg *algs, int count);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user