/crypto/ |
D | chacha20poly1305.c | 50 struct ahash_request req; /* must be last member */ member 56 struct skcipher_request req; /* must be last member */ member 76 static inline void async_done_continue(struct aead_request *req, int err, in async_done_continue() argument 80 err = cont(req); in async_done_continue() 83 aead_request_complete(req, err); in async_done_continue() 86 static void chacha_iv(u8 *iv, struct aead_request *req, u32 icb) in chacha_iv() argument 88 struct chachapoly_ctx *ctx = crypto_aead_ctx(crypto_aead_reqtfm(req)); in chacha_iv() 93 memcpy(iv + sizeof(leicb) + ctx->saltlen, req->iv, in chacha_iv() 97 static int poly_verify_tag(struct aead_request *req) in poly_verify_tag() argument 99 struct chachapoly_req_ctx *rctx = aead_request_ctx(req); in poly_verify_tag() [all …]
|
D | seqiv.c | 28 static void seqiv_aead_encrypt_complete2(struct aead_request *req, int err) in seqiv_aead_encrypt_complete2() argument 30 struct aead_request *subreq = aead_request_ctx(req); in seqiv_aead_encrypt_complete2() 39 geniv = crypto_aead_reqtfm(req); in seqiv_aead_encrypt_complete2() 40 memcpy(req->iv, subreq->iv, crypto_aead_ivsize(geniv)); in seqiv_aead_encrypt_complete2() 49 struct aead_request *req = base->data; in seqiv_aead_encrypt_complete() local 51 seqiv_aead_encrypt_complete2(req, err); in seqiv_aead_encrypt_complete() 52 aead_request_complete(req, err); in seqiv_aead_encrypt_complete() 55 static int seqiv_aead_encrypt(struct aead_request *req) in seqiv_aead_encrypt() argument 57 struct crypto_aead *geniv = crypto_aead_reqtfm(req); in seqiv_aead_encrypt() 59 struct aead_request *subreq = aead_request_ctx(req); in seqiv_aead_encrypt() [all …]
|
D | gcm.c | 64 int (*complete)(struct aead_request *req, u32 flags); 91 static int crypto_rfc4543_copy_src_to_dst(struct aead_request *req, bool enc); 94 struct aead_request *req) in crypto_gcm_reqctx() argument 96 unsigned long align = crypto_aead_alignmask(crypto_aead_reqtfm(req)); in crypto_gcm_reqctx() 98 return (void *)PTR_ALIGN((u8 *)aead_request_ctx(req), align + 1); in crypto_gcm_reqctx() 101 static void crypto_gcm_setkey_done(struct crypto_async_request *req, int err) in crypto_gcm_setkey_done() argument 103 struct crypto_gcm_setkey_result *result = req->data; in crypto_gcm_setkey_done() 125 struct skcipher_request req; in crypto_gcm_setkey() member 145 skcipher_request_set_tfm(&data->req, ctr); in crypto_gcm_setkey() 146 skcipher_request_set_callback(&data->req, CRYPTO_TFM_REQ_MAY_SLEEP | in crypto_gcm_setkey() [all …]
|
D | echainiv.c | 31 static int echainiv_encrypt(struct aead_request *req) in echainiv_encrypt() argument 33 struct crypto_aead *geniv = crypto_aead_reqtfm(req); in echainiv_encrypt() 35 struct aead_request *subreq = aead_request_ctx(req); in echainiv_encrypt() 42 if (req->cryptlen < ivsize) in echainiv_encrypt() 47 info = req->iv; in echainiv_encrypt() 49 if (req->src != req->dst) { in echainiv_encrypt() 53 skcipher_request_set_callback(nreq, req->base.flags, in echainiv_encrypt() 55 skcipher_request_set_crypt(nreq, req->src, req->dst, in echainiv_encrypt() 56 req->assoclen + req->cryptlen, in echainiv_encrypt() 64 aead_request_set_callback(subreq, req->base.flags, in echainiv_encrypt() [all …]
|
D | cts.c | 63 static inline u8 *crypto_cts_reqctx_space(struct skcipher_request *req) in crypto_cts_reqctx_space() argument 65 struct crypto_cts_reqctx *rctx = skcipher_request_ctx(req); in crypto_cts_reqctx_space() 66 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in crypto_cts_reqctx_space() 92 struct skcipher_request *req = areq->data; in cts_cbc_crypt_done() local 97 skcipher_request_complete(req, err); in cts_cbc_crypt_done() 100 static int cts_cbc_encrypt(struct skcipher_request *req) in cts_cbc_encrypt() argument 102 struct crypto_cts_reqctx *rctx = skcipher_request_ctx(req); in cts_cbc_encrypt() 103 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in cts_cbc_encrypt() 112 lastn = req->cryptlen - offset; in cts_cbc_encrypt() 114 sg = scatterwalk_ffwd(rctx->sg, req->dst, offset - bsize); in cts_cbc_encrypt() [all …]
|
D | rsa-pkcs1pad.c | 182 static int pkcs1pad_encrypt_sign_complete(struct akcipher_request *req, int err) in pkcs1pad_encrypt_sign_complete() argument 184 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req); in pkcs1pad_encrypt_sign_complete() 186 struct pkcs1pad_request *req_ctx = akcipher_request_ctx(req); in pkcs1pad_encrypt_sign_complete() 206 sg_copy_to_buffer(req->dst, sg_nents_for_len(req->dst, len), in pkcs1pad_encrypt_sign_complete() 208 sg_copy_from_buffer(req->dst, in pkcs1pad_encrypt_sign_complete() 209 sg_nents_for_len(req->dst, ctx->key_size), in pkcs1pad_encrypt_sign_complete() 214 req->dst_len = ctx->key_size; in pkcs1pad_encrypt_sign_complete() 224 struct akcipher_request *req = child_async_req->data; in pkcs1pad_encrypt_sign_complete_cb() local 230 async_req.data = req->base.data; in pkcs1pad_encrypt_sign_complete_cb() 231 async_req.tfm = crypto_akcipher_tfm(crypto_akcipher_reqtfm(req)); in pkcs1pad_encrypt_sign_complete_cb() [all …]
|
D | authenc.c | 45 static void authenc_request_complete(struct aead_request *req, int err) in authenc_request_complete() argument 48 aead_request_complete(req, err); in authenc_request_complete() 120 struct aead_request *req = areq->data; in authenc_geniv_ahash_done() local 121 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in authenc_geniv_ahash_done() 124 struct authenc_request_ctx *areq_ctx = aead_request_ctx(req); in authenc_geniv_ahash_done() 130 scatterwalk_map_and_copy(ahreq->result, req->dst, in authenc_geniv_ahash_done() 131 req->assoclen + req->cryptlen, in authenc_geniv_ahash_done() 135 aead_request_complete(req, err); in authenc_geniv_ahash_done() 138 static int crypto_authenc_genicv(struct aead_request *req, unsigned int flags) in crypto_authenc_genicv() argument 140 struct crypto_aead *authenc = crypto_aead_reqtfm(req); in crypto_authenc_genicv() [all …]
|
D | ahash.c | 133 int crypto_hash_walk_first(struct ahash_request *req, in crypto_hash_walk_first() argument 136 walk->total = req->nbytes; in crypto_hash_walk_first() 143 walk->alignmask = crypto_ahash_alignmask(crypto_ahash_reqtfm(req)); in crypto_hash_walk_first() 144 walk->sg = req->src; in crypto_hash_walk_first() 145 walk->flags = req->base.flags & CRYPTO_TFM_REQ_MASK; in crypto_hash_walk_first() 151 int crypto_ahash_walk_first(struct ahash_request *req, in crypto_ahash_walk_first() argument 154 walk->total = req->nbytes; in crypto_ahash_walk_first() 161 walk->alignmask = crypto_ahash_alignmask(crypto_ahash_reqtfm(req)); in crypto_ahash_walk_first() 162 walk->sg = req->src; in crypto_ahash_walk_first() 163 walk->flags = req->base.flags & CRYPTO_TFM_REQ_MASK; in crypto_ahash_walk_first() [all …]
|
D | authencesn.c | 48 static void authenc_esn_request_complete(struct aead_request *req, int err) in authenc_esn_request_complete() argument 51 aead_request_complete(req, err); in authenc_esn_request_complete() 100 static int crypto_authenc_esn_genicv_tail(struct aead_request *req, in crypto_authenc_esn_genicv_tail() argument 103 struct crypto_aead *authenc_esn = crypto_aead_reqtfm(req); in crypto_authenc_esn_genicv_tail() 105 struct authenc_esn_request_ctx *areq_ctx = aead_request_ctx(req); in crypto_authenc_esn_genicv_tail() 110 unsigned int assoclen = req->assoclen; in crypto_authenc_esn_genicv_tail() 111 unsigned int cryptlen = req->cryptlen; in crypto_authenc_esn_genicv_tail() 112 struct scatterlist *dst = req->dst; in crypto_authenc_esn_genicv_tail() 127 struct aead_request *req = areq->data; in authenc_esn_geniv_ahash_done() local 129 err = err ?: crypto_authenc_esn_genicv_tail(req, 0); in authenc_esn_geniv_ahash_done() [all …]
|
D | ccm.c | 57 struct aead_request *req) in crypto_ccm_reqctx() argument 59 unsigned long align = crypto_aead_alignmask(crypto_aead_reqtfm(req)); in crypto_ccm_reqctx() 61 return (void *)PTR_ALIGN((u8 *)aead_request_ctx(req), align + 1); in crypto_ccm_reqctx() 129 static int format_input(u8 *info, struct aead_request *req, in format_input() argument 132 struct crypto_aead *aead = crypto_aead_reqtfm(req); in format_input() 133 unsigned int lp = req->iv[0]; in format_input() 139 memcpy(info, req->iv, 16); in format_input() 145 if (req->assoclen) in format_input() 251 static int crypto_ccm_auth(struct aead_request *req, struct scatterlist *plain, in crypto_ccm_auth() argument 254 struct crypto_aead *aead = crypto_aead_reqtfm(req); in crypto_ccm_auth() [all …]
|
D | cryptd.c | 159 struct crypto_async_request *req, *backlog; in cryptd_queue_worker() local 171 req = crypto_dequeue_request(&cpu_queue->queue); in cryptd_queue_worker() 175 if (!req) in cryptd_queue_worker() 180 req->complete(req, 0); in cryptd_queue_worker() 222 static void cryptd_blkcipher_crypt(struct ablkcipher_request *req, in cryptd_blkcipher_crypt() argument 236 rctx = ablkcipher_request_ctx(req); in cryptd_blkcipher_crypt() 242 desc.info = req->info; in cryptd_blkcipher_crypt() 245 err = crypt(&desc, req->dst, req->src, req->nbytes); in cryptd_blkcipher_crypt() 247 req->base.complete = rctx->complete; in cryptd_blkcipher_crypt() 250 tfm = crypto_ablkcipher_reqtfm(req); in cryptd_blkcipher_crypt() [all …]
|
D | ablk_helper.c | 54 int __ablk_encrypt(struct ablkcipher_request *req) in __ablk_encrypt() argument 56 struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); in __ablk_encrypt() 61 desc.info = req->info; in __ablk_encrypt() 65 &desc, req->dst, req->src, req->nbytes); in __ablk_encrypt() 69 int ablk_encrypt(struct ablkcipher_request *req) in ablk_encrypt() argument 71 struct crypto_ablkcipher *tfm = crypto_ablkcipher_reqtfm(req); in ablk_encrypt() 77 ablkcipher_request_ctx(req); in ablk_encrypt() 79 *cryptd_req = *req; in ablk_encrypt() 84 return __ablk_encrypt(req); in ablk_encrypt() 89 int ablk_decrypt(struct ablkcipher_request *req) in ablk_decrypt() argument [all …]
|
D | mcryptd.c | 154 struct crypto_async_request *req, *backlog; in mcryptd_queue_worker() local 168 req = crypto_dequeue_request(&cpu_queue->queue); in mcryptd_queue_worker() 171 if (!req) { in mcryptd_queue_worker() 178 req->complete(req, 0); in mcryptd_queue_worker() 314 static int mcryptd_hash_enqueue(struct ahash_request *req, in mcryptd_hash_enqueue() argument 319 struct mcryptd_hash_request_ctx *rctx = ahash_request_ctx(req); in mcryptd_hash_enqueue() 320 struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); in mcryptd_hash_enqueue() 324 rctx->complete = req->base.complete; in mcryptd_hash_enqueue() 325 req->base.complete = complete; in mcryptd_hash_enqueue() 327 ret = mcryptd_enqueue_request(queue, &req->base, rctx); in mcryptd_hash_enqueue() [all …]
|
D | tcrypt.c | 85 static void tcrypt_complete(struct crypto_async_request *req, int err) in tcrypt_complete() argument 87 struct tcrypt_result *res = req->data; in tcrypt_complete() 96 static inline int do_one_aead_op(struct aead_request *req, int ret) in do_one_aead_op() argument 99 struct tcrypt_result *tr = req->base.data; in do_one_aead_op() 110 static int test_aead_jiffies(struct aead_request *req, int enc, in test_aead_jiffies() argument 120 ret = do_one_aead_op(req, crypto_aead_encrypt(req)); in test_aead_jiffies() 122 ret = do_one_aead_op(req, crypto_aead_decrypt(req)); in test_aead_jiffies() 133 static int test_aead_cycles(struct aead_request *req, int enc, int blen) in test_aead_cycles() argument 144 ret = do_one_aead_op(req, crypto_aead_encrypt(req)); in test_aead_cycles() 146 ret = do_one_aead_op(req, crypto_aead_decrypt(req)); in test_aead_cycles() [all …]
|
D | rsa.c | 86 static int rsa_enc(struct akcipher_request *req) in rsa_enc() argument 88 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req); in rsa_enc() 103 m = mpi_read_raw_from_sgl(req->src, req->src_len); in rsa_enc() 111 ret = mpi_write_to_sgl(c, req->dst, req->dst_len, &sign); in rsa_enc() 125 static int rsa_dec(struct akcipher_request *req) in rsa_dec() argument 127 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req); in rsa_dec() 142 c = mpi_read_raw_from_sgl(req->src, req->src_len); in rsa_dec() 150 ret = mpi_write_to_sgl(m, req->dst, req->dst_len, &sign); in rsa_dec() 163 static int rsa_sign(struct akcipher_request *req) in rsa_sign() argument 165 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req); in rsa_sign() [all …]
|
D | shash.c | 220 static int shash_async_init(struct ahash_request *req) in shash_async_init() argument 222 struct crypto_shash **ctx = crypto_ahash_ctx(crypto_ahash_reqtfm(req)); in shash_async_init() 223 struct shash_desc *desc = ahash_request_ctx(req); in shash_async_init() 226 desc->flags = req->base.flags; in shash_async_init() 231 int shash_ahash_update(struct ahash_request *req, struct shash_desc *desc) in shash_ahash_update() argument 236 for (nbytes = crypto_hash_walk_first(req, &walk); nbytes > 0; in shash_ahash_update() 244 static int shash_async_update(struct ahash_request *req) in shash_async_update() argument 246 return shash_ahash_update(req, ahash_request_ctx(req)); in shash_async_update() 249 static int shash_async_final(struct ahash_request *req) in shash_async_final() argument 251 return crypto_shash_final(ahash_request_ctx(req), req->result); in shash_async_final() [all …]
|
D | skcipher.c | 56 static int skcipher_crypt_blkcipher(struct skcipher_request *req, in skcipher_crypt_blkcipher() argument 62 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); in skcipher_crypt_blkcipher() 66 .info = req->iv, in skcipher_crypt_blkcipher() 67 .flags = req->base.flags, in skcipher_crypt_blkcipher() 71 return crypt(&desc, req->dst, req->src, req->cryptlen); in skcipher_crypt_blkcipher() 74 static int skcipher_encrypt_blkcipher(struct skcipher_request *req) in skcipher_encrypt_blkcipher() argument 76 struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req); in skcipher_encrypt_blkcipher() 80 return skcipher_crypt_blkcipher(req, alg->encrypt); in skcipher_encrypt_blkcipher() 83 static int skcipher_decrypt_blkcipher(struct skcipher_request *req) in skcipher_decrypt_blkcipher() argument 85 struct crypto_skcipher *skcipher = crypto_skcipher_reqtfm(req); in skcipher_decrypt_blkcipher() [all …]
|
D | pcrypt.c | 121 struct aead_request *req = pcrypt_request_ctx(preq); in pcrypt_aead_serial() local 123 aead_request_complete(req->base.data, padata->info); in pcrypt_aead_serial() 128 struct aead_request *req = areq->data; in pcrypt_aead_done() local 129 struct pcrypt_request *preq = aead_request_ctx(req); in pcrypt_aead_done() 133 req->base.flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; in pcrypt_aead_done() 141 struct aead_request *req = pcrypt_request_ctx(preq); in pcrypt_aead_enc() local 143 padata->info = crypto_aead_encrypt(req); in pcrypt_aead_enc() 151 static int pcrypt_aead_encrypt(struct aead_request *req) in pcrypt_aead_encrypt() argument 154 struct pcrypt_request *preq = aead_request_ctx(req); in pcrypt_aead_encrypt() 157 struct crypto_aead *aead = crypto_aead_reqtfm(req); in pcrypt_aead_encrypt() [all …]
|
D | algif_hash.c | 34 struct ahash_request req; member 44 ds = crypto_ahash_digestsize(crypto_ahash_reqtfm(&ctx->req)); in hash_alloc_result() 62 ds = crypto_ahash_digestsize(crypto_ahash_reqtfm(&ctx->req)); in hash_free_result() 86 err = af_alg_wait_for_completion(crypto_ahash_init(&ctx->req), in hash_sendmsg() 106 ahash_request_set_crypt(&ctx->req, ctx->sgl.sg, NULL, len); in hash_sendmsg() 108 err = af_alg_wait_for_completion(crypto_ahash_update(&ctx->req), in hash_sendmsg() 126 ahash_request_set_crypt(&ctx->req, NULL, ctx->result, 0); in hash_sendmsg() 127 err = af_alg_wait_for_completion(crypto_ahash_final(&ctx->req), in hash_sendmsg() 159 ahash_request_set_crypt(&ctx->req, ctx->sgl.sg, ctx->result, size); in hash_sendpage() 163 err = crypto_ahash_finup(&ctx->req); in hash_sendpage() [all …]
|
D | crypto_engine.c | 176 struct ablkcipher_request *req, in crypto_transfer_cipher_request() argument 189 ret = ablkcipher_enqueue_request(&engine->queue, req); in crypto_transfer_cipher_request() 206 struct ablkcipher_request *req) in crypto_transfer_cipher_request_to_engine() argument 208 return crypto_transfer_cipher_request(engine, req, true); in crypto_transfer_cipher_request_to_engine() 219 struct ahash_request *req, bool need_pump) in crypto_transfer_hash_request() argument 231 ret = ahash_enqueue_request(&engine->queue, req); in crypto_transfer_hash_request() 248 struct ahash_request *req) in crypto_transfer_hash_request_to_engine() argument 250 return crypto_transfer_hash_request(engine, req, true); in crypto_transfer_hash_request_to_engine() 261 struct ablkcipher_request *req, int err) in crypto_finalize_cipher_request() argument 268 if (engine->cur_req == &req->base) in crypto_finalize_cipher_request() [all …]
|
D | ablkcipher.c | 102 static int ablkcipher_walk_next(struct ablkcipher_request *req, 105 int ablkcipher_walk_done(struct ablkcipher_request *req, in ablkcipher_walk_done() argument 108 struct crypto_tfm *tfm = req->base.tfm; in ablkcipher_walk_done() 134 crypto_yield(req->base.flags); in ablkcipher_walk_done() 135 return ablkcipher_walk_next(req, walk); in ablkcipher_walk_done() 138 if (walk->iv != req->info) in ablkcipher_walk_done() 139 memcpy(req->info, walk->iv, tfm->crt_ablkcipher.ivsize); in ablkcipher_walk_done() 146 static inline int ablkcipher_next_slow(struct ablkcipher_request *req, in ablkcipher_next_slow() argument 163 return ablkcipher_walk_done(req, walk, -ENOMEM); in ablkcipher_next_slow() 211 static inline int ablkcipher_next_fast(struct ablkcipher_request *req, in ablkcipher_next_fast() argument [all …]
|
D | dh.c | 98 static int dh_compute_value(struct kpp_request *req) in dh_compute_value() argument 100 struct crypto_kpp *tfm = crypto_kpp_reqtfm(req); in dh_compute_value() 114 if (req->src) { in dh_compute_value() 115 base = mpi_read_raw_from_sgl(req->src, req->src_len); in dh_compute_value() 128 ret = mpi_write_to_sgl(val, req->dst, req->dst_len, &sign); in dh_compute_value() 135 if (req->src) in dh_compute_value()
|
D | testmgr.c | 156 static void tcrypt_complete(struct crypto_async_request *req, int err) in tcrypt_complete() argument 158 struct tcrypt_result *res = req->data; in tcrypt_complete() 210 struct ahash_request *req; in ahash_partial_update() local 214 req = *preq; in ahash_partial_update() 216 crypto_ahash_reqtfm(req)); in ahash_partial_update() 223 ret = crypto_ahash_export(req, state); in ahash_partial_update() 229 ahash_request_free(req); in ahash_partial_update() 230 req = ahash_request_alloc(tfm, GFP_KERNEL); in ahash_partial_update() 231 if (!req) { in ahash_partial_update() 235 ahash_request_set_callback(req, in ahash_partial_update() [all …]
|
D | ecdh.c | 66 static int ecdh_compute_value(struct kpp_request *req) in ecdh_compute_value() argument 69 struct crypto_kpp *tfm = crypto_kpp_reqtfm(req); in ecdh_compute_value() 76 if (req->src) { in ecdh_compute_value() 77 copied = sg_copy_to_buffer(req->src, 1, ctx->public_key, in ecdh_compute_value() 101 copied = sg_copy_from_buffer(req->dst, 1, buf, nbytes); in ecdh_compute_value()
|
/crypto/asymmetric_keys/ |
D | public_key.c | 65 static void public_key_verify_done(struct crypto_async_request *req, int err) in public_key_verify_done() argument 67 struct public_key_completion *compl = req->data; in public_key_verify_done() 84 struct akcipher_request *req; in public_key_verify_signature() local 118 req = akcipher_request_alloc(tfm, GFP_KERNEL); in public_key_verify_signature() 119 if (!req) in public_key_verify_signature() 133 akcipher_request_set_crypt(req, &sig_sg, &digest_sg, sig->s_size, in public_key_verify_signature() 136 akcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG | in public_key_verify_signature() 144 ret = crypto_akcipher_verify(req); in public_key_verify_signature() 153 if (req->dst_len != sig->digest_size || in public_key_verify_signature() 160 akcipher_request_free(req); in public_key_verify_signature()
|