-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add mbedtls_ssl_get_cipher_info() accessor #5417
Add mbedtls_ssl_get_cipher_info() accessor #5417
Conversation
Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com>
a59e0c8
to
d48260d
Compare
Follow-up from #5331 where @mpg wrote:
That is my thought, too, but I am not an expert in this area.
Ah, the joys of magic numbers vs (non-standard) human-readable strings. Thanks for pointing it out.
Yes for CGI variables RFC3875 The Common Gateway Interface (CGI) Version 1.1 No for SSL variables. Variables like SSL_CIPHER_ALGKEYSIZE and SSL_CIPHER_USEKEYSIZE likely did have significance at some point in the past. The same may be said for some other SSL_ variables. Still other SSL_ variables can be quite useful for backends implement policy checks on the same machine servicing requests where TLS is terminated in the web server.
That is a bit wasteful to look up a name, and then take the name to look up an id in a different table, when the first func operated with the id that is the result. (
Aside: given the naming convention for accessors, I might expect I'd prefer a single convenience routine (this PR) which gets the (const mbedtls_cipher_info_t *) for the session, and I can use the accessor I am ok with updating the lighttpd code to note that |
Yes,I was just trying to re-use the existing API. If I was designing that API from scratch today, it would probably look different. However, while it's indeed inefficient and feels wrong to first look up a string from a numerical identifier and then immediately loop up again the other way, in the grand scheme of things, this only happens after the handshake, which was way more resource consuming, so I'm not sure it's worth redesigning that part of the API for that now, especially as the natural name for a function that get the ciphersuite id from the context is already taken by a function which, as you note, does something different. (Perhaps in 4.0 we can clean that up. But for now existing functions have to stay as they are and we can only add new functions.)
Yes, I meant to suggest we add that function. Reading my message again, I did not make that clear at all, sorry.
At any other time that would indeed be the obvious right thing to do. But this is a special time: as I explained, we are phasing out the Cipher module (or at least as a first step, its usage from the TLS layer). We'd like, in some 3.x version of Mbed TLS, to be able to compile the TLS part with So, I would suggest:
Would that work for you? |
* | ||
* \return a cipher information structure | ||
*/ | ||
const mbedtls_cipher_info_t *mbedtls_ssl_get_cipher_info( const mbedtls_ssl_context *ssl ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately at this point exposing mbedtls_cipher
as part of the public SSL/TLS API is not compatible with our plans for migrating to PSA.
(I had labeled "enhancement" by mistake: this is a regression, because some useful information that was accessible before 3.0 is no longer conveniently accessible.) |
Thanks for repeating that. I had not grok'ed that I should also avoid Should I close this PR and create a new PR to discuss |
Prior art in ssl_ciphersuites.h suggests To obtain ciphersuite id from the ssl_context -- and with |
As an alternative name to |
Alternate proposal filed as PR #5428 and should replace this PR. |
Closing, replaced with #5428 |
Description
Add
mbedtls_ssl_get_cipher_info()
accessor for mbedtls 3.0This is a follow-up to an item in #5331
Status
READY
Requires Backporting
NO
Migrations
Yes: adds accessor to retrieve
(const mbedtls_cipher_info_t *)
from sessionTodos