From patchwork Wed Mar 9 12:27:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 549704 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp3514368mag; Wed, 9 Mar 2022 04:29:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJycufx2WV/orly/HSGVST+9CaxDe+dCrwB/I7ZUN1Fb51F+N9e4WoRl3U/L0gDccxmq/9bd X-Received: by 2002:a17:907:9483:b0:6da:a26b:2d44 with SMTP id dm3-20020a170907948300b006daa26b2d44mr17855434ejc.337.1646828952516; Wed, 09 Mar 2022 04:29:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646828952; cv=none; d=google.com; s=arc-20160816; b=l1hPz9G6Xr7Oj2zg/wJbrPrx1sUAlHhrNPX30wIguNbH4AhMFYueps52Zzw73kEcar CEQH5NsQYAJAdJxvBwyycmTMU6ZqhvyQtwpjm6kg+MVRP2Y3n8aN2AcpIIfdyKMhmTlC YcWfT/u08GMxhTjnvGyWR90GGzicMmD3C+4Vqly/Gcm+0GaP9MAOwc1iMcJphQAxqUKT QJPiplEa4CZPJtUs/Jro1QIDzsLEpjpfljGA0Sz9v/VDC15GRfllygFksPIfCKEKEKMV XffwCsEHT6HVJ2vAgDbOoJJZPlmOh9KIPgcBdiNEoxYDG7VoHsUn+SZ7N/FbH+RQ/utL pj3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from; bh=q3OZe2oQWr7rVs4/tc8cbPFXXvRmi1w+WfYyjDegBVg=; b=Wc2vdNQjLScQPtj0eK5ccJw63M8Ic/ypfgnzZK5Ul1E1rj5iBG/OEl1t17eQBXWoum b407TfuUlXKQHawHnqyIhoKSsFUbjjDv1ftkMKRN1z1tea8LADj3jnXd06sHBl0OcpOM Ag8mgmLFpm1dRRjNcZ9Huh4wNIzTDJCBXnlRydo+vzhSURkYg6d0mpdUWCMsQhn1nh/h jqmbgnvb+jkK0qLVtZTu2M9ISNvZAukghGc1L/RnLWI4lFD9+JlQ4jJEyDbrKlnUieRp blDpAkg2+M4fNHu25IvtEU13qLpf6jeChDw4FPpQjNAudy587NuoVhERrlS9BH32UYBq ma/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id sg34-20020a170907a42200b006dabf3e1880si1021854ejc.942.2022.03.09.04.29.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Mar 2022 04:29:12 -0800 (PST) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C668A8399C; Wed, 9 Mar 2022 13:28:55 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id BB48E8393F; Wed, 9 Mar 2022 13:28:38 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_SOFTFAIL,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by phobos.denx.de (Postfix) with ESMTP id 500398392F for ; Wed, 9 Mar 2022 13:28:35 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=fail smtp.mailfrom=sughosh.ganu@linaro.org Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CD3701688; Wed, 9 Mar 2022 04:28:34 -0800 (PST) Received: from a076522.blr.arm.com (a076522.blr.arm.com [10.162.16.44]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0D42B3FA4D; Wed, 9 Mar 2022 04:28:32 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Simon Glass , Heinrich Schuchardt , Sughosh Ganu Subject: [PATCH v4 1/8] tpm: rng: Change tpm_get_random to return an int Date: Wed, 9 Mar 2022 17:57:53 +0530 Message-Id: <20220309122800.3940001-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309122800.3940001-1-sughosh.ganu@linaro.org> References: <20220309122800.3940001-1-sughosh.ganu@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean The tpm random number generation functionality will be moved to the driver model. With that, the tpm_get_random function will call the common driver model api instead of separate functions for tpmv1 and tpmv2. Return an int instead of a u32 to comply with the return value of the driver model function. Signed-off-by: Sughosh Ganu Reviewed-by: Heinrich Schuchardt Reviewed-by: Ilias Apalodimas Reviewed-by: Simon Glass --- Changes since V3: None include/tpm_api.h | 4 ++-- lib/tpm_api.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/tpm_api.h b/include/tpm_api.h index 11aa14eb79..249a966942 100644 --- a/include/tpm_api.h +++ b/include/tpm_api.h @@ -274,9 +274,9 @@ u32 tpm_find_key_sha1(struct udevice *dev, const u8 auth[20], * @param dev TPM device * @param data output buffer for the random bytes * @param count size of output buffer - * Return: return code of the operation + * Return: 0 if OK, -ve on error */ -u32 tpm_get_random(struct udevice *dev, void *data, u32 count); +int tpm_get_random(struct udevice *dev, void *data, u32 count); /** * tpm_finalise_physical_presence() - Finalise physical presence diff --git a/lib/tpm_api.c b/lib/tpm_api.c index 4ac4612c81..7d26ea2c3a 100644 --- a/lib/tpm_api.c +++ b/lib/tpm_api.c @@ -264,7 +264,7 @@ u32 tpm_get_permissions(struct udevice *dev, u32 index, u32 *perm) return -ENOSYS; } -u32 tpm_get_random(struct udevice *dev, void *data, u32 count) +int tpm_get_random(struct udevice *dev, void *data, u32 count) { if (tpm_is_v1(dev)) return tpm1_get_random(dev, data, count);