Skip to content

Commit

Permalink
Merge branch 'contrib/github_pr_10391' into 'master'
Browse files Browse the repository at this point in the history
[Docs] specify Digital Signature byte order, and esp_ds_sign() clarification (GitHub PR)

Closes IDFGH-8978

See merge request espressif/esp-idf!21712
  • Loading branch information
mahavirj committed Dec 21, 2022
2 parents ad66203 + d43dd92 commit 078835e
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions components/esp_hw_support/include/esp_ds.h
Expand Up @@ -84,6 +84,9 @@ typedef struct esp_digital_signature_data {
* This is only used for encrypting the RSA parameters by calling esp_ds_encrypt_params().
* Afterwards, the result can be stored in flash or in other persistent memory.
* The encryption is a prerequisite step before any signature operation can be done.
*
* @note
* Y, M, Rb, & M_Prime must all be in little endian format.
*/
typedef struct {
uint32_t Y[ESP_DS_SIGNATURE_MAX_BIT_LEN / 32]; //!< RSA exponent
Expand All @@ -108,7 +111,9 @@ typedef struct {
* @note
* Please see note section of \c esp_ds_start_sign() for more details about the input parameters.
*
* @param message the message to be signed; its length should be (data->rsa_length + 1)*4 bytes
* @param message the message to be signed; its length should be (data->rsa_length + 1)*4 bytes, and those
bytes must be in little endian format. It is your responsibility to apply your hash function
and padding before calling this function, if required. (e.g. message = padding(hash(inputMsg)))
* @param data the encrypted signing key data (AES encrypted RSA key + IV)
* @param key_id the HMAC key ID determining the HMAC key of the HMAC which will be used to decrypt the
* signing key data
Expand Down Expand Up @@ -149,7 +154,9 @@ esp_err_t esp_ds_sign(const void *message,
* No padding is applied to the message automatically, Please ensure the message is appropriate padded before
* calling the API.
*
* @param message the message to be signed; its length should be (data->rsa_length + 1)*4 bytes
* @param message the message to be signed; its length should be (data->rsa_length + 1)*4 bytes, and those
bytes must be in little endian format. It is your responsibility to apply your hash function
and padding before calling this function, if required. (e.g. message = padding(hash(inputMsg)))
* @param data the encrypted signing key data (AES encrypted RSA key + IV)
* @param key_id the HMAC key ID determining the HMAC key of the HMAC which will be used to decrypt the
* signing key data
Expand Down Expand Up @@ -177,7 +184,8 @@ bool esp_ds_is_busy(void);
/**
* @brief Finish the signing process.
*
* @param signature the destination of the signature, should be (data->rsa_length + 1)*4 bytes long
* @param signature the destination of the signature, should be (data->rsa_length + 1)*4 bytes long,
the resultant signature bytes shall be written in little endian format.
* @param esp_ds_ctx the context object retreived by \c esp_ds_start_sign()
*
* @return
Expand Down

0 comments on commit 078835e

Please sign in to comment.