diff options
Diffstat (limited to 'crypto/ghash-generic.c')
-rw-r--r-- | crypto/ghash-generic.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/ghash-generic.c b/crypto/ghash-generic.c index be4425616931..7835b8fc94db 100644 --- a/crypto/ghash-generic.c +++ b/crypto/ghash-generic.c | |||
@@ -67,6 +67,9 @@ static int ghash_update(struct shash_desc *desc, | |||
67 | struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); | 67 | struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); |
68 | u8 *dst = dctx->buffer; | 68 | u8 *dst = dctx->buffer; |
69 | 69 | ||
70 | if (!ctx->gf128) | ||
71 | return -ENOKEY; | ||
72 | |||
70 | if (dctx->bytes) { | 73 | if (dctx->bytes) { |
71 | int n = min(srclen, dctx->bytes); | 74 | int n = min(srclen, dctx->bytes); |
72 | u8 *pos = dst + (GHASH_BLOCK_SIZE - dctx->bytes); | 75 | u8 *pos = dst + (GHASH_BLOCK_SIZE - dctx->bytes); |
@@ -119,6 +122,9 @@ static int ghash_final(struct shash_desc *desc, u8 *dst) | |||
119 | struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); | 122 | struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); |
120 | u8 *buf = dctx->buffer; | 123 | u8 *buf = dctx->buffer; |
121 | 124 | ||
125 | if (!ctx->gf128) | ||
126 | return -ENOKEY; | ||
127 | |||
122 | ghash_flush(ctx, dctx); | 128 | ghash_flush(ctx, dctx); |
123 | memcpy(dst, buf, GHASH_BLOCK_SIZE); | 129 | memcpy(dst, buf, GHASH_BLOCK_SIZE); |
124 | 130 | ||