mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-07-07 20:20:51 +02:00
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:
+17
-17
@@ -4297,10 +4297,10 @@ static int sp_2048_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 <= 32) {
|
||||
s += DIGIT_BIT;
|
||||
r->dp[j++] &= (1L << DIGIT_BIT) - 1;
|
||||
@@ -4308,7 +4308,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 = 32 - s;
|
||||
@@ -8889,10 +8889,10 @@ static int sp_3072_to_mp(const sp_digit* a, mp_int* r)
|
||||
|
||||
r->dp[0] = 0;
|
||||
for (i = 0; i < 96; 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 <= 32) {
|
||||
s += DIGIT_BIT;
|
||||
r->dp[j++] &= (1L << DIGIT_BIT) - 1;
|
||||
@@ -8900,7 +8900,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 = 32 - s;
|
||||
@@ -12428,10 +12428,10 @@ static int sp_4096_to_mp(const sp_digit* a, mp_int* r)
|
||||
|
||||
r->dp[0] = 0;
|
||||
for (i = 0; i < 128; 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 <= 32) {
|
||||
s += DIGIT_BIT;
|
||||
r->dp[j++] &= (1L << DIGIT_BIT) - 1;
|
||||
@@ -12439,7 +12439,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 = 32 - s;
|
||||
@@ -13587,7 +13587,7 @@ static int sp_256_point_new_ex_8(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;
|
||||
@@ -13810,10 +13810,10 @@ static int sp_256_to_mp(const sp_digit* a, mp_int* r)
|
||||
|
||||
r->dp[0] = 0;
|
||||
for (i = 0; i < 8; 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 <= 32) {
|
||||
s += DIGIT_BIT;
|
||||
r->dp[j++] &= (1L << DIGIT_BIT) - 1;
|
||||
@@ -13821,7 +13821,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 = 32 - s;
|
||||
@@ -20048,7 +20048,7 @@ static int sp_384_point_new_ex_12(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;
|
||||
@@ -20302,10 +20302,10 @@ static int sp_384_to_mp(const sp_digit* a, mp_int* r)
|
||||
|
||||
r->dp[0] = 0;
|
||||
for (i = 0; i < 12; 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 <= 32) {
|
||||
s += DIGIT_BIT;
|
||||
r->dp[j++] &= (1L << DIGIT_BIT) - 1;
|
||||
@@ -20313,7 +20313,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 = 32 - s;
|
||||
|
||||
Reference in New Issue
Block a user