mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-05-14 15:42:41 +02:00
pk: function to calculate the signature size
Expose a function mbedtls_pk_signature_size to calculate the maximum size of a signature made with a given key. Document that this is the buffer size that mbedtls_pk_sign requires. Add a corresponding field signature_size_func to the mbedtls_pk_info structure.
This commit is contained in:
committed by
Andrzej Kurek
parent
bce41d373a
commit
cd062d84d6
@@ -270,6 +270,8 @@ void pk_sign_verify( int type, int sign_ret, int verify_ret )
|
||||
|
||||
TEST_ASSERT( mbedtls_pk_sign( &pk, MBEDTLS_MD_SHA256, hash, sizeof hash,
|
||||
sig, &sig_len, rnd_std_rand, NULL ) == sign_ret );
|
||||
if( sign_ret == 0 )
|
||||
TEST_ASSERT( sig_len <= mbedtls_pk_signature_size( &pk ) );
|
||||
|
||||
TEST_ASSERT( mbedtls_pk_verify( &pk, MBEDTLS_MD_SHA256,
|
||||
hash, sizeof hash, sig, sig_len ) == verify_ret );
|
||||
|
||||
Reference in New Issue
Block a user