Lines Matching defs:key
2 /* RSA asymmetric public-key algorithm [RFC3447]
25 static int _rsa_enc(const struct rsa_mpi_key *key, MPI c, MPI m)
28 if (mpi_cmp_ui(m, 0) < 0 || mpi_cmp(m, key->n) >= 0)
32 return mpi_powm(c, m, key->e, key->n);
39 static int _rsa_dec(const struct rsa_mpi_key *key, MPI m, MPI c)
42 if (mpi_cmp_ui(c, 0) < 0 || mpi_cmp(c, key->n) >= 0)
46 return mpi_powm(m, c, key->d, key->n);
131 static void rsa_free_mpi_key(struct rsa_mpi_key *key)
133 mpi_free(key->d);
134 mpi_free(key->e);
135 mpi_free(key->n);
136 key->d = NULL;
137 key->e = NULL;
138 key->n = NULL;
156 static int rsa_set_pub_key(struct crypto_akcipher *tfm, const void *key,
163 /* Free the old MPI key if any */
166 ret = rsa_parse_pub_key(&raw_key, key, keylen);
190 static int rsa_set_priv_key(struct crypto_akcipher *tfm, const void *key,
197 /* Free the old MPI key if any */
200 ret = rsa_parse_priv_key(&raw_key, key, keylen);