Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 75941
b: refs/heads/master
c: 481f34a
h: refs/heads/master
i:
  75939: ba249f0
v: v3
  • Loading branch information
Herbert Xu committed Jan 10, 2008
1 parent 145a7b2 commit 4cff6a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e236d4a89a2ffbc8aa18064161f4f159c4d89b4a
refs/heads/master: 481f34ae752ac74c4cbd88a9954dd4ed10e84f81
14 changes: 10 additions & 4 deletions trunk/crypto/authenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ static int crypto_authenc_encrypt(struct aead_request *req)
return crypto_authenc_hash(req);
}

static int crypto_authenc_verify(struct aead_request *req)
static int crypto_authenc_verify(struct aead_request *req,
unsigned int cryptlen)
{
struct crypto_aead *authenc = crypto_aead_reqtfm(req);
struct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc);
Expand All @@ -170,7 +171,6 @@ static int crypto_authenc_verify(struct aead_request *req)
u8 *ohash = aead_request_ctx(req);
u8 *ihash;
struct scatterlist *src = req->src;
unsigned int cryptlen = req->cryptlen;
unsigned int authsize;
int err;

Expand Down Expand Up @@ -214,16 +214,22 @@ static int crypto_authenc_decrypt(struct aead_request *req)
struct crypto_aead *authenc = crypto_aead_reqtfm(req);
struct crypto_authenc_ctx *ctx = crypto_aead_ctx(authenc);
struct ablkcipher_request *abreq = aead_request_ctx(req);
unsigned int cryptlen = req->cryptlen;
unsigned int authsize = crypto_aead_authsize(authenc);
int err;

err = crypto_authenc_verify(req);
if (cryptlen < authsize)
return -EINVAL;
cryptlen -= authsize;

err = crypto_authenc_verify(req, cryptlen);
if (err)
return err;

ablkcipher_request_set_tfm(abreq, ctx->enc);
ablkcipher_request_set_callback(abreq, aead_request_flags(req),
crypto_authenc_decrypt_done, req);
ablkcipher_request_set_crypt(abreq, req->src, req->dst, req->cryptlen,
ablkcipher_request_set_crypt(abreq, req->src, req->dst, cryptlen,
req->iv);

return crypto_ablkcipher_decrypt(abreq);
Expand Down

0 comments on commit 4cff6a0

Please sign in to comment.