From ad16ee68b189a36955c586959a9d157dff75b998 Mon Sep 17 00:00:00 2001 From: Jaroslaw Stelter Date: Mon, 15 Jan 2024 11:16:32 +0100 Subject: [PATCH] lnl: conf: Enable library authentication on LNL This enables library authentication on LNL platforms. Signed-off-by: Jaroslaw Stelter --- app/boards/intel_adsp_ace20_lnl.conf | 1 + src/library_manager/lib_manager.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/app/boards/intel_adsp_ace20_lnl.conf b/app/boards/intel_adsp_ace20_lnl.conf index 2d45466913a4..fa9acb84d377 100644 --- a/app/boards/intel_adsp_ace20_lnl.conf +++ b/app/boards/intel_adsp_ace20_lnl.conf @@ -33,6 +33,7 @@ CONFIG_DMA=y CONFIG_DMA_INTEL_ADSP_GPDMA=n CONFIG_INTEL_MODULES=y CONFIG_LIBRARY_MANAGER=y +CONFIG_LIBRARY_AUTH_SUPPORT=y CONFIG_INTEL_ADSP_TIMER=y CONFIG_MM_DRV_INTEL_ADSP_TLB_REMAP_UNUSED_RAM=y CONFIG_AMS=y diff --git a/src/library_manager/lib_manager.c b/src/library_manager/lib_manager.c index 85a2d792ec4f..636a814c0e89 100644 --- a/src/library_manager/lib_manager.c +++ b/src/library_manager/lib_manager.c @@ -97,7 +97,7 @@ static int lib_manager_auth_proc(const void *buffer_data, if (ret != 0) { tr_err(&lib_manager_tr, "lib_manager_auth_proc() failed with error: %d", ret); - return -EACCES; + return -ENOTSUP; } /* The auth_api_busy() will timeouts internally in case of failure */ @@ -108,7 +108,7 @@ static int lib_manager_auth_proc(const void *buffer_data, if (ret != AUTH_IMAGE_TRUSTED) { tr_err(&lib_manager_tr, "lib_manager_auth_proc() Untrasted library!"); - return -ENOTSUP; + return -EACCES; } if (phase == AUTH_PHASE_LAST) @@ -653,8 +653,10 @@ static int lib_manager_store_library(struct lib_manager_dma_ext *dma_ext, /* AUTH_PHASE_FIRST - checks library manifest only. */ ret = lib_manager_auth_proc((__sparse_cache void *)man_buffer, MAN_MAX_SIZE_V1_8, AUTH_PHASE_FIRST); - if (ret < 0) + if (ret < 0) { + rfree((__sparse_force void *)library_base_address); return ret; + } #endif /* CONFIG_LIBRARY_AUTH_SUPPORT */ /* Copy data from temp_mft_buf to destination memory (pointed by library_base_address) */ @@ -673,8 +675,10 @@ static int lib_manager_store_library(struct lib_manager_dma_ext *dma_ext, /* AUTH_PHASE_LAST - do final library authentication checks */ ret = lib_manager_auth_proc((__sparse_cache void *)library_base_address, preload_size - MAN_MAX_SIZE_V1_8, AUTH_PHASE_LAST); - if (ret < 0) + if (ret < 0) { + rfree((__sparse_force void *)library_base_address); return ret; + } #endif /* CONFIG_LIBRARY_AUTH_SUPPORT */ /* Now update sof context with new library */