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

rsa_sign example is not working #5419

Open
Oldes opened this issue Jan 12, 2022 · 1 comment · May be fixed by #8009
Open

rsa_sign example is not working #5419

Oldes opened this issue Jan 12, 2022 · 1 comment · May be fixed by #8009
Labels
bug good-first-issue Good for newcomers historical-reviewing Currently reviewing (for legacy PR/issues) size-s Estimated task size: small (~2d)

Comments

@Oldes
Copy link
Contributor

Oldes commented Jan 12, 2022

Summary

When trying rsa_sign.exe, I get this output:

  . Reading private key from rsa_priv.txt
  . Checking the private key
  . Generating the RSA/SHA-256 signature failed
  ! mbedtls_rsa_pkcs1_sign returned -0x4080

  + Press Enter to exit this program.

It is failing at this line:
https://github.com/ARMmbed/mbedtls/blob/d1d0b41fc0b9e3d4012ccf9796ef9e641079cea2/library/rsa.c#L1887
because of this check:
https://github.com/ARMmbed/mbedtls/blob/d1d0b41fc0b9e3d4012ccf9796ef9e641079cea2/library/rsa.c#L918-L919

I suppose, that there cannot be NULL for the random function here:
https://github.com/ARMmbed/mbedtls/blob/d1d0b41fc0b9e3d4012ccf9796ef9e641079cea2/programs/pkey/rsa_sign.c#L145-L146

NOTE:
It was tested with the version 3.1.0.

Oldes added a commit to Siskin-framework/mbedtls that referenced this issue Jan 12, 2022
@ronald-cron-arm
Copy link
Contributor

Thanks for reporting this issue. The documentation of mbedtls_rsa_pkcs1_sign says that the RNG function parameter is mandatory thus you are right, the call to it in rsa_sign.c is not correct.

@ronald-cron-arm ronald-cron-arm added bug good-first-issue Good for newcomers size-s Estimated task size: small (~2d) labels Jan 19, 2022
@tom-cosgrove-arm tom-cosgrove-arm added the historical-reviewing Currently reviewing (for legacy PR/issues) label Jan 27, 2023
@mprse mprse linked a pull request Jul 31, 2023 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug good-first-issue Good for newcomers historical-reviewing Currently reviewing (for legacy PR/issues) size-s Estimated task size: small (~2d)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants