Skip to content

Add 'sigalgs=' method for setting accepted signature algorithms#769

Closed
markus-jung-vivavis wants to merge 3 commits into
ruby:masterfrom
markus-jung-vivavis:add-sigalgs-support
Closed

Add 'sigalgs=' method for setting accepted signature algorithms#769
markus-jung-vivavis wants to merge 3 commits into
ruby:masterfrom
markus-jung-vivavis:add-sigalgs-support

Conversation

@markus-jung-vivavis

Copy link
Copy Markdown
Contributor

This adds OpenSSL::SSL::SSLContext#sigalgs= method and according unit tests to provide access to the OpenSSL SSL_CTX_set1_sigalgs_list() method. Using this method, the enabled/supported signature algorithms for client/server authentication can be configured.

@markus-jung-vivavis markus-jung-vivavis marked this pull request as draft June 17, 2024 15:18
This adds OpenSSL::SSL::SSLContext#sigalgs= method and according unit tests
to provide access to the OpenSSL SSL_CTX_set1_sigalgs_list() method.
Using this method, authentication signature algorithms can be configured.
@markus-jung-vivavis markus-jung-vivavis marked this pull request as ready for review June 17, 2024 15:48
Comment thread ext/openssl/ossl_ssl.c Outdated
SSL_CTX *ctx;

if (NIL_P(v))
return v;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Shouldn't ssl_ctx.sigalgs = nil be an error (i.e., do nothing and let StringValueCStr() raise TypeError)?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe yes, since one most likely did not expect this to be a no-op. I originally decided to implement it consistent to ctx.ciphersuites = nil, which also silently ignores an nil-Argument.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good catch... ctx.ciphersuites = nil doesn't seem right either.

Comment thread test/openssl/test_ssl.rb
Comment thread test/openssl/test_ssl.rb
Comment on lines +1754 to +1760
def test_sigalgs_method_valid_sigalgs
ssl_ctx = OpenSSL::SSL::SSLContext.new
pend 'sigalgs= method is missing' unless ssl_ctx.respond_to?(:sigalgs=)

ssl_ctx.freeze
assert_raise(FrozenError) { ssl_ctx.sigalgs = '"ECDSA+SHA256:RSA+SHA256"' }
end

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This seems unfinished - was it supposed to be the successful path?

There should be a test case that involves an actual TLS session with start_server.

Comment thread ext/openssl/extconf.rb
have_func("EVP_PKEY_check(NULL)", evp_h)
have_func("EVP_PKEY_new_raw_private_key(0, NULL, (unsigned char *)\"\", 0)", evp_h)
have_func("SSL_CTX_set_ciphersuites(NULL, \"\")", ssl_h)
have_func("SSL_CTX_set1_sigalgs(NULL, NULL, 0L)", ssl_h)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please check SSL_CTX_set1_sigalgs_list() (with _list) as it is the function used in ossl_ssl.c.

@junaruga

junaruga commented Jun 3, 2025

Copy link
Copy Markdown
Member

Hi @mj-vivavis, I hope you are doing well. Could you rebase this PR on the latest master branch and check the review comments? I want to see the support of the OpenSSL::SSL::SSLContext#sigalgs=. Thank you.

@rhenium

rhenium commented Jun 3, 2025

Copy link
Copy Markdown
Member

Please see #895

@rhenium rhenium closed this Jun 3, 2025
@junaruga

junaruga commented Jun 3, 2025

Copy link
Copy Markdown
Member

Please see #895

I would appreciate your work!

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.

3 participants