ecdh
struct ecdh params;
unsigned int crypto_ecdh_key_len(const struct ecdh *params)
const struct ecdh *params)
struct ecdh *params)
struct ecdh p = {0};
struct ecdh params;
if (ctx->ecdh.p) {
memzero_explicit(ctx->ecdh.p + shift, sz);
dma_free_coherent(dev, sz << 3, ctx->ecdh.p, ctx->ecdh.dma_p);
ctx->ecdh.p = NULL;
struct hpre_ecdh_ctx ecdh;
static int hpre_ecdh_fill_curve(struct hpre_ctx *ctx, struct ecdh *params,
void *p = ctx->ecdh.p + ctx->key_sz - cur_sz;
void *a = ctx->ecdh.p + shifta - cur_sz;
void *b = ctx->ecdh.p + shiftb - cur_sz;
void *x = ctx->ecdh.g + ctx->key_sz - cur_sz;
void *y = ctx->ecdh.g + shifta - cur_sz;
static int hpre_ecdh_set_param(struct hpre_ctx *ctx, struct ecdh *params)
if (!ctx->ecdh.p) {
ctx->ecdh.p = dma_alloc_coherent(dev, sz << 3, &ctx->ecdh.dma_p,
if (!ctx->ecdh.p)
ctx->ecdh.g = ctx->ecdh.p + shift;
ctx->ecdh.dma_g = ctx->ecdh.dma_p + shift;
dma_free_coherent(dev, sz << 3, ctx->ecdh.p, ctx->ecdh.dma_p);
ctx->ecdh.p = NULL;
static int ecdh_gen_privkey(struct hpre_ctx *ctx, struct ecdh *params)
struct ecdh params;
return crypto_kpp_set_secret(ctx->ecdh.soft_tfm, buf, len);
struct kpp_request *ecdh;
memcpy(ctx->ecdh.p + sz_shift, params.key, params.key_size);
areq = req->areq.ecdh;
h_req->areq.ecdh = req;
msg->key = cpu_to_le64(ctx->ecdh.dma_p);
msg->in = cpu_to_le64(ctx->ecdh.dma_g);
kpp_request_set_tfm(req, ctx->ecdh.soft_tfm);
kpp_request_set_tfm(req, ctx->ecdh.soft_tfm);
return crypto_kpp_maxsize(ctx->ecdh.soft_tfm);
ctx->ecdh.soft_tfm = crypto_alloc_kpp(alg, 0, CRYPTO_ALG_NEED_FALLBACK);
if (IS_ERR(ctx->ecdh.soft_tfm)) {
return PTR_ERR(ctx->ecdh.soft_tfm);
crypto_kpp_set_flags(ctx->ecdh.soft_tfm, crypto_kpp_get_flags(tfm));
crypto_free_kpp(ctx->ecdh.soft_tfm);
struct ecdh params;
unsigned int crypto_ecdh_key_len(const struct ecdh *params);
int crypto_ecdh_encode_key(char *buf, unsigned int len, const struct ecdh *p);
int crypto_ecdh_decode_key(const char *buf, unsigned int len, struct ecdh *p);
struct ecdh p = {0};