Page MenuHomePhabricator

Cryptocell CC312 does not work on Nordic nRF5340
Open, Needs TriagePublic

Description

Upon enabling the cc312 crytocell and running the bl2 image, it gets stuck in a loop waiting for the busy flag of the cc312 to change as per:

#0  0x000068f4 in ProcessHashDrv (pCtx=pCtx@entry=0x20005668, pInputBuffInfo=pInputBuffInfo@entry=0x20005580,
    dataInSize=dataInSize@entry=256)
    at ../lib/ext/cryptocell-312-runtime/codesafe/src/crypto_api/cc3x_sym/driver/hash_driver.c:146
#1  0x000065d0 in mbedtls_hashUpdate (pHashUserCtx=0x20005668, pDataIn=0x20002600 <tmpbuf> "=¸ó-", dataInSize=256)
    at ../lib/ext/cryptocell-312-runtime/codesafe/src/mbedtls_api/mbedtls_hash_common.c:72
#2  0x00006732 in mbedtls_sha_update_internal (ctx=<optimized out>, input=<optimized out>, ilen=<optimized out>)
    at ../lib/ext/cryptocell-312-runtime/codesafe/src/mbedtls_api/mbedtls_hash_common.c:200
#3  0x0000590a in mbedtls_sha256_update_ret (ctx=<optimized out>, input=<optimized out>, ilen=<optimized out>)
    at ../lib/ext/cryptocell-312-runtime/codesafe/src/mbedtls_api/sha256_alt.c:91
#4  0x0000400e in bootutil_sha256_update (ctx=0x20005668, data=0x20002600 <tmpbuf>, data_len=256)
    at lib/ext/mcuboot-src/boot/bootutil/include/bootutil/crypto/sha256.h:73
#5  0x00004122 in bootutil_img_hash (enc_state=0x0 <CC_LibInit>, image_index=0, hdr=0x20002564 <boot_data+44>,
    fap=0xb9ec <flash_map+16>, tmp_buf=0x20002600 <tmpbuf> "=¸ó-", tmp_buf_sz=256,
    hash_result=0x200057b4 "\fo\002oõðÚ&\005\020ƒ¹'\177´ùb", seed=0x0 <CC_LibInit>, seed_len=0)
    at lib/ext/mcuboot-src/boot/bootutil/src/image_validate.c:151
#6  0x00004388 in bootutil_img_validate (enc_state=0x0 <CC_LibInit>, image_index=0, hdr=0x20002564 <boot_data+44>,
    fap=0xb9ec <flash_map+16>, tmp_buf=0x20002600 <tmpbuf> "=¸ó-", tmp_buf_sz=256, seed=0x0 <CC_LibInit>, seed_len=0,
    out_hash=0x0 <CC_LibInit>) at lib/ext/mcuboot-src/boot/bootutil/src/image_validate.c:361
#7  0x000010da in boot_image_check (state=0x20002538 <boot_data>, hdr=0x20002564 <boot_data+44>,
    fap=0xb9ec <flash_map+16>, bs=0x20005c44) at lib/ext/mcuboot-src/boot/bootutil/src/loader.c:419

It is waiting at CC_HAL_WAIT_ON_CRYPTO_BUSY();

The cryptocell does not get enabled by default, so I've added the code to do that to the boot hal code and can confirm the enabled bit is set, however it still does not progress from this point.

The hardware being tested is a Nordic nRF5340 module which has the cc312 crytocell hardware as per the datasheet.

Event Timeline

lairdjm created this task.Tue, Apr 6, 8:56 AM