Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pluknet
Copy link
Contributor

@pluknet pluknet commented Oct 17, 2025

The variables contain an algorithm used in CertificateVerify signatures in the format of TLS SignatureScheme:

https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml

Requested by willmafh.

Closes #554


const char *name;

if (SSL_get0_signature_name(c->ssl->connection, &name)) {
Copy link
Contributor

@willmafh willmafh Oct 19, 2025

Choose a reason for hiding this comment

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

I was afraid that SSL_get0_signature_name returns empty string name, so I use SSL_get_peer_signature_type_nid instead, if it can't get string name, then the variables return digits string as a backup.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Both functions are accessors to the same SIGALG_LOOKUP structure, ultimately - an entry in lookup table combined from builtin and provider-added sigalgs.
Builtin sigalgs started to always have the name in OpenSSL 3.4 (38a7183102), preceding SSL_get0_signature_name() introduction.
Providers sigalgs have such requirement since its introduction (OSSL_CAPABILITY_TLS_SIGALG_IANA_NAME, ee58915cfd).
IOW, if there SIGALG_LOOKUP is found, it should contain both nid and name.

Copy link
Contributor

Choose a reason for hiding this comment

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

@pluknet But what if Nginx is built with openssl before SSL_get0_signature_name was introduced? These two variables just return empty string. It would be better to add a #else case when #ifdef SSL_get0_signature_name failed, and using SSL_get_signature_type_nid to implement the function. As you explained above, SSL_get0_signature_name will always return non-empty sigalg name, but I still prefer to check the return result, if it's empty, then it should try to return nid digits as a backup result, since there are many companies out there fork and maintain their own openssl implementation and it may not 100% fullfilling the requirements, when it happens, these two variables' result are meaningless since their result are empty.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it worth the effort.
SSL_get0_signature_name() was implemented in OpenSSL precisely for logging purpose, basically that's why it is used. See my previous explanation in #545 (review) for detailed reasoning.
Note that OpenSSL 3.5 is an LTS branch, it is quite reasonable to base new variables on this version.

The last argument I don't get, sorry.
If companies have resources to maintain OpenSSL forks, they certainly will be able for nginx.

@ghen2
Copy link

ghen2 commented Oct 20, 2025

Do you plan a $ssl_sigalgs (all signature algorithms advertised by the client, from SSL_get_sigalgs), in analogy to $ssl_ciphers and $ssl_curves?

This will be helpful during PQC certificate transition.

@willmafh
Copy link
Contributor

Do you plan a $ssl_sigalgs (all signature algorithms advertised by the client, from SSL_get_sigalgs), in analogy to $ssl_ciphers and $ssl_curves?

This will be helpful during PQC certificate transition.

@ghen2 @pluknet $ssl_sigalg and $ssl_client_sigalg was actually introduced when I handling handshakes involved PQC related stuff.

(uintptr_t) ngx_ssl_get_client_v_remain, NGX_STREAM_VAR_CHANGEABLE, 0 },

{ ngx_string("ssl_client_sigalg"), NULL, ngx_stream_ssl_variable,
(uintptr_t) ngx_ssl_get_sigalg, NGX_STREAM_VAR_CHANGEABLE, 0 },
Copy link
Contributor

Choose a reason for hiding this comment

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

ngx_ssl_get_client_sigalg ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, tnx.
I tested only http part, that's how it was missed

@arut
Copy link
Contributor

arut commented Oct 23, 2025

Regarding the commit log, I'd prefer the text from the docs, YMMV.

The variables contain the IANA name of the signature scheme[1] used to sign the TLS handshake.

[1] https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml

Variables contain the IANA name of the signature scheme[1] used to sign
the TLS handshake.

Variables are only meaningful when using OpenSSL 3.5 and above, with older
versions they are empty.  Moreover, since this data isn't stored in a
serialized session, variables are only available for new sessions.

[1] https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml

Requested by willmafh.
@pluknet
Copy link
Contributor Author

pluknet commented Oct 24, 2025

Regarding the commit log, I'd prefer the text from the docs, YMMV.

The variables contain the IANA name of the signature scheme[1] used to sign the TLS handshake.

[1] https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml

Applied, thanks.

Wording was roughly taken from https://datatracker.ietf.org/doc/html/rfc8446#section-4.2.3
while you suggest to use it from OpenSSL docs.
Both suffer from vagueness to some extent (IMHO) though I don't have a strong opinion on this point.

Copy link
Contributor

@arut arut left a comment

Choose a reason for hiding this comment

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

Looks ok.

@pluknet pluknet merged commit 71f8eb5 into nginx:master Oct 24, 2025
2 checks passed
@pluknet pluknet deleted the sigalgs-var branch October 24, 2025 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

new ssl variables about signature algorithms used in tls handshake

4 participants