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

Cannot compile/assemble some assembly modules as PIC #25

Open
wernerd opened this issue Feb 20, 2020 · 2 comments
Open

Cannot compile/assemble some assembly modules as PIC #25

wernerd opened this issue Feb 20, 2020 · 2 comments

Comments

@wernerd
Copy link

wernerd commented Feb 20, 2020

In my fork of SIDH to add Cmake, C++ wrapper, Android, Java support I build a shared library which includes the SIDH modules. To support Android applications a shared library is a pre-requisite.

When compiling/assemble fp_x64_asm.S clang reports a problem that it cannot generate position independent code (-fpic).

The offending lines in file fp_x64_asm.S look like this

    MUL128x256_SCHOOL [reg_p1], [rip+p434p1+24], r8, r9, r10, r11, r12, r13, rcx     

The culprit here is the reference to p434p1 which is a global variable in the C-sources. The same holds for p503p1, p610p1, and p751p1 variables in their respective assembler files. Tested using clang V9.0.1.

Because I'm not familiar with x86 assembler ;-) I could not fix this and thus reverted to the generic modules to build the shared library. These are definitely slower than the optimized assembler code.

I found some other smaller issues when building the shared library, however these could be easily solved - I show them in another issue.

@christianpaquin
Copy link
Contributor

The Open Quantum Safe library incorporates the different SIDH parameters under a common library, either static or shared. The project also supports multiple platforms and provides non-C language wrappers; someone is working on an android build. It also now builds with cmake. You might want to call SIDH from this abstraction layer instead, to facilitate your integration.

@wernerd
Copy link
Author

wernerd commented Feb 20, 2020 via email

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

No branches or pull requests

2 participants