Tweak the SP x86_64 ECC assembly
Put back fixes undone in previous commits: - Fix casting warning in SP when mp_digit < sp_digit - SP fix check for NULL in EC point_new
This commit is contained in:
@@ -5235,10 +5235,10 @@ static int sp_2048_to_mp(const sp_digit* a, mp_int* r)
|
||||
|
||||
r->dp[0] = 0;
|
||||
for (i = 0; i < 32; i++) {
|
||||
r->dp[j] |= a[i] << s;
|
||||
r->dp[j] |= (mp_digit)(a[i] << s);
|
||||
r->dp[j] &= (1L << DIGIT_BIT) - 1;
|
||||
s = DIGIT_BIT - s;
|
||||
r->dp[++j] = a[i] >> s;
|
||||
r->dp[++j] = (mp_digit)(a[i] >> s);
|
||||
while (s + DIGIT_BIT <= 64) {
|
||||
s += DIGIT_BIT;
|
||||
r->dp[j++] &= (1L << DIGIT_BIT) - 1;
|
||||
@@ -5246,7 +5246,7 @@ static int sp_2048_to_mp(const sp_digit* a, mp_int* r)
|
||||
r->dp[j] = 0;
|
||||
}
|
||||
else {
|
||||
r->dp[j] = a[i] >> s;
|
||||
r->dp[j] = (mp_digit)(a[i] >> s);
|
||||
}
|
||||
}
|
||||
s = 64 - s;
|
||||
@@ -12907,10 +12907,10 @@ static int sp_3072_to_mp(const sp_digit* a, mp_int* r)
|
||||
|
||||
r->dp[0] = 0;
|
||||
for (i = 0; i < 48; i++) {
|
||||
r->dp[j] |= a[i] << s;
|
||||
r->dp[j] |= (mp_digit)(a[i] << s);
|
||||
r->dp[j] &= (1L << DIGIT_BIT) - 1;
|
||||
s = DIGIT_BIT - s;
|
||||
r->dp[++j] = a[i] >> s;
|
||||
r->dp[++j] = (mp_digit)(a[i] >> s);
|
||||
while (s + DIGIT_BIT <= 64) {
|
||||
s += DIGIT_BIT;
|
||||
r->dp[j++] &= (1L << DIGIT_BIT) - 1;
|
||||
@@ -12918,7 +12918,7 @@ static int sp_3072_to_mp(const sp_digit* a, mp_int* r)
|
||||
r->dp[j] = 0;
|
||||
}
|
||||
else {
|
||||
r->dp[j] = a[i] >> s;
|
||||
r->dp[j] = (mp_digit)(a[i] >> s);
|
||||
}
|
||||
}
|
||||
s = 64 - s;
|
||||
@@ -17806,10 +17806,10 @@ static int sp_4096_to_mp(const sp_digit* a, mp_int* r)
|
||||
|
||||
r->dp[0] = 0;
|
||||
for (i = 0; i < 64; i++) {
|
||||
r->dp[j] |= a[i] << s;
|
||||
r->dp[j] |= (mp_digit)(a[i] << s);
|
||||
r->dp[j] &= (1L << DIGIT_BIT) - 1;
|
||||
s = DIGIT_BIT - s;
|
||||
r->dp[++j] = a[i] >> s;
|
||||
r->dp[++j] = (mp_digit)(a[i] >> s);
|
||||
while (s + DIGIT_BIT <= 64) {
|
||||
s += DIGIT_BIT;
|
||||
r->dp[j++] &= (1L << DIGIT_BIT) - 1;
|
||||
@@ -17817,7 +17817,7 @@ static int sp_4096_to_mp(const sp_digit* a, mp_int* r)
|
||||
r->dp[j] = 0;
|
||||
}
|
||||
else {
|
||||
r->dp[j] = a[i] >> s;
|
||||
r->dp[j] = (mp_digit)(a[i] >> s);
|
||||
}
|
||||
}
|
||||
s = 64 - s;
|
||||
@@ -18568,7 +18568,7 @@ static int sp_256_point_new_ex_4(void* heap, sp_point_256* sp, sp_point_256** p)
|
||||
#else
|
||||
*p = sp;
|
||||
#endif
|
||||
if (p == NULL) {
|
||||
if (*p == NULL) {
|
||||
ret = MEMORY_E;
|
||||
}
|
||||
return ret;
|
||||
@@ -18787,10 +18787,10 @@ static int sp_256_to_mp(const sp_digit* a, mp_int* r)
|
||||
|
||||
r->dp[0] = 0;
|
||||
for (i = 0; i < 4; i++) {
|
||||
r->dp[j] |= a[i] << s;
|
||||
r->dp[j] |= (mp_digit)(a[i] << s);
|
||||
r->dp[j] &= (1L << DIGIT_BIT) - 1;
|
||||
s = DIGIT_BIT - s;
|
||||
r->dp[++j] = a[i] >> s;
|
||||
r->dp[++j] = (mp_digit)(a[i] >> s);
|
||||
while (s + DIGIT_BIT <= 64) {
|
||||
s += DIGIT_BIT;
|
||||
r->dp[j++] &= (1L << DIGIT_BIT) - 1;
|
||||
@@ -18798,7 +18798,7 @@ static int sp_256_to_mp(const sp_digit* a, mp_int* r)
|
||||
r->dp[j] = 0;
|
||||
}
|
||||
else {
|
||||
r->dp[j] = a[i] >> s;
|
||||
r->dp[j] = (mp_digit)(a[i] >> s);
|
||||
}
|
||||
}
|
||||
s = 64 - s;
|
||||
@@ -36352,7 +36352,7 @@ static int sp_384_point_new_ex_6(void* heap, sp_point_384* sp, sp_point_384** p)
|
||||
#else
|
||||
*p = sp;
|
||||
#endif
|
||||
if (p == NULL) {
|
||||
if (*p == NULL) {
|
||||
ret = MEMORY_E;
|
||||
}
|
||||
return ret;
|
||||
@@ -36624,10 +36624,10 @@ static int sp_384_to_mp(const sp_digit* a, mp_int* r)
|
||||
|
||||
r->dp[0] = 0;
|
||||
for (i = 0; i < 6; i++) {
|
||||
r->dp[j] |= a[i] << s;
|
||||
r->dp[j] |= (mp_digit)(a[i] << s);
|
||||
r->dp[j] &= (1L << DIGIT_BIT) - 1;
|
||||
s = DIGIT_BIT - s;
|
||||
r->dp[++j] = a[i] >> s;
|
||||
r->dp[++j] = (mp_digit)(a[i] >> s);
|
||||
while (s + DIGIT_BIT <= 64) {
|
||||
s += DIGIT_BIT;
|
||||
r->dp[j++] &= (1L << DIGIT_BIT) - 1;
|
||||
@@ -36635,7 +36635,7 @@ static int sp_384_to_mp(const sp_digit* a, mp_int* r)
|
||||
r->dp[j] = 0;
|
||||
}
|
||||
else {
|
||||
r->dp[j] = a[i] >> s;
|
||||
r->dp[j] = (mp_digit)(a[i] >> s);
|
||||
}
|
||||
}
|
||||
s = 64 - s;
|
||||
|
||||
Reference in New Issue
Block a user