10 Jan, 2018

1 commit

  • commit e57121d08c38dabec15cf3e1e2ad46721af30cae upstream.

    If the rfc7539 template was instantiated with a hash algorithm with
    digest size larger than 16 bytes (POLY1305_DIGEST_SIZE), then the digest
    overran the 'tag' buffer in 'struct chachapoly_req_ctx', corrupting the
    subsequent memory, including 'cryptlen'. This caused a crash during
    crypto_skcipher_decrypt().

    Fix it by, when instantiating the template, requiring that the
    underlying hash algorithm has the digest size expected for Poly1305.

    Reproducer:

    #include
    #include
    #include

    int main()
    {
    int algfd, reqfd;
    struct sockaddr_alg addr = {
    .salg_type = "aead",
    .salg_name = "rfc7539(chacha20,sha256)",
    };
    unsigned char buf[32] = { 0 };

    algfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
    bind(algfd, (void *)&addr, sizeof(addr));
    setsockopt(algfd, SOL_ALG, ALG_SET_KEY, buf, sizeof(buf));
    reqfd = accept(algfd, 0, 0);
    write(reqfd, buf, 16);
    read(reqfd, buf, 16);
    }

    Reported-by: syzbot
    Fixes: 71ebc4d1b27d ("crypto: chacha20poly1305 - Add a ChaCha20-Poly1305 AEAD construction, RFC7539")
    Signed-off-by: Eric Biggers
    Signed-off-by: Herbert Xu
    Signed-off-by: Greg Kroah-Hartman

    Eric Biggers
     

01 Nov, 2016

2 commits


18 Jul, 2016

1 commit

  • This patch converts chacha20poly1305 to use the new skcipher
    interface as opposed to ablkcipher.

    It also fixes a buglet where we may end up with an async poly1305
    when the user asks for a async algorithm. This shouldn't be a
    problem yet as there aren't any async implementations of poly1305
    out there.

    Signed-off-by: Herbert Xu

    Herbert Xu
     

09 Dec, 2015

1 commit


17 Aug, 2015

1 commit


17 Jul, 2015

3 commits


17 Jun, 2015

1 commit


04 Jun, 2015

2 commits