Add libpsa to documentation
Adding libpsa related changes to the documentation.
Signed-off-by: Gabor Toth <gabor.toth2@arm.com>
Change-Id: I551acdf2da43cfd00030f33a1abab8e5754301a2
diff --git a/docs/deployments/libraries.rst b/docs/deployments/libraries.rst
index 25902ef..81d18cb 100644
--- a/docs/deployments/libraries.rst
+++ b/docs/deployments/libraries.rst
@@ -31,6 +31,80 @@
* - Used by
- * Userspace applications
+.. _libs-libpsa:
+
+libpsa
+------
+Trusted Services implements the `PSA Certified APIs`_. Libpsa encapsulates the service client implementations
+which implement this API. Linux uuser-space applications can use libpsa to easily access the PSA services
+implemented by the project. Libpsa depends on libts for RPC and service discovery services.
+
+.. list-table::
+ :widths: 1 2
+ :header-rows: 0
+
+ * - Supported Environments
+ - * | *linux-pc*
+ * | *arm-linux*
+ * - Used by
+ - * Userspace applications
+ * - Depends on
+ - * `libts`_ library
+
+Build and integration examples
+..............................
+
+Build as shared library::
+
+ cmake -S ./trusted-services/deployments/libpsa/linux-pc/ -B ./build
+ make -C build && make -C build install
+
+.. warning::
+ Building as static library is not yet supported.
+
+To integrate the library libts shall also be integrated. To achieve this add the listed
+lines to the application's cmake files::
+
+ find_package(libpsa "1.0.0" REQUIRED PATHS "<install path>")
+ find_package(libts "2.0.0" REQUIRED PATHS "<install path>")
+ target_link_libraries(ts-demo PRIVATE libpsa::psa)
+
+Initialization
+..............
+
+Before calling any function from libpsa the proper part of the library has to be initialized.
+Before exiting the application (or when PSA services are no longer needed) the initialized
+parts must be deinitialized. To access the library **libpsa.h** must be included::
+
+ psa_status_t libpsa_init_crypto_context(const char *service_name);
+ void libpsa_deinit_crypto_context(void);
+
+ psa_status_t libpsa_init_attestation_context(const char *service_name);
+ void libpsa_deinit_attestation_context(void);
+
+ psa_status_t libpsa_init_its_context(const char *service_name);
+ void libpsa_deinit_its_context(void);
+
+ psa_status_t libpsa_init_ps_context(const char *service_name);
+ void libpsa_deinit_ps_context(void);
+
+The example below initializes and then deinitializes crypto::
+
+ psa_status_t psa_status = libpsa_init_crypto_context("sn:trustedfirmware.org:crypto:0");
+ if (psa_status) {
+ printf("libpsa_init_crypto_context failed: %d\n", psa_status);
+ return PSA_ERROR_GENERIC_ERROR;
+ }
+
+ libpsa_deinit_crypto_context();
+
+Known issues and Limitations
+............................
+
+| The library is single client.
+| The library is not thread safe.
+| Only linux user-space is supported currently.
+
.. _libs-libsp:
libsp
@@ -48,8 +122,17 @@
* - Used by
- * Secure partitions
+Known issues and Limitations
+............................
+
+| The library is single client.
+| The library is not thread safe.
+| Only linux user-space is supported currently.
+
--------------
-*Copyright (c) 2022, Arm Limited and Contributors. All rights reserved.*
+.. _`PSA Certified APIs`: https://arm-software.github.io/psa-api/
+
+*Copyright (c) 2022-2023, Arm Limited and Contributors. All rights reserved.*
SPDX-License-Identifier: BSD-3-Clause