mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 07:47:50 +00:00
Revert "crypto: scatterwalk - Move skcipher walk and use it for memcpy_sglist"
This reverts commit 0f8d42bf12, with the
memcpy_sglist() part dropped.
Now that memcpy_sglist() no longer uses the skcipher_walk code, the
skcipher_walk code can be moved back to where it belongs.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@@ -107,6 +107,18 @@ struct crypto_queue {
|
||||
unsigned int max_qlen;
|
||||
};
|
||||
|
||||
struct scatter_walk {
|
||||
/* Must be the first member, see struct skcipher_walk. */
|
||||
union {
|
||||
void *const addr;
|
||||
|
||||
/* Private API field, do not touch. */
|
||||
union crypto_no_such_thing *__addr;
|
||||
};
|
||||
struct scatterlist *sg;
|
||||
unsigned int offset;
|
||||
};
|
||||
|
||||
struct crypto_attr_alg {
|
||||
char name[CRYPTO_MAX_ALG_NAME];
|
||||
};
|
||||
|
||||
@@ -10,7 +10,6 @@
|
||||
|
||||
#include <crypto/algapi.h>
|
||||
#include <crypto/internal/cipher.h>
|
||||
#include <crypto/scatterwalk.h>
|
||||
#include <crypto/skcipher.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
@@ -55,6 +54,47 @@ struct crypto_lskcipher_spawn {
|
||||
struct crypto_spawn base;
|
||||
};
|
||||
|
||||
struct skcipher_walk {
|
||||
union {
|
||||
/* Virtual address of the source. */
|
||||
struct {
|
||||
struct {
|
||||
const void *const addr;
|
||||
} virt;
|
||||
} src;
|
||||
|
||||
/* Private field for the API, do not use. */
|
||||
struct scatter_walk in;
|
||||
};
|
||||
|
||||
union {
|
||||
/* Virtual address of the destination. */
|
||||
struct {
|
||||
struct {
|
||||
void *const addr;
|
||||
} virt;
|
||||
} dst;
|
||||
|
||||
/* Private field for the API, do not use. */
|
||||
struct scatter_walk out;
|
||||
};
|
||||
|
||||
unsigned int nbytes;
|
||||
unsigned int total;
|
||||
|
||||
u8 *page;
|
||||
u8 *buffer;
|
||||
u8 *oiv;
|
||||
void *iv;
|
||||
|
||||
unsigned int ivsize;
|
||||
|
||||
int flags;
|
||||
unsigned int blocksize;
|
||||
unsigned int stride;
|
||||
unsigned int alignmask;
|
||||
};
|
||||
|
||||
static inline struct crypto_instance *skcipher_crypto_instance(
|
||||
struct skcipher_instance *inst)
|
||||
{
|
||||
@@ -171,6 +211,7 @@ void crypto_unregister_lskciphers(struct lskcipher_alg *algs, int count);
|
||||
int lskcipher_register_instance(struct crypto_template *tmpl,
|
||||
struct lskcipher_instance *inst);
|
||||
|
||||
int skcipher_walk_done(struct skcipher_walk *walk, int res);
|
||||
int skcipher_walk_virt(struct skcipher_walk *__restrict walk,
|
||||
struct skcipher_request *__restrict req,
|
||||
bool atomic);
|
||||
@@ -181,6 +222,11 @@ int skcipher_walk_aead_decrypt(struct skcipher_walk *__restrict walk,
|
||||
struct aead_request *__restrict req,
|
||||
bool atomic);
|
||||
|
||||
static inline void skcipher_walk_abort(struct skcipher_walk *walk)
|
||||
{
|
||||
skcipher_walk_done(walk, -ECANCELED);
|
||||
}
|
||||
|
||||
static inline void *crypto_skcipher_ctx(struct crypto_skcipher *tfm)
|
||||
{
|
||||
return crypto_tfm_ctx(&tfm->base);
|
||||
|
||||
@@ -11,64 +11,11 @@
|
||||
#ifndef _CRYPTO_SCATTERWALK_H
|
||||
#define _CRYPTO_SCATTERWALK_H
|
||||
|
||||
#include <linux/errno.h>
|
||||
#include <crypto/algapi.h>
|
||||
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/scatterlist.h>
|
||||
#include <linux/types.h>
|
||||
|
||||
struct scatter_walk {
|
||||
/* Must be the first member, see struct skcipher_walk. */
|
||||
union {
|
||||
void *const addr;
|
||||
|
||||
/* Private API field, do not touch. */
|
||||
union crypto_no_such_thing *__addr;
|
||||
};
|
||||
struct scatterlist *sg;
|
||||
unsigned int offset;
|
||||
};
|
||||
|
||||
struct skcipher_walk {
|
||||
union {
|
||||
/* Virtual address of the source. */
|
||||
struct {
|
||||
struct {
|
||||
const void *const addr;
|
||||
} virt;
|
||||
} src;
|
||||
|
||||
/* Private field for the API, do not use. */
|
||||
struct scatter_walk in;
|
||||
};
|
||||
|
||||
union {
|
||||
/* Virtual address of the destination. */
|
||||
struct {
|
||||
struct {
|
||||
void *const addr;
|
||||
} virt;
|
||||
} dst;
|
||||
|
||||
/* Private field for the API, do not use. */
|
||||
struct scatter_walk out;
|
||||
};
|
||||
|
||||
unsigned int nbytes;
|
||||
unsigned int total;
|
||||
|
||||
u8 *page;
|
||||
u8 *buffer;
|
||||
u8 *oiv;
|
||||
void *iv;
|
||||
|
||||
unsigned int ivsize;
|
||||
|
||||
int flags;
|
||||
unsigned int blocksize;
|
||||
unsigned int stride;
|
||||
unsigned int alignmask;
|
||||
};
|
||||
|
||||
static inline void scatterwalk_crypto_chain(struct scatterlist *head,
|
||||
struct scatterlist *sg, int num)
|
||||
@@ -306,12 +253,4 @@ struct scatterlist *scatterwalk_ffwd(struct scatterlist dst[2],
|
||||
struct scatterlist *src,
|
||||
unsigned int len);
|
||||
|
||||
int skcipher_walk_first(struct skcipher_walk *walk, bool atomic);
|
||||
int skcipher_walk_done(struct skcipher_walk *walk, int res);
|
||||
|
||||
static inline void skcipher_walk_abort(struct skcipher_walk *walk)
|
||||
{
|
||||
skcipher_walk_done(walk, -ECANCELED);
|
||||
}
|
||||
|
||||
#endif /* _CRYPTO_SCATTERWALK_H */
|
||||
|
||||
Reference in New Issue
Block a user