1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-12 18:49:07 +00:00

Merge pull request #4 from jpochyla/master

MSVC compatibility fixes
This commit is contained in:
Pavol Rusnak 2014-02-15 16:19:23 +01:00
commit 93e7f5ca8b
2 changed files with 778 additions and 778 deletions

View File

@ -209,11 +209,11 @@ void bn_multiply(const bignum256 *k, bignum256 *x, const bignum256 *prime)
// estimate (res / prime)
coef = (res[i] >> 16) + (res[i + 1] << 14);
// substract (coef * prime) from res
temp = 0x1000000000000000llu + res[i - 8] - prime->val[0] * (uint64_t)coef;
temp = 0x1000000000000000ull + res[i - 8] - prime->val[0] * (uint64_t)coef;
res[i - 8] = temp & 0x3FFFFFFF;
for (j = 1; j < 9; j++) {
temp >>= 30;
temp += 0xFFFFFFFC0000000llu + res[i - 8 + j] - prime->val[j] * (uint64_t)coef;
temp += 0xFFFFFFFC0000000ull + res[i - 8 + j] - prime->val[j] * (uint64_t)coef;
res[i - 8 + j] = temp & 0x3FFFFFFF;
}
}
@ -233,11 +233,11 @@ void bn_fast_mod(bignum256 *x, const bignum256 *prime)
coef = x->val[8] >> 16;
if (!coef) return;
// substract (coef * prime) from x
temp = 0x1000000000000000llu + x->val[0] - prime->val[0] * (uint64_t)coef;
temp = 0x1000000000000000ull + x->val[0] - prime->val[0] * (uint64_t)coef;
x->val[0] = temp & 0x3FFFFFFF;
for (j = 1; j < 9; j++) {
temp >>= 30;
temp += 0xFFFFFFFC0000000llu + x->val[j] - prime->val[j] * (uint64_t)coef;
temp += 0xFFFFFFFC0000000ull + x->val[j] - prime->val[j] * (uint64_t)coef;
x->val[j] = temp & 0x3FFFFFFF;
}
}

File diff suppressed because it is too large Load Diff