Lines Matching +full:key +full:- +full:code

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Public Key Encryption
13 * struct akcipher_request - public key request
43 * struct crypto_akcipher - user-instantiated objects which encapsulate
53 * struct akcipher_alg - generic public key algorithm
55 * @sign: Function performs a sign operation as defined by public key
57 * the req->dst_len will be updated to the size required for the
60 * public key algorithm, returning verification status. Requires
62 * @encrypt: Function performs an encrypt operation as defined by public key
64 * the req->dst_len will be updated to the size required for the
66 * @decrypt: Function performs a decrypt operation as defined by public key
68 * the req->dst_len will be updated to the size required for the
70 * @set_pub_key: Function invokes the algorithm specific set public key
72 * the BER encoded public key and parameters
73 * @set_priv_key: Function invokes the algorithm specific set private key
75 * the BER encoded private key and parameters
76 * @max_size: Function returns dest buffer size required for a given key.
97 int (*set_pub_key)(struct crypto_akcipher *tfm, const void *key,
99 int (*set_priv_key)(struct crypto_akcipher *tfm, const void *key,
110 * DOC: Generic Public Key API
112 * The Public Key API is used with the algorithms of type
117 * crypto_alloc_akcipher() - allocate AKCIPHER tfm handle
119 * public key algorithm e.g. "rsa"
123 * Allocate a handle for public key algorithm. The returned struct
125 * API invocation for the public key operations.
128 * of an error, PTR_ERR() returns the error code.
136 return &tfm->base; in crypto_akcipher_tfm()
153 return __crypto_akcipher_alg(crypto_akcipher_tfm(tfm)->__crt_alg); in crypto_akcipher_alg()
158 return crypto_akcipher_alg(tfm)->reqsize; in crypto_akcipher_reqsize()
164 req->base.tfm = crypto_akcipher_tfm(tfm); in akcipher_request_set_tfm()
170 return __crypto_akcipher_tfm(req->base.tfm); in crypto_akcipher_reqtfm()
174 * crypto_free_akcipher() - free AKCIPHER tfm handle
186 * akcipher_request_alloc() - allocates public key request
206 * akcipher_request_free() - zeroize and free public key request
216 * akcipher_request_set_callback() - Sets an asynchronous callback.
231 req->base.complete = cmpl; in akcipher_request_set_callback()
232 req->base.data = data; in akcipher_request_set_callback()
233 req->base.flags = flgs; in akcipher_request_set_callback()
237 * akcipher_request_set_crypt() - Sets request parameters
241 * @req: public key request
254 req->src = src; in akcipher_request_set_crypt()
255 req->dst = dst; in akcipher_request_set_crypt()
256 req->src_len = src_len; in akcipher_request_set_crypt()
257 req->dst_len = dst_len; in akcipher_request_set_crypt()
261 * crypto_akcipher_maxsize() - Get len for output buffer
263 * Function returns the dest buffer size required for a given key.
264 * Function assumes that the key is already set in the transformation. If this
274 return alg->max_size(tfm); in crypto_akcipher_maxsize()
278 * crypto_akcipher_encrypt() - Invoke public key encrypt operation
280 * Function invokes the specific public key encrypt operation for a given
281 * public key algorithm
283 * @req: asymmetric key request
285 * Return: zero on success; error code in case of error
291 struct crypto_alg *calg = tfm->base.__crt_alg; in crypto_akcipher_encrypt()
292 unsigned int src_len = req->src_len; in crypto_akcipher_encrypt()
296 ret = alg->encrypt(req); in crypto_akcipher_encrypt()
302 * crypto_akcipher_decrypt() - Invoke public key decrypt operation
304 * Function invokes the specific public key decrypt operation for a given
305 * public key algorithm
307 * @req: asymmetric key request
309 * Return: zero on success; error code in case of error
315 struct crypto_alg *calg = tfm->base.__crt_alg; in crypto_akcipher_decrypt()
316 unsigned int src_len = req->src_len; in crypto_akcipher_decrypt()
320 ret = alg->decrypt(req); in crypto_akcipher_decrypt()
326 * crypto_akcipher_sign() - Invoke public key sign operation
328 * Function invokes the specific public key sign operation for a given
329 * public key algorithm
331 * @req: asymmetric key request
333 * Return: zero on success; error code in case of error
339 struct crypto_alg *calg = tfm->base.__crt_alg; in crypto_akcipher_sign()
343 ret = alg->sign(req); in crypto_akcipher_sign()
349 * crypto_akcipher_verify() - Invoke public key signature verification
351 * Function invokes the specific public key signature verification operation
352 * for a given public key algorithm.
354 * @req: asymmetric key request
356 * Note: req->dst should be NULL, req->src should point to SG of size
357 * (req->src_size + req->dst_size), containing signature (of req->src_size
358 * length) with appended digest (of req->dst_size length).
360 * Return: zero on verification success; error code in case of error.
366 struct crypto_alg *calg = tfm->base.__crt_alg; in crypto_akcipher_verify()
370 ret = alg->verify(req); in crypto_akcipher_verify()
376 * crypto_akcipher_set_pub_key() - Invoke set public key operation
378 * Function invokes the algorithm specific set key function, which knows
379 * how to decode and interpret the encoded key and parameters
382 * @key: BER encoded public key, algo OID, paramlen, BER encoded
384 * @keylen: length of the key (not including other data)
386 * Return: zero on success; error code in case of error
389 const void *key, in crypto_akcipher_set_pub_key() argument
394 return alg->set_pub_key(tfm, key, keylen); in crypto_akcipher_set_pub_key()
398 * crypto_akcipher_set_priv_key() - Invoke set private key operation
400 * Function invokes the algorithm specific set key function, which knows
401 * how to decode and interpret the encoded key and parameters
404 * @key: BER encoded private key, algo OID, paramlen, BER encoded
406 * @keylen: length of the key (not including other data)
408 * Return: zero on success; error code in case of error
411 const void *key, in crypto_akcipher_set_priv_key() argument
416 return alg->set_priv_key(tfm, key, keylen); in crypto_akcipher_set_priv_key()