Skip to content

Commit 8a28052

Browse files
committed
Prevent dead code warning
The window size variable in ecp_pick_window_size() can only take values: 5 and 4, however we clamp it not to exceed the value of MBEDTLS_ECP_WINDOW_SIZE. If that is higher than 5, the static analyzer will point out that the test: w < MBEDTLS_ECP_WINDOW_SIZE always evaluates to false. This commit removes the test for the cases of the window size large enough to fit both the potential values.
1 parent ee6f9b2 commit 8a28052

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

library/ecp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,8 +2004,10 @@ static unsigned char ecp_pick_window_size( const mbedtls_ecp_group *grp,
20042004
* Make sure w is within bounds.
20052005
* (The last test is useful only for very small curves in the test suite.)
20062006
*/
2007+
#if( MBEDTLS_ECP_WINDOW_SIZE < 5 )
20072008
if( w > MBEDTLS_ECP_WINDOW_SIZE )
20082009
w = MBEDTLS_ECP_WINDOW_SIZE;
2010+
#endif
20092011
if( w >= grp->nbits )
20102012
w = 2;
20112013

0 commit comments

Comments
 (0)