mirror of
				https://github.com/Mbed-TLS/mbedtls.git
				synced 2025-11-03 20:33:16 +03:00 
			
		
		
		
	Improve coding style
Co-authored-by: Tom Cosgrove <81633263+tom-cosgrove-arm@users.noreply.github.com> Co-authored-by: Werner Lewis <werner.wmlewis@gmail.com> Signed-off-by: Janos Follath <janos.follath@arm.com>
This commit is contained in:
		@@ -712,7 +712,7 @@ cleanup:
 | 
				
			|||||||
int mbedtls_mpi_write_binary_le( const mbedtls_mpi *X,
 | 
					int mbedtls_mpi_write_binary_le( const mbedtls_mpi *X,
 | 
				
			||||||
                                 unsigned char *buf, size_t buflen )
 | 
					                                 unsigned char *buf, size_t buflen )
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    return( mbedtls_mpi_core_write_le( X->p, X->n, buf, buflen) );
 | 
					    return( mbedtls_mpi_core_write_le( X->p, X->n, buf, buflen ) );
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -174,7 +174,10 @@ int mbedtls_mpi_core_read_le( mbedtls_mpi_uint *X,
 | 
				
			|||||||
        memset( X, 0, X_limbs * ciL );
 | 
					        memset( X, 0, X_limbs * ciL );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for( size_t i = 0; i < input_length; i++ )
 | 
					        for( size_t i = 0; i < input_length; i++ )
 | 
				
			||||||
            X[i / ciL] |= ((mbedtls_mpi_uint) input[i]) << ((i % ciL) << 3);
 | 
					        {
 | 
				
			||||||
 | 
					            size_t offset = ( ( i % ciL ) << 3 );
 | 
				
			||||||
 | 
					            X[i / ciL] |= ( (mbedtls_mpi_uint) input[i] ) << offset;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return( 0 );
 | 
					    return( 0 );
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -141,9 +141,9 @@ int mbedtls_mpi_core_write_be( const mbedtls_mpi_uint *A,
 | 
				
			|||||||
                               unsigned char *output,
 | 
					                               unsigned char *output,
 | 
				
			||||||
                               size_t output_length );
 | 
					                               size_t output_length );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define ciL    (sizeof(mbedtls_mpi_uint))   /* chars in limb  */
 | 
					#define ciL    ( sizeof(mbedtls_mpi_uint) )   /* chars in limb  */
 | 
				
			||||||
#define biL    (ciL << 3)                   /* bits  in limb  */
 | 
					#define biL    ( ciL << 3 )                   /* bits  in limb  */
 | 
				
			||||||
#define biH    (ciL << 2)                   /* half limb size */
 | 
					#define biH    ( ciL << 2 )                   /* half limb size */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					/*
 | 
				
			||||||
 * Convert between bits/chars and number of limbs
 | 
					 * Convert between bits/chars and number of limbs
 | 
				
			||||||
@@ -153,6 +153,6 @@ int mbedtls_mpi_core_write_be( const mbedtls_mpi_uint *A,
 | 
				
			|||||||
#define CHARS_TO_LIMBS(i) ( (i) / ciL + ( (i) % ciL != 0 ) )
 | 
					#define CHARS_TO_LIMBS(i) ( (i) / ciL + ( (i) % ciL != 0 ) )
 | 
				
			||||||
/* Get a specific byte, without range checks. */
 | 
					/* Get a specific byte, without range checks. */
 | 
				
			||||||
#define GET_BYTE( X, i )                                \
 | 
					#define GET_BYTE( X, i )                                \
 | 
				
			||||||
    ( ( ( X )[( i ) / ciL] >> ( ( ( i ) % ciL ) * 8 ) ) & 0xff )
 | 
					    ( ( (X)[(i) / ciL] >> ( ( (i) % ciL ) * 8 ) ) & 0xff )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif /* MBEDTLS_BIGNUM_CORE_H */
 | 
					#endif /* MBEDTLS_BIGNUM_CORE_H */
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user