gpoulios commented on PR #2870:
URL: https://github.com/apache/nuttx-apps/pull/2870#issuecomment-2509499958

   
   
   Had to make another minor adjustment in crypto/controlse 
(`mbedtls_pk_info_t.sign_func` signature has changed; now accepting 
`mbedtls_pk_context *` instead of `void *`).
   
   ```diff
   diff --git a/crypto/controlse/cmbedtls_se05x_extension.hxx 
b/crypto/controlse/cmbedtls_se05x_extension.hxx
   index 9568ad667..4e8fda770 100644
   --- a/crypto/controlse/cmbedtls_se05x_extension.hxx
   +++ b/crypto/controlse/cmbedtls_se05x_extension.hxx
   @@ -89,7 +89,7 @@ public:
        return result;
      }
    
   -  static int ecdsa_sign_wrap(void *ctx, mbedtls_md_type_t md_alg,
   +  static int ecdsa_sign_wrap(mbedtls_pk_context *pk, mbedtls_md_type_t 
md_alg,
                                 const unsigned char *hash, size_t hash_len,
                                 unsigned char *sig, size_t sig_size,
                                 size_t *sig_len,
   @@ -97,7 +97,8 @@ public:
                                 void *p_rng)
      {
    
   -    mbedtls_ecp_keypair *key = reinterpret_cast<mbedtls_ecp_keypair *>(ctx);
   +    mbedtls_ecp_keypair *key =
   +        reinterpret_cast<mbedtls_ecp_keypair *>(pk->pk_ctx);
        auto se05x_ctx = reinterpret_cast<mbedtls_se05x_ctx *>(key->d.p);
    
        struct se05x_signature_s args
   ```
   
   Initialization takes place a few lines below:
   ```c
   File: crypto/controlse/cmbedtls_se05x_extension.hxx
   
   132:   static int mbedtls_pk_setup_key_se05x(mbedtls_pk_context &key,
   133:                                         const ISecureElement &se,
   134:                                         uint32_t key_slot_id)
   135:   {
   136:     auto se05x_ec_info = CreatePkInfoSe05x();
   137:     if (se05x_ec_info)
   138:       {
   139:         key.pk_info = se05x_ec_info;
   140:         key.pk_ctx = se05x_ec_info->ctx_alloc_func();
   141:       }
   [...]
   163:     ((mbedtls_ecp_keypair *)key.pk_ctx)->d.p
   164:         = reinterpret_cast<mbedtls_mpi_uint *>(se05x_ctx);
   165:     return result;
   ```
   
   Usage in diff above is also aligned with [MbedTLS built-in 
driver](https://github.com/Mbed-TLS/mbedtls/blob/017722f0431baddd22fadda3353736cdb5990fee/tf-psa-crypto/drivers/builtin/src/pk_wrap.c#L756).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to