@@ -42,7 +42,7 @@ CHIP_ERROR OtaTlvEncryptionKey::Import(const uint8_t * key, size_t key_len)
42
42
psa_set_key_algorithm (&attributes, PSA_ALG_CTR);
43
43
psa_set_key_usage_flags (
44
44
&attributes, PSA_KEY_USAGE_DECRYPT);
45
-
45
+
46
46
status = psa_import_key (&attributes, key, key_len, &key_id);
47
47
if (status != PSA_SUCCESS) {
48
48
printf (" Failed to import a key error:%ld\n " , status);
@@ -74,7 +74,7 @@ CHIP_ERROR OtaTlvEncryptionKey::Decrypt(MutableByteSpan & block, uint32_t &mIVOf
74
74
iv[12 ] = (uint8_t ) ((u32IVCount >> 24 ) & 0xff );
75
75
iv[13 ] = (uint8_t ) ((u32IVCount >> 16 ) & 0xff );
76
76
iv[14 ] = (uint8_t ) ((u32IVCount >> 8 ) & 0xff );
77
- iv[15 ] = (uint8_t ) (u32IVCount & 0xff );
77
+ iv[15 ] = (uint8_t ) (u32IVCount & 0xff );
78
78
79
79
while (Offset + 16 <= block.size ())
80
80
{
@@ -88,8 +88,8 @@ CHIP_ERROR OtaTlvEncryptionKey::Decrypt(MutableByteSpan & block, uint32_t &mIVOf
88
88
if (status != PSA_SUCCESS) {
89
89
printf (" Failed to set IV error:%ld\n " , status);
90
90
return CHIP_ERROR_INTERNAL;
91
- }
92
-
91
+ }
92
+
93
93
status = psa_cipher_update (&operation, static_cast <uint8_t *>(&block[Offset]), 16 ,
94
94
output, sizeof (output), &output_len);
95
95
if (status != PSA_SUCCESS) {
@@ -115,9 +115,9 @@ CHIP_ERROR OtaTlvEncryptionKey::Decrypt(MutableByteSpan & block, uint32_t &mIVOf
115
115
printf (" Failed to finish cipher operation\n " );
116
116
return CHIP_ERROR_INTERNAL;
117
117
}
118
-
118
+
119
119
}
120
-
120
+
121
121
printf (" Decrypted ciphertext\n " );
122
122
123
123
psa_cipher_abort (&operation);
@@ -129,4 +129,4 @@ CHIP_ERROR OtaTlvEncryptionKey::Decrypt(MutableByteSpan & block, uint32_t &mIVOf
129
129
} // namespace Provision
130
130
} // namespace Silabs
131
131
} // namespace DeviceLayer
132
- } // namespace chip
132
+ } // namespace chip
0 commit comments