tfm fp_exptmod_nct: set result to zero when base is zero

pull/6622/head
jordan 2023-07-14 13:57:29 -05:00
parent 20115f0e23
commit 1afc0df83d
1 changed files with 3 additions and 1 deletions

View File

@ -3171,8 +3171,10 @@ int fp_exptmod_nct(fp_int * G, fp_int * X, fp_int * P, fp_int * Y)
int x = fp_count_bits (X);
#endif
/* 0^X mod P = 0 mod P = 0.
* Set result to 0 and return early. */
if (fp_iszero(G)) {
fp_set(G, 0);
fp_set(Y, 0);
return FP_OKAY;
}