summaryrefslogtreecommitdiff
path: root/crypto/ghash-generic.c
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2011-10-24 17:03:35 +0200
committerGrant Likely <grant.likely@secretlab.ca>2011-10-24 17:03:35 +0200
commit2bf6f675fa1a0f80b21aff20e6c21e87d6a7c9c9 (patch)
treeef49d741211dcc4f38636b5c422c9c346da09adf /crypto/ghash-generic.c
parent5762c20593b6b959f1470dc6f1ff4ca4d9570f8d (diff)
parentc3b92c8787367a8bb53d57d9789b558f1295cc96 (diff)
Merge commit 'v3.1' into devicetree/next
Diffstat (limited to 'crypto/ghash-generic.c')
-rw-r--r--crypto/ghash-generic.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/ghash-generic.c b/crypto/ghash-generic.c
index be442561693..7835b8fc94d 100644
--- a/crypto/ghash-generic.c
+++ b/crypto/ghash-generic.c
@@ -67,6 +67,9 @@ static int ghash_update(struct shash_desc *desc,
struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm);
u8 *dst = dctx->buffer;
+ if (!ctx->gf128)
+ return -ENOKEY;
+
if (dctx->bytes) {
int n = min(srclen, dctx->bytes);
u8 *pos = dst + (GHASH_BLOCK_SIZE - dctx->bytes);
@@ -119,6 +122,9 @@ static int ghash_final(struct shash_desc *desc, u8 *dst)
struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm);
u8 *buf = dctx->buffer;
+ if (!ctx->gf128)
+ return -ENOKEY;
+
ghash_flush(ctx, dctx);
memcpy(dst, buf, GHASH_BLOCK_SIZE);