From patchwork Thu Feb 24 18:05:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 545592 Delivered-To: patch@linaro.org Received: by 2002:ac0:d8d1:0:0:0:0:0 with SMTP id b17csp437164imj; Thu, 24 Feb 2022 10:06:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJxm+GPUq3z5xJ6xQfQolSxReg2MxdWSB7r7J9VeJU7W/gHgBnTSwDt4LPhaGTboFG2ZXBvg X-Received: by 2002:a17:906:fa02:b0:6ce:78fb:2b94 with SMTP id lo2-20020a170906fa0200b006ce78fb2b94mr3235831ejb.396.1645726007370; Thu, 24 Feb 2022 10:06:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645726007; cv=none; d=google.com; s=arc-20160816; b=ULTLtt8yry+cRrcqlEEQ4Bzu3hhdag9qytNuM3NBLRJU8mF4/rzGh5IeyZX3pno4bd mWkYsU6f+igMGpphRvx5MQEEvgnyLnvwNyKlp0M9C+oGQdMKTfwjA1lyX1YDB5eQZrIN DOUxwlDtibK07z96Ke4+G2TbB+HNd00ejiMOhZ98EfxMS4/h5kq8UdiXpgorIYXrlSFo y0kDvdDW5ii/+/Y8boKvZYKkHOsxKF+qEfiEQVztv5cn8sYKRHhEYp14L5McHaJEwd9L h0ffEkHRRmP/799KFDuOAmohbVa1jKp9Idwsn5vlOwhanSIVT5M8kf+hnjFhDQMpJsXB Kzng== 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:references:in-reply-to :message-id:date:subject:cc:to:from; bh=htoleddqkwlHbvr0aPNGgckK3YjwQ5yRuamQ07tJ8q0=; b=SQqsVo2XIlSK3DLLR+ZwN83oZF6RNwgqmwVVfy9ugH9mbqewAnqL3fm3qMnyXWwhfa 8xLooh0Mu5iCXuzcPj0Jd2vargtzxJLqP/dzJCmEfPTyxNE/2mHvilDM6IhUa9qD62E1 CD2cxSXfPeuRygPHL4jhY4G7OsA0QL+uuNYHUdEUCNm9D3vcu3LZywnWvgQ1PrZUDktd eOEfbnKgVJU9bmb9IQXtM1eLBuk/p13bGdtTChBqIauMrTrjCx7m2ypT6uuXD43KEwqO Jm08aiQ1zZPdaf0jYxCvQqqITOUddOLqfy2i5jYqqUOegvKufCwG82y6QYLzZiAgzcl+ 86fw== 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 n9-20020aa7c689000000b00410ee833c70si147615edq.596.2022.02.24.10.06.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Feb 2022 10:06:47 -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 EB3E883CC5; Thu, 24 Feb 2022 19:06:26 +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 3038F83C23; Thu, 24 Feb 2022 19:06:23 +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 87F1283C90 for ; Thu, 24 Feb 2022 19:06:19 +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 E8634106F; Thu, 24 Feb 2022 10:06:18 -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 87E2A3F70D; Thu, 24 Feb 2022 10:06:16 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Simon Glass , Heinrich Schuchardt , Mario Six , Sughosh Ganu Subject: [PATCH 02/10] tpm: rng: Change tpm_get_random to return an int Date: Thu, 24 Feb 2022 23:35:44 +0530 Message-Id: <20220224180552.26901-3-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220224180552.26901-1-sughosh.ganu@linaro.org> References: <20220224180552.26901-1-sughosh.ganu@linaro.org> 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 --- 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);