From patchwork Sat Apr 27 00:14:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lothar Rubusch X-Patchwork-Id: 13645495 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7B06FC4345F for ; Sat, 27 Apr 2024 00:15:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=ZYSBpb+nOM1j5AozKE9siKhUNsZ/TOL731hAVII/Y1c=; b=FVZ0Csf9NsEsP5 AUqFHDO0GWrVhFqG2C5xsEYmh8++1QN/LvD+7NAfSPxncVGesl00khNiRGJOWXmoQbWjKNMOSpnnp QB4nOD8rjgOJPFswTZ7BMXS2BzijgLgPzlIyPwGsGbqvG+7HGBhPBxxhJ/lXlgSuCYKHRsw096X8G jvKlNXsmcfrVfL76lyR+xGjC9J2FLWStEOj3MKkeHIkC27CCSatmJ9w2JvEmRNp21rDpjxzki0fu6 Ks60L9atDPbbQkrC+HFxppMxVdL6vKzp2KCORegaLwElDTkxT2LuHcMAMgbygqnb6QpFixfkmmrtG IaqVj8+0Bk1IbRF4qUug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0ViL-0000000ESNZ-0Lwu; Sat, 27 Apr 2024 00:14:49 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s0ViI-0000000ESMJ-2wz3 for linux-arm-kernel@lists.infradead.org; Sat, 27 Apr 2024 00:14:47 +0000 Received: by mail-wr1-x42f.google.com with SMTP id ffacd0b85a97d-343c891bca5so2088468f8f.2 for ; Fri, 26 Apr 2024 17:14:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714176884; x=1714781684; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=YV6AybQpNM5L7BmGh7OKWpSwXS2G3KXKiGflHVOVNWA=; b=FEBL/F1RtHyq49K+Cba9M6QoOpMRk96MzP48eYe/MuRcEHpFCW3GIYOZT68gwr5whj KCBAJDFHlV5bFm2JMz70+ZtqbjZQv1FayemBr8AXrAI2Iayc0M0EPjTrWQpRk0MvOffI NhTujBSfo5Np1ZR9dCbAoBqdAGlIC8Fo+3poCq4QckekTnTO0SVcvehV2rlMujECq+47 jWJNLfrBVT2tp62Elodm3tobmi04QXMbfQIBCha3CEeSdBJyIlcGkSd+o5/Ad3uTNGlr I2l3Pmlb2iz+JjI8u521Rz0wTUOoxiOK2NXOOA6l/RkkBTE/AO7X5fcf4bJucAvunrBY zVVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714176884; x=1714781684; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YV6AybQpNM5L7BmGh7OKWpSwXS2G3KXKiGflHVOVNWA=; b=AAtJ6vsi3kvxr4oQ0zeBYeXPUnjfDSCGKhrlK4riLOuaoJ9ZBGyhVKBo0R3ghUob5s 9ruwGkhFzdq7K04PIn55OnEZtiQ2+ZTEBgIAEvbszfqag0sizyk1UbgfEw5vxzcxO950 DD+Nf1XkRmxDO9aCcSBExQ1+IaV/wJyP7FXolgtTsRjctFdw6Yli4nD5ufwdeh4EMqtc +pX7mRRyw3BCRblSmnj2J9KE6xKXp8ZpY9rJuEegsB63TVqerhE+O+Sw7MMqZZ/8rhkv qroc3iB3GseanaLrK3y9J+BBIMr8xF/803v3GnCwqk2p7gL2Bwv1BT+tZCmbyTqfMpjl MalQ== X-Forwarded-Encrypted: i=1; AJvYcCVKprdacsiCPOwodP30KKe4kfTIIbXAqLpwS/HcfcwWG5ckB/m7avdc/hr4gyfmTJfhTxVH8wp4Faq0u0EHlzoslcQ+XMy5gRHAqWzhBpYVH6bAZ38= X-Gm-Message-State: AOJu0YzOvGuHMX+i5FFmzz9xHsPiX1zkBZtuXmUbvE3yTQiY30fy2Xm1 c1jjRIWDH7uM4pfwc9gY3dh5ehWf2wwNRZytK5m3yDOEIMwjCpVf X-Google-Smtp-Source: AGHT+IGL5dxWGqVeotM/Lk06XoKolWNj02U23g6RMrYPs/XMCqXFfCjzQfg4i39C52BMjACbLqFwrg== X-Received: by 2002:adf:f5c7:0:b0:34a:d1d4:cb3c with SMTP id k7-20020adff5c7000000b0034ad1d4cb3cmr3481888wrp.39.1714176883758; Fri, 26 Apr 2024 17:14:43 -0700 (PDT) Received: from 2116bb4b8996.v.cablecom.net (84-72-156-211.dclient.hispeed.ch. [84.72.156.211]) by smtp.gmail.com with ESMTPSA id e7-20020a5d65c7000000b00349eb6eae3esm23748079wrw.4.2024.04.26.17.14.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 17:14:43 -0700 (PDT) From: Lothar Rubusch To: herbert@gondor.apana.org.au, davem@davemloft.net Subject: [PATCH 0/5] crypto: atmel-sha204a - read out otp zone Date: Sat, 27 Apr 2024 00:14:34 +0000 Message-Id: <20240427001439.12726-1-l.rubusch@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240426_171446_772555_ADB21AEB X-CRM114-Status: UNSURE ( 8.60 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alexandre.belloni@bootlin.com, linux-kernel@vger.kernel.org, l.rubusch@gmail.com, linux-crypto@vger.kernel.org, claudiu.beznea@tuxon.dev, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Read out otp memory zone of this secure eeprom and rng chip. The chip has an otp zone and data zone, both still not accessed. The otp zone can be used to store persistently serial numbers or similar, if externally pre-configured. In any way the Atmel SHA204a needs to be preconfgured and fuse locked in order to be useful also for the already implemented RNG functionality. Placing data into the otp zone is optional. If empty, the chip returns 0xff on all field. The implementation passes the content to a new sysfs handle to userspace. If the chip is locked or not accessible no sysfs handle is set. Signed-off-by: Lothar Rubusch --- Lothar Rubusch (5): crypto: atmel-i2 - add missing arg description crypto: atmel-sha204a - remove unused includes crypto: atmel-i2c - rename read function crypto: atmel-sha204a - add reading from otp zone crypto: atmel-sha204a - provide the otp content drivers/crypto/atmel-i2c.c | 30 +++++++++++-- drivers/crypto/atmel-i2c.h | 8 +++- drivers/crypto/atmel-sha204a.c | 77 ++++++++++++++++++++++++++++++---- 3 files changed, 102 insertions(+), 13 deletions(-)