Lines Matching full:x

247  * \param X         The MPI context to initialize. This must not be \c NULL.
249 void mbedtls_mpi_init(mbedtls_mpi *X);
254 * \param X The MPI context to be cleared. This may be \c NULL,
258 void mbedtls_mpi_free(mbedtls_mpi *X);
266 * \param X The MPI to grow. It must be initialized.
273 int mbedtls_mpi_grow(mbedtls_mpi *X, size_t nblimbs);
279 * If \c X is smaller than \c nblimbs, it is resized up
282 * \param X The MPI to shrink. This must point to an initialized MPI.
290 int mbedtls_mpi_shrink(mbedtls_mpi *X, size_t nblimbs);
295 * \param X The destination MPI. This must point to an initialized MPI.
305 int mbedtls_mpi_copy(mbedtls_mpi *X, const mbedtls_mpi *Y);
310 * \param X The first MPI. It must be initialized.
313 void mbedtls_mpi_swap(mbedtls_mpi *X, mbedtls_mpi *Y);
319 * \param X The MPI to conditionally assign to. This must point
325 * * \c 1: Perform the assignment `X = Y`.
326 * * \c 0: Keep the original value of \p X.
329 * `if( assign ) mbedtls_mpi_copy( X, Y );`
336 * is indeterminate, and the resulting value in \p X might be
343 int mbedtls_mpi_safe_cond_assign(mbedtls_mpi *X, const mbedtls_mpi *Y, unsigned char assign);
349 * \param X The first MPI. This must be initialized.
353 * * \c 1: Swap the values of \p X and \p Y.
354 * * \c 0: Keep the original values of \p X and \p Y.
357 * if( swap ) mbedtls_mpi_swap( X, Y );
364 * is indeterminate, and both \p X and \p Y might end up with
372 int mbedtls_mpi_safe_cond_swap(mbedtls_mpi *X, mbedtls_mpi *Y, unsigned char swap);
377 * \param X The MPI to set. This must be initialized.
384 int mbedtls_mpi_lset(mbedtls_mpi *X, mbedtls_mpi_sint z);
389 * \param X The MPI to query. This must be initialized.
393 * of \c X is unset or set.
396 int mbedtls_mpi_get_bit(const mbedtls_mpi *X, size_t pos);
405 * \param X The MPI to modify. This must be initialized.
413 int mbedtls_mpi_set_bit(mbedtls_mpi *X, size_t pos, unsigned char val);
422 * \param X The MPI to query.
425 * bit of value \c 1 in \p X.
427 size_t mbedtls_mpi_lsb(const mbedtls_mpi *X);
436 * \param X The MPI to query. This must point to an initialized MPI.
441 size_t mbedtls_mpi_bitlen(const mbedtls_mpi *X);
446 * \param X The MPI to use. This must point to an initialized MPI.
449 * the number of bytes used to store \p X internally.
454 * the absolute value of \p X.
456 size_t mbedtls_mpi_size(const mbedtls_mpi *X);
461 * \param X The destination MPI. This must point to an initialized MPI.
468 int mbedtls_mpi_read_string(mbedtls_mpi *X, int radix, const char *s);
473 * \param X The source MPI. This must point to an initialized MPI.
487 * is too small to hold the value of \p X in the desired base.
492 int mbedtls_mpi_write_string(const mbedtls_mpi *X, int radix,
499 * \param X The destination MPI. This must point to an initialized MPI.
510 * '0x' prefix for radix \c 16.
517 int mbedtls_mpi_read_file(mbedtls_mpi *X, int radix, FILE *fin);
523 * For example, this might be a label, or "0x" when
526 * \param X The source MPI. This must point to an initialized MPI.
534 int mbedtls_mpi_write_file(const char *p, const mbedtls_mpi *X,
541 * \param X The destination MPI. This must point to an initialized MPI.
550 int mbedtls_mpi_read_binary(mbedtls_mpi *X, const unsigned char *buf,
554 * \brief Import X from unsigned binary data, little endian
556 * \param X The destination MPI. This must point to an initialized MPI.
565 int mbedtls_mpi_read_binary_le(mbedtls_mpi *X,
569 * \brief Export X into unsigned binary data, big endian.
573 * \param X The source MPI. This must point to an initialized MPI.
580 * large enough to hold the value of \p X.
583 int mbedtls_mpi_write_binary(const mbedtls_mpi *X, unsigned char *buf,
587 * \brief Export X into unsigned binary data, little endian.
591 * \param X The source MPI. This must point to an initialized MPI.
598 * large enough to hold the value of \p X.
601 int mbedtls_mpi_write_binary_le(const mbedtls_mpi *X,
605 * \brief Perform a left-shift on an MPI: X <<= count
607 * \param X The MPI to shift. This must point to an initialized MPI.
608 * The MPI pointed by \p X may be resized to fit
616 int mbedtls_mpi_shift_l(mbedtls_mpi *X, size_t count);
619 * \brief Perform a right-shift on an MPI: X >>= count
621 * \param X The MPI to shift. This must point to an initialized MPI.
628 int mbedtls_mpi_shift_r(mbedtls_mpi *X, size_t count);
633 * \param X The left-hand MPI. This must point to an initialized MPI.
636 * \return \c 1 if `|X|` is greater than `|Y|`.
637 * \return \c -1 if `|X|` is lesser than `|Y|`.
638 * \return \c 0 if `|X|` is equal to `|Y|`.
640 int mbedtls_mpi_cmp_abs(const mbedtls_mpi *X, const mbedtls_mpi *Y);
645 * \param X The left-hand MPI. This must point to an initialized MPI.
648 * \return \c 1 if \p X is greater than \p Y.
649 * \return \c -1 if \p X is lesser than \p Y.
650 * \return \c 0 if \p X is equal to \p Y.
652 int mbedtls_mpi_cmp_mpi(const mbedtls_mpi *X, const mbedtls_mpi *Y);
657 * \param X The left-hand MPI. This must point to an initialized MPI
660 * with the same allocated length as X.
662 * \c 1 if \p X is less than \p Y.
663 * \c 0 if \p X is greater than or equal to \p Y.
669 int mbedtls_mpi_lt_mpi_ct(const mbedtls_mpi *X, const mbedtls_mpi *Y,
675 * \param X The left-hand MPI. This must point to an initialized MPI.
676 * \param z The integer value to compare \p X to.
678 * \return \c 1 if \p X is greater than \p z.
679 * \return \c -1 if \p X is lesser than \p z.
680 * \return \c 0 if \p X is equal to \p z.
682 int mbedtls_mpi_cmp_int(const mbedtls_mpi *X, mbedtls_mpi_sint z);
685 * \brief Perform an unsigned addition of MPIs: X = |A| + |B|
687 * \param X The destination MPI. This must point to an initialized MPI.
695 int mbedtls_mpi_add_abs(mbedtls_mpi *X, const mbedtls_mpi *A,
699 * \brief Perform an unsigned subtraction of MPIs: X = |A| - |B|
701 * \param X The destination MPI. This must point to an initialized MPI.
710 int mbedtls_mpi_sub_abs(mbedtls_mpi *X, const mbedtls_mpi *A,
714 * \brief Perform a signed addition of MPIs: X = A + B
716 * \param X The destination MPI. This must point to an initialized MPI.
724 int mbedtls_mpi_add_mpi(mbedtls_mpi *X, const mbedtls_mpi *A,
728 * \brief Perform a signed subtraction of MPIs: X = A - B
730 * \param X The destination MPI. This must point to an initialized MPI.
738 int mbedtls_mpi_sub_mpi(mbedtls_mpi *X, const mbedtls_mpi *A,
742 * \brief Perform a signed addition of an MPI and an integer: X = A + b
744 * \param X The destination MPI. This must point to an initialized MPI.
752 int mbedtls_mpi_add_int(mbedtls_mpi *X, const mbedtls_mpi *A,
757 * X = A - b
759 * \param X The destination MPI. This must point to an initialized MPI.
767 int mbedtls_mpi_sub_int(mbedtls_mpi *X, const mbedtls_mpi *A,
771 * \brief Perform a multiplication of two MPIs: X = A * B
773 * \param X The destination MPI. This must point to an initialized MPI.
782 int mbedtls_mpi_mul_mpi(mbedtls_mpi *X, const mbedtls_mpi *A,
787 * X = A * b
789 * \param X The destination MPI. This must point to an initialized MPI.
798 int mbedtls_mpi_mul_int(mbedtls_mpi *X, const mbedtls_mpi *A,
883 * \brief Perform a sliding-window exponentiation: X = A^E mod N
885 * \param X The destination MPI. This must point to an initialized MPI.
909 int mbedtls_mpi_exp_mod(mbedtls_mpi *X, const mbedtls_mpi *A,
916 * \param X The destination MPI. This must point to an initialized MPI.
930 int mbedtls_mpi_fill_random(mbedtls_mpi *X, size_t size,
946 * \param X The destination MPI. This must point to an initialized MPI.
966 int mbedtls_mpi_random(mbedtls_mpi *X,
987 * \brief Compute the modular inverse: X = A^-1 mod N
989 * \param X The destination MPI. This must point to an initialized MPI.
1002 int mbedtls_mpi_inv_mod(mbedtls_mpi *X, const mbedtls_mpi *A,
1008 * \warning If \p X is potentially generated by an adversary, for example
1013 * if \p X is chosen uniformly or non-adversarially (as is the
1017 * \param X The MPI to check for primality.
1027 * \return \c 0 if successful, i.e. \p X is probably prime.
1029 * \return #MBEDTLS_ERR_MPI_NOT_ACCEPTABLE if \p X is not prime.
1032 int mbedtls_mpi_is_prime_ext(const mbedtls_mpi *X, int rounds,
1038 * Each of these flags is a constraint on the result X returned by
1042 MBEDTLS_MPI_GEN_PRIME_FLAG_DH = 0x0001, /**< (X-1)/2 is prime too */
1049 * \param X The destination MPI to store the generated prime in.
1059 * \return \c 0 if successful, in which case \p X holds a
1065 int mbedtls_mpi_gen_prime(mbedtls_mpi *X, size_t nbits, int flags,