mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-07-30 22:43:08 +03:00
Flip logic of generate_psa_wrappers.py
Change from a long list of PSA functions to a list of excluded false-positives. Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
@ -142,52 +142,14 @@ class PSAWrapperGenerator(c_wrapper_generator.Base):
|
|||||||
_buffer_name: Optional[str]) -> bool:
|
_buffer_name: Optional[str]) -> bool:
|
||||||
"""Whether the specified buffer argument to a PSA function should be copied.
|
"""Whether the specified buffer argument to a PSA function should be copied.
|
||||||
"""
|
"""
|
||||||
#pylint: disable=too-many-return-statements
|
# False-positives that do not need buffer copying
|
||||||
if function_name in ('psa_sign_hash_start',
|
if function_name in ('mbedtls_psa_inject_entropy',
|
||||||
'psa_sign_hash_complete',
|
'psa_crypto_driver_pake_get_password',
|
||||||
'psa_verify_hash_start'):
|
'psa_crypto_driver_pake_get_user',
|
||||||
return True
|
'psa_crypto_driver_pake_get_peer'):
|
||||||
if function_name.startswith('psa_pake'):
|
return False
|
||||||
return True
|
|
||||||
if function_name.startswith('psa_aead'):
|
return True
|
||||||
return True
|
|
||||||
if function_name in {'psa_cipher_encrypt', 'psa_cipher_decrypt',
|
|
||||||
'psa_cipher_update', 'psa_cipher_finish',
|
|
||||||
'psa_cipher_generate_iv', 'psa_cipher_set_iv'}:
|
|
||||||
return True
|
|
||||||
if function_name in ('psa_key_derivation_output_bytes',
|
|
||||||
'psa_key_derivation_input_bytes'):
|
|
||||||
return True
|
|
||||||
if function_name in ('psa_import_key',
|
|
||||||
'psa_export_key',
|
|
||||||
'psa_export_public_key'):
|
|
||||||
return True
|
|
||||||
if function_name in ('psa_sign_message',
|
|
||||||
'psa_verify_message',
|
|
||||||
'psa_sign_hash',
|
|
||||||
'psa_verify_hash'):
|
|
||||||
return True
|
|
||||||
if function_name in ('psa_hash_update',
|
|
||||||
'psa_hash_finish',
|
|
||||||
'psa_hash_verify',
|
|
||||||
'psa_hash_compute',
|
|
||||||
'psa_hash_compare'):
|
|
||||||
return True
|
|
||||||
if function_name in ('psa_key_derivation_key_agreement',
|
|
||||||
'psa_raw_key_agreement'):
|
|
||||||
return True
|
|
||||||
if function_name == 'psa_generate_random':
|
|
||||||
return True
|
|
||||||
if function_name in ('psa_mac_update',
|
|
||||||
'psa_mac_sign_finish',
|
|
||||||
'psa_mac_verify_finish',
|
|
||||||
'psa_mac_compute',
|
|
||||||
'psa_mac_verify'):
|
|
||||||
return True
|
|
||||||
if function_name in ('psa_asymmetric_encrypt',
|
|
||||||
'psa_asymmetric_decrypt'):
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
def _write_function_call(self, out: typing_util.Writable,
|
def _write_function_call(self, out: typing_util.Writable,
|
||||||
function: c_wrapper_generator.FunctionInfo,
|
function: c_wrapper_generator.FunctionInfo,
|
||||||
|
Reference in New Issue
Block a user