Changes between Initial Version and Version 1 of venice/edgelock


Ignore:
Timestamp:
08/11/2025 10:52:14 PM (5 hours ago)
Author:
Tim Harvey
Comment:

initial page

Legend:

Unmodified
Added
Removed
Modified
  • venice/edgelock

    v1 v1  
     1[[PageOutline]]
     2
     3= NXP !EdgeLock Secure Enclave
     4While the i.MX8M does have its own internal !EdgeLock Secure Enclave it only allows up to FIPS level 2 and in some cases level 3 is required (which requires the keys are stored in a different IC).
     5
     6The SE05x speaks SCP03 on top of I2C and can co-exist with other I2C devices. It is often used within OPTEE with a trampoline driver that hooks into Linux with an SMC call to allow Linux owning the I2C bus but OPTEE still allowed controlled access
     7
     8The NXP !EdgeLock SE05x Plug & Trust middleware package is a software stack provided by NXP for integrating the SE050 with Linux systems.
     9 - Supports cryptographic operations like ECC, RSA, AES, and more, leveraging the SE050’s hardware security.
     10 - Provides APIs for session management, key storage, and cryptographic functions.
     11 - Includes support for secure communication protocols like !GlobalPlatform Secure Channel Protocol 03 (SCP03) over an I²C interface.
     12 - Offers pre-integrated libraries for Linux, simplifying integration with host systems.
     13
     14The package can be downloaded from NXP's website while derivatives for specific use cases are available github NXP plug-and-trust repository:
     15 * https://github.com/NXP/plug-and-trust - middleware mini package with minimum files requires to connect to SE05x using t1oi2c protocol
     16
     17References:
     18 * [https://www.nxp.com/products/SE052F SE052F Product Page]
     19 * [https://www.nxp.com/docs/en/application-note/AN14277.pdf AN14277 SE052 Configuration Details]
     20 * [https://www.nxp.com/docs/en/application-note/AN13013.pdf AN13013 Get started with EdgeLock SE05x support package]
     21
     22
     23== Hardware
     24The following Gateworks boards have a SE05x chip on-board:
     25||= Family =||= Board =||= Chip =||= bus/address =||= reset =||
     26|| Venice   || GW8201-C+ || SE052F || I2C2@0x48 || N/A ||
     27
     28
     29== Software
     30The SE05x family uses a T=1 over I2C (T1oI2C) protocol, not standard I2C register based communication. It encapsulates its communication in a higher-level protocol (ISO/IEC 7816-4 APDUs over I2C). For this reason Linux and U-Boot can detect the device as long as the I2C frame addressed to the device contains at least one byte of data but can not access registers over I2C:
     31 * U-Boot device detection:
     32{{{#!bash
     33u-boot=> i2c dev 1 && i2c probe 0x48
     34Setting bus to 1
     35Valid chip addresses: 48
     36}}}
     37  - the valid chip address above confirms SCL/SDA/VDD_3V3/GND are wired correctly and powered
     38
     39Because there is no U-Boot or Linux kernel driver there does not need to be any device-tree node for the device.
     40
     41Note the SE052F errata sheet notes a potential problem where an acknowledged I2C frame addressed to the device must contain at least one byte of data. If not the SE052F may enter an unresponsive state requiring a power cycle. In a shared bus scenario if other devices send incomplete or malformed frames they could trigger this.
     42
     43=== NXP Plug & Trust Middleware
     44The NXP Plug & Trust middleware communicates with the SE05x directly in userspace via the I2C device file (e.g., /dev/i2c-1). It uses the Linux I2C userspace interface (ioctl calls) to send T1oI2C APDUs, bypassing the need for a dedicated kernel driver. The middleware handles all protocol details, including authentication (e.g., SCP03) and command formatting. Because this is in userspace there is no dt entry needed as long as the I2C bus is enabled.
     45
     46There are multiple flavors of the NXP Plug & Trust Middleware below are very minimal examples of getting it up and running by building software on the target board itself.
     47
     48==== Full package (zip downloaded from NXP)
     49You can download the full package middleware by going to https://www.nxp.com/products/SE052F selecting 'Design Resources' then 'Software' then download '!EdgeLock SE05x Plug & Trust Middleware. (NXP account required).
     50
     51Notes:
     52 - example apps take a 'port' argument identifying the bus and address via <busdev>:<slaveaddr> (ie '/dev/i2c-1:0x48' for GW8201). Note that while the busdev is a Linux path that exists the ':0x48' will not exist in a device path)
     53 - the ssscli ssscli tool isnt' a standalone binary; its a python based CLI installed via setup.py after building the middleware libraries.
     54 - there are fairly detailed HTML docs within the docs directory
     55
     56Building:
     57{{{#!bash
     58# install pre-requisites
     59apt update && apt install -y build-essential git cmake python3 python3-pip python3-setuptools python3-wheel libssl-dev libusb-1.0-0-dev pkg-config unzip wget
     60
     61# unzip release package
     62unzip SE-PLUG-TRUST-MW_04.07.01.zip
     63cd simw-top
     64
     65# script uses hostname to determine system its running on, needs to be imx8 if building on imx8m target
     66hostname imx8
     67# create various cmake projects in ~/simw-top_build
     68python3 ./scripts/create_cmake_projects.py
     69# list example projects
     70ls ~/simw-top_build
     71# build imx_native_se050_t1oi2c
     72cd ~/simw-top_build/imx_native_se050_t1oi2c
     73# configure it (see ~/simw-top/doc/scripts/cmake_options.html)
     74cmake . \
     75-DPTMW_Applet=SE05X_C \
     76-DPTMW_SE05X_Ver=07_02 \
     77-DPTMW_HostCrypto=OPENSSL \
     78-DPTMW_Host=iMXLinux \
     79-DPTMW_HostOS=Linux \
     80
     81# build it
     82cmake --build . -j$(nproc)
     83# install it
     84make install
     85# update library cache
     86ldconfig /usr/local/lib/
     87# install ssscli python tool
     88cd ~/simw-top/pycli/src/
     89python3 setup.py develop
     90}}}
     91
     92The ssscli tool is a Python based tool to manipulate the SE050 Secure Element. See ~/simw-top/doc/cli-tool.html for details. It can be used to:
     93 - Insert Keys, Certficates
     94 - Generate Keys
     95 - Attach policies to objects
     96 - Control Cloud for CLI (To Be Done)
     97
     98Running some examples:
     99 * ssscli:
     100{{{#!bash
     101# ssscli --version
     102ssscli, version v04.07.01
     103}}}
     104 * se05x_GetInfo (show device configuration)
     105{{{#!bash
     106# se05x_GetInfo
     107App   :INFO :Running se05x_GetInfo /dev/i2c-1:0x48
     108App   :INFO :If you want to over-ride the selection, use ENV=EX_SSS_BOOT_SSS_PORT or pass in command line arguments.
     109App   :INFO :PlugAndTrust_v04.07.01_20250519
     110sss   :INFO :atr (Len=35)
     111      01 A0 00 00    03 96 04 03    E8 00 FE 02    0B 03 E8 00
     112      01 00 00 00    00 64 13 88    0A 00 65 53    45 30 35 31
     113      00 00 00
     114App   :WARN :#####################################################
     115App   :INFO :uid (Len=18)
     116      04 00 50 01    A4 D8 98 71    0E EC 5D 04    57 48 BA 98
     117      1E 90
     118App   :INFO :Running se05x_GetInfo
     119App   :INFO :If you want to over-ride the selection, use ENV=EX_SSS_BOOT_SSS_PORT or pass in command line arguments.
     120sss   :INFO :atr (Len=35)
     121      01 A0 00 00    03 96 04 03    E8 00 FE 02    0B 03 E8 00
     122      01 00 00 00    00 64 13 88    0A 00 65 53    45 30 35 31
     123      00 00 00
     124sss   :INFO :Newer version of Applet Found
     125sss   :INFO :Compiled for 0x70200. Got newer 0x70216
     126sss   :WARN :Communication channel is Plain.
     127sss   :WARN :!!!Not recommended for production use.!!!
     128App   :WARN :#####################################################
     129App   :INFO :Applet Major = 7
     130App   :INFO :Applet Minor = 2
     131App   :INFO :Applet patch = 22
     132App   :INFO :AppletConfig = 26F2
     133App   :INFO :With    ECDSA_ECDH_ECDHE
     134App   :INFO :WithOut EDDSA
     135App   :INFO :WithOut DH_MONT
     136App   :INFO :With    HMAC
     137App   :INFO :With    RSA_PLAIN
     138App   :INFO :With    RSA_CRT
     139App   :INFO :With    AES
     140App   :INFO :WithOut DES
     141App   :INFO :With    PBKDF
     142App   :INFO :With    TLS
     143App   :INFO :WithOut MIFARE
     144App   :INFO :With    I2CM
     145App   :INFO :Internal = FFFF
     146App   :WARN :#####################################################
     147App   :INFO :Tag value - proprietary data 0xFE = 0xFE
     148App   :INFO :Length of following data 0x45 = 0x4F
     149App   :INFO :Tag card identification data (Len=2)
     150      DF 28
     151App   :INFO :Length of card identification data = 0x4C
     152App   :INFO :Tag configuration ID (Must be 0x01) = 0x01
     153App   :INFO :Configuration ID (Len=12)
     154      00 05 B5 01    1B 7D B8 1B    89 99 D0 5D
     155App   :INFO :OEF ID (Len=2)
     156      B5 01
     157App   :INFO :Tag patch ID (Must be 0x02) = 0x02
     158App   :INFO :Patch ID (Len=8)
     159      00 00 00 00    00 00 00 00
     160App   :INFO :Tag platform build ID1 (Must be 0x03) = 0x03
     161App   :INFO :Platform build ID (Len=24)
     162      4A 33 52 36    30 30 30 33    37 33 31 38    31 32 30 30
     163      6D 20 B6 19    7D 63 5E 7C
     164App   :INFO :JCOP Platform ID = J3R6000373181200
     165App   :INFO :Tag FIPS mode (Must be 0x05) = 0x05
     166App   :INFO :FIPS mode var = 0x01
     167App   :INFO :Tag pre-perso state (Must be 0x07) = 0x07
     168App   :INFO :Bit mask of pre-perso state var = 0x00
     169App   :INFO :Tag ROM ID (Must be 0x08) = 0x08
     170App   :INFO :ROM ID (Len=8)
     171      B3 37 5F E9    B5 50 8B C4
     172App   :INFO :Tag JCOP OS Core ID (Must be 0x0A) = 0x0A
     173App   :INFO :JCOP OS Core (Len=8)
     174      55 60 6F D4    BE EC F3 CD
     175App   :INFO :Status Word (SW) (Len=2)
     176      90 00
     177App   :INFO :se05x_GetInfoPlainApplet Example Success !!!...
     178App   :WARN :#####################################################
     179App   :INFO :cplc_data.IC_fabricator (Len=2)
     180      47 90
     181App   :INFO :cplc_data.IC_type1 (Len=2)
     182      D6 00
     183App   :INFO :cplc_data.Operating_system_identifier (Len=2)
     184      47 00
     185App   :INFO :cplc_data.Operating_system_release_date (Len=2)
     186      00 00
     187App   :INFO :cplc_data.Operating_system_release_level (Len=2)
     188      00 00
     189App   :INFO :cplc_data.IC_fabrication_date (Len=2)
     190      42 44
     191App   :INFO :cplc_data.IC_Serial_number (Len=4)
     192      36 90 47 21
     193App   :INFO :cplc_data.IC_Batch_identifier (Len=2)
     194      11 91
     195App   :INFO :cplc_data.IC_module_fabricator (Len=2)
     196      00 00
     197App   :INFO :cplc_data.IC_module_packaging_date (Len=2)
     198      00 00
     199App   :INFO :cplc_data.ICC_manufacturer (Len=2)
     200      00 00
     201App   :INFO :cplc_data.IC_embedding_date (Len=2)
     202      00 00
     203App   :INFO :cplc_data.IC_OS_initializer (Len=2)
     204      17 57
     205App   :INFO :cplc_data.IC_OS_initialization_date (Len=2)
     206      48 36
     207App   :INFO :cplc_data.IC_OS_initialization_equipment (Len=4)
     208      39 30 34 37
     209App   :INFO :cplc_data.IC_personalizer (Len=2)
     210      00 00
     211App   :INFO :cplc_data.IC_personalization_date (Len=2)
     212      00 00
     213App   :INFO :cplc_data.IC_personalization_equipment_ID (Len=4)
     214      00 00 00 00
     215App   :INFO :cplc_data.SW (Len=2)
     216      90 00
     217App   :INFO :ex_sss Finished
     218}}}
     219 - The 'Newer version of Applet Found' 'Compiled for 0x70200. Got newer 0x70216' simply means that the middleware was built for an earlier version of the chip which is ok as the middleware is backward compatible. At the time of this writing the middleware does not have an option for PTMW_Applet=SE052F
     220 - The 'Communication channel is Plain' and '!!!Not recommended for production use.!!!' means that we are not using SCP03 which you should use for production use and must be enabled by building with '-DPTMW_SE05X_Auth=PlatfSCP03 -DPTMW_SCP=SCP03_SSS' and providing keys with  -DPTMW_SCP03KeyFile or EX_SSS_BOOT_SCP03_PATH env var)
     221
     222
     223==== Plug and Trust middleware mini package (github)
     224NXP provides derivatives of the full Plug & Trust middleware package for specific use cases via github. For development purposes still look at the full package as well as it contains large amounts of examples, tools and additional documentation.
     225
     226Example:
     227{{{#!bash
     228# install pre-requisites
     229apt update && apt install -y build-essential git cmake python3 python3-pip python3-setuptools python3-wheel libssl-dev libusb-1.0-0-dev pkg-config unzip wget
     230
     231# fetch code
     232git clone https://github.com/NXP/plug-and-trust
     233cd plug-and-trust
     234
     235# configure
     236cd ecc_example
     237mkdir build
     238cd build
     239cmake ..
     240
     241# build
     242cmake --build .
     243
     244# execute
     245./ex_ecc /dev/i2c-1:0x48
     246}}}
     247
     248Notes:
     249 * see https://github.com/NXP/plug-and-trust/blob/master/simwlib_cmake_options.cmake for cmake options
     250 * A reset GPIO is configured and toggled to reset the device which may be invalid for your hardware. See (hostlib/hostLib/platform/rsp/se05x_reset.c for reset configuration
     251 * The port/address
     252
     253=== Plug and Trust middleware nano package (github)
     254The Plug and Trust middleware nano package  is a minimalistic version of the Plug & Trust middleware optimized for constrained devices. It also provides an integration with Zephyr OS and an example of Qi 1.3 authentication
     255
     256Example:
     257 * build
     258{{{#!bash
     259# install pre-requisites
     260apt update && apt install -y build-essential git cmake python3 python3-pip python3-setuptools python3-wheel libssl-dev libusb-1.0-0-dev pkg-config unzip wget
     261
     262# fetch code
     263git clone https://github.com/NXPPlugNTrust/nano-package
     264cd nano-package
     265
     266# configure
     267cd examples/se05x_GetInfo/linux
     268mkdir build
     269cd build
     270cmake ../
     271
     272# build
     273make
     274}}}
     275 * execute
     276{{{#!bash
     277# ./ex_se05x_GetInfo
     278Se05x Getinfo Example !
     279Plug and Trust nano package - version: 1.5.4
     280I2C driver supports plain i2c-level commands.
     281#####################################################
     282Close i2c device 3.
     283Plug and Trust nano package - version: 1.5.4
     284I2C driver supports plain i2c-level commands.
     285#####################################################
     286Applet Major = 7
     287Applet Minor = 2
     288Applet patch = 22
     289AppletConfig = 26F2
     290With    ECDSA_ECDH_ECDHE
     291WithOut EDDSA
     292WithOut DH_MONT
     293With    HMAC
     294With    RSA_PLAIN
     295With    RSA_CRT
     296With    AES
     297WithOut DES
     298With    PBKDF
     299With    TLS
     300WithOut MIFARE
     301With    I2CM
     302#####################################################
     303Tag value - proprietary data 0xFE = 0xFE
     304Length of following data 0x45 = 0x4F
     305Length of card identification data = 0x4C
     306Tag configuration ID (Must be 0x01) = 0x01
     307OEF ID = 0xB5 0x01
     308Tag patch ID (Must be 0x02) = 0x02
     309Tag platform build ID1 (Must be 0x03) = 0x03
     310JCOP Platform ID = J3R6000373181200
     311Tag FIPS mode (Must be 0x05) = 0x05
     312FIPS mode var = 0x01
     313Tag pre-perso state (Must be 0x07) = 0x07
     314Bit mask of pre-perso state var = 0x00
     315Tag ROM ID (Must be 0x08) = 0x08
     316se05x_GetInfoPlainApplet Example Success !!!...
     317#####################################################
     318Close i2c device 3.
     319SE05x Getinfo Example Success !
     320}}}
     321
     322Notes
     323 - the bus path and address are hard coded in  lib/platform/linux/sm_i2c.c: SE05X_I2C_DEV_NAME, SE05X_I2C_DEV_ADDR
     324