@@ -14200,7 +14200,7 @@ static int _sp_exptmod_base_2(const sp_int* e, int digits, const sp_int* m,
1420014200 * @return MP_OKAY on success.
1420114201 * @return MP_VAL when b, e, m or r is NULL, digits is negative, or m <= 0 or
1420214202 * e is negative; or m is even in an RSA verify/public only build
14203- * without DH.
14203+ * without DH or OPENSSL_ALL .
1420414204 * @return MP_MEM when dynamic memory allocation fails.
1420514205 */
1420614206int sp_exptmod_ex(const sp_int* b, const sp_int* e, int digits, const sp_int* m,
@@ -14380,7 +14380,9 @@ int sp_exptmod_ex(const sp_int* b, const sp_int* e, int digits, const sp_int* m,
1438014380 * @param [out] r SP integer to hold result.
1438114381 *
1438214382 * @return MP_OKAY on success.
14383- * @return MP_VAL when b, e, m or r is NULL; or m <= 0 or e is negative.
14383+ * @return MP_VAL when b, e, m or r is NULL; or m <= 0 or e is negative; or
14384+ * m is even in an RSA verify/public only build without DH or
14385+ * OPENSSL_ALL.
1438414386 * @return MP_MEM when dynamic memory allocation fails.
1438514387 */
1438614388int sp_exptmod(const sp_int* b, const sp_int* e, const sp_int* m, sp_int* r)
@@ -14841,7 +14843,8 @@ static int _sp_exptmod_nct(const sp_int* b, const sp_int* e, const sp_int* m,
1484114843 *
1484214844 * @return MP_OKAY on success.
1484314845 * @return MP_VAL when b, e, m or r is NULL; or m <= 0 or e is negative; or
14844- * m is even in an RSA verify/public only build without DH.
14846+ * m is even in an RSA verify/public only build without DH or
14847+ * OPENSSL_ALL.
1484514848 * @return MP_MEM when dynamic memory allocation fails.
1484614849 */
1484714850int sp_exptmod_nct(const sp_int* b, const sp_int* e, const sp_int* m, sp_int* r)
@@ -14888,19 +14891,18 @@ int sp_exptmod_nct(const sp_int* b, const sp_int* e, const sp_int* m, sp_int* r)
1488814891 else if (m->used * 2 >= r->size) {
1488914892 err = MP_VAL;
1489014893 }
14894+ else if (mp_iseven(m)) {
1489114895#if (defined(WOLFSSL_SP_MATH_ALL) && !defined(WOLFSSL_RSA_VERIFY_ONLY) && \
1489214896 !defined(WOLFSSL_RSA_PUBLIC_ONLY)) || !defined(NO_DH) || \
1489314897 defined(OPENSSL_ALL)
14894- else if (mp_iseven(m)) {
1489514898 err = _sp_exptmod_ex(b, e, (int)(e->used * SP_WORD_SIZE), m, r);
14896- }
1489714899#else
14898- /* Montgomery form requires an odd modulus and the generic implementation
14899- * is not compiled in (RSA verify/public only without DH). */
14900- else if (mp_iseven(m)) {
14900+ /* Montgomery form requires an odd modulus and the generic
14901+ * implementation is not compiled in (RSA verify/public only without
14902+ * DH). */
1490114903 err = MP_VAL;
14902- }
1490314904#endif
14905+ }
1490414906 else {
1490514907 err = _sp_exptmod_nct(b, e, m, r);
1490614908 }
0 commit comments