]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: dh - fix calculating encoded key size
authorEric Biggers <ebiggers@google.com>
Fri, 27 Jul 2018 22:36:10 +0000 (15:36 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 3 Aug 2018 10:06:06 +0000 (18:06 +0800)
commit5294fb29d6bb23f3bf57741e37e41ad0def1b3ec
tree8e433b5ee404d6f4ed9a4319f0358ef6b5fb7f42
parent27db745f69ed568cf8547bd3d51f7cfc734ac168
crypto: dh - fix calculating encoded key size

It was forgotten to increase DH_KPP_SECRET_MIN_SIZE to include 'q_size',
causing an out-of-bounds write of 4 bytes in crypto_dh_encode_key(), and
an out-of-bounds read of 4 bytes in crypto_dh_decode_key().  Fix it, and
fix the lengths of the test vectors to match this.

Reported-by: syzbot+6d38d558c25b53b8f4ed@syzkaller.appspotmail.com
Fixes: cb01f1de44fc ("crypto: dh - add public key verification test")
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/dh_helper.c
crypto/testmgr.h