66
77#include <zephyr/logging/log.h>
88#include <stdbool.h>
9- #include <suit_platform .h>
9+ #include <suit_plat_write_domain_specific .h>
1010#include <suit_plat_decode_util.h>
1111#include <suit_plat_error_convert.h>
1212#include <suit_platform_internal.h>
3030#include <suit_decrypt_filter.h>
3131#endif /* CONFIG_SUIT_STREAM_FILTER_DECRYPT */
3232
33- LOG_MODULE_REGISTER (suit_plat_write , CONFIG_SUIT_LOG_LEVEL );
33+ LOG_MODULE_DECLARE (suit_plat_write , CONFIG_SUIT_LOG_LEVEL );
3434
35- int suit_plat_check_write (suit_component_t dst_handle , struct zcbor_string * content ,
36- struct zcbor_string * manifest_component_id ,
37- struct suit_encryption_info * enc_info )
35+ bool suit_plat_write_domain_specific_is_type_supported (suit_component_type_t component_type )
36+ {
37+ #ifdef CONFIG_SUIT_STREAM
38+ /* Check if destination component type is supported */
39+ if (component_type == SUIT_COMPONENT_TYPE_MEM ) {
40+ return true;
41+ }
42+ #endif /* CONFIG_SUIT_STREAM */
43+
44+ return false;
45+ }
46+
47+ int suit_plat_check_write_domain_specific (suit_component_t dst_handle ,
48+ suit_component_type_t dst_component_type ,
49+ struct zcbor_string * content ,
50+ struct zcbor_string * manifest_component_id ,
51+ struct suit_encryption_info * enc_info )
3852{
3953#ifdef CONFIG_SUIT_STREAM
4054 struct stream_sink dst_sink ;
41- suit_component_type_t dst_component_type = SUIT_COMPONENT_TYPE_UNSUPPORTED ;
4255 suit_plat_err_t plat_ret = SUIT_PLAT_SUCCESS ;
4356 int ret = SUIT_SUCCESS ;
4457
@@ -50,16 +63,8 @@ int suit_plat_check_write(suit_component_t dst_handle, struct zcbor_string *cont
5063 return suit_plat_err_to_processor_err_convert (SUIT_PLAT_ERR_INVAL );
5164 }
5265
53- /* Get destination component type based on component handle*/
54- ret = suit_plat_component_type_get (dst_handle , & dst_component_type );
55- if (ret != SUIT_SUCCESS ) {
56- LOG_ERR ("Failed to decode destination component type" );
57- return ret ;
58- }
59-
6066 /* Check if destination component type is supported */
61- if ((dst_component_type != SUIT_COMPONENT_TYPE_MEM ) &&
62- (dst_component_type != SUIT_COMPONENT_TYPE_SOC_SPEC )) {
67+ if (dst_component_type != SUIT_COMPONENT_TYPE_MEM ) {
6368 LOG_ERR ("Unsupported destination component type" );
6469 return SUIT_ERR_UNSUPPORTED_COMPONENT_ID ;
6570 }
@@ -110,13 +115,14 @@ int suit_plat_check_write(suit_component_t dst_handle, struct zcbor_string *cont
110115#endif /* CONFIG_SUIT_STREAM */
111116}
112117
113- int suit_plat_write (suit_component_t dst_handle , struct zcbor_string * content ,
114- struct zcbor_string * manifest_component_id ,
115- struct suit_encryption_info * enc_info )
118+ int suit_plat_write_domain_specific (suit_component_t dst_handle ,
119+ suit_component_type_t dst_component_type ,
120+ struct zcbor_string * content ,
121+ struct zcbor_string * manifest_component_id ,
122+ struct suit_encryption_info * enc_info )
116123{
117124#ifdef CONFIG_SUIT_STREAM
118125 struct stream_sink dst_sink ;
119- suit_component_type_t dst_component_type = SUIT_COMPONENT_TYPE_UNSUPPORTED ;
120126 suit_plat_err_t plat_ret = SUIT_PLAT_SUCCESS ;
121127 int ret = SUIT_SUCCESS ;
122128
@@ -128,16 +134,8 @@ int suit_plat_write(suit_component_t dst_handle, struct zcbor_string *content,
128134 return suit_plat_err_to_processor_err_convert (SUIT_PLAT_ERR_INVAL );
129135 }
130136
131- /* Get destination component type based on component handle*/
132- ret = suit_plat_component_type_get (dst_handle , & dst_component_type );
133- if (ret != SUIT_SUCCESS ) {
134- LOG_ERR ("Failed to decode destination component type" );
135- return ret ;
136- }
137-
138137 /* Check if destination component type is supported */
139- if ((dst_component_type != SUIT_COMPONENT_TYPE_MEM ) &&
140- (dst_component_type != SUIT_COMPONENT_TYPE_SOC_SPEC )) {
138+ if (dst_component_type != SUIT_COMPONENT_TYPE_MEM ) {
141139 LOG_ERR ("Unsupported destination component type" );
142140 return SUIT_ERR_UNSUPPORTED_COMPONENT_ID ;
143141 }
0 commit comments