lkml.org 
[lkml]   [2022]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 5.4 078/475] crypto: rsa-pkcs1pad - fix buffer overread in pkcs1pad_verify_complete()
    Date
    From: Eric Biggers <ebiggers@google.com>

    commit a24611ea356c7f3f0ec926da11b9482ac1f414fd upstream.

    Before checking whether the expected digest_info is present, we need to
    check that there are enough bytes remaining.

    Fixes: a49de377e051 ("crypto: Add hash param to pkcs1pad")
    Cc: <stable@vger.kernel.org> # v4.6+
    Cc: Tadeusz Struk <tadeusz.struk@linaro.org>
    Signed-off-by: Eric Biggers <ebiggers@google.com>
    Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    crypto/rsa-pkcs1pad.c | 2 ++
    1 file changed, 2 insertions(+)

    --- a/crypto/rsa-pkcs1pad.c
    +++ b/crypto/rsa-pkcs1pad.c
    @@ -475,6 +475,8 @@ static int pkcs1pad_verify_complete(stru
    pos++;

    if (digest_info) {
    + if (digest_info->size > dst_len - pos)
    + goto done;
    if (crypto_memneq(out_buf + pos, digest_info->data,
    digest_info->size))
    goto done;

    \
     
     \ /
      Last update: 2022-04-14 16:22    [W:4.041 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site