From patchwork Thu Jun 28 13:07:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 140443 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp2166165ljj; Thu, 28 Jun 2018 06:08:07 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI2K8zGZZ6a/LdqBm/ckjx3b0aRgYAPBmRDlCmhvIdu3KYulMnnldEMTh1a88z9gLNE9iGa X-Received: by 2002:a65:6101:: with SMTP id z1-v6mr8726759pgu.282.1530191287167; Thu, 28 Jun 2018 06:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530191287; cv=none; d=google.com; s=arc-20160816; b=HSVHp3hR85tVZ7OhE14KSnBV10u//nHuVgqwm/TRYr/t78Kh5y8hLb6WKNi5nLrbLK W+halXeyA/p9ReJmFwS90+hk1OCnuMlI06T774cp4AfsD3jfzlt5c1IMsH9nSduN+ZaV yvsiN+wCCyFZst/lm7XdmNjukprk6N8wxYRDsMTmU/gFm2YP+I+TWV4XIj3CCAp8mqvK rq6ykgeFLFH/nI2SvwrZK6VkHtTeJ8uCh+8O2cVLrUrRlFC3WTH1CZCiQbe2L3Na2iDk xAfvCOTtXqP7r1gePyoFqpXdLLpMqkGQ8qJh1NY9/4zcYT/7onvdHlF0mJBbyyIP+vuF 5m6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=n8xdOgR9xdzvzWB90Up/sa7t8scWSSkMLPBwbUPPKZE=; b=vR1X0pYyefszfp13jn3uPJtWPFm53H/XB+rKvFZqhAPYRBzGuh4Jqf/gdLuVdg02dD WW5cOv3ZbPSJmHiInG9PCdI0flP3UpzCQMVLb7jh8U2vW+FMy/3bBA7F87MD5lDRaard JHctOtqRwYNknSTZbuIFydxAbdw+MpX47Z5HoBYpIpvKQE/QzClFVg07lRh6t3uDto3R IM/iO61b7FrNJMthgCZ27TRnlYO6Ltz+ayHuPdGSTa+E3EpN+bRfIT/I7zg2wDYrP6Fz MRdOfaGrTLsEiWKjpcj49qWfWJNUxL7lFwVKzmbeg9ThndVVNGMnsdQdQp0fyYQ1vyB8 //Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=TwLf1yEw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9-v6si6556676plo.206.2018.06.28.06.08.06; Thu, 28 Jun 2018 06:08:07 -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=@linaro.org header.s=google header.b=TwLf1yEw; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965616AbeF1NIF (ORCPT + 1 other); Thu, 28 Jun 2018 09:08:05 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:33913 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964854AbeF1NHy (ORCPT ); Thu, 28 Jun 2018 09:07:54 -0400 Received: by mail-lj1-f193.google.com with SMTP id l12-v6so4471686lja.1 for ; Thu, 28 Jun 2018 06:07:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n8xdOgR9xdzvzWB90Up/sa7t8scWSSkMLPBwbUPPKZE=; b=TwLf1yEwE8WItY91FenBbkE7tDsAuc5gacWmkzlmFks/DBHZYFgi+Qt436frykLcYi bGR4hdIMDROjvs0fBnfZmtZvMFleA+3hiYhsMT4QaY1T2HIt429H1GNQ9mizXhneaNik S14pzUtYtl+7ej9diHviKQ0uNW7IhgGWiz+sQ= 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:in-reply-to :references; bh=n8xdOgR9xdzvzWB90Up/sa7t8scWSSkMLPBwbUPPKZE=; b=taUImzjxjZC8RCaRWUEq5P2iv08L3TbbDZx6+ORc0hdH/pGm0mHHdT67tEz5oKYGIX ZAUG3jup7snNoE5meaF/NbiYeTNtCeteksEfhypmQ0+uli8KN4a3odUdR0bcLpRseZBJ y0tZFW78m0XB3eqjyB5Hmf/7S0dTGH90ZPO65dMJrJorAXIIwVfzHS43IoJgXV0LvTwm +Q+RiP7IyYfivCh8I4iTH8fPZFZ/K8CZuEyc5BMBKeDvljaNz6hMQ9/dhsSwtkme3mJn savBVnApNcevArD1tbVB/yIhYE4bTa7hbemBIUpeJ6NlzhNUhBtS0dzAolOxUYEeT5Y9 uqzA== X-Gm-Message-State: APt69E34bm87Kgxl+6fW8J0646AVOEEMsM8iLIAD81nToh9Km1uVW8ZE j0cWOPz2cI9QK+KcqD6VsYyk7L6X33o= X-Received: by 2002:a2e:658d:: with SMTP id e13-v6mr7024179ljf.57.1530191271731; Thu, 28 Jun 2018 06:07:51 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id d24-v6sm1314649lfl.53.2018.06.28.06.07.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 28 Jun 2018 06:07:50 -0700 (PDT) From: Linus Walleij To: linux-crypto@vger.kernel.org, Herbert Xu , Tudor Ambarus Cc: Linus Walleij Subject: [PATCH 8/9 v2] crypto: atmel-ecc: Detail what is unlocked Date: Thu, 28 Jun 2018 15:07:28 +0200 Message-Id: <20180628130729.17589-8-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180628130729.17589-1-linus.walleij@linaro.org> References: <20180628130729.17589-1-linus.walleij@linaro.org> Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Instead of just providing a broad error message about the chip being unlocked provide details on what is unlocked, one line per thing that can be locked: data and OTP and configuration are locked independently. Loose the overzealous defines. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebased --- drivers/crypto/atmel-ecc.c | 8 ++++++-- drivers/crypto/atmel-ecc.h | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) -- 2.17.0 diff --git a/drivers/crypto/atmel-ecc.c b/drivers/crypto/atmel-ecc.c index 659cb3cf37a9..0dfea6eadc56 100644 --- a/drivers/crypto/atmel-ecc.c +++ b/drivers/crypto/atmel-ecc.c @@ -690,8 +690,12 @@ static int device_sanity_check(struct i2c_client *client) * Failure to lock these zones may permit modification of any secret * keys and may lead to other security problems. */ - if (cmd->data[LOCK_CONFIG_IDX] || cmd->data[LOCK_VALUE_IDX]) { - dev_err(&client->dev, "Configuration or Data and OTP zones are unlocked!\n"); + if (cmd->data[RSP_DATA_IDX+3] == 0x55) { + dev_err(&client->dev, "configuration zone is unlocked\n"); + ret = -ENOTSUPP; + } + if (cmd->data[RSP_DATA_IDX+2] == 0x55) { + dev_err(&client->dev, "data and OTP zones are unlocked\n"); ret = -ENOTSUPP; } diff --git a/drivers/crypto/atmel-ecc.h b/drivers/crypto/atmel-ecc.h index 4458585ab588..42b724256f93 100644 --- a/drivers/crypto/atmel-ecc.h +++ b/drivers/crypto/atmel-ecc.h @@ -97,8 +97,6 @@ static const struct { #define CONFIG_ZONE_SERIAL_8_I2CEN 0x03 #define CONFIG_ZONE_I2C_OTP 0x04 #define CONFIG_ZONE_FOOTER 0x15 -#define LOCK_VALUE_IDX (RSP_DATA_IDX + 2) -#define LOCK_CONFIG_IDX (RSP_DATA_IDX + 3) /* * Wake High delay to data communication (microseconds). SDA should be stable