Normalize whitespace to Mbed TLS standards

Only whitespace changes in this commit.
This commit is contained in:
Gilles Peskine 2018-06-08 16:09:36 +02:00 committed by itayzafrir
parent 1c2a7ea4e2
commit 61b91d4476
2 changed files with 95 additions and 98 deletions

View file

@ -1203,7 +1203,9 @@ psa_status_t psa_mac_verify( psa_mac_operation_t *operation,
/* Asymmetric cryptography */
/****************************************************************/
static psa_status_t verify_RSA_hash_input_and_get_md_type(psa_algorithm_t alg, size_t hash_length, mbedtls_md_type_t *md_alg)
static psa_status_t verify_RSA_hash_input_and_get_md_type( psa_algorithm_t alg,
size_t hash_length,
mbedtls_md_type_t *md_alg )
{
psa_algorithm_t hash_alg = PSA_ALG_RSA_GET_HASH( alg );
const mbedtls_md_info_t *md_info = mbedtls_md_info_from_psa( hash_alg );
@ -1222,11 +1224,9 @@ static psa_status_t verify_RSA_hash_input_and_get_md_type(psa_algorithm_t alg, s
if( md_info == NULL )
return( PSA_ERROR_NOT_SUPPORTED );
}
return PSA_SUCCESS;
return( PSA_SUCCESS );
}
psa_status_t psa_asymmetric_sign( psa_key_slot_t key,
psa_algorithm_t alg,
const uint8_t *hash,
@ -1243,7 +1243,6 @@ psa_status_t psa_asymmetric_sign(psa_key_slot_t key,
(void) salt;
(void) salt_length;
if( key == 0 || key > MBEDTLS_PSA_KEY_SLOT_COUNT )
return( PSA_ERROR_EMPTY_SLOT );
slot = &global_data.key_slots[key];
@ -1263,7 +1262,7 @@ psa_status_t psa_asymmetric_sign(psa_key_slot_t key,
status = verify_RSA_hash_input_and_get_md_type( alg, hash_length,
&md_alg );
if( status != PSA_SUCCESS )
return status;
return( status );
if( signature_size < rsa->len )
return( PSA_ERROR_BUFFER_TOO_SMALL );
@ -1315,7 +1314,8 @@ psa_status_t psa_asymmetric_sign(psa_key_slot_t key,
md_info = mbedtls_md_info_from_psa( alg );
md_alg = mbedtls_md_get_type( md_info );
ret = mbedtls_ecdsa_write_signature( ecdsa, md_alg, hash, hash_length,
signature, signature_length, mbedtls_ctr_drbg_random,
signature, signature_length,
mbedtls_ctr_drbg_random,
&global_data.ctr_drbg );
return( mbedtls_to_psa_error( ret ) );
}
@ -1358,7 +1358,7 @@ psa_status_t psa_asymmetric_verify(psa_key_slot_t key,
status = verify_RSA_hash_input_and_get_md_type( alg, hash_length,
&md_alg );
if( status != PSA_SUCCESS )
return status;
return( status );
if( signature_size < rsa->len )
return( PSA_ERROR_BUFFER_TOO_SMALL );
@ -1400,8 +1400,8 @@ psa_status_t psa_asymmetric_verify(psa_key_slot_t key,
mbedtls_ecp_keypair *ecdsa = slot->data.ecp;
int ret;
(void)alg;
ret = mbedtls_ecdsa_read_signature(ecdsa, hash, hash_length, signature,
signature_size);
ret = mbedtls_ecdsa_read_signature( ecdsa, hash, hash_length,
signature, signature_size );
return( mbedtls_to_psa_error( ret ) );
}
else
@ -1411,7 +1411,6 @@ psa_status_t psa_asymmetric_verify(psa_key_slot_t key,
}
}
psa_status_t psa_asymmetric_encrypt( psa_key_slot_t key,
psa_algorithm_t alg,
const uint8_t *input,
@ -1437,7 +1436,6 @@ psa_status_t psa_asymmetric_encrypt(psa_key_slot_t key,
if( ! ( slot->policy.usage & PSA_KEY_USAGE_ENCRYPT ) )
return( PSA_ERROR_NOT_PERMITTED );
#if defined(MBEDTLS_RSA_C)
if( ( slot->type == PSA_KEY_TYPE_RSA_KEYPAIR ) ||
( slot->type == PSA_KEY_TYPE_RSA_PUBLIC_KEY ) )
@ -1488,7 +1486,6 @@ psa_status_t psa_asymmetric_encrypt(psa_key_slot_t key,
}
psa_status_t psa_asymmetric_decrypt( psa_key_slot_t key,
psa_algorithm_t alg,
const uint8_t *input,