mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-10 15:50:47 -04:00
Merge pull request #6387 from gilles-peskine-arm/bignum-mbedtls_test_read_mpi_core-2.28
Backport 2.28: don't introduce mbedtls_test_read_mpi_core
This commit is contained in:
commit
f9c91cea19
@ -92,9 +92,11 @@ def write_data_file(filename: str,
|
|||||||
"""
|
"""
|
||||||
if caller is None:
|
if caller is None:
|
||||||
caller = os.path.basename(sys.argv[0])
|
caller = os.path.basename(sys.argv[0])
|
||||||
with open(filename, 'w') as out:
|
tempfile = filename + '.new'
|
||||||
|
with open(tempfile, 'w') as out:
|
||||||
out.write('# Automatically generated by {}. Do not edit!\n'
|
out.write('# Automatically generated by {}. Do not edit!\n'
|
||||||
.format(caller))
|
.format(caller))
|
||||||
for tc in test_cases:
|
for tc in test_cases:
|
||||||
tc.write(out)
|
tc.write(out)
|
||||||
out.write('\n# End of automatically generated file.\n')
|
out.write('\n# End of automatically generated file.\n')
|
||||||
|
os.replace(tempfile, filename)
|
||||||
|
@ -58,6 +58,13 @@
|
|||||||
#include "mbedtls/bignum.h"
|
#include "mbedtls/bignum.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/** The type of test case arguments that contain binary data. */
|
||||||
|
typedef struct data_tag
|
||||||
|
{
|
||||||
|
uint8_t * x;
|
||||||
|
uint32_t len;
|
||||||
|
} data_t;
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
MBEDTLS_TEST_RESULT_SUCCESS = 0,
|
MBEDTLS_TEST_RESULT_SUCCESS = 0,
|
||||||
@ -379,7 +386,6 @@ void mbedtls_test_err_add_check( int high, int low,
|
|||||||
*
|
*
|
||||||
* \return \c 0 on success, an \c MBEDTLS_ERR_MPI_xxx error code otherwise.
|
* \return \c 0 on success, an \c MBEDTLS_ERR_MPI_xxx error code otherwise.
|
||||||
*/
|
*/
|
||||||
/* Since the library has exactly the desired behavior, this is trivial. */
|
|
||||||
int mbedtls_test_read_mpi( mbedtls_mpi *X, const char *s );
|
int mbedtls_test_read_mpi( mbedtls_mpi *X, const char *s );
|
||||||
#endif /* MBEDTLS_BIGNUM_C */
|
#endif /* MBEDTLS_BIGNUM_C */
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <test/constant_flow.h>
|
||||||
#include <test/helpers.h>
|
#include <test/helpers.h>
|
||||||
#include <test/macros.h>
|
#include <test/macros.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -120,8 +121,12 @@ void mbedtls_test_info_reset( void )
|
|||||||
int mbedtls_test_equal( const char *test, int line_no, const char* filename,
|
int mbedtls_test_equal( const char *test, int line_no, const char* filename,
|
||||||
unsigned long long value1, unsigned long long value2 )
|
unsigned long long value1, unsigned long long value2 )
|
||||||
{
|
{
|
||||||
|
TEST_CF_PUBLIC( &value1, sizeof( value1 ) );
|
||||||
|
TEST_CF_PUBLIC( &value2, sizeof( value2 ) );
|
||||||
|
|
||||||
if( value1 == value2 )
|
if( value1 == value2 )
|
||||||
return( 1 );
|
return( 1 );
|
||||||
|
|
||||||
if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED )
|
if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED )
|
||||||
{
|
{
|
||||||
/* We've already recorded the test as having failed. Don't
|
/* We've already recorded the test as having failed. Don't
|
||||||
@ -143,8 +148,12 @@ int mbedtls_test_equal( const char *test, int line_no, const char* filename,
|
|||||||
int mbedtls_test_le_u( const char *test, int line_no, const char* filename,
|
int mbedtls_test_le_u( const char *test, int line_no, const char* filename,
|
||||||
unsigned long long value1, unsigned long long value2 )
|
unsigned long long value1, unsigned long long value2 )
|
||||||
{
|
{
|
||||||
|
TEST_CF_PUBLIC( &value1, sizeof( value1 ) );
|
||||||
|
TEST_CF_PUBLIC( &value2, sizeof( value2 ) );
|
||||||
|
|
||||||
if( value1 <= value2 )
|
if( value1 <= value2 )
|
||||||
return( 1 );
|
return( 1 );
|
||||||
|
|
||||||
if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED )
|
if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED )
|
||||||
{
|
{
|
||||||
/* We've already recorded the test as having failed. Don't
|
/* We've already recorded the test as having failed. Don't
|
||||||
@ -166,8 +175,12 @@ int mbedtls_test_le_u( const char *test, int line_no, const char* filename,
|
|||||||
int mbedtls_test_le_s( const char *test, int line_no, const char* filename,
|
int mbedtls_test_le_s( const char *test, int line_no, const char* filename,
|
||||||
long long value1, long long value2 )
|
long long value1, long long value2 )
|
||||||
{
|
{
|
||||||
|
TEST_CF_PUBLIC( &value1, sizeof( value1 ) );
|
||||||
|
TEST_CF_PUBLIC( &value2, sizeof( value2 ) );
|
||||||
|
|
||||||
if( value1 <= value2 )
|
if( value1 <= value2 )
|
||||||
return( 1 );
|
return( 1 );
|
||||||
|
|
||||||
if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED )
|
if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED )
|
||||||
{
|
{
|
||||||
/* We've already recorded the test as having failed. Don't
|
/* We've already recorded the test as having failed. Don't
|
||||||
|
@ -51,13 +51,6 @@ typedef UINT32 uint32_t;
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Type for Hex parameters */
|
|
||||||
typedef struct data_tag
|
|
||||||
{
|
|
||||||
uint8_t * x;
|
|
||||||
uint32_t len;
|
|
||||||
} data_t;
|
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/
|
/*----------------------------------------------------------------------------*/
|
||||||
/* Status and error constants */
|
/* Status and error constants */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user