mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
tfm fp_exptmod_nct: set result to zero when base is zero
This commit is contained in:
@ -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);
|
int x = fp_count_bits (X);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* 0^X mod P = 0 mod P = 0.
|
||||||
|
* Set result to 0 and return early. */
|
||||||
if (fp_iszero(G)) {
|
if (fp_iszero(G)) {
|
||||||
fp_set(G, 0);
|
fp_set(Y, 0);
|
||||||
return FP_OKAY;
|
return FP_OKAY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user