-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SP: big-endian support #7410
SP: big-endian support #7410
Conversation
@SparkiDev , what's the state of this PR? Is it ready for review? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to get this to compile with BIG_ENDIAN_ORDER
, these changes are needed:
diff --git a/wolfcrypt/src/sp_arm32.c b/wolfcrypt/src/sp_arm32.c
index d08bf9cd3..20d7f5577 100644
--- a/wolfcrypt/src/sp_arm32.c
+++ b/wolfcrypt/src/sp_arm32.c
@@ -91,7 +91,6 @@ static void sp_2048_from_bin(sp_digit* r, int size, const byte* a, int n)
{
int i;
int j;
- byte* d;
for (i = n - 1,j = 0; i >= 3; i -= 4) {
r[j] = ((sp_digit)a[i - 0] << 0) |
@@ -111,6 +110,8 @@ static void sp_2048_from_bin(sp_digit* r, int size, const byte* a, int n)
r[j] |= ((sp_digit)a[i]) << s;
}
#else
+ byte* d;
+
r[j] = 0;
d = (byte*)r;
@@ -18274,7 +18275,6 @@ static void sp_3072_from_bin(sp_digit* r, int size, const byte* a, int n)
{
int i;
int j;
- byte* d;
for (i = n - 1,j = 0; i >= 3; i -= 4) {
r[j] = ((sp_digit)a[i - 0] << 0) |
@@ -18294,6 +18294,8 @@ static void sp_3072_from_bin(sp_digit* r, int size, const byte* a, int n)
r[j] |= ((sp_digit)a[i]) << s;
}
#else
+ byte* d;
+
r[j] = 0;
d = (byte*)r;
@@ -76393,7 +76395,6 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
{
int i;
int j;
- byte* d;
for (i = n - 1,j = 0; i >= 3; i -= 4) {
r[j] = ((sp_digit)a[i - 0] << 0) |
@@ -76413,6 +76414,8 @@ static void sp_256_from_bin(sp_digit* r, int size, const byte* a, int n)
r[j] |= ((sp_digit)a[i]) << s;
}
#else
+ byte* d;
+
r[j] = 0;
d = (byte*)r;
@@ -156655,7 +156658,6 @@ static void sp_1024_from_bin(sp_digit* r, int size, const byte* a, int n)
{
int i;
int j;
- byte* d;
for (i = n - 1,j = 0; i >= 3; i -= 4) {
r[j] = ((sp_digit)a[i - 0] << 0) |
@@ -156675,6 +156677,8 @@ static void sp_1024_from_bin(sp_digit* r, int size, const byte* a, int n)
r[j] |= ((sp_digit)a[i]) << s;
}
#else
+ byte* d;
+
r[j] = 0;
d = (byte*)r;
once that's done, building on armeb-linux-gnueabihf
gives
/tmp/tmp.4346_12509/cc4wYqsG.s:133: Error: selected processor does not support `umaal r11,r12,r0,r5' in ARM mode
/tmp/tmp.4346_12509/cc4wYqsG.s:135: Error: selected processor does not support `umaal r12,r8,r1,r5' in ARM mode
/tmp/tmp.4346_12509/cc4wYqsG.s:136: Error: selected processor does not support `umaal r12,r7,r0,r6' in ARM mode
[and a couple hundred more like this]
not sure if I'm using the wrong target or what.
it builds clean targeting armv7a-unknown-linux-gnueabihf
.
@SparkiDev nice work on this, please spend some more time if possible to finish it up. |
Handle reading and writing from big-endian byte array when compiling for big endian. Rework little endian to be more effiecient too.
22a6b02
to
10e8f68
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
multi-test passes on cross-aarch64_be-all-sp-asm-unittest-sanitizer cross-armeb-all-noasm-testsuite quantum-safe-wolfssl-all-cross-armv7a-armasm-unittest
, but still fails on cross-armeb-all-armasm-testsuite
(problem is in master
).
Description
Handle reading and writing from big-endian byte array when compiling for big-endian.
Fixes zd#17810
Testing
Emulator not available on Ubuntu for big-endian ARM.
Checklist