diff options
Diffstat (limited to 'drivers/crypto/nx/nx.c')
| -rw-r--r-- | drivers/crypto/nx/nx.c | 38 |
1 files changed, 7 insertions, 31 deletions
diff --git a/drivers/crypto/nx/nx.c b/drivers/crypto/nx/nx.c index c767f232e693..bbdab6e5ccf0 100644 --- a/drivers/crypto/nx/nx.c +++ b/drivers/crypto/nx/nx.c | |||
| @@ -211,44 +211,20 @@ int nx_build_sg_lists(struct nx_crypto_ctx *nx_ctx, | |||
| 211 | { | 211 | { |
| 212 | struct nx_sg *nx_insg = nx_ctx->in_sg; | 212 | struct nx_sg *nx_insg = nx_ctx->in_sg; |
| 213 | struct nx_sg *nx_outsg = nx_ctx->out_sg; | 213 | struct nx_sg *nx_outsg = nx_ctx->out_sg; |
| 214 | struct blkcipher_walk walk; | ||
| 215 | int rc; | ||
| 216 | |||
| 217 | blkcipher_walk_init(&walk, dst, src, nbytes); | ||
| 218 | rc = blkcipher_walk_virt_block(desc, &walk, AES_BLOCK_SIZE); | ||
| 219 | if (rc) | ||
| 220 | goto out; | ||
| 221 | 214 | ||
| 222 | if (iv) | 215 | if (iv) |
| 223 | memcpy(iv, walk.iv, AES_BLOCK_SIZE); | 216 | memcpy(iv, desc->info, AES_BLOCK_SIZE); |
| 224 | 217 | ||
| 225 | while (walk.nbytes) { | 218 | nx_insg = nx_walk_and_build(nx_insg, nx_ctx->ap->sglen, src, 0, nbytes); |
| 226 | nx_insg = nx_build_sg_list(nx_insg, walk.src.virt.addr, | 219 | nx_outsg = nx_walk_and_build(nx_outsg, nx_ctx->ap->sglen, dst, 0, nbytes); |
| 227 | walk.nbytes, nx_ctx->ap->sglen); | ||
| 228 | nx_outsg = nx_build_sg_list(nx_outsg, walk.dst.virt.addr, | ||
| 229 | walk.nbytes, nx_ctx->ap->sglen); | ||
| 230 | |||
| 231 | rc = blkcipher_walk_done(desc, &walk, 0); | ||
| 232 | if (rc) | ||
| 233 | break; | ||
| 234 | } | ||
| 235 | |||
| 236 | if (walk.nbytes) { | ||
| 237 | nx_insg = nx_build_sg_list(nx_insg, walk.src.virt.addr, | ||
| 238 | walk.nbytes, nx_ctx->ap->sglen); | ||
| 239 | nx_outsg = nx_build_sg_list(nx_outsg, walk.dst.virt.addr, | ||
| 240 | walk.nbytes, nx_ctx->ap->sglen); | ||
| 241 | |||
| 242 | rc = 0; | ||
| 243 | } | ||
| 244 | 220 | ||
| 245 | /* these lengths should be negative, which will indicate to phyp that | 221 | /* these lengths should be negative, which will indicate to phyp that |
| 246 | * the input and output parameters are scatterlists, not linear | 222 | * the input and output parameters are scatterlists, not linear |
| 247 | * buffers */ | 223 | * buffers */ |
| 248 | nx_ctx->op.inlen = (nx_ctx->in_sg - nx_insg) * sizeof(struct nx_sg); | 224 | nx_ctx->op.inlen = (nx_ctx->in_sg - nx_insg) * sizeof(struct nx_sg); |
| 249 | nx_ctx->op.outlen = (nx_ctx->out_sg - nx_outsg) * sizeof(struct nx_sg); | 225 | nx_ctx->op.outlen = (nx_ctx->out_sg - nx_outsg) * sizeof(struct nx_sg); |
| 250 | out: | 226 | |
| 251 | return rc; | 227 | return 0; |
| 252 | } | 228 | } |
| 253 | 229 | ||
| 254 | /** | 230 | /** |
| @@ -454,6 +430,8 @@ static int nx_register_algs(void) | |||
| 454 | if (rc) | 430 | if (rc) |
| 455 | goto out; | 431 | goto out; |
| 456 | 432 | ||
| 433 | nx_driver.of.status = NX_OKAY; | ||
| 434 | |||
| 457 | rc = crypto_register_alg(&nx_ecb_aes_alg); | 435 | rc = crypto_register_alg(&nx_ecb_aes_alg); |
| 458 | if (rc) | 436 | if (rc) |
| 459 | goto out; | 437 | goto out; |
| @@ -498,8 +476,6 @@ static int nx_register_algs(void) | |||
| 498 | if (rc) | 476 | if (rc) |
| 499 | goto out_unreg_s512; | 477 | goto out_unreg_s512; |
| 500 | 478 | ||
| 501 | nx_driver.of.status = NX_OKAY; | ||
| 502 | |||
| 503 | goto out; | 479 | goto out; |
| 504 | 480 | ||
| 505 | out_unreg_s512: | 481 | out_unreg_s512: |
