PSA Crypto library
==================

.. _api-version:

API version
-----------

.. macro:: PSA_CRYPTO_API_VERSION_MAJOR
    :definition: 1

    .. summary::
        The major version of this implementation of the PSA Crypto API.

.. macro:: PSA_CRYPTO_API_VERSION_MINOR
    :definition: 0

    .. summary::
        The minor version of this implementation of the PSA Crypto API.

.. _library-init:

Library initialization
----------------------

.. function:: psa_crypto_init

    .. summary::
        Library initialization.

    .. return:: psa_status_t
    .. retval:: PSA_SUCCESS
    .. retval:: PSA_ERROR_INSUFFICIENT_MEMORY
    .. retval:: PSA_ERROR_COMMUNICATION_FAILURE
    .. retval:: PSA_ERROR_HARDWARE_FAILURE
    .. retval:: PSA_ERROR_CORRUPTION_DETECTED
    .. retval:: PSA_ERROR_INSUFFICIENT_ENTROPY

    Applications must call this function before calling any other function in this module.

    Applications are permitted to call this function more than once. Once a call succeeds, subsequent calls are guaranteed to succeed.

    If the application calls other functions before calling `psa_crypto_init()`, the behavior is undefined. In this situation:

    * Implementations are encouraged to either perform the operation as if the library had been initialized or to return `PSA_ERROR_BAD_STATE` or some other applicable error.
    * Implementations must not return a success status if the lack of initialization might have security implications, for example due to improper seeding of the random number generator.
