@@ -132,10 +132,11 @@ CHIP_ERROR P256Keypair::Initialize(ECPKeyTarget key_target)
132
132
// Trust M init
133
133
trustm_Open ();
134
134
// Trust M ECC 256 Key Gen
135
- ChipLogDetail (Crypto, " Generating NIST256 key in Trust M for ecdh !" );
135
+ ChipLogDetail (Crypto, " Generating NIST256 key in TrustM for ECDH !" );
136
136
uint8_t key_usage = (optiga_key_usage_t )(OPTIGA_KEY_USAGE_KEY_AGREEMENT);
137
137
138
138
return_status = trustm_ecc_keygen (OPTIGA_KEY_ID_E0F3, key_usage, OPTIGA_ECC_CURVE_NIST_P_256, pubkey, &pubKeyLen);
139
+
139
140
// Add signature length
140
141
VerifyOrExit (return_status == OPTIGA_LIB_SUCCESS, error = CHIP_ERROR_INTERNAL);
141
142
@@ -158,7 +159,7 @@ CHIP_ERROR P256Keypair::Initialize(ECPKeyTarget key_target)
158
159
// Trust M init
159
160
trustm_Open ();
160
161
// Trust M ECC 256 Key Gen
161
- ChipLogDetail (Crypto, " Generating NIST256 key in Trust M !" );
162
+ ChipLogDetail (Crypto, " Generating NIST256 key in TrustM !" );
162
163
uint8_t key_usage = (optiga_key_usage_t )(OPTIGA_KEY_USAGE_SIGN | OPTIGA_KEY_USAGE_AUTHENTICATION);
163
164
164
165
return_status = trustm_ecc_keygen (OPTIGA_KEY_ID_E0F2, key_usage, OPTIGA_ECC_CURVE_NIST_P_256, pubkey, &pubKeyLen);
@@ -207,7 +208,7 @@ CHIP_ERROR P256Keypair::ECDSA_sign_msg(const uint8_t * msg, size_t msg_length, P
207
208
208
209
VerifyOrReturnError (msg != nullptr , CHIP_ERROR_INVALID_ARGUMENT);
209
210
VerifyOrReturnError (msg_length > 0 , CHIP_ERROR_INVALID_ARGUMENT);
210
- ChipLogDetail (Crypto, " ECDSA_sign_msg: Using trustm for ecdsa sign!" );
211
+ ChipLogDetail (Crypto, " ECDSA_sign_msg: Using TrustM for ecdsa sign!" );
211
212
// Trust M Init
212
213
trustm_Open ();
213
214
// Hash to get the digest
@@ -238,7 +239,7 @@ CHIP_ERROR P256Keypair::ECDSA_sign_msg(const uint8_t * msg, size_t msg_length, P
238
239
239
240
CHIP_ERROR P256Keypair::ECDH_derive_secret (const P256PublicKey & remote_public_key, P256ECDHDerivedSecret & out_secret) const
240
241
{
241
- #if !ENABLE_SE05X_GENERATE_EC_KEY
242
+ #if !ENABLE_TRUSTM_GENERATE_EC_KEY
242
243
return ECDH_derive_secret_H (&mKeypair , remote_public_key, out_secret);
243
244
#else
244
245
CHIP_ERROR error = CHIP_ERROR_INTERNAL;
@@ -247,17 +248,17 @@ CHIP_ERROR P256Keypair::ECDH_derive_secret(const P256PublicKey & remote_public_k
247
248
uint32_t keyid = 0 ;
248
249
if (CHIP_NO_ERROR != get_trustm_keyid_from_keypair (mKeypair , &keyid))
249
250
{
250
- ChipLogDetail (Crypto, " ECDH_derive_secret : Using host for ecdh " );
251
+ ChipLogDetail (Crypto, " ECDH_derive_secret : Using Host for ECDH " );
251
252
return ECDH_derive_secret_H (&mKeypair , remote_public_key, out_secret);
252
253
}
253
254
254
255
ChipLogDetail (Crypto, " ECDH_derive_secret: Using TrustM for ECDH !" );
255
256
trustm_Open ();
256
257
257
- const uint8_t * const pubKey = Uint8::to_const_uchar (remote_public_key);
258
- const size_t pubKeyLen = remote_public_key.Length ();
259
- return_status = trustm_ecdh_derive_secret (OPTIGA_KEY_ID_E0F3, (uint8_t *)pubKey , (uint16_t )pubKeyLen ,
260
- Uint8::to_uchar ( out_secret), (uint8_t )secret_length);
258
+ const uint8_t * const rem_pubKey = Uint8::to_const_uchar (remote_public_key);
259
+ const size_t rem_pubKeyLen = remote_public_key.Length ();
260
+ return_status = trustm_ecdh_derive_secret (OPTIGA_KEY_ID_E0F3, (uint8_t *)rem_pubKey , (uint16_t )rem_pubKeyLen ,
261
+ out_secret. Bytes ( ), (uint8_t )secret_length);
261
262
262
263
VerifyOrExit (return_status == OPTIGA_LIB_SUCCESS, error = CHIP_ERROR_INTERNAL) ;
263
264
@@ -474,7 +475,7 @@ CHIP_ERROR P256Keypair::NewCertificateSigningRequest(uint8_t * csr, size_t & csr
474
475
ChipLogDetail (Crypto, " NewCertificateSigningRequest : Not hsm key. Using host for CSR" );
475
476
return NewCertificateSigningRequest_H (&mKeypair , csr, csr_length);
476
477
}
477
- ChipLogDetail (Crypto, " NewCertificateSigningRequest: Using Trust M for CSR Creating!" );
478
+ ChipLogDetail (Crypto, " NewCertificateSigningRequest: Using TrustM for CSR Creating!" );
478
479
479
480
// No extensions are copied
480
481
buffer_index -= kTlvHeader ;
0 commit comments