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

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * Public Key Encryption
15 * struct akcipher_request - public key request
45 * struct crypto_akcipher - user-instantiated objects which encapsulate
58 * struct akcipher_alg - generic public key algorithm
60 * @sign: Function performs a sign operation as defined by public key
62 * the req->dst_len will be updated to the size required for the
65 * public key algorithm, returning verification status. Requires
67 * @encrypt: Function performs an encrypt operation as defined by public key
69 * the req->dst_len will be updated to the size required for the
71 * @decrypt: Function performs a decrypt operation as defined by public key
73 * the req->dst_len will be updated to the size required for the
75 * @set_pub_key: Function invokes the algorithm specific set public key
77 * the BER encoded public key and parameters
78 * @set_priv_key: Function invokes the algorithm specific set private key
80 * the BER encoded private key and parameters
81 * @max_size: Function returns dest buffer size required for a given key.
101 int (*set_pub_key)(struct crypto_akcipher *tfm, const void *key,
103 int (*set_priv_key)(struct crypto_akcipher *tfm, const void *key,
113 * DOC: Generic Public Key API
115 * The Public Key API is used with the algorithms of type
120 * crypto_alloc_akcipher() - allocate AKCIPHER tfm handle
122 * public key algorithm e.g. "rsa"
126 * Allocate a handle for public key algorithm. The returned struct
128 * API invocation for the public key operations.
131 * of an error, PTR_ERR() returns the error code.
139 return &tfm->base; in crypto_akcipher_tfm()
156 return __crypto_akcipher_alg(crypto_akcipher_tfm(tfm)->__crt_alg); in crypto_akcipher_alg()
161 return tfm->reqsize; in crypto_akcipher_reqsize()
167 req->base.tfm = crypto_akcipher_tfm(tfm); in akcipher_request_set_tfm()
173 return __crypto_akcipher_tfm(req->base.tfm); in crypto_akcipher_reqtfm()
177 * crypto_free_akcipher() - free AKCIPHER tfm handle
189 * akcipher_request_alloc() - allocates public key request
209 * akcipher_request_free() - zeroize and free public key request
219 * akcipher_request_set_callback() - Sets an asynchronous callback.
234 req->base.complete = cmpl; in akcipher_request_set_callback()
235 req->base.data = data; in akcipher_request_set_callback()
236 req->base.flags = flgs; in akcipher_request_set_callback()
240 * akcipher_request_set_crypt() - Sets request parameters
244 * @req: public key request
257 req->src = src; in akcipher_request_set_crypt()
258 req->dst = dst; in akcipher_request_set_crypt()
259 req->src_len = src_len; in akcipher_request_set_crypt()
260 req->dst_len = dst_len; in akcipher_request_set_crypt()
264 * crypto_akcipher_maxsize() - Get len for output buffer
266 * Function returns the dest buffer size required for a given key.
267 * Function assumes that the key is already set in the transformation. If this
277 return alg->max_size(tfm); in crypto_akcipher_maxsize()
281 * crypto_akcipher_encrypt() - Invoke public key encrypt operation
283 * Function invokes the specific public key encrypt operation for a given
284 * public key algorithm
286 * @req: asymmetric key request
288 * Return: zero on success; error code in case of error
294 return crypto_akcipher_alg(tfm)->encrypt(req); in crypto_akcipher_encrypt()
298 * crypto_akcipher_decrypt() - Invoke public key decrypt operation
300 * Function invokes the specific public key decrypt operation for a given
301 * public key algorithm
303 * @req: asymmetric key request
305 * Return: zero on success; error code in case of error
311 return crypto_akcipher_alg(tfm)->decrypt(req); in crypto_akcipher_decrypt()
315 * crypto_akcipher_sync_encrypt() - Invoke public key encrypt operation
317 * Function invokes the specific public key encrypt operation for a given
318 * public key algorithm
326 * Return: zero on success; error code in case of error
333 * crypto_akcipher_sync_decrypt() - Invoke public key decrypt operation
335 * Function invokes the specific public key decrypt operation for a given
336 * public key algorithm
344 * Return: Output length on success; error code in case of error
351 * crypto_akcipher_sign() - Invoke public key sign operation
353 * Function invokes the specific public key sign operation for a given
354 * public key algorithm
356 * @req: asymmetric key request
358 * Return: zero on success; error code in case of error
364 return crypto_akcipher_alg(tfm)->sign(req); in crypto_akcipher_sign()
368 * crypto_akcipher_verify() - Invoke public key signature verification
370 * Function invokes the specific public key signature verification operation
371 * for a given public key algorithm.
373 * @req: asymmetric key request
375 * Note: req->dst should be NULL, req->src should point to SG of size
376 * (req->src_size + req->dst_size), containing signature (of req->src_size
377 * length) with appended digest (of req->dst_size length).
379 * Return: zero on verification success; error code in case of error.
385 return crypto_akcipher_alg(tfm)->verify(req); in crypto_akcipher_verify()
389 * crypto_akcipher_set_pub_key() - Invoke set public key operation
391 * Function invokes the algorithm specific set key function, which knows
392 * how to decode and interpret the encoded key and parameters
395 * @key: BER encoded public key, algo OID, paramlen, BER encoded
397 * @keylen: length of the key (not including other data)
399 * Return: zero on success; error code in case of error
402 const void *key, in crypto_akcipher_set_pub_key() argument
407 return alg->set_pub_key(tfm, key, keylen); in crypto_akcipher_set_pub_key()
411 * crypto_akcipher_set_priv_key() - Invoke set private key operation
413 * Function invokes the algorithm specific set key function, which knows
414 * how to decode and interpret the encoded key and parameters
417 * @key: BER encoded private key, algo OID, paramlen, BER encoded
419 * @keylen: length of the key (not including other data)
421 * Return: zero on success; error code in case of error
424 const void *key, in crypto_akcipher_set_priv_key() argument
429 return alg->set_priv_key(tfm, key, keylen); in crypto_akcipher_set_priv_key()