crypto_compat.h
crypto_extra.h
debug.h
net_sockets.h
oid.h
pk.h
pkcs7.h
psa_util.h
ssl.h
ssl_cache.h
ssl_ciphersuites.h
ssl_cookie.h
ssl_ticket.h
x509.h
x509_crl.h
x509_crt.h
x509_csr.h
crypto.h
crypto_compat.h
crypto_extra.h
PSA_KEY_HANDLE_INIT
MBEDTLS_SVC_KEY_ID_INIT
- PSA_DH_FAMILY_CUSTOM
- PSA_KEY_DOMAIN_PARAMETERS_SIZE
mbedtls_svc_key_id_t typedef mbedtls_svc_key_id_t psa_key_handle_t psa_key_handle_t
int static int psa_key_handle_is_null (psa_key_handle_t handle) psa_key_handle_is_null psa_key_handle_t handle

Check whether a handle is null.

handle

Handle

Non-zero if the handle is null, zero otherwise.

mbedtls_svc_key_id_is_null
psa_status_t psa_status_t psa_open_key (mbedtls_svc_key_id_t key, psa_key_handle_t *handle) psa_open_key mbedtls_svc_key_id_t key psa_key_handle_t * handle

Open a handle to an existing persistent key.

Open a handle to a persistent key. A key is persistent if it was created with a lifetime other than PSA_KEY_LIFETIME_VOLATILE. A persistent key always has a nonzero key identifier, set with psa_set_key_id() when creating the key. Implementations may provide additional pre-provisioned keys that can be opened with psa_open_key(). Such keys have an application key identifier in the vendor range, as documented in the description of psa_key_id_t.

The application must eventually close the handle with psa_close_key() or psa_destroy_key() to release associated resources. If the application dies without calling one of these functions, the implementation should perform the equivalent of a call to psa_close_key().

Some implementations permit an application to open the same key multiple times. If this is successful, each call to psa_open_key() will return a different key handle.

This API is not part of the PSA Cryptography API Release 1.0.0 specification. It was defined in the 1.0 Beta 3 version of the specification but was removed in the 1.0.0 released version. This API is kept for the time being to not break applications relying on it. It is not deprecated yet but will be in the near future.

Applications that rely on opening a key multiple times will not be portable to implementations that only permit a single key handle to be opened. See also :ref:`key-handles`.

key

The persistent identifier of the key.

handle

On success, a handle to the key.

PSA_SUCCESS

Success. The application can now use the value of `*handle` to access the key.

PSA_ERROR_INSUFFICIENT_MEMORY

The implementation does not have sufficient resources to open the key. This can be due to reaching an implementation limit on the number of open keys, the number of open key handles, or available memory.

PSA_ERROR_DOES_NOT_EXIST

There is no persistent key with key identifier `key`.

PSA_ERROR_INVALID_ARGUMENT

`key` is not a valid persistent key identifier.

PSA_ERROR_NOT_PERMITTED

The specified key exists, but the application does not have the permission to access it. Note that this specification does not define any way to create such a key, but it may be possible through implementation-specific means.

PSA_ERROR_COMMUNICATION_FAILURE

PSA_ERROR_CORRUPTION_DETECTED

PSA_ERROR_STORAGE_FAILURE

PSA_ERROR_DATA_INVALID

PSA_ERROR_DATA_CORRUPT

PSA_ERROR_BAD_STATE

The library has not been previously initialized by psa_crypto_init(). It is implementation-dependent whether a failure to initialize results in this error code.

psa_status_t psa_status_t psa_close_key (psa_key_handle_t handle) psa_close_key psa_key_handle_t handle

Close a key handle.

If the handle designates a volatile key, this will destroy the key material and free all associated resources, just like psa_destroy_key().

If this is the last open handle to a persistent key, then closing the handle will free all resources associated with the key in volatile memory. The key data in persistent storage is not affected and can be opened again later with a call to psa_open_key().

Closing the key handle makes the handle invalid, and the key handle must not be used again by the application.

This API is not part of the PSA Cryptography API Release 1.0.0 specification. It was defined in the 1.0 Beta 3 version of the specification but was removed in the 1.0.0 released version. This API is kept for the time being to not break applications relying on it. It is not deprecated yet but will be in the near future.

If the key handle was used to set up an active :ref:`multipart operation <multipart-operations>`, then closing the key handle can cause the multipart operation to fail. Applications should maintain the key handle until after the multipart operation has finished.

handle

The key handle to close. If this is `0`, do nothing and return `PSA_SUCCESS`.

PSA_SUCCESS

`handle` was a valid handle or `0`. It is now closed.

PSA_ERROR_INVALID_HANDLE

`handle` is not a valid handle nor `0`.

PSA_ERROR_COMMUNICATION_FAILURE

PSA_ERROR_CORRUPTION_DETECTED

PSA_ERROR_BAD_STATE

The library has not been previously initialized by psa_crypto_init(). It is implementation-dependent whether a failure to initialize results in this error code.

- psa_set_key_domain_parameters
- psa_get_key_domain_parameters

PSA cryptography module: Backward compatibility aliases.

This header declares alternative names for macro and functions. New application code should not use these names. These names may be removed in a future version of Mbed TLS.

This file may not be included directly. Applications must include psa/crypto.h.

    /*
    *CopyrightTheMbedTLSContributors
    *SPDX-License-Identifier:Apache-2.0ORGPL-2.0-or-later
    */

    #ifndefPSA_CRYPTO_COMPAT_H
    #definePSA_CRYPTO_COMPAT_H

    #ifdef__cplusplus
    extern"C"{
    #endif

    /*
    *TosupportbothopenlessAPIsandpsa_open_key()temporarily,define
    *psa_key_handle_ttobeequaltombedtls_svc_key_id_t.Donotmarkthe
    *typeanditsutilitymacrosandfunctionsdeprecatedyet.Thiswillbedone
    *inasubsequentphase.
    */
    typedefmbedtls_svc_key_id_tpsa_key_handle_t;

    #definePSA_KEY_HANDLE_INITMBEDTLS_SVC_KEY_ID_INIT

    staticinlineintpsa_key_handle_is_null(psa_key_handle_thandle)
    {
    returnmbedtls_svc_key_id_is_null(handle);
    }

    psa_status_tpsa_open_key(mbedtls_svc_key_id_tkey,
    psa_key_handle_t*handle);

    psa_status_tpsa_close_key(psa_key_handle_thandle);

    #if!defined(MBEDTLS_DEPRECATED_REMOVED)
    #definePSA_DH_FAMILY_CUSTOM\
    ((psa_dh_family_t)MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(0x7e))

    staticinlinepsa_status_tMBEDTLS_DEPRECATEDpsa_set_key_domain_parameters(
    psa_key_attributes_t*attributes,
    psa_key_type_ttype,constuint8_t*data,size_tdata_length)
    {
    (void)data;
    if(data_length!=0){
    returnPSA_ERROR_NOT_SUPPORTED;
    }
    psa_set_key_type(attributes,type);
    returnPSA_SUCCESS;
    }

    staticinlinepsa_status_tMBEDTLS_DEPRECATEDpsa_get_key_domain_parameters(
    constpsa_key_attributes_t*attributes,
    uint8_t*data,size_tdata_size,size_t*data_length)
    {
    (void)attributes;
    (void)data;
    (void)data_size;
    *data_length=0;
    returnPSA_SUCCESS;
    }

    #definePSA_KEY_DOMAIN_PARAMETERS_SIZE(key_type,key_bits)\
    MBEDTLS_DEPRECATED_NUMERIC_CONSTANT(1u)
    #endif/*MBEDTLS_DEPRECATED_REMOVED*/

    #ifdef__cplusplus
    }
    #endif

    #endif/*PSA_CRYPTO_COMPAT_H*/