Message ID | 20231009153152.416365-6-stefano.babic@swupdate.org |
---|---|
State | Accepted |
Delegated to: | Stefano Babic |
Headers | show
Return-Path: <swupdate+bncBAABB3VZSCUQMGQEQ37YC5I@googlegroups.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=YjXued6b; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::23b; helo=mail-lj1-x23b.google.com; envelope-from=swupdate+bncbaabb3vzscuqmgqeq37yc5i@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-lj1-x23b.google.com (mail-lj1-x23b.google.com [IPv6:2a00:1450:4864:20::23b]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4S431J2VV4z20Vh for <incoming@patchwork.ozlabs.org>; Tue, 10 Oct 2023 02:32:04 +1100 (AEDT) Received: by mail-lj1-x23b.google.com with SMTP id 38308e7fff4ca-2c12c3e4595sf38288401fa.1 for <incoming@patchwork.ozlabs.org>; Mon, 09 Oct 2023 08:32:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1696865520; cv=pass; d=google.com; s=arc-20160816; b=e3cBlaTS5RJURMHWdr35G5zOYg1+YH+mGEDUCGSx9dT5Q2n3d2AjMLM+4DXgawMXBh PEgabKETaOmJC0GHtWRclGt6G3Y7abVAUkyfz6dQV96DhhhcKKuR1xUxtMnQL99lTt+W im6O/zTHWpXB4Ag7b0TgslnT7pCrw/zfPRfLZeD/9LHfDBe6tNbm2omQmLdtV9/z9Csa BY0ZlhY3Kw6y+PUojPiEMcO+e6Mkr0tA/PDonddh/rVCoXrT71uaBhLntaWDxulsfIsH 2LNawOf1ECly8X3kuUnuOXhQhT+PiDlavDeJTI6zL+KxoI34fw8VYRB9M95M8H5Cp5wb G6XA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:ui-outboundreport:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from:sender :dkim-signature; bh=AtrhKIyAqkPIjGxfCN3R0Z8mYlR2cqYvi5u9/BRRWhY=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=u0pH0wWam9RJqPshbJt/AT/B3WSTsTLmom5RBElkOyaGloyr/aa86tNosXpyogfYXS pePvlOQO1g3YUBdj+UKjvB4aY/QMMVsGqe+x9h1+RVbv2OsMlFDU32mEmt6Q6yo0hIKX +rddcnCyp0rcoivuyGeIOjXvnFIxO5Em2cAQ9WHqmuu8LvNt3eAerzbVQjVi12HeMdWk oI1I3NoCvG0gV/B58EauMBBNPCgfE05VA05nEmjQgA4lkHFVbe7xQPiuJx0zpDnuzv2Z TifLmtHkkDUctAgA4dfwjgP853+RF4mOvpfELIJjTcLoa/Im9DCDJiRr3rPsO5ob/zeM 4GcQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.13 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1696865520; x=1697470320; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:ui-outboundreport:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=AtrhKIyAqkPIjGxfCN3R0Z8mYlR2cqYvi5u9/BRRWhY=; b=YjXued6b6sgGqv2dx2HyHBg2pkQbF+qug313WA18t75eqxqCdiP1VwUMFbMyN2ksok 8Ue2bdSNI3tOlMq9CN7w1+NYeLIDZOYxHRNvoAiWSX4W6lSK3taEuGLljzuRnvl/PtmO uVqGqUppMbo6HBnH7k+rVrH94E9CzNJ9Azs7Mqk4OkHE3tW63p70l631Wv4A/G7rkgYI A4xa5X0rTO52mcHv852LIaXYHt/eBNGegcs75Cbzh6Yla/EmRwpz/QZpRLg1GfNG2wq7 xawrLsjyv+mJbQU0nU29qR4GQJbzbhQDKM46hElyAyvrNzXqWw7CXQ8SrbgC0khiJM+n T4QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696865520; x=1697470320; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :ui-outboundreport:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:x-beenthere:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=AtrhKIyAqkPIjGxfCN3R0Z8mYlR2cqYvi5u9/BRRWhY=; b=bU95FWNAUGqqwUUunIM7O6+QVOoOmuoqL5Bz1WqeSuDTCsxYUJwx+woSCAMAfUvqZ2 OZ12mjUe7VC1eDqL2nYAPpVTa5JpxnQas3yzigUEv3BEGj6djBn/PU69EjCziuD1HRHo 4sPkXxVm3CqjCWt59vFJLNYqq6e40gP7rqJKP0ETAxLwesOxSJ9rXDUS/QhLFl8UnGku KkyRxXrT/dDG73EGO/QICNA1L5QYITxX6t8XgP/Sk/Ih+2iolEuHqFxrLe7f5Ya6eQv0 WzPJivJ28OuZi8gsAubBKAq9oLUXcBr+X9MdPOUXrfdTRC8l9QKfwwJrKFlFvv0pvscD SXLw== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOJu0Yyxreh/pVeaOkihSrhjN+oXviU+bZ0kyA0JybCssg60RsvHOaXu t1GMz69x48RX+Txiz+urrwM= X-Google-Smtp-Source: AGHT+IECQGkNMzgH2+ONQQhD4vo5IR0zu7fNJFYM/v2FkTsimLLwENUIrXNbwe5PnsFwvtB1dYBEyQ== X-Received: by 2002:a2e:330f:0:b0:2bc:df3f:7140 with SMTP id d15-20020a2e330f000000b002bcdf3f7140mr13022260ljc.17.1696865519061; Mon, 09 Oct 2023 08:31:59 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a05:651c:c99:b0:2b9:6182:b0a4 with SMTP id bz25-20020a05651c0c9900b002b96182b0a4ls1539784ljb.2.-pod-prod-05-eu; Mon, 09 Oct 2023 08:31:56 -0700 (PDT) X-Received: by 2002:a19:f516:0:b0:4fe:19ef:8791 with SMTP id j22-20020a19f516000000b004fe19ef8791mr12127715lfb.38.1696865516137; Mon, 09 Oct 2023 08:31:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696865516; cv=none; d=google.com; s=arc-20160816; b=F4qivaFKolovzWDM0kUTS3FxonikjTrEpr1OZ6reFOdBW4YXWU8GjyNrwbmAnGjYDo 4zLxA0L+NWArj98BO/g4AYUfnfvxFFOHFZBFxuU/Sb8E2aD0ytC2gdPR5ExoLsIITHbA vdmkjNSwhtZegOZx56+qKflloBD6QFZ/uhti3A0f3EN55qE4imrolUJLGCh8hRwm3VjW yIuvo6FMdr4RPZ0EwYpYrfAFrqIf5CczLw8evwkOuO1HClEsea3FKNdX731bAKictm8M JGCpBsstP1izV02BHTd8Tf2P7y42EusFHyyvWnQPKWXBpxTFc043qa/ESsv8S7vMHTHC nN6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=ui-outboundreport:content-transfer-encoding:mime-version:references :in-reply-to:message-id:date:subject:cc:to:from; bh=6Y2foYKYSImxOc+m1DYqJvGMgkiLv4V19ri3VblK6M0=; fh=TiEWcqMcKpHk5s7uErzpntoONrNfOXwKpI5P8bIlggk=; b=TcbVvTxIgjRROelRXkjGo3CkMK+LQ7g9UfguKLImxsAZ96OC9IiVn7XhQnfd9SiF31 KXNHINniD3YJPUGAFYUj3fPopsgz5UzwL9MydXuvGLLSSt9L2R7bWybjAvRtjLsDG2UG Q8KY2d/TL3XCUpBBL16SpgvTHUSo+LZu+okPJhTFr5uTdST0OYbEhcps4ZLGNKT4UOmT 9m4wfrBXJht6nmJ5DFzR/9TRZfBHPKnnquLAHzfIEgjGJhZX/o1EACMnh9eoxFR8zmg1 dyk6lPmhpr2KeAaHgL1jmclhS81eP4SJXgxh9Mo9jU5iC6b+9eQxtIHO2a4KMsg9gkdG y+9g== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.13 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Received: from mout.kundenserver.de (mout.kundenserver.de. [212.227.17.13]) by gmr-mx.google.com with ESMTPS id o6-20020ac25e26000000b005056618eed7si351981lfg.4.2023.10.09.08.31.56 for <swupdate@googlegroups.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 08:31:56 -0700 (PDT) Received-SPF: pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.13 as permitted sender) client-ip=212.227.17.13; Received: from paperino.fritz.box ([88.217.136.221]) by mrelayeu.kundenserver.de (mreue109 [213.165.67.113]) with ESMTPSA (Nemesis) id 1MFsd7-1qnPFs1VeR-00HQMY; Mon, 09 Oct 2023 17:31:55 +0200 From: Stefano Babic <stefano.babic@swupdate.org> To: swupdate@googlegroups.com Cc: Stefano Babic <stefano.babic@swupdate.org> Subject: [swupdate] [PATCH 5/7] util: add getter/setter for libuboot config Date: Mon, 9 Oct 2023 17:31:50 +0200 Message-Id: <20231009153152.416365-6-stefano.babic@swupdate.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231009153152.416365-1-stefano.babic@swupdate.org> References: <20231009153152.416365-1-stefano.babic@swupdate.org> MIME-Version: 1.0 X-Provags-ID: V03:K1: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LPVWH2YMqWJVdsAztgO 1XrmGd8AavOR366L/8mMj/Ycteaf43PCUcqXnX5jlRTiNgZQKYoRh410KDIWFeY8fG5ecvkg5 ownX5pEZHuI/3NW0s92TQZGtMgObQfgr56oQ= X-Original-Sender: stefano.babic@swupdate.org X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of stefano.babic@swupdate.org designates 212.227.17.13 as permitted sender) smtp.mailfrom=stefano.babic@swupdate.org Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series |
Introduce SWUpdate environment
|
expand
|
diff --git a/core/util.c b/core/util.c index 9ab0a17d..afe447fb 100644 --- a/core/util.c +++ b/core/util.c @@ -53,6 +53,12 @@ struct decryption_key { static struct decryption_key *aes_key = NULL; +/* + * Configuration file for fw_env.config + */ + +static char *fwenv_config = NULL; + char *sdup(const char *str) { char *p; if ((p = (char *) malloc(strlen(str) + 1)) != NULL) { @@ -573,6 +579,27 @@ int set_aes_ivt(const char *ivt) return 0; } +const char *get_fwenv_config(void) { + if (!fwenv_config) +#if defined(CONFIG_UBOOT) + return CONFIG_UBOOT_FWENV; +#else + return NULL; +#endif + return fwenv_config; +} + +void set_fwenv_config(const char *fname) { + if (!fname) + return; + + if (fwenv_config) + free(fwenv_config); + + fwenv_config = strdup(fname); +} + + char** string_split(const char* in, const char d) { char** result = 0; diff --git a/include/util.h b/include/util.h index 5f4cdc01..b50b58ec 100644 --- a/include/util.h +++ b/include/util.h @@ -234,6 +234,10 @@ long long get_output_size(struct img_type *img, bool strict); bool img_check_free_space(struct img_type *img, int fd); bool check_same_file(int fd1, int fd2); +/* location for libubootenv configuration file */ +const char *get_fwenv_config(void); +void set_fwenv_config(const char *fname); + /* Decryption key functions */ int load_decryption_key(char *fname); unsigned char *get_aes_key(void);
This is to introduce a runtime setup for libubootenv configuration file that overrides CONFIG_UBOOT_FWENV. Signed-off-by: Stefano Babic <stefano.babic@swupdate.org> --- core/util.c | 27 +++++++++++++++++++++++++++ include/util.h | 4 ++++ 2 files changed, 31 insertions(+)