提交 2efd7c0f 编写于 作者: L Linus Torvalds

Merge git://github.com/herbertx/crypto

* git://github.com/herbertx/crypto:
  crypto: ghash - Avoid null pointer dereference if no key is set
...@@ -67,6 +67,9 @@ static int ghash_update(struct shash_desc *desc, ...@@ -67,6 +67,9 @@ static int ghash_update(struct shash_desc *desc,
struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm);
u8 *dst = dctx->buffer; u8 *dst = dctx->buffer;
if (!ctx->gf128)
return -ENOKEY;
if (dctx->bytes) { if (dctx->bytes) {
int n = min(srclen, dctx->bytes); int n = min(srclen, dctx->bytes);
u8 *pos = dst + (GHASH_BLOCK_SIZE - dctx->bytes); u8 *pos = dst + (GHASH_BLOCK_SIZE - dctx->bytes);
...@@ -119,6 +122,9 @@ static int ghash_final(struct shash_desc *desc, u8 *dst) ...@@ -119,6 +122,9 @@ static int ghash_final(struct shash_desc *desc, u8 *dst)
struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm); struct ghash_ctx *ctx = crypto_shash_ctx(desc->tfm);
u8 *buf = dctx->buffer; u8 *buf = dctx->buffer;
if (!ctx->gf128)
return -ENOKEY;
ghash_flush(ctx, dctx); ghash_flush(ctx, dctx);
memcpy(dst, buf, GHASH_BLOCK_SIZE); memcpy(dst, buf, GHASH_BLOCK_SIZE);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册