linux/drivers/crypto/padlock-aes.c

// SPDX-License-Identifier: GPL-2.0-only
/* 
 * Cryptographic API.
 *
 * Support for VIA PadLock hardware crypto engine.
 *
 * Copyright (c) 2004  Michal Ludvig <[email protected]>
 *
 */

#include <crypto/algapi.h>
#include <crypto/aes.h>
#include <crypto/internal/skcipher.h>
#include <crypto/padlock.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/interrupt.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/percpu.h>
#include <linux/smp.h>
#include <linux/slab.h>
#include <asm/cpu_device_id.h>
#include <asm/byteorder.h>
#include <asm/processor.h>
#include <asm/fpu/api.h>

/*
 * Number of data blocks actually fetched for each xcrypt insn.
 * Processors with prefetch errata will fetch extra blocks.
 */
static unsigned int ecb_fetch_blocks =;
#define MAX_ECB_FETCH_BLOCKS
#define ecb_fetch_bytes

static unsigned int cbc_fetch_blocks =;
#define MAX_CBC_FETCH_BLOCKS
#define cbc_fetch_bytes

/* Control word. */
struct cword {} __attribute__ ((__aligned__));

/* Whenever making any changes to the following
 * structure *make sure* you keep E, d_data
 * and cword aligned on 16 Bytes boundaries and
 * the Hardware can access 16 * 16 bytes of E and d_data
 * (only the first 15 * 16 bytes matter but the HW reads
 * more).
 */
struct aes_ctx {};

static DEFINE_PER_CPU(struct cword *, paes_last_cword);

/* Tells whether the ACE is capable to generate
   the extended key for a given key_len. */
static inline int
aes_hw_extkey_available(uint8_t key_len)
{}

static inline struct aes_ctx *aes_ctx_common(void *ctx)
{}

static inline struct aes_ctx *aes_ctx(struct crypto_tfm *tfm)
{}

static inline struct aes_ctx *skcipher_aes_ctx(struct crypto_skcipher *tfm)
{}

static int aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
		       unsigned int key_len)
{}

static int aes_set_key_skcipher(struct crypto_skcipher *tfm, const u8 *in_key,
				unsigned int key_len)
{}

/* ====== Encryption/decryption routines ====== */

/* These are the real call to PadLock. */
static inline void padlock_reset_key(struct cword *cword)
{}

static inline void padlock_store_cword(struct cword *cword)
{}

/*
 * While the padlock instructions don't use FP/SSE registers, they
 * generate a spurious DNA fault when CR0.TS is '1'.  Fortunately,
 * the kernel doesn't use CR0.TS.
 */

static inline void rep_xcrypt_ecb(const u8 *input, u8 *output, void *key,
				  struct cword *control_word, int count)
{}

static inline u8 *rep_xcrypt_cbc(const u8 *input, u8 *output, void *key,
				 u8 *iv, struct cword *control_word, int count)
{}

static void ecb_crypt_copy(const u8 *in, u8 *out, u32 *key,
			   struct cword *cword, int count)
{}

static u8 *cbc_crypt_copy(const u8 *in, u8 *out, u32 *key,
			   u8 *iv, struct cword *cword, int count)
{}

static inline void ecb_crypt(const u8 *in, u8 *out, u32 *key,
			     struct cword *cword, int count)
{}

static inline u8 *cbc_crypt(const u8 *in, u8 *out, u32 *key,
			    u8 *iv, struct cword *cword, int count)
{}

static inline void padlock_xcrypt_ecb(const u8 *input, u8 *output, void *key,
				      void *control_word, u32 count)
{}

static inline u8 *padlock_xcrypt_cbc(const u8 *input, u8 *output, void *key,
				     u8 *iv, void *control_word, u32 count)
{}

static void padlock_aes_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
{}

static void padlock_aes_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
{}

static struct crypto_alg aes_alg =;

static int ecb_aes_encrypt(struct skcipher_request *req)
{}

static int ecb_aes_decrypt(struct skcipher_request *req)
{}

static struct skcipher_alg ecb_aes_alg =;

static int cbc_aes_encrypt(struct skcipher_request *req)
{}

static int cbc_aes_decrypt(struct skcipher_request *req)
{}

static struct skcipher_alg cbc_aes_alg =;

static const struct x86_cpu_id padlock_cpu_id[] =;
MODULE_DEVICE_TABLE(x86cpu, padlock_cpu_id);

static int __init padlock_init(void)
{}

static void __exit padlock_fini(void)
{}

module_init();
module_exit(padlock_fini);

MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_AUTHOR();

MODULE_ALIAS_CRYPTO();