commit | ee7f6a6b4ae809f1a9c1d21a1f5f384f822dad93 | [log] [tgz] |
---|---|---|
author | Will Drewry <wad@google.com> | Tue Jul 25 13:33:55 2017 -0500 |
committer | Will Drewry <drewry@google.com> | Thu Jul 27 12:50:37 2017 -0500 |
tree | fac12a917805ac58122e88b61e722b392ea5aa84 | |
parent | 95d41031376091648f8bfb925865e0061231e2e3 [diff] |
libese-teq1: global resync maximum Set a global maximum for software resyncs before powering the device on and off. This also implies a global maximum of attempts as only one physical reset is allowed prior to a hard reset. (Note, this pulls in the fake hw hack from libese-boot-app which should be migrated to libese-cpp in the future as libese-boot is likely to go away.) Bug: 63546784 Test: boots; normal functions work; teq1_unittests with the error case passes. Merged-In: I403bd90875c08372f043d765497640c216592216 Change-Id: I394b7be729bc714d7b19c2ce9af556c8be251f68
Document last updated: 13 Jan 2017
libese provides a minimal transport wrapper for communicating with embedded secure elements. Embedded secure elements typically adhere to smart card standards whose translation is not always smooth when migrated to an always connected bus, like SPI. The interfaces exposed by libese should enable higher level "terminal" implementations to be written on top and/or a service which provides a similar interface.
Behind the interface, libese should help smooth over the differences between eSEs and smart cards use in the hardware adapter implementations. Additionally, a T=1 implementation is supplied, as it appears to be the most common wire transport for these chips.
Public client interface for Embedded Secure Elements.
Prior to use in a file, import all necessary variables with:
ESE_INCLUDE_HW(SOME_HAL_IMPL);
Instantiate in a function with:
ESE_DECLARE(my_ese, SOME_HAL_IMPL);
or
struct EseInterface my_ese = ESE_INITIALIZER(SOME_HAL_IMPL);
or
struct EseInterface *my_ese = malloc(sizeof(struct EseInterface)); ... ese_init(my_ese, SOME_HAL_IMPL);
To initialize the hardware abstraction, call:
ese_open(my_ese);
To release any claimed resources, call
ese_close(my_ese)
when interface use is complete.
To perform a transmit-receive cycle, call
ese_transceive(my_ese, ...);
with a filled transmit buffer with total data length and an empty receive buffer and a maximum fill length. A negative return value indicates an error and a hardware specific code and string may be collected with calls to
ese_error_code(my_ese); ese_error_message(my_ese);
The EseInterface is not safe for concurrent access. (Patches welcome! ;).
libese is broken into multiple pieces:
libese provides the headers and wrappers for writing libese clients and for implementing hardware backends. It depends on a backend being provided as per libese-hw and on libese-sysdeps.
libese-sysdeps provides the system level libraries that are needed by libese provided software. If libese is being ported to a new environment, like a bootloader or non-Linux OS, this library may need to be replaced. (Also take a look at libese/include/ese/log.h for the macro definitions that may be needed.)
libese-hw provides existing libese hardware backends.
libese-teq1 provides a T=1 compatible transcieve function that may be used by a hardware backend. It comes with some prequisites for use, such as a specifically structured set of error messages and EseInteface pad usage, but otherwise it does not depends on any specific functionality not abstracted via the libese EseOperations structure.
There are two test backends, fake and echo, as well as one real backend for the NXP PN80T/PN81A.
The NXP backends support both a direct kernel driver and a Linux SPIdev interface.