{"id":19045317,"url":"https://github.com/mbed-tls/tf-psa-crypto","last_synced_at":"2025-07-29T01:37:40.815Z","repository":{"id":207189371,"uuid":"569782941","full_name":"Mbed-TLS/TF-PSA-Crypto","owner":"Mbed-TLS","description":"Reference implementation of the PSA Cryptography API","archived":false,"fork":false,"pushed_at":"2025-07-28T21:29:35.000Z","size":101506,"stargazers_count":16,"open_issues_count":117,"forks_count":48,"subscribers_count":12,"default_branch":"development","last_synced_at":"2025-07-28T23:24:56.292Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Mbed-TLS.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":"SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-11-23T15:50:00.000Z","updated_at":"2025-07-28T21:29:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"e6b34a82-121d-4d03-9f9d-03df1a30ae8e","html_url":"https://github.com/Mbed-TLS/TF-PSA-Crypto","commit_stats":null,"previous_names":["mbed-tls/tf-psa-crypto"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Mbed-TLS/TF-PSA-Crypto","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mbed-TLS%2FTF-PSA-Crypto","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mbed-TLS%2FTF-PSA-Crypto/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mbed-TLS%2FTF-PSA-Crypto/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mbed-TLS%2FTF-PSA-Crypto/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Mbed-TLS","download_url":"https://codeload.github.com/Mbed-TLS/TF-PSA-Crypto/tar.gz/refs/heads/development","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Mbed-TLS%2FTF-PSA-Crypto/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267616844,"owners_count":24116169,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T22:49:49.164Z","updated_at":"2025-07-29T01:37:40.784Z","avatar_url":"https://github.com/Mbed-TLS.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"README for TF-PSA-Crypto\n========================\n\nThe TF-PSA-Crypto repository provides an implementation of the\n[PSA Cryptography API](https://arm-software.github.io/psa-api) (version 1.1).\nThis encompasses the on-going extensions to the PSA Cryptography API (e.g. PAKE).\n\nThe PSA Cryptography API implementation is organized around the\n[PSA Cryptography driver interface](https://github.com/Mbed-TLS/mbedtls/blob/development/docs/proposed/psa-driver-interface.md)\naiming to ease the support of cryptographic accelerators and processors.\n\nConfiguration\n-------------\n\nThe TF-PSA-Crypto repository should build out of the box on most systems. Its\nconfiguration is based on C preprocessor macros gathered in\n`include/psa/crypto_config.h`. The C preprocessor macros or configuration\noptions are organized into four groups:\n1. General configuration options, options that are not related to a specific\n   part of the implementation of the PSA Cryptography API.\n2. Configuration, using PSA_WANT_xxx macros as defined in psa-conditional-inclusion-c.md,\n   of which parts of the PSA Cryptography API the user wishes to enable:\n   cryptographic algorithms, key types, elliptic curves ...\n3. Configuration of the PSA cryptography core as defined in psa-driver-interface.md\n   which provides the key management, the generation of random numbers and the\n   dispatch to drivers.\n4. Configuration of the built-in implementation of the PSA driver interface as\n   defined in psa-driver-interface.md: non-functional configuration related to\n   performance/size trade-offs.\n\nThe file `include/psa/crypto_config.h` can be edited manually, or in a more\nprogrammatic way using the Python 3 script `scripts/config.py` (use `--help`\nfor usage instructions).\n\nCompiler options can be set using conventional environment variables such as\n`CC` and `CFLAGS` when using the CMake build system (see below).\n\nDocumentation\n-------------\n\nDocumentation for the PSA Cryptography API is available [on GitHub](https://arm-software.github.io/psa-api/crypto/).\n\nTo generate a local copy of the library documentation in HTML format:\n\n1. Make sure that [Doxygen](http://www.doxygen.nl/) is installed.\n1. Run `mkdir /path/to/build_dir \u0026\u0026 cd /path/to/build_dir`\n1. Run `cmake /path/to/tf/psa/crypto/source`\n1. Run `make apidoc`\n1. Browse `apidoc/index.html` or `apidoc/modules.html`.\n\nCompiling\n---------\n\nThe build system is CMake.\nThe CMake build system creates one library: libtfpsacrypto.\n\n### Tool versions\n\nYou need the following tools to build the library from the main branch with the\nprovided CMake files. TF-PSA-Crypto minimum tool version requirements are set\nbased on the versions shipped in the latest or penultimate (depending on the\nrelease cadence) long-term support releases of major Linux distributions,\nnamely at time of writing: Ubuntu 20.04, RHEL 8, SLES 15 ...\n\n* A C99 toolchain (compiler, linker, archiver). We actively test with GCC 5.4,\n  Clang 3.8. More recent versions should work. Slightly older versions may work.\n* Python 3.6.5 and later to generate some source files (see below), the test\n  code, and to generate sample programs.\n* Perl to run the tests, and to generate some source files in the main branch.\n* CMake 3.16.3 or later.\n* Microsoft Visual Studio 2019 or later (if using Visual Studio).\n* Doxygen 1.8.14 or later.\n\n### Generated source files\n\nThe TF-PSA-Crypto build system generates some library, sample program and test\nC files as well as test data files. Their content depends only on the PSA\ncryptography source code, not on the platform or on the library configuration.\n\nThe following tools are required for the generation of those files:\n\n* Python 3 and some Python packages, for some library source files, sample\n  programs and test data. To install the necessary packages, run\n  ```\n  python3 -m pip install -r scripts/basic.requirements.txt\n  ```\n* A C compiler for the host platform, for some test data.\n\nWhen not cross-compiling, the build system generates the files automatically.\n\nWhen cross-compiling, before to run the build system, you must set the `CC`\nenvironment variable to a C compiler for the host platform, then run\n`tests/scripts/check-generated-files.sh -u`.\n\n### CMake\n\nIn order to build the source using CMake in a separate directory (recommended),\njust enter at the command line:\n\n    mkdir /path/to/build_dir \u0026\u0026 cd /path/to/build_dir\n    cmake /path/to/tf/psa/crypto/source\n    cmake --build .\n\nIn order to run the tests, enter:\n\n    ctest\n\nThe test suites need Python to be built and Perl to be executed. If you don't\nhave one of these installed, you'll want to disable the test suites with:\n\n    cmake -DENABLE_TESTING=Off /path/to/tf/psa/crypto/source\n\nTo configure CMake for building shared libraries, use:\n\n    cmake -DUSE_SHARED_TF_PSA_CRYPTO_LIBRARY=On /path/to/tf/psa/crypto/source\n\nThere are many different build modes available within the CMake build system.\nMost of them are available for gcc and clang, though some are compiler-specific:\n\n- `Release`. This generates the default code without any unnecessary\n  information in the binary files.\n- `Debug`. This generates debug information and disables optimization of the code.\n- `ASan`. This instruments the code with AddressSanitizer to check for memory\n  errors. (This includes LeakSanitizer, with recent version of gcc and clang.)\n  (With recent version of clang, this mode also instruments the code with\n  UndefinedSanitizer to check for undefined behaviour.)\n- `ASanDbg`. Same as ASan but slower, with debug information and better stack\n  traces.\n- `MemSan`. This instruments the code with MemorySanitizer to check for\n  uninitialised memory reads. Experimental, needs recent clang on Linux/x86\\_64.\n- `MemSanDbg`. Same as MemSan but slower, with debug information, better stack\n  traces and origin tracking.\n- `Check`. This activates the compiler warnings that depend on optimization and\n  treats all warnings as errors.\n\nSwitching build modes in CMake is simple. For debug mode, enter at the command\nline:\n\n    cmake -D CMAKE_BUILD_TYPE=Debug /path/to/tf/psa/crypto/source\n\nTo list other available CMake options, use:\n\n    cmake -LH\n\nNote that, with CMake, you can't adjust the compiler or its flags after the\ninitial invocation of cmake. This means that `CC=your_cc make` and `make\nCC=your_cc` will *not* work (similarly with `CFLAGS` and other variables).\nThese variables need to be adjusted when invoking cmake for the first time,\nfor example:\n\n    CC=your_cc cmake /path/to/tf/psa/crypto/source\n\nIf you already invoked cmake and want to change those settings, you need to\nremove the build directory and create it again.\n\nNote that it is possible to build in-place, use:\n\n    cmake .\n    make\n\nRegarding variables, also note that if you set CFLAGS when invoking cmake,\nyour value of CFLAGS doesn't override the content provided by cmake (depending\non the build mode as seen above), it's merely prepended to it.\n\n#### Consuming TF-PSA-Crypto\n\nThe TF-PSA-Crypto repository provides a package config file for consumption as\na dependency in other CMake projects. You can include TF-PSA-Crypto CMake\ntargets yourself with:\n\n    find_package(TF-PSA-Crypto)\n\nIf prompted, set `TF-PSA-Crypto_DIR` to `${YOUR_TF_PSA_CRYPTO_INSTALL_DIR}/cmake`.\nThis creates the `TF-PSA-Crypto::tfpsacrypto` target.\n\nYou can then use it directly through `target_link_libraries()`:\n\n    add_executable(xyz)\n\n    target_link_libraries(xyz PUBLIC TF-PSA-Crypto::tfpsacrypto)\n\nThis will link the TF-PSA-Crypto library to your library or application, and\nadd its include directories to your target (transitively, in the case of\n`PUBLIC` or `INTERFACE` link libraries).\n\n#### TF-PSA-Crypto as a subproject\n\nThe TF-PSA-Crypto repository supports being built as a CMake subproject. One\ncan use `add_subdirectory()` from a parent CMake project to include\nTF-PSA-Crypto as a subproject.\n\n### Microsoft Visual Studio\n\nThe TF-PSA-Crypto library can be built with Microsoft Visual Studio Community\nsuitably installed as a CMake project. For a general documentation about\nCMake projects in Visual Studio, please refer to its documentation.\n\nThe following instructions have been tested on Microsoft Visual Studio Community\n2019 Version 16.11.26. The TF-PSA-Crypto library and its tests build out of the\nbox with:\n. Visual Studio Community installed with the default \"Desktop development with C++\"\nand \"Python development\" workloads.\n. Python libraries needed for code and test generation installed as defined\nin basic.requirements.txt. Refer to the Visual Studio documentation of Python\nenvironments.\n. When cloning the TF-PSA-Crypto repository in Visual Studio, a\nCMakeSettings.json is created at the root of the repository. In that file, add\nthe line `\"environments\": [ {\"CC\" : \"cl\"} ]` to the configuration. That way\nwhen building the library and its tests, a CC environment variable is set with\nvalue \"cl\". This is needed by Python scripts that generate test cases. The\nCMakeSettings.json file can be edited in Visual Studio by following\nProject \u003e CMake Settings for TF-PSA-Crypto \u003e Edit JSON.\n. If necessary (it may have been done automatically when updating\nCMakeSettings.json), generate the CMake cache: Project \u003e Generate Cache\n. Build the library: Build \u003e Build All\n. The test suites can then be run: Test \u003e Run CTests for TF-PSA-Crypto\n\nExample programs\n----------------\n\nWe've included example programs for different features and uses in\n[`programs/`](programs/README.md). Please note that the goal of these sample\nprograms is to demonstrate specific features of the library, and the code may\nneed to be adapted to build a real-world application.\n\nTests\n-----\n\nThe TF-PSA-Crypto repository includes an elaborate test suite in `tests/` that\ninitially requires Python to generate the tests files\n(e.g. `test\\_suite\\_psa\\_crypto.c`). These files are generated from a\n`function file` (e.g. `suites/test\\_suite\\_psa\\_crypto.function`) and a\n`data file` (e.g. `suites/test\\_suite\\_psa\\_crypto.data`). The `function file`\ncontains the test functions. The `data file` contains the test cases, specified\nas parameters that will be passed to the test function.\n\nLicense\n-------\n\nUnless specifically indicated otherwise in a file, TF-PSA-Crypto files are provided under a dual [Apache-2.0](https://spdx.org/licenses/Apache-2.0.html) OR [GPL-2.0-or-later](https://spdx.org/licenses/GPL-2.0-or-later.html) license. See the [LICENSE](LICENSE) file for the full text of these licenses.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbed-tls%2Ftf-psa-crypto","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmbed-tls%2Ftf-psa-crypto","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmbed-tls%2Ftf-psa-crypto/lists"}