linux/crypto/lskcipher.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Linear symmetric key cipher operations.
 *
 * Generic encrypt/decrypt wrapper for ciphers.
 *
 * Copyright (c) 2023 Herbert Xu <[email protected]>
 */

#include <linux/cryptouser.h>
#include <linux/err.h>
#include <linux/export.h>
#include <linux/kernel.h>
#include <linux/seq_file.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <net/netlink.h>
#include "skcipher.h"

static inline struct crypto_lskcipher *__crypto_lskcipher_cast(
	struct crypto_tfm *tfm)
{}

static inline struct lskcipher_alg *__crypto_lskcipher_alg(
	struct crypto_alg *alg)
{}

static int lskcipher_setkey_unaligned(struct crypto_lskcipher *tfm,
				      const u8 *key, unsigned int keylen)
{}

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

static int crypto_lskcipher_crypt_unaligned(
	struct crypto_lskcipher *tfm, const u8 *src, u8 *dst, unsigned len,
	u8 *iv, int (*crypt)(struct crypto_lskcipher *tfm, const u8 *src,
			     u8 *dst, unsigned len, u8 *iv, u32 flags))
{}

static int crypto_lskcipher_crypt(struct crypto_lskcipher *tfm, const u8 *src,
				  u8 *dst, unsigned len, u8 *iv,
				  int (*crypt)(struct crypto_lskcipher *tfm,
					       const u8 *src, u8 *dst,
					       unsigned len, u8 *iv,
					       u32 flags))
{}

int crypto_lskcipher_encrypt(struct crypto_lskcipher *tfm, const u8 *src,
			     u8 *dst, unsigned len, u8 *iv)
{}
EXPORT_SYMBOL_GPL();

int crypto_lskcipher_decrypt(struct crypto_lskcipher *tfm, const u8 *src,
			     u8 *dst, unsigned len, u8 *iv)
{}
EXPORT_SYMBOL_GPL();

static int crypto_lskcipher_crypt_sg(struct skcipher_request *req,
				     int (*crypt)(struct crypto_lskcipher *tfm,
						  const u8 *src, u8 *dst,
						  unsigned len, u8 *ivs,
						  u32 flags))
{}

int crypto_lskcipher_encrypt_sg(struct skcipher_request *req)
{}

int crypto_lskcipher_decrypt_sg(struct skcipher_request *req)
{}

static void crypto_lskcipher_exit_tfm(struct crypto_tfm *tfm)
{}

static int crypto_lskcipher_init_tfm(struct crypto_tfm *tfm)
{}

static void crypto_lskcipher_free_instance(struct crypto_instance *inst)
{}

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

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

static const struct crypto_type crypto_lskcipher_type =;

static void crypto_lskcipher_exit_tfm_sg(struct crypto_tfm *tfm)
{}

int crypto_init_lskcipher_ops_sg(struct crypto_tfm *tfm)
{}

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

struct crypto_lskcipher *crypto_alloc_lskcipher(const char *alg_name,
						u32 type, u32 mask)
{}
EXPORT_SYMBOL_GPL();

static int lskcipher_prepare_alg(struct lskcipher_alg *alg)
{}

int crypto_register_lskcipher(struct lskcipher_alg *alg)
{}
EXPORT_SYMBOL_GPL();

void crypto_unregister_lskcipher(struct lskcipher_alg *alg)
{}
EXPORT_SYMBOL_GPL();

int crypto_register_lskciphers(struct lskcipher_alg *algs, int count)
{}
EXPORT_SYMBOL_GPL();

void crypto_unregister_lskciphers(struct lskcipher_alg *algs, int count)
{}
EXPORT_SYMBOL_GPL();

int lskcipher_register_instance(struct crypto_template *tmpl,
				struct lskcipher_instance *inst)
{}
EXPORT_SYMBOL_GPL();

static int lskcipher_setkey_simple(struct crypto_lskcipher *tfm, const u8 *key,
				   unsigned int keylen)
{}

static int lskcipher_init_tfm_simple(struct crypto_lskcipher *tfm)
{}

static void lskcipher_exit_tfm_simple(struct crypto_lskcipher *tfm)
{}

static void lskcipher_free_instance_simple(struct lskcipher_instance *inst)
{}

/**
 * lskcipher_alloc_instance_simple - allocate instance of simple block cipher
 *
 * Allocate an lskcipher_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
 * struct crypto_lskcipher *, 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 lskcipher_instance *lskcipher_alloc_instance_simple(
	struct crypto_template *tmpl, struct rtattr **tb)
{}
EXPORT_SYMBOL_GPL();