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
184 * akcipher_request_alloc() - allocates public key request
204 * akcipher_request_free() - zeroize and free public key request
214 * akcipher_request_set_callback() - Sets an asynchronous callback.
229 req->base.complete = cmpl; in akcipher_request_set_callback()
230 req->base.data = data; in akcipher_request_set_callback()
231 req->base.flags = flgs; in akcipher_request_set_callback()
235 * akcipher_request_set_crypt() - Sets request parameters
239 * @req: public key request
252 req->src = src; in akcipher_request_set_crypt()
253 req->dst = dst; in akcipher_request_set_crypt()
254 req->src_len = src_len; in akcipher_request_set_crypt()
255 req->dst_len = dst_len; in akcipher_request_set_crypt()
259 * crypto_akcipher_maxsize() - Get len for output buffer
261 * Function returns the dest buffer size required for a given key.
262 * Function assumes that the key is already set in the transformation. If this
272 return alg->max_size(tfm); in crypto_akcipher_maxsize()
276 * crypto_akcipher_encrypt() - Invoke public key encrypt operation
278 * Function invokes the specific public key encrypt operation for a given
279 * public key algorithm
281 * @req: asymmetric key request
283 * Return: zero on success; error code in case of error
289 struct crypto_alg *calg = tfm->base.__crt_alg; in crypto_akcipher_encrypt()
290 unsigned int src_len = req->src_len; in crypto_akcipher_encrypt()
294 ret = alg->encrypt(req); in crypto_akcipher_encrypt()
300 * crypto_akcipher_decrypt() - Invoke public key decrypt operation
302 * Function invokes the specific public key decrypt operation for a given
303 * public key algorithm
305 * @req: asymmetric key request
307 * Return: zero on success; error code in case of error
313 struct crypto_alg *calg = tfm->base.__crt_alg; in crypto_akcipher_decrypt()
314 unsigned int src_len = req->src_len; in crypto_akcipher_decrypt()
318 ret = alg->decrypt(req); in crypto_akcipher_decrypt()
324 * crypto_akcipher_sign() - Invoke public key sign operation
326 * Function invokes the specific public key sign operation for a given
327 * public key algorithm
329 * @req: asymmetric key request
331 * Return: zero on success; error code in case of error
337 struct crypto_alg *calg = tfm->base.__crt_alg; in crypto_akcipher_sign()
341 ret = alg->sign(req); in crypto_akcipher_sign()
347 * crypto_akcipher_verify() - Invoke public key signature verification
349 * Function invokes the specific public key signature verification operation
350 * for a given public key algorithm.
352 * @req: asymmetric key request
354 * Note: req->dst should be NULL, req->src should point to SG of size
355 * (req->src_size + req->dst_size), containing signature (of req->src_size
356 * length) with appended digest (of req->dst_size length).
358 * Return: zero on verification success; error code in case of error.
364 struct crypto_alg *calg = tfm->base.__crt_alg; in crypto_akcipher_verify()
368 ret = alg->verify(req); in crypto_akcipher_verify()
374 * crypto_akcipher_set_pub_key() - Invoke set public key operation
376 * Function invokes the algorithm specific set key function, which knows
377 * how to decode and interpret the encoded key and parameters
380 * @key: BER encoded public key, algo OID, paramlen, BER encoded
382 * @keylen: length of the key (not including other data)
384 * Return: zero on success; error code in case of error
387 const void *key, in crypto_akcipher_set_pub_key() argument
392 return alg->set_pub_key(tfm, key, keylen); in crypto_akcipher_set_pub_key()
396 * crypto_akcipher_set_priv_key() - Invoke set private key operation
398 * Function invokes the algorithm specific set key function, which knows
399 * how to decode and interpret the encoded key and parameters
402 * @key: BER encoded private key, algo OID, paramlen, BER encoded
404 * @keylen: length of the key (not including other data)
406 * Return: zero on success; error code in case of error
409 const void *key, in crypto_akcipher_set_priv_key() argument
414 return alg->set_priv_key(tfm, key, keylen); in crypto_akcipher_set_priv_key()