Skip to content

Conversation

@mpg
Copy link
Contributor

@mpg mpg commented Nov 18, 2025

Description

In builds where MBEDTLS_RSA_NO_CRT is disabled, take advantage of the CRT when generating the initial value for base blinding.

Fixes #10476

PR checklist

mpg added 3 commits November 18, 2025 11:38
Will gain a new implementation using the CRT, so we want to hide the upcoming complexity in a dedicated function. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
Was only used in one place so far, but will be used in rsa_gen_rand_with_inverse()'s upcoming CRT-based implementation. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
@mpg mpg self-assigned this Nov 18, 2025
@mpg mpg added needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review labels Nov 20, 2025
@mpg mpg added the size-s Estimated task size: small (~2d) label Nov 20, 2025
@mpg mpg marked this pull request as ready for review November 20, 2025 08:45
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for nominal RSA keys, but I don't see why the CRT version would make a difference with respect to the number of retries to find a suitable blinding value.

I haven't run any benchmarks.

@gilles-peskine-arm gilles-peskine-arm added needs-work needs-backports Backports are missing or are pending review and approval. and removed needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review labels Nov 28, 2025
mpg added 3 commits December 3, 2025 11:26
Previously we were looping in one case but not even checking the other. Let's check both cases and error out immediately. The error path should never be taken in pratice anyway. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This only made the function harder to use. Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but the CI is unhappy about the NO_CRT code.

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
@mpg
Copy link
Contributor Author

mpg commented Dec 3, 2025

Ah, quite embarrassing, I didn't even build that config before pushing. Let me try again.

Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members, needs-ci Needs to pass CI tests needs-reviewer This PR needs someone to pick it up for review and removed needs-work labels Dec 3, 2025
@davidhorstmann-arm davidhorstmann-arm self-requested a review December 3, 2025 14:14
@mpg mpg removed needs-reviewer This PR needs someone to pick it up for review needs-ci Needs to pass CI tests labels Dec 4, 2025
@mpg mpg added the priority-high High priority - will be reviewed soon label Dec 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-backports Backports are missing or are pending review and approval. needs-review Every commit must be reviewed by at least two team members, priority-high High priority - will be reviewed soon size-s Estimated task size: small (~2d)

2 participants