mirror of
https://github.com/cuberite/polarssl.git
synced 2025-09-08 14:49:59 -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:
|
||||
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'
|
||||
.format(caller))
|
||||
for tc in test_cases:
|
||||
tc.write(out)
|
||||
out.write('\n# End of automatically generated file.\n')
|
||||
os.replace(tempfile, filename)
|
||||
|
@ -58,6 +58,13 @@
|
||||
#include "mbedtls/bignum.h"
|
||||
#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
|
||||
{
|
||||
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.
|
||||
*/
|
||||
/* Since the library has exactly the desired behavior, this is trivial. */
|
||||
int mbedtls_test_read_mpi( mbedtls_mpi *X, const char *s );
|
||||
#endif /* MBEDTLS_BIGNUM_C */
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <test/constant_flow.h>
|
||||
#include <test/helpers.h>
|
||||
#include <test/macros.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,
|
||||
unsigned long long value1, unsigned long long value2 )
|
||||
{
|
||||
TEST_CF_PUBLIC( &value1, sizeof( value1 ) );
|
||||
TEST_CF_PUBLIC( &value2, sizeof( value2 ) );
|
||||
|
||||
if( value1 == value2 )
|
||||
return( 1 );
|
||||
|
||||
if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED )
|
||||
{
|
||||
/* 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,
|
||||
unsigned long long value1, unsigned long long value2 )
|
||||
{
|
||||
TEST_CF_PUBLIC( &value1, sizeof( value1 ) );
|
||||
TEST_CF_PUBLIC( &value2, sizeof( value2 ) );
|
||||
|
||||
if( value1 <= value2 )
|
||||
return( 1 );
|
||||
|
||||
if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED )
|
||||
{
|
||||
/* 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,
|
||||
long long value1, long long value2 )
|
||||
{
|
||||
TEST_CF_PUBLIC( &value1, sizeof( value1 ) );
|
||||
TEST_CF_PUBLIC( &value2, sizeof( value2 ) );
|
||||
|
||||
if( value1 <= value2 )
|
||||
return( 1 );
|
||||
|
||||
if( mbedtls_test_info.result == MBEDTLS_TEST_RESULT_FAILED )
|
||||
{
|
||||
/* We've already recorded the test as having failed. Don't
|
||||
|
@ -51,13 +51,6 @@ typedef UINT32 uint32_t;
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
/* Type for Hex parameters */
|
||||
typedef struct data_tag
|
||||
{
|
||||
uint8_t * x;
|
||||
uint32_t len;
|
||||
} data_t;
|
||||
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Status and error constants */
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user