Skip to content

peterzuger/hydrogen-micropython

Repository files navigation

hydrogen-micropython

Table of Contents

About

Very recently libhydrogen was added to micropython for providing encrypted and signed firmware upgrades.

See: this-pull-request

This C-Module is intended to lift the C functionality in libhydrogen to be usable from micropython.

Currently key-generation and signing and verifying signatures is supported.

Getting Started

Prerequisites

This is designed for micropython.

git clone --recurse-submodules https://github.com/micropython/micropython.git

to compile the project, make, gcc and arm-none-eabi-gcc is required, install them from your package manager

Installing

hydrogen-micropython will work on the stm32 and the unix port.

First create a modules folder next to your copy of micropython.

project/
├── modules/
│   └──hydrogen-micropython/
│       ├──...
│       └──micropython.mk
└── micropython/
    ├──ports/
   ... ├──stm32/
      ...

And now put this project in the modules folder.

cd modules
git clone https://gitlab.com/peterzuger/hydrogen-micropython.git

Now that all required changes are made, it is time to build micropython, for this cd to the top level directory of micropython. From here, first the mpy-cross compiler has to be built:

make -C mpy-cross

once this is built, compile your port with:

make -C ports/your port name here/ USER_C_MODULES=../modules CFLAGS_EXTRA=-DMODULE_HYDROGEN_ENABLED=1

and you are ready to use hydrogen.

Usage

The module is available by just importing hydrogen:

import hydrogen

The module documentation is available soon.

Documentation

coming soon