Commit Graph

10 Commits

Author SHA1 Message Date
MacDue 8486f8bddb esp_encrypted_img: make code const-correct
`pre_enc_decrypt_arg_t.data_in` is not modified so can be const
2022-03-10 16:09:58 +00:00
MacDue 695aaf6c2f esp_encrypted_img: pre-commit format code 2022-03-08 09:33:12 +00:00
MacDue c89f4af6f9 esp_encrypted_img: fix handle pointer in tests 2022-03-08 09:33:12 +00:00
MacDue 8fbf13dee9 esp_encrypted_img: avoid possible leak of rsa_pem
It's possible esp_encrypted_img_decrypt_end() could be called
without any decryption done. E.g. If firmware was going to
be installed there was a network failure that cancelled it.

So rsa_pem should be free'd there too.

Note: freeing a NULL pointer is a no-op
2022-03-08 09:33:12 +00:00
MacDue 724c95488c esp_encrypted_img: remove unnecessary additional allocations
This moves the gcm_key and iv to the esp_encrypted_img_handle,
which is only an additional 48 bytes, and avoids a bunch
of extra error checking & deallocation logic.

got_auth is also allocated on the stack since it's only 16 bytes
2022-03-08 09:33:12 +00:00
MacDue a087052578 esp_encrypted_img: esp_decrypt_handle_t params not esp_decrypt_handle_t*
Replaces esp_decrypt_handle_t* parameters with esp_encrypted_handle_t,
esp_encrypted_handle_t is a void*, esp_decrypt_handle_t* is void**
which is incorrect and produces compiler errors when used in C++.
2022-03-08 09:33:12 +00:00
Harshit Malpani e8efc29976 esp_encrypted_img: fix for unused variable error during build 2022-02-24 19:16:57 +05:30
Harshit Malpani 894e3d71f6 esp_encrypted_img: Updated component to support mbedtls 3.1 APIs 2022-02-24 12:37:39 +05:30
Tomas Rezucha e651ec16c5 Format code 2022-02-17 14:56:45 +01:00
Harshit Malpani 1d9f9b05c6 Add esp_encrypted_img to component manager 2022-02-15 12:01:47 +05:30