From patchwork Tue Aug 31 02:46:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 504639 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp2369739jai; Mon, 30 Aug 2021 19:48:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyiHoPLRMQPU4CjKfX/sgBWfVFCnSgmoxWHiYINxfGSIVjUB8t2D5XdQ6bRALdwYvphW33K X-Received: by 2002:a17:906:7848:: with SMTP id p8mr27617263ejm.212.1630378081992; Mon, 30 Aug 2021 19:48:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630378081; cv=none; d=google.com; s=arc-20160816; b=xzYzpfSDnrPHXEo1Ev7ma1CbUMNN9HRRF9I7YqbxKEneim3DyWlGsUHdvlV4PybtUB 6XqCLjmUhuWxLG2fnfZKTk+JBdOC++ZE86Pb5vXKVVAlqQGEvezoSEYQ6P2x7Bazbr1O HtIIyLKTOxOzp7fO3Vx3Pq75u+cwGE37qKt3+c/pG7WoztXNtC5pX4TjZBpFOwMrA9xP HmmTRYBgj4WIyoUzgq/gUQbS51z1WGRanFQ8EDZ1mSR4lhDf+NOOBrspP2qBFW/artdY Z6w2uylBbvioit4bGcA+cxIYc3fU3u8zVVHHdYEadURzDIV2XUUjndrVhwQpVOkrhT1U vMlw== 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:dkim-signature; bh=tCDfebOCrM/+88uniLDY7VcV97Izym9bc7+ebM0ywv0=; b=L8nnlXpPjSkq9q8xjbiVG7ZrqBolwIl1NUTFitLY5O1HI52COFCCk//PLsnuff4Dyn o6ozLLoM455h0in3KvRZxtyux5X0EDscBUs5biSyxtwQvmx/lQ4PUXXQlQ4Q5/gkgjuY fhakbpnL8VLQnZtz3Ti4HUaIZ45nkr8wlyTZ2+lZTtQ9htsIVEORy/q+MvGo0CzWr5rm v+uFZ1P7B2Bg+LMSzLo+RX9q6OU3zw/+LTsrho0LrPDUP+gpTQpcP1bJX9j5Oy2zMPTV QYzov1LZxKL3tUccFI/1KBz+VZ/2FVs/0J5RCffDNFphsIk+xBY6hMjZmZAjNRBPTINH g2qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dXDlAxzS; 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=pass (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 d19si15916090edz.503.2021.08.30.19.48.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 19:48:01 -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; dkim=pass header.i=@linaro.org header.s=google header.b=dXDlAxzS; 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=pass (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 C435D833FF; Tue, 31 Aug 2021 04:47:56 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="dXDlAxzS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 792F183408; Tue, 31 Aug 2021 04:47:43 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6180D833F8 for ; Tue, 31 Aug 2021 04:47:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pj1-x1031.google.com with SMTP id j1so10801507pjv.3 for ; Mon, 30 Aug 2021 19:47:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=tCDfebOCrM/+88uniLDY7VcV97Izym9bc7+ebM0ywv0=; b=dXDlAxzSKrCv5szSdU2UYOx0M29xhkwKK/r5F98JUjV1vFF79XuzVQ2wkAN4lWijwO eQVdSC4qWYwMnVL16323oDGYOJ50/t/YK9CfKBUFxZ2D9NG3jLjiNe1CdnDendoxLUQQ X7cPYLpDSiLI5F6M0pKXrygaEtUnjwc6heuOxOBLuIPJ/L0b9kC3ETaQYHCrj4QqV8TR 0wl2inPMKjjAKRimjtODOJJ/qFXBWKTOtaVcbGQ1PzlKRWqDGCGMH48b5xUaw5ez4v6B L4fY1SJWyaoGORbI9lSA3HLtseMGFhhw4W2RQCYHbBDChLBrenCN0lYiqT3tSuIdfk9O zS+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=tCDfebOCrM/+88uniLDY7VcV97Izym9bc7+ebM0ywv0=; b=hmbJ1bZwyhHk+5jw5TdAVFlHlhOAi9SujFhIUKXu9SuNfAh53T3qssWzWjC8ttHYf5 euZSB4ubtueXsaxo8H/js1EQGXb5twNY2qsgeFQ+BSQbFuSbtiy+306oTC5PEx5wNjC/ jGA6KtHeB+mygjWHTfVFIEmRr1pY3JvgRncp2mgAarfzTGJDbIlcnxsmH4ozcoi8QZdr nNlmwr9BeIdONtkYSVBoImqVH7Se3dCgQEwlJ1LyhQVQQ3JjZ+KXRokmLwP0cS5IIIws JLfYF3oWJozdZWg8kIiTy/b1vUI/oBQqUMgRG0EOyPsIT/mV6X6bUguCjUu9cupIR/eX WXUQ== X-Gm-Message-State: AOAM5306KlxBpp3RfOW1qRB/ZLEGWRcS6ugj/FG2OoeiRb1NK6MfY1vW ylrS0DLrj+d2u5CHxyS4COImoA== X-Received: by 2002:a17:90a:bd02:: with SMTP id y2mr2454159pjr.202.1630378052482; Mon, 30 Aug 2021 19:47:32 -0700 (PDT) Received: from localhost.localdomain (p784a44f4.tkyea130.ap.so-net.ne.jp. [120.74.68.244]) by smtp.gmail.com with ESMTPSA id g2sm219649pfr.35.2021.08.30.19.47.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 19:47:32 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de Cc: ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v3 1/5] tools: mkeficapsule: add firmwware image signing Date: Tue, 31 Aug 2021 11:46:55 +0900 Message-Id: <20210831024659.53464-2-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210831024659.53464-1-takahiro.akashi@linaro.org> References: <20210831024659.53464-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean With this enhancement, mkeficapsule will be able to sign a capsule file when it is created. A signature added will be used later in the verification at FMP's SetImage() call. To do that, We need specify additional command parameters: -monotonic-cout : monotonic count -private-key : private key file -certificate : certificate file Only when all of those parameters are given, a signature will be added to a capsule file. Users are expected to maintain and increment the monotonic count at every time of the update for each firmware image. Signed-off-by: AKASHI Takahiro --- tools/Kconfig | 7 + tools/Makefile | 8 +- tools/mkeficapsule.c | 435 +++++++++++++++++++++++++++++++++++++++---- 3 files changed, 416 insertions(+), 34 deletions(-) -- 2.33.0 diff --git a/tools/Kconfig b/tools/Kconfig index d6f82cd949b5..9a37ed035311 100644 --- a/tools/Kconfig +++ b/tools/Kconfig @@ -20,4 +20,11 @@ config TOOLS_LIBCRYPTO This selection does not affect target features, such as runtime FIT signature verification. +config TOOLS_MKEFICAPSULE + bool "Build efimkcapsule command" + default y if EFI_CAPSULE_ON_DISK + help + This command allows users to create a UEFI capsule file and, + optionally sign that file. If you want to enable UEFI capsule + update feature on your target, you certainly need this. endmenu diff --git a/tools/Makefile b/tools/Makefile index 4a86321f6467..6ea3033dbfb8 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -237,8 +237,12 @@ hostprogs-$(CONFIG_MIPS) += mips-relocs hostprogs-$(CONFIG_ASN1_COMPILER) += asn1_compiler HOSTCFLAGS_asn1_compiler.o = -idirafter $(srctree)/include -mkeficapsule-objs := mkeficapsule.o $(LIBFDT_OBJS) -hostprogs-$(CONFIG_EFI_HAVE_CAPSULE_SUPPORT) += mkeficapsule +HOSTLDLIBS_mkeficapsule += -luuid +ifeq ($(CONFIG_TOOLS_LIBCRYPTO),y) +HOSTLDLIBS_mkeficapsule += \ + $(shell pkg-config --libs libssl libcrypto 2> /dev/null || echo "-lssl -lcrypto") +endif +hostprogs-$(CONFIG_TOOLS_MKEFICAPSULE) += mkeficapsule # We build some files with extra pedantic flags to try to minimize things # that won't build on some weird host compiler -- though there are lots of diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c index 4995ba4e0c2a..090fb02de68d 100644 --- a/tools/mkeficapsule.c +++ b/tools/mkeficapsule.c @@ -15,6 +15,16 @@ #include #include +#include +#ifdef CONFIG_TOOLS_LIBCRYPTO +#include +#include +#include +#include +#include +#include +#endif + typedef __u8 u8; typedef __u16 u16; typedef __u32 u32; @@ -38,12 +48,25 @@ efi_guid_t efi_guid_image_type_uboot_fit = EFI_FIRMWARE_IMAGE_TYPE_UBOOT_FIT_GUID; efi_guid_t efi_guid_image_type_uboot_raw = EFI_FIRMWARE_IMAGE_TYPE_UBOOT_RAW_GUID; +efi_guid_t efi_guid_cert_type_pkcs7 = EFI_CERT_TYPE_PKCS7_GUID; + +#ifdef CONFIG_TOOLS_LIBCRYPTO +static const char *opts_short = "f:r:i:I:v:p:c:m:dh"; +#else +static const char *opts_short = "f:r:i:I:v:h"; +#endif static struct option options[] = { {"fit", required_argument, NULL, 'f'}, {"raw", required_argument, NULL, 'r'}, {"index", required_argument, NULL, 'i'}, {"instance", required_argument, NULL, 'I'}, +#ifdef CONFIG_TOOLS_LIBCRYPTO + {"private-key", required_argument, NULL, 'p'}, + {"certificate", required_argument, NULL, 'c'}, + {"monotonic-count", required_argument, NULL, 'm'}, + {"dump-sig", no_argument, NULL, 'd'}, +#endif {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0}, }; @@ -57,16 +80,280 @@ static void print_usage(void) "\t-r, --raw new raw image file\n" "\t-i, --index update image index\n" "\t-I, --instance update hardware instance\n" +#ifdef CONFIG_TOOLS_LIBCRYPTO + "\t-p, --private-key private key file\n" + "\t-c, --certificate signer's certificate file\n" + "\t-m, --monotonic-count monotonic count\n" + "\t-d, --dump_sig dump signature (*.p7)\n" +#endif "\t-h, --help print a help message\n", tool_name); } +/** + * auth_context - authentication context + * @key_file: Path to a private key file + * @cert_file: Path to a certificate file + * @image_data: Pointer to firmware data + * @image_size: Size of firmware data + * @auth: Authentication header + * @sig_data: Signature data + * @sig_size: Size of signature data + * + * Data structure used in create_auth_data(). @key_file through + * @image_size are input parameters. @auth, @sig_data and @sig_size + * are filled in by create_auth_data(). + */ +struct auth_context { + char *key_file; + char *cert_file; + u8 *image_data; + size_t image_size; + struct efi_firmware_image_authentication auth; + u8 *sig_data; + size_t sig_size; +}; + +static int dump_sig; + +#ifdef CONFIG_TOOLS_LIBCRYPTO +/** + * fileio-read_pkey - read out a private key + * @filename: Path to a private key file + * + * Read out a private key file and parse it into "EVP_PKEY" structure. + * + * Return: + * * Pointer to private key structure - on success + * * NULL - on failure + */ +static EVP_PKEY *fileio_read_pkey(const char *filename) +{ + EVP_PKEY *key = NULL; + BIO *bio; + + bio = BIO_new_file(filename, "r"); + if (!bio) + goto out; + + key = PEM_read_bio_PrivateKey(bio, NULL, NULL, NULL); + +out: + BIO_free_all(bio); + if (!key) { + printf("Can't load key from file '%s'\n", filename); + ERR_print_errors_fp(stderr); + } + + return key; +} + +/** + * fileio-read_cert - read out a certificate + * @filename: Path to a certificate file + * + * Read out a certificate file and parse it into "X509" structure. + * + * Return: + * * Pointer to certificate structure - on success + * * NULL - on failure + */ +static X509 *fileio_read_cert(const char *filename) +{ + X509 *cert = NULL; + BIO *bio; + + bio = BIO_new_file(filename, "r"); + if (!bio) + goto out; + + cert = PEM_read_bio_X509(bio, NULL, NULL, NULL); + +out: + BIO_free_all(bio); + if (!cert) { + printf("Can't load certificate from file '%s'\n", filename); + ERR_print_errors_fp(stderr); + } + + return cert; +} + +/** + * create_auth_data - compose authentication data in capsule + * @auth_context: Pointer to authentication context + * + * Fill up an authentication header (.auth) and signature data (.sig_data) + * in @auth_context, using library functions from openssl. + * All the parameters in @auth_context must be filled in by a caller. + * + * Return: + * * 0 - on success + * * -1 - on failure + */ +static int create_auth_data(struct auth_context *ctx) +{ + EVP_PKEY *key = NULL; + X509 *cert = NULL; + BIO *data_bio = NULL; + const EVP_MD *md; + PKCS7 *p7; + int flags, ret = -1; + + OpenSSL_add_all_digests(); + OpenSSL_add_all_ciphers(); + ERR_load_crypto_strings(); + + key = fileio_read_pkey(ctx->key_file); + if (!key) + goto err; + cert = fileio_read_cert(ctx->cert_file); + if (!cert) + goto err; + + /* + * create a BIO, containing: + * * firmware image + * * monotonic count + * in this order! + * See EDK2's FmpAuthenticatedHandlerRsa2048Sha256() + */ + data_bio = BIO_new(BIO_s_mem()); + BIO_write(data_bio, ctx->image_data, ctx->image_size); + BIO_write(data_bio, &ctx->auth.monotonic_count, + sizeof(ctx->auth.monotonic_count)); + + md = EVP_get_digestbyname("SHA256"); + if (!md) + goto err; + + /* create signature */ + /* TODO: maybe add PKCS7_NOATTR and PKCS7_NOSMIMECAP */ + flags = PKCS7_BINARY | PKCS7_DETACHED; + p7 = PKCS7_sign(NULL, NULL, NULL, data_bio, flags | PKCS7_PARTIAL); + if (!p7) + goto err; + if (!PKCS7_sign_add_signer(p7, cert, key, md, flags)) + goto err; + if (!PKCS7_final(p7, data_bio, flags)) + goto err; + + /* convert pkcs7 into DER */ + ctx->sig_data = NULL; + ctx->sig_size = ASN1_item_i2d((ASN1_VALUE *)p7, &ctx->sig_data, + ASN1_ITEM_rptr(PKCS7)); + if (!ctx->sig_size) + goto err; + + /* fill auth_info */ + ctx->auth.auth_info.hdr.dwLength = sizeof(ctx->auth.auth_info) + + ctx->sig_size; + ctx->auth.auth_info.hdr.wRevision = WIN_CERT_REVISION_2_0; + ctx->auth.auth_info.hdr.wCertificateType = WIN_CERT_TYPE_EFI_GUID; + memcpy(&ctx->auth.auth_info.cert_type, &efi_guid_cert_type_pkcs7, + sizeof(efi_guid_cert_type_pkcs7)); + + ret = 0; +err: + BIO_free_all(data_bio); + EVP_PKEY_free(key); + X509_free(cert); + + return ret; +} + +/** + * dump_signature - dump out a signature + * @path: Path to a capsule file + * @signature: Signature data + * @sig_size: Size of signature data + * + * Signature data pointed to by @signature will be saved into + * a file whose file name is @path with ".p7" suffix. + * + * Return: + * * 0 - on success + * * -1 - on failure + */ +static int dump_signature(const char *path, u8 *signature, size_t sig_size) +{ + char *sig_path; + FILE *f; + size_t size; + int ret = -1; + + sig_path = malloc(strlen(path) + 3 + 1); + if (!sig_path) + return ret; + + sprintf(sig_path, "%s.p7", path); + f = fopen(sig_path, "w"); + if (!f) + goto err; + + size = fwrite(signature, 1, sig_size, f); + if (size == sig_size) + ret = 0; + + fclose(f); +err: + free(sig_path); + return ret; +} + +/** + * free_sig_data - free out signature data + * @ctx: Pointer to authentication context + * + * Free signature data allocated in create_auth_data(). + */ +static void free_sig_data(struct auth_context *ctx) +{ + if (ctx->sig_size) + OPENSSL_free(ctx->sig_data); +} +#else +static int create_auth_data(struct auth_context *ctx) +{ + return 0; +} + +static int dump_signature(const char *path, u8 *signature, size_t sig_size) +{ + return 0; +} + +static void free_sig_data(struct auth_context *ctx) {} +#endif + +/** + * create_fwbin - create an uefi capsule file + * @path: Path to a created capsule file + * @bin: Path to a firmware binary to encapsulate + * @guid: GUID of related FMP driver + * @index: Index number in capsule + * @instance: Instance number in capsule + * @mcount: Monolitic count in authentication information + * @private_file: Path to a private key file + * @cert_file: Path to a certificate file + * + * This function actually does the job of creating an uefi capsule file. + * All the arguments must be supplied. + * If either @private_file ror @cert_file is NULL, the capsule file + * won't be signed. + * + * Return: + * * 0 - on success + * * -1 - on failure + */ static int create_fwbin(char *path, char *bin, efi_guid_t *guid, - unsigned long index, unsigned long instance) + unsigned long index, unsigned long instance, + uint64_t mcount, char *privkey_file, char *cert_file) { struct efi_capsule_header header; struct efi_firmware_management_capsule_header capsule; struct efi_firmware_management_capsule_image_header image; + struct auth_context auth_context; FILE *f, *g; struct stat bin_stat; u8 *data; @@ -76,8 +363,9 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid, #ifdef DEBUG printf("For output: %s\n", path); printf("\tbin: %s\n\ttype: %pUl\n", bin, guid); - printf("\tindex: %ld\n\tinstance: %ld\n", index, instance); + printf("\tindex: %lu\n\tinstance: %lu\n", index, instance); #endif + auth_context.sig_size = 0; g = fopen(bin, "r"); if (!g) { @@ -93,11 +381,34 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid, printf("cannot allocate memory: %zx\n", (size_t)bin_stat.st_size); goto err_1; } - f = fopen(path, "w"); - if (!f) { - printf("cannot open %s\n", path); + + size = fread(data, 1, bin_stat.st_size, g); + if (size < bin_stat.st_size) { + printf("read failed (%zx)\n", size); goto err_2; } + + /* first, calculate signature to determine its size */ + if (privkey_file && cert_file) { + auth_context.key_file = privkey_file; + auth_context.cert_file = cert_file; + auth_context.auth.monotonic_count = mcount; + auth_context.image_data = data; + auth_context.image_size = bin_stat.st_size; + + if (create_auth_data(&auth_context)) { + printf("Signing firmware image failed\n"); + goto err_3; + } + + if (dump_sig && + dump_signature(path, auth_context.sig_data, + auth_context.sig_size)) { + printf("Creating signature file failed\n"); + goto err_3; + } + } + header.capsule_guid = efi_guid_fm_capsule; header.header_size = sizeof(header); /* TODO: The current implementation ignores flags */ @@ -106,11 +417,20 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid, + sizeof(capsule) + sizeof(u64) + sizeof(image) + bin_stat.st_size; + if (auth_context.sig_size) + header.capsule_image_size += sizeof(auth_context.auth) + + auth_context.sig_size; + + f = fopen(path, "w"); + if (!f) { + printf("cannot open %s\n", path); + goto err_3; + } size = fwrite(&header, 1, sizeof(header), f); if (size < sizeof(header)) { printf("write failed (%zx)\n", size); - goto err_3; + goto err_4; } capsule.version = 0x00000001; @@ -119,13 +439,13 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid, size = fwrite(&capsule, 1, sizeof(capsule), f); if (size < (sizeof(capsule))) { printf("write failed (%zx)\n", size); - goto err_3; + goto err_4; } offset = sizeof(capsule) + sizeof(u64); size = fwrite(&offset, 1, sizeof(offset), f); if (size < sizeof(offset)) { printf("write failed (%zx)\n", size); - goto err_3; + goto err_4; } image.version = 0x00000003; @@ -135,34 +455,53 @@ static int create_fwbin(char *path, char *bin, efi_guid_t *guid, image.reserved[1] = 0; image.reserved[2] = 0; image.update_image_size = bin_stat.st_size; + if (auth_context.sig_size) + image.update_image_size += sizeof(auth_context.auth) + + auth_context.sig_size; image.update_vendor_code_size = 0; /* none */ image.update_hardware_instance = instance; image.image_capsule_support = 0; + if (auth_context.sig_size) + image.image_capsule_support |= CAPSULE_SUPPORT_AUTHENTICATION; size = fwrite(&image, 1, sizeof(image), f); if (size < sizeof(image)) { printf("write failed (%zx)\n", size); - goto err_3; + goto err_4; } - size = fread(data, 1, bin_stat.st_size, g); - if (size < bin_stat.st_size) { - printf("read failed (%zx)\n", size); - goto err_3; + + if (auth_context.sig_size) { + size = fwrite(&auth_context.auth, 1, + sizeof(auth_context.auth), f); + if (size < sizeof(auth_context.auth)) { + printf("write failed (%zx)\n", size); + goto err_4; + } + size = fwrite(auth_context.sig_data, 1, + auth_context.sig_size, f); + if (size < auth_context.sig_size) { + printf("write failed (%zx)\n", size); + goto err_4; + } } + size = fwrite(data, 1, bin_stat.st_size, f); if (size < bin_stat.st_size) { printf("write failed (%zx)\n", size); - goto err_3; + goto err_4; } fclose(f); fclose(g); free(data); + free_sig_data(&auth_context); return 0; -err_3: +err_4: fclose(f); +err_3: + free_sig_data(&auth_context); err_2: free(data); err_1: @@ -171,23 +510,37 @@ err_1: return -1; } -/* - * Usage: - * $ mkeficapsule -f +/** + * main - main entry function of mkeficapsule + * @argc: Number of arguments + * @argv: Array of pointers to arguments + * + * Create an uefi capsule file, optionally signing it. + * Parse all the arguments and pass them on to create_fwbin(). + * + * Return: + * * 0 - on success + * * -1 - on failure */ int main(int argc, char **argv) { char *file; efi_guid_t *guid; unsigned long index, instance; + uint64_t mcount; + char *privkey_file, *cert_file; int c, idx; file = NULL; guid = NULL; index = 0; instance = 0; + mcount = 0; + privkey_file = NULL; + cert_file = NULL; + dump_sig = 0; for (;;) { - c = getopt_long(argc, argv, "f:r:i:I:v:h", options, &idx); + c = getopt_long(argc, argv, opts_short, options, &idx); if (c == -1) break; @@ -214,29 +567,47 @@ int main(int argc, char **argv) case 'I': instance = strtoul(optarg, NULL, 0); break; +#ifdef CONFIG_TOOLS_LIBCRYPTO + case 'p': + if (privkey_file) { + printf("Private Key already specified\n"); + return -1; + } + privkey_file = optarg; + break; + case 'c': + if (cert_file) { + printf("Certificate file already specified\n"); + return -1; + } + cert_file = optarg; + break; + case 'm': + mcount = strtoul(optarg, NULL, 0); + break; + case 'd': + dump_sig = 1; + break; +#endif /* CONFIG_TOOLS_LIBCRYPTO */ case 'h': print_usage(); return 0; } } - /* need an output file */ - if (argc != optind + 1) { - print_usage(); - exit(EXIT_FAILURE); - } - - /* need a fit image file or raw image file */ - if (!file) { + /* check necessary parameters */ + if ((argc != optind + 1) || !file || + ((privkey_file && !cert_file) || + (!privkey_file && cert_file))) { print_usage(); - exit(EXIT_SUCCESS); + return -1; } - if (create_fwbin(argv[optind], file, guid, index, instance) - < 0) { + if (create_fwbin(argv[optind], file, guid, index, instance, + mcount, privkey_file, cert_file) < 0) { printf("Creating firmware capsule failed\n"); - exit(EXIT_FAILURE); + return -1; } - exit(EXIT_SUCCESS); + return 0; } From patchwork Tue Aug 31 02:46:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 504638 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp2369668jai; Mon, 30 Aug 2021 19:47:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeurNPiaeDiEG1MazNJ9jW/LtDLsrV2PEc3teTeCckRkm7+cdfELSLWzfFN4hnqb7if4js X-Received: by 2002:a17:906:abd7:: with SMTP id kq23mr13423395ejb.542.1630378070404; Mon, 30 Aug 2021 19:47:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630378070; cv=none; d=google.com; s=arc-20160816; b=ABRYdajLoXS5o74umQGC3ZnOh8B4giLDSwTtBnUph+luo4Rdj3kAIYTotvw1yDWmGf Dvwvum4UBfSH/lOpq4Wp+Eh3f5nBEnp63v/Z7E05DDH6mkXFoe7F7vmiyUg5PQXzzDQa GLZd9MLf3CZqbB5KMq7MyFQdNv6KjGpv4wIEBvRizR+69y4cHC/YVmIcXiDPSxigH3XJ c18lfzuz2cmitVBe8Z/bQ4Tfu8Ial8R0zR9CZNAPE0UtlW5+ddXHl8rKFjRPbzqje2G0 Y4HHzDvR4Np4L3DcNbLwnA6IakmolbHzRak4QX2JOSfSaoxKvxZInCqPdSgL4/kQgMvo 10iA== 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:dkim-signature; bh=xEcUuWoQTzTjHrlxw6696W5Jh9P12XVARrdrpC/YDrM=; b=efo4OTKTap6HBEf7UDOo4qVGBCA07+pB60raBCrhuJgQAyElpgLFXD7gt6tBhshj/5 aaZUHMYWZJFNSD9lDQb8yuvH94i5U9QyPsxQKv+vW3fGPReXlw23NBk72VHgAHdtY31D w8EHwsPivxUnhLm4mgBi+NctwUGGUKaPoxNyUWkKbBdGrXvkD4+WS6vagv+vpl/waRpB L0VINAxCnZebzkEndJuGJJ6tOuhqmuACYTc+hdXf3SQ9W4tZkjKunsYOym8s6GSpypTW u0mda7l/BrTXYApSKGZNx9Mkre3jnoZ+26dIDkdBsnWDwvumvCkiw85GqmnFM3QN9k2C G5dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qy8G6d6g; 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=pass (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 h20si16340590ejt.70.2021.08.30.19.47.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 19:47:50 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=qy8G6d6g; 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=pass (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 C38588340C; Tue, 31 Aug 2021 04:47:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="qy8G6d6g"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 86BD783409; Tue, 31 Aug 2021 04:47:44 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EAD55833FB for ; Tue, 31 Aug 2021 04:47:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x436.google.com with SMTP id v123so13753566pfb.11 for ; Mon, 30 Aug 2021 19:47:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xEcUuWoQTzTjHrlxw6696W5Jh9P12XVARrdrpC/YDrM=; b=qy8G6d6g1xtNTzdeQxgs9zJh7S4X8b1C+FaaI7itNifufih8Vc2bWo5/DPpSxP2XgT zBw+LxehkYUWmVn4zApOuuzg32chQMvp9ykrZGSqxInSHSKa9nwJMyvNTiD791RSMkZm oQXtQQTYZ3oMDtocZGbPdKJZvD/CihA3JhqwCmDJFvFIRm6V7cu9Xrcz3RR6JfWV/Ixn nYtuIMdnYfg2AXkCsUtG8qMeAzZBJVbStWJPA0cMOsr2cSqP/iQVmp3oqjpwnNvuUE47 tL5Lk5vMMly7XiVJ5vpz6O4jib0nthi7Utd9rWMAcTj1KreietQeZnsPJLy92pNnMQAB NgdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xEcUuWoQTzTjHrlxw6696W5Jh9P12XVARrdrpC/YDrM=; b=X72BXupAr6/J8C9uSnfl+VQ+EaJN0zFuQdL1xJKMa4N8tGe/RfQHnKtxB846GoX7Bu 57CtYGXyVX2FhddsHOwaHCi1QGoYOo7w0CeNrWQuPCjffTnz1ALGlePmWYPysrFCUVLE rvMJtytrc7vtBDfFN6BpV6wJkB/oFfYadIad/wDpGs2ez2G0m/T09QQ2jb1lgt8biuzb 28Svb+LdJLlk5zQ0fzCz5D2p5anB1hsTNJK0dFSgYj37Ml2/AbjxRcWAErCtlJE0aYbC 1HE/dPE0N93LxWaJggjspcadDz9OrJk17vM0FNm4Rqwx+2hOWscI33kxNk0eHHMDDLMy Hpbg== X-Gm-Message-State: AOAM5303Eg4JAGbFsj+TdTOJwL/WhL0wbPoHuhDDdOkpRwX8iBJTI8gG 16rFAkBOozfuNuqwgy16V2qFxw== X-Received: by 2002:a05:6a00:787:b0:405:700b:69ce with SMTP id g7-20020a056a00078700b00405700b69cemr449385pfu.50.1630378055262; Mon, 30 Aug 2021 19:47:35 -0700 (PDT) Received: from localhost.localdomain (p784a44f4.tkyea130.ap.so-net.ne.jp. [120.74.68.244]) by smtp.gmail.com with ESMTPSA id g2sm219649pfr.35.2021.08.30.19.47.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 19:47:34 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de Cc: ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v3 2/5] tools: mkeficapsule: add man page Date: Tue, 31 Aug 2021 11:46:56 +0900 Message-Id: <20210831024659.53464-3-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210831024659.53464-1-takahiro.akashi@linaro.org> References: <20210831024659.53464-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Add a man page for mkeficapsule command. Signed-off-by: AKASHI Takahiro --- MAINTAINERS | 1 + doc/mkeficapsule.1 | 91 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 doc/mkeficapsule.1 -- 2.33.0 diff --git a/MAINTAINERS b/MAINTAINERS index 4cf0c33c5d58..0bb2de007982 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -701,6 +701,7 @@ S: Maintained T: git https://source.denx.de/u-boot/custodians/u-boot-efi.git F: doc/api/efi.rst F: doc/develop/uefi/* +F: doc/mkeficapsule.1 F: doc/usage/bootefi.rst F: drivers/rtc/emul_rtc.c F: include/capitalization.h diff --git a/doc/mkeficapsule.1 b/doc/mkeficapsule.1 new file mode 100644 index 000000000000..7c2341160ea4 --- /dev/null +++ b/doc/mkeficapsule.1 @@ -0,0 +1,91 @@ +.TH MAEFICAPSULE 1 "May 2021" + +.SH NAME +mkeficapsule \- Generate EFI capsule file for U-Boot + +.SH SYNOPSIS +.B mkeficapsule +.RB [\fIoptions\fP] " \fIcapsule-file\fP" + +.SH "DESCRIPTION" +The +\fBmkeficapsule\fP +command is used to create an EFI capsule file for use with the U-Boot +EFI capsule update. +A capsule file may contain various type of firmware blobs which +are to be applied to the system and must be placed in the specific +directory on the UEFI system partition. An update will be automatically +executed at next reboot. + +Optionally, a capsule file can be signed with a given private key. +In this case, the update will be authenticated by verifying the signature +before applying. + +\fBmkeficapsule\fP supports two different format of image files: +.TP +.I raw image +format is a single binary blob of any type of firmware. + +.TP +.I FIT (Flattened Image Tree) image +format +is the same as used in the new \fIuImage\fP format and allows for +multiple binary blobs in a single capsule file. +This type of image file can be generated by \fBmkimage\fP. + +.SH "OPTIONS" + +.TP +.BI "-f, --fit \fIfit-image-file\fP" +Specify a FIT image file + +.TP +.BI "-r, --raw \fIraw-image-file\fP" +Specify a raw image file + +.TP +.BI "-i, --index \fIindex\fP" +Specify an image index + +.TP +.BI "-I, --instance \fIinstance\fP" +Specify a hardware instance + +.TP +.BI "-h, --help" +Print a help message + +.TP 0 +.B With signing: + +.TP +.BI "-p, --private-key \fIprivate-key-file\fP" +Specify signer's private key file in PEM + +.TP +.BI "-c, --certificate \fIcertificate-file\fP" +Specify signer's certificate file in EFI certificate list format + +.TP +.BI "-m, --monotonic-count \fIcount\fP" +Specify a monotonic count which is set to be monotonically incremented +at every firmware update. + +.TP +.BI "-d, --dump_sig" +Dump signature data into *.p7 file + +.PP +.SH FILES +.TP +.BI "\fI/EFI/UpdateCapsule\fP" +The directory in which all capsule files be placed + +.SH SEE ALSO +.B mkimage + +.SH AUTHORS +Written by AKASHI Takahiro + +.SH HOMEPAGE +http://www.denx.de/wiki/U-Boot/WebHome From patchwork Tue Aug 31 02:46:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 504640 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp2369901jai; Mon, 30 Aug 2021 19:48:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyl+7PaQpp13abzfo1JJ7TNCkN8O7V+T7F5+uffAuUDt07nb9AUbUGnoqvpE8BfoMDi2dCs X-Received: by 2002:a05:6402:1455:: with SMTP id d21mr26954205edx.161.1630378101271; Mon, 30 Aug 2021 19:48:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630378101; cv=none; d=google.com; s=arc-20160816; b=LShLsffsv8NSOsPjaUTG07VFiLQsH5gG1UjiYDJOhFrSuKeoQigP+EM3AnVW3T0zCC QhZh/e0vOC3XtCDHdGwhl+EhIW75gvpUDSkB9uX+SU0vAvo9/QOVCPG/Szgsqz7jJvGN da/wUM9rtSUG3ssSmzux0nriqGlMazjkvCLI6MxuOLOZp3qOZHO9XUoA+TfxkPt5MAVf GiwGNTTp3+NfAx3iYJ8cNl7cu3o/xVWjQNDEGxz8uJ5jtwPwMkuDa0d4sPNqBNXe1/lB bYLuqyMnfXQJRsE9VS6o5uugR9kfBsNWjaljiLkkqU+U4brPev2P83OGmI0ufrgmoT+p npJA== 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:dkim-signature; bh=A0OmgO+gkbqwJPJ51g+lgdc+PN0XtHLnnILcf2jZHzM=; b=jWe1hyHP18hmnWcrqIJ/DQtmJYcoWOTz7A3taSwFEyP0UduXLRybDQuqXbJc7GKH3y Olh+ACtXSnOs2C2gwgPVmjzbFYH5mvVkjr07o+IRGQNLPX2BUxNyJSx0c2cgR4uXlFq2 VOcu6NNR5u2FgLdLNobjoDP1q4fEsWP6NQREI84es3LufN3M0DsxlGCrkVaUeONNeLLY ratFx9xhGl+cKIXusc0NY0w5J3Ec37lRi2A76Y1sJ0tIdwa+5QGnO0UEDUzVxxbPhXEz zLGjMrxlUKtrSe1QKSyEuDHBZx8xEMx7pGKbF+V/elKkP2lsTatMzQBFAW338s3vKc/C FU9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WwKFcyya; 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=pass (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 c28si9745075ejj.414.2021.08.30.19.48.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 19:48:21 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=WwKFcyya; 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=pass (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 3383C833F4; Tue, 31 Aug 2021 04:48:20 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="WwKFcyya"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B5B4D83408; Tue, 31 Aug 2021 04:47:49 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id AF77983402 for ; Tue, 31 Aug 2021 04:47:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x434.google.com with SMTP id u6so13155559pfi.0 for ; Mon, 30 Aug 2021 19:47:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=A0OmgO+gkbqwJPJ51g+lgdc+PN0XtHLnnILcf2jZHzM=; b=WwKFcyyaF0hCLqAPWod/vEfKgcgKUQFu42bpvCD2L7uuXUf/yOaoWwwfEZNJvv8ra5 qVQPYbgnR+SCOhTMEs6iGKOswZM0E6d1rcQi8djJU5/eNO+waLSQeKYrRMi0OFv0doCw YYVz1yMCn0fDatnImDNsj3mTccGsBDBCbs6dmq7/48CmhbfSvpqMi9KTUk8Y4EwjJqYF 9qkNHTDRyzbBy2LCDWrzYn4vV5iL88VPxo4CGjSx7S3v9Tb+HbFI8FeRL7kyPG5nfPcM IVib7/6jEs44iSXpmi2NvfrFIRTVkRoySJ+jd/UA4/7SOlYr54zg5IhNQhUdCEDm2XaD A6nA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=A0OmgO+gkbqwJPJ51g+lgdc+PN0XtHLnnILcf2jZHzM=; b=iBnKDOjh8IQ3MlS2K5XXWNGdS96x2yv7Q4lsaaEnyDSKraSHWohFFt2W2ecLHWcJ6P b/2EqXxG61cxT8nj1j2PCnYNB0/b9sK+yzzLaxLKNfLfOgiHTn3v8E6TQCOQkT6lLTJc F4oxRcYmgP2fZunXi2a+IUBOGmCFNJMNUPf21KU3kP0xx9hjSojEVSt8CxOfSNOQlu+B Q3Tf8MT14UCBOE5meMogufBOgAEU3d9UMmLzoGDStJjQ4Q0Bkj9JNBE5OhBCXTCEGM98 NuGkDPICosnYGuzKvJejy+s0YhKZTVdIlj1twFzbuuwHmMrafXO1n6o1A2pgxOyTDDHh Rckw== X-Gm-Message-State: AOAM533/sXcmqiNLxOBaCiiaaILRJLbx+6XGN8yvE62xSiAYTTDdLi6R LxKT34vPzNpMGyWFrLR37afMqioZ6hn7pA== X-Received: by 2002:a63:a4a:: with SMTP id z10mr24297218pgk.329.1630378058078; Mon, 30 Aug 2021 19:47:38 -0700 (PDT) Received: from localhost.localdomain (p784a44f4.tkyea130.ap.so-net.ne.jp. [120.74.68.244]) by smtp.gmail.com with ESMTPSA id g2sm219649pfr.35.2021.08.30.19.47.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 19:47:37 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de Cc: ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v3 3/5] doc: update UEFI document for usage of mkeficapsule Date: Tue, 31 Aug 2021 11:46:57 +0900 Message-Id: <20210831024659.53464-4-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210831024659.53464-1-takahiro.akashi@linaro.org> References: <20210831024659.53464-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Now we can use mkeficapsule command instead of EDK-II's script to create a signed capsule file. So update the instruction for capsule authentication. Signed-off-by: AKASHI Takahiro --- doc/develop/uefi/uefi.rst | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) -- 2.33.0 diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst index 64fe9346c7f2..5ccb455da984 100644 --- a/doc/develop/uefi/uefi.rst +++ b/doc/develop/uefi/uefi.rst @@ -347,23 +347,20 @@ and used by the steps highlighted below:: -keyout CRT.key -out CRT.crt -nodes -days 365 $ cert-to-efi-sig-list CRT.crt CRT.esl - $ openssl x509 -in CRT.crt -out CRT.cer -outform DER - $ openssl x509 -inform DER -in CRT.cer -outform PEM -out CRT.pub.pem - - $ openssl pkcs12 -export -out CRT.pfx -inkey CRT.key -in CRT.crt - $ openssl pkcs12 -in CRT.pfx -nodes -out CRT.pem - -The capsule file can be generated by using the GenerateCapsule.py -script in EDKII:: - - $ ./BaseTools/BinWrappers/PosixLike/GenerateCapsule -e -o \ - --monotonic-count --fw-version \ - --lsv --guid \ - e2bb9c06-70e9-4b14-97a3-5a7913176e3f --verbose \ - --update-image-index --signer-private-cert \ - /path/to/CRT.pem --trusted-public-cert \ - /path/to/CRT.pub.pem --other-public-cert /path/to/CRT.pub.pem \ - +The signed capsule file can be generated by using tools/mkeficapsule. +To build this tool, enable:: + + CONFIG_TOOLS_MKEFICAPSULE=y + CONFIG_TOOLS_LIBCRYPTO=y + +To generate and sign the capsule file:: + + $ mkeficapsule --monotonic-count 1 \ + --private-key CRT.key \ + --certificate CRT.crt \ + --index 1 --instance 0 \ + [--fit | --raw ] \ + Place the capsule generated in the above step on the EFI System Partition under the EFI/UpdateCapsule directory From patchwork Tue Aug 31 02:46:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 504641 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp2369974jai; Mon, 30 Aug 2021 19:48:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxF5SFyta56AL7WZ8Kx5J076I6HhiXQJ0sM5MyyxeQCMDYkEAGoEOK/I1DB4sMxoGlRTnOG X-Received: by 2002:aa7:c54c:: with SMTP id s12mr26402320edr.96.1630378112067; Mon, 30 Aug 2021 19:48:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630378112; cv=none; d=google.com; s=arc-20160816; b=Hk0tZTYru2NIJtm9NfE8ac/b1GNQxMXXzC3DJUOrID8sjhKmYVl4yNkwuNddsOGT3T Yy2hYQSvDR0XGifLBvveYhI1nJ54vUMTBjNrIBYU0iUA8s1AqxUwEAi+KSYU9cljCj/D 6r72Yr5Ttb9mvNckkpa+njvH5ATeXCo8zu5LTRgWutNTtQ3Zu+5O0vGTGOQ1dDYQi+lv nx+0Pn7YjUV3BuElGVcdadeUH8fjtWK1MmaqzX8KcOA+fDo81PI90OWvXsa4oFsR6thW ekec7hI7HT+EDmtlqRehFApZLvwzsvoiOn6rQLXzBghLkZKOf5ueL6/sjWIqhYSivTMC V2Fg== 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:dkim-signature; bh=fSykzfRbGy8MXSfwsGkgUWqXo3A9nlIQfo0wr2f8npc=; b=smfO6R/jn0FikXE+LGrcrAqgQUhh7njDxVHZ4lq37Z8mr5kY4XtrDUScfWxLliMGPn HUTqxuaawS+4/qyj+BpoTDaQhnt2cx8XuR2cUNqzg3avOkaF/R1/zPk/t/SsX+8tGTGt EuegI3/rqB2BAJGDKzpgKpx7sv2veCEJdgb5P8rZEiNg2JMiH3v7SWv214JIeumKWMFQ UJRHIsXEG3ZwaWUm3LCDKmxqlOH5bYVc70ZKcQDzDQ4Geeyz8uprJjaM+fRT7deNE1Rw 7Brdqw+MH0GRfnG2EFqgZ9ekZ7Sbcbm48Yq4x4Duv+c3nmapLaKx03dPSfVPF8BfnIE/ ZV2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mQOp+ABY; 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=pass (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 r23si738683edy.23.2021.08.30.19.48.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 19:48:32 -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; dkim=pass header.i=@linaro.org header.s=google header.b=mQOp+ABY; 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=pass (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 ADF028340D; Tue, 31 Aug 2021 04:48:25 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="mQOp+ABY"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 519E483403; Tue, 31 Aug 2021 04:47:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 90E0D8340A for ; Tue, 31 Aug 2021 04:47:42 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pj1-x102c.google.com with SMTP id j4-20020a17090a734400b0018f6dd1ec97so1332264pjs.3 for ; Mon, 30 Aug 2021 19:47:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fSykzfRbGy8MXSfwsGkgUWqXo3A9nlIQfo0wr2f8npc=; b=mQOp+ABYGY7eYjXhq4HTPEGRifOtqU3dgAK5ttT2TnJpwdmG4DnkNa7dzJRB4TzvhR w4ZGalHK6SVev1sTWiE+IJ3PYgwwDwJUt4dEryAdkFfKA9iREjU/Iz2FLC1M3EV4E60I VqvXgZ1BKdDORiyTnGbKj7h/LuKJXKktc0LlqpmUVM/nbnUHPEliCwGDiIkVW9Vg24hd h0LdAmxRnVThNo/3F8jWkMggwu9cOz3RNLuw1AQlfCh+ExHcsmygkD/Tj9GTxmAT48kt UWRcfObTTrRK0vqjzegIukf/6myApIfPoIM/wQsQAoEPF6Vw8yorMxAFR4AuhVbpxH1M ltKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fSykzfRbGy8MXSfwsGkgUWqXo3A9nlIQfo0wr2f8npc=; b=cA4/izkj+SE8jF8RIMIkIajXZ+IBLoQsJX7ECS3Sq+q9ap2zT2OSCKrPQwCijGvp87 vY+hDS6+f7LhAPq/ob+SMNA1IT+dbUuQJZVA8ylBErShPQ/UOTcAMA135zRQ21LUiKVY HM8xMJMmooxvL+tGuPaZlyXFrwiCSk+CBIGPhQhz6iUEmLlMgjki2X29u9x9ncctpDmh uXv6s83OELS4FxW4EaVOdmL4h6AqYT80CfQscct/9fhLFqTyFOmwDSEpCkhi7hWCAjoE N/+5C53iNr23ikC/ktjmhQnpaNAoZIDV1I3/+zOXEBCpIX5GAjXfbyHWSq4Hzpb7/xU9 KZCQ== X-Gm-Message-State: AOAM533wEEesXo2QvJCXRDMYxDbmm0QVk4ERZkbOdrER0R/51s91v5Bp YytAMPgFWjcfOw3idot738wbbQ== X-Received: by 2002:a17:90b:1d02:: with SMTP id on2mr2452218pjb.21.1630378060813; Mon, 30 Aug 2021 19:47:40 -0700 (PDT) Received: from localhost.localdomain (p784a44f4.tkyea130.ap.so-net.ne.jp. [120.74.68.244]) by smtp.gmail.com with ESMTPSA id g2sm219649pfr.35.2021.08.30.19.47.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 19:47:40 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de Cc: ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v3 4/5] tools: mkeficapsule: allow for specifying GUID explicitly Date: Tue, 31 Aug 2021 11:46:58 +0900 Message-Id: <20210831024659.53464-5-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210831024659.53464-1-takahiro.akashi@linaro.org> References: <20210831024659.53464-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean The existing options, "--fit" and "--raw," are only used to put a proper GUID in a capsule header, where GUID identifies a particular FMP (Firmware Management Protocol) driver which then would handle the firmware binary in a capsule. In fact, mkeficapsule does the exact same job in creating a capsule file whatever the firmware binary type is. To prepare for the future extension, the command syntax will be a bit modified to allow users to specify arbitrary GUID for their own FMP driver. OLD: [--fit | --raw ] NEW: [--fit | --raw | --guid ] Signed-off-by: AKASHI Takahiro --- doc/develop/uefi/uefi.rst | 4 ++-- doc/mkeficapsule.1 | 19 +++++++++++----- tools/mkeficapsule.c | 46 ++++++++++++++++++++++++--------------- 3 files changed, 43 insertions(+), 26 deletions(-) -- 2.33.0 Acked-by: Heinrich Schuchardt diff --git a/doc/develop/uefi/uefi.rst b/doc/develop/uefi/uefi.rst index 5ccb455da984..c23fc2125fb2 100644 --- a/doc/develop/uefi/uefi.rst +++ b/doc/develop/uefi/uefi.rst @@ -359,8 +359,8 @@ To generate and sign the capsule file:: --private-key CRT.key \ --certificate CRT.crt \ --index 1 --instance 0 \ - [--fit | --raw ] \ - + [--fit | --raw | --guid Place the capsule generated in the above step on the EFI System Partition under the EFI/UpdateCapsule directory diff --git a/doc/mkeficapsule.1 b/doc/mkeficapsule.1 index 7c2341160ea4..ab2aa3719744 100644 --- a/doc/mkeficapsule.1 +++ b/doc/mkeficapsule.1 @@ -5,7 +5,7 @@ mkeficapsule \- Generate EFI capsule file for U-Boot .SH SYNOPSIS .B mkeficapsule -.RB [\fIoptions\fP] " \fIcapsule-file\fP" +.RB [\fIoptions\fP] " \fIimage-blob\fP \fIcapsule-file\fP" .SH "DESCRIPTION" The @@ -21,7 +21,7 @@ Optionally, a capsule file can be signed with a given private key. In this case, the update will be authenticated by verifying the signature before applying. -\fBmkeficapsule\fP supports two different format of image files: +\fBmkeficapsule\fP takes any type of image files, including: .TP .I raw image format is a single binary blob of any type of firmware. @@ -33,15 +33,22 @@ is the same as used in the new \fIuImage\fP format and allows for multiple binary blobs in a single capsule file. This type of image file can be generated by \fBmkimage\fP. +If you want to use other types than above two, you should explicitly +specify a guid for the FMP driver. + .SH "OPTIONS" .TP -.BI "-f, --fit \fIfit-image-file\fP" -Specify a FIT image file +.BI "-f, --fit +Indicate that the blob is a FIT image file + +.TP +.BI "-r, --raw +Indicate that the blob is a raw image file .TP -.BI "-r, --raw \fIraw-image-file\fP" -Specify a raw image file +.BI "-g, --guid \fIguid-string\fP" +Specify guid for image blob type .TP .BI "-i, --index \fIindex\fP" diff --git a/tools/mkeficapsule.c b/tools/mkeficapsule.c index 090fb02de68d..c730cf468d2b 100644 --- a/tools/mkeficapsule.c +++ b/tools/mkeficapsule.c @@ -14,7 +14,7 @@ #include #include - +#include #include #ifdef CONFIG_TOOLS_LIBCRYPTO #include @@ -51,14 +51,15 @@ efi_guid_t efi_guid_image_type_uboot_raw = efi_guid_t efi_guid_cert_type_pkcs7 = EFI_CERT_TYPE_PKCS7_GUID; #ifdef CONFIG_TOOLS_LIBCRYPTO -static const char *opts_short = "f:r:i:I:v:p:c:m:dh"; +static const char *opts_short = "frg:i:I:v:p:c:m:dh"; #else -static const char *opts_short = "f:r:i:I:v:h"; +static const char *opts_short = "frg:i:I:v:h"; #endif static struct option options[] = { - {"fit", required_argument, NULL, 'f'}, - {"raw", required_argument, NULL, 'r'}, + {"fit", no_argument, NULL, 'f'}, + {"raw", no_argument, NULL, 'r'}, + {"guid", required_argument, NULL, 'g'}, {"index", required_argument, NULL, 'i'}, {"instance", required_argument, NULL, 'I'}, #ifdef CONFIG_TOOLS_LIBCRYPTO @@ -73,11 +74,12 @@ static struct option options[] = { static void print_usage(void) { - printf("Usage: %s [options] \n" + printf("Usage: %s [options] \n" "Options:\n" - "\t-f, --fit new FIT image file\n" - "\t-r, --raw new raw image file\n" + "\t-f, --fit FIT image type\n" + "\t-r, --raw raw image type\n" + "\t-g, --guid guid for image blob type\n" "\t-i, --index update image index\n" "\t-I, --instance update hardware instance\n" #ifdef CONFIG_TOOLS_LIBCRYPTO @@ -524,14 +526,13 @@ err_1: */ int main(int argc, char **argv) { - char *file; efi_guid_t *guid; + unsigned char uuid_buf[16]; unsigned long index, instance; uint64_t mcount; char *privkey_file, *cert_file; int c, idx; - file = NULL; guid = NULL; index = 0; instance = 0; @@ -546,21 +547,30 @@ int main(int argc, char **argv) switch (c) { case 'f': - if (file) { - printf("Image already specified\n"); + if (guid) { + printf("Image type already specified\n"); return -1; } - file = optarg; guid = &efi_guid_image_type_uboot_fit; break; case 'r': - if (file) { - printf("Image already specified\n"); + if (guid) { + printf("Image type already specified\n"); return -1; } - file = optarg; guid = &efi_guid_image_type_uboot_raw; break; + case 'g': + if (guid) { + printf("Image type already specified\n"); + return -1; + } + if (uuid_parse(optarg, uuid_buf)) { + printf("Wrong guid format\n"); + return -1; + } + guid = (efi_guid_t *)uuid_buf; + break; case 'i': index = strtoul(optarg, NULL, 0); break; @@ -596,14 +606,14 @@ int main(int argc, char **argv) } /* check necessary parameters */ - if ((argc != optind + 1) || !file || + if ((argc != optind + 2) || !guid || ((privkey_file && !cert_file) || (!privkey_file && cert_file))) { print_usage(); return -1; } - if (create_fwbin(argv[optind], file, guid, index, instance, + if (create_fwbin(argv[argc - 1], argv[argc - 2], guid, index, instance, mcount, privkey_file, cert_file) < 0) { printf("Creating firmware capsule failed\n"); return -1; From patchwork Tue Aug 31 02:46:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AKASHI Takahiro X-Patchwork-Id: 504642 Delivered-To: patch@linaro.org Received: by 2002:a02:8629:0:0:0:0:0 with SMTP id e38csp2370075jai; Mon, 30 Aug 2021 19:48:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4q3Pjvl69AlnnCMsIbQ33NsZTVisWe7oebOdJAhPk8PdRAna9QuGW0YBujxaqFcszopC9 X-Received: by 2002:a17:906:3a98:: with SMTP id y24mr27685061ejd.198.1630378123392; Mon, 30 Aug 2021 19:48:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630378123; cv=none; d=google.com; s=arc-20160816; b=ksbz/jM1WDTdDs1wHxQtd7IGMKVGMxlFItGP2+VcgQ+X2OolNwt3Q35AWmLzREecT0 Z1JBWYWfeAMW5aRjV9/QG8P+FlPvmRTmNEiYSegTNWl0dhg6HCLeUXFfMsFHMXqfAOGi zSY0SHZp78sQpG3G7BwvGmh1/Fwcn7dleGcPNeUD/lDvOTEVQJD5K5iT/+TdoU08ijWL UIQQYu+UkQTxN0h+V+H+Z3GnX/5Lp483UeMRmn8h/u5cW5ZnnIrK1DEPidcRU4z5wGZK N8RItfRb+O6DL9ToRLHLC9L9XtCR6GMkpW9WRrNHzvx3PkQL3Aebx8wBkcbnkIoXvDX0 +D4g== 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:dkim-signature; bh=v4dBoQZd5UUP1oYnWDORh8SVHXfwpxzYRmK3J7LmPHs=; b=lTzuGCHO7pRHu6yBgNCbibZ//9iacxbO0UZT14bQVWrnahGNS5HtyWFgNy4UvXPDDc Td2DRUVZ65WqfvF/+PhViL1psjAVQL7ZOMWMT1vyNchsGL3k51Pq66UT8Oh1VNRvr8W8 wXBUlWBBikkqZ06bIkEM6R+TmN5YdRMPrVnCWZxqthwLODolILLEbz1BXnzsxtGPB9Eg njWKxavcerxcowXMB8GR/eSr4OvMqYikh8tiXkQExYznM2LTf47Fxztr58AC0DAfJ/Bn 7b9hIrtokSwkAaUCflDz97mwyyJqQFKWNm21wb0Zj0NXkNjwFnfqLdmEGjHWY+RHyMA0 uvuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wsuFc9Gt; 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=pass (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 aq12si7528190ejc.417.2021.08.30.19.48.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 19:48:43 -0700 (PDT) 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; dkim=pass header.i=@linaro.org header.s=google header.b=wsuFc9Gt; 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=pass (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 25F388341F; Tue, 31 Aug 2021 04:48:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="wsuFc9Gt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BA825833F8; Tue, 31 Aug 2021 04:47:52 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 6C560833FB for ; Tue, 31 Aug 2021 04:47:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pf1-x429.google.com with SMTP id v123so13753755pfb.11 for ; Mon, 30 Aug 2021 19:47:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=v4dBoQZd5UUP1oYnWDORh8SVHXfwpxzYRmK3J7LmPHs=; b=wsuFc9Gtsu6KQEx08DUhX+pESaT2lkQV7wUI2h/+3wliozDcSYPdhFnObosZWOwzpG 2rXncEsOZbJnnc1RDwUgnppAKifyHvy2HIcF7W8Jeko0f6gJlwNnE8ULObx72ZxGHeDW c76H4juQ5ZHyt0GAS57ekYWxO81KuOQTA7/tA6BooQaOd9Bxi/z0DQaoN2CX4i1w62aM vwNs7OstCQciwymbv7uzb8l9Bt9VElyXCxsRzJTNbOXrvzLLRerHp0VP4DlrskTxcaBD LsFSdRyxmOIy6GePrqxJYM7jcLFtDhQzju5Wl6TMF+eiQCDQpSIyePg2KWA8BegyJsXi +cKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=v4dBoQZd5UUP1oYnWDORh8SVHXfwpxzYRmK3J7LmPHs=; b=JEnE/dsg4b3Tk12FAnTRWrMYaZTPrFyASkxhyH72Cql/ahwNpOGXvZherQsT5nGNBS a9bSleJVj6jC7iGR6FN131iJ3PSFwPDLVNkZS548MwEJtO0DoHhGM9XSX2X4Q7hRIAkQ 0rHhREm6vV0L1wcsCmVMfUibQnWux5R8AN4p6COGEEAhE5pvFLuzQVbtZMi2jCCXCPIw GB6yKfi2UWcLqmDIA8A7mfhmIT3hCPL6QmCH2ew8NzBuJStT6w/sktsODTvOWUo0K+es 9dw9Nyo1pfhShFPZp3EDLnD3pU/nsIkAHZk+Uwt3nobb4BoFXIWJI7h/M5ujYsS2UfXz P3Cg== X-Gm-Message-State: AOAM533kGsi0vooo4eB1NZm4UcDFl1fnv6IWY+9WHv5AXnKn/mGc6j9r dZVa1zhUEM6fvPONJ8r3s6FYRg== X-Received: by 2002:aa7:80d1:0:b029:399:ce3a:d617 with SMTP id a17-20020aa780d10000b0290399ce3ad617mr26049449pfn.16.1630378063713; Mon, 30 Aug 2021 19:47:43 -0700 (PDT) Received: from localhost.localdomain (p784a44f4.tkyea130.ap.so-net.ne.jp. [120.74.68.244]) by smtp.gmail.com with ESMTPSA id g2sm219649pfr.35.2021.08.30.19.47.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Aug 2021 19:47:43 -0700 (PDT) From: AKASHI Takahiro To: xypron.glpk@gmx.de, agraf@csgraf.de Cc: ilias.apalodimas@linaro.org, sughosh.ganu@linaro.org, masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v3 5/5] test/py: efi_capsule: align with the syntax change of mkeficapsule Date: Tue, 31 Aug 2021 11:46:59 +0900 Message-Id: <20210831024659.53464-6-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210831024659.53464-1-takahiro.akashi@linaro.org> References: <20210831024659.53464-1-takahiro.akashi@linaro.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.2 at phobos.denx.de X-Virus-Status: Clean Modify command line arguments at mkeficapsule as the syntax was a bit modified in the previous commit. Signed-off-by: AKASHI Takahiro --- test/py/tests/test_efi_capsule/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.33.0 diff --git a/test/py/tests/test_efi_capsule/conftest.py b/test/py/tests/test_efi_capsule/conftest.py index 6ad5608cd71c..8b5368c11abc 100644 --- a/test/py/tests/test_efi_capsule/conftest.py +++ b/test/py/tests/test_efi_capsule/conftest.py @@ -50,10 +50,10 @@ def efi_capsule_data(request, u_boot_config): check_call('cd %s; %s/tools/mkimage -f uboot_bin_env.its uboot_bin_env.itb' % (data_dir, u_boot_config.build_dir), shell=True) - check_call('cd %s; %s/tools/mkeficapsule --fit uboot_bin_env.itb --index 1 Test01' % + check_call('cd %s; %s/tools/mkeficapsule --index 1 --fit uboot_bin_env.itb Test01' % (data_dir, u_boot_config.build_dir), shell=True) - check_call('cd %s; %s/tools/mkeficapsule --raw u-boot.bin.new --index 1 Test02' % + check_call('cd %s; %s/tools/mkeficapsule --index 1 --raw u-boot.bin.new Test02' % (data_dir, u_boot_config.build_dir), shell=True)