Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

KEYS: DH: Use crypto_wait_req

This patch replaces the custom crypto completion function with
crypto_req_done.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

+5 -25
+5 -25
security/keys/dh.c
··· 64 64 kfree_sensitive(dh->g); 65 65 } 66 66 67 - struct dh_completion { 68 - struct completion completion; 69 - int err; 70 - }; 71 - 72 - static void dh_crypto_done(struct crypto_async_request *req, int err) 73 - { 74 - struct dh_completion *compl = req->data; 75 - 76 - if (err == -EINPROGRESS) 77 - return; 78 - 79 - compl->err = err; 80 - complete(&compl->completion); 81 - } 82 - 83 67 static int kdf_alloc(struct crypto_shash **hash, char *hashname) 84 68 { 85 69 struct crypto_shash *tfm; ··· 130 146 struct keyctl_dh_params pcopy; 131 147 struct dh dh_inputs; 132 148 struct scatterlist outsg; 133 - struct dh_completion compl; 149 + DECLARE_CRYPTO_WAIT(compl); 134 150 struct crypto_kpp *tfm; 135 151 struct kpp_request *req; 136 152 uint8_t *secret; ··· 250 266 251 267 kpp_request_set_input(req, NULL, 0); 252 268 kpp_request_set_output(req, &outsg, outlen); 253 - init_completion(&compl.completion); 254 269 kpp_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG | 255 270 CRYPTO_TFM_REQ_MAY_SLEEP, 256 - dh_crypto_done, &compl); 271 + crypto_req_done, &compl); 257 272 258 273 /* 259 274 * For DH, generate_public_key and generate_shared_secret are 260 275 * the same calculation 261 276 */ 262 277 ret = crypto_kpp_generate_public_key(req); 263 - if (ret == -EINPROGRESS) { 264 - wait_for_completion(&compl.completion); 265 - ret = compl.err; 266 - if (ret) 267 - goto out6; 268 - } 278 + ret = crypto_wait_req(ret, &compl); 279 + if (ret) 280 + goto out6; 269 281 270 282 if (kdfcopy) { 271 283 /*