From patchwork Mon Feb 28 12:06:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 546688 Delivered-To: patch@linaro.org Received: by 2002:ac0:9f50:0:0:0:0:0 with SMTP id l16csp2675010imf; Mon, 28 Feb 2022 04:08:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxwiZJ3lRX969X5Wspru7TEd9lYbk2eg/7jOLPxGj+MnW28bjen1BoP0sVF8UFb52MknuLD X-Received: by 2002:a17:906:1995:b0:6ce:6b78:f9ec with SMTP id g21-20020a170906199500b006ce6b78f9ecmr14910981ejd.459.1646050084161; Mon, 28 Feb 2022 04:08:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646050084; cv=none; d=google.com; s=arc-20160816; b=BaZi4SMNewb9lww46nSo5SMyPVjNGKHr4sHxvtTiUkeFGDU0xacNH7xntVlbaR5c77 t+1z8QlhAyc3OYjYne+7YK2lsUJLR1XQ74P/FOrJgBpMGdLTNEb7Vgj8VkEpeKC5TAEB Q3aGO/qKV4Ic6YWtPnyw4LalTkIgkvNaFLesmjpsmhf7hH6zY7AzkX7oY6vTbjUW7fIj t8tGdaJXplwGeW76wyBuwuzxYiG4SfVjQikjqM8B8PJI1+WBUsjD3L8uOsCYQ6tP4fYf zdtq54bxw9BWbHqEpw2jVpncZBV6sxPr4mCUhW32paRNCUb2BAh9rsSJmZzHimFwHF9P joAg== 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=T87P05tg4RT4VMYcEPAL9S70rQbPc3iU8AqlRGFeu04=; b=KGUyOayXrbrsNv+Wq/4GMY2npdfOxpkdBCKA0QbOVi84goos/fkqlhBcvXbcfUFMo3 X2R1TgZJXsb+sYAE3eK6mVbakj1KTvR/URhTQylmHdkNI3rv/HQIDX/euqsq+IxjPN8o ytNf2CsVCX4dFMWOmtCRi+Vq5IzKExaV+ynuEs/MS0tMVv7+yChmd2ZCZreYQGvpFsRZ Lb55GY5YqO0K2+0wggW2lyzvNJ0CVDuU41uBXA8ierYJfpTJXzZjo8sFAt7CgSNd1+yZ G+6vdnWGa9WoVn55xdBhQV9UqA51WpRgwl6lnh9HqpgOFzd7G3mdr92fu12m2Sl0wrHK Nfog== 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 jz3-20020a170906bb0300b006cfd35fb687si5356560ejb.579.2022.02.28.04.08.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Feb 2022 04:08:04 -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 6694183BF7; Mon, 28 Feb 2022 13:07:56 +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 7AF31838D6; Mon, 28 Feb 2022 13:07:35 +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 9458B81DD0 for ; Mon, 28 Feb 2022 13:07:31 +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 C6B18ED1; Mon, 28 Feb 2022 04:07:30 -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 E1A6C3F73D; Mon, 28 Feb 2022 04:07:28 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Simon Glass , Heinrich Schuchardt , Mario Six , Sughosh Ganu Subject: [PATCH v2 02/10] tpm: rng: Change tpm_get_random to return an int Date: Mon, 28 Feb 2022 17:36:30 +0530 Message-Id: <20220228120638.678137-3-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220228120638.678137-1-sughosh.ganu@linaro.org> References: <20220228120638.678137-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: Simon Glass --- Changes since V1: 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 ef45b43a8f..b9e3e8b5e6 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 4c662640a9..1bbe33a3fc 100644 --- a/lib/tpm_api.c +++ b/lib/tpm_api.c @@ -274,7 +274,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 (is_tpm1(dev)) return tpm1_get_random(dev, data, count);