Skip to content
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

Remove deprecated error codes #4283

Closed
mpg opened this issue Apr 1, 2021 · 3 comments · Fixed by #4339
Closed

Remove deprecated error codes #4283

mpg opened this issue Apr 1, 2021 · 3 comments · Fixed by #4339
Assignees
Labels
enhancement good-first-issue Good for newcomers size-s Estimated task size: small (~2d)

Comments

@mpg
Copy link
Contributor

mpg commented Apr 1, 2021

Remove deprecated error codes, which can be found using `git grep -i 'MBEDTLS_ERR.*deprecated'.

Normally, those codes are already no longer used in the library, programs and test, and only their definition remains, which should be removed. However there are a few exceptions:

  • library/error.c uses them but it's generated, so it just needs to be re-generated after updating the header files
  • library/psa_crypto.c uses them in a large switch statement in mbedtls_to_psa_error(): the corresponding cases need to be removed
  • include/mbedtls/error.h documents the ranges used by each module and might need to be updated
@mpg mpg added enhancement good-first-issue Good for newcomers mbedtls-3 size-s Estimated task size: small (~2d) labels Apr 1, 2021
@mpg mpg added this to Incoming Items in OBSOLETE - SEE https://github.com/orgs/Mbed-TLS/projects/3 via automation Apr 1, 2021
@laumor01 laumor01 moved this from Incoming Items to May Sprint in OBSOLETE - SEE https://github.com/orgs/Mbed-TLS/projects/3 Apr 7, 2021
@TRodziewicz TRodziewicz self-assigned this Apr 12, 2021
@TRodziewicz
Copy link
Contributor

TRodziewicz commented Apr 12, 2021

In this task MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED has been deprecated but it's still used in active (?) code in a switch/case as a default: return value and some other places. What to use here instead?

file cipher.c, from line 322:

switch( status )
{
    case PSA_SUCCESS:
        break;
    case PSA_ERROR_INSUFFICIENT_MEMORY:
        return( MBEDTLS_ERR_CIPHER_ALLOC_FAILED );
    case PSA_ERROR_NOT_SUPPORTED:
        return( MBEDTLS_ERR_CIPHER_FEATURE_UNAVAILABLE );
    default:
        return( MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED ); // <----???
}

same file, from line 1246:

if( status != PSA_SUCCESS )
	return( MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED );

status = psa_cipher_set_iv( &cipher_op, iv, iv_len );
if( status != PSA_SUCCESS )
	return( MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED );

status = psa_cipher_update( &cipher_op, input, ilen, output, ilen, olen );
if( status != PSA_SUCCESS )
	return( MBEDTLS_ERR_CIPHER_HW_ACCEL_FAILED );

status = psa_cipher_finish( &cipher_op, output + *olen, ilen - *olen, &part_len );
if( status != PSA_SUCCESS )
	return( 0 );

The same question is with MBEDTLS_ERR_MD_HW_ACCEL_FAILED, MBEDTLS_ERR_PK_HW_ACCEL_FAILED, MBEDTLS_ERR_RSA_UNSUPPORTED_OPERATION (in test_suite_rsa.function).

@gilles-peskine-arm
Copy link
Contributor

gilles-peskine-arm commented Apr 12, 2021

Use MBEDTLS_ERR_PLATFORM_HW_ACCEL_FAILED instead of other MBEDTLS_ERR_xxx_HW_ACCEL_FAILED. Likewise with MBEDTLS_ERR_PLATFORM_FEATURE_UNSUPPORTED.

@TRodziewicz
Copy link
Contributor

This issue has been fixed by #4339 so it can be closed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement good-first-issue Good for newcomers size-s Estimated task size: small (~2d)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants