Lines Matching refs:key

62 static void starfive_rsa_free_key(struct starfive_rsa_key *key)  in starfive_rsa_free_key()  argument
64 if (key->d) in starfive_rsa_free_key()
65 kfree_sensitive(key->d); in starfive_rsa_free_key()
66 if (key->e) in starfive_rsa_free_key()
67 kfree_sensitive(key->e); in starfive_rsa_free_key()
68 if (key->n) in starfive_rsa_free_key()
69 kfree_sensitive(key->n); in starfive_rsa_free_key()
70 memset(key, 0, sizeof(*key)); in starfive_rsa_free_key()
194 struct starfive_rsa_key *key = &ctx->rsa_key; in starfive_rsa_cpu_start() local
217 for (loop = key->bitlen - 1; loop > 0; loop--) { in starfive_rsa_cpu_start()
275 struct starfive_rsa_key *key = &ctx->rsa_key; in starfive_rsa_enc_core() local
289 key->bitlen = key->e_bitlen; in starfive_rsa_enc_core()
290 ret = starfive_rsa_start(ctx, rctx->rsa_data, key->e, in starfive_rsa_enc_core()
291 key->n, key->key_sz); in starfive_rsa_enc_core()
293 key->bitlen = key->d_bitlen; in starfive_rsa_enc_core()
294 ret = starfive_rsa_start(ctx, rctx->rsa_data, key->d, in starfive_rsa_enc_core()
295 key->n, key->key_sz); in starfive_rsa_enc_core()
302 rctx->rsa_data, key->key_sz, 0, 0); in starfive_rsa_enc_core()
315 struct starfive_rsa_key *key = &ctx->rsa_key; in starfive_rsa_enc() local
319 if (!key->key_sz) { in starfive_rsa_enc()
326 if (unlikely(!key->n || !key->e)) in starfive_rsa_enc()
329 if (req->dst_len < key->key_sz) in starfive_rsa_enc()
346 struct starfive_rsa_key *key = &ctx->rsa_key; in starfive_rsa_dec() local
350 if (!key->key_sz) { in starfive_rsa_dec()
357 if (unlikely(!key->n || !key->d)) in starfive_rsa_dec()
360 if (req->dst_len < key->key_sz) in starfive_rsa_dec()
475 static int starfive_rsa_setkey(struct crypto_akcipher *tfm, const void *key, in starfive_rsa_setkey() argument
484 ret = rsa_parse_priv_key(&raw_key, key, keylen); in starfive_rsa_setkey()
486 ret = rsa_parse_pub_key(&raw_key, key, keylen); in starfive_rsa_setkey()
526 static int starfive_rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key, in starfive_rsa_set_pub_key() argument
532 ret = crypto_akcipher_set_pub_key(ctx->akcipher_fbk, key, keylen); in starfive_rsa_set_pub_key()
536 return starfive_rsa_setkey(tfm, key, keylen, false); in starfive_rsa_set_pub_key()
539 static int starfive_rsa_set_priv_key(struct crypto_akcipher *tfm, const void *key, in starfive_rsa_set_priv_key() argument
545 ret = crypto_akcipher_set_priv_key(ctx->akcipher_fbk, key, keylen); in starfive_rsa_set_priv_key()
549 return starfive_rsa_setkey(tfm, key, keylen, true); in starfive_rsa_set_priv_key()
585 struct starfive_rsa_key *key = (struct starfive_rsa_key *)&ctx->rsa_key; in starfive_rsa_exit_tfm() local
588 starfive_rsa_free_key(key); in starfive_rsa_exit_tfm()