mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-23 03:55:44 +01:00
Merge branch 'pr_1409' into mbedtls-2.1-proposed
This commit is contained in:
commit
adee19582e
@ -35,6 +35,8 @@ Bugfix
|
|||||||
* Fix compilation error on Mingw32 when _TRUNCATE is defined. Use _TRUNCATE
|
* Fix compilation error on Mingw32 when _TRUNCATE is defined. Use _TRUNCATE
|
||||||
only if __MINGW32__ not defined. Fix suggested by Thomas Glanzmann and
|
only if __MINGW32__ not defined. Fix suggested by Thomas Glanzmann and
|
||||||
Nick Wilson on issue #355
|
Nick Wilson on issue #355
|
||||||
|
* In test_suite_pk, pass valid parameters when testing for hash length
|
||||||
|
overflow. #1179
|
||||||
|
|
||||||
Changes
|
Changes
|
||||||
* Clarified the documentation of mbedtls_ssl_setup.
|
* Clarified the documentation of mbedtls_ssl_setup.
|
||||||
|
@ -421,11 +421,15 @@ exit:
|
|||||||
void pk_rsa_overflow( )
|
void pk_rsa_overflow( )
|
||||||
{
|
{
|
||||||
mbedtls_pk_context pk;
|
mbedtls_pk_context pk;
|
||||||
size_t hash_len = SIZE_MAX;
|
size_t hash_len = SIZE_MAX, sig_len = SIZE_MAX;
|
||||||
|
unsigned char hash[50], sig[100];
|
||||||
|
|
||||||
if( SIZE_MAX <= UINT_MAX )
|
if( SIZE_MAX <= UINT_MAX )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
memset( hash, 0x2a, sizeof hash );
|
||||||
|
memset( sig, 0, sizeof sig );
|
||||||
|
|
||||||
mbedtls_pk_init( &pk );
|
mbedtls_pk_init( &pk );
|
||||||
|
|
||||||
TEST_ASSERT( mbedtls_pk_setup( &pk,
|
TEST_ASSERT( mbedtls_pk_setup( &pk,
|
||||||
@ -433,14 +437,14 @@ void pk_rsa_overflow( )
|
|||||||
|
|
||||||
#if defined(MBEDTLS_PKCS1_V21)
|
#if defined(MBEDTLS_PKCS1_V21)
|
||||||
TEST_ASSERT( mbedtls_pk_verify_ext( MBEDTLS_PK_RSASSA_PSS, NULL, &pk,
|
TEST_ASSERT( mbedtls_pk_verify_ext( MBEDTLS_PK_RSASSA_PSS, NULL, &pk,
|
||||||
MBEDTLS_MD_NONE, NULL, hash_len, NULL, 0 ) ==
|
MBEDTLS_MD_NONE, hash, hash_len, sig, sig_len ) ==
|
||||||
MBEDTLS_ERR_PK_BAD_INPUT_DATA );
|
MBEDTLS_ERR_PK_BAD_INPUT_DATA );
|
||||||
#endif /* MBEDTLS_PKCS1_V21 */
|
#endif /* MBEDTLS_PKCS1_V21 */
|
||||||
|
|
||||||
TEST_ASSERT( mbedtls_pk_verify( &pk, MBEDTLS_MD_NONE, NULL, hash_len,
|
TEST_ASSERT( mbedtls_pk_verify( &pk, MBEDTLS_MD_NONE, hash, hash_len,
|
||||||
NULL, 0 ) == MBEDTLS_ERR_PK_BAD_INPUT_DATA );
|
sig, sig_len ) == MBEDTLS_ERR_PK_BAD_INPUT_DATA );
|
||||||
|
|
||||||
TEST_ASSERT( mbedtls_pk_sign( &pk, MBEDTLS_MD_NONE, NULL, hash_len, NULL, 0,
|
TEST_ASSERT( mbedtls_pk_sign( &pk, MBEDTLS_MD_NONE, hash, hash_len, sig, &sig_len,
|
||||||
rnd_std_rand, NULL ) == MBEDTLS_ERR_PK_BAD_INPUT_DATA );
|
rnd_std_rand, NULL ) == MBEDTLS_ERR_PK_BAD_INPUT_DATA );
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
Loading…
Reference in New Issue
Block a user