Crate rustkey

Source

Modules§

cpumonitor
cpumonitor module provides access to the CPU execution monitor.
frame
frame module contains logic for constructing frames (header and payload) according to the specified protocol.
gpio
gpio provides only the constants for addressing the appropriate memory region. The GPIO pins are not exposed in the ready-sold TKeys, so they are only of benefit for the unlocked versions.
io
io module contains basic input/output operations.
led
led module controls the LED on the TKey.
timer
timer module provides access to the device’s countdown-timer.
touch
touch represents the touch-sensor of the TKey.
trng
trng is the module for the true-RNG. Note that this RNG is not guaranteed cryptographically- secure and it is recommended to mix the entropy from the TRNG with cryptographically-suitable mechanisms.

Enums§

Error

Constants§

APP_MAX_SIZE
The maximum possible size of an application, i.e. the size of available RAM.
RAM_BASE
RAM_SIZE
ROM_BASE
ROM_SIZE
ROM_SIZE is not specified in tk1 memory model. Instead, this is the maximum allowed size that is made available in EBR (Embedded Block RAM) in the verilog model. See hw/application_fpg/core/rom/rtl/rom.v in the tillitis-key1 repository containing the hardware, fpga and firmware content.
TK1_APP_ADDR
TK1_APP_ADDR the address to the start of the application loaded into TKey.
TK1_APP_SIZE
TK1_APP_SIZE the size of the application loaded into TKey.
TK1_BLAKE2S_ADDR
TK1_BLAKE2S_ADDR provides the address to the blake2s function in TKey firmware.
TK1_CDI
TK1_CDI provides access to the (application-specific) CDI value. (32 bytes, contiguous)
TK1_CPU_FREQUENCY
TK1_NAME0
TK1_NAME0 is the address for the first 4-byte app-name.
TK1_NAME1
TK1_NAME1 is the address for the second 4-byte app-name.
TK1_SWITCH_APP
TK1_VERSION
TK1_VERSION is the address for the app version.

Functions§

abort
abort enters infinite loop, effectively aborting execution, with blinking red LED. It uses 400,000 cycles for sleeps, therefore flashes at about twice as rapid as CPU halt on illegal instruction.
blake2s
blake2s performs a Blake2s hash calculation with immediate result.
done
done enters an infinite loop, effectively halting execution.
hash_firmware_rom
EXPERIMENTAL! hash_firmware_rom computes the Blake2s hash-value of the TKey firmware in ROM. The ROM is monitored for execution once the program-binary is loaded to prevent malicious activity, but it is still readable. A checksum of the firmware may be useful to determine what exact firmware is running on the device. Especially if (minor) changes are made to the (memory-mapped) API.
random
random produces (reasonably) cryptographically-secure (needs to be verified/proved) random bytes, using the TRNG, Blake2s and optionally seed data. If strong randomness is needed from very first use, it is recommended to contribute some seed-entropy to get the buffer mixed up faster.
read_cdi
read_cdi reads the compound device identifier (CDI).
read_name_version
read_name_version reads the name addresses and the version address.
sleep
sleep for specified number of cycles (delay by virtue of volatile writes).