From patchwork Tue Jun 5 13:49:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 137741 Delivered-To: patch@linaro.org Received: by 2002:a2e:970d:0:0:0:0:0 with SMTP id r13-v6csp986193lji; Tue, 5 Jun 2018 06:50:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKOlD4OCUL+enPwbe0A3IbxfdE8R9CCLMhsKZPpzasjS0qyTaw3dWJcEGox7c+L3tStxgzE X-Received: by 2002:a62:9945:: with SMTP id d66-v6mr15620722pfe.192.1528206643499; Tue, 05 Jun 2018 06:50:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528206643; cv=none; d=google.com; s=arc-20160816; b=SjJ0mxqBVPJSuKU41HRspt/lgt7PbGpEqu0a4dvFhHyumklewBtaHAsPKS8E705faD Q+JPV62hoLYPD+5rct3vkgeHrJA8ChfLQrX6W9BVME8VE8cWb0AF9L5uVi5sMf6irD+a 7qevyKualZkIOdB3ZvglQqx/TVtcQozqQD1zbPoOvwjNcaA5FC3QG3K2G6U1MiVHbmu0 4axEtTrt4ZxQFsjujCVDt4GfjmOS4o7C45GiBT/uysXOrmZi9skNHx5xA0IJf6f1NJFG hiFIUOjv3nD9Q7KIaLyAUw53fL6OfFX0Ua61ZTonydLng+HPANau0Hdr0WT1oNc3TXX1 vyJw== 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=GzEI/+65HMa0rNp6Pw7CGfVjulmnkWrDhv37jqOeDAE=; b=IUvLTJ1R9dP4tW5C96+l2NvTjme2euE1yBDk5ZPbaVVLfcfME4xCWfDZdTBWGaWOud 3yTNUicxE1p9RyuW/seZh/sO0yLnEapzeYl9CoAoBdmxR4D5QCqgkzB3bwJtsC9Pt2EM CKKdNhGqAeLPFRh464REege5RFdzXRFq30ARqxLUB38feik580cHVCcnmDexepo+ziCi yx53brbRJhx6LekTL6lwXBNAXp8OXNPw/xRzEWobrIdX2z8oZJnktF0BiyhqZXxyzwOu izCbs0j0b0UfLo+y8ydbn6jwOZ+jsXkuBBiaWf5VKaK/DFNrBbRibGATkq5e00B2TR4f GcCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AsK4Lrmf; 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 j78-v6si24186154pfe.187.2018.06.05.06.50.43; Tue, 05 Jun 2018 06:50:43 -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=AsK4Lrmf; 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 S1751949AbeFENum (ORCPT + 1 other); Tue, 5 Jun 2018 09:50:42 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:44975 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751750AbeFENul (ORCPT ); Tue, 5 Jun 2018 09:50:41 -0400 Received: by mail-lf0-f67.google.com with SMTP id 36-v6so3679054lfr.11 for ; Tue, 05 Jun 2018 06:50:41 -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=GzEI/+65HMa0rNp6Pw7CGfVjulmnkWrDhv37jqOeDAE=; b=AsK4LrmfCdy34EY13RKEZhfVr3GeD6SpzfcX0QxGB3NpSA5nHoet0jq/QnzjsCfKFQ An7bJRmcZb6fjd/Kgce+TjSgqzND/57WwfbITSZG09M0wFC1u+N9EazW1q4tFhoDfVYp g8P6ZXIrZhKJ98gUR3Vr4ICszUgDGKFnRHy1E= 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=GzEI/+65HMa0rNp6Pw7CGfVjulmnkWrDhv37jqOeDAE=; b=MGP/XFFHQDTxPFdTzCSbcDV2tb9JMJ5KnA55wFX6/Gm/c/u9EYSR8K8PL/FDsxKJzS DdEfbCN6G/p5fLA+gBi4e/+sQB9ot0kIAHN6+yTOCs+bOAkoktfumm02owORGXZmZmZ6 9HGZYWsKDJCiescIi51omuFkuCQOaDyVyZs+mbUu4jh5z1gHSx8Na3cWV1uZFMcpltFA 5lJDUSc+GSYgs3DoVLloo23VjFED2Qwbzvh3XU5agtSVmxgY8e/UteHWcRY7p/s4UkEV 1pJnX0TxgLKe/pcCvNBVbU5nJmbJqPc7jOEufWkOwrQWoXgFBRQgGA0g5EVvLJp5Lgng Lfag== X-Gm-Message-State: APt69E2YuqWhQmgUaJYacQchm5jw8iVjGN1D7jAvIDxKWuoJChvrRmDJ RACTX53DTwQ3Kpc9h03YsIBf9qvO9o8= X-Received: by 2002:a19:1099:: with SMTP id 25-v6mr1681732lfq.112.1528206640358; Tue, 05 Jun 2018 06:50:40 -0700 (PDT) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id x72-v6sm5201092lfi.52.2018.06.05.06.50.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 05 Jun 2018 06:50:39 -0700 (PDT) From: Linus Walleij To: linux-crypto@vger.kernel.org, Herbert Xu , Tudor Ambarus Cc: Linus Walleij Subject: [PATCH 8/9] crypto: atmel-ecc: Detail what is unlocked Date: Tue, 5 Jun 2018 15:49:49 +0200 Message-Id: <20180605134950.6605-8-linus.walleij@linaro.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180605134950.6605-1-linus.walleij@linaro.org> References: <20180605134950.6605-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 --- 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 fd8149313104..2b6c8bb7bd1c 100644 --- a/drivers/crypto/atmel-ecc.c +++ b/drivers/crypto/atmel-ecc.c @@ -692,8 +692,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 2a378bccc213..988e46507619 100644 --- a/drivers/crypto/atmel-ecc.h +++ b/drivers/crypto/atmel-ecc.h @@ -113,8 +113,6 @@ static const struct { #define CONFIG_ZONE_LKU_4_5 0x13 #define CONFIG_ZONE_LKU_6_7 0x14 #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