[Security] Problems using SDK CSEC Driver

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

[Security] Problems using SDK CSEC Driver

ソリューションへジャンプ
2,257件の閲覧回数
Gideon
Contributor III

Dear NXPs:

SDK CSEC Driver
csec_driver.h
csec_driver.c
csec_hw_access.c
csec_hw_access.h
I transplanted the SDK CSEC Driver to the normal project (without free RTOS) for use. The chip objects are S32K142 and S32K146. I found that the SDK CSEC Driver only used the OS timer for timeout processing, so my solution was to delete the OS part of the CSEC Driver C file, which met my needs.
The interface I plan to use is:
void CSEC_DRV_Init(csec_state_t *state);
void CSEC_DRV_Deinit(void);
status_t CSEC_DRV_EncryptCBC(csec_key_id_t keyId,
const uint8_t *plainText, uint32_t length,
const uint8_t *iv, uint8_t *cipherText, uint32_t timeout);
status_t CSEC_DRV_DecryptCBC(csec_key_id_t keyId, const uint8_t *cipherText,
uint32_t length, const uint8_t* iv, uint8_t *plainText, uint32_t timeout);
status_t CSEC_DRV_GenerateMAC(csec_key_id_t keyId, const uint8_t *msg,
uint32_t msgLen, uint8_t *cmac, uint32_t timeout);
status_t CSEC_DRV_GenerateMACAddrMode(csec_key_id_t keyId,
const uint8_t *msg, uint32_t msgLen, uint8_t *cmac);
status_t CSEC_DRV_VerifyMAC(csec_key_id_t keyId, const uint8_t *msg,
uint32_t msgLen, const uint8_t *mac, uint16_t macLen, bool *verifStatus,
uint32_t timeout);
status_t CSEC_DRV_VerifyMACAddrMode(csec_key_id_t keyId, const uint8_t *msg,
uint32_t msgLen, const uint8_t *mac, uint16_t macLen, bool *verifStatus);
status_t CSEC_DRV_LoadKey(csec_key_id_t keyId, const uint8_t *m1,
const uint8_t *m2, const uint8_t *m3, uint8_t *m4, uint8_t *m5);
status_t CSEC_DRV_BootFailure(void);
status_t CSEC_DRV_BootOK(void);
status_t CSEC_DRV_BootDefine(uint32_t bootSize, csec_boot_flavor_t bootFlavor);
static inline csec_status_t CSEC_DRV_GetStatus(void);
status_t CSEC_DRV_MPCompress(const uint8_t *msg, uint16_t msgLen,
uint8_t *mpCompress, uint32_t timeout);
Q:What I want to inquire about is transplanting the SDK CSEC Driver to the Normal project (142/146, no OS). Are there any potential risks? ?

0 件の賞賛
返信
1 解決策
2,148件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

You can find the manual here:
c:\NXP\S32DS.3.4\S32DS\software\S32SDK_S32K1XX_RTM_4.0.3\doc\S32SDK_S32K144_UserManual.pdf

No configuration is needed. If you have a project without FreeRTOS then baremetal version is selected automatically.

元の投稿で解決策を見る

0 件の賞賛
返信
3 返答(返信)
2,226件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

Hi @Gideon 

there's implementation of OSIF for both FreeRTOS and baremetal configuration. So, there's no problem even if you don't use FreeRTOS. Take a look at section "OS Interface (OSIF)" in SDK user manual.

lukaszadrapa_0-1713559726522.png

I can't see a reason to do such changes. 

And if SDK is not used ever, it's better to use code from AN5401.

Regards,

Lukas

 

0 件の賞賛
返信
2,188件の閲覧回数
Gideon
Contributor III

Dear NXPs:

Q1:Where can I view the document you sent a screenshot of?

Q2:Could you provide me with a baremetal configuration S32K14x CSEC driver?

0 件の賞賛
返信
2,149件の閲覧回数
lukaszadrapa
NXP TechSupport
NXP TechSupport

