Skip to content
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

s2n doesn't compile on MIPS Platforms #1592

Closed
alexw91 opened this issue Feb 28, 2020 · 4 comments
Closed

s2n doesn't compile on MIPS Platforms #1592

alexw91 opened this issue Feb 28, 2020 · 4 comments

Comments

@alexw91
Copy link
Contributor

alexw91 commented Feb 28, 2020

Problem:

Some users need to disable the pq-crypto build in order to build on MIPS platforms.
There is build error on this line: https://github.com/aws/s2n-tls/blob/main/pq-crypto/sike_r1/config_r1.h#L58

Proposed Solution:

  1. Add a MIPS build to s2n Codebuild as a regression test
  2. Fix issues that are causing pq-crypto directory to fail to build when building on MIPS platforms
@zaherd
Copy link

zaherd commented Jun 15, 2020

  1. Add a MIPS build to s2n Codebuild as a regression test
  2. Fix issues that are causing pq-crypto directory to fail to build when building on MIPS platforms

@stwirth
Copy link

stwirth commented Jul 20, 2022

Any hints on what needs to be done to compile on mips?
I'm compiling v1.3.12 (within aws-iot-device-sdk-cpp-v2 v1.18.5) for a MIPS-base embedded CPU and the only issue I have is that

#error -- "Unsupported ARCHITECTURE"

gets triggered.
When I add

diff --git a/pq-crypto/sike_r3/sikep434r3.h b/pq-crypto/sike_r3/sikep434r3.h
index 5b797b1d..5ea0b0cf 100644
--- a/pq-crypto/sike_r3/sikep434r3.h
+++ b/pq-crypto/sike_r3/sikep434r3.h
@@ -41,7 +41,7 @@ uint64_t bswap64(uint64_t x);
     #define S2N_SIKE_P434_R3_BSWAP_DIGIT(i)  bswap64((i))
     typedef uint64_t digit_t;
     typedef uint32_t hdigit_t;
-#elif defined(_X86_) || defined(_ARM_) || defined(__arm__) || defined(__i386__)
+#elif defined(_X86_) || defined(_ARM_) || defined(__arm__) || defined(__i386__) || defined(__mips__)
     #define S2N_SIKE_P434_R3_NWORDS_FIELD    14 /* Number of words of a 434-bit field element */
     #define S2N_SIKE_P434_R3_ZERO_WORDS      6  /* Number of "0" digits in the least significant part of p434 + 1 */
     #define S2N_SIKE_P434_R3_RADIX           32

then compilation goes through but I'm not sure if it works.
I'm getting

[WARN] [2020-03-01T13:33:24Z] [76aff3f0] [tls-handler] - id=0x76112428: negotiation failed with error Certificate is untrusted (Error encountered in /project/aws-iot-device-sdk-cpp-v2-src/crt/aws-crt-cpp/crt/s2n/tls/s2n_server_cert.c:49)

on the embedded system when I try an MQTT connection example that works well on my desktop.

@maddeleine
Copy link
Contributor

@stwirth We have actually removed the sike_r3 folder from our pq-crypto directory since df28694. Can you try that commit and let us know if it fixes your MIPS compilation issue?
The connection error you're getting is a separate issue; your tls-handler isn't configured correctly so that it can trust its peer certificate.

@stwirth
Copy link

stwirth commented Jul 26, 2022

Thanks @maddeleine. I can confirm that compilation goes through with that commit and with main as well.
The TLS error was due to the time not being set correctly on the device.

So from my point of view, this issue can be closed, I compiled s2n successfully for a MIPS platform.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants