RSA: refactor: avoid code duplication
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/library/rsa_alt_helpers.h b/library/rsa_alt_helpers.h
index 052b024..580ffb2 100644
--- a/library/rsa_alt_helpers.h
+++ b/library/rsa_alt_helpers.h
@@ -89,12 +89,15 @@
* \param P First prime factor of RSA modulus
* \param Q Second prime factor of RSA modulus
* \param E RSA public exponent
- * \param D Pointer to MPI holding the private exponent on success.
+ * \param D Pointer to MPI holding the private exponent on success,
+ * ie the modular inverse of E modulo LCM(P-1,Q-1).
*
- * \return
- * - 0 if successful. In this case, D is set to a simultaneous
- * modular inverse of E modulo both P-1 and Q-1.
- * - A non-zero error code otherwise.
+ * \return \c 0 if successful.
+ * \return #MBEDTLS_ERR_MPI_ALLOC_FAILED if a memory allocation failed.
+ * \return #MBEDTLS_ERR_MPI_NOT_ACCEPTABLE if E is not coprime to P-1
+ * and Q-1, that is, if GCD( E, (P-1)*(Q-1) ) != 1.
+ * \return #MBEDTLS_ERR_MPI_BAD_INPUT_DATA if inputs are otherwise
+ * invalid.
*
* \note This function does not check whether P and Q are primes.
*