Skip to content

Expose operations for RSA flags #2345

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

notgull
Copy link

@notgull notgull commented Jan 6, 2025

This commit adds the functions needed to manipulate the flags on the RSA object. These flags are not used in normal SSL as far as I know, but are used by custom providers/engines to change some functionality. The functions I've added are as follows:

  • RSA_test_flags
  • RSA_set_flags
  • RSA_clear_flags

Since these operations are not available on OpenSSL 1.0.2 or earlier, I've also added shims that allow one to directly manipulate the "flags" variable on these older versions.

This patch is made on behalf of Marvell Technology Inc.

@notgull notgull force-pushed the flags branch 5 times, most recently from 61c2791 to e7e355b Compare January 7, 2025 22:47
This commit adds the functions needed to manipulated the flags on the
RSA object. These flags are not used in normal SSL as far as I know, but
are used by custom providers/engines to change some functionality. The
functions I've added are as follows:

- RSA_test_flags
- RSA_set_flags
- RSA_clear_flags

Since these operations are not available on OpenSSL 1.0.2 or earlier,
I've also added shims that allow one to directly manipulate the "flags"
variable on these older versions.

This patch is made on behalf of Marvell Technology Inc.

Signed-off-by: John Nunley <[email protected]>
@notgull
Copy link
Author

notgull commented Aug 5, 2025

@alex @sfackler Any chance this can be reviewed?

@alex
Copy link
Collaborator

alex commented Aug 5, 2025

Sorry for the delay.

I'm not sure this is sound: Rsas are reference counted objects, which means multiple can exist with the same pointer. As a result, I don't think mutation operations are sound on them?

@notgull
Copy link
Author

notgull commented Aug 7, 2025

Do you think it would be sound if we did this during the RSA creation process? Like if we had a builder for the struct?

@alex
Copy link
Collaborator

alex commented Aug 7, 2025 via email

@notgull
Copy link
Author

notgull commented Aug 7, 2025

At the moment we're just using a extern "C" block to call the C equivalent of this function. I'm fine sticking with that if this PR conflicts with other open design decisions.

@alex
Copy link
Collaborator

alex commented Aug 7, 2025

More like conflicts with other design frustrations 🙃

If you want to have this PR do the test_flags + add ghe handwritten bindings, and then you can do the unsafe call in your own codebase, that works.

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

Successfully merging this pull request may close these issues.

2 participants