Message ID | 20210122170556.2338762-1-igor.opaniuk@gmail.com |
---|---|
Headers | show
Return-Path: <u-boot-bounces@lists.denx.de> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=foundries.io header.i=@foundries.io header.a=rsa-sha256 header.s=google header.b=SANssBw8; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DMlz50r5gz9sCq for <incoming@patchwork.ozlabs.org>; Sat, 23 Jan 2021 04:06:16 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E6D0C82770; Fri, 22 Jan 2021 18:06:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io 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=foundries.io header.i=@foundries.io header.b="SANssBw8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8F89482926; Fri, 22 Jan 2021 18:06:05 +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=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) (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 3123082761 for <u-boot@lists.denx.de>; Fri, 22 Jan 2021 18:06:02 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=foundries.io Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=igor.opaniuk@foundries.io Received: by mail-lf1-x130.google.com with SMTP id p21so3407151lfu.11 for <u-boot@lists.denx.de>; Fri, 22 Jan 2021 09:06:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundries.io; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ObLI1kZPIa6eso5FXOrlpL1izKH/gjhKIMINf01IllU=; b=SANssBw8ZvPUEnYuuuyPtJhfH7hWm5H/SzUAynKhDWCM2kOdnX4fQvpCNLki/8V1IA cUQwDOa/HNx1OITTBVqpAtxuPG5ajxND3Xr8ebHJUlJqfh24GuunBxjAp1QOZlC1g0ia PZSu3HFW0EPyMcb/TOS2EltHSvCl7XKcIuYd/zX21IljMRfpbLLtuxa8p1QNy8bNvvEf ud1dbOG8d9ohEbfMI5cwle+AnQyOToyjGecvTYs4xtMY7cEPoEFsY6JK0n3aDUcvwtKI aZMNm/UZumqnb07+bJc8ISF7/VQUxDZlO3R7PRSpsOlv+uFbfzazYmWKUrtjGp80542j niTA== 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:mime-version :content-transfer-encoding; bh=ObLI1kZPIa6eso5FXOrlpL1izKH/gjhKIMINf01IllU=; b=QQyOFcQd82/FyVClWWVY3hVCLjO/kVmllyWEt1GQKjReusKzbq1KBxTKACvu9l47Hy +BNBEbRYMO4Y4/fB6R4GauiGLJjGPERSVyKo75LBFZ3u5F3qLVURRtK5pU9iFTtcSoRr AXOqvnqZlHBearRbwYPUjdqhupHXZXPPAoevwPPrm6R39VHlEoP53U3/59WNW8uMCbES xp9yms3b5m7zeSxB/+txdpKzevb4SNLhMGR1M70Gcudn75hJ580vl8gO+6/YX4zqRQPE LBmC7r976TJ5EhzBnlEmXLjxzQGvAGK91M2f1Tt9hriCB1Wi6QJ5bZuFUJLWBHPtU4VX fXrw== X-Gm-Message-State: AOAM533+HFQTw6ruzKgKv1Mnrur99z3gumeZxRaoQrGHD/o19dY6LpZE HxQlMzJPN9CHGJuw2az90WFAo0nK1AgwgAR7 X-Google-Smtp-Source: ABdhPJxvXu19AHBjCBl4NgG6nZ9+n6bLTXgDTSsZ3vq0QXQ6rbEE9Mt5t4Tj0p5uU7sGWLcNdjaPYQ== X-Received: by 2002:a05:6512:202c:: with SMTP id s12mr1967785lfs.220.1611335161012; Fri, 22 Jan 2021 09:06:01 -0800 (PST) Received: from localhost ([109.108.76.111]) by smtp.gmail.com with ESMTPSA id i26sm948140lfl.309.2021.01.22.09.05.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jan 2021 09:06:00 -0800 (PST) From: Igor Opaniuk <igor.opaniuk@foundries.io> X-Google-Original-From: Igor Opaniuk <igor.opaniuk@gmail.com> To: u-boot@lists.denx.de Cc: mike@foundries.io, ricardo@foundries.io, seanga2@gmail.com, trini@konsulko.com, jorge@foundries.io, etienne.carriere@linaro.org, vikas.gupta@broadcom.com, sjg@chromium.org, jens.wiklander@linaro.org, Igor Opaniuk <igor.opaniuk@foundries.io> Subject: [PATCH v7 0/4] OP-TEE I2C trampoline and associated tests Date: Fri, 22 Jan 2021 19:05:52 +0200 Message-Id: <20210122170556.2338762-1-igor.opaniuk@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion <u-boot.lists.denx.de> List-Unsubscribe: <https://lists.denx.de/options/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=unsubscribe> List-Archive: <https://lists.denx.de/pipermail/u-boot/> List-Post: <mailto:u-boot@lists.denx.de> List-Help: <mailto:u-boot-request@lists.denx.de?subject=help> List-Subscribe: <https://lists.denx.de/listinfo/u-boot>, <mailto:u-boot-request@lists.denx.de?subject=subscribe> Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" <u-boot-bounces@lists.denx.de> X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean |
Series |
OP-TEE I2C trampoline and associated tests
|
expand
|
From: Igor Opaniuk <igor.opaniuk@foundries.io> This patchset allows OP-TEE to communicate with I2C devices; a typical use case would be servicing U-Boot requests that require underlying cryptographic operations implemented by an I2C chip. On a board fitted with the NXP SE050 I2C secure element, OP-TEE can route some of the cryptographic operations it needs to that device (ie RSA, ECC, CTR..). Before the REE executes, OP-TEE would use its own I2C drivers to communicate with the device on the bus; later on, once the REE is up, accesses to the I2C bus should be coordinated with the REE to avoid collisions. However instead of implementing such a synchronization mechanism, this trampoline service permits OP-TEE to route those I2C requests back to U-boot without then having to worry about collisions. Lets suppose that U-Boot executes the trusted application Android Verified Boot; when OP-TEE receives the request - and before executing the application - it uses RSA to verify it. So on the back of the TA function invocation, OP-TEE returns to U-boot with a sequence of RPC calls requesting I2C transfers (check carefully the implementation in do_call_with_arg(...) implemented in drivers/tee/optee/core.c and notice the while loop) When using sandbox testing, RPC is called directly to validate its actual implementation; however as succintly described above, these calls will always be originated in OP-TEE. Changes v7: * [Etienne Carriere] extended TA param description, adding info about i2c xfer flags. Applied A-b and R-b tags * [Jens Wiklander] applied R-b tag Changes v6: * [Etienne Carriere] fixed func return code handling * [Etienne Carriere] tee_optee_ta_uuid passing a pointer instead of full struct * [Etienne Carriere] pass additionally i2c control flags in tests * Fixed mispelling in the comments Changes v5: * [Jens Wiklander] Addressed comment about optee_alloc_and_init_page_list(): drop inline, proper return value and comment Changes v4: * [Simon Glass] Reduced amount ifdefs warnings and move to if (IS_ENABLED(CONFIG_*)) where possible * Fixed pointer-sign warnings Changes v3: * [Simon Glass] Added RPC I2C test coverage Changes v2: * [Simon Glass] Adjusted the usage of DM internal api (dev_get_parent_platdata) * [Simon Glass] Added additional comments to functions * [Jens Wiklander] s/tmem/rmem/g Igor Opaniuk (3): test: py: add pygit2 and pyelftools to requirements.txt drivers: tee: sandbox: add rpc test ta emulation test: dm: tee: extend with RPC test Jorge Ramirez-Ortiz (1): drivers: tee: i2c trampoline driver drivers/tee/Makefile | 2 + drivers/tee/optee/Kconfig | 9 ++ drivers/tee/optee/Makefile | 1 + drivers/tee/optee/i2c.c | 90 ++++++++++++++ drivers/tee/optee/optee_msg.h | 21 ++++ drivers/tee/optee/optee_msg_supplicant.h | 5 + drivers/tee/optee/optee_private.h | 17 +++ drivers/tee/optee/supplicant.c | 3 + drivers/tee/sandbox.c | 142 ++++++++++++++++++++++- include/tee/optee_ta_rpc_test.h | 29 +++++ test/dm/tee.c | 116 ++++++++++++++++-- test/py/requirements.txt | 2 + 12 files changed, 426 insertions(+), 11 deletions(-) create mode 100644 drivers/tee/optee/i2c.c create mode 100644 include/tee/optee_ta_rpc_test.h