GitHub C Trending

The latest build: 2024-06-14Source of data: GitHubTrendingRSS

hekate - A GUI based Nintendo Switch Bootloader

hekate - Nyx

Image of Hekate

Custom Graphical Nintendo Switch bootloader, firmware patcher, tools, and many more.


  • Fully Configurable and Graphical with Touchscreen and Joycon input support
  • Launcher Style, Background and Color Themes
  • HOS (Switch OS) Bootloader -- For CFW Sys/Emu, OFW Sys and Stock Sys
  • Android & Linux Bootloader
  • Payload Launcher
  • eMMC/emuMMC Backup/Restore Tools
  • SD Card Partition Manager -- Prepares and formats SD Card for any combo of HOS (Sys/emuMMC), Android and Linux
  • emuMMC Creation & Manager -- Can also migrate and fix existing emuMMC
  • Switch Android & Linux flasher
  • USB Mass Storage (UMS) for SD/eMMC/emuMMC -- Converts Switch into a SD Card Reader
  • USB Gamepad -- Converts Switch with Joycon into a USB HID Gamepad
  • Hardware and Peripherals info (SoC, Fuses, RAM, Display, Touch, eMMC, SD, Battery, PSU, Charger)
  • Many other tools like Archive Bit Fixer, Touch Calibration, SD/eMMC Benchmark, AutoRCM enabler and more

Bootloader folders and files

bootloaderMain folder.
|__ bootlogo.bmpIt is used if no logopath key is found. User provided. Can be skipped.
|__ hekate_ipl.iniMain bootloader configuration and boot entries in Launch menu.
|__ nyx.iniNyx GUI configuration
|__ patches.iniAdd external patches. Can be skipped. A template can be found here
|__ update.binIf newer, it is loaded at boot. Normally for modchips. Auto updated and created at first boot.
bootloader/ini/For individual inis. More configs menu. Autoboot is supported.
bootloader/res/Nyx user resources. Icons and more.
|__ background.bmpNyx - Custom background. User provided.
|__ icon_switch.bmpNyx - Default icon for CFWs.
|__ icon_payload.bmpNyx - Default icon for Payloads.
bootloader/sys/hekate and Nyx system modules folder.
|__ emummc.kipmemuMMC KIP1 module. !Important!
|__ libsys_lp0.bsoLP0 (sleep mode) module. Important!
|__ libsys_minerva.bsoMinerva Training Cell. Used for DRAM Frequency training. !Important!
|__ nyx.binNyx - hekate's GUI. !Important!
|__ res.pakNyx resources package. !Important!
|__ thk.binAtmosphère Tsec Hovi Keygen. !Important!
bootloader/screenshots/Folder where Nyx screenshots are saved
bootloader/payloads/For the Payloads menu. All CFW bootloaders, tools, Linux payloads are supported. Autoboot only supported by including them into an ini.

Bootloader configuration

The bootloader can be configured via 'bootloader/hekate_ipl.ini' (if it is present on the SD card). Each ini section represents a boot entry, except for the special section 'config' that controls the global configuration.

There are four possible type of entries. "[ ]": Boot entry, "{ }": Caption, "#": Comment, "newline": .ini cosmetic newline.

You can find a template Here

hekate Global Configuration keys/values (when entry is [config]):

Config optionDescription
autoboot=00: Disable, #: Boot entry number to auto boot.
autoboot_list=00: Read autoboot boot entry from hekate_ipl.ini, 1: Read from ini folder (ini files are ASCII ordered).
bootwait=30: Disable (It also disables bootlogo. Having VOL- pressed since injection goes to menu.), #: Time to wait for VOL- to enter menu. Max: 20s.
noticker=00: Animated line is drawn during custom bootlogo, signifying time left to skip to menu. 1: Disable.
autohosoff=10: Disable, 1: If woke up from HOS via an RTC alarm, shows logo, then powers off completely, 2: No logo, immediately powers off.
autonogc=10: Disable, 1: Automatically applies nogc patch if unburnt fuses found and a >= 4.0.0 HOS is booted.
bootprotect=00: Disable, 1: Protect bootloader folder from being corrupted by disallowing reading or editing in HOS.
updater2p=00: Disable, 1: Force updates (if needed) the reboot2payload binary to be hekate.
backlight=100Screen backlight level. 0-255.

