Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MCU client #179

Merged
merged 57 commits into from
Aug 12, 2021
Merged

Add MCU client #179

merged 57 commits into from
Aug 12, 2021

Conversation

geky
Copy link
Member

@geky geky commented Jul 22, 2021

Note this is dependent on #75

Adds a MCU client and demo based on Zephyr OS. In order to test on Zephry OS, this uses a Docker image with the relevant build system, which makes things a bit complicated for both the build system and for networking.

To reproduce the demo you can follow the MCU_CLIENT_INSTRUCTIONS.markdown in the new veracruz-mcu-client directory.

Note that testing-wise, this is in the same state as #75. We can't easily add this into the CI until a CI friendly platform (Linux or IceCap) is merged. See #176 for more info.

Should resolve #41

TODO:

  • Move demo code into its own folder (veracruz-mcu-client/demo veracruz-mcu-client/example unless anyone else has a better idea)
  • Add recv_results/send_program
  • Add minimal tests covering send_data/recv_results/send_program
  • Check Zephyr for cryptographically secure rng
  • Add RAM/ROM measurements
  • License pass
  • More documentation (per popular demand)
  • Remove run_markdown.sh (per popular demand)

geky added 27 commits November 19, 2020 14:39
This will allow for other HTTP operations (POST, PUT, etc)
Still needs work:
- Fails on key exchange for some reason
- Still using *_VERIFY_NONE
- Required significant RAM and stack increases
…ttestation

Mostly just required some asn1 parsing to extract the extension field
from mbedtls's x509 structure
geky added 24 commits August 12, 2021 13:12
Note that there is a bit of necessary duplication due to docker limiting
access from the veracruz-mcu-client directory
…s own folder

This also now means the MCU Veracruz client is much better integrated
with Zephyr's build system, which should be helpful for integrating the
library into existing Zephyr projects.

This includes properly adding the various scripts into CMakeLists.txt,
hooking the various configuration options into Kconfig.vc, and providing
the necessary metadata to include the Veracruz library.

The demo has been moved to the "samples" directory, as is common in
Zephyr modules, with the Makefile still compiling the demo by default
(since most inclusions of the library will bypass the Makefile for
Zephyr's build system).
Sizes at the time of writing, note this includes the full Zephyr OS:

   code  static    heap   stack
 180531   43802   45012    8264

make run_with_memory_report also generates detailed reports thanks
to Zephyr's ram/rom reporting and Valgrind's Massif (heap/stack
measurement).

Note that this ends up measure ROM usage for thumb, and RAM for
native (usually x86). This is a convenient trick for easily finding
rough measurements since RAM does not change as much cross-platform.
Note that this isn't supported in the QEMU-based boards, so
we fall back to the pseudorandom RNG in those cases (with
compile-time warnings)
Before it has a beautiful mixture of hardcoded values and long command
strings passed on the command line, the new version is quite a bit
cleaner
This allows the logging to be disabled for a quieter stdout and smaller
code size footprint
… of maintaining a copy

I don't think there's a great solution to this, since of course symlinks
from Docker to the containing directory won't work. Not even a Docker
COPY works here because the relevant file is outside of the build
context.
Currently just based on some arbitrary, but hopefully interesting,
pattern matches.

Here are the results at the time of writing:

                code  static    heap   stack
base64           607       0       0       0
main             568       0       0       0
mbedtls        92700     104   22668       0
nanopb          6502       0       0       0
net            34476   21680       0       0
policy          2820       0       0       0
vc              1318     920    6144       0
zephyr         13004   18153    3890       0
misc            7921    2825    2468    7416
TOTAL         177491   43802   44928    7416
Due to base64 encoding, we need to have a 4/3x larger
CONFIG_VC_SEND_BUFFER than CONFIG_MBEDTLS_SSL_MAX_CONTENT_LEN.

Curious why this wasn't failing earlier, most like due to the size of
the binary changing due to upstream changes.
@geky
Copy link
Member Author

geky commented Aug 12, 2021

Rebased to pull in #192 and tested locally

@veracruz-project-owner
Copy link
Contributor

AWS CodeBuild CI Report

  • CodeBuild project: Veracruz
  • Commit ID: 61a11df
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

@dreemkiller dreemkiller merged commit c0ca927 into veracruz-project:main Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build-process Something related to the Veracruz build process client-code Something related to client code for interacting with Veracruz enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for MCU clients
5 participants