An open source, portable, easy to use, readable and flexible SSL library
Go to file
Gilles Peskine bdf3f52710 all.sh: don't insist on Linux; always run Valgrind
Don't bail out of all.sh if the OS isn't Linux. We only expect
everything to pass on a recent Linux x86_64, but it's useful to call
all.sh to run some components on any platform.

In all.sh, always run both MemorySanitizer and Valgrind. Valgrind is
slower than ASan and MSan but finds some things that they don't.

Run MSan unconditionally, not just on Linux/x86_64. MSan is supported
on some other OSes and CPUs these days.

Use `all.sh --except test_memsan` if you want to omit MSan because it
isn't supported on your platform. Use `all.sh --except test_memcheck`
if you want to omit Valgrind because it's too slow.

Make the test scripts more portable (tested on FreeBSD): don't insist
on GNU sed, and recognize amd64 as well as x86_64 for `uname -m`. The
`make` utility must still be GNU make.
2019-01-10 09:32:04 +01:00
.github Add github issue template 2018-11-29 15:53:00 +02:00
configs add MBEDTLS_PSA_HAS_ITS_IO 2018-11-21 13:28:09 +02:00
docs Add generated documentation for mbedcrypto-0.1.0b 2018-11-26 17:21:23 +00:00
doxygen Update library version number to 2.14.0 2018-11-19 18:31:40 +00:00
include Split crypto_driver.h into one for each driver type 2018-12-21 18:17:10 +01:00
library Use CMAKE_BUILD_TYPE to do Asan builds 2019-01-10 09:32:04 +01:00
programs Merge pull request #3 from gilles-peskine-arm/key_ladder_demo-maybe_uninitialized 2019-01-04 14:50:34 +00:00
scripts Move integral types and associated macros to their own header 2018-12-21 17:53:09 +01:00
tests all.sh: don't insist on Linux; always run Valgrind 2019-01-10 09:32:04 +01:00
visualc/VS2010 Split crypto_driver.h into one for each driver type 2018-12-21 18:17:10 +01:00
.gitignore Remove exporter script 2018-11-21 12:17:29 +00:00
.pylint Pylint tests in all.sh 2018-08-06 11:42:56 +01:00
.travis.yml Add check-files.py to travis.yml 2018-05-21 11:59:28 +01:00
apache-2.0.txt Change main license to Apache 2.0 2015-09-04 14:21:07 +02:00
ChangeLog Adapt ChangeLog 2018-11-22 13:41:53 +00:00
circle.yml Add morpheus integration test to Circle CI. 2016-08-15 16:13:05 +01:00
CMakeLists.txt Add library as valid header file location 2018-11-20 15:21:22 +00:00
CONTRIBUTING.md Remove unnecessary newlines in CONTRIBUTING.md 2018-07-24 17:21:00 +01:00
DartConfiguration.tcl Rename to mbed TLS in the documentation/comments 2015-01-22 16:11:05 +00:00
LICENSE Change main license to Apache 2.0 2015-09-04 14:21:07 +02:00
Makefile Makefile: Install PSA headers 2018-11-21 12:17:31 +00:00
README.md README: Update with the CMake build option 2018-11-21 12:17:31 +00:00

Mbed Crypto library

The Mbed cryptography library is a reference implementation of the cryptography interface of the Arm Platform Security Architecture (PSA). This is a preview release of Mbed Crypto, provided for evaluation purposes only.

Mbed Crypto is distributed under the Apache License, version 2.0. See the LICENSE file for the full text of the license.

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 handles, 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.

Mbed Crypto implementation

Mbed Crypto is a reference implementation of the PSA cryptography API. It is written in portable C.

Documentation

Since the Mbed Crypto library is a reference implementation of the PSA cryptography API, the library's API documentation is the PSA cryptography API specification. The PSA cryptography API specification consists of the following documents:

Compiling

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

  • GNU Make or a build tool that CMake supports.
  • A C99 toolchain (compiler, linker, archiver).
  • Python 2 or Python 3 (either will work) to generate the test code.
  • Perl to run the tests.

If you have a C compiler, such as GCC or Clang, just run make in the top-level directory to build the library, a set of unit tests and some sample programs.

To select a different compiler, set the CC variable to the name or path of the compiler and linker (default: cc), and set AR to a compatible archiver (default: ar). For example:

make CC=arm-linux-gnueabi-gcc AR=arm-linux-gnueabi-ar

The provided makefiles pass options to the compiler that assume a GCC-like command-line syntax. To use a different compiler, you may need to pass different values for CFLAGS, WARNINGS_CFLAGS and LDFLAGS.

To run the unit tests on the host machine, run make test from the top-level directory. If you are cross-compiling, copy the test executable from the tests directory to the target machine.

Compiling as a subproject

Mbed Crypto supports being built as a subproject of Mbed TLS. Mbed TLS can use Mbed Crypto for its cryptography implementation by using Mbed Crypto as a subproject.

From the Mbed TLS project repository, CMake can be invoked as follows to build Mbed TLS using Mbed Crypto's libmbedcrypto.

mkdir cmake
cd cmake
cmake .. -DUSE_CRYPTO_SUBMODULE=1
make -j
make test

When building Mbed Crypto as a subproject of Mbed TLS, the Mbed TLS configuration file (config.h) is used, and not the Mbed Crypto configuration file.

Example programs

The programs/ subdirectory contains sample programs that use the library. 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.

Upcoming features

Future releases of this library will include:

  • A driver programming interface, which makes it possible to use hardware accelerators instead of the default software implementation for chosen algorithms.
  • Support for external keys to be stored and manipulated exclusively in a separate cryptoprocessor.
  • A configuration mechanism to compile only the algorithms you need for your application.
  • A wider set of cryptographic algorithms.

Feedback welcome

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 mbed-crypto@arm.com. All feedback received by email is treated confidentially.