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.

crypto: x86/ghash - Use proper helpers to clone request

Rather than copying a request by hand with memcpy, use the correct
API helpers to setup the new request. This will matter once the
API helpers start setting up chained requests as a simple memcpy
will break chaining.

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

+17 -6
+17 -6
arch/x86/crypto/ghash-clmulni-intel_glue.c
··· 189 189 return crypto_shash_init(desc); 190 190 } 191 191 192 + static void ghash_init_cryptd_req(struct ahash_request *req) 193 + { 194 + struct ahash_request *cryptd_req = ahash_request_ctx(req); 195 + struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); 196 + struct ghash_async_ctx *ctx = crypto_ahash_ctx(tfm); 197 + struct cryptd_ahash *cryptd_tfm = ctx->cryptd_tfm; 198 + 199 + ahash_request_set_tfm(cryptd_req, &cryptd_tfm->base); 200 + ahash_request_set_callback(cryptd_req, req->base.flags, 201 + req->base.complete, req->base.data); 202 + ahash_request_set_crypt(cryptd_req, req->src, req->result, 203 + req->nbytes); 204 + } 205 + 192 206 static int ghash_async_update(struct ahash_request *req) 193 207 { 194 208 struct ahash_request *cryptd_req = ahash_request_ctx(req); ··· 212 198 213 199 if (!crypto_simd_usable() || 214 200 (in_atomic() && cryptd_ahash_queued(cryptd_tfm))) { 215 - memcpy(cryptd_req, req, sizeof(*req)); 216 - ahash_request_set_tfm(cryptd_req, &cryptd_tfm->base); 201 + ghash_init_cryptd_req(req); 217 202 return crypto_ahash_update(cryptd_req); 218 203 } else { 219 204 struct shash_desc *desc = cryptd_shash_desc(cryptd_req); ··· 229 216 230 217 if (!crypto_simd_usable() || 231 218 (in_atomic() && cryptd_ahash_queued(cryptd_tfm))) { 232 - memcpy(cryptd_req, req, sizeof(*req)); 233 - ahash_request_set_tfm(cryptd_req, &cryptd_tfm->base); 219 + ghash_init_cryptd_req(req); 234 220 return crypto_ahash_final(cryptd_req); 235 221 } else { 236 222 struct shash_desc *desc = cryptd_shash_desc(cryptd_req); ··· 269 257 270 258 if (!crypto_simd_usable() || 271 259 (in_atomic() && cryptd_ahash_queued(cryptd_tfm))) { 272 - memcpy(cryptd_req, req, sizeof(*req)); 273 - ahash_request_set_tfm(cryptd_req, &cryptd_tfm->base); 260 + ghash_init_cryptd_req(req); 274 261 return crypto_ahash_digest(cryptd_req); 275 262 } else { 276 263 struct shash_desc *desc = cryptd_shash_desc(cryptd_req);