From patchwork Fri Mar 4 13:34:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sughosh Ganu X-Patchwork-Id: 548112 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:6713:0:0:0:0 with SMTP id u19csp21589mag; Fri, 4 Mar 2022 05:35:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0q3ffw4vyfCDMG/Wdpr5VGa4kiUwt8WvaNBFz2kZzFuCsfTYXK7pyDwvdQto+fQ7zUaMd X-Received: by 2002:aa7:c687:0:b0:415:eb43:8ff5 with SMTP id n7-20020aa7c687000000b00415eb438ff5mr6161277edq.74.1646400934865; Fri, 04 Mar 2022 05:35:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646400934; cv=none; d=google.com; s=arc-20160816; b=G8Bt8o7mH/E6x5n2lJoJJTC/WAGQQQDSwfN8/3r3kmxTkm0uoYaQccQa8vL8FR21RB Q12M1n8Sim0F6xAhCIcw4gXi62DOuhNaANY7LisYHdXRWoFiONjoq2l7WeqeOrQYLrVf sbTz6X2BPiVAyar6FWCVJGKY36If0DFvY54rbPovf7n57C9/SURKtGV9pzivOB2tWifP InaXAzIIpk9U7xAOitOtHbabENG6MuRGy4DT3g+ekFOAqsXlIwfCJdvi3HkCbnmj6f56 h+Igc6ZmkJ+KsXG16W2eykkHbWc2du6CWrbY+lcREHOvQB1Px2Fnddr5nYFo0pHPo1yx CHUg== 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=0qRbX1HZpHkNcjxdv/2LII3ImJrqt3SThpAUHHPQbhU=; b=m1AuZCIIJu9Hj+vJJkFMI9g4pfBGr0Il4ocD2IeYeWs05rS6oKyIyqYpWyqYnkNfED XGM2T0RGTJNzKpKrLjz3j/yyQ4B6X0//UMHkni9o7KjtNSJBPOLmX59x0F1CNjpnmKgj Yhl26HLGUMvCbUjy8GKh+rPTNugh8k8s8PP64dTpVQsSJFWr0/J23MKXQTyMFSSoUmog rDiXg656QRiKnk4DhW+rLJ1d3rhJUv16QdoBWlZzLdRGTWwHZ73I7l4IltROELHC5U4w hIbGsDDIxk44+YXpOKqZ8YBBExJGCbBlhFquowgJ7h1IfcLWhcM6a+hHH2zvmdzi3+1U MgZg== 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 10-20020a170906318a00b006d1ddb409bdsi3188698ejy.32.2022.03.04.05.35.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Mar 2022 05:35:34 -0800 (PST) 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 6FA6E83D3D; Fri, 4 Mar 2022 14:35:17 +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 785BE83B6C; Fri, 4 Mar 2022 14:35:08 +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 16DC483CB4 for ; Fri, 4 Mar 2022 14:35:03 +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 647841396; Fri, 4 Mar 2022 05:35:02 -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 B89183F70D; Fri, 4 Mar 2022 05:35:00 -0800 (PST) From: Sughosh Ganu To: u-boot@lists.denx.de Cc: Ilias Apalodimas , Simon Glass , Heinrich Schuchardt , Sughosh Ganu Subject: [PATCH v3 1/8] tpm: rng: Change tpm_get_random to return an int Date: Fri, 4 Mar 2022 19:04:22 +0530 Message-Id: <20220304133429.1047752-2-sughosh.ganu@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220304133429.1047752-1-sughosh.ganu@linaro.org> References: <20220304133429.1047752-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 Reviewed-by: Ilias Apalodimas --- Changes since V2: 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);