Random generation#
Functions#
Generate random bytes.
Generate a key or key pair.
Function Documentation#
psa_generate_random#
psa_status_t psa_generate_random (uint8_t * output, size_t output_size)
Generate random bytes.
[out] | output | Output buffer for the generated data. |
N/A | output_size | Number of bytes to generate and output. |
Warnings
This function can fail! Callers MUST check the return status and MUST NOT use the content of the output buffer if the return status is not PSA_SUCCESS.
Note
To generate a key, use psa_generate_key() instead.
4044
of file util/third_party/trusted-firmware-m/interface/include/psa/crypto.h
psa_generate_key#
psa_status_t psa_generate_key (const psa_key_attributes_t * attributes, psa_key_id_t * key)
Generate a key or key pair.
[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 |
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:
For RSA keys (PSA_KEY_TYPE_RSA_KEY_PAIR), the public exponent is 65537. The modulus is a product of two probabilistic primes between 2^{n-1} and 2^n where n is the bit size specified in the attributes.
4091
of file util/third_party/trusted-firmware-m/interface/include/psa/crypto.h