2023-02-06 09:11:22 +01:00
|
|
|
|
[](https://github.com/tillitis/tillitis-key1/actions/workflows/ci.yaml)
|
|
|
|
|
|
2022-12-02 07:17:14 +01:00
|
|
|
|
# Tillitis TKey
|
2022-09-19 08:51:11 +02:00
|
|
|
|
|
2025-03-07 15:24:27 +01:00
|
|
|
|
Read about current work in progress
|
|
|
|
|
[here](#current-work-in-progress-in-this-repository).
|
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
 *The TK1 PCB, also known as
|
|
|
|
|
TKey.*
|
|
|
|
|
|
2022-09-19 08:51:11 +02:00
|
|
|
|
## Introduction
|
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
The Tillitis TKey is an open source, open hardware FPGA-based USB
|
|
|
|
|
security token using
|
|
|
|
|
[DICE-like](https://trustedcomputinggroup.org/work-groups/dice-architectures/)
|
|
|
|
|
unconditional measured boot that can run generic applications while
|
|
|
|
|
still guaranteeing the security of its cryptographic assets.
|
2022-11-21 15:35:43 +01:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
[TKey Threat Model](doc/threat_model/threat_model.md).
|
2022-11-21 15:35:43 +01:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
With the right application, the TKey can be used for:
|
2022-11-21 15:35:43 +01:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
- authentication,
|
|
|
|
|
- cryptographic signing,
|
|
|
|
|
- encryption,
|
|
|
|
|
- root of trust,
|
|
|
|
|
- and more: it's a general computer!
|
2022-11-21 15:35:43 +01:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
If you want to know more about Tillitis and the TKey, visit:
|
2022-11-21 15:35:43 +01:00
|
|
|
|
|
2025-03-07 15:24:27 +01:00
|
|
|
|
- Main web: <https://tillitis.se/>
|
|
|
|
|
- Shop: <https://shop.tillitis.se/>
|
|
|
|
|
- Developer Handbook: <https://dev.tillitis.se/>
|
|
|
|
|
- Officially supported apps: <https://tillitis.se/download/>
|
|
|
|
|
- Other known apps: <https://dev.tillitis.se/projects/>
|
2022-09-19 08:51:11 +02:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
All of the TKey software, firmware, FPGA Verilog code, schematics and
|
|
|
|
|
PCB design files are open source, just like all trustworthy security
|
|
|
|
|
software and hardware should be.
|
2022-11-22 15:05:43 +01:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
## Licensing
|
2022-09-19 08:51:11 +02:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
See [LICENSES](./LICENSES/README.md) for more information about
|
|
|
|
|
the projects' licenses.
|
2022-09-19 08:51:11 +02:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
## Repositories
|
2022-11-30 11:11:13 +01:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
This repository contains the FPGA design, the source of the
|
|
|
|
|
firmware/bootloader, and the source of the USB controller firmware.
|
2024-03-15 15:04:57 +01:00
|
|
|
|
|
2024-07-01 17:01:40 +02:00
|
|
|
|
Specific documentation regarding implementation is kept close to the
|
|
|
|
|
code/design in README files, typically in the same directory.
|
2024-03-15 15:04:57 +01:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
Note that development is ongoing. To avoid unexpected changes of
|
|
|
|
|
derived key material, please use a tagged release. Read the [Release
|
|
|
|
|
Notes](doc/release_notes.md) to keep up to date with changes and new
|
|
|
|
|
releases.
|
2024-09-20 10:59:11 +02:00
|
|
|
|
|
|
|
|
|
The TKey PCB [KiCad](https://www.kicad.org/) design files are kept in
|
|
|
|
|
a separate repository:
|
|
|
|
|
|
2025-03-07 15:24:27 +01:00
|
|
|
|
<https://github.com/tillitis/tk1-pcba>
|
2024-09-20 10:59:11 +02:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
The TP1 (TKey programmer 1) PCB design files and the firmware sources
|
|
|
|
|
are kept in:
|
2024-09-20 10:59:11 +02:00
|
|
|
|
|
2025-03-07 15:24:27 +01:00
|
|
|
|
<https://github.com/tillitis/tp1>
|
2024-09-20 10:59:11 +02:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
Note that the TP1 is only used for provisioning the FPGA bitstream
|
|
|
|
|
into flash or the FPGA configuration memory. It's not necessary if you
|
|
|
|
|
just want to develop apps for the TKey.
|
2022-11-30 11:11:13 +01:00
|
|
|
|
|
2025-03-11 13:16:56 +01:00
|
|
|
|
We use the tkey-libs libraries used for device app development in the
|
|
|
|
|
firmware, too:
|
|
|
|
|
|
|
|
|
|
https://github.com/tillitis/tkey-libs
|
|
|
|
|
|
|
|
|
|
but keep our own copy of it in the repo. See below.
|
|
|
|
|
|
2025-03-11 15:18:14 +01:00
|
|
|
|
## Building
|
|
|
|
|
|
|
|
|
|
Building is probably easiest using make and Podman. Do this to see all
|
|
|
|
|
targets:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
cd contrib
|
|
|
|
|
make
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Build the entire FPGA bitstream, which includes the firmware, using
|
|
|
|
|
Podman:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
cd contrib
|
|
|
|
|
make run-make
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
See the [Tillitis Developer Handbook](https://dev.tillitis.se) for
|
|
|
|
|
more.
|
|
|
|
|
|
2025-03-11 13:16:56 +01:00
|
|
|
|
## Updating and working with tkey-libs
|
|
|
|
|
|
|
|
|
|
A copy of [tkey-libs](https://github.com/tillitis/tkey-libs) is kept
|
|
|
|
|
in `hw/application_fpga/tkey-libs`. This is mostly to avoid the
|
|
|
|
|
subtleties of Git submodules.
|
|
|
|
|
|
|
|
|
|
If you want to change something in tkey-libs, always change in the
|
|
|
|
|
upstream library at:
|
|
|
|
|
|
|
|
|
|
https://github.com/tillitis/tkey-libs
|
|
|
|
|
|
|
|
|
|
You can build with an out-of-tree copy if you set `LIBDIR`, for
|
|
|
|
|
example:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
make LIBDIR=~/git/tkey-libs firmware.elf
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
When it's time to update the in-tree tkey-lib first tag the upstream
|
|
|
|
|
repo with an `fw` prefix, like `fw-1` even if it already has an
|
|
|
|
|
official version tag.
|
|
|
|
|
|
|
|
|
|
Easiest is probably to just remove the tkey-libs directory and then
|
|
|
|
|
git clone the desired tag. Use the entire repo, but remove the .-files
|
|
|
|
|
like `.git`, `.github`, et cetera.
|
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
## Measured boot
|
2024-03-15 15:04:57 +01:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
The key behind guaranteeing security even as a general computer is the
|
|
|
|
|
unconditional measured boot. This means that we have a small,
|
|
|
|
|
unchangeable, trusted firmware in ROM that creates a unique identity
|
|
|
|
|
before starting the application. This identity is used as a seed for
|
|
|
|
|
all later cryptographic keys.
|
2022-10-04 11:07:44 +02:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
We call this identity the Compound Device Identity (CDI). The CDI is a
|
|
|
|
|
cryptographic mix of:
|
2022-09-19 08:51:11 +02:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
1. the Unique Device Secret (UDS), a hardware secret, unique per
|
|
|
|
|
device, something the user *has*,
|
|
|
|
|
2. the hash digest of the TKey device application that has been
|
|
|
|
|
loaded, the *integrity* of the application, and,
|
|
|
|
|
3. an optional User Supplied Secret (USS), something the user *knows*.
|
2024-09-20 10:59:11 +02:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
CDI is computed using the BLAKE2s hash function:
|
2022-11-22 15:05:43 +01:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
CDI = BLAKE2s(UDS, BLAKE2s(application loaded in RAM), USS)
|
2024-03-15 15:04:57 +01:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
When firmware is about to start the device application it changes the
|
|
|
|
|
TKey to a less permissive hardware mode, application mode. In
|
|
|
|
|
application mode the UDS and the User Supplied Secret are no longer
|
|
|
|
|
available, but the device application can use the CDI as a seed to
|
|
|
|
|
deterministically generate any cryptographic keys it needs.
|
2022-09-19 08:51:11 +02:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
- If the wrong application has been loaded, or the original
|
|
|
|
|
application has been tampered with, the generated keys will be
|
|
|
|
|
different.
|
|
|
|
|
- If the USS is not the same, the generated keys will be different.
|
|
|
|
|
- If the same USS and device application is used on a different TKey,
|
|
|
|
|
the generated keys will be different.
|
2022-11-21 13:47:42 +01:00
|
|
|
|
|
2024-10-17 16:27:02 +02:00
|
|
|
|
The TKey unconditional measured boot is inspired by, but not exactly
|
|
|
|
|
the same as part of [TCG
|
|
|
|
|
DICE](https://trustedcomputinggroup.org/work-groups/dice-architectures/).
|
2025-03-07 15:24:27 +01:00
|
|
|
|
|
|
|
|
|
# Current Work in Progress in this repository
|
|
|
|
|
|
|
|
|
|
We are updating the FPGA and firmware on TKey as part of the Castor
|
|
|
|
|
release. This update will simplify TKey’s usage, laying the groundwork
|
|
|
|
|
for future support of U2F/FIDO authentication.
|
|
|
|
|
|
|
|
|
|
You can track our progress through this
|
|
|
|
|
[milestone](https://github.com/tillitis/tillitis-key1/milestone/1).
|
|
|
|
|
|
|
|
|
|
Note that main branch is in development. We try to keep status of main
|
|
|
|
|
branch updated in the [release notes](/doc/release_notes.md#upcoming-release-castor).
|