#include <crypto/internal/aead.h>
#include <crypto/internal/skcipher.h>
#include <crypto/scatterwalk.h>
#include <linux/cryptouser.h>
#include <linux/compiler.h>
#include <linux/module.h>
#include <linux/rtnetlink.h>
#include <linux/seq_file.h>
SKCIPHER_WALK_PHYS = 1 << 0,
SKCIPHER_WALK_SLOW = 1 << 1,
SKCIPHER_WALK_COPY = 1 << 2,
SKCIPHER_WALK_DIFF = 1 << 3,
SKCIPHER_WALK_SLEEP = 1 << 4,
struct skcipher_walk_buffer {
static int skcipher_walk_next(struct skcipher_walk *walk);
static inline void skcipher_unmap(struct scatter_walk *walk, void *vaddr)
if (PageHighMem(scatterwalk_page(walk)))
static inline void *skcipher_map(struct scatter_walk *walk)
struct page *page = scatterwalk_page(walk);
return (PageHighMem(page) ? kmap_atomic(page) : page_address(page)) +
offset_in_page(walk->offset);
static inline void skcipher_map_src(struct skcipher_walk *walk)
walk->src.virt.addr = skcipher_map(&walk->in);
static inline void skcipher_map_dst(struct skcipher_walk *walk)
walk->dst.virt.addr = skcipher_map(&walk->out);
static inline void skcipher_unmap_src(struct skcipher_walk *walk)
skcipher_unmap(&walk->in, walk->src.virt.addr);
static inline void skcipher_unmap_dst(struct skcipher_walk *walk)
skcipher_unmap(&walk->out, walk->dst.virt.addr);
static inline gfp_t skcipher_walk_gfp(struct skcipher_walk *walk)
return walk->flags & SKCIPHER_WALK_SLEEP ? GFP_KERNEL : GFP_ATOMIC;
static inline u8 *skcipher_get_spot(u8 *start, unsigned int len)
u8 *end_page = (u8 *)(((unsigned long)(start + len - 1)) & PAGE_MASK);
return max(start, end_page);