From patchwork Thu Jun 12 13:24:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 359129 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 81C8314009E for ; Thu, 12 Jun 2014 23:26:21 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id B51DA4B89E; Thu, 12 Jun 2014 15:26:10 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IlBvP1rAcmhh; Thu, 12 Jun 2014 15:26:10 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8AFA9A7437; Thu, 12 Jun 2014 15:25:25 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8C59A4B865 for ; Thu, 12 Jun 2014 15:25:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Wgmjt3Rz8m6k for ; Thu, 12 Jun 2014 15:25:14 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-yk0-f201.google.com (mail-yk0-f201.google.com [209.85.160.201]) by theia.denx.de (Postfix) with ESMTPS id 764FEA7437 for ; Thu, 12 Jun 2014 15:25:03 +0200 (CEST) Received: by mail-yk0-f201.google.com with SMTP id 9so66078ykp.4 for ; Thu, 12 Jun 2014 06:25:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=FYmOzFp7gFaDtfBKCeDyzkkdqSq8VAuAvqE0A2sH8Fg=; b=WmZrKHdPxcAUgQz6mEj/SQ7fVQksq2gJyCm36sOjKMYnNMCRsAji3/7zoJPeKQwXkD Mh71XfkFCbjpCBXG8wwc+Hmk77TzpmJUjqBbu5wJodx9sDhgGRRViWC5FnkZ6RJxUi22 AtlvLfmjV4dKKWSFEVQSg/2WoxUPVQhRl9WqHepVf4kYBy+MlKdnGWY5TaWAThj7cYgs VtjsUaPfLnZCPwRxbcSrul17eNM+FmpaRdtvuNRSv7gfl/0O9S3FXDHOSwayJuzmwUjf lzKmTdLBypchemlTPihUH0pgsduoLj9tFBL4BL/JpLL+SY6exgublNaiv/QXH/VRIxay J9Lg== X-Gm-Message-State: ALoCoQkrIvYZGHdR4dkaaB56+pw6MqUSeg16Bw+EDrT8pwbUdQBWZGat52foggyQoBx8KOiTbv/U X-Received: by 10.58.38.199 with SMTP id i7mr759578vek.6.1402579501734; Thu, 12 Jun 2014 06:25:01 -0700 (PDT) Received: from corp2gmr1-2.hot.corp.google.com (corp2gmr1-2.hot.corp.google.com [172.24.189.93]) by gmr-mx.google.com with ESMTPS id c22si66019yhe.1.2014.06.12.06.25.01 for (version=TLSv1.1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 12 Jun 2014 06:25:01 -0700 (PDT) Received: from kaki.bld.corp.google.com (kaki.bld.corp.google.com [172.29.216.32]) by corp2gmr1-2.hot.corp.google.com (Postfix) with ESMTP id 979DC5A4A11; Thu, 12 Jun 2014 06:25:01 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 3B4732259BC; Thu, 12 Jun 2014 07:25:01 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Thu, 12 Jun 2014 07:24:45 -0600 Message-Id: <1402579494-29389-6-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.0.0.526.g5318336 In-Reply-To: <1402579494-29389-1-git-send-email-sjg@chromium.org> References: <1402579494-29389-1-git-send-email-sjg@chromium.org> Cc: Tom Rini , harshakiran Kasha Subject: [U-Boot] [PATCH v2 05/14] Reverse the meaning of the fit_config_verify() return code X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de It is more common to have 0 mean OK, and -ve mean error. Change this function to work the same way to avoid confusion. Signed-off-by: Simon Glass --- Changes in v2: None common/cmd_fdt.c | 2 +- common/image-fit.c | 2 +- common/image-sig.c | 4 ++-- tools/fit_check_sign.c | 3 +-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/common/cmd_fdt.c b/common/cmd_fdt.c index a6744ed..f2ad2a3 100644 --- a/common/cmd_fdt.c +++ b/common/cmd_fdt.c @@ -612,7 +612,7 @@ static int do_fdt(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) } ret = fit_config_verify(working_fdt, cfg_noffset); - if (ret == 1) + if (ret == 0) return CMD_RET_SUCCESS; else return CMD_RET_FAILURE; diff --git a/common/image-fit.c b/common/image-fit.c index 732505a..40c7e27 100644 --- a/common/image-fit.c +++ b/common/image-fit.c @@ -1534,7 +1534,7 @@ int fit_image_load(bootm_headers_t *images, const char *prop_name, ulong addr, images->fit_uname_cfg = fit_uname_config; if (IMAGE_ENABLE_VERIFY && images->verify) { puts(" Verifying Hash Integrity ... "); - if (!fit_config_verify(fit, cfg_noffset)) { + if (fit_config_verify(fit, cfg_noffset)) { puts("Bad Data Hash\n"); bootstage_error(bootstage_id + BOOTSTAGE_SUB_HASH); diff --git a/common/image-sig.c b/common/image-sig.c index 72284eb..48788f9 100644 --- a/common/image-sig.c +++ b/common/image-sig.c @@ -467,6 +467,6 @@ int fit_config_verify_required_sigs(const void *fit, int conf_noffset, int fit_config_verify(const void *fit, int conf_noffset) { - return !fit_config_verify_required_sigs(fit, conf_noffset, - gd_fdt_blob()); + return fit_config_verify_required_sigs(fit, conf_noffset, + gd_fdt_blob()); } diff --git a/tools/fit_check_sign.c b/tools/fit_check_sign.c index e1198bc..768be2f 100644 --- a/tools/fit_check_sign.c +++ b/tools/fit_check_sign.c @@ -80,8 +80,7 @@ int main(int argc, char **argv) image_set_host_blob(key_blob); ret = fit_check_sign(fit_blob, key_blob); - - if (ret) + if (!ret) ret = EXIT_SUCCESS; else ret = EXIT_FAILURE;