Lines Matching refs:pkey
67 software_key_determine_akcipher(const struct public_key *pkey, in software_key_determine_akcipher() argument
79 if (strcmp(pkey->pkey_algo, "rsa") == 0) { in software_key_determine_akcipher()
89 pkey->pkey_algo); in software_key_determine_akcipher()
93 pkey->pkey_algo, hash_algo); in software_key_determine_akcipher()
106 } else if (strncmp(pkey->pkey_algo, "ecdsa", 5) == 0) { in software_key_determine_akcipher()
124 } else if (strcmp(pkey->pkey_algo, "sm2") == 0) { in software_key_determine_akcipher()
131 } else if (strcmp(pkey->pkey_algo, "ecrdsa") == 0) { in software_key_determine_akcipher()
143 if (strscpy(alg_name, pkey->pkey_algo, CRYPTO_MAX_ALG_NAME) < 0) in software_key_determine_akcipher()
161 struct public_key *pkey = params->key->payload.data[asym_crypto]; in software_key_query() local
168 ret = software_key_determine_akcipher(pkey, params->encoding, in software_key_query()
174 key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen, in software_key_query()
179 memcpy(key, pkey->key, pkey->keylen); in software_key_query()
180 ptr = key + pkey->keylen; in software_key_query()
181 ptr = pkey_pack_u32(ptr, pkey->algo); in software_key_query()
182 ptr = pkey_pack_u32(ptr, pkey->paramlen); in software_key_query()
183 memcpy(ptr, pkey->params, pkey->paramlen); in software_key_query()
192 if (pkey->key_is_private) in software_key_query()
193 ret = crypto_sig_set_privkey(sig, key, pkey->keylen); in software_key_query()
195 ret = crypto_sig_set_pubkey(sig, key, pkey->keylen); in software_key_query()
202 if (pkey->key_is_private) in software_key_query()
207 if (pkey->key_is_private) in software_key_query()
217 if (pkey->key_is_private) in software_key_query()
218 ret = crypto_akcipher_set_priv_key(tfm, key, pkey->keylen); in software_key_query()
220 ret = crypto_akcipher_set_pub_key(tfm, key, pkey->keylen); in software_key_query()
227 if (pkey->key_is_private) in software_key_query()
233 if (strncmp(pkey->pkey_algo, "ecdsa", 5) == 0) { in software_key_query()
276 const struct public_key *pkey = params->key->payload.data[asym_crypto]; in software_key_eds_op() local
287 ret = software_key_determine_akcipher(pkey, params->encoding, in software_key_eds_op()
293 key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen, in software_key_eds_op()
298 memcpy(key, pkey->key, pkey->keylen); in software_key_eds_op()
299 ptr = key + pkey->keylen; in software_key_eds_op()
300 ptr = pkey_pack_u32(ptr, pkey->algo); in software_key_eds_op()
301 ptr = pkey_pack_u32(ptr, pkey->paramlen); in software_key_eds_op()
302 memcpy(ptr, pkey->params, pkey->paramlen); in software_key_eds_op()
311 if (pkey->key_is_private) in software_key_eds_op()
312 ret = crypto_sig_set_privkey(sig, key, pkey->keylen); in software_key_eds_op()
314 ret = crypto_sig_set_pubkey(sig, key, pkey->keylen); in software_key_eds_op()
326 if (pkey->key_is_private) in software_key_eds_op()
327 ret = crypto_akcipher_set_priv_key(tfm, key, pkey->keylen); in software_key_eds_op()
329 ret = crypto_akcipher_set_pub_key(tfm, key, pkey->keylen); in software_key_eds_op()
379 int public_key_verify_signature(const struct public_key *pkey, in public_key_verify_signature() argument
390 BUG_ON(!pkey); in public_key_verify_signature()
403 if (strcmp(pkey->pkey_algo, sig->pkey_algo) != 0 && in public_key_verify_signature()
404 (strncmp(pkey->pkey_algo, "ecdsa-", 6) != 0 || in public_key_verify_signature()
409 ret = software_key_determine_akcipher(pkey, sig->encoding, in public_key_verify_signature()
419 key = kmalloc(pkey->keylen + sizeof(u32) * 2 + pkey->paramlen, in public_key_verify_signature()
426 memcpy(key, pkey->key, pkey->keylen); in public_key_verify_signature()
427 ptr = key + pkey->keylen; in public_key_verify_signature()
428 ptr = pkey_pack_u32(ptr, pkey->algo); in public_key_verify_signature()
429 ptr = pkey_pack_u32(ptr, pkey->paramlen); in public_key_verify_signature()
430 memcpy(ptr, pkey->params, pkey->paramlen); in public_key_verify_signature()
432 if (pkey->key_is_private) in public_key_verify_signature()
433 ret = crypto_sig_set_privkey(tfm, key, pkey->keylen); in public_key_verify_signature()
435 ret = crypto_sig_set_pubkey(tfm, key, pkey->keylen); in public_key_verify_signature()