Random generation#

Functions#

psa_generate_random(uint8_t *output, size_t output_size)

Generate random bytes.

psa_generate_key(const psa_key_attributes_t *attributes, mbedtls_svc_key_id_t *key)

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.

Parameters
[out]output

Output buffer for the generated data.

N/Aoutput_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


Definition at line 4073 of file util/third_party/mbedtls/include/psa/crypto.h

psa_generate_key#

psa_status_t psa_generate_key (const psa_key_attributes_t * attributes, mbedtls_svc_key_id_t * key)

Generate a key or key pair.

Parameters
[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.

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.


Definition at line 4120 of file util/third_party/mbedtls/include/psa/crypto.h