From patchwork Sun Mar 13 14:47:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 550921 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp1826017mag; Sun, 13 Mar 2022 07:49:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+uPbRXDsaPL2mXuzQEaKCYI6v8qQZYkH3Cb3xEKZjX/CcFrKYDp0HTIPPLv5+A5cwZgYp X-Received: by 2002:a05:6402:1435:b0:410:d2e1:e6dc with SMTP id c21-20020a056402143500b00410d2e1e6dcmr16287723edx.138.1647182955957; Sun, 13 Mar 2022 07:49:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647182955; cv=none; d=google.com; s=arc-20160816; b=eSWq9VO8HAEofm4FffsoD2JK2T0s700od8BXoT0H4Ffj+V47WhCsbOdWgNDqYdkF6Y mlS37aaMLKrHtMESlav+fOX99GWcOctTsRsqbkVvRC+/9jvBZvHBgKBGubE/PAOWkv+y ONfOhpMUWeo797cSI6IvG/IeuVhPmC0vE1MnsWg52OF5/UgQs9kzvb1nGXd+JnKOcH1k roHbBDCTUFR+BWSsoR9eUIyFM8AI7t1XF0jrryw3iSUY0SRmL1ic4yVQSUjHYBrI8Dr9 Zub6vypPfpi6+5U7bSXX/0SjhSDtue+VWEWhCVf93Gj1DoCL9l55yMAUmxJQ99yQOUFE 4fOg== 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=kBjOUMhz+PBxjjNu+rml++LiwoWS1ICWmb8nkAmNFxo=; b=qsJmZ0pzbNNl+HUw1ZcqFe68xCza0bkwPamoj+ptbUvjPCjRO4cVzAtt3WtjCrOxIB yF5pMz6GVcOULvw1Wa6tQJGOBzMV+/Tar2fJTHMU+XiDd6Lygityp6JrEw4pY2cqsQp1 r7xGbAVl6A3h7g0AljNMa9UZsgk5Vk7IOcxmcjYLCR2s09ZXD4+AIKSLWtAe0wvj3Txs OSVI2dRIipcJOq0LgzJ3mfulZrEMpVddCU8uTVbP+7RMsmQSXSKlPHNkS+1ReiodQkc8 IOVzrO5aajIQdmDrg5jdJ6b8GaI9P3sW7EZjS6Mm/keNdlzIQub0hzAw1g86cxCrWFCA S3sA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id sg19-20020a170907a41300b006cfd1ebf35dsi8146405ejc.565.2022.03.13.07.49.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Mar 2022 07:49:15 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 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 B4AFA838B5; Sun, 13 Mar 2022 15:49:03 +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 0CC3F8301F; Sun, 13 Mar 2022 15:48:53 +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 C9FE4829FF for ; Sun, 13 Mar 2022 15:48:49 +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 2A9391042; Sun, 13 Mar 2022 07:48:49 -0700 (PDT) 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 5EEF93F7D7; Sun, 13 Mar 2022 07:48:47 -0700 (PDT) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Simon Glass , Heinrich Schuchardt , Sughosh Ganu Subject: [PATCH v5 1/9] tpm: rng: Change tpm_get_random to return an int Date: Sun, 13 Mar 2022 20:17:54 +0530 Message-Id: <20220313144802.65687-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220313144802.65687-1-sughosh.ganu@linaro.org> References: <20220313144802.65687-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 V4: 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);