Commit b286d8b1 authored by Herbert Xu's avatar Herbert Xu

crypto: skcipher - Add skcipher walk interface

This patch adds the skcipher walk interface which replaces both
blkcipher walk and ablkcipher walk.  Just like blkcipher walk it
can also be used for AEAD algorithms.
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 7cf31864
This diff is collapsed.
...@@ -15,8 +15,10 @@ ...@@ -15,8 +15,10 @@
#include <crypto/algapi.h> #include <crypto/algapi.h>
#include <crypto/skcipher.h> #include <crypto/skcipher.h>
#include <linux/list.h>
#include <linux/types.h> #include <linux/types.h>
struct aead_request;
struct rtattr; struct rtattr;
struct skcipher_instance { struct skcipher_instance {
...@@ -34,6 +36,40 @@ struct crypto_skcipher_spawn { ...@@ -34,6 +36,40 @@ struct crypto_skcipher_spawn {
struct crypto_spawn base; struct crypto_spawn base;
}; };
struct skcipher_walk {
union {
struct {
struct page *page;
unsigned long offset;
} phys;
struct {
u8 *page;
void *addr;
} virt;
} src, dst;
struct scatter_walk in;
unsigned int nbytes;
struct scatter_walk out;
unsigned int total;
struct list_head buffers;
u8 *page;
u8 *buffer;
u8 *oiv;
void *iv;
unsigned int ivsize;
int flags;
unsigned int blocksize;
unsigned int chunksize;
unsigned int alignmask;
};
extern const struct crypto_type crypto_givcipher_type; extern const struct crypto_type crypto_givcipher_type;
static inline struct crypto_instance *skcipher_crypto_instance( static inline struct crypto_instance *skcipher_crypto_instance(
...@@ -104,6 +140,17 @@ void crypto_unregister_skciphers(struct skcipher_alg *algs, int count); ...@@ -104,6 +140,17 @@ void crypto_unregister_skciphers(struct skcipher_alg *algs, int count);
int skcipher_register_instance(struct crypto_template *tmpl, int skcipher_register_instance(struct crypto_template *tmpl,
struct skcipher_instance *inst); struct skcipher_instance *inst);
int skcipher_walk_done(struct skcipher_walk *walk, int err);
int skcipher_walk_virt(struct skcipher_walk *walk,
struct skcipher_request *req,
bool atomic);
void skcipher_walk_atomise(struct skcipher_walk *walk);
int skcipher_walk_async(struct skcipher_walk *walk,
struct skcipher_request *req);
int skcipher_walk_aead(struct skcipher_walk *walk, struct aead_request *req,
bool atomic);
void skcipher_walk_complete(struct skcipher_walk *walk, int err);
static inline void ablkcipher_request_complete(struct ablkcipher_request *req, static inline void ablkcipher_request_complete(struct ablkcipher_request *req,
int err) int err)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment