Functions | |
psa_status_t | psa_generate_random (uint8_t *output, size_t output_size) |
Generate random bytes. More... | |
psa_status_t | psa_generate_key (const psa_key_attributes_t *attributes, mbedtls_svc_key_id_t *key) |
Generate a key or key pair. More... | |
psa_status_t psa_generate_key | ( | const psa_key_attributes_t * | attributes, |
mbedtls_svc_key_id_t * | key | ||
) |
Generate a key or key pair.
The key is generated randomly. Its location, usage policy, type and size are taken from attributes
.
Implementations must reject an attempt to generate a key of size 0.
The following type-specific considerations apply:
[in] | attributes | The attributes for the new key. |
[out] | key | On success, an identifier for the newly created key. For persistent keys, this is the key identifier defined in attributes . 0 on failure. |
PSA_SUCCESS | Success. If the key is persistent, the key material and the key's metadata have been saved to persistent storage. |
PSA_ERROR_ALREADY_EXISTS | This is an attempt to create a persistent key, and there is already a persistent key with the given identifier. |
PSA_ERROR_NOT_SUPPORTED | |
PSA_ERROR_INVALID_ARGUMENT | |
PSA_ERROR_INSUFFICIENT_MEMORY | |
PSA_ERROR_INSUFFICIENT_ENTROPY | |
PSA_ERROR_COMMUNICATION_FAILURE | |
PSA_ERROR_HARDWARE_FAILURE | |
PSA_ERROR_CORRUPTION_DETECTED | |
PSA_ERROR_INSUFFICIENT_STORAGE | |
PSA_ERROR_STORAGE_FAILURE | |
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. |
The key is generated randomly. Its location, usage policy, type and size are taken from attributes
.
Implementations must reject an attempt to generate a key of size 0.
The following type-specific considerations apply:
[in] | attributes | The attributes for the new key. |
[out] | handle | On success, a handle to the newly created key. 0 on failure. |
PSA_SUCCESS | Success. If the key is persistent, the key material and the key's metadata have been saved to persistent storage. |
PSA_ERROR_ALREADY_EXISTS | This is an attempt to create a persistent key, and there is already a persistent key with the given identifier. |
PSA_ERROR_NOT_SUPPORTED | |
PSA_ERROR_INVALID_ARGUMENT | |
PSA_ERROR_INSUFFICIENT_MEMORY | |
PSA_ERROR_INSUFFICIENT_ENTROPY | |
PSA_ERROR_COMMUNICATION_FAILURE | |
PSA_ERROR_HARDWARE_FAILURE | |
PSA_ERROR_CORRUPTION_DETECTED | |
PSA_ERROR_INSUFFICIENT_STORAGE | |
PSA_ERROR_STORAGE_FAILURE | |
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_generate_random | ( | uint8_t * | output, |
size_t | output_size | ||
) |
Generate random bytes.
[out] | output | Output buffer for the generated data. |
output_size | Number of bytes to generate and output. |
PSA_SUCCESS | |
PSA_ERROR_NOT_SUPPORTED | |
PSA_ERROR_INSUFFICIENT_ENTROPY | |
PSA_ERROR_INSUFFICIENT_MEMORY | |
PSA_ERROR_COMMUNICATION_FAILURE | |
PSA_ERROR_HARDWARE_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. |