linux/crypto/tcrypt.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Quick & dirty crypto testing module.
 *
 * This will only exist until we have a better testing mechanism
 * (e.g. a char device).
 *
 * Copyright (c) 2002 James Morris <[email protected]>
 * Copyright (c) 2002 Jean-Francois Dive <[email protected]>
 * Copyright (c) 2007 Nokia Siemens Networks
 *
 * Updated RFC4106 AES-GCM testing.
 *    Authors: Aidan O'Mahony ([email protected])
 *             Adrian Hoban <[email protected]>
 *             Gabriele Paoloni <[email protected]>
 *             Tadeusz Struk ([email protected])
 *             Copyright (c) 2010, Intel Corporation.
 */

#define pr_fmt(fmt)

#include <crypto/aead.h>
#include <crypto/hash.h>
#include <crypto/skcipher.h>
#include <linux/err.h>
#include <linux/fips.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/jiffies.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/scatterlist.h>
#include <linux/slab.h>
#include <linux/string.h>
#include <linux/timex.h>

#include "internal.h"
#include "tcrypt.h"

/*
 * Need slab memory for testing (size in number of pages).
 */
#define TVMEMSIZE

/*
* Used by test_cipher_speed()
*/
#define ENCRYPT
#define DECRYPT

#define MAX_DIGEST_SIZE

/*
 * return a string with the driver name
 */
#define get_driver_name(tfm_type, tfm)

/*
 * Used by test_cipher_speed()
 */
static unsigned int sec;

static char *alg;
static u32 type;
static u32 mask;
static int mode;
static u32 num_mb =;
static unsigned int klen;
static char *tvmem[TVMEMSIZE];

static const int block_sizes[] =;
static const int aead_sizes[] =;

#define XBUFSIZE
#define MAX_IVLEN

static int testmgr_alloc_buf(char *buf[XBUFSIZE])
{}

static void testmgr_free_buf(char *buf[XBUFSIZE])
{}

static void sg_init_aead(struct scatterlist *sg, char *xbuf[XBUFSIZE],
			 unsigned int buflen, const void *assoc,
			 unsigned int aad_size)
{}

static inline int do_one_aead_op(struct aead_request *req, int ret)
{}

struct test_mb_aead_data {};

static int do_mult_aead_op(struct test_mb_aead_data *data, int enc,
				u32 num_mb, int *rc)
{}

static int test_mb_aead_jiffies(struct test_mb_aead_data *data, int enc,
				int blen, int secs, u32 num_mb)
{}

static int test_mb_aead_cycles(struct test_mb_aead_data *data, int enc,
			       int blen, u32 num_mb)
{}

static void test_mb_aead_speed(const char *algo, int enc, int secs,
			       struct aead_speed_template *template,
			       unsigned int tcount, u8 authsize,
			       unsigned int aad_size, u8 *keysize, u32 num_mb)
{}

static int test_aead_jiffies(struct aead_request *req, int enc,
				int blen, int secs)
{}

static int test_aead_cycles(struct aead_request *req, int enc, int blen)
{}

static void test_aead_speed(const char *algo, int enc, unsigned int secs,
			    struct aead_speed_template *template,
			    unsigned int tcount, u8 authsize,
			    unsigned int aad_size, u8 *keysize)
{}

static void test_hash_sg_init(struct scatterlist *sg)
{}

static inline int do_one_ahash_op(struct ahash_request *req, int ret)
{}

static int test_ahash_jiffies_digest(struct ahash_request *req, int blen,
				     char *out, int secs)
{}

static int test_ahash_jiffies(struct ahash_request *req, int blen,
			      int plen, char *out, int secs)
{}

static int test_ahash_cycles_digest(struct ahash_request *req, int blen,
				    char *out)
{}

static int test_ahash_cycles(struct ahash_request *req, int blen,
			     int plen, char *out)
{}

static void test_ahash_speed_common(const char *algo, unsigned int secs,
				    struct hash_speed *speed, unsigned mask)
{}

static void test_ahash_speed(const char *algo, unsigned int secs,
			     struct hash_speed *speed)
{}

static void test_hash_speed(const char *algo, unsigned int secs,
			    struct hash_speed *speed)
{}

struct test_mb_skcipher_data {};

static int do_mult_acipher_op(struct test_mb_skcipher_data *data, int enc,
				u32 num_mb, int *rc)
{}

static int test_mb_acipher_jiffies(struct test_mb_skcipher_data *data, int enc,
				int blen, int secs, u32 num_mb)
{}

static int test_mb_acipher_cycles(struct test_mb_skcipher_data *data, int enc,
			       int blen, u32 num_mb)
{}

static void test_mb_skcipher_speed(const char *algo, int enc, int secs,
				   struct cipher_speed_template *template,
				   unsigned int tcount, u8 *keysize, u32 num_mb)
{}

static inline int do_one_acipher_op(struct skcipher_request *req, int ret)
{}

static int test_acipher_jiffies(struct skcipher_request *req, int enc,
				int blen, int secs)
{}

static int test_acipher_cycles(struct skcipher_request *req, int enc,
			       int blen)
{}

static void test_skcipher_speed(const char *algo, int enc, unsigned int secs,
				struct cipher_speed_template *template,
				unsigned int tcount, u8 *keysize, bool async)
{}

static void test_acipher_speed(const char *algo, int enc, unsigned int secs,
			       struct cipher_speed_template *template,
			       unsigned int tcount, u8 *keysize)
{}

static void test_cipher_speed(const char *algo, int enc, unsigned int secs,
			      struct cipher_speed_template *template,
			      unsigned int tcount, u8 *keysize)
{}

static inline int tcrypt_test(const char *alg)
{}

static int do_test(const char *alg, u32 type, u32 mask, int m, u32 num_mb)
{}

static int __init tcrypt_mod_init(void)
{}

/*
 * If an init function is provided, an exit function must also be provided
 * to allow module unload.
 */
static void __exit tcrypt_mod_fini(void) {}

late_initcall(tcrypt_mod_init);
module_exit(tcrypt_mod_fini);

module_param(alg, charp, 0);
module_param(type, uint, 0);
module_param(mask, uint, 0);
module_param(mode, int, 0);
module_param(sec, uint, 0);
MODULE_PARM_DESC();
module_param(num_mb, uint, 0000);
MODULE_PARM_DESC();
module_param(klen, uint, 0);
MODULE_PARM_DESC();

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