mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2025-12-24 00:06:32 +01:00
Change size of preallocated buffer for pk_sign() calls
This commit is contained in:
parent
08f363baa9
commit
e79c939693
3 changed files with 33 additions and 3 deletions
|
|
@ -72,6 +72,16 @@ void mbedtls_param_failed( const char *failure_condition,
|
|||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* For the currently used signature algorithms the buffer to store any signature
|
||||
* must be at least of size MAX(MBEDTLS_ECDSA_MAX_LEN, MBEDTLS_MPI_MAX_SIZE)
|
||||
*/
|
||||
#if MBEDTLS_ECDSA_MAX_LEN > MBEDTLS_MPI_MAX_SIZE
|
||||
#define SIGNATURE_MAX_SIZE MBEDTLS_ECDSA_MAX_LEN
|
||||
#else
|
||||
#define SIGNATURE_MAX_SIZE MBEDTLS_MPI_MAX_SIZE
|
||||
#endif
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
FILE *f;
|
||||
|
|
@ -81,7 +91,7 @@ int main( int argc, char *argv[] )
|
|||
mbedtls_entropy_context entropy;
|
||||
mbedtls_ctr_drbg_context ctr_drbg;
|
||||
unsigned char hash[32];
|
||||
unsigned char buf[MBEDTLS_MPI_MAX_SIZE];
|
||||
unsigned char buf[SIGNATURE_MAX_SIZE];
|
||||
char filename[512];
|
||||
const char *pers = "mbedtls_pk_sign";
|
||||
size_t olen = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue