From patchwork Mon Sep 3 14:47:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 145816 Delivered-To: patches@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp2575819ljw; Mon, 3 Sep 2018 07:47:47 -0700 (PDT) X-Received: by 2002:a19:a401:: with SMTP id q1-v6mr18888158lfc.111.1535986067917; Mon, 03 Sep 2018 07:47:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535986067; cv=none; d=google.com; s=arc-20160816; b=UU9qYpVUNiTgH4rQb7ODJHAcMXdXN/UHMcqhWKQxSjVS/f4xkHBK5I3yS0ys8dlB9C wUJSDxQiVJMo+gDUgtCU5cmL2HirY0ChrepGrYOBM4zSDKOcgILIsXeobphqXERBe9Y9 9AZ+KxOQ+f/ad9vI7vd74WH8t4PPq37WSHdPWlTZbGjzzoXs6eIARyVUu4DJ96u61dIw KXGZAFiANgA3KvkdiKVQHU2sp1IFRytSR/Y2+f50C7tDcXlPlValN/+rRvZsu0TNDa3r 4rQo1hy2TojYbrIEfKrF27l3x38xr+mAljdL621JYbv464H0TIiDHzLnRqFPik2MR750 zfDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=+9FSrqWNL25MdQ9/5naOwcGq3yhUTI1TrXp3fXXUVJ0=; b=OMfyAM5aD8lmvaCcLk6HhyruXOAEESiBd0nnxSKdcRmh1v4XGAFThGbbfyy0n06Wek bAO2q2MhMZfMaIkR4ePnGzpb0MfkH2p+O6jFB972fk6O+9X7dno4G161qiqOSZBoTUw1 vW5perQEaDil23q4zoa79I50tvxaUXfBZQ1p8r39tEbDkxXnM28wXHkvWzskOmg1gJp/ RfTBFgMTfv0BLarvyTfyzxk3DszGXa2TKy6sx7cExgEQNfDA2A+NxhQgUA5QTRF2iUAY SE4fJqwi1rDqkm/eJg8YZrSR/TraYdH9G+8WwmV5F5SqE5GdoKm7YakD0bYXpQ5+Hahj EM1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RxnWZdrv; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id q5-v6sor5309770lff.24.2018.09.03.07.47.47 for (Google Transport Security); Mon, 03 Sep 2018 07:47:47 -0700 (PDT) Received-SPF: pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RxnWZdrv; spf=pass (google.com: domain of jens.wiklander@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=jens.wiklander@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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; bh=+9FSrqWNL25MdQ9/5naOwcGq3yhUTI1TrXp3fXXUVJ0=; b=RxnWZdrvNuPSQ/nCdH5DcM92yH/qCtcWXmcnRisPjZKTA5Y3qw0nNHa6YMd76rpcEX lBpsoeBhMAyHMNwLAD7iqANBARxLWfWb5TFXRXoZL1+cMTHv1sjw2nvco3Dpw6AbWFhX Ddq9K8FY7vYIwpLLcoG8ybBikfDe5xvG0pEyM= 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; bh=+9FSrqWNL25MdQ9/5naOwcGq3yhUTI1TrXp3fXXUVJ0=; b=pgxqXO2WvAwhf4VwNud8J6FuyKlhkyVhuMXpMyjHoJvGayyKpQJh+jYNtX48LQ9i3k 9Ao+3+giFl/f0rCzfQYpaQqTf6Wj7B1kD4XmqZT+Wbgtl7KJy+BJzMesgo0QNdBbTo0u qaaSEdJFHMsewoHwxWnVeF1buSRlg0Xg6uFuhDPdMb5qwrIuHHtcYqbL8Ox5Oh5tsemG v/zFLNams+tgzbwPIuSg37yhbWmXXLTgkm1MAbqPadSYUNESXyOrMXnizROULRBSbNfO Ca9sbiKFwVqLKo/SpMFCBT9n/nHia+St/pZV/ALti3vPhbsee18gEa7CPHh8ciRCxitZ OqDg== X-Gm-Message-State: APzg51DGrMBqvEMPQh2d/ZKsJpOTdkVji1Syo4cfwDpsuhF7rO1ox7lO D5J1AmxAztZ2gKZ9C4sAwj59xLER5kk9Vw== X-Google-Smtp-Source: ANB0Vda255/mLWrKJC0UH5QBc2DqudIF5D/1yRY7HeVYQPbKvrgBRI5cRCsXCw3fMYSji771Smz/9g== X-Received: by 2002:a19:c5:: with SMTP id 188-v6mr17565350lfa.45.1535986067739; Mon, 03 Sep 2018 07:47:47 -0700 (PDT) Return-Path: Received: from jax.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id w18-v6sm3343431ljd.73.2018.09.03.07.47.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Sep 2018 07:47:46 -0700 (PDT) From: Jens Wiklander To: u-boot@lists.denx.de Cc: Simon Glass , Igor Opaniuk , Tom Rini , Jaehoon Chung , Pierre Aubert , Albert Aribaud , Peter Griffin , Michal Simek , Jens Wiklander Subject: [PATCH v3 19/20] avb_verify: support sandbox configuration Date: Mon, 3 Sep 2018 16:47:10 +0200 Message-Id: <20180903144711.31585-20-jens.wiklander@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180903144711.31585-1-jens.wiklander@linaro.org> References: <20180903144711.31585-1-jens.wiklander@linaro.org> With CONFIG_SANDBOX malloc a buffer in get_sector_buf() and return that instead of returning CONFIG_FASTBOOT_BUF_ADDR since there's no such buffer reserved. Signed-off-by: Jens Wiklander --- include/avb_verify.h | 9 +++++++++ 1 file changed, 9 insertions(+) -- 2.17.1 diff --git a/include/avb_verify.h b/include/avb_verify.h index a532a2331aea..7b95409d247e 100644 --- a/include/avb_verify.h +++ b/include/avb_verify.h @@ -76,7 +76,16 @@ static inline size_t get_sector_buf_size(void) static inline void *get_sector_buf(void) { +#ifdef CONFIG_SANDBOX + static void *p; + + if (!p) + p = avb_malloc_(get_sector_buf_size()); + + return p; +#else return (void *)CONFIG_FASTBOOT_BUF_ADDR; +#endif } static inline bool is_buf_unaligned(void *buffer)