mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-29 18:27:29 +02:00
Merge pull request #4881 from SparkiDev/sp_asm_shift_fix
SP asm: fix for modexp corner case
This commit is contained in:
@ -4373,6 +4373,10 @@ static int sp_2048_mod_exp_32(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -4540,6 +4544,10 @@ static int sp_2048_mod_exp_32(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -6797,6 +6805,10 @@ static int sp_2048_mod_exp_64(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -6947,6 +6959,10 @@ static int sp_2048_mod_exp_64(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -8057,6 +8073,10 @@ static int sp_2048_mod_exp_2_64(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -14439,6 +14459,10 @@ static int sp_3072_mod_exp_48(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -14606,6 +14630,10 @@ static int sp_3072_mod_exp_48(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -17695,6 +17723,10 @@ static int sp_3072_mod_exp_96(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -17845,6 +17877,10 @@ static int sp_3072_mod_exp_96(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -19203,6 +19239,10 @@ static int sp_3072_mod_exp_2_96(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -25320,6 +25360,10 @@ static int sp_4096_mod_exp_128(sp_digit* r, const sp_digit* a, const sp_digit* e
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -25470,6 +25514,10 @@ static int sp_4096_mod_exp_128(sp_digit* r, const sp_digit* a, const sp_digit* e
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -27076,6 +27124,10 @@ static int sp_4096_mod_exp_2_128(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
|
@ -3322,6 +3322,10 @@ static int sp_2048_mod_exp_16(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -3489,6 +3493,10 @@ static int sp_2048_mod_exp_16(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -4901,6 +4909,10 @@ static int sp_2048_mod_exp_32(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -5051,6 +5063,10 @@ static int sp_2048_mod_exp_32(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -5915,6 +5931,10 @@ static int sp_2048_mod_exp_2_32(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -10944,6 +10964,10 @@ static int sp_3072_mod_exp_24(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -11111,6 +11135,10 @@ static int sp_3072_mod_exp_24(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -12947,6 +12975,10 @@ static int sp_3072_mod_exp_48(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -13097,6 +13129,10 @@ static int sp_3072_mod_exp_48(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -14085,6 +14121,10 @@ static int sp_3072_mod_exp_2_48(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -18156,6 +18196,10 @@ static int sp_4096_mod_exp_64(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -18306,6 +18350,10 @@ static int sp_4096_mod_exp_64(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -19418,6 +19466,10 @@ static int sp_4096_mod_exp_2_64(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
|
@ -23860,6 +23860,10 @@ static int sp_2048_mod_exp_32(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -24027,6 +24031,10 @@ static int sp_2048_mod_exp_32(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -27304,6 +27312,10 @@ static int sp_2048_mod_exp_64(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -27454,6 +27466,10 @@ static int sp_2048_mod_exp_64(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -29673,6 +29689,10 @@ static int sp_2048_mod_exp_2_64(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -74892,6 +74912,10 @@ static int sp_3072_mod_exp_48(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -75059,6 +75083,10 @@ static int sp_3072_mod_exp_48(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -79167,6 +79195,10 @@ static int sp_3072_mod_exp_96(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -79317,6 +79349,10 @@ static int sp_3072_mod_exp_96(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -82334,6 +82370,10 @@ static int sp_3072_mod_exp_2_96(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -91522,6 +91562,10 @@ static int sp_4096_mod_exp_128(sp_digit* r, const sp_digit* a, const sp_digit* e
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -91672,6 +91716,10 @@ static int sp_4096_mod_exp_128(sp_digit* r, const sp_digit* a, const sp_digit* e
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -95482,6 +95530,10 @@ static int sp_4096_mod_exp_2_128(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
|
@ -3264,6 +3264,10 @@ static int sp_2048_mod_exp_32(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -3431,6 +3435,10 @@ static int sp_2048_mod_exp_32(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -4237,6 +4245,10 @@ static int sp_2048_mod_exp_64(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -4387,6 +4399,10 @@ static int sp_2048_mod_exp_64(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -5390,6 +5406,10 @@ static int sp_2048_mod_exp_2_64(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -8415,6 +8435,10 @@ static int sp_3072_mod_exp_48(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -8582,6 +8606,10 @@ static int sp_3072_mod_exp_48(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -9472,6 +9500,10 @@ static int sp_3072_mod_exp_96(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -9622,6 +9654,10 @@ static int sp_3072_mod_exp_96(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -10821,6 +10857,10 @@ static int sp_3072_mod_exp_2_96(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -13189,6 +13229,10 @@ static int sp_4096_mod_exp_128(sp_digit* r, const sp_digit* a, const sp_digit* e
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -13339,6 +13383,10 @@ static int sp_4096_mod_exp_128(sp_digit* r, const sp_digit* a, const sp_digit* e
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
@ -14735,6 +14783,10 @@ static int sp_4096_mod_exp_2_128(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 32 - c;
|
||||
|
@ -587,6 +587,10 @@ static int sp_2048_mod_exp_16(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -810,6 +814,10 @@ static int sp_2048_mod_exp_avx2_16(sp_digit* r, const sp_digit* a, const sp_digi
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -1272,6 +1280,10 @@ static int sp_2048_mod_exp_32(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -1479,6 +1491,10 @@ static int sp_2048_mod_exp_avx2_32(sp_digit* r, const sp_digit* a, const sp_digi
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -2190,6 +2206,10 @@ static int sp_2048_mod_exp_2_avx2_32(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -2325,6 +2345,10 @@ static int sp_2048_mod_exp_2_32(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -3112,6 +3136,10 @@ static int sp_3072_mod_exp_24(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -3335,6 +3363,10 @@ static int sp_3072_mod_exp_avx2_24(sp_digit* r, const sp_digit* a, const sp_digi
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -3797,6 +3829,10 @@ static int sp_3072_mod_exp_48(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -4004,6 +4040,10 @@ static int sp_3072_mod_exp_avx2_48(sp_digit* r, const sp_digit* a, const sp_digi
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -4715,6 +4755,10 @@ static int sp_3072_mod_exp_2_avx2_48(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -4850,6 +4894,10 @@ static int sp_3072_mod_exp_2_48(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -5687,6 +5735,10 @@ static int sp_4096_mod_exp_64(sp_digit* r, const sp_digit* a, const sp_digit* e,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -5894,6 +5946,10 @@ static int sp_4096_mod_exp_avx2_64(sp_digit* r, const sp_digit* a, const sp_digi
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -6605,6 +6661,10 @@ static int sp_4096_mod_exp_2_avx2_64(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
@ -6740,6 +6800,10 @@ static int sp_4096_mod_exp_2_64(sp_digit* r, const sp_digit* e, int bits,
|
||||
n <<= c;
|
||||
c = 64 - c;
|
||||
}
|
||||
else if (c == 0) {
|
||||
/* All bits in top word used. */
|
||||
y = (byte)n;
|
||||
}
|
||||
else {
|
||||
y = (byte)(n >> c);
|
||||
n <<= 64 - c;
|
||||
|
Reference in New Issue
Block a user