Bignum core: Break shift_r function out of the classic shift_r
This commit contains the function prototype for mbedtls_mpi_core_shift_r,
and the implementation minimally modified from mbedtls_mpi_shift_r.
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
diff --git a/library/bignum_core.h b/library/bignum_core.h
index 196736d..4ba1433 100644
--- a/library/bignum_core.h
+++ b/library/bignum_core.h
@@ -262,6 +262,21 @@
unsigned char *output,
size_t output_length );
+/** \brief Shift a machine integer right by a number of bits.
+ *
+ * Shifting by more bits than there are bit positions
+ * in \p X is valid and results in setting \p X to 0.
+ *
+ * This function's execution time depends on the value
+ * of \p count (and of course \p limbs).
+ *
+ * \param[in,out] X The number to shift.
+ * \param limbs The number of limbs of \p X. This must be at least 1.
+ * \param count The number of bits to shift by.
+ */
+void mbedtls_mpi_core_shift_r( mbedtls_mpi_uint *X, size_t limbs,
+ size_t count );
+
/**
* \brief Conditional addition of two fixed-size large unsigned integers,
* returning the carry.