mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-14 10:37:23 -07:00
mbedtls: make style
This commit is contained in:
parent
6324e2e746
commit
b1d6eaf2f7
177 changed files with 37224 additions and 41821 deletions
|
@ -115,63 +115,63 @@
|
|||
* disabled by defining MBEDTLS_NO_UDBL_DIVISION.
|
||||
*/
|
||||
#if !defined(MBEDTLS_HAVE_INT32)
|
||||
#if defined(_MSC_VER) && defined(_M_AMD64)
|
||||
/* Always choose 64-bit when using MSC */
|
||||
#if !defined(MBEDTLS_HAVE_INT64)
|
||||
#define MBEDTLS_HAVE_INT64
|
||||
#endif /* !MBEDTLS_HAVE_INT64 */
|
||||
typedef int64_t mbedtls_mpi_sint;
|
||||
typedef uint64_t mbedtls_mpi_uint;
|
||||
#elif defined(__GNUC__) && ( \
|
||||
#if defined(_MSC_VER) && defined(_M_AMD64)
|
||||
/* Always choose 64-bit when using MSC */
|
||||
#if !defined(MBEDTLS_HAVE_INT64)
|
||||
#define MBEDTLS_HAVE_INT64
|
||||
#endif /* !MBEDTLS_HAVE_INT64 */
|
||||
typedef int64_t mbedtls_mpi_sint;
|
||||
typedef uint64_t mbedtls_mpi_uint;
|
||||
#elif defined(__GNUC__) && ( \
|
||||
defined(__amd64__) || defined(__x86_64__) || \
|
||||
defined(__ppc64__) || defined(__powerpc64__) || \
|
||||
defined(__ia64__) || defined(__alpha__) || \
|
||||
( defined(__sparc__) && defined(__arch64__) ) || \
|
||||
defined(__s390x__) || defined(__mips64) || \
|
||||
defined(__aarch64__) )
|
||||
#if !defined(MBEDTLS_HAVE_INT64)
|
||||
#define MBEDTLS_HAVE_INT64
|
||||
#endif /* MBEDTLS_HAVE_INT64 */
|
||||
typedef int64_t mbedtls_mpi_sint;
|
||||
typedef uint64_t mbedtls_mpi_uint;
|
||||
#if !defined(MBEDTLS_NO_UDBL_DIVISION)
|
||||
/* mbedtls_t_udbl defined as 128-bit unsigned int */
|
||||
typedef unsigned int mbedtls_t_udbl __attribute__((mode(TI)));
|
||||
#define MBEDTLS_HAVE_UDBL
|
||||
#endif /* !MBEDTLS_NO_UDBL_DIVISION */
|
||||
#elif defined(__ARMCC_VERSION) && defined(__aarch64__)
|
||||
/*
|
||||
* __ARMCC_VERSION is defined for both armcc and armclang and
|
||||
* __aarch64__ is only defined by armclang when compiling 64-bit code
|
||||
*/
|
||||
#if !defined(MBEDTLS_HAVE_INT64)
|
||||
#define MBEDTLS_HAVE_INT64
|
||||
#endif /* !MBEDTLS_HAVE_INT64 */
|
||||
typedef int64_t mbedtls_mpi_sint;
|
||||
typedef uint64_t mbedtls_mpi_uint;
|
||||
#if !defined(MBEDTLS_NO_UDBL_DIVISION)
|
||||
/* mbedtls_t_udbl defined as 128-bit unsigned int */
|
||||
typedef __uint128_t mbedtls_t_udbl;
|
||||
#define MBEDTLS_HAVE_UDBL
|
||||
#endif /* !MBEDTLS_NO_UDBL_DIVISION */
|
||||
#elif defined(MBEDTLS_HAVE_INT64)
|
||||
/* Force 64-bit integers with unknown compiler */
|
||||
typedef int64_t mbedtls_mpi_sint;
|
||||
typedef uint64_t mbedtls_mpi_uint;
|
||||
#endif
|
||||
#if !defined(MBEDTLS_HAVE_INT64)
|
||||
#define MBEDTLS_HAVE_INT64
|
||||
#endif /* MBEDTLS_HAVE_INT64 */
|
||||
typedef int64_t mbedtls_mpi_sint;
|
||||
typedef uint64_t mbedtls_mpi_uint;
|
||||
#if !defined(MBEDTLS_NO_UDBL_DIVISION)
|
||||
/* mbedtls_t_udbl defined as 128-bit unsigned int */
|
||||
typedef unsigned int mbedtls_t_udbl __attribute__((mode(TI)));
|
||||
#define MBEDTLS_HAVE_UDBL
|
||||
#endif /* !MBEDTLS_NO_UDBL_DIVISION */
|
||||
#elif defined(__ARMCC_VERSION) && defined(__aarch64__)
|
||||
/*
|
||||
* __ARMCC_VERSION is defined for both armcc and armclang and
|
||||
* __aarch64__ is only defined by armclang when compiling 64-bit code
|
||||
*/
|
||||
#if !defined(MBEDTLS_HAVE_INT64)
|
||||
#define MBEDTLS_HAVE_INT64
|
||||
#endif /* !MBEDTLS_HAVE_INT64 */
|
||||
typedef int64_t mbedtls_mpi_sint;
|
||||
typedef uint64_t mbedtls_mpi_uint;
|
||||
#if !defined(MBEDTLS_NO_UDBL_DIVISION)
|
||||
/* mbedtls_t_udbl defined as 128-bit unsigned int */
|
||||
typedef __uint128_t mbedtls_t_udbl;
|
||||
#define MBEDTLS_HAVE_UDBL
|
||||
#endif /* !MBEDTLS_NO_UDBL_DIVISION */
|
||||
#elif defined(MBEDTLS_HAVE_INT64)
|
||||
/* Force 64-bit integers with unknown compiler */
|
||||
typedef int64_t mbedtls_mpi_sint;
|
||||
typedef uint64_t mbedtls_mpi_uint;
|
||||
#endif
|
||||
#endif /* !MBEDTLS_HAVE_INT32 */
|
||||
|
||||
#if !defined(MBEDTLS_HAVE_INT64)
|
||||
/* Default to 32-bit compilation */
|
||||
#if !defined(MBEDTLS_HAVE_INT32)
|
||||
#define MBEDTLS_HAVE_INT32
|
||||
#endif /* !MBEDTLS_HAVE_INT32 */
|
||||
typedef int32_t mbedtls_mpi_sint;
|
||||
typedef uint32_t mbedtls_mpi_uint;
|
||||
#if !defined(MBEDTLS_NO_UDBL_DIVISION)
|
||||
typedef uint64_t mbedtls_t_udbl;
|
||||
#define MBEDTLS_HAVE_UDBL
|
||||
#endif /* !MBEDTLS_NO_UDBL_DIVISION */
|
||||
/* Default to 32-bit compilation */
|
||||
#if !defined(MBEDTLS_HAVE_INT32)
|
||||
#define MBEDTLS_HAVE_INT32
|
||||
#endif /* !MBEDTLS_HAVE_INT32 */
|
||||
typedef int32_t mbedtls_mpi_sint;
|
||||
typedef uint32_t mbedtls_mpi_uint;
|
||||
#if !defined(MBEDTLS_NO_UDBL_DIVISION)
|
||||
typedef uint64_t mbedtls_t_udbl;
|
||||
#define MBEDTLS_HAVE_UDBL
|
||||
#endif /* !MBEDTLS_NO_UDBL_DIVISION */
|
||||
#endif /* !MBEDTLS_HAVE_INT64 */
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -181,8 +181,7 @@ extern "C" {
|
|||
/**
|
||||
* \brief MPI structure
|
||||
*/
|
||||
typedef struct mbedtls_mpi
|
||||
{
|
||||
typedef struct mbedtls_mpi {
|
||||
int s; /*!< Sign: -1 if the mpi is negative, 1 otherwise */
|
||||
size_t n; /*!< total # of limbs */
|
||||
mbedtls_mpi_uint *p; /*!< pointer to limbs */
|
||||
|
@ -197,7 +196,7 @@ mbedtls_mpi;
|
|||
*
|
||||
* \param X The MPI context to initialize. This must not be \c NULL.
|
||||
*/
|
||||
void mbedtls_mpi_init( mbedtls_mpi *X );
|
||||
void mbedtls_mpi_init(mbedtls_mpi *X);
|
||||
|
||||
/**
|
||||
* \brief This function frees the components of an MPI context.
|
||||
|
@ -206,7 +205,7 @@ void mbedtls_mpi_init( mbedtls_mpi *X );
|
|||
* in which case this function is a no-op. If it is
|
||||
* not \c NULL, it must point to an initialized MPI.
|
||||
*/
|
||||
void mbedtls_mpi_free( mbedtls_mpi *X );
|
||||
void mbedtls_mpi_free(mbedtls_mpi *X);
|
||||
|
||||
/**
|
||||
* \brief Enlarge an MPI to the specified number of limbs.
|
||||
|
@ -221,7 +220,7 @@ void mbedtls_mpi_free( mbedtls_mpi *X );
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed.
|
||||
* \return Another negative error code on other kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_grow( mbedtls_mpi *X, size_t nblimbs );
|
||||
int mbedtls_mpi_grow(mbedtls_mpi *X, size_t nblimbs);
|
||||
|
||||
/**
|
||||
* \brief This function resizes an MPI downwards, keeping at least the
|
||||
|
@ -238,7 +237,7 @@ int mbedtls_mpi_grow( mbedtls_mpi *X, size_t nblimbs );
|
|||
* (this can only happen when resizing up).
|
||||
* \return Another negative error code on other kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_shrink( mbedtls_mpi *X, size_t nblimbs );
|
||||
int mbedtls_mpi_shrink(mbedtls_mpi *X, size_t nblimbs);
|
||||
|
||||
/**
|
||||
* \brief Make a copy of an MPI.
|
||||
|
@ -253,7 +252,7 @@ int mbedtls_mpi_shrink( mbedtls_mpi *X, size_t nblimbs );
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed.
|
||||
* \return Another negative error code on other kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_copy( mbedtls_mpi *X, const mbedtls_mpi *Y );
|
||||
int mbedtls_mpi_copy(mbedtls_mpi *X, const mbedtls_mpi *Y);
|
||||
|
||||
/**
|
||||
* \brief Swap the contents of two MPIs.
|
||||
|
@ -261,7 +260,7 @@ int mbedtls_mpi_copy( mbedtls_mpi *X, const mbedtls_mpi *Y );
|
|||
* \param X The first MPI. It must be initialized.
|
||||
* \param Y The second MPI. It must be initialized.
|
||||
*/
|
||||
void mbedtls_mpi_swap( mbedtls_mpi *X, mbedtls_mpi *Y );
|
||||
void mbedtls_mpi_swap(mbedtls_mpi *X, mbedtls_mpi *Y);
|
||||
|
||||
/**
|
||||
* \brief Perform a safe conditional copy of MPI which doesn't
|
||||
|
@ -287,7 +286,7 @@ void mbedtls_mpi_swap( mbedtls_mpi *X, mbedtls_mpi *Y );
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed.
|
||||
* \return Another negative error code on other kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_safe_cond_assign( mbedtls_mpi *X, const mbedtls_mpi *Y, unsigned char assign );
|
||||
int mbedtls_mpi_safe_cond_assign(mbedtls_mpi *X, const mbedtls_mpi *Y, unsigned char assign);
|
||||
|
||||
/**
|
||||
* \brief Perform a safe conditional swap which doesn't
|
||||
|
@ -312,7 +311,7 @@ int mbedtls_mpi_safe_cond_assign( mbedtls_mpi *X, const mbedtls_mpi *Y, unsigned
|
|||
* \return Another negative error code on other kinds of failure.
|
||||
*
|
||||
*/
|
||||
int mbedtls_mpi_safe_cond_swap( mbedtls_mpi *X, mbedtls_mpi *Y, unsigned char assign );
|
||||
int mbedtls_mpi_safe_cond_swap(mbedtls_mpi *X, mbedtls_mpi *Y, unsigned char assign);
|
||||
|
||||
/**
|
||||
* \brief Store integer value in MPI.
|
||||
|
@ -324,7 +323,7 @@ int mbedtls_mpi_safe_cond_swap( mbedtls_mpi *X, mbedtls_mpi *Y, unsigned char as
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed.
|
||||
* \return Another negative error code on other kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_lset( mbedtls_mpi *X, mbedtls_mpi_sint z );
|
||||
int mbedtls_mpi_lset(mbedtls_mpi *X, mbedtls_mpi_sint z);
|
||||
|
||||
/**
|
||||
* \brief Get a specific bit from an MPI.
|
||||
|
@ -336,7 +335,7 @@ int mbedtls_mpi_lset( mbedtls_mpi *X, mbedtls_mpi_sint z );
|
|||
* of \c X is unset or set.
|
||||
* \return A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_mpi_get_bit( const mbedtls_mpi *X, size_t pos );
|
||||
int mbedtls_mpi_get_bit(const mbedtls_mpi *X, size_t pos);
|
||||
|
||||
/**
|
||||
* \brief Modify a specific bit in an MPI.
|
||||
|
@ -353,7 +352,7 @@ int mbedtls_mpi_get_bit( const mbedtls_mpi *X, size_t pos );
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed.
|
||||
* \return Another negative error code on other kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_set_bit( mbedtls_mpi *X, size_t pos, unsigned char val );
|
||||
int mbedtls_mpi_set_bit(mbedtls_mpi *X, size_t pos, unsigned char val);
|
||||
|
||||
/**
|
||||
* \brief Return the number of bits of value \c 0 before the
|
||||
|
@ -367,7 +366,7 @@ int mbedtls_mpi_set_bit( mbedtls_mpi *X, size_t pos, unsigned char val );
|
|||
* \return The number of bits of value \c 0 before the least significant
|
||||
* bit of value \c 1 in \p X.
|
||||
*/
|
||||
size_t mbedtls_mpi_lsb( const mbedtls_mpi *X );
|
||||
size_t mbedtls_mpi_lsb(const mbedtls_mpi *X);
|
||||
|
||||
/**
|
||||
* \brief Return the number of bits up to and including the most
|
||||
|
@ -381,7 +380,7 @@ size_t mbedtls_mpi_lsb( const mbedtls_mpi *X );
|
|||
* \return The number of bits up to and including the most
|
||||
* significant bit of value \c 1.
|
||||
*/
|
||||
size_t mbedtls_mpi_bitlen( const mbedtls_mpi *X );
|
||||
size_t mbedtls_mpi_bitlen(const mbedtls_mpi *X);
|
||||
|
||||
/**
|
||||
* \brief Return the total size of an MPI value in bytes.
|
||||
|
@ -396,7 +395,7 @@ size_t mbedtls_mpi_bitlen( const mbedtls_mpi *X );
|
|||
* \return The least number of bytes capable of storing
|
||||
* the absolute value of \p X.
|
||||
*/
|
||||
size_t mbedtls_mpi_size( const mbedtls_mpi *X );
|
||||
size_t mbedtls_mpi_size(const mbedtls_mpi *X);
|
||||
|
||||
/**
|
||||
* \brief Import an MPI from an ASCII string.
|
||||
|
@ -408,7 +407,7 @@ size_t mbedtls_mpi_size( const mbedtls_mpi *X );
|
|||
* \return \c 0 if successful.
|
||||
* \return A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_mpi_read_string( mbedtls_mpi *X, int radix, const char *s );
|
||||
int mbedtls_mpi_read_string(mbedtls_mpi *X, int radix, const char *s);
|
||||
|
||||
/**
|
||||
* \brief Export an MPI to an ASCII string.
|
||||
|
@ -432,8 +431,8 @@ int mbedtls_mpi_read_string( mbedtls_mpi *X, int radix, const char *s );
|
|||
* size of \p buf required for a successful call.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_write_string( const mbedtls_mpi *X, int radix,
|
||||
char *buf, size_t buflen, size_t *olen );
|
||||
int mbedtls_mpi_write_string(const mbedtls_mpi *X, int radix,
|
||||
char *buf, size_t buflen, size_t *olen);
|
||||
|
||||
#if defined(MBEDTLS_FS_IO)
|
||||
/**
|
||||
|
@ -457,7 +456,7 @@ int mbedtls_mpi_write_string( const mbedtls_mpi *X, int radix,
|
|||
* is too small.
|
||||
* \return Another negative error code on failure.
|
||||
*/
|
||||
int mbedtls_mpi_read_file( mbedtls_mpi *X, int radix, FILE *fin );
|
||||
int mbedtls_mpi_read_file(mbedtls_mpi *X, int radix, FILE *fin);
|
||||
|
||||
/**
|
||||
* \brief Export an MPI into an opened file.
|
||||
|
@ -474,8 +473,8 @@ int mbedtls_mpi_read_file( mbedtls_mpi *X, int radix, FILE *fin );
|
|||
* \return \c 0 if successful.
|
||||
* \return A negative error code on failure.
|
||||
*/
|
||||
int mbedtls_mpi_write_file( const char *p, const mbedtls_mpi *X,
|
||||
int radix, FILE *fout );
|
||||
int mbedtls_mpi_write_file(const char *p, const mbedtls_mpi *X,
|
||||
int radix, FILE *fout);
|
||||
#endif /* MBEDTLS_FS_IO */
|
||||
|
||||
/**
|
||||
|
@ -490,8 +489,8 @@ int mbedtls_mpi_write_file( const char *p, const mbedtls_mpi *X,
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_read_binary( mbedtls_mpi *X, const unsigned char *buf,
|
||||
size_t buflen );
|
||||
int mbedtls_mpi_read_binary(mbedtls_mpi *X, const unsigned char *buf,
|
||||
size_t buflen);
|
||||
|
||||
/**
|
||||
* \brief Import X from unsigned binary data, little endian
|
||||
|
@ -505,8 +504,8 @@ int mbedtls_mpi_read_binary( mbedtls_mpi *X, const unsigned char *buf,
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if memory allocation failed.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_read_binary_le( mbedtls_mpi *X,
|
||||
const unsigned char *buf, size_t buflen );
|
||||
int mbedtls_mpi_read_binary_le(mbedtls_mpi *X,
|
||||
const unsigned char *buf, size_t buflen);
|
||||
|
||||
/**
|
||||
* \brief Export X into unsigned binary data, big endian.
|
||||
|
@ -523,8 +522,8 @@ int mbedtls_mpi_read_binary_le( mbedtls_mpi *X,
|
|||
* large enough to hold the value of \p X.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_write_binary( const mbedtls_mpi *X, unsigned char *buf,
|
||||
size_t buflen );
|
||||
int mbedtls_mpi_write_binary(const mbedtls_mpi *X, unsigned char *buf,
|
||||
size_t buflen);
|
||||
|
||||
/**
|
||||
* \brief Export X into unsigned binary data, little endian.
|
||||
|
@ -541,8 +540,8 @@ int mbedtls_mpi_write_binary( const mbedtls_mpi *X, unsigned char *buf,
|
|||
* large enough to hold the value of \p X.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_write_binary_le( const mbedtls_mpi *X,
|
||||
unsigned char *buf, size_t buflen );
|
||||
int mbedtls_mpi_write_binary_le(const mbedtls_mpi *X,
|
||||
unsigned char *buf, size_t buflen);
|
||||
|
||||
/**
|
||||
* \brief Perform a left-shift on an MPI: X <<= count
|
||||
|
@ -554,7 +553,7 @@ int mbedtls_mpi_write_binary_le( const mbedtls_mpi *X,
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_shift_l( mbedtls_mpi *X, size_t count );
|
||||
int mbedtls_mpi_shift_l(mbedtls_mpi *X, size_t count);
|
||||
|
||||
/**
|
||||
* \brief Perform a right-shift on an MPI: X >>= count
|
||||
|
@ -566,7 +565,7 @@ int mbedtls_mpi_shift_l( mbedtls_mpi *X, size_t count );
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_shift_r( mbedtls_mpi *X, size_t count );
|
||||
int mbedtls_mpi_shift_r(mbedtls_mpi *X, size_t count);
|
||||
|
||||
/**
|
||||
* \brief Compare the absolute values of two MPIs.
|
||||
|
@ -578,7 +577,7 @@ int mbedtls_mpi_shift_r( mbedtls_mpi *X, size_t count );
|
|||
* \return \c -1 if `|X|` is lesser than `|Y|`.
|
||||
* \return \c 0 if `|X|` is equal to `|Y|`.
|
||||
*/
|
||||
int mbedtls_mpi_cmp_abs( const mbedtls_mpi *X, const mbedtls_mpi *Y );
|
||||
int mbedtls_mpi_cmp_abs(const mbedtls_mpi *X, const mbedtls_mpi *Y);
|
||||
|
||||
/**
|
||||
* \brief Compare two MPIs.
|
||||
|
@ -590,7 +589,7 @@ int mbedtls_mpi_cmp_abs( const mbedtls_mpi *X, const mbedtls_mpi *Y );
|
|||
* \return \c -1 if \p X is lesser than \p Y.
|
||||
* \return \c 0 if \p X is equal to \p Y.
|
||||
*/
|
||||
int mbedtls_mpi_cmp_mpi( const mbedtls_mpi *X, const mbedtls_mpi *Y );
|
||||
int mbedtls_mpi_cmp_mpi(const mbedtls_mpi *X, const mbedtls_mpi *Y);
|
||||
|
||||
/**
|
||||
* \brief Check if an MPI is less than the other in constant time.
|
||||
|
@ -607,8 +606,8 @@ int mbedtls_mpi_cmp_mpi( const mbedtls_mpi *X, const mbedtls_mpi *Y );
|
|||
* \return MBEDTLS_ERR_MPI_BAD_INPUT_DATA if the allocated length of
|
||||
* the two input MPIs is not the same.
|
||||
*/
|
||||
int mbedtls_mpi_lt_mpi_ct( const mbedtls_mpi *X, const mbedtls_mpi *Y,
|
||||
unsigned *ret );
|
||||
int mbedtls_mpi_lt_mpi_ct(const mbedtls_mpi *X, const mbedtls_mpi *Y,
|
||||
unsigned *ret);
|
||||
|
||||
/**
|
||||
* \brief Compare an MPI with an integer.
|
||||
|
@ -620,7 +619,7 @@ int mbedtls_mpi_lt_mpi_ct( const mbedtls_mpi *X, const mbedtls_mpi *Y,
|
|||
* \return \c -1 if \p X is lesser than \p z.
|
||||
* \return \c 0 if \p X is equal to \p z.
|
||||
*/
|
||||
int mbedtls_mpi_cmp_int( const mbedtls_mpi *X, mbedtls_mpi_sint z );
|
||||
int mbedtls_mpi_cmp_int(const mbedtls_mpi *X, mbedtls_mpi_sint z);
|
||||
|
||||
/**
|
||||
* \brief Perform an unsigned addition of MPIs: X = |A| + |B|
|
||||
|
@ -633,8 +632,8 @@ int mbedtls_mpi_cmp_int( const mbedtls_mpi *X, mbedtls_mpi_sint z );
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_add_abs( mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B );
|
||||
int mbedtls_mpi_add_abs(mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B);
|
||||
|
||||
/**
|
||||
* \brief Perform an unsigned subtraction of MPIs: X = |A| - |B|
|
||||
|
@ -648,8 +647,8 @@ int mbedtls_mpi_add_abs( mbedtls_mpi *X, const mbedtls_mpi *A,
|
|||
* \return Another negative error code on different kinds of failure.
|
||||
*
|
||||
*/
|
||||
int mbedtls_mpi_sub_abs( mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B );
|
||||
int mbedtls_mpi_sub_abs(mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B);
|
||||
|
||||
/**
|
||||
* \brief Perform a signed addition of MPIs: X = A + B
|
||||
|
@ -662,8 +661,8 @@ int mbedtls_mpi_sub_abs( mbedtls_mpi *X, const mbedtls_mpi *A,
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_add_mpi( mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B );
|
||||
int mbedtls_mpi_add_mpi(mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B);
|
||||
|
||||
/**
|
||||
* \brief Perform a signed subtraction of MPIs: X = A - B
|
||||
|
@ -676,8 +675,8 @@ int mbedtls_mpi_add_mpi( mbedtls_mpi *X, const mbedtls_mpi *A,
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_sub_mpi( mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B );
|
||||
int mbedtls_mpi_sub_mpi(mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B);
|
||||
|
||||
/**
|
||||
* \brief Perform a signed addition of an MPI and an integer: X = A + b
|
||||
|
@ -690,8 +689,8 @@ int mbedtls_mpi_sub_mpi( mbedtls_mpi *X, const mbedtls_mpi *A,
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_add_int( mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
mbedtls_mpi_sint b );
|
||||
int mbedtls_mpi_add_int(mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
mbedtls_mpi_sint b);
|
||||
|
||||
/**
|
||||
* \brief Perform a signed subtraction of an MPI and an integer:
|
||||
|
@ -705,8 +704,8 @@ int mbedtls_mpi_add_int( mbedtls_mpi *X, const mbedtls_mpi *A,
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_sub_int( mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
mbedtls_mpi_sint b );
|
||||
int mbedtls_mpi_sub_int(mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
mbedtls_mpi_sint b);
|
||||
|
||||
/**
|
||||
* \brief Perform a multiplication of two MPIs: X = A * B
|
||||
|
@ -720,8 +719,8 @@ int mbedtls_mpi_sub_int( mbedtls_mpi *X, const mbedtls_mpi *A,
|
|||
* \return Another negative error code on different kinds of failure.
|
||||
*
|
||||
*/
|
||||
int mbedtls_mpi_mul_mpi( mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B );
|
||||
int mbedtls_mpi_mul_mpi(mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B);
|
||||
|
||||
/**
|
||||
* \brief Perform a multiplication of an MPI with an unsigned integer:
|
||||
|
@ -736,8 +735,8 @@ int mbedtls_mpi_mul_mpi( mbedtls_mpi *X, const mbedtls_mpi *A,
|
|||
* \return Another negative error code on different kinds of failure.
|
||||
*
|
||||
*/
|
||||
int mbedtls_mpi_mul_int( mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
mbedtls_mpi_uint b );
|
||||
int mbedtls_mpi_mul_int(mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
mbedtls_mpi_uint b);
|
||||
|
||||
/**
|
||||
* \brief Perform a division with remainder of two MPIs:
|
||||
|
@ -757,8 +756,8 @@ int mbedtls_mpi_mul_int( mbedtls_mpi *X, const mbedtls_mpi *A,
|
|||
* \return #MBEDTLS_ERR_MPI_DIVISION_BY_ZERO if \p B equals zero.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_div_mpi( mbedtls_mpi *Q, mbedtls_mpi *R, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B );
|
||||
int mbedtls_mpi_div_mpi(mbedtls_mpi *Q, mbedtls_mpi *R, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B);
|
||||
|
||||
/**
|
||||
* \brief Perform a division with remainder of an MPI by an integer:
|
||||
|
@ -778,8 +777,8 @@ int mbedtls_mpi_div_mpi( mbedtls_mpi *Q, mbedtls_mpi *R, const mbedtls_mpi *A,
|
|||
* \return #MBEDTLS_ERR_MPI_DIVISION_BY_ZERO if \p b equals zero.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_div_int( mbedtls_mpi *Q, mbedtls_mpi *R, const mbedtls_mpi *A,
|
||||
mbedtls_mpi_sint b );
|
||||
int mbedtls_mpi_div_int(mbedtls_mpi *Q, mbedtls_mpi *R, const mbedtls_mpi *A,
|
||||
mbedtls_mpi_sint b);
|
||||
|
||||
/**
|
||||
* \brief Perform a modular reduction. R = A mod B
|
||||
|
@ -798,8 +797,8 @@ int mbedtls_mpi_div_int( mbedtls_mpi *Q, mbedtls_mpi *R, const mbedtls_mpi *A,
|
|||
* \return Another negative error code on different kinds of failure.
|
||||
*
|
||||
*/
|
||||
int mbedtls_mpi_mod_mpi( mbedtls_mpi *R, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B );
|
||||
int mbedtls_mpi_mod_mpi(mbedtls_mpi *R, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B);
|
||||
|
||||
/**
|
||||
* \brief Perform a modular reduction with respect to an integer.
|
||||
|
@ -817,8 +816,8 @@ int mbedtls_mpi_mod_mpi( mbedtls_mpi *R, const mbedtls_mpi *A,
|
|||
* \return #MBEDTLS_ERR_MPI_NEGATIVE_VALUE if \p b is negative.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_mod_int( mbedtls_mpi_uint *r, const mbedtls_mpi *A,
|
||||
mbedtls_mpi_sint b );
|
||||
int mbedtls_mpi_mod_int(mbedtls_mpi_uint *r, const mbedtls_mpi *A,
|
||||
mbedtls_mpi_sint b);
|
||||
|
||||
/**
|
||||
* \brief Perform a sliding-window exponentiation: X = A^E mod N
|
||||
|
@ -846,9 +845,9 @@ int mbedtls_mpi_mod_int( mbedtls_mpi_uint *r, const mbedtls_mpi *A,
|
|||
* \return Another negative error code on different kinds of failures.
|
||||
*
|
||||
*/
|
||||
int mbedtls_mpi_exp_mod( mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *E, const mbedtls_mpi *N,
|
||||
mbedtls_mpi *_RR );
|
||||
int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *E, const mbedtls_mpi *N,
|
||||
mbedtls_mpi *_RR);
|
||||
|
||||
/**
|
||||
* \brief Fill an MPI with a number of random bytes.
|
||||
|
@ -867,9 +866,9 @@ int mbedtls_mpi_exp_mod( mbedtls_mpi *X, const mbedtls_mpi *A,
|
|||
* as a big-endian representation of an MPI; this can
|
||||
* be relevant in applications like deterministic ECDSA.
|
||||
*/
|
||||
int mbedtls_mpi_fill_random( mbedtls_mpi *X, size_t size,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng );
|
||||
int mbedtls_mpi_fill_random(mbedtls_mpi *X, size_t size,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng);
|
||||
|
||||
/**
|
||||
* \brief Compute the greatest common divisor: G = gcd(A, B)
|
||||
|
@ -882,8 +881,8 @@ int mbedtls_mpi_fill_random( mbedtls_mpi *X, size_t size,
|
|||
* \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed.
|
||||
* \return Another negative error code on different kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_gcd( mbedtls_mpi *G, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B );
|
||||
int mbedtls_mpi_gcd(mbedtls_mpi *G, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *B);
|
||||
|
||||
/**
|
||||
* \brief Compute the modular inverse: X = A^-1 mod N
|
||||
|
@ -901,8 +900,8 @@ int mbedtls_mpi_gcd( mbedtls_mpi *G, const mbedtls_mpi *A,
|
|||
* \return #MBEDTLS_ERR_MPI_NOT_ACCEPTABLE if \p has no modular inverse
|
||||
* with respect to \p N.
|
||||
*/
|
||||
int mbedtls_mpi_inv_mod( mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *N );
|
||||
int mbedtls_mpi_inv_mod(mbedtls_mpi *X, const mbedtls_mpi *A,
|
||||
const mbedtls_mpi *N);
|
||||
|
||||
#if !defined(MBEDTLS_DEPRECATED_REMOVED)
|
||||
#if defined(MBEDTLS_DEPRECATED_WARNING)
|
||||
|
@ -929,9 +928,9 @@ int mbedtls_mpi_inv_mod( mbedtls_mpi *X, const mbedtls_mpi *A,
|
|||
* \return #MBEDTLS_ERR_MPI_NOT_ACCEPTABLE if \p X is not prime.
|
||||
* \return Another negative error code on other kinds of failure.
|
||||
*/
|
||||
MBEDTLS_DEPRECATED int mbedtls_mpi_is_prime( const mbedtls_mpi *X,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng );
|
||||
MBEDTLS_DEPRECATED int mbedtls_mpi_is_prime(const mbedtls_mpi *X,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng);
|
||||
#undef MBEDTLS_DEPRECATED
|
||||
#endif /* !MBEDTLS_DEPRECATED_REMOVED */
|
||||
|
||||
|
@ -962,9 +961,9 @@ MBEDTLS_DEPRECATED int mbedtls_mpi_is_prime( const mbedtls_mpi *X,
|
|||
* \return #MBEDTLS_ERR_MPI_NOT_ACCEPTABLE if \p X is not prime.
|
||||
* \return Another negative error code on other kinds of failure.
|
||||
*/
|
||||
int mbedtls_mpi_is_prime_ext( const mbedtls_mpi *X, int rounds,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng );
|
||||
int mbedtls_mpi_is_prime_ext(const mbedtls_mpi *X, int rounds,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng);
|
||||
/**
|
||||
* \brief Flags for mbedtls_mpi_gen_prime()
|
||||
*
|
||||
|
@ -995,9 +994,9 @@ typedef enum {
|
|||
* \return #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if `nbits` is not between
|
||||
* \c 3 and #MBEDTLS_MPI_MAX_BITS.
|
||||
*/
|
||||
int mbedtls_mpi_gen_prime( mbedtls_mpi *X, size_t nbits, int flags,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng );
|
||||
int mbedtls_mpi_gen_prime(mbedtls_mpi *X, size_t nbits, int flags,
|
||||
int (*f_rng)(void *, unsigned char *, size_t),
|
||||
void *p_rng);
|
||||
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
||||
|
@ -1006,7 +1005,7 @@ int mbedtls_mpi_gen_prime( mbedtls_mpi *X, size_t nbits, int flags,
|
|||
*
|
||||
* \return 0 if successful, or 1 if the test failed
|
||||
*/
|
||||
int mbedtls_mpi_self_test( int verbose );
|
||||
int mbedtls_mpi_self_test(int verbose);
|
||||
|
||||
#endif /* MBEDTLS_SELF_TEST */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue