mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-24 15:02:55 +00:00
Use PSA_BITS_TO_BYTES macro to convert key bits to bytes
Signed-off-by: Przemyslaw Stekiel <przemyslaw.stekiel@mobica.com>
This commit is contained in:
parent
ae77b0ab28
commit
11a33e6d90
@ -56,9 +56,6 @@
|
|||||||
#include "mbedtls/oid.h"
|
#include "mbedtls/oid.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Convert key bits to byte size */
|
|
||||||
#define KEY_BYTES( bits ) ( ( (size_t) bits + 7 ) / 8 )
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
|
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
|
||||||
@ -1106,7 +1103,7 @@ static int ssl_tls12_populate_transform( mbedtls_ssl_transform *transform,
|
|||||||
|
|
||||||
if( ( status = psa_import_key( &attributes,
|
if( ( status = psa_import_key( &attributes,
|
||||||
key1,
|
key1,
|
||||||
KEY_BYTES( key_bits ),
|
PSA_BITS_TO_BYTES( key_bits ),
|
||||||
&transform->psa_key_enc ) ) != PSA_SUCCESS )
|
&transform->psa_key_enc ) ) != PSA_SUCCESS )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", status );
|
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", status );
|
||||||
@ -1114,7 +1111,7 @@ static int ssl_tls12_populate_transform( mbedtls_ssl_transform *transform,
|
|||||||
}
|
}
|
||||||
if( ( status = psa_import_key( &attributes,
|
if( ( status = psa_import_key( &attributes,
|
||||||
key2,
|
key2,
|
||||||
KEY_BYTES( key_bits ),
|
PSA_BITS_TO_BYTES( key_bits ),
|
||||||
&transform->psa_key_dec ) ) != PSA_SUCCESS )
|
&transform->psa_key_dec ) ) != PSA_SUCCESS )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", status );
|
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", status );
|
||||||
|
@ -31,10 +31,6 @@
|
|||||||
#include "ssl_misc.h"
|
#include "ssl_misc.h"
|
||||||
#include "ssl_tls13_keys.h"
|
#include "ssl_tls13_keys.h"
|
||||||
|
|
||||||
/* Convert key bits to byte size */
|
|
||||||
#define KEY_BYTES( bits ) ( ( (size_t) bits + 7 ) / 8 )
|
|
||||||
|
|
||||||
|
|
||||||
#define MBEDTLS_SSL_TLS1_3_LABEL( name, string ) \
|
#define MBEDTLS_SSL_TLS1_3_LABEL( name, string ) \
|
||||||
.name = string,
|
.name = string,
|
||||||
|
|
||||||
@ -937,7 +933,7 @@ int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform,
|
|||||||
|
|
||||||
if( ( status = psa_import_key( &attributes,
|
if( ( status = psa_import_key( &attributes,
|
||||||
key_enc,
|
key_enc,
|
||||||
KEY_BYTES( key_bits ),
|
PSA_BITS_TO_BYTES( key_bits ),
|
||||||
&transform->psa_key_enc ) ) != PSA_SUCCESS )
|
&transform->psa_key_enc ) ) != PSA_SUCCESS )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", status );
|
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", status );
|
||||||
@ -945,7 +941,7 @@ int mbedtls_ssl_tls13_populate_transform( mbedtls_ssl_transform *transform,
|
|||||||
}
|
}
|
||||||
if( ( status = psa_import_key( &attributes,
|
if( ( status = psa_import_key( &attributes,
|
||||||
key_dec,
|
key_dec,
|
||||||
KEY_BYTES( key_bits ),
|
PSA_BITS_TO_BYTES( key_bits ),
|
||||||
&transform->psa_key_dec ) ) != PSA_SUCCESS )
|
&transform->psa_key_dec ) ) != PSA_SUCCESS )
|
||||||
{
|
{
|
||||||
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", status );
|
MBEDTLS_SSL_DEBUG_RET( 1, "psa_import_key", status );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user