diff options
Diffstat (limited to 'drivers/crypto/nx/nx-aes-gcm.c')
| -rw-r--r-- | drivers/crypto/nx/nx-aes-gcm.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/crypto/nx/nx-aes-gcm.c b/drivers/crypto/nx/nx-aes-gcm.c index 08ac6d48688c..92c993f08213 100644 --- a/drivers/crypto/nx/nx-aes-gcm.c +++ b/drivers/crypto/nx/nx-aes-gcm.c | |||
| @@ -317,6 +317,7 @@ out: | |||
| 317 | static int gcm_aes_nx_crypt(struct aead_request *req, int enc) | 317 | static int gcm_aes_nx_crypt(struct aead_request *req, int enc) |
| 318 | { | 318 | { |
| 319 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); | 319 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); |
| 320 | struct nx_gcm_rctx *rctx = aead_request_ctx(req); | ||
| 320 | struct nx_csbcpb *csbcpb = nx_ctx->csbcpb; | 321 | struct nx_csbcpb *csbcpb = nx_ctx->csbcpb; |
| 321 | struct blkcipher_desc desc; | 322 | struct blkcipher_desc desc; |
| 322 | unsigned int nbytes = req->cryptlen; | 323 | unsigned int nbytes = req->cryptlen; |
| @@ -326,7 +327,7 @@ static int gcm_aes_nx_crypt(struct aead_request *req, int enc) | |||
| 326 | 327 | ||
| 327 | spin_lock_irqsave(&nx_ctx->lock, irq_flags); | 328 | spin_lock_irqsave(&nx_ctx->lock, irq_flags); |
| 328 | 329 | ||
| 329 | desc.info = nx_ctx->priv.gcm.iv; | 330 | desc.info = rctx->iv; |
| 330 | /* initialize the counter */ | 331 | /* initialize the counter */ |
| 331 | *(u32 *)(desc.info + NX_GCM_CTR_OFFSET) = 1; | 332 | *(u32 *)(desc.info + NX_GCM_CTR_OFFSET) = 1; |
| 332 | 333 | ||
| @@ -424,8 +425,8 @@ out: | |||
| 424 | 425 | ||
| 425 | static int gcm_aes_nx_encrypt(struct aead_request *req) | 426 | static int gcm_aes_nx_encrypt(struct aead_request *req) |
| 426 | { | 427 | { |
| 427 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); | 428 | struct nx_gcm_rctx *rctx = aead_request_ctx(req); |
| 428 | char *iv = nx_ctx->priv.gcm.iv; | 429 | char *iv = rctx->iv; |
| 429 | 430 | ||
| 430 | memcpy(iv, req->iv, 12); | 431 | memcpy(iv, req->iv, 12); |
| 431 | 432 | ||
| @@ -434,8 +435,8 @@ static int gcm_aes_nx_encrypt(struct aead_request *req) | |||
| 434 | 435 | ||
| 435 | static int gcm_aes_nx_decrypt(struct aead_request *req) | 436 | static int gcm_aes_nx_decrypt(struct aead_request *req) |
| 436 | { | 437 | { |
| 437 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); | 438 | struct nx_gcm_rctx *rctx = aead_request_ctx(req); |
| 438 | char *iv = nx_ctx->priv.gcm.iv; | 439 | char *iv = rctx->iv; |
| 439 | 440 | ||
| 440 | memcpy(iv, req->iv, 12); | 441 | memcpy(iv, req->iv, 12); |
| 441 | 442 | ||
| @@ -445,7 +446,8 @@ static int gcm_aes_nx_decrypt(struct aead_request *req) | |||
| 445 | static int gcm4106_aes_nx_encrypt(struct aead_request *req) | 446 | static int gcm4106_aes_nx_encrypt(struct aead_request *req) |
| 446 | { | 447 | { |
| 447 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); | 448 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); |
| 448 | char *iv = nx_ctx->priv.gcm.iv; | 449 | struct nx_gcm_rctx *rctx = aead_request_ctx(req); |
| 450 | char *iv = rctx->iv; | ||
| 449 | char *nonce = nx_ctx->priv.gcm.nonce; | 451 | char *nonce = nx_ctx->priv.gcm.nonce; |
| 450 | 452 | ||
| 451 | memcpy(iv, nonce, NX_GCM4106_NONCE_LEN); | 453 | memcpy(iv, nonce, NX_GCM4106_NONCE_LEN); |
| @@ -457,7 +459,8 @@ static int gcm4106_aes_nx_encrypt(struct aead_request *req) | |||
| 457 | static int gcm4106_aes_nx_decrypt(struct aead_request *req) | 459 | static int gcm4106_aes_nx_decrypt(struct aead_request *req) |
| 458 | { | 460 | { |
| 459 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); | 461 | struct nx_crypto_ctx *nx_ctx = crypto_tfm_ctx(req->base.tfm); |
| 460 | char *iv = nx_ctx->priv.gcm.iv; | 462 | struct nx_gcm_rctx *rctx = aead_request_ctx(req); |
| 463 | char *iv = rctx->iv; | ||
| 461 | char *nonce = nx_ctx->priv.gcm.nonce; | 464 | char *nonce = nx_ctx->priv.gcm.nonce; |
| 462 | 465 | ||
| 463 | memcpy(iv, nonce, NX_GCM4106_NONCE_LEN); | 466 | memcpy(iv, nonce, NX_GCM4106_NONCE_LEN); |
