linux/drivers/crypto/starfive/jh7110-rsa.c

// SPDX-License-Identifier: GPL-2.0
/*
 * StarFive Public Key Algo acceleration driver
 *
 * Copyright (c) 2022 StarFive Technology
 */

#include <linux/crypto.h>
#include <linux/iopoll.h>
#include <crypto/akcipher.h>
#include <crypto/algapi.h>
#include <crypto/internal/akcipher.h>
#include <crypto/internal/rsa.h>
#include <crypto/scatterwalk.h>

#include "jh7110-cryp.h"

#define STARFIVE_PKA_REGS_OFFSET
#define STARFIVE_PKA_CACR_OFFSET
#define STARFIVE_PKA_CASR_OFFSET
#define STARFIVE_PKA_CAAR_OFFSET
#define STARFIVE_PKA_CAER_OFFSET
#define STARFIVE_PKA_CANR_OFFSET

/* R ^ 2 mod N and N0' */
#define CRYPTO_CMD_PRE
/* A * R mod N   ==> A */
#define CRYPTO_CMD_ARN
/* A * E * R mod N ==> A */
#define CRYPTO_CMD_AERN
/* A * A * R mod N ==> A */
#define CRYPTO_CMD_AARN

#define STARFIVE_RSA_RESET

static inline int starfive_pka_wait_done(struct starfive_cryp_ctx *ctx)
{}

static void starfive_rsa_free_key(struct starfive_rsa_key *key)
{}

static unsigned int starfive_rsa_get_nbit(u8 *pa, u32 snum, int key_sz)
{}

static int starfive_rsa_montgomery_form(struct starfive_cryp_ctx *ctx,
					u32 *out, u32 *in, u8 mont,
					u32 *mod, int bit_len)
{}

static int starfive_rsa_cpu_start(struct starfive_cryp_ctx *ctx, u32 *result,
				  u8 *de, u32 *n, int key_sz)
{}

static int starfive_rsa_start(struct starfive_cryp_ctx *ctx, u8 *result,
			      u8 *de, u8 *n, int key_sz)
{}

static int starfive_rsa_enc_core(struct starfive_cryp_ctx *ctx, int enc)
{}

static int starfive_rsa_enc(struct akcipher_request *req)
{}

static int starfive_rsa_dec(struct akcipher_request *req)
{}

static int starfive_rsa_set_n(struct starfive_rsa_key *rsa_key,
			      const char *value, size_t vlen)
{}

static int starfive_rsa_set_e(struct starfive_rsa_key *rsa_key,
			      const char *value, size_t vlen)
{}

static int starfive_rsa_set_d(struct starfive_rsa_key *rsa_key,
			      const char *value, size_t vlen)
{}

static int starfive_rsa_setkey(struct crypto_akcipher *tfm, const void *key,
			       unsigned int keylen, bool private)
{}

static int starfive_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key,
				    unsigned int keylen)
{}

static int starfive_rsa_set_priv_key(struct crypto_akcipher *tfm, const void *key,
				     unsigned int keylen)
{}

static unsigned int starfive_rsa_max_size(struct crypto_akcipher *tfm)
{}

static int starfive_rsa_init_tfm(struct crypto_akcipher *tfm)
{}

static void starfive_rsa_exit_tfm(struct crypto_akcipher *tfm)
{}

static struct akcipher_alg starfive_rsa =;

int starfive_rsa_register_algs(void)
{}

void starfive_rsa_unregister_algs(void)
{}