Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp515881yba; Wed, 15 May 2019 05:29:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxk08UX3u2VQn45zdcKyYjxnK8SCOU8umIXxes9k/VnNtLdDAD4KY/NtLbi+4JCtAj46UsD X-Received: by 2002:a17:902:6bc2:: with SMTP id m2mr42935250plt.24.1557923389545; Wed, 15 May 2019 05:29:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557923389; cv=none; d=google.com; s=arc-20160816; b=pOSx9O8Maif6EdrIfuXFXwGsh8sLFZreIh0lMyh45GCDuu/wHuM1iQVTCmDTL9dww5 ar/6hi40Mhche7Uz9w2cqOe5yzJSQls+YxEUcLaPK/pE3JQap/rFAKKgw1U1zPPuKVac 2qx910EZwzAolo0sx7+rblYxQ0Lp/YZL8Cm1DpAfeGOeWKKDTI8PXr+0yTccmZ/UxI8I jGfiRigrzBWMtakv5EtMyb8xnQ5anzs+XAs1JWNhr7zsXBaAy+ask9KFn+kvnCqRALB7 PPqymA3eOuRB9exyZ7vK0O1bPD/8fO5nKQzQ9AtvA6vsgiJoEG/vtsYjLiBkXSO70trL YtKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:cc:to:subject:from:message-id :dkim-signature; bh=zYf06nweMlwdkB63d/iwHQ8zN1gvYKYrXVQma/FlmF8=; b=FlSuJY8Mpzd4zHWjgO2SawyGCgFfG9qi4y9K0WyZ0D1ZtzlwxENdT05mcLIT85jBrE tX+P+eyPBJOcB+J7xJiAiMXMM9RDwvTI+McDvBbgK/1OSQ6M5aHnsM1UD70i2m1Fyjz1 LP0mPI/cuhAtKd3ZGSiXQk3XIzmZkYH2AK4JwSpRZdmRs8QK6sKfKmUQaEtyPiZsuUxT 61cls8BOpBl4V2uU3slYs0IYzK9Jgz4CnPztuhXc3QYqO6rgruEvRrScmuH5FsRLcAeS 0DD+cvvCNkIO3NuFYSI7JScIytXEv1115J3O70iSqisaT6tyzlfkmpqKcI8ZVdbZFipv QEKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=rWkD5a5Z; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v130si2101816pfc.99.2019.05.15.05.29.30; Wed, 15 May 2019 05:29:49 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=rWkD5a5Z; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726441AbfEOM3F (ORCPT + 99 others); Wed, 15 May 2019 08:29:05 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:32414 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726803AbfEOM3F (ORCPT ); Wed, 15 May 2019 08:29:05 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 453v4G46LpzB09ZT; Wed, 15 May 2019 14:29:02 +0200 (CEST) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=rWkD5a5Z; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id mqvdH3CK5meM; Wed, 15 May 2019 14:29:02 +0200 (CEST) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 453v4G34B0zB09ZM; Wed, 15 May 2019 14:29:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1557923342; bh=zYf06nweMlwdkB63d/iwHQ8zN1gvYKYrXVQma/FlmF8=; h=From:Subject:To:Cc:Date:From; b=rWkD5a5ZuBL0aLuOC5hNArmInkB27CpOTt6WauM4nOol/xQ/Uv/Q9oUEFofWjFt1n PYVURtLaJmGdKBLQlMqYP3CuasbHZTArluyuHrEosDiyhK6+XBzdFomDx4vM1cAcAh CkjA+IEoniWDRoLQ8us3ywaky/LXk5oRulkLvPYc= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id B86268B906; Wed, 15 May 2019 14:29:02 +0200 (CEST) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id FNjLGilsuU0a; Wed, 15 May 2019 14:29:02 +0200 (CEST) Received: from po16846vm.idsi0.si.c-s.fr (po15451.idsi0.si.c-s.fr [172.25.231.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 9A4218B905; Wed, 15 May 2019 14:29:02 +0200 (CEST) Received: by po16846vm.idsi0.si.c-s.fr (Postfix, from userid 0) id 7D606682B4; Wed, 15 May 2019 12:29:03 +0000 (UTC) Message-Id: From: Christophe Leroy Subject: [PATCH] crypto: talitos - fix skcipher failure due to wrong output IV To: Herbert Xu , "David S. Miller" Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Date: Wed, 15 May 2019 12:29:03 +0000 (UTC) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Selftests report the following: [ 2.984845] alg: skcipher: cbc-aes-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 2.995377] 00000000: 3d af ba 42 9d 9e b4 30 b4 22 da 80 2c 9f ac 41 [ 3.032673] alg: skcipher: cbc-des-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 3.043185] 00000000: fe dc ba 98 76 54 32 10 [ 3.063238] alg: skcipher: cbc-3des-talitos encryption test failed (wrong output IV) on test vector 0, cfg="in-place" [ 3.073818] 00000000: 7d 33 88 93 0f 93 b2 42 This above dumps show that the actual output IV is indeed the input IV. This is due to the IV not being copied back into the request. This patch fixes that. Signed-off-by: Christophe Leroy --- drivers/crypto/talitos.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c index 1d429fc073d1..f443cbe7da80 100644 --- a/drivers/crypto/talitos.c +++ b/drivers/crypto/talitos.c @@ -1637,11 +1637,15 @@ static void ablkcipher_done(struct device *dev, int err) { struct ablkcipher_request *areq = context; + struct crypto_ablkcipher *cipher = crypto_ablkcipher_reqtfm(areq); + struct talitos_ctx *ctx = crypto_ablkcipher_ctx(cipher); + unsigned int ivsize = crypto_ablkcipher_ivsize(cipher); struct talitos_edesc *edesc; edesc = container_of(desc, struct talitos_edesc, desc); common_nonsnoop_unmap(dev, edesc, areq); + memcpy(areq->info, ctx->iv, ivsize); kfree(edesc); -- 2.13.3