From patchwork Sun May 20 08:57:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?T25kcmVqIE1vc27DocSNZWs=?= X-Patchwork-Id: 10413315 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A1AD260365 for ; Sun, 20 May 2018 08:58:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 86E9B28703 for ; Sun, 20 May 2018 08:58:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 791662870C; Sun, 20 May 2018 08:58:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1ED5928703 for ; Sun, 20 May 2018 08:57:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750878AbeETI56 (ORCPT ); Sun, 20 May 2018 04:57:58 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:46940 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750800AbeETI55 (ORCPT ); Sun, 20 May 2018 04:57:57 -0400 Received: by mail-wr0-f195.google.com with SMTP id x9-v6so10217188wrl.13 for ; Sun, 20 May 2018 01:57:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=LX6/x29Y1c9sA6soWEn/KEQtRrgQsrdO8U8CuTBPMS8=; b=nt2yzsuWKCe8S5uQVtk/3FNP4qtGniHvPM+U/gYvzqdrKnwBJjwBzrsp/0UtNdRwym PiDW9wmLXfuwP8MqGwisows2PCTHf5kyH6Yxi0OpuC+c/5MhmMk371eKknlw8vLnI79G TJxwTrViIkZrtElbQDJCwSKrH+Rhb7uit5KT3Pt03bOQvKW5y09a6FzyIwuF6JchzEne +XfJsb9DHlQ0t4kvq71X4ksrGqwqd7M+0f/FG8VpYBuO3B6l+DJ6zJe9lVIxkvLwcqWv 8bY13UZk4T7qYb5l6T1g4Cnjt0c4+4+xdbnhcYvDVcG6887HADedf1upSClg9TZkcNBu SVPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=LX6/x29Y1c9sA6soWEn/KEQtRrgQsrdO8U8CuTBPMS8=; b=a5zUUcWE4kEVC8EeWLIsC37usvUg7gr1Wnz0lioonqgiMZMJ33WrXVMMESkV5W+m0Z Wh/nvKgOObiKYBbXwcRm+n7AXUCFiTNPoBCvEy4GURIdXf6nMRnXd9RxCT0FcW8KRib5 mYQ3udkgTOEFgz+bNVSWesYCoNXaBJkoEi8zY09Hx96M75QqI8kJqas0wzkfU7DalYEn aly2csvyoX4W0Pkzer3EYbHA1QGHoUhfJGzBQuY8PiebWYZzRou+cFIxLi4G/j0brhCn 0PCAvM3HO9e23m9OtQRpZga/tsI7Ue9hMIeCt1RRWJ3J3lxhrFgkKz1AGEHLle+Qff6l jjjQ== X-Gm-Message-State: ALKqPwcxAmKSIZa5l+jnnvw05Jn2GsQ08UK0EyJ2WeVurJNjAMtiTZeR mWw7pVig8FR0Nwi6oxOq42kaMbFq X-Google-Smtp-Source: AB8JxZquu0MTlMnc0Xolb6MtyW+YElT4qPO0lhM8z+oB8vowUVK/b6/4lW1SoetXpEnJ7zHQp3Q8dw== X-Received: by 2002:adf:b722:: with SMTP id l34-v6mr13370809wre.85.1526806676320; Sun, 20 May 2018 01:57:56 -0700 (PDT) Received: from omosnacek-acer.redhat.com ([2a02:8308:b041:e600:ac61:6486:6de9:2dd5]) by smtp.gmail.com with ESMTPSA id x73-v6sm8250630wmf.21.2018.05.20.01.57.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 20 May 2018 01:57:54 -0700 (PDT) From: =?UTF-8?q?Ondrej=20Mosn=C3=A1=C4=8Dek?= To: linux-crypto@vger.kernel.org Cc: Herbert Xu , Eric Biggers , Milan Broz , Ondrej Mosnacek Subject: [PATCH] crypto: x86/aegis256 - Fix wrong key buffer size Date: Sun, 20 May 2018 10:57:23 +0200 Message-Id: <20180520085723.6663-1-omosnacek@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ondrej Mosnacek AEGIS-256 key is two blocks, not one. Fixes: 1d373d4e8e15 ("crypto: x86 - Add optimized AEGIS implementations") Reported-by: Eric Biggers Signed-off-by: Ondrej Mosnacek --- arch/x86/crypto/aegis256-aesni-glue.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/crypto/aegis256-aesni-glue.c b/arch/x86/crypto/aegis256-aesni-glue.c index 3181655dd862..2b5dd3af8f4d 100644 --- a/arch/x86/crypto/aegis256-aesni-glue.c +++ b/arch/x86/crypto/aegis256-aesni-glue.c @@ -57,7 +57,7 @@ struct aegis_state { }; struct aegis_ctx { - struct aegis_block key; + struct aegis_block key[AEGIS256_KEY_SIZE / AEGIS256_BLOCK_SIZE]; }; struct aegis_crypt_ops { @@ -164,7 +164,7 @@ static int crypto_aegis256_aesni_setkey(struct crypto_aead *aead, const u8 *key, return -EINVAL; } - memcpy(ctx->key.bytes, key, AEGIS256_KEY_SIZE); + memcpy(ctx->key, key, AEGIS256_KEY_SIZE); return 0; } @@ -190,7 +190,7 @@ static void crypto_aegis256_aesni_crypt(struct aead_request *req, kernel_fpu_begin(); - crypto_aegis256_aesni_init(&state, ctx->key.bytes, req->iv); + crypto_aegis256_aesni_init(&state, ctx->key, req->iv); crypto_aegis256_aesni_process_ad(&state, req->src, req->assoclen); crypto_aegis256_aesni_process_crypt(&state, req, ops); crypto_aegis256_aesni_final(&state, tag_xor, req->assoclen, cryptlen);