From patchwork Fri Oct 19 23:01:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 10650211 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-2.web.codeaurora.org (Postfix) with ESMTP id B1B9190 for ; Fri, 19 Oct 2018 23:01:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A267728534 for ; Fri, 19 Oct 2018 23:01:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 95D2428538; Fri, 19 Oct 2018 23:01:59 +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 4E08028534 for ; Fri, 19 Oct 2018 23:01:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726964AbeJTHKC (ORCPT ); Sat, 20 Oct 2018 03:10:02 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:46435 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726403AbeJTHKC (ORCPT ); Sat, 20 Oct 2018 03:10:02 -0400 Received: by mail-lf1-f68.google.com with SMTP id p143-v6so15349971lfp.13; Fri, 19 Oct 2018 16:01:56 -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:mime-version :content-transfer-encoding; bh=JUDsKVEpFI2WSrEK4ymBlDWGBvyZbz/NUcx+7+FSjp4=; b=fuj9s2EZTXWHj29ukWHh7PNzDXcrFLQF/lbDPCXYMwVBs4TgjlMKEMxp8C9zI6uvay MegVEjv6y43IbzJrVOJ63rI6TXvaJvdHW/kDGQq8Nz7tKCKJVEzBHGBP2p8F8509yMqE WggKKD/CO8weBc7CIK0rJDTloFcEIXMb/SW9V08c/NdlcdcjNN4EHfT/h+eJ86iM4YUZ ETck4qYV/NmAaIXQM1jo09trLrYiVIWYZI8YfB9cpt5cbKKK+ZVMSuOUhS/e8HHbr0Ap Wk8mOJnpWNgixHXlcXOvC7x9iv4YUVWXvobesW5/ooRQ49HN4hsBgBFcfMwW0EBfc4CY Q9jA== 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:mime-version :content-transfer-encoding; bh=JUDsKVEpFI2WSrEK4ymBlDWGBvyZbz/NUcx+7+FSjp4=; b=D4mqZIuHH6Ke/32jEhHrhlIkK7GlqqNGZpiNjvV9Pk0czGUbY52dE91noAs4X1h8BT TRd3JZVWkcTZ27UX/HwkBsjqDcSLCG5CTAbHsdQkX/iE2cQWKJnrAna9aFUOy6xIb0Cz DudzQrWwnV6uvN7BE3C5fRCxtLHH6vU59P2HtgDa9EvsuG8TjEs7swjJZwf3JaJ4+ykN 9yrJUNtYts4/p+hk5rwzkYAmyJXXKOC2HptisJreQMQZlqVycbtApSnGa7JXv2KYooVk lT5bdaO6QFO3o4L9Rd0m2Iprf5E/OewFfCGiwKXY90yHjCW7tbvYtIWL2N3ZU/6XubEt h/xA== X-Gm-Message-State: ABuFfoiP73tzH/mUjavHmNpQ7Qe2QIsMf8Lj9G4zs7lcqmvNqmtlAyNA mvU8srWyihqKdltpmUoonsBdgz9uVpE= X-Google-Smtp-Source: ACcGV63wY6MeflnXKHMbndXt6Rieo0ZXgCkl4wAmapuCb3m4NeNoskWTXKevv/eHXEmp88IFfNo7JA== X-Received: by 2002:a19:4e9a:: with SMTP id u26-v6mr4015036lfk.91.1539990115675; Fri, 19 Oct 2018 16:01:55 -0700 (PDT) Received: from rhovanion.lumag.spb.ru ([188.162.65.177]) by smtp.gmail.com with ESMTPSA id x141-v6sm5392701lff.32.2018.10.19.16.01.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 19 Oct 2018 16:01:54 -0700 (PDT) From: Dmitry Eremin-Solenikov To: linux-crypto@vger.kernel.org Cc: "David S. Miller" , Herbert Xu , stable@vger.kernel.org Subject: [PATCH 1/2] crypto: fix cfb mode decryption Date: Sat, 20 Oct 2018 02:01:52 +0300 Message-Id: <20181019230153.28201-1-dbaryshkov@gmail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.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 crypto_cfb_decrypt_segment() incorrectly XOR'ed generated keystream with IV, rather than with data stream, resulting in incorrect decryption. Test vectors will be added in the next patch. Signed-off-by: Dmitry Eremin-Solenikov Cc: stable@vger.kernel.org --- crypto/cfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crypto/cfb.c b/crypto/cfb.c index a0d68c09e1b9..fd4e8500e121 100644 --- a/crypto/cfb.c +++ b/crypto/cfb.c @@ -144,7 +144,7 @@ static int crypto_cfb_decrypt_segment(struct skcipher_walk *walk, do { crypto_cfb_encrypt_one(tfm, iv, dst); - crypto_xor(dst, iv, bsize); + crypto_xor(dst, src, bsize); iv = src; src += bsize;