linux/crypto/skcipher.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Symmetric key cipher operations.
 *
 * Generic encrypt/decrypt wrapper for ciphers, handles operations across
 * multiple page boundaries by using temporary blocks.  In user context,
 * the kernel is given a chance to schedule us once per page.
 *
 * Copyright (c) 2015 Herbert Xu <[email protected]>
 */

#include <crypto/internal/aead.h>
#include <crypto/internal/cipher.h>
#include <crypto/internal/skcipher.h>
#include <crypto/scatterwalk.h>
#include <linux/bug.h>
#include <linux/cryptouser.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <net/netlink.h>
#include "skcipher.h"

#define CRYPTO_ALG_TYPE_SKCIPHER_MASK

enum {};

struct skcipher_walk_buffer {};

static const struct crypto_type crypto_skcipher_type;

static int skcipher_walk_next(struct skcipher_walk *walk);

static inline void skcipher_map_src(struct skcipher_walk *walk)
{}

static inline void skcipher_map_dst(struct skcipher_walk *walk)
{}

static inline void skcipher_unmap_src(struct skcipher_walk *walk)
{}

static inline void skcipher_unmap_dst(struct skcipher_walk *walk)
{}

static inline gfp_t skcipher_walk_gfp(struct skcipher_walk *walk)
{}

/* Get a spot of the specified length that does not straddle a page.
 * The caller needs to ensure that there is enough space for this operation.
 */
static inline u8 *skcipher_get_spot(u8 *start, unsigned int len)
{}

static inline struct skcipher_alg *__crypto_skcipher_alg(
	struct crypto_alg *alg)
{}

static int skcipher_done_slow(struct skcipher_walk *walk, unsigned int bsize)
{}

int skcipher_walk_done(struct skcipher_walk *walk, int err)
{}
EXPORT_SYMBOL_GPL();

void skcipher_walk_complete(struct skcipher_walk *walk, int err)
{}
EXPORT_SYMBOL_GPL();

static void skcipher_queue_write(struct skcipher_walk *walk,
				 struct skcipher_walk_buffer *p)
{}

static int skcipher_next_slow(struct skcipher_walk *walk, unsigned int bsize)
{}

static int skcipher_next_copy(struct skcipher_walk *walk)
{}

static int skcipher_next_fast(struct skcipher_walk *walk)
{}

static int skcipher_walk_next(struct skcipher_walk *walk)
{}

static int skcipher_copy_iv(struct skcipher_walk *walk)
{}

static int skcipher_walk_first(struct skcipher_walk *walk)
{}

static int skcipher_walk_skcipher(struct skcipher_walk *walk,
				  struct skcipher_request *req)
{}

int skcipher_walk_virt(struct skcipher_walk *walk,
		       struct skcipher_request *req, bool atomic)
{}
EXPORT_SYMBOL_GPL();

int skcipher_walk_async(struct skcipher_walk *walk,
			struct skcipher_request *req)
{}
EXPORT_SYMBOL_GPL();

static int skcipher_walk_aead_common(struct skcipher_walk *walk,
				     struct aead_request *req, bool atomic)
{}

int skcipher_walk_aead_encrypt(struct skcipher_walk *walk,
			       struct aead_request *req, bool atomic)
{}
EXPORT_SYMBOL_GPL();

int skcipher_walk_aead_decrypt(struct skcipher_walk *walk,
			       struct aead_request *req, bool atomic)
{}
EXPORT_SYMBOL_GPL();

static void skcipher_set_needkey(struct crypto_skcipher *tfm)
{}

static int skcipher_setkey_unaligned(struct crypto_skcipher *tfm,
				     const u8 *key, unsigned int keylen)
{}

int crypto_skcipher_setkey(struct crypto_skcipher *tfm, const u8 *key,
			   unsigned int keylen)
{}
EXPORT_SYMBOL_GPL();

int crypto_skcipher_encrypt(struct skcipher_request *req)
{}
EXPORT_SYMBOL_GPL();

int crypto_skcipher_decrypt(struct skcipher_request *req)
{}
EXPORT_SYMBOL_GPL();

static int crypto_lskcipher_export(struct skcipher_request *req, void *out)
{}