Boot entry key/value combinations:

Config optionDescription
warmboot={FILE path}Replaces the warmboot binary
secmon={FILE path}Replaces the security monitor binary
kernel={FILE path}Replaces the kernel binary
kip1={FILE path}Replaces/Adds kernel initial process. Multiple can be set.
kip1={FOLDER path}/*Loads every .kip/.kip1 inside a folder. Compatible with single kip1 keys.
fss0={FILE path}Takes an Atmosphere package3 binary (formerly fusee-secondary.bin) and extracts all needed parts from it. kips, exosphere, warmboot and mesophere if enabled.
fss0experimental=1Enables loading of experimental content from a FSS0 storage
exofatal={FILE path}Replaces the exosphere fatal binary for Mariko
kip1patch=patchnameEnables a kip1 patch. Specify with multiple lines and/or in one line with , as separator. If actual patch is not found, a warning will show up
emupath={FOLDER path}Forces emuMMC to use the selected one. (=emuMMC/RAW1, =emuMMC/SD00, etc). emuMMC must be created by hekate because it uses the raw_based/file_based files.
emummcforce=1Forces the use of emuMMC. If emummc.ini is disabled or not found, then it causes an error.
emummc_force_disable=1Disables emuMMC, if it's enabled.
stock=1Disables unneeded kernel patching and CFW kips when running stock or semi-stock. If emuMMC is enabled, emummc_force_disable=1 is required. emuMMC is not supported on stock. If additional KIPs are needed other than OFW's, you can define them with kip1 key. No kip should be used that relies on Atmosphère patching, because it will hang. If NOGC is needed, use kip1patch=nogc.
fullsvcperm=1Disables SVC verification (full services permission). Doesn't work with Mesosphere as kernel.
debugmode=1Enables Debug mode. Obsolete when used with exosphere as secmon.
atmosphere=1Enables Atmosphère patching. Not needed when fss0 is used.
payload={FILE path}Payload launching. Tools, Android/Linux, CFW bootloaders, etc. Any key above when used with that, doesn't get into account.
l4t=1L4T Linux/Android native launching.
boot_prefixes={FOLDER path}L4T bootstack directory.
ram_oc=0L4T RAM Overclocking. Check README_CONFIG.txt for more info.
ram_oc_vdd2=1100L4T RAM VDD2 Voltage. Set VDD2 (T210B01) or VDD2/VDDQ (T210) voltage. 1050-1175.
ram_oc_vddq=600L4T RAM VDDQ Voltage. Set VDDQ (T210B01). 550-650.
uart_port=0Enables logging on serial port for L4T uboot/kernel.
Additional keysEach distro supports more keys. Check README_CONFIG.txt for more info.
bootwait=3Overrides global bootwait from [config].
id=IDNAMEIdentifies boot entry for forced boot via id. Max 7 chars.
logopath={FILE path}If it exists, it will load the specified bitmap. Otherwise bootloader/bootlogo.bmp will be used if exists
icon={FILE path}Force Nyx to use the icon defined here. If this is not found, it will check for a bmp named as the boot entry ([Test 2] -> bootloader/res/Test 2.bmp). Otherwise defaults will be used.

Note1: When using the wildcard (/*) with kip1 you can still use the normal kip1 after that to load extra single kips.

Note2: When using FSS0 it parses exosphere, warmboot and all core kips. You can override the first 2 by using secmon/warmboot after defining fss0. You can define kip1 to load an extra kip or many via the wildcard (/*) usage.

Warning: Careful when you define fss0 core kips when using fss0 or the folder (when using /*) includes them. This is in case the kips are incompatible between them. If compatible, you can override fss0 kips with no issues (useful for testing with intermediate kip changes). In such cases, the kip1 line must be under fss0 line.

Boot entry key/value combinations for Exosphère:

Config optionDescription
nouserexceptions=1Disables usermode exception handlers when paired with Exosphère.
userpmu=1Enables user access to PMU when paired with Exosphère.
cal0blank=1Overrides Exosphère config blank_prodinfo_{sys/emu}mmc. If that key doesn't exist, exosphere.ini will be used.
cal0writesys=1Overrides Exosphère config allow_writing_to_cal_sysmmc. If that key doesn't exist, exosphere.ini will be used.
usb3force=1Overrides system settings mitm config usb30_force_enabled. If that key doesn't exist, system_settings.ini will be used.

Note: cal0blank, cal0writesys, usb3force, as stated override the exosphere.ini or system_settings.ini. 0: Disable, 1: Enable, Key Missing: Use original value.

Note2: blank_prodinfo_{sys/emu}mmc, allow_writing_to_cal_sysmmc and usb30_force_enabled in exosphere.ini and system_settings.ini respectively, are the only atmosphere config keys that can affect hekate booting configuration externally, if the equivalent keys in hekate config are missing.

Payload storage:

hekate has a boot storage in the binary that helps it configure it outside of BPMP enviroment:

Offset / NameDescription
'0x94' boot_cfgbit0: Force AutoBoot, bit1: Show launch log, bit2: Boot from ID, bit3: Boot to emuMMC.
'0x95' autobootIf Force AutoBoot, 0: Force go to menu, else boot that entry.
'0x96' autoboot_listIf Force AutoBoot and autoboot then it boots from ini folder.
'0x97' extra_cfgWhen menu is forced: bit5: Run UMS.
'0x98' xt_str[128]Depends on the set cfg bits.
'0x98' ums[1]When Run UMS is set, it will launch the selected UMS. 0: SD, 1: eMMC BOOT0, 2: eMMC BOOT1, 3: eMMC GPP, 4: emuMMC BOOT0, 5: emuMMC BOOT1, 6: emuMMC GPP,
'0x98' id[8]When Boot from ID is set, it will search all inis automatically and find the boot entry with that id and boot it. Must be NULL terminated.
'0xA0' emummc_path[120]When Boot to emuMMC is set, it will override the current emuMMC (boot entry or emummc.ini). Must be NULL terminated.

Nyx Configuration keys/values (nyx.ini):

Config optionDescription
themebg=2d2d2dSets Nyx background color in HEX. EXPERIMENTAL.
themecolor=167Sets Nyx color of text highlights.
entries5col=01: Sets Launch entry columns from 4 to 5 per line. For a total of 10 entries.
timeoff=100Sets time offset in HEX. Must be in HOS epoch format
homescreen=0Sets home screen. 0: Home menu, 1: All configs (merges Launch and More configs), 2: Launch, 3: More Configs.
verification=10: Disable Backup/Restore verification, 1: Sparse (block based, fast and mostly reliable), 2: Full (sha256 based, slow and 100% reliable).
------------------------- The following options can only be edited in nyx.ini -------
umsemmcrw=01: eMMC/emuMMC UMS will be mounted as writable by default.
jcdisable=01: Disables Joycon driver completely.
jcforceright=01: Forces right joycon to be used as main mouse control.
bpmpclock=10: Auto, 1: Fastest, 2: Faster, 3: Fast. Use 2 or 3 if Nyx hangs or some functions like UMS/Backup Verification fail.
hekate (c) 2018, naehrwert, st4rk. (c) 2018-2024, CTCaer.Nyx GUI (c) 2019-2024, CTCaer.Thanks to: derrek, nedwill, plutoo, shuffle2, smea, thexyz, yellows8.Greetings to: fincs, hexkyz, SciresM, Shiny Quagsire, WinterMute.Open source and free packages used: - Littlev Graphics Library, Copyright (c) 2016-2018 Gabor Kiss-Vamosi - FatFs R0.13c, Copyright (c) 2006-2018, ChaN Copyright (c) 2018-2022, CTCaer - bcl-1.2.0, Copyright (c) 2003-2006, Marcus Geelnard - blz, Copyright (c) 2018, SciresM - elfload, Copyright (c) 2014 Owen Shepherd, Copyright (c) 2018 M4xw ___ .-' `'. / \ | ; | | ___.--, _.._ |0) = (0) | _.---'`__.-( (_. __.--'`_.. '.__.\ '--. \_.-' ,.--'` `""` ( ,.--'` ',__ /./; ;, '.__.'` __ _`) ) .---.__.' / | |\ \__..--"" """--.,_ `---' .'.''-._.-'`_./ /\ '. \ _.--''````'''--._`-.__.' | | .' _.-' | | \ \ '. `----` \ \/ .' \ \ '. '-._) \/ / \ \ `=.__`'-. / /\ `) ) / / `"".`\ , _.-'.'\ \ / / ( ( / / `--'` ) ) .-'.' '.'. | ( (/` ( (` ) ) '-; [switchbrew]

nRF Connect SDK main repository

nRF Connect SDK: sdk-nrf ########################

.. contents:: :local: :depth: 2

This repository contains the core of nRF Connect SDK, including subsystems, libraries, samples, and applications. It is also the SDK's west manifest repository, containing the nRF Connect SDK manifest (west.yml).


Official latest documentation at https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/index.html

For earlier versions, open the latest version and use the drop-down under the title header.

An open source, portable, easy to use, readable and flexible TLS library, and reference implementation of the PSA Cryptography API. Releases are on a varying cadence, typically around 3 - 6 months between releases.


Mbed TLS is a C library that implements cryptographic primitives, X.509 certificate manipulation and the SSL/TLS and DTLS protocols. Its small code footprint makes it suitable for embedded systems.

Mbed TLS includes a reference implementation of the PSA Cryptography API. This is currently a preview for evaluation purposes only.


Mbed TLS should build out of the box on most systems. Some platform specific options are available in the fully documented configuration file include/mbedtls/mbedtls_config.h, which is also the place where features can be selected. This file can be edited manually, or in a more programmatic way using the Python 3 script scripts/config.py (use --help for usage instructions).

Compiler options can be set using conventional environment variables such as CC and CFLAGS when using the Make and CMake build system (see below).

We provide some non-standard configurations focused on specific use cases in the configs/ directory. You can read more about those in configs/README.txt


The main Mbed TLS documentation is available via ReadTheDocs.

Documentation for the PSA Cryptography API is available on GitHub.

To generate a local copy of the library documentation in HTML format, tailored to your compile-time configuration:

  1. Make sure that Doxygen is installed.
  2. Run make apidoc.
  3. Browse apidoc/index.html or apidoc/modules.html.

For other sources of documentation, see the SUPPORT document.


There are currently three active build systems used within Mbed TLS releases:

  • GNU Make
  • CMake
  • Microsoft Visual Studio

The main systems used for development are CMake and GNU Make. Those systems are always complete and up-to-date. The others should reflect all changes present in the CMake and Make build system, although features may not be ported there automatically.

The Make and CMake build systems create three libraries: libmbedcrypto, libmbedx509, and libmbedtls. Note that libmbedtls depends on libmbedx509 and libmbedcrypto, and libmbedx509 depends on libmbedcrypto. As a result, some linkers will expect flags to be in a specific order, for example the GNU linker wants -lmbedtls -lmbedx509 -lmbedcrypto.

Tool versions

You need the following tools to build the library with the provided makefiles:

  • GNU Make 3.82 or a build tool that CMake supports.
  • A C99 toolchain (compiler, linker, archiver). We actively test with GCC 5.4, Clang 3.8, Arm Compiler 6, IAR 8 and Visual Studio 2017. More recent versions should work. Slightly older versions may work.
  • Python 3.8 to generate the test code. Python is also needed to integrate PSA drivers and to build the development branch (see next section).
  • Perl to run the tests, and to generate some source files in the development branch.
  • CMake 3.10.2 or later (if using CMake).
  • Microsoft Visual Studio 2017 or later (if using Visual Studio).
  • Doxygen 1.8.11 or later (if building the documentation; slightly older versions should work).

Git usage

The development branch and the mbedtls-3.6 long-term support branch of Mbed TLS use a Git submodule (framework). This is not needed to merely compile the library at a release tag. This is not needed to consume a release archive (zip or tar).

Generated source files in the development branch

The source code of Mbed TLS includes some files that are automatically generated by scripts and whose content depends only on the Mbed TLS source, not on the platform or on the library configuration. These files are not included in the development branch of Mbed TLS, but the generated files are included in official releases. This section explains how to generate the missing files in the development branch.

The following tools are required:

  • Perl, for some library source files and for Visual Studio build files.
  • Python 3.8 and some Python packages, for some library source files, sample programs and test data. To install the necessary packages, run:
    python3 -m pip install --user -r scripts/basic.requirements.txt
    Depending on your Python installation, you may need to invoke python instead of python3. To install the packages system-wide, omit the --user option.
  • A C compiler for the host platform, for some test data.

If you are cross-compiling, you must set the CC environment variable to a C compiler for the host platform when generating the configuration-independent files.

Any of the following methods are available to generate the configuration-independent files:

  • If not cross-compiling, running make with any target, or just make, will automatically generate required files.
  • On non-Windows systems, when not cross-compiling, CMake will generate the required files automatically.
  • Run make generated_files to generate all the configuration-independent files.
  • On Unix/POSIX systems, run tests/scripts/check-generated-files.sh -u to generate all the configuration-independent files.
  • On Windows, run scripts\make_generated_files.bat to generate all the configuration-independent files.


We require GNU Make. To build the library and the sample programs, GNU Make and a C compiler are sufficient. Some of the more advanced build targets require some Unix/Linux tools.

We intentionally only use a minimum of functionality in the makefiles in order to keep them as simple and independent of different toolchains as possible, to allow users to more easily move between different platforms. Users who need more features are recommended to use CMake.

In order to build from the source code using GNU Make, just enter at the command line:


In order to run the tests, enter:

make check

The tests need Python to be built and Perl to be run. If you don't have one of them installed, you can skip building the tests with:

make no_test

You'll still be able to run a much smaller set of tests with:


In order to build for a Windows platform, you should use WINDOWS_BUILD=1 if the target is Windows but the build environment is Unix-like (for instance when cross-compiling, or compiling from an MSYS shell), and WINDOWS=1 if the build environment is a Windows shell (for instance using mingw32-make) (in that case some targets will not be available).

Setting the variable SHARED in your environment will build shared libraries in addition to the static libraries. Setting DEBUG gives you a debug build. You can override CFLAGS and LDFLAGS by setting them in your environment or on the make command line; compiler warning options may be overridden separately using WARNING_CFLAGS. Some directory-specific options (for example, -I directives) are still preserved.

Please note that setting CFLAGS overrides its default value of -O2 and setting WARNING_CFLAGS overrides its default value (starting with -Wall -Wextra), so if you just want to add some warning options to the default ones, you can do so by setting CFLAGS=-O2 -Werror for example. Setting WARNING_CFLAGS is useful when you want to get rid of its default content (for example because your compiler doesn't accept -Wall as an option). Directory-specific options cannot be overridden from the command line.

Depending on your platform, you might run into some issues. Please check the Makefiles in library/, programs/ and tests/ for options to manually add or remove for specific platforms. You can also check the Mbed TLS Knowledge Base for articles on your platform or issue.

In case you find that you need to do something else as well, please let us know what, so we can add it to the Mbed TLS Knowledge Base.


In order to build the source using CMake in a separate directory (recommended), just enter at the command line:

mkdir /path/to/build_dir && cd /path/to/build_dircmake /path/to/mbedtls_sourcecmake --build .

In order to run the tests, enter:


The test suites need Python to be built and Perl to be executed. If you don't have one of these installed, you'll want to disable the test suites with:

cmake -DENABLE_TESTING=Off /path/to/mbedtls_source

If you disabled the test suites, but kept the programs enabled, you can still run a much smaller set of tests with:


To configure CMake for building shared libraries, use:

cmake -DUSE_SHARED_MBEDTLS_LIBRARY=On /path/to/mbedtls_source

There are many different build modes available within the CMake buildsystem. Most of them are available for gcc and clang, though some are compiler-specific:

  • Release. This generates the default code without any unnecessary information in the binary files.
  • Debug. This generates debug information and disables optimization of the code.
  • Coverage. This generates code coverage information in addition to debug information.
  • ASan. This instruments the code with AddressSanitizer to check for memory errors. (This includes LeakSanitizer, with recent version of gcc and clang.) (With recent version of clang, this mode also instruments the code with UndefinedSanitizer to check for undefined behaviour.)
  • ASanDbg. Same as ASan but slower, with debug information and better stack traces.
  • MemSan. This instruments the code with MemorySanitizer to check for uninitialised memory reads. Experimental, needs recent clang on Linux/x86_64.
  • MemSanDbg. Same as MemSan but slower, with debug information, better stack traces and origin tracking.
  • Check. This activates the compiler warnings that depend on optimization and treats all warnings as errors.

Switching build modes in CMake is simple. For debug mode, enter at the command line:

cmake -D CMAKE_BUILD_TYPE=Debug /path/to/mbedtls_source

To list other available CMake options, use:

cmake -LH

Note that, with CMake, you can't adjust the compiler or its flags after the initial invocation of cmake. This means that CC=your_cc make and make CC=your_cc will not work (similarly with CFLAGS and other variables). These variables need to be adjusted when invoking cmake for the first time, for example:

CC=your_cc cmake /path/to/mbedtls_source

If you already invoked cmake and want to change those settings, you need to remove the build directory and create it again.

Note that it is possible to build in-place; this will however overwrite the provided Makefiles (see scripts/tmp_ignore_makefiles.sh if you want to prevent git status from showing them as modified). In order to do so, from the Mbed TLS source directory, use:

cmake .make

If you want to change CC or CFLAGS afterwards, you will need to remove the CMake cache. This can be done with the following command using GNU find:

find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} +

You can now make the desired change:

CC=your_cc cmake .make

Regarding variables, also note that if you set CFLAGS when invoking cmake, your value of CFLAGS doesn't override the content provided by cmake (depending on the build mode as seen above), it's merely prepended to it.

Consuming Mbed TLS

Mbed TLS provides a package config file for consumption as a dependency in other CMake projects. You can include Mbed TLS's CMake targets yourself with:


If prompted, set MbedTLS_DIR to ${YOUR_MBEDTLS_INSTALL_DIR}/cmake. This creates the following targets:

  • MbedTLS::mbedcrypto (Crypto library)
  • MbedTLS::mbedtls (TLS library)
  • MbedTLS::mbedx509 (X509 library)

You can then use these directly through target_link_libraries():

add_executable(xyz)target_link_libraries(xyz PUBLIC MbedTLS::mbedtls MbedTLS::mbedcrypto MbedTLS::mbedx509)

This will link the Mbed TLS libraries to your library or application, and add its include directories to your target (transitively, in the case of PUBLIC or INTERFACE link libraries).

Mbed TLS as a subproject

Mbed TLS supports being built as a CMake subproject. One can use add_subdirectory() from a parent CMake project to include Mbed TLS as a subproject.

Microsoft Visual Studio

The build files for Microsoft Visual Studio are generated for Visual Studio 2017.

The solution file mbedTLS.sln contains all the basic projects needed to build the library and all the programs. The files in tests are not generated and compiled, as these need Python and perl environments as well. However, the selftest program in programs/test/ is still available.

In the development branch of Mbed TLS, the Visual Studio solution files need to be generated first as described in Generated source files in the development branch.

Example programs

We've included example programs for a lot of different features and uses in programs/. Please note that the goal of these sample programs is to demonstrate specific features of the library, and the code may need to be adapted to build a real-world application.


Mbed TLS includes an elaborate test suite in tests/ that initially requires Python to generate the tests files (e.g. test\_suite\_mpi.c). These files are generated from a function file (e.g. suites/test\_suite\_mpi.function) and a data file (e.g. suites/test\_suite\_mpi.data). The function file contains the test functions. The data file contains the test cases, specified as parameters that will be passed to the test function.

For machines with a Unix shell and OpenSSL (and optionally GnuTLS) installed, additional test scripts are available:

  • tests/ssl-opt.sh runs integration tests for various TLS options (renegotiation, resumption, etc.) and tests interoperability of these options with other implementations.
  • tests/compat.sh tests interoperability of every ciphersuite with other implementations.
  • tests/scripts/test-ref-configs.pl test builds in various reduced configurations.
  • tests/scripts/depends.py test builds in configurations with a single curve, key exchange, hash, cipher, or pkalg on.
  • tests/scripts/all.sh runs a combination of the above tests, plus some more, with various build options (such as ASan, full mbedtls_config.h, etc).

Instead of manually installing the required versions of all tools required for testing, it is possible to use the Docker images from our CI systems, as explained in our testing infrastructure repository.

Porting Mbed TLS

Mbed TLS can be ported to many different architectures, OS's and platforms. Before starting a port, you may find the following Knowledge Base articles useful:

Mbed TLS is mostly written in portable C99; however, it has a few platform requirements that go beyond the standard, but are met by most modern architectures:

  • Bytes must be 8 bits.
  • All-bits-zero must be a valid representation of a null pointer.
  • Signed integers must be represented using two's complement.
  • int and size_t must be at least 32 bits wide.
  • The types uint8_t, uint16_t, uint32_t and their signed equivalents must be available.
  • Mixed-endian platforms are not supported.
  • SIZE_MAX must be at least as big as INT_MAX and UINT_MAX.

PSA cryptography API


Arm's Platform Security Architecture (PSA) is a holistic set of threat models, security analyses, hardware and firmware architecture specifications, and an open source firmware reference implementation. PSA provides a recipe, based on industry best practice, that allows security to be consistently designed in, at both a hardware and firmware level.

The PSA cryptography API provides access to a set of cryptographic primitives. It has a dual purpose. First, it can be used in a PSA-compliant platform to build services, such as secure boot, secure storage and secure communication. Second, it can also be used independently of other PSA components on any platform.

The design goals of the PSA cryptography API include:

  • The API distinguishes caller memory from internal memory, which allows the library to be implemented in an isolated space for additional security. Library calls can be implemented as direct function calls if isolation is not desired, and as remote procedure calls if isolation is desired.
  • The structure of internal data is hidden to the application, which allows substituting alternative implementations at build time or run time, for example, in order to take advantage of hardware accelerators.
  • All access to the keys happens through key identifiers, which allows support for external cryptoprocessors that is transparent to applications.
  • The interface to algorithms is generic, favoring algorithm agility.
  • The interface is designed to be easy to use and hard to accidentally misuse.

Arm welcomes feedback on the design of the API. If you think something could be improved, please open an issue on our Github repository. Alternatively, if you prefer to provide your feedback privately, please email us at [email protected]. All feedback received by email is treated confidentially.

PSA implementation in Mbed TLS

Mbed TLS includes a reference implementation of the PSA Cryptography API. However, it does not aim to implement the whole specification; in particular it does not implement all the algorithms.

The X.509 and TLS code can use PSA cryptography for most operations. To enable this support, activate the compilation option MBEDTLS_USE_PSA_CRYPTO in mbedtls_config.h. Note that TLS 1.3 uses PSA cryptography for most operations regardless of this option. See docs/use-psa-crypto.md for details.

PSA drivers

Mbed TLS supports drivers for cryptographic accelerators, secure elements and random generators. This is work in progress. Please note that the driver interfaces are not fully stable yet and may change without notice. We intend to preserve backward compatibility for application code (using the PSA Crypto API), but the code of the drivers may have to change in future minor releases of Mbed TLS.

Please see the PSA driver example and guide for information on writing a driver.

When using drivers, you will generally want to enable two compilation options (see the reference manual for more information):

  • MBEDTLS_USE_PSA_CRYPTO is necessary so that the X.509 and TLS code calls the PSA drivers rather than the built-in software implementation.
  • MBEDTLS_PSA_CRYPTO_CONFIG allows you to enable PSA cryptographic mechanisms without including the code of the corresponding software implementation. This is not yet supported for all mechanisms.


Unless specifically indicated otherwise in a file, Mbed TLS files are provided under a dual Apache-2.0 OR GPL-2.0-or-later license. See the LICENSE file for the full text of these licenses, and the 'License and Copyright' section in the contributing guidelines for more information.

Third-party code included in Mbed TLS

This project contains code from other projects. This code is located within the 3rdparty/ directory. The original license text is included within project subdirectories, where it differs from the normal Mbed TLS license, and/or in source files. The projects are listed below:

  • 3rdparty/everest/: Files stem from Project Everest and are distributed under the Apache 2.0 license.
  • 3rdparty/p256-m/p256-m/: Files have been taken from the p256-m repository. The code in the original repository is distributed under the Apache 2.0 license. It is distributed in Mbed TLS under a dual Apache-2.0 OR GPL-2.0-or-later license with permission from the author.


We gratefully accept bug reports and contributions from the community. Please see the contributing guidelines for details on how to do this.