Chapter 2. API Reference
• key: Pointer to 32 bytes of key data. Type determined by key_type parameter. The expectation is
the corresponding HMAC key will be stored to efuse and then permanently erased.
Structures
struct esp_digital_signature_data
Encrypted private key data. Recommended to store in flash in this format.
Note This struct has to match to one from the ROM code! This documentation is mostly taken from there.
Public Members
esp_digital_signature_length_t rsa_length
RSA LENGTH register parameters (number of words in RSA key & operands, minus one).
Max value 127 (for RSA 4096).
This value must match the length field encrypted and stored in ‘c’, or invalid results will be returned.
(The DS peripheral will always use the value in ‘c’, not this value, so an attacker can’t alter the
DS peripheral results this way, it will just truncate or extend the message and the resulting signature in
software.)
Note In IDF, the enum type length is the same as of type unsigned, so they can be used interchangably.
See the ROM code for the original declaration of struct ets_ds_data_t.
uint8_t iv[ESP_DS_IV_LEN]
IV value used to encrypt ‘c’
uint8_t c[ESP_DS_C_LEN]
Encrypted Digital Signature parameters. Result of AES-CBC encryption of plaintext values. Includes an
encrypted message digest.
struct esp_ds_p_data_t
Plaintext parameters used by Digital Signature.
Not used for signing with DS peripheral, but can be encrypted in-device by calling esp_ds_encrypt_params()
Note This documentation is mostly taken from the ROM code.
Public Members
uint32_t Y[4096 / 32]
RSA exponent.
uint32_t M[4096 / 32]
RSA modulus.
uint32_t Rb[4096 / 32]
RSA r inverse operand.
uint32_t M_prime
RSA M prime operand.
esp_digital_signature_length_t length
RSA length.
Macros
ESP_ERR_HW_CRYPTO_DS_HMAC_FAIL
HMAC peripheral problem
ESP_ERR_HW_CRYPTO_DS_INVALID_KEY
given HMAC key isn’t correct, HMAC peripheral problem
ESP_ERR_HW_CRYPTO_DS_INVALID_DIGEST
message digest check failed, result is invalid
Espressif Systems 279
Submit Document Feedback
Release v4.4