Bug with Hashcrypt on LPC55S06

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Bug with Hashcrypt on LPC55S06

69 Views
s_hdl
Contributor I

Hello, 
I encounter an infinite loop in my attempt to use Hashcrypt HW acceleration. 
The Hashcrypt driver version is 2.2.17. The microcontroller get stuck at the line 679 in hashcrypt_sha_one_block() : 

while (0U == (base->STATUS & HASHCRYPT_STATUS_WAITING_MASK))

    {

//stuck here

    }

Surprisingly, it appears to be stuck after 90 executions (our microcontroller manages to perform 89 times hashcrypt_sha_one_block without being stuck).

The main call is done by embedTLS ssl_tls.c file (see err.png).

 

Here is my current implementation of mbedtls_sha256_finish() (that I needed to implement by defining the SHA256_ALT when building mbedTLS v3.6.7

int mbedtls_sha256_finish(mbedtls_sha256_context *ctx,unsigned char *output)

{

status_t status;

status = HASHCRYPT_SHA_Finish(

HASHCRYPT,

(hashcrypt_hash_ctx_t *)ctx->hash,

output,

NULL);

return status;

}



Our code is bare metal, we don't have different processes. 

Thank you very much for your help.

 

Regards,

Harold

0 Kudos
Reply
0 Replies
%3CLINGO-SUB%20id%3D%22lingo-sub-2416367%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3EBug%20with%20Hashcrypt%20on%20LPC55S06%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2416367%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHello%2C%26nbsp%3B%3CBR%20%2F%3EI%20encounter%20an%20infinite%20loop%20in%20my%20attempt%20to%20use%20Hashcrypt%20HW%20acceleration.%26nbsp%3B%3CBR%20%2F%3EThe%20Hashcrypt%20driver%20version%20is%26nbsp%3B%3CSPAN%3E2.2.17.%20The%20microcontroller%20get%20stuck%20at%20the%20line%20679%20in%26nbsp%3B%3CSTRONG%3Ehashcrypt_sha_one_block%3C%2FSTRONG%3E()%20%3A%26nbsp%3B%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSTRONG%3Ewhile%3C%2FSTRONG%3E%3C%2FSPAN%3E%20(0U%20%3D%3D%20(base-%26gt%3BSTATUS%20%26amp%3B%20HASHCRYPT_STATUS_WAITING_MASK))%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%3C%2FP%3E%3CP%3E%2F%2Fstuck%20here%3C%2FP%3E%3CP%3E%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%3C%2FP%3E%3CP%3ESurprisingly%2C%20it%20appears%20to%20be%20stuck%20after%2090%20executions%20(our%20microcontroller%20manages%20to%20perform%2089%20times%26nbsp%3B%3CSPAN%3E%3CSTRONG%3Ehashcrypt_sha_one_block%26nbsp%3B%3C%2FSTRONG%3Ewithout%20being%20stuck).%3CBR%20%2F%3E%3CBR%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EThe%20main%20call%20is%20done%20by%20embedTLS%20ssl_tls.c%20file%20(see%20err.png).%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3EHere%20is%20my%20current%20implementation%20of%20mbedtls_sha256_finish()%20(that%20I%20needed%20to%20implement%20by%20defining%20the%20SHA256_ALT%20when%20building%20mbedTLS%20v3.6.7%3C%2FSPAN%3E%3C%2FP%3E%3CDIV%3E%3CDIV%3E%3CP%3E%3CSPAN%3Eint%3C%2FSPAN%3E%20%3CSPAN%3Embedtls_sha256_finish%3C%2FSPAN%3E%3CSPAN%3E(%3C%2FSPAN%3E%3CSPAN%3Embedtls_sha256_context%3C%2FSPAN%3E%20%3CSPAN%3E*%3C%2FSPAN%3E%3CSPAN%3Ectx%3C%2FSPAN%3E%3CSPAN%3E%2C%3C%2FSPAN%3E%3CSPAN%3Eunsigned%3C%2FSPAN%3E%20%3CSPAN%3Echar%3C%2FSPAN%3E%20%3CSPAN%3E*%3C%2FSPAN%3E%3CSPAN%3Eoutput%3C%2FSPAN%3E%3CSPAN%3E)%3C%2FSPAN%3E%3C%2FP%3E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BR%20%2F%3EThank%20you%20very%20much%20for%20your%20help.%3C%2FSPAN%3E%3C%2FP%3E%3CBR%20%2F%3E%3CP%3E%3CSPAN%3ERegards%2C%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3EHarold%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E