-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modify HW accelerator drivers to new error code #8643
Modify HW accelerator drivers to new error code #8643
Conversation
68ddf50
to
0d8e466
Compare
@RonEld Is ARMmbed/mbed-os-example-tls#211 needed to put this through CI, or is the label just indicating that it should go in first? |
@Patater @sbutcher-arm When y'all get a chance for a review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to rename the error codes from the deprecated one to the new on
@@ -146,7 +147,7 @@ int convert_CrysError_to_mbedtls_err( CRYSError_t Crys_err ) | |||
return ( MBEDTLS_ERR_ECP_INVALID_KEY ); | |||
|
|||
default: | |||
return ( MBEDTLS_ERR_ECP_HW_ACCEL_FAILED ); | |||
return ( MBEDTLS_ERR_PLATFORM_HW_FAILED ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED
@@ -122,7 +122,7 @@ uint32_t convert_mbedtls_to_cc_rand( void* mbedtls_rand, uint16_t outSizeBytes, | |||
* | |||
* | |||
* \return \c The corresponding Mbed TLS error, | |||
* MBEDTLS_ERR_ECP_HW_ACCEL_FAILED as default, if none found | |||
* MBEDTLS_ERR_PLATFORM_HW_FAILED as default, if none found |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED
@@ -93,7 +93,7 @@ int mbedtls_ccm_encrypt_and_tag( mbedtls_ccm_context *ctx, size_t length, | |||
CrysRet = CRYS_AESCCM( SASI_AES_ENCRYPT, ctx->cipher_key, ctx->keySize_ID,(uint8_t*)iv, iv_len, | |||
(uint8_t*)add, add_len, (uint8_t*)input, length, output, tag_len, tag ); | |||
if( CrysRet != CRYS_OK ) | |||
return ( MBEDTLS_ERR_CCM_HW_ACCEL_FAILED ); | |||
return ( MBEDTLS_ERR_PLATFORM_HW_FAILED ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED
@@ -130,7 +130,7 @@ int mbedtls_ccm_auth_decrypt( mbedtls_ccm_context *ctx, size_t length, | |||
CrysRet = CRYS_AESCCM( SASI_AES_DECRYPT, ctx->cipher_key, ctx->keySize_ID,(uint8_t*)iv, iv_len, | |||
(uint8_t*)add, add_len, (uint8_t*)input, length, output, tag_len, (uint8_t*)tag ); | |||
if ( CrysRet != CRYS_OK ) | |||
return ( MBEDTLS_ERR_CCM_HW_ACCEL_FAILED ); | |||
return ( MBEDTLS_ERR_PLATFORM_HW_FAILED ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED
@@ -47,7 +47,7 @@ void mbedtls_sha1_clone( mbedtls_sha1_context *dst, | |||
int mbedtls_sha1_starts_ret( mbedtls_sha1_context *ctx ) | |||
{ | |||
if( CRYS_HASH_Init( &ctx->crys_hash_ctx, CRYS_HASH_SHA1_mode ) != CRYS_OK ) | |||
return ( MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED ); | |||
return ( MBEDTLS_ERR_PLATFORM_HW_FAILED ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED
} | ||
|
||
int mbedtls_internal_sha1_process( mbedtls_sha1_context *ctx, | ||
const unsigned char data[64] ) | ||
{ | ||
if( CRYS_HASH_Update( &ctx->crys_hash_ctx, (uint8_t*)data, 64 ) != CRYS_OK ) | ||
return ( MBEDTLS_ERR_SHA1_HW_ACCEL_FAILED ); | ||
return ( MBEDTLS_ERR_PLATFORM_HW_FAILED ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED
@@ -47,15 +47,15 @@ int mbedtls_sha256_starts_ret( mbedtls_sha256_context *ctx, int is224 ) | |||
{ | |||
if(CRYS_HASH_Init( &ctx->crys_hash_ctx, is224 ? | |||
CRYS_HASH_SHA224_mode : CRYS_HASH_SHA256_mode ) != CRYS_OK ) | |||
return ( MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED ); | |||
return ( MBEDTLS_ERR_PLATFORM_HW_FAILED ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED
return ( 0 ); | ||
} | ||
|
||
int mbedtls_internal_sha256_process( mbedtls_sha256_context *ctx, | ||
const unsigned char data[64] ) | ||
{ | ||
if( CRYS_HASH_Update( &ctx->crys_hash_ctx, (uint8_t*)data, 64 ) != CRYS_OK ) | ||
return ( MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED ); | ||
return ( MBEDTLS_ERR_PLATFORM_HW_FAILED ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED
@@ -64,7 +64,7 @@ int mbedtls_sha256_update_ret( mbedtls_sha256_context *ctx, | |||
size_t ilen ) | |||
{ | |||
if( CRYS_HASH_Update( &ctx->crys_hash_ctx, (uint8_t*)input, ilen ) != CRYS_OK ) | |||
return ( MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED ); | |||
return ( MBEDTLS_ERR_PLATFORM_HW_FAILED ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED
@@ -80,7 +80,7 @@ int mbedtls_sha256_finish_ret( mbedtls_sha256_context *ctx, | |||
return ( 0 ); | |||
} | |||
else | |||
return ( MBEDTLS_ERR_SHA256_HW_ACCEL_FAILED ); | |||
return ( MBEDTLS_ERR_PLATFORM_HW_FAILED ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED
@cmonr ARMmbed/mbed-os-example-tls#211 is dependent on this PR for the test to pass,( and Mbed-TLS/mbedtls#2054 for the build to pass ), so I guess we can pass it through CI This PR is dependent on Mbed-TLS/mbedtls#2054 to build, however, since 2054 has changed, and is not as strict as it was before ( previously it removed the old error codes, now it mostly adds error codes), this PR will not fix any build failures, once the new Mbed TLS release will be merged, but it only improves to the correct implementation. The label "needs: preceding PR" for this PR, is that it requires Mbed-TLS/mbedtls#2054 to be merged to Mbed TLS, and for the Mbed TLS release to be merged into Mbed OS. BTW, I noticed a few mistakes in this Pr, since we deprecated an error code. I will amend my commit |
Have the HW accelearation drivers return the platform module errors about feature unsupported, and hw acceleration failure, because the moduel specific errors will be removed.
0d8e466
to
9f4e752
Compare
I amended my previous commit to fix the comments I added. @cmonr Do you think we should have the partners review the relevant changes to their drivers? |
@RonEld I would think so, but this is also only a one line change, so I'm not entirely sure. @MarceloSalazar @ashok-rao @screamerbg Thoughts? How much code changes to a partner's code can be made before they should be brought into the loop? |
It looks like a minor but breaking change. IMO should go to 5.11.0 |
@Patater @sbutcher-arm This has been waiting on review for 9 days could you please take a look asap? |
Reminder @Patater @sbutcher-arm This has been waiting on review for 13 days could you please take a look asap? |
To summarize (I reread the thread to understand again why preceding PR is still valid):
This is waiting for Mbed TLS version update. Plus reviewers approvals. |
Yes. This PR uses error codes that will be introduced only after the Mbed TLS update. If this PR will get merged earlier, build will break for these targets. |
While we are waiting for preceding PR, can reviewers proceed with reviews please? |
Restarting CI |
Test run: SUCCESSSummary: 4 of 4 test jobs passed |
I am not sure why the CI failed, but I don't expect the build to succeed on several platforms, as the changes uses error codes that will be introduced only after Mbed TLS is updated |
It was triggered automatically. We will wait until the preceding PR goes in |
Sure no problem, it is just strange to me how the build succeeded. |
@OPpuolitaival can you review ^^ |
Since #8859 has been merged, we can remove the "needs:preceding PR" label. @0xc0170 @cmonr @NirSonnenschein Can we start the CI? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me
@RonEld : yes, removing preceding PR is fine. |
Test run: SUCCESSSummary: 4 of 4 test jobs passed |
Description
Have the HW accelearation drivers return the platform module
errors about feature unsupported, and hw acceleration failure,
because the moduel specific errors will be removed.
Pending Mbed-TLS/mbedtls#2054 to be merged to the Mbed TLS repository, and for Mbed TLS to be updated in Mbed OS
CC @Patater @sbutcher-arm
Pull request type