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: 10448341 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 C92BC60234 for ; Tue, 5 Jun 2018 13:50:43 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B9EB9294A4 for ; Tue, 5 Jun 2018 13:50:43 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AED9C294AE; Tue, 5 Jun 2018 13:50:43 +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, 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 4C3A0294A4 for ; Tue, 5 Jun 2018 13:50:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751949AbeFENum (ORCPT ); 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-Google-Smtp-Source: ADUXVKIS15nz3wyypzO9qJgJa1N8qYoHKHsHhPYjO76KwpBOqD0RrxM2UDPYuufgeCbaOj+eu92Cow== 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 X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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