mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-22 17:15:38 +01:00
Fix potential signedness issue
This commit is contained in:
parent
6ca4076468
commit
6fdc4cae53
@ -14,6 +14,8 @@ Bugfix
|
|||||||
* Fix hardclock() (only used in the benchmarking program) with some
|
* Fix hardclock() (only used in the benchmarking program) with some
|
||||||
versions of mingw64 (found by kxjhlele).
|
versions of mingw64 (found by kxjhlele).
|
||||||
* Fix warnings from mingw64 in timing.c (found by kxjklele).
|
* Fix warnings from mingw64 in timing.c (found by kxjklele).
|
||||||
|
* Fix potential unintended sign extension in asn1_get_len() on 64-bit
|
||||||
|
platforms.
|
||||||
|
|
||||||
Changes
|
Changes
|
||||||
* Move from SHA-1 to SHA-256 in example programs using signatures
|
* Move from SHA-1 to SHA-256 in example programs using signatures
|
||||||
|
@ -77,7 +77,7 @@ int asn1_get_len( unsigned char **p,
|
|||||||
if( ( end - *p ) < 3 )
|
if( ( end - *p ) < 3 )
|
||||||
return( POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
return( POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
||||||
|
|
||||||
*len = ( (*p)[1] << 8 ) | (*p)[2];
|
*len = ( (size_t)(*p)[1] << 8 ) | (*p)[2];
|
||||||
(*p) += 3;
|
(*p) += 3;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -85,7 +85,8 @@ int asn1_get_len( unsigned char **p,
|
|||||||
if( ( end - *p ) < 4 )
|
if( ( end - *p ) < 4 )
|
||||||
return( POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
return( POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
||||||
|
|
||||||
*len = ( (*p)[1] << 16 ) | ( (*p)[2] << 8 ) | (*p)[3];
|
*len = ( (size_t)(*p)[1] << 16 ) |
|
||||||
|
( (size_t)(*p)[2] << 8 ) | (*p)[3];
|
||||||
(*p) += 4;
|
(*p) += 4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -93,8 +94,8 @@ int asn1_get_len( unsigned char **p,
|
|||||||
if( ( end - *p ) < 5 )
|
if( ( end - *p ) < 5 )
|
||||||
return( POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
return( POLARSSL_ERR_ASN1_OUT_OF_DATA );
|
||||||
|
|
||||||
*len = ( (*p)[1] << 24 ) | ( (*p)[2] << 16 ) | ( (*p)[3] << 8 ) |
|
*len = ( (size_t)(*p)[1] << 24 ) | ( (size_t)(*p)[2] << 16 ) |
|
||||||
(*p)[4];
|
( (size_t)(*p)[3] << 8 ) | (*p)[4];
|
||||||
(*p) += 5;
|
(*p) += 5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user