Topic: RISC-V configuration

I've been using wolfCrypt v 4.3.0 on a custom MIPS core for several years now. I had a few issues with RSA to start but they were due to a malformatted private key. Once that was resolved, everything worked great. Now we have developed a RISC-V core (specifically rv32im/ilp32 -- this is a 32-bit, 32-register core with integer multiply / divide). RISC-V and MIPS are very close in architecture. I figured that these two cores are close enough that I could reuse the configuration file. That appears to not be the case. When I run my RSA tests both the encryption and decryption fail.

On RSA encryption, I am encrypting a 16-byte plain-text block to a 128-byte cipher-text block. The encryption seems to work identically to the MIPS but the block cannot be decrypted.

On RSA decryption, I am decrypting the encrypted 128-byte block. The decryption function fails with either "mp_exptmod error state" or "RSA buffer error, output too small or input too big".

I have the same code running in an MINGW64_NT-10.0-19042 / Unity Test / gcc (10.3.0) and in this test environment, everything works as expected. I can encrypt and decrypt without issue. Note this code emulates an internal random number generator, malloc/free, key structure, etc. It emulates the target environment as much as possible. They keys and the RNG have been verified to be correct.

I've attempted to move forward to use 4.8.1, but that doesn't work either. The one difference is that it fails in the Unity Test environment and the target environment.

I've gone over the manual and the configuration several times to try to work out what may be happening with no luck.

I've attached the code I'm running and sample output.

Post's attachments 8.45 kb, 1 downloads since 2021-08-27 

You don't have the permssions to download the attachments of this post.


Re: RISC-V configuration

Hello a7v7

Could you please send an email referencing this issue to ?

Kind regards,
Eric @ wolfSSL Support

Re: RISC-V configuration

Thanks Eric,

Will do.