]> Pileus Git - ~andy/linux/blobdiff - crypto/ghash-generic.c
Merge tag 'v3.6-rc7' into core/rcu
[~andy/linux] / crypto / ghash-generic.c
index be4425616931ffcf0f1747aa752d76f15379c989..7835b8fc94db6d69b9e93c1806d677e8ea390736 100644 (file)
@@ -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);