liboqs icon indicating copy to clipboard operation
liboqs copied to clipboard

RISC-V support

Open hack3ric opened this issue 3 years ago • 41 comments

Hello,

I am porting various packages to riscv64 platform. I saw comments on compilation in CMakeLists.txt:

Compilation on an unsupported processor should only be used for testing, as it may result an insecure configuration, for example due to variable-time instructions leaking secret information.

Is there anything we need to do, like auditing RISC-V processors, in order to have them supported?

hack3ric avatar Mar 15 '23 09:03 hack3ric

Hello -- thanks very much for your interest to help move this project forward!

Is there anything we need to do, like auditing RISC-V processors, in order to have them supported?

The best would be an addition of such processors to a CI environment in which this support could be "proven" (by successfully running the (self)tests). We're open to any suggestions as to which such CI system to use for this.

baentsch avatar Mar 15 '23 09:03 baentsch

@hack3ric May I ask about your success getting liboqs to run OK on RISC-V? If so, we could add a statement to the warning you quote above that RISC-V "has been tested at vx.x.x" (you tell us which version) -- but as long as such machines are not part of CI, I'd think it'd not be correct to call the platform "supported".

baentsch avatar Jul 05 '23 08:07 baentsch

if no one is working on this id like to take it on

trigpolynom avatar Nov 15 '23 01:11 trigpolynom

if no one is working on this id like to take it on

That would be great, please give it a go!

dstebila avatar Nov 21 '23 19:11 dstebila

@baentsch @dstebila quick update on getting liboqs running on RISC-V. Was able to build and pass all tests in a RISC-V QEMU environment using the following commands:

cmake -DOQS_PERMIT_UNSUPPORTED_ARCHITECTURE=ON -DOQS_USE_OPENSSL=OFF -GNinja ..
ninja
ninja run_tests

The environment details:

isa		: rv64imafdc_zicntr_zicsr_zifencei_zihpm
mmu		: sv48

Distributor ID:	Ubuntu
Description:	Ubuntu 23.10
Release:	23.10
Codename:	mantic

trigpolynom avatar Dec 02 '23 17:12 trigpolynom

Was able to build and pass all tests in a RISC-V QEMU environment

Very nice! What's the runtime (edit: Meinung performance under emulation)? Amenable to adding to CI? Do you want to open a PR for that?

baentsch avatar Dec 02 '23 17:12 baentsch

Very nice! What's the runtime (edit: Meinung performance under emulation)? Amenable to adding to CI?

Currently, tests is taking wayyy too long (over 30 minutes) and several tests are being skipped which I want to look into further. Going to tweak environment parameters to see if I get get runtime much faster.

trigpolynom avatar Dec 02 '23 20:12 trigpolynom

Very nice! What's the runtime (edit: Meinung performance under emulation)? Amenable to adding to CI?

Currently, tests is taking wayyy too long (over 30 minutes) and several tests are being skipped which I want to look into further. Going to tweak environment parameters to see if I get get runtime much faster.

@baentsch @dstebila quick update on getting liboqs running on RISC-V. Was able to build and pass all tests in a RISC-V QEMU environment using the following commands:

cmake -DOQS_PERMIT_UNSUPPORTED_ARCHITECTURE=ON -DOQS_USE_OPENSSL=OFF -GNinja ..
ninja
ninja run_tests

The environment details:

isa		: rv64imafdc_zicntr_zicsr_zifencei_zihpm
mmu		: sv48

Distributor ID:	Ubuntu
Description:	Ubuntu 23.10
Release:	23.10
Codename:	mantic

Hi! I'd like to ask you some questions since i'm working on integrating a pqc signature into Keystone on RISC-V QEMU.

CarusoGiuseppe avatar Dec 04 '23 18:12 CarusoGiuseppe

Hi! I'd like to ask you some questions since i'm working on integrating a pqc signature into Keystone on RISC-V QEMU.

Sure! Feel free to email me at [email protected]

trigpolynom avatar Dec 04 '23 18:12 trigpolynom

Quick update on this issue. Tried to run liboqs in the same QEMU RISC-V but on a much more powerful EC2 instance as the host machine. Tests still take almost 40 minutes. I just ordered the SparkFun RED-V RedBoard - SiFive RISC-V FE310 SoC and will try and implement on actual hardware to get a more accurate understanding of the runtime. It will be interesting to compare to the liboqs TLS implementation expolored in this paper: Energy Consumption Evaluation of Post-Quantum TLS 1.3 for Resource-Constrained Embedded Devices

trigpolynom avatar Dec 12 '23 01:12 trigpolynom