static int crypto_lskcipher_import(struct skcipher_request *req, const void *in)
{}

static int skcipher_noexport(struct skcipher_request *req, void *out)
{}

static int skcipher_noimport(struct skcipher_request *req, const void *in)
{}

int crypto_skcipher_export(struct skcipher_request *req, void *out)
{}
EXPORT_SYMBOL_GPL();

int crypto_skcipher_import(struct skcipher_request *req, const void *in)
{}
EXPORT_SYMBOL_GPL();

static void crypto_skcipher_exit_tfm(struct crypto_tfm *tfm)
{}

static int crypto_skcipher_init_tfm(struct crypto_tfm *tfm)
{}

static unsigned int crypto_skcipher_extsize(struct crypto_alg *alg)
{}

static void crypto_skcipher_free_instance(struct crypto_instance *inst)
{}

static void crypto_skcipher_show(struct seq_file *m, struct crypto_alg *alg)
	__maybe_unused;
static void crypto_skcipher_show(struct seq_file *m, struct crypto_alg *alg)
{}

static int __maybe_unused crypto_skcipher_report(
	struct sk_buff *skb, struct crypto_alg *alg)
{}

static const struct crypto_type crypto_skcipher_type =;

int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn,
			 struct crypto_instance *inst,
			 const char *name, u32 type, u32 mask)
{}
EXPORT_SYMBOL_GPL();

struct crypto_skcipher *crypto_alloc_skcipher(const char *alg_name,
					      u32 type, u32 mask)
{}
EXPORT_SYMBOL_GPL();

struct crypto_sync_skcipher *crypto_alloc_sync_skcipher(
				const char *alg_name, u32 type, u32 mask)
{}
EXPORT_SYMBOL_GPL();

int crypto_has_skcipher(const char *alg_name, u32 type, u32 mask)
{}
EXPORT_SYMBOL_GPL();

int skcipher_prepare_alg_common(struct skcipher_alg_common *alg)
{}

static int skcipher_prepare_alg(struct skcipher_alg *alg)
{}

int crypto_register_skcipher(struct skcipher_alg *alg)
{}
EXPORT_SYMBOL_GPL();

void crypto_unregister_skcipher(struct skcipher_alg *alg)
{}
EXPORT_SYMBOL_GPL();

int crypto_register_skciphers(struct skcipher_alg *algs, int count)
{}
EXPORT_SYMBOL_GPL();

void crypto_unregister_skciphers(struct skcipher_alg *algs, int count)
{}
EXPORT_SYMBOL_GPL();

int skcipher_register_instance(struct crypto_template *tmpl,
			   struct skcipher_instance *inst)
{}
EXPORT_SYMBOL_GPL();

static int skcipher_setkey_simple(struct crypto_skcipher *tfm, const u8 *key,
				  unsigned int keylen)
{}

static int skcipher_init_tfm_simple(struct crypto_skcipher *tfm)
{}

static void skcipher_exit_tfm_simple(struct crypto_skcipher *tfm)
{}

static void skcipher_free_instance_simple(struct skcipher_instance *inst)
{}

/**
 * skcipher_alloc_instance_simple - allocate instance of simple block cipher mode
 *
 * Allocate an skcipher_instance for a simple block cipher mode of operation,
 * e.g. cbc or ecb.  The instance context will have just a single crypto_spawn,
 * that for the underlying cipher.  The {min,max}_keysize, ivsize, blocksize,
 * alignmask, and priority are set from the underlying cipher but can be
 * overridden if needed.  The tfm context defaults to skcipher_ctx_simple, and
 * default ->setkey(), ->init(), and ->exit() methods are installed.
 *
 * @tmpl: the template being instantiated
 * @tb: the template parameters
 *
 * Return: a pointer to the new instance, or an ERR_PTR().  The caller still
 *	   needs to register the instance.
 */
struct skcipher_instance *skcipher_alloc_instance_simple(
	struct crypto_template *tmpl, struct rtattr **tb)
{}
EXPORT_SYMBOL_GPL();

MODULE_LICENSE();
MODULE_DESCRIPTION();
MODULE_IMPORT_NS();