You can find the manual here:
c:\NXP\S32DS.3.4\S32DS\software\S32SDK_S32K1XX_RTM_4.0.3\doc\S32SDK_S32K144_UserManual.pdf

No configuration is needed. If you have a project without FreeRTOS then baremetal version is selected automatically.

0 件の賞賛
返信
%3CLINGO-SUB%20id%3D%22lingo-sub-1849608%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%5BSecurity%5D%20Problems%20using%20SDK%20CSEC%20Driver%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1849608%22%20slang%3D%22zh-CN%22%20mode%3D%22CREATE%22%3E%3CP%3ENXP%E3%81%AE%E7%9A%86%E6%A7%98%E3%81%B8%3A%3C%2FP%3E%3CP%3ESDK%20CSEC%20Driver%3CBR%20%2F%3Ecsec_driver.h%3CBR%20%2F%3Ecsec_driver.c%3CBR%20%2F%3Ecsec_hw_access.c%3CBR%20%2F%3Ecsec_hw_access.h%3CBR%20%2F%3EI%20transplanted%20the%20SDK%20CSEC%20Driver%20to%20the%20normal%20project%20(without%20free%20RTOS)%20for%20use.%20The%20chip%20objects%20are%20S32K142%20and%20S32K146.%20I%20found%20that%20the%20SDK%20CSEC%20Driver%20only%20used%20the%20OS%20timer%20for%20timeout%20processing%2C%20so%20my%20solution%20was%20to%20delete%20the%20OS%20part%20of%20the%20CSEC%20Driver%20C%20file%2C%20which%20met%20my%20needs.%3CBR%20%2F%3EThe%20interface%20I%20plan%20to%20use%20is%3A%3CBR%20%2F%3Evoid%20CSEC_DRV_Init(csec_state_t%20*state)%3B%3CBR%20%2F%3Evoid%20CSEC_DRV_Deinit(void)%3B%3CBR%20%2F%3Estatus_t%20CSEC_DRV_EncryptCBC(csec_key_id_t%20keyId%2C%3CBR%20%2F%3Econst%20uint8_t%20*plainText%2C%20uint32_t%20length%2C%3CBR%20%2F%3Econst%20uint8_t%20*iv%2C%20uint8_t%20*cipherText%2C%20uint32_t%20timeout)%3B%3CBR%20%2F%3Estatus_t%20CSEC_DRV_DecryptCBC(csec_key_id_t%20keyId%2C%20const%20uint8_t%20*cipherText%2C%3CBR%20%2F%3Euint32_t%20length%2C%20const%20uint8_t*%20iv%2C%20uint8_t%20*plainText%2C%20uint32_t%20timeout)%3B%3CBR%20%2F%3Estatus_t%20CSEC_DRV_GenerateMAC(csec_key_id_t%20keyId%2C%20const%20uint8_t%20*msg%2C%3CBR%20%2F%3Euint32_t%20msgLen%2C%20uint8_t%20*cmac%2C%20uint32_t%20timeout)%3B%3CBR%20%2F%3Estatus_t%20CSEC_DRV_GenerateMACAddrMode(csec_key_id_t%20keyId%2C%3CBR%20%2F%3Econst%20uint8_t%20*msg%2C%20uint32_t%20msgLen%2C%20uint8_t%20*cmac)%3B%3CBR%20%2F%3Estatus_t%20CSEC_DRV_VerifyMAC(csec_key_id_t%20keyId%2C%20const%20uint8_t%20*msg%2C%3CBR%20%2F%3Euint32_t%20msgLen%2C%20const%20uint8_t%20*mac%2C%20uint16_t%20macLen%2C%20bool%20*verifStatus%2C%3CBR%20%2F%3Euint32_t%20timeout)%3B%3CBR%20%2F%3Estatus_t%20CSEC_DRV_VerifyMACAddrMode(csec_key_id_t%20keyId%2C%20const%20uint8_t%20*msg%2C%3CBR%20%2F%3Euint32_t%20msgLen%2C%20const%20uint8_t%20*mac%2C%20uint16_t%20macLen%2C%20bool%20*verifStatus)%3B%3CBR%20%2F%3Estatus_t%20CSEC_DRV_LoadKey(csec_key_id_t%20keyId%2C%20const%20uint8_t%20*m1%2C%3CBR%20%2F%3Econst%20uint8_t%20*m2%2C%20const%20uint8_t%20*m3%2C%20uint8_t%20*m4%2C%20uint8_t%20*m5)%3B%3CBR%20%2F%3Estatus_t%20CSEC_DRV_BootFailure(void)%3B%3CBR%20%2F%3Estatus_t%20CSEC_DRV_BootOK(void)%3B%3CBR%20%2F%3Estatus_t%20CSEC_DRV_BootDefine(uint32_t%20bootSize%2C%20csec_boot_flavor_t%20bootFlavor)%3B%3CBR%20%2F%3Estatic%20inline%20csec_status_t%20CSEC_DRV_GetStatus(void)%3B%3CBR%20%2F%3Estatus_t%20CSEC_DRV_MPCompress(const%20uint8_t%20*msg%2C%20uint16_t%20msgLen%2C%3CBR%20%2F%3Euint8_t%20*mpCompress%2C%20uint32_t%20timeout)%3B%3CBR%20%2F%3EQ%EF%BC%9AWhat%20I%20want%20to%20inquire%20about%20is%20transplanting%20the%20SDK%20CSEC%20Driver%20to%20the%20Normal%20project%20(142%2F146%2C%20no%20OS).%20Are%20there%20any%20potential%20risks%3F%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1852097%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%5B%E3%82%BB%E3%82%AD%E3%83%A5%E3%83%AA%E3%83%86%E3%82%A3%5DSDK%20CSEC%E3%83%89%E3%83%A9%E3%82%A4%E3%83%90%E3%83%BC%E3%81%AE%E4%BD%BF%E7%94%A8%E3%81%AB%E9%96%A2%E3%81%99%E3%82%8B%E5%95%8F%E9%A1%8C%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1852097%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3E%E3%83%9E%E3%83%8B%E3%83%A5%E3%82%A2%E3%83%AB%E3%81%AF%E3%81%93%E3%81%A1%E3%82%89%E3%81%8B%E3%82%89%E3%81%94%E8%A6%A7%E3%81%84%E3%81%9F%E3%81%A0%E3%81%91%E3%81%BE%E3%81%99%E3%80%82%3CBR%20%2F%3Ec%3A%5C%20NXP%20%5C%20S32DS.3.4%20%5C%20S32DS%20%5C%E3%82%BD%E3%83%95%E3%83%88%E3%82%A6%E3%82%A7%E3%82%A2%5CS32SDK_S32K1XX_RTM_4.0.3%20%5C%20doc%5CS32SDK_S32K144_UserManual.pdf%3C%2FP%3E%0A%3CP%3E%E8%A8%AD%E5%AE%9A%E3%81%AF%E5%BF%85%E8%A6%81%E3%81%82%E3%82%8A%E3%81%BE%E3%81%9B%E3%82%93%E3%80%82FreeRTOS%20%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%AA%E3%81%84%E3%83%97%E3%83%AD%E3%82%B8%E3%82%A7%E3%82%AF%E3%83%88%E3%81%8C%E3%81%82%E3%82%8B%E5%A0%B4%E5%90%88%E3%81%AF%E3%80%81%E3%83%99%E3%82%A2%E3%83%A1%E3%82%BF%E3%83%AB%20%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3%E3%81%8C%E8%87%AA%E5%8B%95%E7%9A%84%E3%81%AB%E9%81%B8%E6%8A%9E%E3%81%95%E3%82%8C%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1850943%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3ERe%3A%5B%E3%82%BB%E3%82%AD%E3%83%A5%E3%83%AA%E3%83%86%E3%82%A3%5DSDK%20CSEC%E3%83%89%E3%83%A9%E3%82%A4%E3%83%90%E3%83%BC%E3%81%AE%E4%BD%BF%E7%94%A8%E3%81%AB%E9%96%A2%E3%81%99%E3%82%8B%E5%95%8F%E9%A1%8C%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1850943%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%20%3CA%20href%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F218898%22%20target%3D%22_blank%22%3E%40Gideon%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFreeRTOS%20%E3%81%A8%E3%83%99%E3%82%A2%E3%83%A1%E3%82%BF%E3%83%AB%E8%A8%AD%E5%AE%9A%E3%81%AE%E4%B8%A1%E6%96%B9%E3%81%AB%20OSIF%20%E3%81%8C%E5%AE%9F%E8%A3%85%E3%81%95%E3%82%8C%E3%81%A6%E3%81%84%E3%81%BE%E3%81%99%E3%80%82%E3%81%9D%E3%81%AE%E3%81%9F%E3%82%81%E3%80%81FreeRTOS%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%AA%E3%81%8F%E3%81%A6%E3%82%82%E5%95%8F%E9%A1%8C%E3%81%82%E3%82%8A%E3%81%BE%E3%81%9B%E3%82%93%E3%80%82SDK%E3%83%A6%E3%83%BC%E3%82%B6%E3%83%BC%E3%83%9E%E3%83%8B%E3%83%A5%E3%82%A2%E3%83%AB%E3%81%AE%E3%80%8COS%E3%82%A4%E3%83%B3%E3%82%BF%E3%83%BC%E3%83%95%E3%82%A7%E3%83%BC%E3%82%B9(OSIF)%E3%80%8D%E3%81%AE%E3%82%BB%E3%82%AF%E3%82%B7%E3%83%A7%E3%83%B3%E3%82%92%E3%81%94%E8%A6%A7%E3%81%8F%E3%81%A0%E3%81%95%E3%81%84%E3%80%82%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22lukaszadrapa_0-1713559726522.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cspan%20class%3D%22lia-inline-image-display-wrapper%22%20image-alt%3D%22lukaszadrapa_0-1713559726522.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3Cimg%20src%3D%22https%3A%2F%2Fcommunity.nxp.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F274794i593B225734045E9F%2Fimage-size%2Fmedium%3Fv%3Dv2%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22lukaszadrapa_0-1713559726522.png%22%20alt%3D%22lukaszadrapa_0-1713559726522.png%22%20%2F%3E%3C%2Fspan%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%E3%81%9D%E3%81%AE%E3%82%88%E3%81%86%E3%81%AA%E5%A4%89%E6%9B%B4%E3%82%92%E8%A1%8C%E3%81%86%E7%90%86%E7%94%B1%E3%81%8C%E8%A6%8B%E5%BD%93%E3%81%9F%E3%82%8A%E3%81%BE%E3%81%9B%E3%82%93%E3%80%82%3C%2FP%3E%0A%3CP%3E%E3%81%BE%E3%81%9F%E3%80%81SDK%E3%82%92%E4%B8%80%E5%BA%A6%E3%82%82%E4%BD%BF%E7%94%A8%E3%81%97%E3%81%AA%E3%81%84%E5%A0%B4%E5%90%88%E3%81%AF%E3%80%81AN5401%E3%81%AE%E3%82%B3%E3%83%BC%E3%83%89%E3%82%92%E4%BD%BF%E7%94%A8%E3%81%99%E3%82%8B%E3%81%93%E3%81%A8%E3%82%92%E3%81%8A%E5%8B%A7%E3%82%81%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%0A%3CP%3E%E3%82%88%E3%82%8D%E3%81%97%E3%81%8F%E3%81%8A%E9%A1%98%E3%81%84%E3%81%97%E3%81%BE%E3%81%99%E3%80%82%3C%2FP%3E%0A%3CP%3ELukas%3C%2FP%3E%0A%3CBR%20%2F%3E%3C%2FLINGO-BODY%3E