Fix key attributes encrypt or decrypt only (not both)
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
dd7b501c92
commit
fe7397d8a7
2 changed files with 8 additions and 2 deletions
|
@ -1097,7 +1097,7 @@ static int ssl_tls12_populate_transform( mbedtls_ssl_transform *transform,
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT );
|
psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
|
||||||
psa_set_key_algorithm( &attributes, alg );
|
psa_set_key_algorithm( &attributes, alg );
|
||||||
|
|
||||||
transform->psa_alg = alg;
|
transform->psa_alg = alg;
|
||||||
|
@ -1111,6 +1111,9 @@ static int ssl_tls12_populate_transform( mbedtls_ssl_transform *transform,
|
||||||
ret = psa_status_to_mbedtls( status );
|
ret = psa_status_to_mbedtls( status );
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DECRYPT );
|
||||||
|
|
||||||
if( ( status = psa_import_key( &attributes,
|
if( ( status = psa_import_key( &attributes,
|
||||||
key2,
|
key2,
|
||||||
PSA_BITS_TO_BYTES( key_bits ),
|
PSA_BITS_TO_BYTES( key_bits ),
|
||||||
|
|
|
@ -932,7 +932,7 @@ int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform,
|
||||||
return( psa_status_to_mbedtls( status ) );
|
return( psa_status_to_mbedtls( status ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT | PSA_KEY_USAGE_DECRYPT );
|
psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_ENCRYPT );
|
||||||
psa_set_key_algorithm( &attributes, alg );
|
psa_set_key_algorithm( &attributes, alg );
|
||||||
|
|
||||||
transform->psa_alg = alg;
|
transform->psa_alg = alg;
|
||||||
|
@ -945,6 +945,9 @@ int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform,
|
||||||
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", psa_status_to_mbedtls( status ) );
|
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", psa_status_to_mbedtls( status ) );
|
||||||
return( psa_status_to_mbedtls( status ) );
|
return( psa_status_to_mbedtls( status ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
psa_set_key_usage_flags( &attributes, PSA_KEY_USAGE_DECRYPT );
|
||||||
|
|
||||||
if( ( status = psa_import_key( &attributes,
|
if( ( status = psa_import_key( &attributes,
|
||||||
key_dec,
|
key_dec,
|
||||||
PSA_BITS_TO_BYTES( key_bits ),
|
PSA_BITS_TO_BYTES( key_bits ),
|
||||||
|
|
Loading…
Reference in a new issue