aboutsummaryrefslogtreecommitdiff
path: root/projects/hsm
AgeCommit message (Collapse)Author
2017-03-23Fix UART RX communication errors resulting in byte swapping.Fredrik Thulin
Sometimes, the Half-Transfer Complete and Transfer Complete events execute in the wrong order. This happens when both the TC and HT bits get set before HAL_DMA_IRQHandler() runs. Don't know what causes that, but this mitigates the problem with a separate read index for the uart_rx buffer.
2017-03-02Try to be a bit more robust in the face of normal errors.Paul Selkirk
If hal_rpc_server_dispatch() returns an XDR decode error because the request packet was too short, don't call Error_Handler() and kill the dispatch thread, just drop the request. Add more ibuf_queue entries, but don't panic and kill the dispatch thread if we can't get one, just drop the incoming character (which will lead to an XDR decode error if/when we finally get an ibuf).
2017-02-23Add --pin and --quiet options.Paul Selkirk
2017-02-23Speed up file upload enormously.Paul Selkirk
We need to start with a long serial timeout, in order to catch the reboot messages for a firmware upload (this has to be done through the bootloader). But once we start sending the file, cut the serial timeout to 1ms. (I've tested it down to 1us, but that may not work for everyone, and it doesn't improve performance in a statistically significant way.) This brings the time to upload a 4.5MB bitstream from 38:23 to 1:25.
2017-02-22Refactor flash code.Paul Selkirk
2017-02-21Use libcli return codes where appropriate; show whether PINs are set.Paul Selkirk
2017-02-21Use bulk erase in the one place it makes sense.Paul Selkirk
2017-02-02Add locking around keystore operations.Rob Austein
2016-12-23Don't wrap key number in "keystore show keys".Rob Austein
2016-12-21Rewrite core upload loop to simplify and fix race conditions.Rob Austein
The main loop in cryptech_upload:send_file() was much more complicated than necessary, and also contained some hidden assumptions about serial I/O timing which happened to fail on the first two machines I tested. We already had a perfectly good buffered-input function, so rewrote to use that, and simplified control structure in the process. In theory, the new code should work in any environment where the old one did, but this has not yet been confirmed.
2016-12-20Flush output to serial device after writing.Rob Austein
2016-12-20Merge branch 'master' into ksngRob Austein
Bootloader DFU fixes.
2016-12-20The bootloader upgrade reboots now, so we don't need to log out of the CLI.Paul Selkirk
2016-12-20Fix bootloader upload callback routine to write the correct number of bytes ↵Paul Selkirk
to flash. While we're at it, propagate error returns.
2016-12-20cli_receive_data: re-enable UART DMA before returning. Based on Fredrik's ↵Paul Selkirk
fix to cli-test, commit ae8ebce.
2016-12-19Merge branch 'master' into ksng.Rob Austein
Drag in UART-related changes from master.
2016-11-25Add debugging code to cryptech_upload.Rob Austein
2016-11-15Reinitialize keystore data structures after wiping keystore flash.Rob Austein
2016-11-14Track removal of hal_rpc_pkey_list().Rob Austein
2016-11-14hal_rpc_pkey_find() -> hal_rpc_pkey_open().Rob Austein
2016-11-01Tweak CLI keystore commands for latest libhal RPC keystore API.Rob Austein
Using {-1} as a client handle in the CLI is a kludge, but the new stricter libhal keystore code really wants us to be consistent about this, so as long as any part of the CLI is using client {-1}, it all needs to do so. This still isn't really right, the CLI probably needs a different set of access rules than those which apply to the RPC calls, but I'm deferring that until we know what the "final" (for this branch) version of the RPC API looks like, and have done whatever refactoring might be required in the libhal keystore drivers.
2016-10-09Track changes to libhal pkey API.Rob Austein
2016-10-07Track changes to libhal RPC pkey API.Rob Austein
2016-09-27"keystore erase" now clears entire keystore flash.Rob Austein
Now that we're using more than just the first few sectors of the keystore flash, we need a command to clear the whole thing. This is not quite right yet, because it doesn't yet notify libhal's ks_flash driver that the entire content of the flash has been yanked out from under it. In theory, we should be able to erase the entire flash in a single operation using the bulk erase command command (0xC7), but I couldn't get that to do anything (no error reported, no visible effect), so, for now, we erase by sectors.
2016-09-23Use subsectors instead of sectors in keystore.Rob Austein
2016-09-20Still some problem with uart receive under heavy load, so change to a 2-byte ↵Paul Selkirk
receive buffer with half-complete callbacks, and raise the dma priority.
2016-09-16Revised ks_flash. Compiles, not yet tested.Rob Austein
2016-09-13Track libhal cleanup (function names, const-ification).Rob Austein
2016-09-09Track removal of `type` argument from hal_rpc_pkey_find().Rob Austein
2016-09-02Whack with club until working with new keystore API.Rob Austein
Basic stuff like "keystore show keys", "keystore delete key", and the PIN commands all work with the new keystore code. Some of the management commands are still broken. Some of the old management commands were using libhal-internal APIs for which no real equivalent exists anymore. Some of the old management commands were doing things that, um, never could have worked as written.
2016-08-23Show running threads.Paul Selkirk
2016-08-23Reset table of cores after resetting FPGA from CLI.Paul Selkirk
2016-08-23Multi-client testing revealed race conditions in uart receive codePaul Selkirk
(dropped characters, improper handoff of message buffers). Fixed by a) changing the uart receiver from interrupt to DMA mode, and b) replacing the dispatch mutex and rpc semaphore with a mail queue (memory pool + message queue).
2016-08-11Multiple threads and multiple cores, to deal with multiple clients.Paul Selkirk
2016-07-21Use a fresh port of libcli, which retains more of the original API.Paul Selkirk
2016-07-16Don't run empty "export" command.Rob Austein
2016-07-13'masterkey set' without args sets master key to a random valuePaul Selkirk
2016-07-13probe_cores() finally does the right thing, so we don't have to call it early.Paul Selkirk
2016-07-12Make username a command-line option, default "so" as it used to be.Rob Austein
2016-07-12Allow wheel to upload firmware/bitstreamsPaul Selkirk
2016-07-12Re-disable 'keystore set key'; hexdump binary key names; remove unused ↵Paul Selkirk
'show' commands.
2016-07-12Restore 'keystore set|rename|delete' commands; access key by index as well ↵Paul Selkirk
as name.
2016-07-09Clean up the CLI.Fredrik Thulin
A lot of the commands were just useful when testing/implementing features for the Alpha. Remove them now that they have been merged to projects/cli-test.
2016-07-08Add upload from firmware tarball, gussie up command parser, add dire warnings.Rob Austein
Command parser now enforces little things like mutually-exclusive required options so we warn users who attempt something silly. Preferred source for uploads is now the firmware tarball installed along with the client software; we still support uploading from an explictly-specified source file, but one must now say "-i file". Updating the bootloader is dangerous, we now say so and also require an additional option before we'll even attempt it. For the record, while testing this I did manage to brick my Alpha and had to use an ST-LINK to recover, exactly as predicted by the new dire warning.
2016-07-07Merge branch 'master' of https://git.cryptech.is/sw/stm32.git.Rob Austein
2016-07-07Add cryptech_miniterm; tweak cryptech_probe to write environment variables ↵Rob Austein
like ssh-agent.
2016-07-07Drop bad request packets.Paul Selkirk
Also, if the UART receive callback fails to re-enable receive (because dispatch_thread is in the middle of transmitting a response), signal dispatch_thread to re-enable receive after it's done.
2016-07-07Default to one RPC worker thread.Paul Selkirk
2016-07-07Rewrite and add cleanup sequences to avoid confusing the RPC server.Rob Austein
2016-07-06Add uart_set_default() to make debugging output easier.Paul Selkirk